Indeed! Thanks for sharing the pipeline details here ![]()
IDK how WSL works, so I haven’t tried it.
No prob. Each step is essentially RegEx substitution. Let me know if there is a specific one that interests you.
Typst templates…
I was able to get several Typst templates to work (when they were already made into Quarto extensions).
I added a feature to simply list Quarto extensions in the Squarto settings file:
quarto_extensions = [
'dialoa/imagify',
'schochastics/academicons',
'mvuorre/quarto-preprint',
'gordonwoodhull/quarto-haobook',
'gordonwoodhull/quarto-bookly',
'gordonwoodhull/quarto-wonderous-book',
'gordonwoodhull/quarto-ilm',
]
Thus, extensions do not need to be stored in the Squarto Project, but rather can be dynamically installed by Quarto at build time. (If you have your own extension that you wrote, you can store it in my_squarto_project/_squarto_settings/quarto_extensions/, and it will be similarly installed.)
The examples above shows some extensions that are different types of Typst book templates. To apply them, I just specify in my _quarto.yml file:
format:
typst:
# options go here
or
format:
ilm-typst:
# options go here
etc.
Everything works well in that regard.
The next challenge will be to actually modify the templates, which will require me to learn a bit about Typst. The templates are reasonable starting points, but some things are off related to margins, fonts, etc.
Pandoc templates or LaTeX partials…
I had less luck getting LaTeX partials to work. I set it up in Squarto so that all the partials can be stored in the preset directory my_squarto_project/_squarto_settings/quarto_presets/my_preset_name/partials/. These files get copied over into the Quarto Project no problem. The _quarto.yml allows specification of partials like this:
format:
pdf:
template-partials:
- partials/after-body.tex
# Other options here
But I can’t get this to work. I’ve reviewed the docs on replacing partials, but I wasn’t able to get that to work. There is a recent presentation from PostiConf25 that may be helpful.
So there’s something that I still don’t get about how it is supposed to work.
Oh, and a side note… Typst is fast! Rendering to PDF via Typst is 10-100x faster than via LaTeX methods.
Very pleasant surprise!
Yes, Typst is wicked fast, it really makes a difference if you work in a semi-visual manner and want to check layout etc. compared to LaTeX. If I have to use TeX, I still prefer XeLaTeX over LuaLaTeX just because it is ~2x faster; but Typst wipes the floor with all TeX engines (and installing Typst is >100x simpler, ~14mb single file vs. complex packages, updates, tlmgr etc.)
Hacking on Typst display code is really simple, especially because of the show rules you can inject tweaks anywhere you like: Styling – Typst Documentation – I found it easy to tweak to my preference. More complex dynamic layout can get a bit more challenging (Typsts uses context for this: Context – Typst Documentation), but looking at existing Typst templates on the Typst universe can help…
I’ve not made any Quarto custom templates, but suspect this is probably something quite minor. On the Pandoc side this is really simple, call --template for the main template and partials are called with their fullname like $document-metadata.latex()$. Quarto adds its own layer on top, which helps for packaging but somewhat complicates understanding how it works…
Quarto (v1.9) has updated its support for Typst, including Books projects.