4

This is a follow-up question on Avoid parentheses around optional header material in theorem environment.

I want to do exactly the same (remove the parenthesis around the theorem optional header in a theorem, in beamer), but for ams style theorems. I am indeed using ams style theorems, not the numbered ones, i.e. I use \setbeamertemplate{theorems}[ams style], not \setbeamertemplate{theorems}[numbered] as in the other post. How should I adjust the code there?

A naive change of \defbeamertemplate{theorem begin}{numbered} to \defbeamertemplate{theorem begin}{ams style} ran into the error: LaTeX Error: Command \beamer@@tmpop@theorem begin@ams style already defined.

Here is the code that works for [numbered], and that I would like to adapt for [ams style]:

\documentclass{beamer}

\makeatletter
\expandafter\let\csname beamer@@tmpop@theorem begin@numbered\endcsname\relax
\defbeamertemplate{theorem begin}{numbered}
{%
  \begin{\inserttheoremblockenv}
    {%
      \inserttheoremname
      \inserttheoremnumber
      \ifx\inserttheoremaddition\@empty\else\ \inserttheoremaddition\fi% (\inserttheoremaddition)
    }%
}
\makeatother

\setbeamertemplate{theorems}[numbered]
\newtheorem{MyHypo}{Hypothesis}

\begin{document}

\begin{frame}
\begin{MyHypo}[insert text]
  This is my hypothesis
\end{MyHypo}
\end{frame}

\end{document}
1
  • 1
    this has nothing to do with amsmath. theorems are defined by amsthm, so i've changed the tag. Commented May 24, 2017 at 0:17

1 Answer 1

6

\defbeamertemplate{theorem begin}{ams style} is defined in beamerbaseauxtemplates.sty, ll. 771. To remove the parenthesis:

\documentclass{beamer}

\setbeamertemplate{theorems}[ams style]
\newtheorem{MyHypo}{Hypothesis}

\makeatletter
\setbeamertemplate{theorem begin}
{%
  \begin{\inserttheoremblockenv}
    {%
      \inserttheoremheadfont
      \inserttheoremname
      \inserttheoremnumber
      \ifx\inserttheoremaddition\@empty\else\ \inserttheoremaddition\fi%
      \inserttheorempunctuation
    }%
}
\makeatother

\begin{document}

\begin{frame}
\begin{MyHypo}[insert text]
  This is my hypothesis
\end{MyHypo}
\end{frame}

\end{document}

enter image description here

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .