I'm using the metropolis beamer theme. In beamerfontthememetropolis.sty, the fonts are loaded by font name, e.g.:

\setsansfont[ItalicFont={Fira Sans Light Italic},%
                 BoldFont={Fira Sans},%
                 BoldItalicFont={Fira Sans Italic}]%
                {Fira Sans Light}

however, I need to look up the fonts by file name since I don't have them installed globally. The situation arises for example when using Overleaf. The Overleaf documentation just suggests to change the \setXXXfont commands so to tell fontspec to look up the font by file name instead of by font name, and this makes sense.

However, I'm not setting the fonts myself, but rather I'm loading the metropolis theme, which loads the fonts and sets lots of beamer options. I could of course take the font settings from the metropolis code, paste it in my own theme and change the code, but that looks dirty.

So is there a way to tell metropolis to load specific file names for the Fira Sans font, without copy/pasting code from the theme itself?

Another way could be to issue the \setsansfont command after the loading the theme. But in this case, is there a way to temporarily suppress the "font not found" errors?

  • Why do you need to load font by filename on overleaf? If metropolis is compiled with xelatex or lualatex, it uses fira font by default, even on overleaf – samcarter_is_at_topanswers.xyz Nov 12 '18 at 14:07
  • So do you mean Overleaf has Fira Fonts installed and the metropolis theme finds them out of the box? – gigabytes Nov 12 '18 at 14:13
  • Yes, as long as you compile with xelatex or lualatex. – samcarter_is_at_topanswers.xyz Nov 12 '18 at 14:14
  • That's good news. Is this something that changed (relatively) recently? – gigabytes Nov 12 '18 at 14:15
  • I don't know. After reading your question I tested it and it worked. – samcarter_is_at_topanswers.xyz Nov 12 '18 at 14:16

The answer is simple: just do nothing.

As long as the document is compiled with xelatex or lualatex it will use fira fonts per default which also works on overleaf.

The following image shows how to select the engine on overleaf:

enter image description here

| improve this answer | |

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.