3

I've got a problem when I try to use the options thmbox=M and numbered=no at the same time in the thmtools package. Here is a MWE:

\documentclass{minimal}

\usepackage{amsthm}
\usepackage{thmtools}
\declaretheorem[numbered=no, name=TheoremA,         ]{mytheo1}
\declaretheorem[             name=TheoremB, thmbox=M]{mytheo2}
%\declaretheorem[numbered=no, name=TheoremC, thmbox=M]{mytheo3} -> Here the error accurs

\begin{document}

\begin{mytheo1}
    test1
\end{mytheo1}

\begin{mytheo2}
    test2
\end{mytheo2}

\end{document}

The Styles 1 and 2 work great, but uncommenting the third \declaretheorem... line will produce the error

! LaTeX Error: Missing \begin{document}.
! LaTeX Error: \mytheo3 undefined

Does anybody know, if there's a way to use both, thmbox and nonumbered option?

2 Answers 2

6

When the thmbox option is used, the control is passed to the thmbox package, which doesn't provide unnumbered theorems.

This means that you cannot use that option together with numbered=no option.

As a workaround, to obtain the theorem environment you were looking for, define

\newenvironment{mytheo3}{%
  \thmbox[M]{\textbf{TheoremC}}%
  \hspace*{-1.5em}\slshape\ignorespaces%
  }
  {%
  \endthmbox\vspace*{.75ex}%
  }

to be used like

\begin{mytheo3}
    test3
\end{mytheo3}

or

\newenvironment{mytheo4}[2][M]{%
  \thmbox[#1]{\textbf{#2}}%
  \hspace*{-1.5em}\slshape\ignorespaces%
  }
  {%
  \endthmbox\vspace*{.75ex}%
  }

to be used like

\begin{mytheo4}[M]{TheoremD}
    test4
\end{mytheo4}

Since in this case M is the default, it can be omitted.

MWE:

\documentclass{article}

\usepackage{amsthm}
\usepackage{thmtools}

\declaretheorem[numbered=no, name=TheoremA,         ]{mytheo1}
\declaretheorem[             name=TheoremB, thmbox=M]{mytheo2}
%\declaretheorem[numbered=no, name=TheoremC, thmbox=M]{mytheo3} % this doesn't work!!!!!!!!!!

\newenvironment{mytheo3}{%
  \thmbox[M]{\textbf{TheoremC}}%
  \hspace*{-1.5em}\slshape\ignorespaces%
  }
  {%
  \endthmbox\vspace*{.75ex}%
  }

\newenvironment{mytheo4}[2][M]{%
  \thmbox[#1]{\textbf{#2}}%
  \hspace*{-1.5em}\slshape\ignorespaces%
  }
  {%
  \endthmbox\vspace*{.75ex}%
  }

\begin{document}

\begin{mytheo1}
    test1
\end{mytheo1}

\begin{mytheo2}
    test2
\end{mytheo2} 

\begin{mytheo3}
    test3
\end{mytheo3}

\begin{mytheo4}[M]{TheoremD}
    test4
\end{mytheo4}

\end{document}

Output:

enter image description here

4
  • 1
    I don't think it's a bug. When thmbox is used, control is passed to the thmbox package, which doesn't provide unnumbered theorems.
    – egreg
    Jan 7, 2015 at 20:36
  • @egreg And why does it not compile? Jan 8, 2015 at 6:03
  • Is it a bug of your bicycle if you can't go with it across the sea?
    – egreg
    Jan 8, 2015 at 9:41
  • @egreg Got it. Answer edited... Jan 8, 2015 at 11:35
2

For anyone wandering here after all these years, and who does not like to have any numbered theorem, I just found out that adding

\makeatletter
\renewcommand\thmbox@headstyle[2]{\bfseries #1}
\makeatother

in the preamble will disable ALL of the numberings made by thmbox (default values being: \bfseries\boldmath#1 #2, as stated in the documentation).

You must log in to answer this question.

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