26

I want to change font style in my presentation. I prefere Liberation Serif font. This is TrueType font so use XeLaTeX program. I tried to set this font using \usepackage{fontspec} and \setmainfont{Liberation Serif}, but font in my document does not change. How i can solve this problem?

29

By default, beamer uses sans serif font, so \setmainfont will do nothing. You have to tell it that you want serif fonts:

\documentclass{beamer}
\usefonttheme{professionalfonts} % using non standard fonts for beamer
\usefonttheme{serif} % default family is serif
\usepackage{fontspec}
\setmainfont{Liberation Serif}

\begin{document}
\begin{frame}
Abdce
\end{frame}
\end{document}
  • 5
    I have a similar problem as @Pavel Morozkin, I tried this code and I get the following error: ! Fatal fontspec error: "cannot-use-pdftex"!! The fontspec package requires either XeTeX or LuaTeX.!! You must change your typesetting engine to, e.g., "xelatex" or! "lualatex"instead of "latex" or "pdflatex".!! See the fontspec documentation for further information.!! For immediate help type H <return>.!............................................... \msg_fatal:nn {fontspec} {cannot-use-pdftex} – Gunelle Jun 25 '18 at 10:02
  • I am also getting a similar error. – Peaceful Jul 17 '18 at 9:55
  • @Peaceful You need to use XeLaTeX or LuaLaTeX. – egreg Jul 17 '18 at 10:20

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.