Hacker News new | ask | show | jobs
by mr_mitm 4 hours ago
You can pass a JSON structure to a Typst document and render it however you like. No need for a templating engine or anything like that.

Pandoc probably uses latex under the hood, and Typst is order of magnitudes faster. Also, much better error messages.

Typst is vastly superior for usage in automation or when developing document classes.

If that's not your use case, don't bother.

2 comments

you can tell pandoc to use typst as pdf-engine.

I use this command to create pdf from my md file.

  Downloads/pandoc-3.9/bin/pandoc \
  README.md \
  -o "my-output.pdf" \
  --pdf-engine=typst \
  -V papersize=a4 \
  -V fontsize=10pt \
  -V margin-left=2.5cm \
  -V margin-right=2.5cm \
  -V margin-top=2.5cm \
  -V margin-bottom=2.5cm \
  -V title="My title" \
  -V lang=de \
  --include-in-header=typst-header.typ \
  --toc --toc-depth=3 2>&1
That's the typst-header.typ

  #set figure(placement: none)
  #show figure: set block(breakable: true)
  #set table(
    inset: 5pt,
    stroke: 0.5pt + rgb("#cccccc"),
  )
  #show table: set text(size: 8pt)
  #show table.cell: it => {
    set text(hyphenate: true)
    show raw: set text(size: 6.5pt)
    it
  }
  #set par(justify: true)
  #show heading: it => block(sticky: true, it)
To produce a pdf, pandoc uses typst, pdfroff, lualatex, whatever you please. There is no particular connection to latex. The idea exhibits complete ignorance.
There was probably a nicer way of expressing this, but yes, ideally I will continue to use Org mode for my documents and substitute typst for LaTex when exporting to pdf.