I want to change font style in my presentation. I prefere Liberation Serif font. This is TrueType font so XeLaTeX can be used. I tried to set this font using \usepackage{fontspec}
and \setmainfont{Liberation Serif}
, but the font in my document isn't changed. How to solve this issue?
2 Answers
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}
-
7I 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}– GunelleJun 25, 2018 at 10:02
-
-
2
-
@Gunelle I suppose if you're using Overleaf, there's not a lot you can do. Jul 5, 2022 at 20:06
Beamer uses sans serif font by default, so you can use \setsansfont{...}
to change the font (even if the font you actually want to use has serifs...)
% !TeX TS-program = lualatex
\documentclass{beamer}
\usepackage{fontspec}
\setsansfont{Liberation Serif}
\begin{document}
\begin{frame}
abc
\end{frame}
\end{document}
-
Is there a way to modify the directive to incorporate
latexmk
functionality? Jul 14 at 10:50 -
1
-
-
But is there also a directive
% TEX TS-program = ...
to do the same thing? Jul 15 at 4:37 -
1@xFioraMstr18 The above command is for texstudio. You should better ask a proper question to get the attention of texshop users. Jul 15 at 5:15