1

I'm trying to do a presentation doing a Beamer template.

I've loaded the following packages:

\usepackage{graphicx}
\usepackage{booktabs} 
\usepackage{bm}
\usepackage{mathtools}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

Everything else is according to the template with minor changes like instead \date{\today} I put \date{June 20, 2016}, or instead of \frametitle{Overview} I put \frametitle{Sumário}.

I'm trying to compile this with texmaker, but I get the following error:

! LaTeX Error: Command `\mathbf' already defined.See the LaTeX manual or LaTeX Companion for explanation.Type H <return> for immediate help.... 

I've yet to use that command in the presentation, and the line texmaker indicates as the beginning of problematic section is right at the start, i.e. \begin{document}

I know that if I comment out the bm package the problem goes away, but I've used this combination of packages in documents before without any problem.

Why is this happening?

Any help would be appreciated.

  • Seems to be a combination of beamer, bm and lmodern. For example \documentclass{beamer} \usepackage{bm} \usepackage{lmodern} \begin{document} s \end{document} will produce the error, swapping the order of bm and lmodern and the error goes away. – Torbjørn T. Jun 12 '16 at 9:51
  • What's the reason for \usepackage{lmodern}? – egreg Jun 12 '16 at 10:15
  • @egreg the reason is I would like to write accented letters – An old man in the sea. Jun 12 '16 at 13:48
  • @Anoldmaninthesea. What has lmodern to do with accented letters? – egreg Jun 12 '16 at 13:51
2

Change the package loading order. Note that graphicx is already loaded by beamer.

On the other hand, loading lmodern is not needed, unless you're on MiKTeX and don't have a working installation of the CM-Super fonts.

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\usepackage{mathtools}
\usepackage{bm}
\usepackage{booktabs}

\begin{document}

\begin{frame}
\frametitle{Test}

Some text and math:
\[
\sum_{k=1}^n k^2=n\left(n+\frac{1}{2}\right)(n+1)
\]

\end{frame}

\end{document}

enter image description here

| improve this answer | |
2

Without a proper MWE, this is the best help I can offer: invoking professionalfonts produces no such error.

\documentclass{beamer}
\usefonttheme{professionalfonts}
\usepackage{graphicx}
\usepackage{booktabs} 
\usepackage{bm}
\usepackage{mathtools}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\begin{document}
Test.
\end{document}
| improve this answer | |

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.