# How to prevent paragraph breaks after theorem environments?

By default, the list environments (such as itemize) have the nice property that if you add a blank line after it, it starts a new paragraph, and if you don't, the paragraph continues. So

The following objects
\begin{itemize}
\item car
\item tree
\item pupil
\end{itemize}
are countable.


will produce one paragraph, while

Here's a list of uncountable objects:
\begin{itemize}
\item hair
\item rice
\end{itemize}

And now for something completely different


gives two paragraphs.

For the theorem type environments (I use the theorems from amsart class), no matter what I do after \end{<theorem type>}, the paragraph breaks. Is there a way to make them behave like itemize (so that page breaking depends on whether I insert a blank line after the environment)?

Edit Since both of the answers so far enquires to why I want this behaviour, rather than the default, let me clarify a bit. I agree that it looks weird to state a theorem in the middle of a paragraph. But I actually want to use the behaviour for (short) definitions or setting of notations. For example, I may write

For the purposes of this monograph, all functions are infinitely differentiable.
That is, we usually work in the space
\begin{definition}
$C^\infty(\Real^k) \eqdef$ the space of complex-valued smooth functions.
\end{definition}
Often, however, we wish to ignore complications from infinity'', i.e.~from
the non-compactness of $\Real^k$. In these situations we want to use
\begin{definition}
$\mathcal{D} = C^\infty_c(\Real^k) \eqdef$ the space of complex-valued
smooth functions with compact support.
\end{definition}
Since one of our main tools will be the Fourier transform, the above definition
is not always satisfactory: the Fourier transform of a function in
$C^\infty_c(\Real^k)$ will necessarily not be in the same space by the
uncertainty principle. So a better space is
\begin{definition}
$\mathcal{S}\eqdef$ the space of complex-valued smooth functions with rapid
decay. That is, all functions $f$ such that $x^\alpha D^\beta f$ remain
bounded for all multi-indices $\alpha,\beta$.
\end{definition}
For convenience, we will also introduce the notations
\begin{definition}
$\mathcal{D}' \eqdef$ the space of distributions, or continuous linear maps
from $\mathcal{D}$ to $\Complex$; and similarly $\mathcal{S}' \eqdef$ the
space of \emph{tempered} distributions.
\end{definition}


I find the jagged edge caused by the indentation unpleasant. So no, this is not just an idle question.

-
Perhaps just a matter of style, but I would drop all of those “Definition XX.” environments, have a single paragraph and use \emph{...} to emphasize each newly defined term or concept. –  Juan A. Navarro Sep 26 '10 at 8:08

Paragraph breaking after theorem environments depending on whether a blank line is inserted does work for the standard article class, but doesn't for amsart. The reason is that amsarts definition of \@endtheorem includes \@endpefalse which disables the conditional breaking mechanism. Remove \@endpefalse and all is well.

\documentclass{amsart}

\makeatletter
% \def\@endtheorem{\endtrivlist\@endpefalse }% OLD
\def\@endtheorem{\endtrivlist}% NEW
\makeatother

\newtheorem{theorem}{Theorem}

\newcommand*{\sometext}{Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Ut purus elit, vestibulum ut, placerat ac,
adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu
libero, nonummy eget, consectetuer id, vulputate a, magna.}

\begin{document}

\sometext

\begin{theorem}
\sometext
\end{theorem}

\sometext

\begin{theorem}
\sometext
\end{theorem}
%
\sometext

\end{document}


-
It looks like with the ntheorem package, this does not work. At some point, there is \gdef\@endtheorem{\endtrivlist\csname\InTheoType @postwork\endcsname} that should be modified? –  pluton Aug 25 '12 at 2:17

The environment theorem ends a paragraph and you are creating a new environment, definition, out of it, so it inherits the properties of theorem since you are just changing the name. Semantically not wanting an end of the paragraph and inheriting from theorem is not correct. That why you would have to do some patch to solve it. A "cleaner" way would be to define your environment definition.

\newcounter{definitioncounter}

\newenvironment{mydefinition}{\noindent\textbf{Definition}\arabic{definitioncounter}:\newline\indent}{\newline}


This will give what you want (I hope). Inside the second pair of {}s, in the \newenvironment command, you can insert more commands to give style to the text inside the definition if you want some style different from the surrounding text. For example if you want it in italics.

Edit: use \addtocounter{definitioncounter}{1}

If you want it to start in 1 instead of 0.

-
So I take it that as part of the definition of the theorem environment the paragraph is ended? I generally see theorem grouped with itemize and others in the set of "paragraph-making environments", but my example above suggest that there are subtle differences. Are these differences documented somewhere other than in the LaTeX source? –  Willie Wong Sep 27 '10 at 19:23
I'm sorry to do this (removing a green check). But I think lockstep's answer below explains it better. Cheers. –  Willie Wong Dec 2 '11 at 9:44

Not really answering your question, but it kind of looks funny if you state a theorem right in the middle of a paragraph, no?

Anyway, if you would like to do that in the odd case, would it be enough to fake it with a \noindent? Unless you have some modifications in your document layout, the spacing seems to be the same as, say, a quote in the middle of a paragraph. Compare:

\documentclass{article}

\usepackage{amsthm}
\newtheorem{theorem}{Theorem}

\begin{document}

Someone said
\begin{quote}
Some funny quote.
\end{quote}
and it was quite funny.

Someone proved
\begin{theorem}
Some interesting theorem.
\end{theorem}
\noindent
and it was quite interesting.

\end{document}

-
Ahh.. I just missed that you said amsart and not just amsthm, the spacing does look a bit different in amsart. But is the solution perhaps still useful for you? –  Juan A. Navarro Sep 22 '10 at 18:36
To address your first comment: yes, it does look funny to state a theorem in the middle of a paragraph. But it does not look as funny to state definitions in the middle of a paragraph, especially when the definition is just one line long and motivated by the part of the paragraph immediately above it. Now imagine several definitions being made in succession in the same paragraph. \noindent is of course the obvious option. But I would prefer a solution that doesn't break when, say, new paragraph is denoted by vertical spacing instead of indentation. –  Willie Wong Sep 24 '10 at 17:14

Another way to prevent the new paragraph effect is to wrap the theorem inside a minipage:

\documentclass{amsart}
\newtheorem{thm}{Theorem}[section]

\begin{document}
Here we state
\newline
\begin{minipage}{\textwidth}
\begin{thm}
(Famous Theorem) Statement,
\end{thm}
\end{minipage}
\newline
which is part of this paragraph.
\end{document}


If the theorem statement is short enough and you remove the \newline commands you might even get it to fit inline.

I second Juan's opinion though that this looks funny... Do you have any examples of instances in which what you're asking for is a better solution than the default? Or are you just curious if it's possible?

-