There is a beautiful new markup + PDF output engine available called Typst. It has similar syntax to markdown, yet is actually a LaTex replacement. Look through this tutorial:
Typst is so much more elegant than LaTeX, yet as it can embed programming functions directly can be extended in many ways. There are of course still outstanding weaknesses compared to LaTeX (given decades of packages and development); you can read more on the comparison with LaTeX here: Guide for LaTeX users â Typst Documentation
You can install the command-line version using homebrew: brew install typst â there is an online editor too.
Pandoc now supports Typst input/output, so existing Pandoc projects can be configured to use Typst as the PDF engine. Scrivener could also easily output typst PDFs without needing Pandoc by using Styles, Section Types and the compiler post-processor directly.
Read about this in the release notes for the latest release of pandoc however Typst is still very much in development (0.4 at this moment in time) and much missing for seasoned LaTeX users. Maybe in time it will rival LaTeX but right now it has serious limitations. Worth reading John MacFarlaneâs comments on his announcement that pandoc 3.1.3 now has preliminary support for Typst.
Typst is definitely a young project, with the chance that some of the core syntax may change. You can have a look at their Roadmap to see where they are heading (lots of really neat stuff). For most mortal humans LaTeX (powerful as it is) is a series of unintelligible incantantions that can work wonders, but requires a high cognitive load, inelegant markup (solved by using Pandoc or MMD of course) and tons of google searching to make âsimpleâ changes. I honestly do not use most of the possible packages LaTeX offers, and sometimes just drop doing something in LaTeX as I can do it more simply in LibreOffice.
Iâm curious, what do the Typst folks envision scholars who use their platform will submit to journals? Not the pdf, right? But then what will the journalsâ typesetters use? A Typst source file?
Seems to me that outputting to LaTeX or Word is needed before Typst will take off. What am I missing?
Yes, the final submission puzzle for academics is still undefined from the Typst website at least, perhaps you can ask on their discord server? I assumed Pandoc would serve as that bridge, and thought i saw some interaction between Typst developers and John (Pandoc creator) but forget where I saw that. Typst is still in quite a state of flux, and as beautifully elegant as it is, Iâll stick to markdown for the time being for most projects
I saw that as of the latest version of Pandoc, it can serve as a reader and writer of Typst. So perhaps youâre right that the Typst folks plan to rely on that.
You can just use Typst directly, without having to transcode to/from Markdown (Pandoc/Quarto etc.) â there is certainly enough in its layout engine to make book projects, though things will get much better as their roadmap gets filled out: Roadmap â Typst Documentation
Yup! But this would remove Scrivener from the equation, and I wouldnât want to do it!
Iâm very confident this missing part will be added together with others. It looks like Quarto and Typst are of the same ethos, trying to make modern tools for an old task.
Not at all, I mean to use Scrivenerâs compiler to output Typst and use the typst command as the post-processor, much like the direct-LaTeX template does. With careful structuring, you can use styles and section types to drive either markdown or typst outputs. Scrivener always stays in the driverâs seat, it is the compiler that is tasked with the work of translationâŠ
My original note about Typst not being compatibile with Quartoâs book format is particularly obtuse. This shows how confused I am with this matter.
Obviously, there is no reason to go through the book format, when all that Typst is called to do is a monolithic PDF file. So, the workflow is Scrivener â Pandoc â Quarto â Typst with a single .md file.
Well, Iâve been able to compile my first PDF with Quarto and Typst. Only, it is just EVERYTHING I typed in Scrivener, including the markup codes.
I added a configuration block at the beginning of the .md file to be processed, but maybe I lack some more information about what to add there. For example, the template is probably just a placeholder.
For example, when running a quarto typst compile [filename] command, I get several errors of this type:
error: expected expression
ââ Documents/[filename and path]:13:1
â
13 â # This is a title
â ^
I donât see anything wrong, according to the Pandoc markdown syntax. So, I wouldnât know what to fix.
I also get several errors from asterisks (*) used by the compiler for bullet lists. And hashtags (#) inserted in the text (representing note names with a sharp symbol, for example in âC#â) are reported as errors by Quarto/Typst. And text between strong/bold markup (**[text]**) is reported as âno textâ, and âunnecessary multiple consecutive starsâ.
I use brew to install pandoc and typst, and even though I do add /opt/homebrew/bin (where both pandoc and typst commands are found) to the environment, Scrivener causes Pandoc to fail to find Typst.
UPDATE: in fact I can get the PDF directly from Scrivener now:
Headings, inline styles, figures, footnotes etc. are working; more advanced features will need more tweaking and some method to inject typst markup directly to change the layout etc. is still required.
The one I tried was the simplest one (a title, a body text). But now I understand what could have been wrong: I presumed that the source markdown file had to be in Pandoc markdown syntax. Apparently, it has to be in the Typst syntax.
In fact, when I replaced the hashtag (#) with an equali sign (=) in the source file, the document sections were understood, and the PDF file generated. Only, it also contained the configuration block. Iâm using the most up-to-date versions of Quarto, Typst and Pandoc, as from their official installers (even if beta).
So, I guess compiling from Scrivener should require something similar to the LaTeX Modern template. It is not just a matter of letting Quarto convert a Pandoc MMD file generated by Scrivener. I understand it will be quite a work, even if probably much easier than with LaTeX.
At this point, Iâm not sure what the Pandoc Typst writer is doing.
EDIT: Or, maybe I should tell the compile format, in Scrivener, that it should use Typst for conversion? Writing it in the documentâs configuration head is not enough, even for Quarto?
No, your new presumption is wrong, the old one was fine!
The ideal workflow:
The text in Scrivener should use Scrivenerâs styles and Section Types, so emphasis for italic etc. and use appropriate Section Types.
Then you compile to Pandoc markdown.
Scrivener compiler makes a Pandoc MD file.
The pandoc command is: pandoc -f markdown -t typst -o out.pdf in.md â this command can be done in the post-processing pane of the compiler or you can run it yourself in TerminalâŠ
You will get a PDF next to the MD file. See above for the sample I made direct from Scrivener.
I attached a working Scrivener project that demonstrates how to do this above. I have an Apple Silicon Mac so my homebrew is /opt/homebrew/bin so if you have an Intel youâll need to change the post-processing commands. But that project demonstrates what you need.
We can build from that, as we can use Styles or Section Types to inject the formatting markup for e.g. one/two columns, fonts etc. So that just as for Quarto compile formats, we can do detailed layout using Scrivenerâs editing features⊠The limits for this workflow will be reached when we bump up to Typst limitations or the fact Pandoc may not fully support all typst featuresâŠ
Just to clarify: Quarto may not support Typst properly yet, so using Quarto instead of Pandoc adds lots of additional complexity, just stick to pandoc for the moment. Again open my project and see exactly what is done thereâŠ
For Typst youâd use injected typst markup for layout changes, and for Prince youâd use injected CSS, but this now gives you maximum flexibility without any editor changesâŠ