Beamer 与 Metropolis 主题:MacOS 上的 Fira Font 问题

Beamer 与 Metropolis 主题:MacOS 上的 Fira Font 问题

我想使用 metropolis 主题做一个 beamer 演示,但是正在使用 pb 体验Fira font

我使用 MacOs 10.13 和 TexStudio。

我已经检查过这些先前的问题:

但提出的解决方案都无法解决我的 pb。

我已经下载了演示(以 zip 格式)来自 Overleaf 网站。与此演示包一样,metropolis sty 文件位于我的 .tex 旁边

我下载了 Fira 字体,如下所述:https://gist.github.com/muammar/a5ffb635eb7f532346a8e777b847f8a7和 Fira 字体在我的下面user/Library/Fonts

我使用 进行编译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}

当明确使用字体(Test font)时,它可以工作,但完整文档不采用 Fira。

最后一点:日志文件显示texlive正在使用:

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.

(抱歉,复制粘贴的格式不太好)。

在此先非常感谢您的帮助。

答案1

如果它可以帮助其他面临同样问题的人:

有效的方法是复制我已下载的 Fira 字体文件,如下所示这里进入user/Library/Fontstex 实际寻找它们的地方(在日志中指示),即/texlive/2017/texmf-dist/fonts/opentype/public/fira

正如所示@samcarter,不需要\setsansfont[BoldFont={Fira Sans}]{Fira Sans Light} \setmonofont{Fira Mono} \usepackage[sfdefault]{Fira Sans}xeLatex可以自行完成工作。

最后一句话:查看日志文件来了解发生了什么是值得的,即使很长!

答案2

如果metropolis主题是用 编译的xelatex,则默认使用 fira 字体。因此无需手动干预字体选择并承担出现问题的风险。事实上,如果删除与字体相关的三行,示例就可以顺利编译。

% !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}

相关内容