Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- run: sudo apt install -y ghostscript fonts-freefont-ttf
- uses: julia-actions/setup-julia@v2
with:
version: 1
Expand Down
4 changes: 3 additions & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Fontconfig = "186bb1d3-e1f7-5a2c-a377-96d770f13627"
InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
Latexify = "23fbe1c1-3f47-55db-b15f-69d7ec21a316"
Expand All @@ -14,5 +15,6 @@ Unitful = {path = ".."}

[compat]
Documenter = "1"
Latexify = "0.16.9"
Latexify = "0.16.10"
Plots = "1"
Fontconfig = "0.4"
20 changes: 15 additions & 5 deletions docs/generate_latex_images.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
using LaTeXStrings, Unitful, Latexify, tectonic_jll
using LaTeXStrings, Unitful, Latexify
import tectonic_jll # needed for lightweight LaTeX render
using Fontconfig: format, match, Pattern

# Since the docs can get built on different systems, we need to find a locally installed
# monospaced font that has enough Unicode coverage to handle π
monofont = format(match(Pattern(spacing=100, charset="3c0")), "%{family}")

commands = [
:(latexify(612.2u"nm")),
Expand All @@ -19,11 +25,16 @@ end
ltab1 = latextabular(tab1, adjustment=:l, transpose=true, latex=false, booktabs=true,
head=["julia", "\\LaTeX", "Result"])
# Setting an explicit white background color results in transparent PDF, so go offwhite.
ltab1 = LaTeXString("\\definecolor{offwhite}{rgb}{0.999,0.999,0.999}\n\\pagecolor{offwhite}\n\\color{black}\n" * ltab1)
ltab1 = LaTeXString("""
\\setmonofont{$monofont}
\\definecolor{offwhite}{rgb}{0.999,0.999,0.999}
\\pagecolor{offwhite}
\\color{black}
""" * ltab1)

render(ltab1, MIME("image/png"); use_tectonic=true,
name=(@__DIR__)*"/src/assets/latex-examples",
packages=["booktabs", "color", "siunitx"],
packages=["booktabs", "color", "siunitx", "fontspec"],
documentclass=("standalone"))

functions = [
Expand Down Expand Up @@ -133,8 +144,7 @@ ltab2 = latextabular(tab2, adjustment=:l, transpose=true, latex=false, booktabs=
# Set background to not-quite-white so it doesn't get treated as transparent
ltab2 = LaTeXString(
"""
\\setmainfont{FreeSerif}
\\setmonofont{FreeMono}
\\setmonofont{$monofont}
\\definecolor{offwhite}{rgb}{0.999,0.999,0.999}
\\pagecolor{offwhite}
\\color{black}
Expand Down
Loading