2

I am new in LaTex. However, I am using document class Beamer with mode as presentation. I tried to change the main font. But do not find anyway! Can I use Cambria font in TexStudio? please help.

1 Answers1

4

If you have the ttf (TrueType) Cambria font, you can use XeLaTeX:

\documentclass{beamer}
\usepackage{fontspec}
\usepackage{lipsum}

\setmainfont[Ligatures=TeX]{Cambria}
\usefonttheme{serif}
\usefonttheme{professionalfonts}

\begin{document}

\begin{frame}
\lipsum[4]
\end{frame}

\end{document}

enter image description here

Notice that since the default font theme in beamer switches to sans serif, one has to explicitly ask for a serif font using

\usefonttheme{serif}

or one of its variants (refer to the beamer manual).

Gonzalo Medina
  • 505,128
  • Sorry, I am new in LaTex. Do I have to download and install XeLaTex? – overwhelmed Apr 17 '14 at 01:00
  • @overwhelmed No; it should come with your LaTeX system (if its relatively updated). Your editor TeXstudio should have an option to choose which engine to use (there must be a menu showing things like pdflatex, lualatex, xelatex); choose xelatex to compile. All you need is to have the TrueType Cambria font; if your system doesn't already have it, there are numerous places in the web where you can download it. – Gonzalo Medina Apr 17 '14 at 01:02
  • For the record, I believe your screenshot is incorrect: it looks like Latin Modern Sans (a sans-serif font) instead of Cambria (a serif font). – hftf Apr 17 '14 at 01:28
  • @hftf You're right. Since the default font theme in beamer switches to sans serif, one has to explicitly ask for a serif font. I've updated my answer. Thanks for noticing it! – Gonzalo Medina Apr 17 '14 at 01:34
  • @GonzaloMedina Got it. It is in Option>Configure TexStudio>Build>Default Compiler. Now changed to XeLaTex. However, now I see new problem: ** WARNING ** Couldn't open font map file "kanjix.map". By the way, I am using Windows 7, and I have Cambria font at C:\Windows\Fonts. But no change of font to Cambria in my current document after using your codes. What should I do now? – overwhelmed Apr 17 '14 at 01:35
  • @overwhelmed Please see http://tex.stackexchange.com/q/133591/3954. – Gonzalo Medina Apr 17 '14 at 01:36
  • @GonzaloMedina Thank you. It works now. I appreciate it. – overwhelmed Apr 17 '14 at 01:50
  • @GonzaloMedina Hi Gonzalo, I tried to comment in one of your post on Justifying. But I do not have enough reputation t comment. Here is my question: I have used your code \apptocmd{\frame}{\justifying}{}{} which destroyed \begin{frame}[allowframebreaks]{Reference} for long bibliography. I get a header allowframebreaks and then no frame breaks at all. Can you please help? – overwhelmed Apr 17 '14 at 03:22
  • @overwhelmed I suggest you to open a fresh new question, with a minimal version of the code you are using, clearly stating which is the problem and perhaps including a link to the mentioned post. – Gonzalo Medina Apr 17 '14 at 03:25