asciidoctor-latex 1.5.0.dev → 1.5.0.1.dev

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +118 -122
  3. data/data/extras.css +6 -0
  4. data/{try-out → examples}/README.adoc +8 -4
  5. data/examples/box.adoc +16 -0
  6. data/examples/chem.adoc +17 -0
  7. data/{try-out → examples}/click.adoc +0 -0
  8. data/{try-out → examples}/code.adoc +0 -0
  9. data/{try-out → examples}/env.adoc +0 -0
  10. data/examples/eq-alignment.adoc +5 -0
  11. data/examples/eq-block.adoc +60 -0
  12. data/{try-out → examples}/eq-latex.adoc +0 -0
  13. data/{try-out → examples}/eq-stem.adoc +0 -0
  14. data/{try-out → examples}/eqno-latex.adoc +0 -0
  15. data/{try-out → examples}/math_article.adoc +0 -0
  16. data/{try-out → examples}/pyth-stem.adoc +0 -0
  17. data/{try-out → examples}/theorem-latex.adoc +0 -0
  18. data/{try-out → examples}/xref-equations.adoc +2 -1
  19. data/lib/asciidoctor/latex/click_block.rb +0 -2
  20. data/lib/asciidoctor/latex/converter.rb +90 -77
  21. data/lib/asciidoctor/latex/environment_block.rb +44 -26
  22. data/lib/asciidoctor/latex/prepend_processor.rb +1 -1
  23. data/lib/asciidoctor/latex/preprocess.rb +0 -8
  24. data/lib/asciidoctor/latex/tex_preprocessor.rb +2 -2
  25. data/lib/asciidoctor/latex/version.rb +1 -1
  26. data/manual.adoc +2 -2
  27. data/test/examples/adoc/env.adoc +1 -9
  28. data/test/examples/adoc/eq.adoc +1 -1
  29. data/test/examples/adoc/zero.adoc +2 -0
  30. data/test/examples/asciidoc-html/env.adoc +103 -0
  31. data/test/examples/asciidoc-html/equations.adoc +15 -0
  32. data/test/examples/tex/env.tex +1 -127
  33. data/test/examples/tex/eq.tex +2 -125
  34. data/test/examples/tex/zero.tex +2 -120
  35. metadata +39 -21
  36. data/rake/cacert.pem +0 -3894
  37. data/rake/jdk_helper.rb +0 -105
  38. data/rake/tar-licence +0 -19
  39. data/rake/tar.rb +0 -38
  40. data/test/examples/asciidoc-html/block_open.adoc +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3e5580fadffd5a0ff5f968e8672225c1b387a434
4
- data.tar.gz: 67f763319571a6cb2ee224bf79b5044d945e82fe
3
+ metadata.gz: b8311fb6bf67fe3fdad35eda206272fca2cee6bd
4
+ data.tar.gz: 9d9e0614a2e8bddb8f28776ab57fe58298659e64
5
5
  SHA512:
6
- metadata.gz: f7aeb65738dea61724b8295e2f6fad7eebabd95b7daa0195a6faebee124194a37d44cf0fe50a7cb1498e7454d39b767728e8f0ac873ad4456c51730ff3ab138b
7
- data.tar.gz: e47b504a4b7b0752656d675c632aef95e3f5247e00bed9785069c2102980427edbe9f6e5640fbf068de088dc9c601e9d49f1c6b1e8b5cf6cc21a594238057e36
6
+ metadata.gz: b0276015c4a3531b4768f42a0255653c7daa2c8a0d307ebc769428b4821b282f8d172893c300f5518963931d6689666bc01e9ddc8e9ed89385e60327d90d568e
7
+ data.tar.gz: 3eea9dd3976da80e860076185863868c4db050cb30496f093d68f75d487d51789e8d81d1c7a1e0cb139687614be182af943243e191dbb5a6977b12fe0cd08549
data/README.adoc CHANGED
@@ -1,4 +1,4 @@
1
- = AsciiDoc to LaTeX Converter for Asciidoctor
1
+ = AsciiDoc-LaTeX Converter for Asciidoctor
2
2
  James Carlson
3
3
 
4
4
  :numbered:
@@ -7,24 +7,48 @@ James Carlson
7
7
 
8
8
  == Purpose
9
9
 
