asciidoctor-latex 1.5.0.1.dev → 1.5.0.2.dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.adoc +17 -31
- data/examples/README.adoc +9 -349
- data/lib/asciidoctor/latex/chem.rb +20 -12
- data/lib/asciidoctor/latex/converter.rb +9 -5
- data/lib/asciidoctor/latex/core_ext/colored_string.rb +5 -0
- data/lib/asciidoctor/latex/node_processors.rb +91 -74
- data/lib/asciidoctor/latex/tex_postprocessor.rb +1 -0
- data/lib/asciidoctor/latex/version.rb +1 -1
- data/test/examples/adoc/admonition.adoc +11 -0
- data/test/examples/adoc/box.adoc +8 -0
- data/test/examples/adoc/env.adoc +20 -0
- data/test/examples/adoc/eqalign.adoc +13 -0
- data/test/examples/adoc/line_break.adoc +5 -0
- data/test/examples/adoc/listing.adoc +12 -0
- data/test/examples/adoc/literal.adoc +20 -0
- data/test/examples/adoc/math.adoc +12 -0
- data/test/examples/adoc/open_block.adoc +17 -0
- data/test/examples/adoc/page_break.adoc +7 -0
- data/test/examples/adoc/pass.adoc +5 -0
- data/test/examples/adoc/sections.adoc +32 -0
- data/test/examples/tex/env.tex +15 -1
- data/test/examples/tex/eq.tex +1 -1
- metadata +24 -3
- data/manual.adoc +0 -285
@@ -23,6 +23,7 @@ module Asciidoctor::LaTeX
|
|
23
23
|
def process document, output
|
24
24
|
output = output.gsub('DOLLOD', '\$')
|
25
25
|
output = output.gsub('CHEMRIGHTARROW','->').gsub('CHEMLEFTARROW','<-').gsub('CHEMLEFTRIGHTARROW','<-->')
|
26
|
+
output = output.gsub('\\(','$').gsub('\\)','$')
|
26
27
|
output.gsub('!!!BACKSLASH', '\\')
|
27
28
|
end
|
28
29
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
//.adomition
|
2
|
+
== Test
|
3
|
+
|
4
|
+
Blah, blah
|
5
|
+
|
6
|
+
WARNING: Best not to say "blah, blah" in class.
|
7
|
+
You will get detention. Best not to say "blah, blah" in class.
|
8
|
+
You will get detention. Best not to say "blah, blah" in class.
|
9
|
+
You will get detention. Best not to say "blah, blah" in class.
|
10
|
+
You will get detention. Best not to say "blah, blah" in class.
|
11
|
+
You will get detention.
|
data/test/examples/adoc/env.adoc
CHANGED
@@ -6,3 +6,23 @@ The equation $a^2 + b^2 = c^2$
|
|
6
6
|
has infinitely many non-proportional
|
7
7
|
integer solutions.
|
8
8
|
--
|
9
|
+
|
10
|
+
//.env_display
|
11
|
+
|
12
|
+
[env.theorem]
|
13
|
+
--
|
14
|
+
\[
|
15
|
+
e^{2\pi\sqrt{-1}} = 1
|
16
|
+
\]
|
17
|
+
--
|
18
|
+
|
19
|
+
|
20
|
+
//.env_display_with_title
|
21
|
+
|
22
|
+
.Euler
|
23
|
+
[env.theorem]
|
24
|
+
--
|
25
|
+
\[
|
26
|
+
e^{2\pi\sqrt{-1}} = 1
|
27
|
+
\]
|
28
|
+
--
|
@@ -0,0 +1,32 @@
|
|
1
|
+
//.sections
|
2
|
+
|
3
|
+
|
4
|
+
== Section
|
5
|
+
|
6
|
+
=== Going down farther -- subsection
|
7
|
+
|
8
|
+
==== And farther still ...
|
9
|
+
|
10
|
+
===== Yikes! We have hit bottom!!
|
11
|
+
|
12
|
+
:numbered:
|
13
|
+
|
14
|
+
== Section
|
15
|
+
|
16
|
+
=== Going down farther -- subsection
|
17
|
+
|
18
|
+
==== And farther still ...
|
19
|
+
|
20
|
+
===== Yikes! We have hit bottom!!
|
21
|
+
|
22
|
+
:!numbered:
|
23
|
+
|
24
|
+
== Section
|
25
|
+
|
26
|
+
=== Going down farther -- subsection
|
27
|
+
|
28
|
+
==== And farther still ...
|
29
|
+
|
30
|
+
===== Yikes! We have hit bottom!!
|
31
|
+
|
32
|
+
|
data/test/examples/tex/env.tex
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
%== .env ==%
|
2
2
|
\begin{theorem}
|
3
|
-
The equation
|
3
|
+
The equation $a^2 + b^2 = c^2$
|
4
4
|
has infinitely many non-proportional
|
5
5
|
integer solutions.
|
6
6
|
\end{theorem}
|
7
|
+
|
8
|
+
%== .env_display ==%
|
9
|
+
\begin{theorem}
|
10
|
+
\[
|
11
|
+
e^{2\pi\sqrt{-1}} = 1
|
12
|
+
\]
|
13
|
+
\end{theorem}
|
14
|
+
|
15
|
+
%== .env_display_with_title ==%
|
16
|
+
\begin{theorem}{\rm (Euler) }
|
17
|
+
\[
|
18
|
+
e^{2\pi\sqrt{-1}} = 1
|
19
|
+
\]
|
20
|
+
\end{theorem}
|
data/test/examples/tex/eq.tex
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-latex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.0.
|
4
|
+
version: 1.5.0.2.dev
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Carlson
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-04-
|
13
|
+
date: 2015-04-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: asciidoctor
|
@@ -132,7 +132,6 @@ files:
|
|
132
132
|
- lib/asciidoctor/latex/tex_postprocessor.rb
|
133
133
|
- lib/asciidoctor/latex/tex_preprocessor.rb
|
134
134
|
- lib/asciidoctor/latex/version.rb
|
135
|
-
- manual.adoc
|
136
135
|
- rspec/README.adoc
|
137
136
|
- rspec/a.rb
|
138
137
|
- rspec/b.rb
|
@@ -151,8 +150,19 @@ files:
|
|
151
150
|
- spec/data/tex2
|
152
151
|
- spec/data/tex2.expect
|
153
152
|
- spec/transform.rb
|
153
|
+
- test/examples/adoc/admonition.adoc
|
154
|
+
- test/examples/adoc/box.adoc
|
154
155
|
- test/examples/adoc/env.adoc
|
155
156
|
- test/examples/adoc/eq.adoc
|
157
|
+
- test/examples/adoc/eqalign.adoc
|
158
|
+
- test/examples/adoc/line_break.adoc
|
159
|
+
- test/examples/adoc/listing.adoc
|
160
|
+
- test/examples/adoc/literal.adoc
|
161
|
+
- test/examples/adoc/math.adoc
|
162
|
+
- test/examples/adoc/open_block.adoc
|
163
|
+
- test/examples/adoc/page_break.adoc
|
164
|
+
- test/examples/adoc/pass.adoc
|
165
|
+
- test/examples/adoc/sections.adoc
|
156
166
|
- test/examples/adoc/zero.adoc
|
157
167
|
- test/examples/asciidoc-html/env.adoc
|
158
168
|
- test/examples/asciidoc-html/equations.adoc
|
@@ -214,8 +224,19 @@ test_files:
|
|
214
224
|
- spec/data/tex2
|
215
225
|
- spec/data/tex2.expect
|
216
226
|
- spec/transform.rb
|
227
|
+
- test/examples/adoc/admonition.adoc
|
228
|
+
- test/examples/adoc/box.adoc
|
217
229
|
- test/examples/adoc/env.adoc
|
218
230
|
- test/examples/adoc/eq.adoc
|
231
|
+
- test/examples/adoc/eqalign.adoc
|
232
|
+
- test/examples/adoc/line_break.adoc
|
233
|
+
- test/examples/adoc/listing.adoc
|
234
|
+
- test/examples/adoc/literal.adoc
|
235
|
+
- test/examples/adoc/math.adoc
|
236
|
+
- test/examples/adoc/open_block.adoc
|
237
|
+
- test/examples/adoc/page_break.adoc
|
238
|
+
- test/examples/adoc/pass.adoc
|
239
|
+
- test/examples/adoc/sections.adoc
|
219
240
|
- test/examples/adoc/zero.adoc
|
220
241
|
- test/examples/asciidoc-html/env.adoc
|
221
242
|
- test/examples/asciidoc-html/equations.adoc
|
data/manual.adoc
DELETED
@@ -1,285 +0,0 @@
|
|
1
|
-
= LaTeX Converter Manual
|
2
|
-
James Carlson
|
3
|
-
:toc2:
|
4
|
-
:numbered:
|
5
|
-
:stem: latexmath
|
6
|
-
|
7
|
-
== Introduction
|
8
|
-
|
9
|
-
TexConverter translates a file written
|
10
|
-
in a subset of Asciidoc to LaTeX. The
|
11
|
-
subset is described below. While not
|
12
|
-
complete, it is adequate for the preparation
|
13
|
-
of a wide range of mathematical documents,
|
14
|
-
from one-page handouts to articles to entire books.
|
15
|
-
|
16
|
-
As a demonstration of the current state of this
|
17
|
-
project, the file you are looking at, `manual.adoc`,
|
18
|
-
can be rendered into HTML by
|
19
|
-
----
|
20
|
-
$ asciidoctor-latex -b html manual.adoc
|
21
|
-
----
|
22
|
-
or can be rendered as a LaTeX file via
|
23
|
-
----
|
24
|
-
$ asciidoctor-latex manual.adoc
|
25
|
-
# => manual.tex
|
26
|
-
----
|
27
|
-
The `.tex` file can in turn be rendred into pdf via
|
28
|
-
`pdflatex` or `xelatex`. We recommend the latter.
|
29
|
-
|
30
|
-
|
31
|
-
Mathematical text in Asciidoc can be written as
|
32
|
-
one usually does in LaTeX if one invokes the
|
33
|
-
latex option.footnote:[This option exists but has not yet been released. To use
|
34
|
-
the option at http://noteshare.io[noteshare.io], include the code `:latex:` in
|
35
|
-
your document]. You do this via `asciidoctor -latex foo.adoc`.
|
36
|
-
Thus for the Pythagorean
|
37
|
-
theorem $a^2 + b^2 = c^2$, one writes
|
38
|
-
|
39
|
-
----
|
40
|
-
$ a^2 + b^2 = c^2 $
|
41
|
-
----
|
42
|
-
|
43
|
-
For the famous formula of Euler,
|
44
|
-
\[
|
45
|
-
e^{2\pi \sqrt{-1}} = 1
|
46
|
-
\]
|
47
|
-
one writes
|
48
|
-
|
49
|
-
----
|
50
|
-
\[
|
51
|
-
e^{2\pi \sqrt{-1}} = 1
|
52
|
-
\]
|
53
|
-
----
|
54
|
-
|
55
|
-
|
56
|
-
== The Asciidoc-LaTeX subset
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
=== Sections, levels 1 through 5
|
61
|
-
|
62
|
-
|
63
|
-
=== Ordered and unordered lists
|
64
|
-
|
65
|
-
In Asciidoc, an unordered list like
|
66
|
-
|
67
|
-
* Pay Bills
|
68
|
-
* Get Groceries
|
69
|
-
** Milk
|
70
|
-
** Bread
|
71
|
-
** Orange Juice
|
72
|
-
* Change Oil Filter on Car
|
73
|
-
|
74
|
-
is written like this
|
75
|
-
|
76
|
-
----
|
77
|
-
* Pay Bills
|
78
|
-
* Get Groceries
|
79
|
-
** Milk
|
80
|
-
** Bread
|
81
|
-
** Orange Juice
|
82
|
-
* Change Oil Filter on Car
|
83
|
-
----
|
84
|
-
|
85
|
-
Its translation into LaTeX is
|
86
|
-
|
87
|
-
----
|
88
|
-
\begin{itemize}
|
89
|
-
\item Pay Bills
|
90
|
-
\item Get Groceries
|
91
|
-
\begin{itemize}
|
92
|
-
\item Milk
|
93
|
-
\item Bread
|
94
|
-
\item Orange Juice
|
95
|
-
\end{itemize}
|
96
|
-
\item Change Oil Filter on Car
|
97
|
-
\end{itemize}
|
98
|
-
----
|
99
|
-
|
100
|
-
The corresponding ordered list,
|
101
|
-
|
102
|
-
. Pay Bills
|
103
|
-
. Get Groceries
|
104
|
-
.. Milk
|
105
|
-
.. Bread
|
106
|
-
.. Orange Juice
|
107
|
-
. Change Oil Filter on Car
|
108
|
-
|
109
|
-
is written as
|
110
|
-
|
111
|
-
----
|
112
|
-
. Pay Bills
|
113
|
-
. Get Groceries
|
114
|
-
.. Milk
|
115
|
-
.. Bread
|
116
|
-
.. Orange Juice
|
117
|
-
. Change Oil Filter on Car
|
118
|
-
----
|
119
|
-
|
120
|
-
with the following source in LaTex:
|
121
|
-
|
122
|
-
----
|
123
|
-
\begin{enumerate}
|
124
|
-
\item Pay Bills
|
125
|
-
\item Get Groceries
|
126
|
-
\begin{enumerate}
|
127
|
-
\item Milk
|
128
|
-
\item Bread
|
129
|
-
\item Orange Juice
|
130
|
-
\end{enumerate}
|
131
|
-
\item Change Oil Filter on Car
|
132
|
-
\end{enumerate}
|
133
|
-
----
|
134
|
-
|
135
|
-
=== Bold, italic, and monospaced text
|
136
|
-
|
137
|
-
The text "She said _potatoes_ but he said *potaatoes*", written
|
138
|
-
in Asciidoc as
|
139
|
-
|
140
|
-
----
|
141
|
-
She said _potatoes_ but he said *potaatoes*
|
142
|
-
----
|
143
|
-
is mapped to
|
144
|
-
|
145
|
-
----
|
146
|
-
She said \emph{potatoes} but he said \textbf{potaatoes}
|
147
|
-
----
|
148
|
-
|
149
|
-
The text
|
150
|
-
|
151
|
-
----
|
152
|
-
`monospaced`
|
153
|
-
----
|
154
|
-
|
155
|
-
is mapped to
|
156
|
-
|
157
|
-
----
|
158
|
-
{\tt monospaced}
|
159
|
-
----
|
160
|
-
|
161
|
-
|
162
|
-
=== Quotations
|
163
|
-
|
164
|
-
The text
|
165
|
-
|
166
|
-
----
|
167
|
-
[quote, Abraham Lincoln, Soldiers' National Cemetery Dedication]
|
168
|
-
____
|
169
|
-
Four score and seven years ago our fathers brought forth
|
170
|
-
on this continent a new nation
|
171
|
-
____
|
172
|
-
----
|
173
|
-
is mapped to
|
174
|
-
|
175
|
-
----
|
176
|
-
\begin{quote}
|
177
|
-
Four score and seven years ago our fathers brought forth
|
178
|
-
on this continent a new nation
|
179
|
-
\end{quote}
|
180
|
-
----
|
181
|
-
|
182
|
-
=== Footnotes
|
183
|
-
|
184
|
-
Text like this
|
185
|
-
----
|
186
|
-
Ho hum.footnote:[An epression of boredem]
|
187
|
-
----
|
188
|
-
is mapped to
|
189
|
-
|
190
|
-
----
|
191
|
-
Ho hum\footnote{An epression of boredem}
|
192
|
-
----
|
193
|
-
|
194
|
-
=== References and labels
|
195
|
-
|
196
|
-
The label
|
197
|
-
|
198
|
-
----
|
199
|
-
Ho hum[[foo]]
|
200
|
-
----
|
201
|
-
|
202
|
-
is mapped to
|
203
|
-
|
204
|
-
----
|
205
|
-
Ho hum\label{foo}
|
206
|
-
----
|
207
|
-
|
208
|
-
The cross-reference
|
209
|
-
|
210
|
-
----
|
211
|
-
Please see <<foo>>
|
212
|
-
----
|
213
|
-
|
214
|
-
is mapped to
|
215
|
-
|
216
|
-
----
|
217
|
-
Please see \ref{foo}
|
218
|
-
----
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
=== Hyperlinks
|
223
|
-
|
224
|
-
The hyperlink
|
225
|
-
|
226
|
-
----
|
227
|
-
http://nytimes.com[All the news that is fit to print]
|
228
|
-
----
|
229
|
-
|
230
|
-
is mapped to
|
231
|
-
|
232
|
-
----
|
233
|
-
\href{http://nytimes.com}{All the news that is fit to print}
|
234
|
-
----
|
235
|
-
|
236
|
-
=== Line breaks `+`
|
237
|
-
|
238
|
-
=== Listing
|
239
|
-
|
240
|
-
=== Open blocks
|
241
|
-
|
242
|
-
=== Literal
|
243
|
-
|
244
|
-
=== Page break
|
245
|
-
|
246
|
-
=== Pass
|
247
|
-
|
248
|
-
////
|
249
|
-
INLINE_TYPES = %w( inline_quoted)
|
250
|
-
BLOCK_TYPES = %w(admonition listing literal page_break paragraph stem pass open quote)
|
251
|
-
////
|
252
|
-
|
253
|
-
|
254
|
-
== Mathematical text
|
255
|
-
|
256
|
-
We distinguish between _inner text_ amd _outer text_. the first
|
257
|
-
appears between math delimiters, while the second does not.
|
258
|
-
|
259
|
-
=== Inner text
|
260
|
-
|
261
|
-
As noted in the introduction, mathematical text is enclosed in the
|
262
|
-
standard delimiters and is written in the normal way. Environments
|
263
|
-
supported in display math mode are
|
264
|
-
|
265
|
-
* matrix
|
266
|
-
* equation, including the label macro
|
267
|
-
|
268
|
-
|
269
|
-
=== Outer text
|
270
|
-
|
271
|
-
To write a theorem, do this:
|
272
|
-
|
273
|
-
----
|
274
|
-
.Theorem {counter:theorem}
|
275
|
-
--
|
276
|
-
For all $a$, $b$, $c$, the relation $a(b+c) = ab + ac$ holds.
|
277
|
-
--
|
278
|
-
----
|
279
|
-
|
280
|
-
This will render in Asciidoc as
|
281
|
-
|
282
|
-
.Theorem {counter:theorem}
|
283
|
-
--
|
284
|
-
_For all $a$, $b$, $c$, the relation $a(b+c) = ab + ac$ holds._
|
285
|
-
--
|