2

When I insert an theorem/definition environment at the start of an item of enumerate, it creates a newline automatically before Theorem. Is it somehow possible to remove this enforced newline so that the enumeration item (e.g. (a) ) is on the same line as the theorem beginning?

The following is a minimal example:

\documentclass{article}
\usepackage{amsthm}
\usepackage{enumerate}
\newtheorem{theorem}{Theorem}
\begin{document}

\begin{enumerate}[(a)]
  \item % avoid newline here
    \begin{theorem} Some statement. \end{theorem}
\end{enumerate}

\end{document}

Output of the minimal example

2
  • It's not really clear why you would have theorems in the middle of an enumerated list.
    – egreg
    Feb 26, 2016 at 0:34
  • I use this construct for exercise sheets and solutions, i.e. enumerating points for each exercise (1. a), 1. b), etc.). In some of those points, there is a theorem/statement that needs to be proven. There may be a better way to do this to avoid having theorems in enumerations, but I do not know. Feb 26, 2016 at 9:21

2 Answers 2

4

Perhaps the easiest way is to define another environment for theorems which should not start with a line break. You can tweak the appearance if you want.

\documentclass{article}
\usepackage{amsthm}
\usepackage{enumerate}
\newtheorem{theorem}{Theorem}

% For theorems which do not start with a line break
\makeatletter
\newenvironment{nonewlinetheorem}
{\refstepcounter{theorem}\textbf{Theorem~\thetheorem.\space}\itshape}{\par}
\makeatother

\begin{document}

\begin{enumerate}[(a)]
\item \begin{theorem} Some statement. \end{theorem}
\item
  \begin{nonewlinetheorem}
    Another theorem statement.
  \end{nonewlinetheorem}

\end{enumerate}

\end{document}
3
  • Better would be \thetheorem instead of \arabic{theorem} to get the current printing style of theorem numbers, e.g. if they are numbered within sections. Feb 25, 2016 at 17:19
  • And you might wish to make the environment end with \par, to avoid the risk of having it gobble up following text into the same paragraph. Feb 25, 2016 at 17:26
  • @HaraldHanche-Olsen Thanks, edited.
    – Masroor
    Feb 26, 2016 at 0:18
0

It's a little bit of a hack, but negative \vspace is a fairly common solution in LaTeX and will allow you to use this solution on any Theorem/Proposition/Lemma etc. environment you like without defining a new one for the purpose. As an example:

\documentclass{article}
\usepackage{amsthm}
\usepackage{enumerate}
\newtheorem{lemma}{Lemma}
\newtheorem{theorem}{Theorem}

\begin{document}

\begin{enumerate}[(a)]
\item \leavevmode \vspace{-2em}
    \begin{lemma} $e^{i\theta}\equiv\cos(\theta)+i\sin(\theta).$ \end{lemma}
\item \leavevmode \vspace{-2em}
    \begin{theorem} $e^{i\pi}=-1$. \end{theorem}
\end{enumerate}

\end{document}

gives the following:

LaTex output

Here \leavevmode is necessary to enter horizontal mode, otherwise \vspace produces a \vskip which ends the current paragraph, which does not then produce the desired affect.

2
  • I know this post is old, but I thought this solution might help any newcomers to the post. Mar 6, 2018 at 1:02
  • 1
    Why 2em and not something related to \baselineskip?
    – Werner
    Mar 6, 2018 at 1:18

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.