asciidoctor-latex 1.5.0.dev
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.adoc +22 -0
- data/README.adoc +213 -0
- data/Rakefile +55 -0
- data/bin/asciidoctor-latex +22 -0
- data/data/asciidoc_tex_macros.tex +42 -0
- data/data/preamble_article.tex +45 -0
- data/data/preamble_book.tex +44 -0
- data/lib/asciidoctor-latex.rb +1 -0
- data/lib/asciidoctor/latex.rb +8 -0
- data/lib/asciidoctor/latex/chem.rb +24 -0
- data/lib/asciidoctor/latex/click_block.rb +121 -0
- data/lib/asciidoctor/latex/converter.rb +358 -0
- data/lib/asciidoctor/latex/core_ext/colored_string.rb +35 -0
- data/lib/asciidoctor/latex/dollar.rb +28 -0
- data/lib/asciidoctor/latex/ent_to_uni.rb +17 -0
- data/lib/asciidoctor/latex/environment_block.rb +190 -0
- data/lib/asciidoctor/latex/inject_html.rb +49 -0
- data/lib/asciidoctor/latex/inline_macros.rb +20 -0
- data/lib/asciidoctor/latex/macro_insert.rb +49 -0
- data/lib/asciidoctor/latex/node_processors.rb +695 -0
- data/lib/asciidoctor/latex/prepend_processor.rb +36 -0
- data/lib/asciidoctor/latex/preprocess.rb +37 -0
- data/lib/asciidoctor/latex/tex_block.rb +108 -0
- data/lib/asciidoctor/latex/tex_postprocessor.rb +44 -0
- data/lib/asciidoctor/latex/tex_preprocessor.rb +65 -0
- data/lib/asciidoctor/latex/version.rb +5 -0
- data/manual.adoc +285 -0
- data/rake/cacert.pem +3894 -0
- data/rake/jdk_helper.rb +105 -0
- data/rake/tar-licence +19 -0
- data/rake/tar.rb +38 -0
- data/rspec/README.adoc +45 -0
- data/rspec/a.rb +79 -0
- data/rspec/b.rb +111 -0
- data/rspec/c.rb +121 -0
- data/rspec/data/tex1 +65 -0
- data/rspec/data/tex2 +5 -0
- data/rspec/data/tex2.expect +5 -0
- data/rspec/transform.rb +36 -0
- data/spec/README.adoc +45 -0
- data/spec/a.rb +79 -0
- data/spec/b.rb +111 -0
- data/spec/c.rb +121 -0
- data/spec/data/foo +1 -0
- data/spec/data/lorem +1 -0
- data/spec/data/tex1 +65 -0
- data/spec/data/tex2 +5 -0
- data/spec/data/tex2.expect +5 -0
- data/spec/transform.rb +36 -0
- data/test/examples/adoc/env.adoc +16 -0
- data/test/examples/adoc/eq.adoc +12 -0
- data/test/examples/adoc/zero.adoc +3 -0
- data/test/examples/asciidoc-html/block_open.adoc +17 -0
- data/test/examples/tex/env.tex +132 -0
- data/test/examples/tex/eq.tex +132 -0
- data/test/examples/tex/zero.tex +121 -0
- data/test/html_test.rb +8 -0
- data/test/latex_test.rb +8 -0
- data/test/test_helper.rb +4 -0
- data/test_jc/admonition.adoc +4 -0
- data/test_jc/click.adoc +7 -0
- data/test_jc/env.adoc +31 -0
- data/test_jc/example.adoc +17 -0
- data/test_jc/floating_title.adoc +15 -0
- data/test_jc/image.adoc +84 -0
- data/test_jc/images/frog.jpg +0 -0
- data/test_jc/images/red_frog.jpeg +0 -0
- data/test_jc/images/yellow_frog.jpeg +0 -0
- data/test_jc/listing.adoc +9 -0
- data/test_jc/lists.adoc +20 -0
- data/test_jc/math.adoc +10 -0
- data/test_jc/preamble.adoc +14 -0
- data/test_jc/section-numbered.adoc +9 -0
- data/test_jc/section.adoc +7 -0
- data/test_jc/sidebar.adoc +61 -0
- data/test_jc/verse.adoc +15 -0
- data/try-out/README.adoc +348 -0
- data/try-out/click.adoc +108 -0
- data/try-out/code.adoc +122 -0
- data/try-out/env.adoc +139 -0
- data/try-out/eq-latex.adoc +37 -0
- data/try-out/eq-stem.adoc +41 -0
- data/try-out/eqno-latex.adoc +120 -0
- data/try-out/math_article.adoc +138 -0
- data/try-out/pyth-stem.adoc +52 -0
- data/try-out/theorem-latex.adoc +50 -0
- data/try-out/xref-equations.adoc +28 -0
- metadata +210 -0
data/test/html_test.rb
ADDED
data/test/latex_test.rb
ADDED
data/test/test_helper.rb
ADDED
data/test_jc/click.adoc
ADDED
data/test_jc/env.adoc
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
== Test: Environment Blocks
|
2
|
+
|
3
|
+
[env.theorem#pyth]
|
4
|
+
--
|
5
|
+
If $a$ and $b$ are the sides
|
6
|
+
of a right triangle and $c$
|
7
|
+
is the hypotenuse, then
|
8
|
+
\[
|
9
|
+
a^2 + b^2 = c^2
|
10
|
+
\]
|
11
|
+
--
|
12
|
+
|
13
|
+
[env.equation#binomial]
|
14
|
+
--
|
15
|
+
(a + b)^2 = a^2 + 2ab + b^2
|
16
|
+
--
|
17
|
+
|
18
|
+
[env.listing]
|
19
|
+
--
|
20
|
+
if a in b
|
21
|
+
foo(a,b)
|
22
|
+
blatzo(a+b)
|
23
|
+
--
|
24
|
+
|
25
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam sit amet interdum elit. Quisque viverra feugiat massa hendrerit sagittis. Quisque at arcu massa. Nulla facilisi. Cras et ligula sapien. Donec commodo viverra dui at rhoncus. In consequat ut nisl in mollis. Nullam id turpis quam. Maecenas felis arcu, semper ut vulputate ut, maximus in elit. Etiam in tempor leo.
|
26
|
+
|
27
|
+
Sed nec eleifend arcu. Nulla pulvinar nulla ac ornare rutrum. Fusce arcu lacus, convallis quis ante eu, pulvinar iaculis ante. Vivamus porta sagittis orci ut molestie. Fusce rhoncus porta est vel maximus. Proin tincidunt mauris ac augue pellentesque, et commodo sapien accumsan. In vel rhoncus odio. Cras congue, quam non dapibus sagittis, nibh ligula interdum nibh, vitae auctor enim ipsum sed enim.
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
Most people know <<pyth>> and equation <<binomial>>.
|
data/test_jc/image.adoc
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
== Test: Image
|
2
|
+
|
3
|
+
:imagesdir: ./images
|
4
|
+
|
5
|
+
|
6
|
+
Frogs can be both beautiful and poisonous.
|
7
|
+
|
8
|
+
[.text-center]
|
9
|
+
.Poisonous blue frog
|
10
|
+
image::frog.jpg[width=200,align=center]
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
Lorem ipsum dolor sit amet, dolor quis pede, et
|
17
|
+
dignissim nec mauris vitae non, ut felis quam
|
18
|
+
sagittis leo vulputate, purus massa praesent
|
19
|
+
ultricies orci vivamus, imperdiet imperdiet ante.
|
20
|
+
Tempor sit congue, quam pulvinar dictumst ante
|
21
|
+
integer gravida, diam morbi facilisis placerat
|
22
|
+
urna nam, pulvinar integer placerat aliquet nibh
|
23
|
+
senectus. Tristique sed aliquet ultrices nulla,
|
24
|
+
morbi egestas, dui phasellus. Sed nulla cras cum,
|
25
|
+
egestas vel, dui tellus euismod lectus
|
26
|
+
pellentesque commodo, montes at, pretium elementum
|
27
|
+
ut suscipit nec vestibulum nulla. Viverra
|
28
|
+
fermentum arcu, augue auctor dolor tortor vel
|
29
|
+
mauris id, a eros proin dui. Orci eget mauris,
|
30
|
+
vestibulum in posuere, dolor quam.
|
31
|
+
|
32
|
+
image::yellow_frog.jpeg[float=left]
|
33
|
+
|
34
|
+
Orci nunc ipsum curabitur sit, consectetuer
|
35
|
+
suspendisse numquam nonummy neque et, praesent
|
36
|
+
voluptas id sit donec eu posuere, eget tempus vel.
|
37
|
+
Ante elit vestibulum sollicitudin suscipit a. Id
|
38
|
+
ut fusce. Non duis sodales sed, in porttitor
|
39
|
+
vulputate in sit morbi non, integer elementum quis
|
40
|
+
quis, fringilla integer est enim vel, ac sed
|
41
|
+
maecenas ut enim ridiculus nisl. Elit nec sed
|
42
|
+
sodales, mauris egestas, aliquet volutpat
|
43
|
+
suspendisse gravida duis tempus in, volutpat vitae
|
44
|
+
egestas aliquet nec sit, libero orci tincidunt
|
45
|
+
sed. Hendrerit ut dictum nascetur ullamcorper
|
46
|
+
risus neque. Vestibulum a, maxime vestibulum quis
|
47
|
+
est sit, erat porttitor, per mus. Quisque
|
48
|
+
vestibulum, cras consequat risus eget risus,
|
49
|
+
inceptos nulla id luctus ligula sunt, est inceptos
|
50
|
+
arcu amet, vivamus integer tempor scelerisque.
|
51
|
+
Libero fusce euismod, possimus eu erat convallis
|
52
|
+
nunc, orci cras hymenaeos ut tempus mi viverra,
|
53
|
+
fermentum dolor fames explicabo libero, vel in.
|
54
|
+
Integer at est tellus etiam a, urna sed nunc, cras
|
55
|
+
dictumst, velit integer. Sed montes velit
|
56
|
+
venenatis, turpis bibendum pharetra luctus neque
|
57
|
+
dui, in praesent, sed nec vitae. Imperdiet et
|
58
|
+
neque nunc proin vulputate, velit fringilla in
|
59
|
+
odio iaculis wisi, laboris lorem etiam ultricies.
|
60
|
+
|
61
|
+
image::red_frog.jpeg[float=right, width=300]
|
62
|
+
|
63
|
+
Condimentum amet semper orci pretium, at consequat
|
64
|
+
pellentesque, interdum aut sed tempus vehicula
|
65
|
+
egestas magna, sunt egestas. Mus auctor tempus
|
66
|
+
aliquam, aliquam lorem nulla. Ut neque et
|
67
|
+
scelerisque gravida convallis proin, vestibulum et
|
68
|
+
mi nonummy sit pellentesque, eget nec aliquet
|
69
|
+
posuere nonummy leo, risus integer, mattis justo
|
70
|
+
enim nec urna quis. Tristique ipsum risus est ac.
|
71
|
+
Tristique aliquam velit turpis feugiat nullam,
|
72
|
+
scelerisque erat fringilla pulvinar, feugiat non
|
73
|
+
per, magna phasellus erat aliquam blandit. Lorem
|
74
|
+
in diam, quis ipsum blandit vestibulum sed.
|
75
|
+
|
76
|
+
Justo sodales faucibus vel corporis. Lorem
|
77
|
+
suspendisse. A leo purus, pede odio duis integer
|
78
|
+
ligula eget mollis. Lorem interdum mus id. Nec
|
79
|
+
duis odio vel aliquam felis gravida, nulla dolor
|
80
|
+
morbi pede per cras tellus, gravida pellentesque
|
81
|
+
aliquet, purus vitae ultrices non, vitae curae mi
|
82
|
+
neque. Sit et feugiat bibendum sed mi inceptos,
|
83
|
+
nibh integer, sed nec ac proin sed wisi sed,
|
84
|
+
pretium volutpat enim pellentesque tellus.
|
Binary file
|
Binary file
|
Binary file
|
data/test_jc/lists.adoc
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
== Test: lists
|
2
|
+
|
3
|
+
=== Numbered List (Groceries)
|
4
|
+
|
5
|
+
. Eggs
|
6
|
+
. Milk
|
7
|
+
. Flour
|
8
|
+
|
9
|
+
=== Itemized List (Meeting)
|
10
|
+
|
11
|
+
. Minutes
|
12
|
+
. Old Business
|
13
|
+
. New Business
|
14
|
+
. Adjourn
|
15
|
+
|
16
|
+
=== Definition List (Science)
|
17
|
+
|
18
|
+
Physics:: atoms, electrons, etc
|
19
|
+
|
20
|
+
Biology:: cells, organisms, evolution
|
data/test_jc/math.adoc
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
= The Dangerous and Thrilling Documentation Chronicles
|
2
|
+
Kismet Chameleon
|
3
|
+
|
4
|
+
This journey begins on a bleary Monday morning.
|
5
|
+
Our intrepid team is in desperate need of double shot mochas, but the milk expired eight days ago.
|
6
|
+
A trip to the dairy was out of the question.
|
7
|
+
On Friday night, a mutant, script-injecting warlock had infected the Shetland cattle herd with a ravenous craving for tags and annotations.
|
8
|
+
The security wolves were at a trust building retreat in Katchanga, and no one in the village could locate their defensive operations manual.
|
9
|
+
|
10
|
+
Weak daylight trickled across the stripped pasture, chased by distant bovine screams...
|
11
|
+
|
12
|
+
== Cavern Glow
|
13
|
+
|
14
|
+
The river rages through the cavern, rattling its content...
|
@@ -0,0 +1,61 @@
|
|
1
|
+
== Test: Sidebar
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
Lorem ipsum dolor sit amet, dolor quis pede, et
|
8
|
+
dignissim nec mauris vitae non, ut felis quam
|
9
|
+
sagittis leo vulputate, purus massa praesent
|
10
|
+
ultricies orci vivamus, imperdiet imperdiet ante.
|
11
|
+
Tempor sit congue, quam pulvinar dictumst ante
|
12
|
+
integer gravida, diam morbi facilisis placerat
|
13
|
+
urna nam, pulvinar integer placerat aliquet nibh
|
14
|
+
senectus. Tristique sed aliquet ultrices nulla,
|
15
|
+
morbi egestas, dui phasellus. Sed nulla cras cum,
|
16
|
+
egestas vel, dui tellus euismod lectus
|
17
|
+
pellentesque commodo, montes at, pretium elementum
|
18
|
+
ut suscipit nec vestibulum nulla. Viverra
|
19
|
+
fermentum arcu, augue auctor dolor tortor vel
|
20
|
+
mauris id, a eros proin dui. Orci eget mauris,
|
21
|
+
vestibulum in posuere, dolor quam.
|
22
|
+
|
23
|
+
[sidebar]
|
24
|
+
--
|
25
|
+
Orci nunc ipsum curabitur sit, consectetuer
|
26
|
+
suspendisse numquam nonummy neque et, praesent
|
27
|
+
voluptas id sit donec eu posuere, eget tempus vel.
|
28
|
+
Ante elit vestibulum sollicitudin suscipit a. Id
|
29
|
+
ut fusce. Non duis sodales sed, in porttitor
|
30
|
+
vulputate in sit morbi non, integer elementum quis
|
31
|
+
quis, fringilla integer est enim vel, ac sed
|
32
|
+
maecenas ut enim ridiculus nisl. Elit nec sed
|
33
|
+
sodales, mauris egestas, aliquet volutpat
|
34
|
+
suspendisse gravida duis tempus in, volutpat vitae
|
35
|
+
egestas aliquet nec sit, libero orci tincidunt
|
36
|
+
sed. Hendrerit ut dictum nascetur ullamcorper
|
37
|
+
risus neque.
|
38
|
+
--
|
39
|
+
|
40
|
+
Condimentum amet semper orci pretium, at consequat
|
41
|
+
pellentesque, interdum aut sed tempus vehicula
|
42
|
+
egestas magna, sunt egestas. Mus auctor tempus
|
43
|
+
aliquam, aliquam lorem nulla. Ut neque et
|
44
|
+
scelerisque gravida convallis proin, vestibulum et
|
45
|
+
mi nonummy sit pellentesque, eget nec aliquet
|
46
|
+
posuere nonummy leo, risus integer, mattis justo
|
47
|
+
enim nec urna quis. Tristique ipsum risus est ac.
|
48
|
+
Tristique aliquam velit turpis feugiat nullam,
|
49
|
+
scelerisque erat fringilla pulvinar, feugiat non
|
50
|
+
per, magna phasellus erat aliquam blandit. Lorem
|
51
|
+
in diam, quis ipsum blandit vestibulum sed.
|
52
|
+
|
53
|
+
Justo sodales faucibus vel corporis. Lorem
|
54
|
+
suspendisse. A leo purus, pede odio duis integer
|
55
|
+
ligula eget mollis. Lorem interdum mus id. Nec
|
56
|
+
duis odio vel aliquam felis gravida, nulla dolor
|
57
|
+
morbi pede per cras tellus, gravida pellentesque
|
58
|
+
aliquet, purus vitae ultrices non, vitae curae mi
|
59
|
+
neque. Sit et feugiat bibendum sed mi inceptos,
|
60
|
+
nibh integer, sed nec ac proin sed wisi sed,
|
61
|
+
pretium volutpat enim pellentesque tellus.
|
data/test_jc/verse.adoc
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
== Test: verse
|
3
|
+
|
4
|
+
[verse]
|
5
|
+
--
|
6
|
+
I used to love my garden
|
7
|
+
But now my love is dead
|
8
|
+
For I found a bachelor’s button
|
9
|
+
In black-eyed Susan’s bed.
|
10
|
+
|
11
|
+
I used to love my garden
|
12
|
+
But now my love is dead
|
13
|
+
For I found a bachelor’s button
|
14
|
+
In black-eyed Susan’s bed.
|
15
|
+
--
|
data/try-out/README.adoc
ADDED
@@ -0,0 +1,348 @@
|
|
1
|
+
:numbered:
|
2
|
+
:toc2:
|
3
|
+
:max-width: 60%
|
4
|
+
|
5
|
+
:stem: latexmath
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
== Introduction
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
The aim of Asciidoctor's LaTeX converter is
|
14
|
+
|
15
|
+
. To render AsciiDoc documents as LaTeX.
|
16
|
+
|
17
|
+
. To add to Asciidoctor's facilities for handling mathematical notation when rendered as HTML
|
18
|
+
|
19
|
+
As an example of both features, you can write automatically numbered equations, e.g.,
|
20
|
+
|
21
|
+
[env.equation]
|
22
|
+
--
|
23
|
+
\int_{|z| = 1} \frac{dz}{z} = 2\pi \sqrt{-1}
|
24
|
+
--
|
25
|
+
|
26
|
+
by writing this in Asciidoc
|
27
|
+
|
28
|
+
----
|
29
|
+
[env.equation]
|
30
|
+
--
|
31
|
+
\int_{|z| = 1} \frac{dz}{z} = 2\pi \sqrt{-1}
|
32
|
+
--
|
33
|
+
----
|
34
|
+
|
35
|
+
|
36
|
+
To render your document as tex, type the commmand
|
37
|
+
`asciidoctor-latex foo.adoc`.
|
38
|
+
To render your document as HTML, use the `html`
|
39
|
+
backend: type the
|
40
|
+
command `asciidoctor-latex -b html foo.adoc`.
|
41
|
+
|
42
|
+
|
43
|
+
Automatically numbered theorems, definitions, etc., are
|
44
|
+
written in the same way
|
45
|
+
|
46
|
+
----
|
47
|
+
|
48
|
+
[env.theorem#th-pythag#integral]
|
49
|
+
--
|
50
|
+
For a right triangle, the square on the hypotenuse is equal to the summ
|
51
|
+
of the squares of the two remaining sides, i.e.,
|
52
|
+
\[
|
53
|
+
c^2 = a^2 + b^2.
|
54
|
+
\]
|
55
|
+
-
|
56
|
+
----
|
57
|
+
|
58
|
+
[env.theorem#th-pythag]
|
59
|
+
--
|
60
|
+
For a right triangle, the square on the hypotenuse is equal to the summ
|
61
|
+
of the squares of the two remaining sides, i.e.,
|
62
|
+
\[
|
63
|
+
c^2 = a^2 + b^2.
|
64
|
+
\]
|
65
|
+
--
|
66
|
+
|
67
|
+
The optional string `#th-pythag` is a label for purposes of cross-referencing:
|
68
|
+
----
|
69
|
+
<<th-pythag>>
|
70
|
+
----
|
71
|
+
Using the above code, we may later refer to <<th-pythag>>.
|
72
|
+
The cross-referencing style applies to env-blocks in general,
|
73
|
+
e.g., to
|
74
|
+
|
75
|
+
[env.equation#eq-pythag]
|
76
|
+
--
|
77
|
+
c^2 = a^2 + b^2
|
78
|
+
--
|
79
|
+
Cross-references are made like this:
|
80
|
+
----
|
81
|
+
<eq-pythag>>
|
82
|
+
----
|
83
|
+
but the rendered
|
84
|
+
cross-reference is different: we refer to equation <<eq-pythag>>,
|
85
|
+
formula <<eq-pythag>>, etc. The ``[env.code]`` block also receives
|
86
|
+
special treatment. The source text
|
87
|
+
----
|
88
|
+
[env.code#iter]
|
89
|
+
--
|
90
|
+
def iter(f, a, n)
|
91
|
+
n.times do
|
92
|
+
a = f.call(a)
|
93
|
+
puts a
|
94
|
+
end
|
95
|
+
return a
|
96
|
+
end
|
97
|
+
--
|
98
|
+
----
|
99
|
+
is rendered as
|
100
|
+
|
101
|
+
[env.code#iter]
|
102
|
+
--
|
103
|
+
def iter(f, a, n)
|
104
|
+
n.times do
|
105
|
+
a = f.call(a)
|
106
|
+
puts a
|
107
|
+
end
|
108
|
+
return a
|
109
|
+
end
|
110
|
+
--
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
== First tests
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
Below are some examples you can run through Asciidoctor to see what you can do with it.
|
120
|
+
We assume that you've already installed asciidoctor-latex (see README for instructions).
|
121
|
+
Now try this
|
122
|
+
|
123
|
+
```
|
124
|
+
$ asciidoctor -b html eq-latex.adoc
|
125
|
+
```
|
126
|
+
|
127
|
+
After running the above command, you should find the file `eq-latex.html`
|
128
|
+
next to the source file `eq-latex.adoc`. View it in your browser.
|
129
|
+
You will need to be connected to the internet so that your browser
|
130
|
+
can load the MathJax fonts used to render mathematical
|
131
|
+
notation.footnote:[You can also install the fonts on your system.
|
132
|
+
See http://www.mathjax.org/help/fonts/[mathjax-fonts]. this will give you faster reponse.
|
133
|
+
Turning off your internet conneection makes it better still:-(]
|
134
|
+
|
135
|
+
Lets test the analogous file written in `stem` format:
|
136
|
+
|
137
|
+
```
|
138
|
+
$ asciidoctor -r asciidoctor-latex -a stem eq-stem.adoc
|
139
|
+
```
|
140
|
+
|
141
|
+
Now convert our first file into LaTeX by running the command
|
142
|
+
|
143
|
+
```
|
144
|
+
$ asciidoctor -r asciidoctor-latex -a stem=latexmath -b latex eq-latex.adoc
|
145
|
+
```
|
146
|
+
or simply with the wrapper script
|
147
|
+
```
|
148
|
+
$ asciidoctor-latex eq-latex.adoc
|
149
|
+
```
|
150
|
+
|
151
|
+
If all was successful, there will be a file `eq-latex.tex` alongside
|
152
|
+
your source file `eq-latex.adoc`. You can process it as you
|
153
|
+
would any LaTeX file.
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
== Examples
|
160
|
+
|
161
|
+
Below is a list of files which demsonstrate various features
|
162
|
+
of the converter. In some cases there are two versions, e.g.
|
163
|
+
`eq-latex.adoc` and `eq-stem.adoc`, each written in the
|
164
|
+
indicated format.footnote:[A missing entry in the table
|
165
|
+
may mean that a feature has not yet been implemented,
|
166
|
+
or that the file demonstrating it has not yet been
|
167
|
+
written and/or tested.] In other cases, there
|
168
|
+
is the same file appears in both the LaTeX
|
169
|
+
and the STEM columns. In those cases
|
170
|
+
the `-a stem` or `-a stem:latexmath` option
|
171
|
+
is not required unless there is mathematical
|
172
|
+
content.
|
173
|
+
|
174
|
+
One of the best ways
|
175
|
+
of learning how to use the features of
|
176
|
+
Asciidotor LaTeX is to use your
|
177
|
+
natural talent for reverse-engineering:
|
178
|
+
run the example, the compare the rendered
|
179
|
+
file and its source.
|
180
|
+
|
181
|
+
[options=header, width=80%, align=center]
|
182
|
+
|===
|
183
|
+
| LaTeX | STEM | Comments
|
184
|
+
| `eq-latex.adoc` | `eq-stem.adoc` | Basic equations
|
185
|
+
| `eqno-latex.adoc` | -- | Numbered equations
|
186
|
+
| `theorem-latex.adoc` | -- | Numbered theorems
|
187
|
+
| `env.adoc` | `env.adoc` | Env blocks
|
188
|
+
| `click.adoc` | `click.adoc` | Click blocks
|
189
|
+
| `code.adoc` | code.adoc` | Code blocks
|
190
|
+
|===
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
== Comments on the examples
|
195
|
+
|
196
|
+
=== eq-latex
|
197
|
+
|
198
|
+
Basic equations, both in-line, as with \(a^2 + b^2 = c^2\),
|
199
|
+
and displayed, as with
|
200
|
+
\[
|
201
|
+
a^n + b^n = c^n
|
202
|
+
\]
|
203
|
+
|
204
|
+
|
205
|
+
The environment `[env.equation]` is automatically
|
206
|
+
numbered by default, as in the examples below.
|
207
|
+
|
208
|
+
|
209
|
+
[env.equation]
|
210
|
+
--
|
211
|
+
a^3 + b^3 = c^3
|
212
|
+
--
|
213
|
+
|
214
|
+
|
215
|
+
[env.equation]
|
216
|
+
--
|
217
|
+
\int_0^1 x^n dx = \frac{1}{n}
|
218
|
+
--
|
219
|
+
|
220
|
+
Here is how the first equation is done:
|
221
|
+
----
|
222
|
+
[env.equation]
|
223
|
+
--
|
224
|
+
a^3 + b^3 = c^3
|
225
|
+
--
|
226
|
+
----
|
227
|
+
|
228
|
+
|
229
|
+
=== theorem-latex
|
230
|
+
|
231
|
+
Numbered theorems, like the those below.
|
232
|
+
|
233
|
+
|
234
|
+
[env.theorem]
|
235
|
+
--
|
236
|
+
\[
|
237
|
+
a + (b + c) = (a + b) + c
|
238
|
+
\]
|
239
|
+
--
|
240
|
+
|
241
|
+
[env.theorem]
|
242
|
+
--
|
243
|
+
\[
|
244
|
+
a(b+c) = ab + ac
|
245
|
+
\]
|
246
|
+
--
|
247
|
+
|
248
|
+
|
249
|
+
=== env
|
250
|
+
|
251
|
+
The file `env.adoc`, which only requires the converter,
|
252
|
+
illustrates general usage of the `env`-block. It gives
|
253
|
+
an automatically numbered and titled block. Thus repeated use
|
254
|
+
of `[env.objection]` gives this.
|
255
|
+
|
256
|
+
[env.objection]
|
257
|
+
--
|
258
|
+
This is hearsay.
|
259
|
+
--
|
260
|
+
|
261
|
+
[env.objection]
|
262
|
+
--
|
263
|
+
That evidence has not been admitted before the court.
|
264
|
+
--
|
265
|
+
|
266
|
+
The first objection was written like this:
|
267
|
+
|
268
|
+
----
|
269
|
+
[env.objection]
|
270
|
+
--
|
271
|
+
This is hearsay.
|
272
|
+
--
|
273
|
+
----
|
274
|
+
|
275
|
+
=== click
|
276
|
+
|
277
|
+
|
278
|
+
Click blocks are like `env`-blocks, except that
|
279
|
+
when you open a document, only the title,
|
280
|
+
not the body of the block, is displayed.
|
281
|
+
Click on the title to reveal the body;
|
282
|
+
clicking again will return the body
|
283
|
+
to its hidden sate. Click blocks
|
284
|
+
signal their presence by the blue
|
285
|
+
color of the title.
|
286
|
+
|
287
|
+
.Secret message
|
288
|
+
[click.message]
|
289
|
+
--
|
290
|
+
The path to wisdom is written on no
|
291
|
+
secret map.
|
292
|
+
--
|
293
|
+
|
294
|
+
Click blocks are useful in making up problem sets,
|
295
|
+
homework assignments, study guides, etc.
|
296
|
+
|
297
|
+
|
298
|
+
=== code
|
299
|
+
|
300
|
+
The file `code.adoc` illstrates the versatilty of the `[env]`
|
301
|
+
and `[click]` blocks which are used here in their `code` role.
|
302
|
+
We explain how we do the two blocks below and related pieces
|
303
|
+
of writing.
|
304
|
+
|
305
|
+
|
306
|
+
[env.code#iter]
|
307
|
+
--
|
308
|
+
def iter(f, a, n)
|
309
|
+
n.times do
|
310
|
+
a = f.call(a)
|
311
|
+
puts a
|
312
|
+
end
|
313
|
+
return a
|
314
|
+
end
|
315
|
+
--
|
316
|
+
|
317
|
+
.Results
|
318
|
+
[click.code%numbered]
|
319
|
+
--
|
320
|
+
irb> iter $g, 1.0, 6
|
321
|
+
1.5
|
322
|
+
1.4166666666666665
|
323
|
+
1.4142156862745097
|
324
|
+
1.4142135623746899
|
325
|
+
1.414213562373095
|
326
|
+
1.414213562373095
|
327
|
+
=> 1.414213562373095
|
328
|
+
--
|
329
|
+
|
330
|
+
|
331
|
+
== Issues
|
332
|
+
|
333
|
+
One should be able to tex this document wihout error
|
334
|
+
and obtain the desired output. This is very much a work
|
335
|
+
in progress. In particaulr, the following have not yet been resolved.
|
336
|
+
|
337
|
+
. Dollars signs used to illustrated command cause LaTeX to choke.
|
338
|
+
We need to map dollar sign to escaped dollar sig in
|
339
|
+
post-processing for tex. Or is there a better solution?
|
340
|
+
|
341
|
+
. The table block in Asciidoc is not implmented -- or rather,
|
342
|
+
is partially implemnted.
|
343
|
+
|
344
|
+
. The Click block is not implented in teh TeX output.
|
345
|
+
|
346
|
+
. The matrix environment in `eq-stem.adoc` does not render correctly.
|
347
|
+
|
348
|
+
. Fix title in latex mode
|