|
1 | | -using LaTeXStrings, Unitful, Latexify, tectonic_jll |
| 1 | +using LaTeXStrings, Unitful, Latexify |
| 2 | +import tectonic_jll # needed for lightweight LaTeX render |
| 3 | +using Fontconfig: format, match, Pattern |
| 4 | + |
| 5 | +# Since the docs can get built on different systems, we need to find a locally installed |
| 6 | +# monospaced font that has enough Unicode coverage to handle π |
| 7 | +monofont = format(match(Pattern(spacing=100, charset="3c0")), "%{family}") |
2 | 8 |
|
3 | 9 | commands = [ |
4 | 10 | :(latexify(612.2u"nm")), |
|
19 | 25 | ltab1 = latextabular(tab1, adjustment=:l, transpose=true, latex=false, booktabs=true, |
20 | 26 | head=["julia", "\\LaTeX", "Result"]) |
21 | 27 | # Setting an explicit white background color results in transparent PDF, so go offwhite. |
22 | | -ltab1 = LaTeXString("\\definecolor{offwhite}{rgb}{0.999,0.999,0.999}\n\\pagecolor{offwhite}\n\\color{black}\n" * ltab1) |
| 28 | +ltab1 = LaTeXString(""" |
| 29 | + \\setmonofont{$monofont} |
| 30 | + \\definecolor{offwhite}{rgb}{0.999,0.999,0.999} |
| 31 | + \\pagecolor{offwhite} |
| 32 | + \\color{black} |
| 33 | +""" * ltab1) |
23 | 34 |
|
24 | | -render(ltab1, MIME("image/png"); use_tectonic=true, |
| 35 | +render(ltab1, MIME("image/png"); use_tectonic=true, open=false, |
25 | 36 | name=(@__DIR__)*"/src/assets/latex-examples", |
26 | | - packages=["booktabs", "color", "siunitx"], |
| 37 | + packages=["booktabs", "color", "siunitx", "fontspec"], |
27 | 38 | documentclass=("standalone")) |
28 | 39 |
|
29 | 40 | functions = [ |
@@ -133,14 +144,13 @@ ltab2 = latextabular(tab2, adjustment=:l, transpose=true, latex=false, booktabs= |
133 | 144 | # Set background to not-quite-white so it doesn't get treated as transparent |
134 | 145 | ltab2 = LaTeXString( |
135 | 146 | """ |
136 | | - \\setmainfont{FreeSerif} |
137 | | - \\setmonofont{FreeMono} |
| 147 | + \\setmonofont{$monofont} |
138 | 148 | \\definecolor{offwhite}{rgb}{0.999,0.999,0.999} |
139 | 149 | \\pagecolor{offwhite} |
140 | 150 | \\color{black} |
141 | 151 | """ * ltab2) |
142 | 152 |
|
143 | | -render(ltab2, MIME("image/png"); use_tectonic=true, |
| 153 | +render(ltab2, MIME("image/png"); use_tectonic=true, open=false, |
144 | 154 | tectonic_flags=`-Z continue-on-errors`, |
145 | 155 | name=(@__DIR__)*"/src/assets/latex-allunits", |
146 | 156 | packages=["booktabs", "color", "siunitx", "fontspec"], |
|
0 commit comments