I am converting Markdown documents via Pandoc to PDF, using a LaTeX template called Eisvogel. Pandoc is using pdfTeX, I believe. (I am rather new to all of this so please forgive me in advance!)
The template: https://github.com/Wandmalfarbe/pandoc-latex-template/blob/master/eisvogel.tex
In a nutshell: I need to have my text font as 'Lato', and the headings to be 'Lato Light'.
I have managed to set "Lato" as the font for the text in the body of my documents (in a rather roundabout way), however, the section headings appear to (I think) be controlled by Beamer.
Strangely, Lato is used for the 3rd level heading links in the TOC, but the headings themselves are in LM Sans 10, as are the other headings in the TOC.
I previously tried using "fontfamily: Lato" in the YAML header of my markdown documents, but I got this error: Error producing PDF.
! pdfTeX error (font expansion): auto expansion is only possible with scalable
fonts.
Instead, I got the text font to work by changing the default font family to Lato:
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
$if(fontfamily)$
$else$
\usepackage[default]{Lato}
\usepackage[T1]{fontenc}
$endif$
\else % if not pdftex
$if(mainfont)$
$else$
\usepackage[default]{Lato}
\usepackage[T1]{fontenc}
I had thought that "if(fontfamily)" would just use the "Lato" from my YAML, but obviously not – only by putting it as the "else" does it work which, now I think I understand, is because it's the Beamer part of this that is throwing the error, not this section of code.
So it seems that the problem is with Beamer. The rest of LaTeX/Pandoc, has no problem with Lato when it's for normal text, but I think Beamer must be trying to do something to it for headings which it doesn't like. I've tried simply putting \usepackage{lato} instead of \usepackage{lmodern} in the below, to no avail.
$if(beamerarticle)$
\usepackage{beamerarticle} % needs to be loaded first
$endif$
$if(fontfamily)$
\usepackage[$for(fontfamilyoptions)$$fontfamilyoptions$$sep$,$endfor$]{$fontfamily$}
$else$
\usepackage{lmodern}
$endif$
This is where I've kind of come to a wall in my journey. I know that Lato can be used because it works for normal text in my document, and I've seen examples of people using Lato as headers for slides and documents during my travels, so I don't understand why Beamer has to use lmodern and really doesn't like to use Lato.
Any guidance or explanation of where I'm going wrong would be greatly appreciated!
Best Answer
There is no need to alter the template. You can use the Lato fonts via
lato.sty
. With this style you should give the optionsdefault
anddefaultsans
to use Lato as default family and default sans-serif font, which can be done using the YAML fieldsfontfamily
andfontfamilyoptions
:Using an unmodified
eisvogel.tex
template together with this example documentand processed with
produces a PDF that uses only Lato fonts: