1

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!

5

There is no need to alter the template. You can use the Lato fonts via lato.sty. With this style you should give the options default and defaultsans to use Lato as default family and default sans-serif font, which can be done using the YAML fields fontfamily and fontfamilyoptions:

fontfamily: lato
fontfamilyoptions: 
- default
- defaultsans

Using an unmodified eisvogel.tex template together with this example document

---
title: "Example PDF"
author: [Author]
date: "2019-06-16"
subject: "Markdown"
keywords: [Markdown, Example]
lang: "en"
fontfamily: lato
fontfamilyoptions: 
- default
- defaultsans
...

# Vinaque sanguine metuenti cuiquam Alcyone fixus

Lorem markdownum Letoia, et alios: figurae flectentem annis aliquid Peneosque ab
esse, obstat gravitate.

and processed with

pandoc beamer.md -o beamer.pdf --from markdown --to beamer --template ./eisvogel.tex

produces a PDF that uses only Lato fonts:

$ pdffonts beamer.pdf 
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
BBNBGL+Lato-Regular                  Type 1            Custom           yes yes no      18  0
| improve this answer | |
  • Thankyou Ralf, I didn't realise that I had to specify the default values. I managed to get the Headings to be Lato-Light as well by using \addtokomafont - although the table of contents stubbornly remains bold! – JV53 Dec 3 '19 at 12:21
  • @JV53 You are welcome. Can you you provide a minimal example document showing the problem? Maybe best in a new question ... – Ralf Stubner Dec 3 '19 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.