6

I'm trying to do a set of beamer slides with the equations flush left. A minimal example is below. The fleqn option doesn't seem to have any effect. When I combine the class file and tex file into a single file, using \documentclass[fleqn]{beamer}, the equation is flush left, as expected. Presumably I'm making a mistake in my class file, but I can't figure out what it is. Can anyone help? Thanks!

Class file:

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{talk}

\LoadClass[fleqn]{beamer}
\RequirePackage{amsmath}
\setlength{\mathindent}{0pt}

Tex file:

\documentclass{talk}
\begin{document}
\begin{frame}{Foo}
  When in the course
  \begin{equation*}
  x=y
  \end{equation*}
  of human events\ldots
\end{frame}
\end{document}
3
  • 1
    \RequirePackage[fleqn]{amsmath} Jan 22, 2018 at 17:28
  • @DavidCarlisle: That doesn't work. I get this error: LaTeX Error: Option clash for package amsmath. As far as I can tell, beamer wants you to supply the fleqn option to it, which it then wants to pass on to amsmath. And that is indeed what works when I do this as a single file rather than with a separate class file.
    – user6853
    Jan 22, 2018 at 18:06
  • yes it would work if you loaded it before beamer, or you can stop beamer loading amsmath first as egreg showed. Jan 22, 2018 at 20:21

1 Answer 1

5

The option you pass to beamer is not global, so it's not inherited by amsmath, which is loaded by beamer with no option. So you can't load it later.

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{talk}

\PassOptionsToPackage{fleqn}{amsmath}
\LoadClass{beamer}
\setlength{\mathindent}{0pt}

enter image description here

Alternatively

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{talk}

\LoadClass[noamsthm]{beamer}
\RequirePackage[fleqn]{amsmath}
\RequirePackage{amsthm}
\setlength{\mathindent}{0pt}

You must log in to answer this question.