4

My compiled math font family is not like a default one(e.g., the font used in MahtJaX), but it is same as the text font family. My example code and it's complied one are shown below.

\documentclass[xcolor=x11names,compress]{beamer}

\usepackage{graphicx}
\usepackage{tikz}
\usepackage{palatino}

\useinnertheme{default}
\usefonttheme{serif}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\begin{frame}{Example}
\begin{definition}
Let $R\subseteq S\timesT$ be a relation.\break
The domain of R is defined as:\break
$\operatorname{Dom} \left({\mathcal R}\right) := \left\{{s \in S: \exists t \in T: \left({s, t}\right) \in \mathcal R}\right\}$\break
and can be denoted $\operatorname{Dom} \left({\mathcal R}\right)$.
\end{definition}
\end{frame}

\end{document}

enter image description here This definition is from the webpage of Proofwiki. How to change the font family to default for math codes in beamer?

  • Load the professional font theme to stop beamer changing the fonts. \usefonttheme{professionalfonts} – cfr Jul 25 '14 at 21:05
  • @cfr Nice. It worked nicely. But, may I ask one more simple question? I want to right the context of a definition right next to the label "Definition". How do I do that? (In the example above, the contexts are starting in the next line. It automatically make a \break.) – Guinea Pig Jul 25 '14 at 21:09
6

The first part of this echoes Herbert's answer but I posted it as a comment 8 minutes prior to that answer and so claim this answer is legitimate ;). (But I will remove it if Herbert objects or if anybody else, not being Herbert, both objects and can give me a good reason why they have a right to object despite not being Herbert.)

Original Question

\usefonttheme{professionalfonts} prevents beamer from overwriting your fonts and is therefore needed to use specified font packages.

palatino is deprecated, however. l2tabuen recommends this replacement:

\usepackage{mathpazo}
\usepackage[scaled=.95]{helvet}% uncomment these if required
\usepackage{courier}

URW Palatino look-alike

An alternative would be to use TeX Gyre's Pagella, for example.

Second Question

Since this is a different question it should really be a different question. However, you could use the description environment rather than the definition environment here. definition always starts a new line for the main part of the definition. (The name of the term can go on the same line but the definition itself starts below.) While this could obviously be changed, it seems to me there are simpler options. For example:

\begin{description}
  \item[Definition] Definition goes here.
\end{description}

A definition of a different kind...

The Code

\documentclass[xcolor=x11names,compress]{beamer}

\usepackage{graphicx}
\usepackage{tikz}
% \usepackage{palatino}% is obsolete - see l2tabu (or l2tabuen) for details
\usepackage{mathpazo}
% \usepackage[scaled=.95]{helvet}% uncomment these if required
% \usepackage{courier}

\useinnertheme{default}
\usefonttheme{professionalfonts}
\usefonttheme{serif}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

\begin{frame}{Example}
\begin{description}
  \item[Definition] Let $R\subseteq S\times T$ be a relation.\break
  The domain of R is defined as:\break
  $\operatorname{Dom} \left({\mathcal R}\right) := \left\{{s \in S: \exists t \in T: \left({s, t}\right) \in \mathcal R}\right\}$\break
  and can be denoted $\operatorname{Dom} \left({\mathcal R}\right)$.
\end{description}
\end{frame}

\end{document}
  • Could you provide information on the different packages? I have tried to comment out some to see the effects and found, that \usepackage{courier} doesn't do anything for me. Moreover, is there a list of viable packages? – gr4nt3d Jan 4 '18 at 15:28
  • 1
    @gr4nt3d courier will have an effect only if your document includes sans-serif text and not only serif. E.g. \textsf{} or [\sffamily }. The same with helvet. If you never use sans, loading these is pointless. – cfr Jan 6 '18 at 2:48
2
\useinnertheme{default}
\usefonttheme{professionalfonts}
\let\familydefault\rmdefault
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  • What is the code \let\familydefault\rmdefault affects on? – Guinea Pig Jul 25 '14 at 21:28
  • Sets the main font roman (serif) – user2478 Jul 25 '14 at 21:38
  • @Herbert I had a problem of proper math symbols typesetting, and I asked this question. Then I found your answer here to use \usefonttheme{professionalfonts} which fixes my problem. I wonder what is the difference between using professionalfonts as a class option and using it as a font theme as you did here? – Diaa Aug 21 '16 at 12:44
  • there is no difference. But it makes more sense to use it as shown, because all other themes must be loaded in the same way. – user2478 Aug 21 '16 at 13:10
  • 1
    "professionalfonts" means that the complete font setting is done by you and not beamer. This is the reason why another fonttheme makes no sense if you have professionalfonts set. – user2478 Aug 21 '16 at 16:58

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.