3

My question is more a curiosity than a problem.
I notice that the following text builds a valid document. I thought the only correct way to use this theorem environment would be to write the body between '\begin{definition}' and '\end{definition}'.

Why don't I get any warnings or errors?

\documentclass{article}
\usepackage{amsthm}
\newtheorem{definition}{Definition}
\title{A reason to argue} 
\author{Grassy Knoll}
\begin{document}
\section{Introduction}
Here is a weird thing:

\definition[rain] Water that falls from the sky.  
It falls from up high.

The definition does not end, so something is wrong.
\end{document}
2
  • 2
    No, it seems to work, but several things are not done (or undone) because of the missing group and execution of \enddefinition.
    – egreg
    Sep 9, 2022 at 20:08
  • Can't test now, but there should be a warning about exiting the main file with a nest level greater than 1... I'll check tomorrow.
    – Rmano
    Sep 9, 2022 at 22:04

1 Answer 1

4

When you do

\begin{definition}

several commands are performed by \begin, followed by doing \definition.

Similarly, when LaTeX processes

\end{definition}

it executes \enddefinition and also several commands connected to \end.

If you don't use the proper \begin{...}...\end{...} LaTeX is left in an unpredictable state, because an environment is supposed to be processed inside a group, so many settings are automatically undone by the end of the group, which is provided by \end.

For instance, the font remains italic, as you perhaps discovered. And there is no vertical space after the paragraph that's supposed to be the definition text.

Output with your code

enter image description here

Output with the proper \begin and \end

enter image description here

You must log in to answer this question.

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