2
2
3
3
## Introduction
4
4
This Lua filter is used to create images with or without captions from code
5
- blocks. Currently PlantUML, Graphviz, Ti* k* Z and Python can be processed.
6
- This document also serves as a test document, which is why the subsequent
7
- test diagrams are integrated in every supported language.
5
+ blocks. Currently PlantUML, Graphviz, Ti* k* Z, Asymptote, and Python can be
6
+ processed. This document also serves as a test document, which is why the
7
+ subsequent test diagrams are integrated in every supported language.
8
8
9
9
## Prerequisites
10
10
To be able to use this Lua filter, the respective external tools must be
@@ -211,6 +211,66 @@ key `activate_python_path` to `c:\ProgramData\Anaconda3\Scripts\activate.bat`.
211
211
212
212
Pandoc will activate this Python environment and starts Python with your code.
213
213
214
+ ## Asymptote
215
+ [ Asymptote] ( https://asymptote.sourceforge.io/ ) is a graphics
216
+ language inspired by Metapost. To use Asymptote, you will need to
217
+ install the software itself, a TeX distribution such as
218
+ [ TeX Live] ( https://www.tug.org/texlive/ ) , and
219
+ [ dvisvgm] ( https://dvisvgm.de/ ) , which may be included in the TeX
220
+ distribution.
221
+
222
+ If png output is required (such as for the ` docx ` , ` pptx ` and ` rtf `
223
+ output formats) Inkscape must be installed. See the Ti* k* Z section
224
+ for details.
225
+
226
+ Ensure that the Asymptote ` asy ` binary is in the path, or point
227
+ the environment variable ` ASYMPTOTE ` or the metadata variable
228
+ ` asymptotePath ` to the full path name. Asymptote calls the various
229
+ TeX utilities and dvipdfm, so you will need to configure Asymptote
230
+ so that it finds them.
231
+
232
+ ``` {.asymptote caption="This is an image, created by **Asymptote**."}
233
+ size(5cm);
234
+ include graph;
235
+
236
+ pair circumcenter(pair A, pair B, pair C)
237
+ {
238
+ pair P, Q, R, S;
239
+ P = (A+B)/2;
240
+ Q = (B+C)/2;
241
+ R = rotate(90, P) * A;
242
+ S = rotate(90, Q) * B;
243
+ return extension(P, R, Q, S);
244
+ }
245
+
246
+ pair incenter(pair A, pair B, pair C)
247
+ {
248
+ real a = abs(angle(C-A)-angle(B-A)),
249
+ b = abs(angle(C-B)-angle(A-B)),
250
+ c = abs(angle(A-C)-angle(B-C));
251
+ return (sin(a)*A + sin(b)*B + sin(c)*C) / (sin(a)+sin(b)+sin(c));
252
+ }
253
+
254
+ real dist_A_BC(pair A, pair B, pair C)
255
+ {
256
+ real det = cross(B-A, C-A);
257
+ return abs(det/abs(B-C));
258
+ }
259
+
260
+ pair A = (0, 0), B = (5, 0), C = (3.5, 4),
261
+ O = circumcenter(A, B, C),
262
+ I = incenter(A, B, C);
263
+ dot(A); dot(B); dot(C); dot(O, blue); dot(I, magenta);
264
+ draw(A--B--C--cycle, linewidth(2));
265
+ draw(Circle(O, abs(A-O)), blue+linewidth(1.5));
266
+ draw(Circle(I, dist_A_BC(I, A, B)), magenta+linewidth(1.5));
267
+ label("$A$", A, SW);
268
+ label("$B$", B, SE);
269
+ label("$C$", C, NE);
270
+ label("$O$", O, W);
271
+ label("$I$", I, E);
272
+ ```
273
+
214
274
## How to run pandoc
215
275
This section will show, how to call Pandoc in order to use this filter with
216
276
meta keys. The following command assume, that the filters are stored in the
@@ -232,6 +292,7 @@ All available environment variables:
232
292
- ` JAVA_HOME ` e.g. ` c:\Program Files\Java\jre1.8.0_201 ` ; Default: n/a
233
293
- ` DOT ` e.g. ` c:\ProgramData\chocolatey\bin\dot.exe ` ; Default: ` dot `
234
294
- ` PDFLATEX ` e.g. ` c:\Program Files\MiKTeX 2.9\miktex\bin\x64\pdflatex.exe ` ; Default: ` pdflatex `
295
+ - ` ASYMPTOTE ` e.g. ` c:\Program Files\Asymptote\asy ` ; Default: ` asy `
235
296
236
297
All available meta keys:
237
298
@@ -242,3 +303,4 @@ All available meta keys:
242
303
- ` java_path `
243
304
- ` dot_path `
244
305
- ` pdflatex_path `
306
+ - ` asymptote_path `
0 commit comments