5

The following code works fine

\begin{theorem}[Euler] Blah
\end{theorem}

But whenever I try to use square brackets in the description I get an error.

\begin{theorem}[The set $[0, 1]$ is compact] Blah
\end{theorem}

Can anybody tell me how to avoid the error, please?

EPS
  • 197
  • 1
    What about using ...{$[0, 1]$}...? – Werner Jul 13 '14 at 15:53
  • 1
    @Sam: [] within optional argument [] brackets must be surrounded by {} pair. –  Jul 13 '14 at 16:13
  • Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Jul 13 '14 at 16:21
  • Thanks for the tips! @ChristianHupfer This was my first post on tex.stackexchange. In the future I will make sure to provide MWE's. – EPS Jul 13 '14 at 16:34

1 Answers1

5
\documentclass[paper=a4,12pt]{scrbook}

\usepackage{amsmath}%
\usepackage{amsthm}%

\newtheorem{MyTheorem}{Brontosaurs}


\begin{document}

\begin{MyTheorem}[The set {$[0,1]$} is compact]
\end{MyTheorem}

\begin{MyTheorem}[By Ann Elk {[Misses]}]
\par
Brontosaurs are thin at one end, thick in the middle and thin again at the other end.
\end{MyTheorem}



\end{document}

enter image description here

  • I hope the five remaining guys of MP does not sue me for using that line ;-) –  Jul 13 '14 at 16:30