A New Typst Template for Pandoc

(imaginarytext.ca)

48 points | by ankitg12 1 day ago

4 comments

  • llimllib 1 hour ago
    I wish the article showed what the markdown format for working with typst and pandoc looked like, and what an output PDF looked like. I have no idea whether I'm interested or not from this article
  • Terretta 1 hour ago
    From the article:

    Last summer … Fast-forward to spring 2025. In the intervening months, Typst has been upgraded twice (to v0.13) and Pandoc has upgraded at least 3 times (currently at v3.6.4), and my templates don’t work anymore.

    This template is from March 2025, and we're now May 2026, with four more releases to Typst 0.14.2 (December 12, 2025), and with Pandoc 3.9.0.2 (2026-03-19).

  • LAC-Tech 43 minutes ago
    At the risk of making a fool of myself in-front of the rest of the class, I will come out and admit I don't know what the article is talking about.

    > Last summer I spent a lot of time with Typst (at that point v0.11) and Pandoc, working on a flexible and reusable workflow to typeset markdown-formatted articles to PDF.

    I understand that Typst is a markup language that can output a pdf file (big Typst fan btw).

    I understand Pandoc is a thing that transforms documents of one kind to documents of another, ie markdown to html.

    But the author wants to "typeset markdown-formatted article to PDF". Which makes me wonder what this has to do with typst at all.

    • thornewolf 15 minutes ago
      The author explain this in more detail in the article; I also was initially confused. The key details come from their broken down pandoc command. Specifically, these two flags:

        --pdf-engine=typst
        -V template=article.typ
      
      Despite the input content being a .md file, we see that the .md contents populate the .typ file. Pandoc then understands how to convert the populated .typ file into a .pdf. The author also notes in their hyperlinked .typ document where the body content is placed:

        // THIS IS THE ACTUAL BODY:
      
      What is not clear to me is the actual mechanism that tells pandoc where to place the body contents in the template. I presume it's some "magic" from the pandoc docs. The pandoc templates documentation[1] does reveal to us that `-V` is setting a variable called `template`. I don't have pandoc locally, but from another post[2] from the same author and a chatgpt query, it seems that the `body` symbol in the template is the chosen substitution symbol.

      [1]: https://pandoc.org/demo/example33/6-templates.html

      [2]: https://imaginarytext.ca/posts/2024/pandoc-typst-tutorial/

  • adolph 1 hour ago
    Thank you kind person for posting this. I've just started my Pandoc journey formatting books for reading in a secondhand Sony DPT-RP1.