10
- The aim of the LaTeX converter is to transform an AsciiDoc document containing
11
- mathematical notation into a LaTeX document.
12
- The converter also adds to Asciidoctor's facilities for handling mathematical
13
- notation when rendered as HTML. Among these are the automatic numbering of theorems
14
- and equations.
15
- Please see the file [path]_manual.adoc_ in this repository for additional details
16
- and for technical information.
10
+ Asciidoc-LaTeX defines an extended mathematical syntax
11
+ for Asciidoc that closely parallels LaTeX. The
12
+ Asciidoctor-LaTeX converter renders documents written
13
+ in this extended markup language into both HTML
14
+ and LaTeX.footnote:[Many, but not all Asciidoc language
15
+ features are covered by this release.]
17
16
 
18
- For examples and a quick start guide, see <<Getting started>>.
19
- Below, we describe the <<Document format,document formats>> used
20
- for mathematics and the <<Command for rendering,commands>> for rendering a document into HTML or LaTeX.
17
+ This README is very brief because mathematical
18
+ markup in Asciidoc-LaTeX will not render in GitHub.
19
+ For a better view of what Asciidoc-LaTeX does, follow the
20
+ installation instructions and then run
21
+
22
+ ----
23
+ $ asciidoctor-latex -b html start.adoc
24
+ ----
25
+ on the files `start.adoc`, etc found
26
+ in the directory `examples` of this repository.
27
+ This command produces the file `start.html`.
28
+ It can be viewed with any browser. You will
29
+ need an internet connection , since the browser
30
+ must load he MathJax fonts.
31
+
32
+ NOTE: Consult the
33
+ http://noteshare.io/book/asciidoctor-latex-manual[Asciidoctor-LaTeX manual]
34
+ for more information and for a view of both
35
+ source and rendered text for
36
+ Asciidoc-LaTeX. For more information on conversion
37
+ of Asciidoc-LaTeX documents to LaTeX, see
38
+ `manual.adoc` _(needs update)_.
39
+
40
+
41
+ Asciidoctor-LaTeX is developed by James Carlson, Jakub Jirutka, and Dan Allen.
42
+ _In progress: Cross-compilation to Asciidoctor.js by Guillaume Grossetie makes
43
+ possible other uses, among which will be inclusion in the Chrome
44
+ Live Preview Extension._
21
45
 
22
46
 
23
47
  == Installation
24
48
 
25
49
  === Using Rubygems
26
50
 
27
- _asciidoctor-latex has not been released yet_
51
+ There is a development release. Beta alert!
28
52
 
29
53
  === From repository
30
54
 
@@ -36,45 +60,37 @@ If you would like to install a development version from the repository, use:
36
60
  $ gem install *.gem
37
61
 
38
62
 
39
- == Getting started
40
-
41
- The directory `try-out` contains a set of examples which
42
- show what Asciidoctor LateX can do. Consult the `README` file
43
- for directions on how to render an examples as
44
- HTML or LaTeX. By comparing the source and rendered files,
45
- you will quickly see how to write Asciidoc LaTeX.
46
-
47
-
48
-
49
63
  == Document format
50
64
 
51
- Asciidoctor supports two closely-related math formats, [blue]#AsciiMath# and [blue]#LaTeX#.
52
- For in-line mathematics, the first looks like `+++stem:[ a^2 + b^2 = c^2 ]+++`, while the
53
- second looks like `$ a^2 + b^2 = c^2 $`. Both render as stem:[ a^2 + b^2 = c^2 ].
54
- For displayed text, one can use
65
+ Asciidoctor supports two closely-related
66
+ math formats, [blue]#Asciidoc-LaTeX#
67
+ and [blue]#AsciiMath#.
68
+ In Asciidoc-LaTeX,
69
+ one can write `$ a^2 + b^2 = c^2 $` and
70
+ ----
71
+ \[
72
+ e^{2\pi \sqrt{-1}} = 1,
73
+ \]
74
+ ----
75
+ for in-line and dipplay mathematial
76
+ text, respectively.
77
+ You will need to express dollar-denominated
78
+ currency using
79
+ escaped dollar signs: "He paid \$100 for that
80
+ theore.m" In AsciiMath, one writes
81
+ `+++stem:[ a^2 + b^2 = c^2 ]+++`
82
+ and
55
83
  ----
56
84
  [stem]
57
85
  ++++
58
- e^{2\pi \sqrt{-1}} = 1
86
+ e^{2\pi \sqrt{-1}} = 1.
59
87
  ++++
60
88
  ----
61
- or
62
- ----
63
- \[
64
- e^{2\pi \sqrt{-1}} = 1
65
- \]
66
- ----
67
- Both render as
68
- \[
69
- e^{2\pi \sqrt{-1}} = 1
70
- \]
71
- _Please note that the formulae above will not render properly
72
- if you are reading it on GitHub. It will, however, render properly if you run
73
- this file through Asciidoctor_.
74
89
 
75
- == Asciidoctor environments
76
90
 
