1

Starting to use the thmtools package, I encountered a LaTeX Error: Missing \begin{document}. in the following minimal example.

\documentclass{article}

\usepackage{amsthm}
\usepackage{thmtools}

\declaretheorem[within=section]{theorem}
\declaretheorem[within=section,sibling=theorem]{corollary}

\begin{document}

\begin{theorem}
This is a theorem.
\end{theorem}

\begin{corollary}
This is a corollary.
\end{corollary}

\end{document}

Why is the error showing up and how can I fix the document?

(I already found the answer but thought that this might be a problem also encountered by others - since I did not find anything about this via Google, I'm asking this question and will answer it if noone else does)

  • 1
    I think you must drop within=section in the definition of corollary since it is sharing the counter with theorem anyways. – Arash Esbati Dec 28 '15 at 12:33
  • 3
    As the two setttings are mutually exclusive thmtools should imho do something like \@for\tmp@keyname:=sibling,numberlike,sharenumber\do{% \define@key{thmdef}{\tmp@keyname}{\thmt@trytwice{\thmt@setparent{}\thmt@setsibling{#1}}{}}% } (and similar for the other set of keys), and perhaps give some warning. You should inform the author. – Ulrike Fischer Dec 28 '15 at 12:59
  • @UlrikeFischer Yes. At least a more meaningful error message would be beneficial. I'll email him. – cryingshadow Dec 28 '15 at 13:04
1

withinand sibling, both assigns a counter to the theorem, and assigning both to the same theorem serves no purpose, as seen in Thmtools documentation, page 14

As made clear in comments, the package author has be notified about suggestion to give a better warning-message than the current one, which simply gives an error to the whole document.

\documentclass{article}

\usepackage{amsthm}
\usepackage{thmtools}

\declaretheorem[within=section]{theorem}
\declaretheorem[sibling=theorem]{corollary}

\begin{document}

\begin{theorem}
This is a theorem.
\end{theorem}

\begin{corollary}
This is a corollary.
\end{corollary}

\end{document}
| improve this answer | |
  • Yep. However, I think it does not get so clear from the documentation when reading it the first time. – cryingshadow Dec 28 '15 at 12:40
  • yeah, reading documentation can be a pain, sometimes. (I haven't really read that much of this one, so I cannot really say anything about the quality of it) – Runar Dec 28 '15 at 12:46

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.