12

Consider the following example:

\documentclass{article}
\newtheorem{Theorem}{Theorem}
\begin{document}
\begin{Theorem}
On the other hand, this one has only one claim.
\end{Theorem}
\begin{Theorem}
\begin{enumerate}
\item First claim
\item Second claim
\end{enumerate}
\end{Theorem}
\end{document}

Typesetting it results in:

enter image description here

Notice there is extra horizontal space before the first item in the list of the second theorem.

Is there a sensible way to get rid of that?

Ideally, the solution would work with amsthm, thmtools, enumitem.

N.B.: this is related to Is it possible to skip the first line in a theorem environment? but not quite the same.

2
  • @Martin: the plus signs meant something different than your commas :) May 5, 2011 at 9:22
  • 1
    Sorry, I didn't saw that. The main edit was the formatting of the package name with back-ticks `. Feel free to put the +s back in. May 5, 2011 at 9:24

5 Answers 5

8

Two variants of a solution using the enumitem package. In the first case, two enumerate environments were used; the first one uses leftamargin=* to suppress the undesired horizontal space; the second enumerate uses resume to keep the numbering but preserves the standard value for \leftmargin; the vertical spacing between the two environments was also corrected. In the second case, the option leftmargin=* was also used, but this time only one enumerate environment was used so the horizontal space will be removed for all the items.

\documentclass{article}
\usepackage{enumitem}

\newtheorem{Theorem}{Theorem}

\begin{document}

\begin{Theorem}
   On the other hand, this one has only one claim.
\end{Theorem}

\begin{Theorem}
  \begin{enumerate}[leftmargin=*]
    \item First claim
  \end{enumerate}\vspace*{-2\partopsep}
  \begin{enumerate}[resume]
    \item Second claim
  \end{enumerate}
\end{Theorem}

\begin{Theorem}
   On the other hand, this one has only one claim.
\end{Theorem}

\begin{Theorem}
  \begin{enumerate}[leftmargin=*]
    \item First claim
    \item Second claim
  \end{enumerate}
\end{Theorem}

\end{document}

The result:

5

