mizuho 0.9.10 → 0.9.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. data/README.markdown +18 -2
  2. data/asciidoc/BUGS +3 -6
  3. data/asciidoc/BUGS.txt +0 -3
  4. data/asciidoc/CHANGELOG +660 -397
  5. data/asciidoc/CHANGELOG.txt +237 -2
  6. data/asciidoc/INSTALL +14 -14
  7. data/asciidoc/MANIFEST +2 -0
  8. data/asciidoc/Makefile.in +9 -1
  9. data/asciidoc/README +2 -2
  10. data/asciidoc/a2x.py +101 -43
  11. data/asciidoc/asciidoc.conf +18 -11
  12. data/asciidoc/asciidoc.py +615 -260
  13. data/asciidoc/common.aap +2 -2
  14. data/asciidoc/configure +9 -9
  15. data/asciidoc/configure.ac +1 -1
  16. data/asciidoc/doc/a2x.1 +34 -4
  17. data/asciidoc/doc/a2x.1.txt +12 -0
  18. data/asciidoc/doc/article.pdf +0 -0
  19. data/asciidoc/doc/asciidoc.1 +73 -29
  20. data/asciidoc/doc/asciidoc.1.txt +56 -30
  21. data/asciidoc/doc/asciidoc.dict +23 -2
  22. data/asciidoc/doc/asciidoc.txt +468 -327
  23. data/asciidoc/doc/book.epub +0 -0
  24. data/asciidoc/doc/faq.txt +201 -25
  25. data/asciidoc/doc/latex-filter.pdf +0 -0
  26. data/asciidoc/doc/music-filter.pdf +0 -0
  27. data/asciidoc/doc/publishing-ebooks-with-asciidoc.txt +1 -1
  28. data/asciidoc/doc/source-highlight-filter.pdf +0 -0
  29. data/asciidoc/doc/source-highlight-filter.txt +48 -37
  30. data/asciidoc/docbook45.conf +4 -4
  31. data/asciidoc/examples/website/ASCIIMathML.js +938 -0
  32. data/asciidoc/examples/website/CHANGELOG.txt +3056 -0
  33. data/asciidoc/examples/website/INSTALL.txt +227 -0
  34. data/asciidoc/examples/website/LaTeXMathML.js +1223 -0
  35. data/asciidoc/examples/website/README-website.txt +29 -0
  36. data/asciidoc/examples/website/README.txt +35 -0
  37. data/asciidoc/examples/website/a2x.1.txt +358 -0
  38. data/asciidoc/examples/website/asciidoc-docbook-xsl.txt +65 -0
  39. data/asciidoc/examples/website/asciidoc-graphviz-sample.txt +170 -0
  40. data/asciidoc/examples/website/asciidoc.css +533 -0
  41. data/asciidoc/examples/website/asciidoc.js +189 -0
  42. data/asciidoc/examples/website/asciidocapi.txt +189 -0
  43. data/asciidoc/examples/website/asciimathml.txt +61 -0
  44. data/asciidoc/examples/website/build-website.sh +25 -0
  45. data/asciidoc/examples/website/customers.csv +18 -0
  46. data/asciidoc/examples/website/epub-notes.txt +210 -0
  47. data/asciidoc/examples/website/faq.txt +1298 -0
  48. data/asciidoc/examples/website/index.txt +502 -0
  49. data/asciidoc/examples/website/latex-backend.txt +192 -0
  50. data/asciidoc/examples/website/latex-bugs.txt +134 -0
  51. data/asciidoc/examples/website/latex-filter.txt +196 -0
  52. data/asciidoc/examples/website/latexmathml.txt +41 -0
  53. data/asciidoc/examples/website/layout1.conf +153 -0
  54. data/asciidoc/examples/website/layout1.css +65 -0
  55. data/asciidoc/examples/website/layout2.conf +153 -0
  56. data/asciidoc/examples/website/layout2.css +83 -0
  57. data/asciidoc/examples/website/main.aap +159 -0
  58. data/asciidoc/examples/website/manpage.txt +197 -0
  59. data/asciidoc/examples/website/music-filter.txt +148 -0
  60. data/asciidoc/examples/website/newlists.txt +40 -0
  61. data/asciidoc/examples/website/newtables.txt +743 -0
  62. data/asciidoc/examples/website/plugins.txt +91 -0
  63. data/asciidoc/examples/website/publishing-ebooks-with-asciidoc.txt +398 -0
  64. data/asciidoc/examples/website/slidy-example.txt +167 -0
  65. data/asciidoc/examples/website/slidy.txt +113 -0
  66. data/asciidoc/examples/website/source-highlight-filter.txt +239 -0
  67. data/asciidoc/examples/website/support.txt +5 -0
  68. data/asciidoc/examples/website/testasciidoc.txt +231 -0
  69. data/asciidoc/examples/website/userguide.txt +5991 -0
  70. data/asciidoc/examples/website/version83.txt +37 -0
  71. data/asciidoc/examples/website/xhtml11-quirks.css +43 -0
  72. data/asciidoc/filters/latex/latex2png.py +28 -12
  73. data/asciidoc/filters/music/music2png.py +22 -6
  74. data/asciidoc/filters/source/source-highlight-filter.conf +7 -5
  75. data/asciidoc/help.conf +147 -131
  76. data/asciidoc/html4.conf +1 -0
  77. data/asciidoc/html5.conf +37 -39
  78. data/asciidoc/javascripts/asciidoc.js +3 -3
  79. data/asciidoc/lang-de.conf +4 -0
  80. data/asciidoc/lang-es.conf +2 -0
  81. data/asciidoc/lang-fr.conf +1 -1
  82. data/asciidoc/lang-hu.conf +2 -0
  83. data/asciidoc/lang-it.conf +2 -0
  84. data/asciidoc/lang-nl.conf +5 -0
  85. data/asciidoc/lang-pt-BR.conf +2 -0
  86. data/asciidoc/lang-ru.conf +2 -3
  87. data/asciidoc/latex.conf +2 -2
  88. data/asciidoc/slidy.conf +4 -2
  89. data/asciidoc/stylesheets/asciidoc.css +29 -4
  90. data/asciidoc/stylesheets/docbook-xsl.css +12 -5
  91. data/asciidoc/stylesheets/toc2.css +1 -0
  92. data/asciidoc/stylesheets/xhtml11-quirks.css +1 -1
  93. data/asciidoc/tests/data/lang-de-man-test.txt +21 -0
  94. data/asciidoc/tests/data/lang-en-man-test.txt +21 -0
  95. data/asciidoc/tests/data/lang-es-man-test.txt +21 -0
  96. data/asciidoc/tests/data/lang-fr-man-test.txt +21 -0
  97. data/asciidoc/tests/data/lang-hu-man-test.txt +21 -0
  98. data/asciidoc/tests/data/lang-it-man-test.txt +21 -0
  99. data/asciidoc/tests/data/lang-it-test.txt +106 -0
  100. data/asciidoc/tests/data/lang-nl-man-test.txt +21 -0
  101. data/asciidoc/tests/data/lang-pt-BR-man-test.txt +21 -0
  102. data/asciidoc/tests/data/lang-ru-man-test.txt +21 -0
  103. data/asciidoc/tests/data/lang-uk-man-test.txt +21 -0
  104. data/asciidoc/tests/data/testcases.conf +10 -0
  105. data/asciidoc/tests/data/testcases.txt +40 -0
  106. data/asciidoc/tests/testasciidoc.conf +143 -17
  107. data/asciidoc/tests/testasciidoc.py +11 -2
  108. data/asciidoc/{stylesheets → themes/flask}/flask.css +0 -0
  109. data/asciidoc/{stylesheets → themes/volnitsky}/volnitsky.css +1 -1
  110. data/asciidoc/vim/ftdetect/asciidoc_filetype.vim +1 -1
  111. data/asciidoc/vim/syntax/asciidoc.vim +1 -1
  112. data/asciidoc/xhtml11-quirks.conf +2 -2
  113. data/asciidoc/xhtml11.conf +35 -37
  114. data/lib/mizuho.rb +1 -1
  115. data/lib/mizuho/generator.rb +3 -1
  116. data/source-highlight/darwin/source-highlight +0 -0
  117. data/templates/juvia.js +30 -5
  118. metadata +58 -9
  119. data/asciidoc/stylesheets/asciidoc-manpage.css +0 -18
  120. data/asciidoc/stylesheets/flask-manpage.css +0 -1
  121. data/asciidoc/stylesheets/volnitsky-manpage.css +0 -1
