8

I would like to do a beamer presentation using metropolis theme but am experiencing pb with Fira font.

I am with MacOs 10.13, and TexStudio.

I have checked these previous questions:

but none of the solutions proposed solved my pb.

I have downloaded the demo (as zip) from Overleaf web site. As in this demo package, the metropolis sty files are sitting next to my .tex

I downloaded Fira font as explained here: https://gist.github.com/muammar/a5ffb635eb7f532346a8e777b847f8a7 and Fira font is under my user/Library/Fonts.

I compile with xeLatex.

Here is a test doc:

\documentclass[10pt]{beamer}

\usetheme[progressbar=frametitle]{metropolis}
\usepackage{appendixnumberbeamer}
\usepackage{pgfplots}
\usepackage{xspace}

\newcommand{\themename}{\textbf{\textsc{metropolis}}\xspace}
\setsansfont[BoldFont={Fira Sans}]{Fira Sans Light}
\setmonofont{Fira Mono}
\usepackage[sfdefault]{Fira Sans}

\title{Problem with Fira Sans}
\subtitle{test}
\date{}


\begin{document}

\maketitle

\begin{frame}{Test font}
 \sffamily Fira Sans
 \itshape Fira Sans Italic
 \bfseries Fira Sans Italic Bold
 \upshape Fira Sans Bold
 \scshape Fira Sans Bold Small-Caps
 \itshape Fira Sans Bold Italic Small-Caps
 \mdseries Fira Sans Italic Small-Caps
 \upshape Fira Sans Small-Caps

 \ttfamily
 Fira Mono
 \bfseries Fira Mono Bold
\end{frame}

\begin{frame}[fragile]{Font not working}

  The \themename theme is a Beamer theme with minimal visual noise
  inspired by the \href{https://github.com/hsrmbeamertheme/hsrmbeamertheme}    {\textsc{hsrm} Beamer
  Theme} by Benjamin Weiss.

  Enable the theme by loading

  \begin{verbatim}    \documentclass{beamer}
    \usetheme{metropolis}\end{verbatim}

  Note, that you have to have Mozilla's \emph{Fira Sans} font and XeTeX
  installed to enjoy this wonderful typography.
\end{frame}

\end{document}

When using explicitely the font (Test font), it works, but the full document does not take Fira.

One last point: the log file shows that texlive is being used:

LaTeX Info: Redefining \ttfamily on input line 13.

(/usr/local/texlive/2017/texmf-dist/tex/latex/fira/FiraSans.sty
 Package: FiraSans 2016/11/20 (Bob Tennent and autoinst) Style file for Fira     San...
...
Requested font "[FiraSans-Regular.otf]/OT" at 10.0pt
 -> /usr/local/texlive/2017/texmf-dist/fonts/opentype/public/fira/FiraSans-    Regu
 lar.otf
 \g__fontspec_family_FiraSans_int=\count297
Requested font "[FiraSans-Bold.otf]/OT" at 10.0pt
 -> /usr/local/texlive/2017/texmf-dist/fonts/opentype/public/fira/FiraSans-     Bold
 .otf
 Requested font "[FiraSans-RegularItalic.otf]/OT" at 10.0pt
  -> /usr/local/texlive/2017/texmf-dist/fonts/opentype/public/fira/FiraSans-     Regu
 larItalic.otf
 Requested font "[FiraSans-BoldItalic.otf]/OT" at 10.0pt
  -> /usr/local/texlive/2017/texmf-dist/fonts/opentype/public/fira/FiraSans-Bold
 Italic.otf
 .................................................
 . fontspec info: "defining-font"
 . 
 . Font family 'FiraSans(0)' created for font 'FiraSans' with options
 . [Ligatures = TeX,Scale = 1,Extension = .otf,Ligatures=TeX,Numbers =
 . {Proportional,OldStyle},UprightFont = *-Regular,ItalicFont =
 . *-RegularItalic,BoldFont = *-Bold,BoldItalicFont = *-BoldItalic].
 .  
 s fonts.

(sorry for the no so well formatted copy-and-paste).

Many thanks in advance for your help.

ecrin
  • 121
  • 2
    +1 For code example and documented research :) – Dr. Manuel Kuehner Jun 09 '18 at 09:54
  • Are \usepackage{appendixnumberbeamer} \usepackage{booktabs} \usepackage[scale=2]{ccicons} \usepackage{pgfplots} \usepgfplotslibrary{dateplot} needed dor the problem at hand? – Dr. Manuel Kuehner Jun 09 '18 at 09:55
  • @Dr.ManuelKuehner no indeed these packages have nothing to do with the current pb. I just recompiled without them to get the test cleaner, pb persist. The issue message is still Font shape TU/FiraMono(1)/m/sc undefined(Font) using TU/FiraMono(1)/m/n instead. I have the feeling the pb is related to finding the font, but could not find how to do so far. – ecrin Jun 09 '18 at 10:07
  • I can't help you with your actual problem but normally it is good to remove all unrelated code part. – Dr. Manuel Kuehner Jun 09 '18 at 10:30
  • @Dr.ManuelKuehner: anyway, thanks for your attention! I edited the link to the overleaf demo, and remove unnecessary packages in the example code. Now waiting and hoping that someone could have the solution. – ecrin Jun 09 '18 at 12:03
  • @ecrin Can you try if you can compile the following with xelatex: `\documentclass{beamer} \usetheme{metropolis}

    \begin{document} \begin{frame} test \end{frame} \end{document} `

    – samcarter_is_at_topanswers.xyz Jun 09 '18 at 12:37
  • @ecrin If metropolis theme is compiled with xelatex, it automatically uses fira fonts, so it should not be necessary to set them yourself. In fact if I remove \setsansfont[BoldFont={Fira Sans}]{Fira Sans Light} \setmonofont{Fira Mono} \usepackage[sfdefault]{Fira Sans} from your example, I can compile with xelatex. – samcarter_is_at_topanswers.xyz Jun 09 '18 at 12:39
  • @ecrin Can you show the first few lines of your .log file? – samcarter_is_at_topanswers.xyz Jun 09 '18 at 12:40
  • @ecrin And welcome to TeX.Stackexchange! – samcarter_is_at_topanswers.xyz Jun 09 '18 at 12:41
  • @samcarter many thanks for your suggestions. Before seeing them I actually read carefully the 2300 lines of log file, and copied the FiraSans-xx.otf files from /Library/Fonts to /usr/local/texlive/2017/texmf-dist/fonts/opentype/public/fira, where those files existed already but were probably older. Don't really know why, but it solved the pb! Then I tested your 2 suggestions, both work. It's unfortunate we cannot know if this is because of moving the libs or removing the packages calls. I am relieved this beamer template finally compiles and I thank you for your support! – ecrin Jun 09 '18 at 13:17
  • @ecrin Good to hear it works! Have fun with beamer! – samcarter_is_at_topanswers.xyz Jun 09 '18 at 13:23
  • @ecrin The good thing on this site: it can have multiple answers. Please consider writing a short answer about your copying of the font files. – samcarter_is_at_topanswers.xyz Jun 09 '18 at 13:24

