# Convert Markdown to PDF using Typst via Pandoc ## Basis Converting a basic Markdown file to PDF using the defaults: ```bash pandoc myFile.md --pdf-engine=typst -o myPDF.pdf ``` ### Metadata By default, the following metadata fields are recognized as elements in the PDF: ``` title: "<TITLE>" author: "<AUTHOR> date: "<DATE>" ``` ## Templates The default template can be viewed via `pandoc -D typst`. To use a specific template use ```bash pandoc myFile.md --pdf-engine=typst --template=myTemplate.typst -o myPDF.pdf ``` > [!IMPORTANT] > The default template for converting Markdown to PDF using Typst 0.15.0 in Pandoc 3.1.3 does not work, due to missing fonts. > >```bash > pandoc onepager.md --pdf-engine=typst -o myPDF.pdf error: font fallback list must not be empty ┌─ toPdfViaTempFile57159-0.html:46:17 │ 46 │ font: font, │ ^^^^ > > while calling `conf` at toPdfViaTempFile57159-0.html:90:14 > conf(…) > > Error producing PDF. > ``` > > As per [Issue #11238](https://github.com/jgm/pandoc/issues/11238), the workaround is specifying an available font in the metadata of the Markdown file: > > ```yaml > mainfont: "DejaVu Serif" > ``` --- ## Related - **previous** [[Entrypoint]] - **see** [[Pandoc]] for the software used to convert documents - **see** [[Typst]] for the typesetting software ## Sources - **references** [Using Pandoc and Typst to Produce PDFs](https://imaginarytext.ca/posts/2024/pandoc-typst-tutorial/) as the initial inspiration for using Typst instead of LaTeX ## Usage - **used in** none