5

i want to set the main font in my beamer as "Consolas" i do like this :

\documentclass{beamer}
\usepackage{fontspec}
\usetheme{Warsaw}
\begin{document}
\setmainfont{Consolas}
\begin{frame}
we discuss the ambiguities of existing security definitions and then provide a general framework for defining AKE security when involve strong adversary capabilities
\end{frame}
\end{document}

but after compile it , the font doesn't change, it is the same with that before the main font was set. what's the reason?

  • Please consider expanding your posting by posting a Minimum Working Example (MWE) of what you've done so far. "Nothing happens" is a rather broad term -- does the document fail to compile, or is a font other than Consolas in use? Please also indicate which TeX format you use. – Mico Sep 24 '13 at 8:56
  • What does "nothing" mean in this context? Do you at least get warnings or error messages in the log file (*.log)? Furthermore it could be very helpful if you add an example that is as short as possible, demonstrates the problem and is compilable as is. – Thorsten Donig Sep 24 '13 at 8:58
11

At the moment you only set the main font of the document. You need to specify the sans serif font family because that's what the »beamer« classes uses in the end.

\documentclass{beamer}
\usepackage{fontspec}
\usetheme{Warsaw}
%\setmainfont{Consolas}
\setsansfont{Consolas}

\begin{document}

\begin{frame}
we discuss the ambiguities of existing security definitions and then provide a general framework for defining AKE security when involve strong adversary capabilities
\end{frame}

\end{document}

enter image description here

  • 1
    Do you really want to use a mono spaced font for your presentation? – Thorsten Donig Sep 24 '13 at 9:22
  • One of the most frustrating things about latex is that sometimes the answer to "How would one do X?" is "Latex does not find X aesthetically pleasing. You shouldn't do X." But yeah, a presentation in monospaced font may be too creative. – Praxeolitic May 28 '14 at 4:54
7

By default beamer uses a sans-serif font. You can set that directly, by \setsansfont instead of \setmainfont, or you can stay with \setmainfont and use the serif font theme of beamer. Here is the latter:

Sample output

\documentclass{beamer}

\usepackage{fontspec}
\setmainfont{Consolas}

\usetheme{Warsaw}
\usefonttheme{serif}

\begin{document}

\begin{frame}
  We discuss the ambiguities of existing security definitions and then
  provide a general framework for defining AKE security when involve
  strong adversary capabilities.
\end{frame}

\end{document}

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.