You can use a \@labels trick (as in Phil Hirschhorn's answer to “Avoiding a line break at the beginning of an enumerate”). Here's the result:

Image of the result of the code

There are two ways you can use this. The first is by manually putting a \thmenumhspace after \begin{enumerate} inside a theorem:

\documentclass{article}
%\usepackage{amsthm,enumitem,thmtools}% works with or without
\newtheorem{Theorem}{Theorem}
\makeatletter
\newlength{\@thlabel@width}%
\newcommand{\thmenumhspace}{\settowidth{\@thlabel@width}{\itshape1.}\sbox{\@labels}{\unhbox\@labels\hspace{\dimexpr-\leftmargin+\labelsep+\@thlabel@width-\itemindent}}}
\makeatother
\begin{document}
\begin{Theorem}
1. First claim 2. Second claim.
\end{Theorem}
\begin{Theorem}
\begin{enumerate}\thmenumhspace
\item First claim
\item Second claim
\end{enumerate}
\end{Theorem}
\end{document}

With a little more work, this can be automated, hopefully without any side effects (this time, you need amsthm for it to work correctly):

\documentclass{article}
\usepackage{amsthm,enumitem,thmtools}% needs amsthm
\newtheorem{Theorem}{Theorem}
\makeatletter
\newcommand{\thmenumhspace}[1]{\sbox{\@labels}{\unhbox\@labels\hskip#1}}
\let\original@item\item
\newlength{\@thlabel@width}%
\newcommand{\RedefineItem}{%
  \settowidth{\@thlabel@width}{\itshape1.}%
  \def\item{\let\item\original@item\thmenumhspace{\dimexpr-\leftmargin+\labelsep+\@thlabel@width-\itemindent}\original@item}
}
\let\original@Theorem\Theorem
\def\Theorem{
   \@ifnextchar[{\Theorem@Opt}
                {\Theorem@NoOpt}
}
\def\Theorem@Opt[#1]{%
   \@ifnextchar\begin{\RedefineItem\original@Theorem[#1]}%
                     {\original@Theorem[#1]}%
}
\def\Theorem@NoOpt{%
   \@ifnextchar\begin{\RedefineItem\original@Theorem}%
                     {\original@Theorem}%
}
\makeatother
\begin{document}
\begin{Theorem}
1. First claim. 2. Second claim.
\end{Theorem}
\begin{Theorem}
\begin{enumerate}
  \item First claim
  \item Second claim
\end{enumerate}
\end{Theorem}
\begin{Theorem}
This one has two claims.
\begin{enumerate}
  \item First claim
  \item Second claim
\end{enumerate}
\end{Theorem}
\begin{Theorem}[Title]
\begin{enumerate}
  \item First claim
  \item Second claim
\end{enumerate}
\end{Theorem}
\begin{Theorem}[Title]
This one has two claims.
\begin{enumerate}
  \item First claim
  \item Second claim
\end{enumerate}
\end{Theorem}
\end{document}
12
  • From where comes the dimension -1em? To me it is not enough. How to determine the exactly value to use to have the same output as with no enumerate?
    – Sigur
    Apr 8, 2015 at 17:52
  • @Sigur: I've edited the answer; it should now have the exact right amount of space whatever the settings are. Apr 10, 2015 at 16:00
  • I saw that you edited only the automated code. But I'm using the simplest one since I'm using it only once. I tried the same value as \baselineskip (in my case, 1.5em) and it looks right but I'm not sure.
    – Sigur
    Apr 10, 2015 at 17:35
  • @Sigur: I've also adapted the manual code. The exact value cannot be 1.5em: it depends on the leftmargin, labelsep, itemindent and the size of the enumerate label. Apr 10, 2015 at 19:37
  • Nice! Since I'm using the label style (i) and so on in upright font, should I use \upshape(i) instead of \itshape1.?
    – Sigur
    Apr 10, 2015 at 20:03
2

You can hack a bit the first \item as follows:

\documentclass{article}
\newtheorem{Theorem}{Theorem}
\newcommand*\fixitem {\item[]%
  \refstepcounter{enumi}\hskip-\leftmargin\labelenumi\hskip\labelsep}
\begin{document}
\begin{Theorem}
On the other hand, this one has only one claim.
\end{Theorem}
\begin{Theorem}
\begin{enumerate}
\fixitem First claim
\item Second claim
\end{enumerate}
\end{Theorem}
\end{document}

and the result is:

result of tex run

1

I found this trick that might help:

\documentclass{article}
\newtheorem{Theorem}{Theorem}
\begin{document}
\begin{Theorem}
On the other hand, this one has only one claim.
\end{Theorem}
\begin{Theorem}
\mbox{}
\begin{itemize}    
\item[(i)] item one.    
\item[(ii)] item two.    
\item[(iii)]  item three.    
\end{itemize}
\end{Theorem}
\end{document}
4
  • That is mentioned in the question I linked to, but does not do what I want because it starts a new line. I would like the list to start right beside the Theorem 2, but without the unnecessary space. May 5, 2011 at 9:41
  • 1
    How is it unnessary? That is the default space between items in a list, that has nothing to do with theorems. If you whant to be able to configure this, see the enumitem package
    – daleif
    May 5, 2011 at 9:43
  • 1
    @daleif: well, I consider it unnecessary to add extra horizontal space between the end of the Theorem 2 text and the label of the first item in the list: it is inb that way that it is unnecessary! Also «see the enumitem package» does in no way help me... I have already seen it —I have been using for years now…— and I would not be asking if I knew how to achieve the effect I want to achieve. If you read the other answers, you'll notice that it is quite not a matter of using the please-mariano option to enumitem, too. May 5, 2011 at 17:01
  • @mariano ahh, then I misunderstood, I was thinking vertical
    – daleif
    May 5, 2011 at 22:28
0

This is a non-answer whose purpose is to point out that some of the profered answers really gives correct marginal indentation of the enumerate items within a theorem.

Although I show the source and output from just one of the answers' methods,others give similar, undesirable indentation.

\documentclass{article}
%\usepackage{amsthm,thmtools}% works with or without

\usepackage{enumitem}

\newcommand{\sometext}{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam lobortis facilisis sem. Nullam nec mi et neque pharetra sollicitudin.}

\newtheorem{theorem}{Theorem}

\begin{document}

\begin{theorem}
  This is normal enumeration inside a theorem, which should be matched when no text precedes the enumeration:
  \begin{enumerate}
    \item \sometext
    \item \sometext
  \end{enumerate} 
\end{theorem}

Margination of the first item of next theorem does \emph{not} agree with the ``normal'' margination of the preceding Theorem 1.

\begin{theorem}\label{thm-2}
  \begin{enumerate}[leftmargin=*]
    \item \sometext
  \end{enumerate}\vspace*{-2\partopsep}
  \begin{enumerate}[resume]
    \item \sometext
  \end{enumerate}
\end{theorem}


Margination of \emph{neither} item of the next theorem agrees with the ``normal'' margination of Theorem 1.

\begin{theorem}
  \begin{enumerate}[leftmargin=*]
    \item \sometext
    \item \sometext
  \end{enumerate}
\end{theorem}

A theorem with no enumeration inside:

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

\end{document}

Now look at the items' indentation in the output, where the theorems that start directly with an enumerate do not have the same indentation as for a theorem that has text before the enumerate:

Wrong indentation when enumerate immediately follows theorem heading

The question becomes: When an enumerate immediate follows \begin{theorem}, ss there some way of:

  • eliminating the extra horizontal space between "Theorem" and the number of the first item; and yet
  • keep the same "normal" indentation of items as in a Theorem having some text before the enumerate?

avoiding the extra horizontal space between "Theorem" and the number of the first item

1
  • However, the @label trick does work -- even for theorem-like environments created using thmtools and for enumeration lists within them created using enumitem.
    – murray
    Mar 24, 2021 at 20:00

You must log in to answer this question.

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