2 Answers2

4

In case it can help others facing same problem:

What works was to copy the Fira Font files I had downloaded as indicated here in user/Library/Fonts to the place where tex was actually looking for them (indicated in the log), i.e. /texlive/2017/texmf-dist/fonts/opentype/public/fira.

As indicated by @samcarter, no need to have \setsansfont[BoldFont={Fira Sans}]{Fira Sans Light} \setmonofont{Fira Mono} \usepackage[sfdefault]{Fira Sans}, xeLatex does the job by itself.

Last word: it pays off to look at the log file to understand what happens, even if long!

ecrin
  • 121
2

If the metropolis theme is compiled with xelatex, it uses fira fonts per default. So there is no need to manually interfere with the font selection and risk problems. In fact the example compiles just fine if the three lines related to fonts are removed.

% !TeX TS-program = xelatex

\documentclass[10pt]{beamer}

\usetheme[progressbar=frametitle]{metropolis}
\usepackage{appendixnumberbeamer}
\usepackage{pgfplots}
\usepackage{xspace}

\newcommand{\themename}{\textbf{\textsc{metropolis}}\xspace}
%\setsansfont[BoldFont={Fira Sans}]{Fira Sans Light}
%\setmonofont{Fira Mono}
%\usepackage[sfdefault]{Fira Sans}

\title{Problem with Fira Sans}
\subtitle{test}
\date{}


\begin{document}

\maketitle

\begin{frame}{Test font}
 \sffamily Fira Sans
 \itshape Fira Sans Italic
 \bfseries Fira Sans Italic Bold
 \upshape Fira Sans Bold
 \scshape Fira Sans Bold Small-Caps
 \itshape Fira Sans Bold Italic Small-Caps
 \mdseries Fira Sans Italic Small-Caps
 \upshape Fira Sans Small-Caps

 \ttfamily
 Fira Mono
 \bfseries Fira Mono Bold
\end{frame}

\begin{frame}[fragile]{Font not working}

  The \themename theme is a Beamer theme with minimal visual noise
  inspired by the \href{https://github.com/hsrmbeamertheme/hsrmbeamertheme}    {\textsc{hsrm} Beamer
  Theme} by Benjamin Weiss.

  Enable the theme by loading

  \begin{verbatim}    \documentclass{beamer}
    \usetheme{metropolis}\end{verbatim}

  Note, that you have to have Mozilla's \emph{Fira Sans} font and XeTeX
  installed to enjoy this wonderful typography.
\end{frame}

\end{document}