rpdfpdf-generationquarto

Set CMU Sans Serif font on pdf quarto


I've been using Quarto for a few days to produce pdf documents. When specifying the main font used, I can perfectly well choose "Cambria" or "Calibri", but I cannot choose fonts like "Computer Modern Sans Serif".

    format:
     pdf:
     toc: true
     toc-title: "Text mining"
     number-sections: true
     colorlinks: true
     pdf-engine: lualatex
     mainfont: "Computer Modern"
     fontsize: 12pt

What changes should I make to the code to produce pdfs in the font of my choice? The solution proposed here won't work.


Solution

  • You could use fontfamily in your yaml header with pdflatex engine and check The LaTeX Font Catalogue, which shows that Computer Modern Sans Serif is available. Here some reproducible code:

    ---
    format:
      pdf:
        toc: true
        toc-title: "Text mining et Première Guerre mondiale"
        number-sections: true
        colorlinks: true
        pdf-engine: pdflatex
        fontfamily: "Computer Modern Sans Serif"
        fontsize: 12pt
    ---
    
    This is some example text.