77
- Asciidoctor supports an `env` construct that maps to LaTeX environments.
91
+ == Asciidoc-LaTeX environments
92
+
93
+ Asciidoc-LaTeX supports an `env` construct that maps to LaTeX environments.
78
94
  Thus
79
95
  ----
80
96
  [env.theorem]
@@ -82,48 +98,75 @@ Thus
82
98
  There exist infinitely many prime numbers.
83
99
  --
84
100
  ----
85
- renders as an automatically numbered theorem:
86
-
101
+ renders as an automatically numbered theorem.
102
+ Environments can contain in-line and display mathematics, e.g.,
103
+ ----
87
104
  [env.theorem]
88
105
  --
89
- There exist infinitely many prime numbers.
106
+ A two-by-two matrix is invertible if
107
+ its determinant is nonzero, i.e., if
108
+ \[
109
+ \left|\begin{matrix}
110
+ a & b \\
111
+ c & d
112
+ \end{matrix}\right| \ne 0
113
+ \]
114
+ This result extends to $n\times n$ matrices.
90
115
  --
116
+ ----
91
117
 
92
- Likewise, using `[env.definition]`, we obtain
118
+ There is complete freedom in parameter `NAME`
119
+ of `[env.NAME]`, Thus,one can write
120
+ ----
93
121
  [env.definition]
94
122
  --
95
- An integer $n$ is *prime* if (a) it is not $\pm 1$
96
- and (b) it has no divisors other
123
+ An integer $n$ is *prime* if (a) it is not
124
+ $\pm 1$ and (b) it has no divisors other
97
125
  than $\pm 1$ and $\pm n$.
98
126
  --
99
-
100
- For numbered equations, use `[env.equation]` like this
101
-
102
127
  ----
103
- [env.equation]
128
+ or
129
+ ----
130
+ [env.joke]
104
131
  --
105
- a^{p-1} \equiv 1\ \text{mod}\ p
132
+ A mathematician, a philosopher, and
133
+ a lawyer met at the local bar
134
+ for a drink. The lawyer said ...
106
135
  --
107
136
  ----
