diff --git a/demos/Project.toml b/demos/Project.toml index 2edc09af2..2f4ea7739 100644 --- a/demos/Project.toml +++ b/demos/Project.toml @@ -7,5 +7,6 @@ Latexify = "23fbe1c1-3f47-55db-b15f-69d7ec21a316" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d" PyPlot = "d330b81b-6aea-500a-939a-2ce795aea3ee" +TikzPictures = "37f6aa50-8035-52d0-81c2-5a1d08754b2d" WGLMakie = "276b4fcb-3e11-5398-bf8b-a0c2d153d008" Weave = "44d3d7a6-8a23-5bf8-98c5-b353f8df5ec9" diff --git a/demos/config.md b/demos/config.md index 9167f85ce..535cb8e03 100644 --- a/demos/config.md +++ b/demos/config.md @@ -9,9 +9,10 @@ maxtoclevel = 3 mathjax = false ignore = ["foo/content.md"] weave = false - generate_sitemap = true +isAppleARM = Sys.isapple() && Sys.ARCH === :aarch64 + # supports question 001 members_from_csv = eachrow(readdlm("_assets/members.csv", ',', skipstart=1)) +++ diff --git a/demos/index.md b/demos/index.md index 00baa1605..a55337bbd 100644 --- a/demos/index.md +++ b/demos/index.md @@ -251,11 +251,12 @@ and that's it 🏁. ## (009) custom environment for TikzCD -> TikzCDs is currently too disfunctional so the demo is commented out for now. Like TikzPicture, it's possible to make it work with Tectonic but Tectonic doesn't work on M* macs. +{{if isAppleARM}} +> This demo unfortunately doesn't work on Apple ARM since it uses tectonic through the [TikzPictures.jl](https://github.com/JuliaTeX/TikzPictures.jl) package. See issue [Tectonic.jl#13](https://github.com/MichaelHatherly/Tectonic.jl/issues/13). - - +{{end}} ## (008) (custom) environments and commands diff --git a/demos/utils.jl b/demos/utils.jl index 4b47bdbc8..c58858ac0 100644 --- a/demos/utils.jl +++ b/demos/utils.jl @@ -4,12 +4,16 @@ # Project.toml and the `deploy.yml` file here as examples. # using DelimitedFiles -# using TikzCDs using Dates using Weave using DataFrames using PrettyTables +const isAppleARM = Sys.isapple() && Sys.ARCH === :aarch64 +if !isAppleARM + using TikzPictures +end + # ======================================================================== ########### @@ -73,21 +77,28 @@ end ### 009 ### ########### -# XXX TikzCD is too disfunctional as of April 2023 - -# function env_tikzcd(e, _) -# content = strip(Franklin.content(e)) -# name = strip(Franklin.content(e.braces[1])) -# # save SVG at __site/assets/[path/to/file]/$name.svg -# rpath = joinpath("assets", splitext(Franklin.locvar(:fd_rpath))[1], "$name.svg") -# outpath = joinpath(Franklin.path(:site), rpath) -# # if the directory doesn't exist, create it -# outdir = dirname(outpath) -# isdir(outdir) || mkpath(outdir) -# # save the file and show it -# save(SVG(outpath), TikzCD(content)) -# return "\\fig{/$(Franklin.unixify(rpath))}" -# end +if !isAppleARM + + # so we don't have to install LaTeX on CI + tikzUseTectonic(true) + + function env_tikzcd(e, _) + content = strip(Franklin.content(e)) + name = strip(Franklin.content(e.braces[1])) + # save SVG at __site/assets/[path/to/file]/$name.svg + rpath = joinpath("assets", splitext(Franklin.locvar(:fd_rpath))[1], "$name.svg") + outpath = joinpath(Franklin.path(:site), rpath) + # if the directory doesn't exist, create it + outdir = dirname(outpath) + isdir(outdir) || mkpath(outdir) + # save the file and show it + save(SVG(outpath), TikzPicture(content; environment="tikzcd", preamble="\\usepackage{tikz-cd}")) + return "\\fig{/$(Franklin.unixify(rpath))}" + end + +else + env_tikzcd(_, _) = "" +end ########### ### 013 ###