@@ -0,0 +1,192 @@
1
+ LaTeX backend for Asciidoc
2
+ ==========================
3
+ Benjamin Klum <benjamin.klum@gmail.com>
4
+ v1.0, June 2006
5
+
6
+ == Introduction
7
+
8
+
9
+ LaTeX backend is a configuration file for Stuart Rackham's http://www.methods.co.nz/asciidoc/[Asciidoc]. It generates high-level LaTeX markup from Asciidoc documents. LaTeX is a document preparation system for TeX which in turn is a popular typesetting system. It is well known for producing excellently typesetted high quality printouts, especially suited for scientific text.
10
+
11
+ == Tutorial
12
+ Getting a ready-to-print document from an Asciidoc document using the LaTeX backend involves at least two steps:
13
+
14
+ 1. Conversion of the Asciidoc document into a LaTeX document (this is done by Asciidoc using the LaTeX backend)
15
+ 2. Conversion of the LaTeX document into a PDF document (this is done by the TeX system)
16
+
17
+ Try to create a PDF document from the Asciidoc document `article.txt` which resides in the `doc` directory of Asciidoc:
18
+
19
+ .. Make a copy of `article.txt` in a directory of your choice, let's call it `latex-test`.
20
+ .. Make sure that all images referenced in `article.txt` exist in `latex-test`. Brute force approach: Copy the whole `images` directory from Asciidoc directory into `latex-test`.
21
+ .. Change directory to `latex-test` and type following commands:
22
+ +
23
+ asciidoc --unsafe --backend=latex article.txt
24
+ pdflatex article.tex
25
+ +
26
+ .. Now there should be a file `article.pdf` in the `latex-test` directory.
27
+
28
+ [IMPORTANT]
29
+ ==============================
30
+ - Asciidoc has to be started in 'unsafe mode' when using LaTeX backend.
31
+ - Note that some special LaTeX packages are necessary, see <<packageRequirements,here>>.
32
+ ==============================
33
+
34
+ == General notes
35
+
36
+ === Quality of LaTeX output
37
+ High-level LaTeX is not very straightforward to generate. Therefore there's no guarantee that the generated output is valid and compiles successfully. At all, this backend should be considered as rather experimental. You should have been already in touch with LaTeX in order to use the backend effectively because LaTeX compilation errors can be really nasty.
38
+
39
+ Nevertheless good results can be achieved by using LaTeX backend. Try for example to compile Stuart Rackham's Asciidoc documentation, a rather large document. It should compile without problems. However, the code filter might have to be reconfigured for the code filter example to work.
40
+
41
+ === Configuration file customization
42
+ Like every other Asciidoc backend the LaTeX backend can be customized easily to fit the user's needs. Actually it is very important to have this option since LaTeX doesn't have a companion language like CSS which allows to put styling information in a separate file. Read more about the LaTeX backend configuration file <<configurationFile,here>>.
43
+
44
+ === Output optimization
45
+ The LaTeX output is optimized for creating PDF documents using 'pdflatex'.
46
+
47
+ [[unicodeSupport]]
48
+ === Unicode support
49
+ Unfortunately TeX/LaTeX does not have native unicode support. The package 'ucs' adds elementary unicode support by introducing UTF-8 input encoding recognition and by defining lookup tables which contain the corresponding LaTeX commands for unicode characters. But these lookup tables are far from being complete. When a unicode character is found which is not defined in the lookup tables an error is raised by the TeX/LaTeX compiler. Note that TeX/LaTeX compilation errors caused by missing unicode character definitions are not fatal, that means the result is probably readable but undefined unicode characters are replaced with `[U+...]`. You may (de)activate the recognition of escaped unicode characters. See the <<latex-recognize-escaped-unicode>> backend option.
50
+
51
+ == Backend specific features
52
+
53
+ === Special sections
54
+
55
+ LaTeX backend supports the following special sections and replaces them with corresponding LaTeX commands or environments:
56
+
57
+ - Abstract (only for document type 'article')
58
+ - Dedication (only for document type 'book')
59
+ - Index
60
+ - Bibliography (only when the attribute 'latex-use-bibliography-environment' is set)
61
+ - Appendix
62
+ - Contents
63
+
64
+ [[internalCrossReferences]]
65
+ === Internal cross references
66
+
67
+ Macros for internal cross references have been extended by the attribute 'style'.
68
+
69
+ xref:<id>[<caption>, style=<style>]
70
+
71
+ or
72
+
73
+ <<<id>,<caption>,<style>>>
74
+
75
+
76
+ The additional attribute 'style' can have following values:
77
+
78
+ page::
79
+ Let's LaTeX print the page number of the referenced anchor.
80
+
81
+ ref::
82
+ Let's LaTeX print the number of the section, subsection, figure, table or theorem the referenced anchor resides.
83
+
84
+ autoref::
85
+ Let's LaTeX print the number of the section, subsection, figure, table or theorem the referenced anchor resides preceded with a contextual label.
86
+
87
+ cite::
88
+ Let's LaTeX interprete this reference as a reference to a bibliography entry. If the attribute 'latex-use-bibliography-environment' is set, references with 'cite' style as well as their corresponding bibliography anchors are presented as automatically generated numbers.
89
+
90
+ If the 'style' attribute is not set the reference is printed the common way.
91
+
92
+
93
+ === Options
94
+ LaTeX document generation is influenced by the following attributes:
95
+
96
+ latex-table-rowlimit::
97
+ The maximum number of rows for typesetting tables using the 'tabular' environment. If a table has more rows than 'latex-table-rowlimit', 'longtable' environment is used instead of 'tabular' environment. 'longtable' environment supports tables spanning over several pages.
98
+
99
+ latex-use-bibliography-environment::
100
+ If 'latex-use-bibliography-environment' is defined, 'thebibliography' environment is used for the bibliography section. As a result bibliography entries are automatically numbered. Note that this works only if the bibliography section contains exclusively bibliography list items which start with a bibliography entry ([[[...]]]). Otherwise a TeX/LaTeX compilation error will occur. In order to display bibliography references correctly their 'style' attribute must be set to 'cite'. For more information see <<internalCrossReferences,Internal cross references>>.
101
+
102
+ latex-indent-paragraphs::
103
+ If 'latex-indent-paragraphs' is defined, the first line of paragraphs will be indented. By default LaTeX backend prevents paragraph indentation and prints paragraphs with preceding vertical space.
104
+
105
+ [[latex-recognize-escaped-unicode]] latex-recognize-escaped-unicode::
106
+ If 'latex-recognize-escaped-unicode' is defined, escaped unicode
107
+ characters (e.g. `\$${amp}#960;$$` or `\$${amp}#x3C0;$$`) will be recognized. This can lead to LaTeX compilation errors since LaTeX unicode support is only rudimentary. For more information see <<unicodeSupport, Unicode support>>.
108
+
109
+ latex-use-custom-list-items::
110
+ If 'latex-use-custom-list-items' is defined, lists will be bulleted or enumerated the way you have typed them in the original Asciidoc document. That means, `*` turns into a circle bullet, `-` turns into a dash, `.` turns into a number and `..` turns into a letter. Otherwise LaTeX will use different bullets and enumeration characters depending on the level of nesting.
111
+
112
+ latex-use-colored-tables::
113
+ If 'latex-use-colored-tables' is defined, tables will be printed colored.
114
+
115
+ latex-use-running-title-headings::
116
+ If 'latex-use-running-title-headings' is defined, 'pagestyle' will be set to 'headings' which results in running titles in the head.
117
+
118
+ latex-use-colored-sidebar-blocks::
119
+ If 'latex-use-colored-sidebar-blocks' is defined, sidebar block content will be put in a color box instead of being indented by a vertical bar.
120
+
121
+ icons::
122
+ Link admonition paragraph and admonition block icon images and badge images. By default icons is undefined and text is used in place of icon images.
123
+
124
+ encoding::
125
+ Set the input and output document character set encoding. Currently `ISO-8859-1` and `UTF-8` are supported.
126
+
127
+ == Requirements
128
+
129
+ === General
130
+
131
+ The following software is necessary for using the LaTeX backend:
132
+
133
+ - An up-to-date version of http://www.methods.co.nz/asciidoc/[Asciidoc]
134
+ - An up-to-date TeX distribution, e.g.:
135
+ * http://www.miktex.org/[MiKTeX] for Windows
136
+ * http://www.tug.org/tetex/[teTeX] for Linux
137
+
138
+ [[packageRequirements]]
139
+ === TeX/LaTeX Package requirements
140
+
141
+ LaTeX backend makes use of some LaTeX specialities which don't belong to a minimal TeX/LaTeX distribution. However, I took special care not to employ exotic packages. Hence the following packages should be available in most package repositories. The table is not complete yet because I don't know the package names for all TeX distributions.
142
+
143
+ [cols="4*,4",options="header"]
144
+ |====================================================================
145
+ |Speciality | MiKTeX package name | teTeX package name | TeX Live package name | Description
146
+ |KOMA-Script | koma-script | | | LaTeX backend uses the document classes 'scrartcl' and 'scrbook' as well as some other specialities defined in the 'KOMA-Script' package, e.g. the commands `\addmargin{}` and `\minisec{}`.
147
+ |xcolor.sty | xcolor | | | Used to produce colored boxes and tables.
148
+ |colortbl.sty | colortbl | | | Used to produce colored tables.
149
+ |type1ec.sty | cm-super | | | Enables high quality fonts for PDF output.
150
+ |hyperref.sty | hyperref | | | Extensive support for hypertext in PDF documents.
151
+ |enumerate.sty | tools | | | When 'latex-use-custom-list-items' is defined this package is used for determining the enumeration character.
152
+ |graphicx.sty | graphics | | | Used for including images.
153
+ |longtable.sty | tools | | | Enables page spanning tables.
154
+ |ucs.sty | unicode | | | Enables support for unicode characters.
155
+ |textcomp | ltxbase | | | Used for printing various symbols like arrows. Should be already installed.
156
+ |alltt | ltxbase | | | Used in literal-like blocks for retaining line and whitespace formatting. Should be already installed.
157
+ |listings.sty | listings | | | Used for listing blocks.
158
+ |====================================================================
159
+
160
+ [[configurationFile]]
161
+ == About the LaTeX backend configuration file
162
+ An important note for people who want to adapt the LaTeX backend configuration file to their own needs:
163
+
164
+ LaTeX markup has a lot of special characters, most importantly ``, `{`, `}`. In order to make things less complicated, I changed the default substitution order (see entry 'subsnormal' in the `[miscellaneous]` section). In contrast to the backends 'docbook' and 'xhtml11', the 'specialcharacters' substitution is applied very late. As a result all special characters produced by 'quotes', 'specialwords', 'replacements', 'attributes' and 'macros' become escaped at the end. If you don't want special characters in the corresponding sections to get escaped, you've to use following symbols instead of the special characters.
165
+
166
+ - `\$$!..backslash..!$$` instead of ``
167
+ - `\$$!..braceleft..!$$` instead of `{`
168
+ - `\$$!..braceright..!$$` instead of `}`
169
+
170
+
171
+ For more special characters take a look in the `[replacements2]` sections. `[replacements2]` section is responsible for replacing the symbols with their corresponding special characters.
172
+
173
+
174
+ == Ideas
175
+
176
+ === Code listing block
177
+
178
+ For creating highlighted code listings I suggest the use of http://www.andre-simon.de/[Highlight] or http://www.gnu.org/software/src-highlite/[GNU Source Highlight]. Both are suited for use as Asciidoc filters.
179
+
180
+ == Known Bugs
181
+
182
+ - Sometimes LaTeX backend handles things differently from the default backends
183
+ - A lot of little bugs
184
+
185
+ == Todo List
186
+
187
+ - Remove bugs
188
+ - Support for 'grid' attribute in tables
189
+ - Better looking tables
190
+ - Option for squeezing output (smaller lists)
191
+ - Support for different languages (That would be a nice feature for Asciidoc in general)
192
+ - Option for switching titlepage on and off
@@ -0,0 +1,134 @@
1
+ Bugs in asciidoc latex backend
2
+ ==============================
3
+ Geoff Eddy
4
+
5
+ Benjamin Klum was unable to maintain the LaTeX backend beyond version
6
+ 8.2.7, and as a consequence the `latex.conf` file ceased to work with
7
+ `asciidoc` sometime after this. For version 8.4.3 I made some changes
8
+ to the file to get it working again. This document summarises the
9
+ remaining issues which I have found with generating LaTeX and thence
10
+ PDF output with `asciidoc`, which is done as follows:
11
+
12
+ - `asciidoc --backend=latex --unsafe FILE.txt`
13
+ - `latex FILE.tex`
14
+ - `kpdf FILE.pdf`
15
+
16
+ Many of these were found by processing the `asciidoc.txt` file and
17
+ comparing the HTML output with the PDF.
18
+
19
+ == Footnotes
20
+
21
+ Priority:: Low.
22
+
23
+ Problem:: References to footnotes, and a sensible value for the
24
+ `[footnoteref-inlinemacro]` section, don't seem to be possible.
25
+
26
+ Cause:: LaTeX doesn't support footnoting much beyond creating a
27
+ footnote at a certain point in text and displaying the footnote
28
+ itself.
29
+
30
+ Solution:: Unclear. How important or necessary is this, anyway?
31
+
32
+ == Spurious text at starts of paragraphs
33
+
34
+ Priority:: Medium
35
+
36
+ Problem:: It is necessary to insert spurious text in paragraphs.
37
+
38
+ Cause:: This `asciidoc` input:
39
+ +
40
+ -------------------------------------------------------------------
41
+ Text
42
+ -------------------------------------------------------------------
43
+ +
44
+ generates this LaTeX code:
45
+ +
46
+ \begin{lstlisting}
47
+ SPURIOUS TEXTText\end{lstlisting}
48
+ +
49
+ which should be:
50
+ +
51
+ \begin{lstlisting}[]
52
+ Text\end{lstlisting}
53
+
54
+ Solution:: Find out a way to generate the correct LaTeX output as
55
+ above. The obvious solution, as explained in `latet.conf`, doesn't
56
+ work.
57
+
58
+ == Tables
59
+
60
+ Priority:: Rather high.
61
+
62
+ Problem:: Not all of the table configuration options can be passed
63
+ through to the LaTeX backend. In particular, I've had to assume that
64
+ all tables will be fifteen or fewer left-justified columns wide.
65
+
66
+ Cause:: The table models in LaTeX and HTML are too dissimilar for one
67
+ `asciidoc` specification to generate valid output in both formats by
68
+ simple regexp replacement. Related to this is the unfortunate fact
69
+ that `<COLGROUP>` and related tags aren't a required part of HTML4,
70
+ and some broswers (at least Firefox and Konqueror) don't implement
71
+ them.
72
+
73
+ Solution:: Perhaps table processing could be handled by a Python
74
+ plugin, which would read in a table spec and generate the appropriate
75
+ text?
76
+
77
+ == Unicode escaping
78
+
79
+ Priority:: Rather high, to me at least.
80
+
81
+ Problem:: The commented-out section in `latex.conf`, if uncommented,
82
+ converts `&#960;` to `\unichar{960}`, which then causes LaTeX to
83
+ complain that the resulting command is unavailable in encoding T1. The
84
+ more common non-ASCII characters, such as those in `félicité` and
85
+ `świeca`, are handled properly, but some - such as the IPA characters
86
+ in the `tipa` package - are not.
87
+
88
+ Cause:: The encodings in the LaTeX output are wrong.
89
+
90
+ Solution:: Correct the encodings.
91
+
92
+ == Text colours
93
+
94
+ Priority:: Probably low
95
+
96
+ Problem:: The text colour options are not processed by LaTeX; for
97
+ example `[#ff0000]#Red text#` is not rendered in red.
98
+
99
+ Cause:: LaTeX and HTML represent RGB triads differently: HTML is happy
100
+ with `#ff8000`, but LaTeX needs `[rgb]{1,0.5,0}`.
101
+
102
+ Solution:: Provide some sort of internal RGB conversion mechanism
103
+ which can convert RGB triads to different representations.
104
+
105
+ == Text sizes
106
+
107
+ Priority:: Probably low
108
+
109
+ Problem:: The text size options are not processed by LaTeX:
110
+ `[,,1]#text#` is rendered in the same size as normal text.
111
+
112
+ Cause:: HTML size tags - `h1` through `h7` - are directly derivable
113
+ from the size number, whereas LaTeX has a series of descriptive words
114
+ (`HUGE` through `normalsize` to `scriptsize`).
115
+
116
+ Solution:: Provide a way to treat the number as an index into an
117
+ array.
118
+
119
+ == Background colour in paragraphs
120
+
121
+ Priority:: Medium
122
+
123
+ Problem:: If the `backgroundcolor` attribute is specified in the
124
+ `lstset` command, all paragraphs are displayed as black rectangles by
125
+ `kpdf`, `xpdf`, and `evince`, although `kdvi` has no problems. I've
126
+ had to remove the attribute, and so paragraphs all appear on white
127
+ backgrounds. The PDF viewers also complain:
128
+
129
+ Error (NNNN): Unknown operator 'rgb'
130
+
131
+ Cause:: Apparently a known bug in the output of `pdflatex`. Not a bug
132
+ in `asciidoc`.
133
+
134
+ Solution:: Wait until this bug is fixed?
@@ -0,0 +1,196 @@
1
+ LaTeX Filter
2
+ ============
3
+
4
+ :blogpost-status: published
5
+ :blogpost-doctype: article
6
+ :blogpost-posttype: page
7
+ :blogpost-categories: AsciiDoc,LaTeX,python
8
+
9
+ The AsciiDoc distribution includes a LaTeX filter that translates
10
+ LaTeX source to PNG image which is automatically inserted into the
11
+ AsciiDoc output document. Although it can accept any LaTeX source, the
12
+ primary use is to render mathematical formulae (see the examples
13
+ below). The filter implements the 'latex' Listing block and Paragraph
14
+ styles.
15
+
16
+ This LaTeX paragraph:
17
+
18
+ [listing]
19
+ .....................................................................
20
+ [latex]
21
+ $y = \int_0^\infty \gamma^2 \cos(x) dx$
22
+ .....................................................................
23
+
24
+ Renders:
25
+
26
+ [latex]
27
+ $y = \int_0^\infty \gamma^2 \cos(x) dx$
28
+
29
+ This LaTeX block:
30
+
31
+ [listing]
32
+ .....................................................................
33
+ ["latex","latex1.png",align="center"]
34
+ ---------------------------------------------------------------------
35
+ $\displaystyle{ V_i = C_0 - C_3
36
+ \frac{C_1\cos(\theta_i+C_3)}{C_4+C_1\cos(\theta_i+C_2)} }$
37
+ ---------------------------------------------------------------------
38
+ .....................................................................
39
+
40
+ Renders:
41
+
42
+ ["latex","latex1.png",align="center"]
43
+ ---------------------------------------------------------------------
44
+ $\displaystyle{ V_i = C_0 - C_3
45
+ \frac{C_1\cos(\theta_i+C_3)}{C_4+C_1\cos(\theta_i+C_2)} }$
46
+ ---------------------------------------------------------------------
47
+
48
+ This LaTeX block:
49
+
50
+ [listing]
51
+ .....................................................................
52
+ .LaTeX filter example
53
+ [latex]
54
+ ["latex","latex3.png"]
55
+ ---------------------------------------------------------------------
56
+ \begin{equation}
57
+ \Re{z} =\frac{n\pi \dfrac{\theta +\psi}{2}}{
58
+ \left(\dfrac{\theta +\psi}{2}\right)^2 + \left( \dfrac{1}{2}
59
+ \log \left\lvert\dfrac{B}{A}\right\rvert\right)^2}.
60
+ \end{equation}
61
+
62
+ \begin{equation}
63
+ \boxed{\eta \leq C(\delta(\eta) +\Lambda_M(0,\delta))}
64
+ \end{equation}
65
+
66
+ \begin{equation}\label{first}
67
+ a=b+c
68
+ \end{equation}
69
+
70
+ \begin{subequations}\label{grp}
71
+ \begin{align}
72
+ a&=b+c\label{second}\\
73
+ d&=e+f+g\label{third}\\
74
+ h&=i+j\label{fourth}
75
+ \end{align}
76
+ \end{subequations}
77
+ ---------------------------------------------------------------------
78
+ .....................................................................
79
+
80
+ Renders:
81
+
82
+ .LaTeX filter example
83
+ [latex]
84
+ ---------------------------------------------------------------------
85
+ \begin{equation}
86
+ \Re{z} =\frac{n\pi \dfrac{\theta +\psi}{2}}{
87
+ \left(\dfrac{\theta +\psi}{2}\right)^2 + \left( \dfrac{1}{2}
88
+ \log \left\lvert\dfrac{B}{A}\right\rvert\right)^2}.
89
+ \end{equation}
90
+
91
+ \begin{equation}
92
+ \boxed{\eta \leq C(\delta(\eta) +\Lambda_M(0,\delta))}
93
+ \end{equation}
94
+
95
+ \begin{equation}\label{first}
96
+ a=b+c
97
+ \end{equation}
98
+
99
+ \begin{subequations}\label{grp}
100
+ \begin{align}
101
+ a&=b+c\label{second}\\
102
+ d&=e+f+g\label{third}\\
103
+ h&=i+j\label{fourth}
104
+ \end{align}
105
+ \end{subequations}
106
+ ---------------------------------------------------------------------
107
+
108
+ This LaTeX paragraph:
109
+
110
+ [listing]
111
+ .....................................................................
112
+ .A LaTeX table
113
+ [latex]
114
+ \begin{tabular}{c r @{.} l}
115
+ Pi expression &
116
+ \multicolumn{2}{c}{Value} \\
117
+ \hline
118
+ $\pi$ & 3&1416 \\
119
+ $\pi^{\pi}$ & 36&46 \\
120
+ $(\pi^{\pi})^{\pi}$ & 80662&7 \\
121
+ \end{tabular}
122
+ .....................................................................
123
+
124
+ Renders:
125
+
126
+ .A LaTeX table
127
+ [latex]
128
+ \begin{tabular}{c r @{.} l}
129
+ Pi expression &
130
+ \multicolumn{2}{c}{Value} \\
131
+ \hline
132
+ $\pi$ & 3&1416 \\
133
+ $\pi^{\pi}$ & 36&46 \\
134
+ $(\pi^{\pi})^{\pi}$ & 80662&7 \\
135
+ \end{tabular}
136
+
137
+
138
+ Using the Filter
139
+ ----------------
140
+ - The LaTeX filter is invoked by setting the Listing block or
141
+ Paragraph style (the first positional block attribute) to 'latex'.
142
+ - The second positional attribute (named 'target' is optional, it sets
143
+ the name of the generated PNG image file. If this is not supplied a
144
+ file name like `{docname}__{target-number}.png` is synthesised
145
+ (where `{docname}` is the document file name and `{target-number}`
146
+ is an integer number.
147
+ - The third positional attribute, named 'dpi', is also optional; it is
148
+ an integer number that sets the output resolution in dots per inch.
149
+
150
+ Because the LaTeX images are rendered using the image block templates
151
+ you can also use the optional named image block attributes (see
152
+ link:userguide.html#X55[Image macro attributes] in the AsciiDoc User
153
+ Guide).
154
+
155
+ [TIP]
156
+ =====================================================================
157
+ You can also change the image size using the following LaTeX commands:
158
+
159
+ \tiny
160
+ \scriptsize
161
+ \footnotesize
162
+ \small
163
+ \normalsize
164
+ \large
165
+ \Large
166
+ \LARGE
167
+ \huge
168
+
169
+ For example:
170
+
171
+ [latex]
172
+ \Large $y = \int_0^\infty \gamma^2 \cos(x) dx$
173
+
174
+ The `\Large` command is outside the `$` math delimiters.
175
+
176
+ =====================================================================
177
+
178
+ The filter (`./filters/latex/latex2png.py`) can be used outside
179
+ AsciiDoc to convert LaTeX source to PNG images.
180
+
181
+ Execute the following command to see how to use it:
182
+
183
+ $ ./filters/latex/latex2png.py --help
184
+
185
+
186
+ Limitations
187
+ -----------
188
+ - The `asciidoc(1)` input and output files cannot both be `-` (stdin
189
+ and stdout), either the input or output files (or both) must be a
190
+ named file.
191
+
192
+
193
+ Installation
194
+ ------------
195
+ In addition to AsciiDoc you will need to have `latex(1)` and
196
+ `dvipng(1)` installed.