137
+ One can make cross references by labeling
138
+ the environment as in
139
+ ----
140
+ [env.joke#mathjoke1]
141
+ --
142
+ A mathematician, a philosopher, and
143
+ a lawyer met at the local bar
144
+ for a drink. The lawyer said ...
145
+ --
146
+ ----
147
+ then referencing it later as `<<mathjoke1>>`.
108
148
 
109
- to obtain the rendered text
149
+ Certain environments receive special treatment.
150
+ For numbered equations, use `[env.equation]`
151
+ like this
110
152
 
153
+ ----
111
154
  [env.equation]
112
155
  --
113
156
  a^{p-1} \equiv 1\ \text{mod}\ p
114
157
  --
158
+ ----
115
159
 
160
+ For sets of equations, use `[env,equationalign]`:
161
+ ----
162
+ [env.equationalign]
163
+ --
164
+ A & = 4\pi r^2 \\
165
+ V & = \frac{4}{3} \pi r^3
166
+ --
167
+ ----
116
168
 
117
169
 
118
- Except for `[env.equation]`, the TeX constructs `$ ... $` and
119
- `\[ ... \]` can be used in `[env]` blocks.
120
- For directions on making cross-references and labeling theorems, equations, etc., see
121
- the `README` file in the `try-out` directory. For an extensive
122
- example of the use of Asciidoctor LaTeX, see
123
- http://www.noteshare.io/section/the-fundamental-class-of-projective-space[this].
124
- All of these constructs discussed above are translated into native LaTeX when
125
- the converter is used to produuce tex output.
126
-
127
170
 
128
171
 
129
172
  == Click blocks
@@ -133,77 +176,30 @@ the block is not displayed until the user clicks on the heading.
133
176
  The heading of a click block is displayed in blue. Once a click
134
177
  block is "opened", it can be closed by clicking again on the heading.
135
178
 
136
- [click.comment]
137
- --
138
- It is sometimes useful to "hide" a comment in a click block
139
- so as not to unduly disturb the flow of the prose. Click
140
- blocks are also useful for problem sets, since one
141
- can make hints, solutions, etc. clickable.
142
- --
143
-
144
- The source for the above comment is
145
-
146
179
  ----
147
180
  [click.comment]
148
181
  --
149
- It is sometimes useful to "hide" a comment ...
150
- --
182
+ It is sometimes useful to "hide" a comment
183
+ in a click block so as not to unduly
184
+ disturb the flow of the prose. Click
185
+ blocks are also useful for problem sets,
186
+ since one can make hints, solutions, etc.
187
+ clickable.
151
188
  ----
152
189
 
190
+
153
191
  The default for click blocks is not to number them.
154
- See the file `click.adoc` in the `try-out` directory
192
+ See the file `click.adoc` in the `exampless` directory
155
193
  for more information.
156
194
 
157
195
  == Commands for rendering
158
196
 
159
197
  Asciidoc math files can be rendered
160
198
 
161
- . as HTML (the default)
162
- . with the LaTeX converter additions such as automatic theorem numbering
163
- . as LaTeX
164
- +
165
- *Note.* Forthcoming releases will make it possible to render
166
- +
167
- . as PDF
168
- . as EPUB3 (Electronic book)
169
-
170
-
171
- === HTML output
172
-
173
- To render a file into HTML, the Asciidoctor default,
174
- use the usual `asciidoctor` command with this option:
175
- ```
176
- $ asciidoctor -a stem foo.adoc
177
- ```
178
- or with this
179
- ```
180
- $ asciidoctor -a stem=latexmath foo.adoc
181
- ```
182
- depending on the format.
183
-
184
-
185
- === LaTeX converter additions
186
-
187
- To employ the converter additions such as automatic theorem numbering, use
188
- ```
189
- $ asciidoctor -r asciidoctor-latex -a stem=latexmath -b html foo.adoc
190
- ```
191
- or
192
- ```
193
- $ asciidoctor-latex -b html foo.adoc
194
- ```
195
-
196
-
197
- === LaTeX output
198
-
199
- To render a file into LaTeX, use the `-r` (require rubygem) and `-b` (backend) option, e.g.:
200
- ```
201
- $ asciidoctor -r asciidoctor-latex -a stem=latexmath -b latex foo.adoc
202
- ```
203
- or simply with the wrapper script:
204
- ```
205
- $ asciidoctor-latex foo.adoc
206
- ```
199
+ * as HTML. Use `$ asciidoctor-latex -b html foo.adoc` to produce `foo.html`.
200
+ With this command the Asciidoc-LaTeX syntax and extensions will be rendered.
201
+ * as LaTeX. Use `$ asciidoctor-latex foo.adoc`
202
+ to produce `foo.tex`.
207
203
 
208
204
 
209
205
  == Switches
data/data/extras.css ADDED
@@ -0,0 +1,6 @@
1
+ .openblock.box.content {
2
+ margin-top:1em;
3
+ margin-bottom: 1em;
4
+ margin-left:3em;
5
+ margin-right:4em;
6
+ }
@@ -10,11 +10,15 @@
10
10
 
11
11
 
12
12
 
13
- The aim of Asciidoctor's LaTeX converter is
13
+ The aim of the Asciidoc-LaTeX converter is
14
14
 
15
- . To render AsciiDoc documents as LaTeX.
16
15
 
17
- . To add to Asciidoctor's facilities for handling mathematical notation when rendered as HTML
16
+ . To add LaTeX-like facilities
17
+ to Asciidoc for handling mathematical notation when rendered as HTML.
18
+ We refer to the extended Asciidoc markup language as Asciidoc-LaTeX.
19
+
20
+ . To render AsciiDoc-LaTeX documents into LaTeX.
21
+
18
22
 
19
23
  As an example of both features, you can write automatically numbered equations, e.g.,
20
24
 
@@ -23,7 +27,7 @@ As an example of both features, you can write automatically numbered equations,
23
27
  \int_{|z| = 1} \frac{dz}{z} = 2\pi \sqrt{-1}
24
28
  --
25
29
 
26
- by writing this in Asciidoc
30
+ by writing this
27
31
 
28
32
  ----
29
33
  [env.equation]
data/examples/box.adoc ADDED
@@ -0,0 +1,16 @@
1
+ Ho hum, said the professor:
2
+
3
+ .Foobar
4
+ [env.box]
5
+ --
6
+ The curve $M'$ was compactified by adding $d$ points "at infnity".
7
+ The locus "infinity" is the locus $Z = 0$. Tha locus is la di dah di dah ..
8
+ --
9
+
10
+ .Laak Boribuul
11
+ [env.box%numbered]
12
+ --
13
+ The curve $M'$ was compactified by adding $d$ points "at infnity".
14
+ The locus "infinity" is the locus $Z = 0$. Tha locus is la di dah di dah ..
15
+ --
16
+
@@ -0,0 +1,17 @@
1
+ == Test
2
+
3
+ [env.code]
4
+ --
5
+ for k in foo:
6
+ do bar
7
+ --
8
+
9
+ [env.chem]
10
+ --
11
+ H2O
12
+ --
13
+
14
+ [env.equation]
15
+ --
16
+ a^7 = 1
17
+ --
File without changes
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ [env.equationalign]
2
+ --
3
+ A & = 4\pi r^2 \\
4
+ V & = \frac{4}{3} \pi r^3
5
+ --
@@ -0,0 +1,60 @@
1
+ == Some Equations
2
+ :foo: 'locus'
3
+
4
+ === Number Theory
5
+
6
+ The equation
7
+ $a^2 + b^2 = c^2$ has infinitely many
8
+ non-proportional integer solutions.
9
+ The integer solutions of the equation
10
+ [env.equation#eq-fermat]
11
+ --
12
+ a^3 + b^3 = c^3
13
+ --
14
+ are trivial: at least one entry is
15
+ zero and the others are "obvious"
16
+
17
+ === Calculus
18
+
19
+ A definite integral with no equation number
20
+ [env.equation%no-number]
21
+ --
22
+ \int_0^1 x^n dx = \frac{1}{n}
23
+ --
24
+
25
+ A definite integral with an equation number:
26
+ [env.equation]
27
+ --
28
+ \int_0^1 x^n dx = \frac{1}{n}
29
+ --
30
+
31
+ The fundamental theorem of calculus:
32
+ [env.equation]
33
+ --
34
+ \frac{d}{dx} \int_a^x f(t) dt = f(x)
35
+ --
36
+
37
+ === Linear algebra
38
+
39
+ A matrix:
40
+ [env.equation]
41
+ --
42
+ M = \left[
43
+ \begin{array}{ c c }
44
+ 1 & 2 \\
45
+ 3 & 4
46
+ \end{array} \right]
47
+ --
48
+
49
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sed lorem enim. Donec ut porta augue. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Proin vel pulvinar mi. Donec eu viverra arcu. Aenean accumsan lectus sit amet dui bibendum tristique. Vivamus a magna ut lectus tempus placerat quis in metus. Donec sagittis, lacus at porttitor porttitor, turpis ipsum malesuada risus, quis luctus magna ex ac neque. Curabitur a lacus et arcu vulputate sagittis eget ut leo. In at dolor mollis, semper nisl tempus, cursus turpis. Donec ipsum eros, pharetra pharetra molestie eu, posuere eget ipsum.
50
+
51
+ Mauris vitae lorem a felis sollicitudin ornare. Nullam iaculis eleifend fermentum. Duis non justo sapien. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec sed diam nibh. Aliquam aliquam a urna ut scelerisque. Aliquam posuere lectus et condimentum fermentum. Quisque eleifend, purus eget sodales venenatis, leo enim egestas lectus, non semper felis felis in arcu. Phasellus sed turpis erat. Mauris scelerisque finibus sollicitudin. Nam non lectus orci. Pellentesque vitae aliquam orci. Quisque congue posuere dui. Vestibulum et ipsum nulla. Vivamus aliquet egestas lorem, non condimentum leo suscipit vel.
52
+
53
+ Sed consectetur efficitur arcu vitae gravida. Donec non neque rhoncus, vehicula elit sit amet, sagittis metus. Nulla eleifend dui et finibus luctus. Quisque pulvinar elit libero, sit amet vestibulum sapien iaculis sed. Maecenas imperdiet massa id condimentum sollicitudin. Duis vestibulum feugiat elit, at tincidunt justo placerat vitae. Vivamus leo neque, posuere et risus vestibulum, molestie fermentum enim. Integer eget vulputate libero. Ut id ligula id massa dignissim dictum.
54
+
55
+ Sed non libero aliquet, ultrices nulla ac, accumsan erat. Nulla posuere lectus ut imperdiet ullamcorper. Pellentesque consequat vestibulum neque eget ornare. Etiam porttitor nunc purus, non ullamcorper nulla sodales id. Aliquam dapibus maximus odio. Nunc rhoncus iaculis lectus in scelerisque. Vivamus est mauris, gravida vitae elementum in, euismod ac nibh. Phasellus mauris arcu, auctor id mauris nec, varius commodo risus. Aliquam interdum arcu porttitor eros rutrum, vitae malesuada erat cursus. Curabitur ut purus eu nunc viverra cursus. Praesent ut porttitor leo. Donec blandit efficitur auctor. Pellentesque fermentum, nisi non venenatis euismod, sapien tellus sodales libero, ut convallis augue dui quis nulla. Nulla facilisi. Nunc consectetur libero est, non aliquam ex sollicitudin ornare. Etiam porttitor nulla sed quam cursus, vitae ultricies sapien commodo.
56
+
57
+
58
+
59
+ I refer to <<eq-fermat>>
60
+