# TYPST: A new markup + page layout engine to take on LaTeX

**URL:** <https://forum.literatureandlatte.com/t/typst-a-new-markup-page-layout-engine-to-take-on-latex/134674>\
**Category:** Markdown & LaTeX\
**Created:** [June 7, 2023, 3:46pm UTC](https://forum.literatureandlatte.com/t/typst-a-new-markup-page-layout-engine-to-take-on-latex/134674 "2023-06-07T15:46:26Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![nontroppo](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/nontroppo/32/15746_2.png) [@nontroppo](https://forum.literatureandlatte.com/u/nontroppo)\
**Post date:** [June 7, 2023, 3:46pm UTC](https://forum.literatureandlatte.com/t/typst-a-new-markup-page-layout-engine-to-take-on-latex/134674/1 "2023-06-07T15:46:26Z")

</div>

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:

> **[Advanced Styling – Typst Documentation](https://typst.app/docs/tutorial/advanced-styling/#guidelines)**
>
> Typst's tutorial.

To see how layout like this becomes a nice PDF:

 ![Screenshot 2023-06-07 at 23.36.19](https://forum.literatureandlatte.com/uploads/default/original/3X/0/2/0261013a9b5735ab527fd9e9ff5c651f4d8a9fcd.png)

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](https://typst.app/docs/guides/guide-for-latex-users/)

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.

---

<div class="post-metadata">

**Author:** ![reepicheep](https://forum.literatureandlatte.com/letter_avatar_proxy/v4/letter/r/ed655f/32.png) [@reepicheep](https://forum.literatureandlatte.com/u/reepicheep)\
**Post date:** [June 7, 2023, 4:05pm UTC](https://forum.literatureandlatte.com/t/typst-a-new-markup-page-layout-engine-to-take-on-latex/134674/2 "2023-06-07T16:05:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nontroppo](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/nontroppo/32/15746_2.png) [@nontroppo](https://forum.literatureandlatte.com/u/nontroppo)\
**Post date:** [June 7, 2023, 11:38pm UTC](https://forum.literatureandlatte.com/t/typst-a-new-markup-page-layout-engine-to-take-on-latex/134674/3 "2023-06-07T23:38:43Z")

</div>

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](https://typst.app/docs/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.

Can you link to John’s comments, thanks?

---

<div class="post-metadata">

**Author:** ![reepicheep](https://forum.literatureandlatte.com/letter_avatar_proxy/v4/letter/r/ed655f/32.png) [@reepicheep](https://forum.literatureandlatte.com/u/reepicheep)\
**Post date:** [June 8, 2023, 5:33pm UTC](https://forum.literatureandlatte.com/t/typst-a-new-markup-page-layout-engine-to-take-on-latex/134674/4 "2023-06-08T17:33:14Z")

</div>

> [@nontroppo](#):
>
> For most mortal humans LaTeX (powerful as it is) is a series of unintelligible incantantions that can work wonders,

After working on SGML and LaTex for decades those incantations are my first language.

> [@nontroppo](#):
>
> Can you link to John’s comments, thanks?

He made the comments in the email announcement to the pandoc mailing list; if Google hasn’t screwed it up this is the link to that message.

[https://groups.google.com/g/pandoc-discuss/c/B7V9V2QVPQI/m/UFXIs4XdCgAJ](https://groups.google.com/g/pandoc-discuss/c/B7V9V2QVPQI/m/UFXIs4XdCgAJ)

---

<div class="post-metadata">

**Author:** ![jpkell](https://forum.literatureandlatte.com/letter_avatar_proxy/v4/letter/j/919ad9/32.png) [@jpkell](https://forum.literatureandlatte.com/u/jpkell)\
**Post date:** [August 9, 2023, 2:17pm UTC](https://forum.literatureandlatte.com/t/typst-a-new-markup-page-layout-engine-to-take-on-latex/134674/5 "2023-08-09T14:17:00Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![nontroppo](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/nontroppo/32/15746_2.png) [@nontroppo](https://forum.literatureandlatte.com/u/nontroppo)\
**Post date:** [August 10, 2023, 2:37am UTC](https://forum.literatureandlatte.com/t/typst-a-new-markup-page-layout-engine-to-take-on-latex/134674/6 "2023-08-10T02:37:26Z")

</div>

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 😊

---

<div class="post-metadata">

**Author:** ![jpkell](https://forum.literatureandlatte.com/letter_avatar_proxy/v4/letter/j/919ad9/32.png) [@jpkell](https://forum.literatureandlatte.com/u/jpkell)\
**Post date:** [August 10, 2023, 6:22pm UTC](https://forum.literatureandlatte.com/t/typst-a-new-markup-page-layout-engine-to-take-on-latex/134674/7 "2023-08-10T18:22:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ptram](https://forum.literatureandlatte.com/letter_avatar_proxy/v4/letter/p/49beb7/32.png) [@ptram](https://forum.literatureandlatte.com/u/ptram)\
**Post date:** [September 9, 2023, 6:30pm UTC](https://forum.literatureandlatte.com/t/typst-a-new-markup-page-layout-engine-to-take-on-latex/134674/8 "2023-09-09T18:30:20Z")

</div>

It looks like Typst is not supported by the Quarto book format. When I compile I get :

WARNING: The typst format is not supported by book projects

So, alas, it can’t yet be used as an alternative to LaTeX for entire projects. Single files do work.

Paolo

---

<div class="post-metadata">

**Author:** ![nontroppo](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/nontroppo/32/15746_2.png) [@nontroppo](https://forum.literatureandlatte.com/u/nontroppo)\
**Post date:** [September 11, 2023, 1:21am UTC](https://forum.literatureandlatte.com/t/typst-a-new-markup-page-layout-engine-to-take-on-latex/134674/9 "2023-09-11T01:21:52Z")

</div>

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](https://typst.app/docs/roadmap/)

---

<div class="post-metadata">

**Author:** ![scrive](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/scrive/32/15869_2.png) [@scrive](https://forum.literatureandlatte.com/u/scrive)\
**Post date:** [September 11, 2023, 5:52am UTC](https://forum.literatureandlatte.com/t/typst-a-new-markup-page-layout-engine-to-take-on-latex/134674/10 "2023-09-11T05:52:20Z")

</div>

Hi [nontroppo](https://forum.literatureandlatte.com/u/nontroppo),

Thanks for the ‘[Homebrew](https://formulae.brew.sh/formula/)’ Terminal command …

I’ll likely be keeping an eye on Typst development … could be interesting!

Thanks again,  
scrive  
🤔

---

<div class="post-metadata">

**Author:** ![ptram](https://forum.literatureandlatte.com/letter_avatar_proxy/v4/letter/p/49beb7/32.png) [@ptram](https://forum.literatureandlatte.com/u/ptram)\
**Post date:** [September 11, 2023, 4:41pm UTC](https://forum.literatureandlatte.com/t/typst-a-new-markup-page-layout-engine-to-take-on-latex/134674/11 "2023-09-11T16:41:56Z")

</div>

> [@nontroppo](#):
>
> You can just use Typst directly, without having to transcode to/from Markdown (Pandoc/Quarto etc.)

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.

Paolo

---

<div class="post-metadata">

**Author:** ![nontroppo](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/nontroppo/32/15746_2.png) [@nontroppo](https://forum.literatureandlatte.com/u/nontroppo)\
**Post date:** [September 12, 2023, 12:40am UTC](https://forum.literatureandlatte.com/t/typst-a-new-markup-page-layout-engine-to-take-on-latex/134674/12 "2023-09-12T00:40:21Z")

</div>

> [@ptram](#):
>
> Yup! But this would remove Scrivener from the equation, and I wouldn’t want to do it!

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…

---

<div class="post-metadata">

**Author:** ![ptram](https://forum.literatureandlatte.com/letter_avatar_proxy/v4/letter/p/49beb7/32.png) [@ptram](https://forum.literatureandlatte.com/u/ptram)\
**Post date:** [September 20, 2023, 9:03am UTC](https://forum.literatureandlatte.com/t/typst-a-new-markup-page-layout-engine-to-take-on-latex/134674/13 "2023-09-20T09:03:08Z")

</div>

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.

Paolo

---

<div class="post-metadata">

**Author:** ![ptram](https://forum.literatureandlatte.com/letter_avatar_proxy/v4/letter/p/49beb7/32.png) [@ptram](https://forum.literatureandlatte.com/u/ptram)\
**Post date:** [September 20, 2023, 5:55pm UTC](https://forum.literatureandlatte.com/t/typst-a-new-markup-page-layout-engine-to-take-on-latex/134674/14 "2023-09-20T17:55:59Z")

</div>

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.

```plaintext
---
title: "My Project"
format:
  typst:
    toc: true
    section-numbering: false
    columns: 1
    papersize: a5
    fontsize: 9.5
---

```

But not even the page format was considered. Let’s look for some additional manuals…

Paolo

---

<div class="post-metadata">

**Author:** ![ptram](https://forum.literatureandlatte.com/letter_avatar_proxy/v4/letter/p/49beb7/32.png) [@ptram](https://forum.literatureandlatte.com/u/ptram)\
**Post date:** [September 20, 2023, 7:52pm UTC](https://forum.literatureandlatte.com/t/typst-a-new-markup-page-layout-engine-to-take-on-latex/134674/15 "2023-09-20T19:52:06Z")

</div>

For example, when running a `quarto typst compile [filename]` command, I get several errors of this type:

```plaintext
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”.

Really mysterious.

Paolo

---

<div class="post-metadata">

**Author:** ![nontroppo](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/nontroppo/32/15746_2.png) [@nontroppo](https://forum.literatureandlatte.com/u/nontroppo)\
**Post date:** [September 21, 2023, 3:08am UTC](https://forum.literatureandlatte.com/t/typst-a-new-markup-page-layout-engine-to-take-on-latex/134674/16 "2023-09-21T03:08:09Z")

</div>

Can you make a simple project that is failing. It is always helpful for others as they can quickly test what may be not working in your setup…

---

<div class="post-metadata">

**Author:** ![nontroppo](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/nontroppo/32/15746_2.png) [@nontroppo](https://forum.literatureandlatte.com/u/nontroppo)\
**Post date:** [September 21, 2023, 5:45am UTC](https://forum.literatureandlatte.com/t/typst-a-new-markup-page-layout-engine-to-take-on-latex/134674/17 "2023-09-21T05:45:28Z")

</div>

Here is a simple test, uses Pandoc → Typst

[typst.scriv.zip](https://forum.literatureandlatte.com/uploads/short-url/eySbahxkMGoTzJwBHKhAHfyHytU.zip) (237.2 KB)

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:

[typst.pdf.zip](https://forum.literatureandlatte.com/uploads/short-url/xMinnFbM5pSfWj7yD83aJ9bsIY7.zip) (236.6 KB)

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.

 ![Screenshot 2023-09-21 at 13.59.33](https://forum.literatureandlatte.com/uploads/default/original/3X/8/6/8681cd9f1dab7cf35c22c50ff754868fda304660.png)

---

<div class="post-metadata">

**Author:** ![ptram](https://forum.literatureandlatte.com/letter_avatar_proxy/v4/letter/p/49beb7/32.png) [@ptram](https://forum.literatureandlatte.com/u/ptram)\
**Post date:** [September 21, 2023, 12:59pm UTC](https://forum.literatureandlatte.com/t/typst-a-new-markup-page-layout-engine-to-take-on-latex/134674/18 "2023-09-21T12:59:28Z")

</div>

> [@nontroppo](#):
>
> Can you make a simple project that is failing

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?

Paolo

[quarto-typst-right-wrong.zip](https://forum.literatureandlatte.com/uploads/short-url/beil81zmRzRIHoOrX4yLmjf7CQb.zip) (1.6 KB)

---

<div class="post-metadata">

**Author:** ![nontroppo](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/nontroppo/32/15746_2.png) [@nontroppo](https://forum.literatureandlatte.com/u/nontroppo)\
**Post date:** [September 22, 2023, 12:40am UTC](https://forum.literatureandlatte.com/t/typst-a-new-markup-page-layout-engine-to-take-on-latex/134674/19 "2023-09-22T00:40:37Z")

</div>

> [@ptram](#):
>
> 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.

No, your new presumption is wrong, the old one was fine! 😜

The ideal workflow:

1. The text in Scrivener should use Scrivener’s styles and Section Types, so emphasis for italic etc. and use appropriate Section Types.
2. Then you compile to Pandoc markdown.
3. Scrivener compiler makes a Pandoc MD file.
4. 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…
5. 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…

> [@ptram](#):
>
> 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?

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…

---

<div class="post-metadata">

**Author:** ![nontroppo](https://forum.literatureandlatte.com/user_avatar/forum.literatureandlatte.com/nontroppo/32/15746_2.png) [@nontroppo](https://forum.literatureandlatte.com/u/nontroppo)\
**Post date:** [September 22, 2023, 12:52am UTC](https://forum.literatureandlatte.com/t/typst-a-new-markup-page-layout-engine-to-take-on-latex/134674/20 "2023-09-22T00:52:30Z")

</div>

And to really reinforce the power of this, I just slightly tweaked the post-processing to use PrinceXML:

```plaintext
pandoc -t html5 --pdf-engine=prince -o prince.pdf -i in.md

```

And so the same Scrivener project (no editor changes) can now compile automagically to either HTML+PDF or Typst+PDF…

[prince.pdf.zip](https://forum.literatureandlatte.com/uploads/short-url/dhB2CpCaqLo5lWlVnAdk5QF4WMN.zip) (110.8 KB)

 ![Screenshot 2023-09-22 at 08.54.21_SMALL](https://forum.literatureandlatte.com/uploads/default/original/3X/7/4/7470db3464cd9e2b12663684acf25f887ddf0c99.png)

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…

[Next page](https://forum.literatureandlatte.com/t/typst-a-new-markup-page-layout-engine-to-take-on-latex/134674.md?page=2)
