10

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?

2
  • 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
    Commented Sep 24, 2013 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. Commented Sep 24, 2013 at 8:58

2 Answers 2

17

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

2
  • 1
    Do you really want to use a mono spaced font for your presentation? Commented Sep 24, 2013 at 9:22
  • 1
    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. Commented May 28, 2014 at 4:54
8

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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .