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?
Add a comment |
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} - 8I 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– Gunelle2018-06-25 10:02:29 +00:00Commented Jun 25, 2018 at 10:02
- I am also getting a similar error.Peaceful– Peaceful2018-07-17 09:55:38 +00:00Commented Jul 17, 2018 at 9:55
- 2@Peaceful You need to use XeLaTeX or LuaLaTeX.egreg– egreg2018-07-17 10:20:31 +00:00Commented Jul 17, 2018 at 10:20
- @Gunelle I suppose if you're using Overleaf, there's not a lot you can do.Boris Valderrama– Boris Valderrama2022-07-05 20:06:59 +00:00Commented Jul 5, 2022 at 20:06
- 1just to build on @BorisValderrama's comment — you can change the typesetting engine in Overleaf to XeLaTeX or LuaLaTeX.apizzimenti– apizzimenti2024-10-08 14:09:46 +00:00Commented Oct 8, 2024 at 14:09
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
latexmkfunctionality?xFioraMstr18– xFioraMstr182023-07-14 10:50:42 +00:00Commented Jul 14, 2023 at 10:50 - 1@xFioraMstr18 Did you try
latexmk -lulatex?samcarter_is_at_topanswers.xyz– samcarter_is_at_topanswers.xyz2023-07-14 11:44:50 +00:00Commented Jul 14, 2023 at 11:44 - That works! Thank you.xFioraMstr18– xFioraMstr182023-07-15 04:36:38 +00:00Commented Jul 15, 2023 at 4:36
- But is there also a directive
% TEX TS-program = ...to do the same thing?xFioraMstr18– xFioraMstr182023-07-15 04:37:53 +00:00Commented Jul 15, 2023 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.samcarter_is_at_topanswers.xyz– samcarter_is_at_topanswers.xyz2023-07-15 05:15:59 +00:00Commented Jul 15, 2023 at 5:15
