2

I have a problem regarding the \setbeamerfont command related to alerted text. The usage is:

\setbeamerfont{alerted text}{series=\bfseries}

However, bfseries does not work in math mode - what can I do to obtain the same effect for alerted text in math mode?

To use \bf was one thing I found during my search, but \bf is deprecated and should not be used, as it was told to be unstable in certain cases.

Minimal example:

beamerthemeTest.sty:

\mode<presentation>
\usepackage{mathptmx}

\useinnertheme{rectangles}
\usefonttheme[onlymath]{serif}
\usefonttheme{professionalfonts}
\setbeamerfont{alerted text}{series=\bfseries\boldmath}
\setbeamercolor{alerted text}{fg=blue}
\mode
<all>

Document:

\documentclass{beamer}
\usetheme{Test}
\begin{document}
\begin{frame}
  \alert{This text is alerted.}
  \alert{$x^2$} cannot be alerted.
\end{frame}
\end{document}
Modass
  • 23
  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – samcarter_is_at_topanswers.xyz Apr 02 '15 at 09:21
  • A tip: If you indent lines by 4 spaces or [enclose words in backticks ```](http://meta.tex.stackexchange.com/q/863), they'll be marked as code, as can be seen in my edit. You can also highlight the code and click the "code" button (with "{}" on it). – samcarter_is_at_topanswers.xyz Apr 02 '15 at 09:22
  • question already answered in http://tex.stackexchange.com/questions/34265/how-to-get-beamer-math-to-look-like-article-math – aronadaal Apr 02 '15 at 10:27
  • @aronadaal I don't see how this solves my problem, please elaborate further – Modass Apr 02 '15 at 11:20
  • sry, I was a bit too fast. Here is now a working example. – aronadaal Apr 02 '15 at 12:08
  • The difference between the added theme and the answer below, is that here you load mathptmx. This does not have a bold version of math, and anyway is regard as obselete, see [https://www.ctan.org/pkg/mathptmx?lang=en]. If instead you either omit this package (so you get standard fonts) or use \usepackage{newtxtext,newtxmath} (times like) then the solution provided works – Andrew Swann Apr 20 '15 at 12:49

1 Answers1

3

Sorry, I was a bit too fast with my answer. Use \usefonttheme[onlymath]{serif} for serif font in math mode and \boldmath for bold font - again only in math mode.

\documentclass{beamer}
\usefonttheme[onlymath]{serif}
\begin{document}
\begin{frame}
\begin{columns}
\column{.5\textwidth}
  \centering
  $ x = 5 - 2 $
\column{.5\textwidth}
  \centering
  \boldmath
  $ x = 5 - 2 $
\end{columns}
\end{frame}
\end{document}

enter image description here

EDIT: Ok, now with the your example I understand the problem. Solves this one your problem?

The theme:

\mode<presentation>
\setbeamerfont{alerted text}{series=\bfseries\boldmath}
\setbeamercolor{alerted text}{fg=blue}
\mode
<all>

The document:

\documentclass{beamer}
\usetheme{Test}
\begin{document}
\begin{frame}
  \alert{This text is alerted.}
  \alert{$x^2$} can be alerted, too! % math inside \alert{}
\end{frame}
\end{document}

enter image description here

Andrew Swann
  • 95,762
aronadaal
  • 553
  • Okay - but how do I set this inside a beamertemplate? Maybe I was not precise enough: What I want is that whenever I use '\alert{Stuff}' I want Stuff to be bold and colored, no matter which mode I am in – Modass Apr 02 '15 at 12:46
  • please provide a working/non-working minimal example http://minimalbeispiel.de/mini-en.html – aronadaal Apr 02 '15 at 12:52
  • Ok, extended the question – Modass Apr 02 '15 at 13:04
  • answer extended, too – aronadaal Apr 02 '15 at 14:22
  • Okay, this removes the error, but in my case the font is not bold - I will figure that out and report. – Modass Apr 08 '15 at 11:14
  • did you see that I modified the theme too? --> \setbeamerfont{alerted text}{series=\bfseries\boldmath} – aronadaal Apr 08 '15 at 13:12
  • yes, I included that in my theme, which fixed the error, but I couldn't really see a difference in the font -> I assume this might be related to the fonttheme (although I've tried default)? – Modass Apr 08 '15 at 15:39
  • can you post a working example or your code again? so I can have a look... – aronadaal Apr 10 '15 at 16:27
  • Okay, I've included all of the template, that is related to fonts, the rest is just some template elements and color definitions. – Modass Apr 16 '15 at 11:47
  • and where is the \boldmath definition inside your beamerstyle? You have to replace this line \setbeamerfont{alerted text}{series=\bfseries} by this one \setbeamerfont{alerted text}{series=\bfseries\boldmath}

    Did you really have a look at my answer?

    – aronadaal Apr 17 '15 at 07:25
  • Sorry, forgot to put that in the edit - Yes, I've tried your solution, but it does not seem to produce bold text (I am sure you've tested it yourself, so I assume, that there is a different problem, which I still cannot figure out) – Modass Apr 20 '15 at 09:04
  • @Modass See my comment on your modified question regarding font choices. – Andrew Swann Apr 20 '15 at 12:51