2

When I include a theorem-based environment right after the start of a list item, a linebreak is inserted that looks a little funny.

\documentclass{article}
\usepackage{amsthm}
\newtheorem{claim}{Claim}
\begin{document}
Problem:
\begin{enumerate}
    \item First part of problem
    \item Second part of problem
\end{enumerate}

Solution:
\begin{enumerate}
    \item First part of solution
    \item
    \begin{claim}
        Result X holds
    \end{claim}
    By Result X, the second part follows.
\end{enumerate}
\end{document}

The linebreak occurs after Item 2 of the solution, since theorem environments always start with a linebreak. Is there an alternative to a theorem environment that I should be using? I am looking for a solution that is as canonical as possible, and doesn't require tweaking lots of settings manually.

EDIT: While updating my code snippet to make it a MWE, I realized that omitting the \usepackage{amsthm} fixes the problem. However, in my actual LaTeX document I would prefer to keep using amsthm.

7
  • See enumerating-inside-a-proposition-and-inside-a-proof
    – user30471
    Jul 25, 2014 at 10:01
  • That post is about an enum inside a theorem; my post is about a theorem inside an enum. How does it apply?
    – pre-kidney
    Jul 25, 2014 at 10:09
  • Sorry, I read your title backwards. One option would be to define your claim environment using the enumitem package -- so something like \newlist{claim}{description}{1}. Then you could set its parameters using \setlist. Be good if you could add a MWE.
    – user30471
    Jul 25, 2014 at 13:35
  • you don't say what packages you're using, but most theorem packages expect that you'll be on the "outer" level when inputting a theorem object. unless you expect to cross-reference this claim later, i'd suggest simply emulating the style manually, or providing a "simple" definition for the situation. not a great approach, but trying to overcome a rather complicated theorem environment definition is going to be at least a headache, and may well cause problems elsewhere. Jul 25, 2014 at 13:36
  • See the updated question; I am using amsthm, which introduces the extra line break.
    – pre-kidney
    Jul 26, 2014 at 0:58

3 Answers 3

3

Here is a workaround that seems to work. Simply replace \usepackage{amsthm} with \usepackage[amsthm]{ntheorem}. This avoids the extra linebreak.

1
  • I didn'tknow that one! Anyway, I always use ntheorem for its automatic placement of end-of-proof symbol, even when the proof ends with displayed equations.
    – Bernard
    Jul 26, 2014 at 13:36
2

As suggested by @Andrew, it's much simpler to define a claim environment as a special description environment, with the enumitem package. Here is a way to go.

Actually I also define a claims environment, for a series of such ‘claims’. It has a counter, and so can be referenced intelligently through the cleveref package. I reset this counter per section, but, supposing your problems or solutions are numbered environments (say theorem-like), you can easily reset claimno per problem or solution.

\documentclass{article}
\usepackage{xcolor}
\usepackage{parskip}
\usepackage{enumitem}
\usepackage{cleveref}

\newenvironment{claim}{%
\def\claim{\item[\mdseries\em Claim: ]}%
\begin{description}[wide]}%
{\end{description}}

\newenvironment{claims}{%
\newcounter{claimno}[section]\def\claim{\refstepcounter{claimno}\item[\mdseries\em Claim \theclaimno: ]}%
\begin{description}[wide]}%
{\end{description}}
\crefname{claimno}{claim}{claims}
\Crefname{claimno}{Claim}{Claims}

\begin{document}
Problem:
\begin{enumerate}
    \item First part of problem\label{part2}
    \item Second part of problem
\end{enumerate}
Solution:
\begin{enumerate}
    \item First part of solution
    \item \begin{claims}
     \claim\label{cl1}   Result X holds.  Some comments some comments some comments some comments some comments some comments some comments some comments some comments
     \claim  \mbox{}\\ Result Y holds.
\end{claims}
    By \cref{cl1}, the second part follows.
\end{enumerate}
\end{document} 

enter image description here

0

Here is some investigative work, revealed via the addition of \showoutput to your preamble:

\documentclass{article}
\usepackage{amsthm}
\newtheorem{claim}{Claim}
\showoutput
\begin{document}
Problem:
\begin{enumerate}
    \item First part of problem
    \item Second part of problem
\end{enumerate}

Solution:
\begin{enumerate}
    \item First part of solution
    \item 
    \begin{claim}
        Result X holds
    \end{claim}
    By Result X, the second part follows.
\end{enumerate}
\end{document}

The .log includes the following piece of information:

...\glue 8.0 plus 2.0 minus 4.0
...\glue -8.0 plus -2.0 minus -4.0
...\glue 4.0 minus 3.0
...\glue(\parskip) 4.0 plus 2.0 minus 1.0
...\glue(\baselineskip) 5.05556
...\hbox(6.94444+0.0)x319.99997, glue set 209.07147fil, shifted 25.00003
....\OT1/cmr/bx/n/10 C
....\OT1/cmr/bx/n/10 l
....\OT1/cmr/bx/n/10 a
....\OT1/cmr/bx/n/10 i
....\OT1/cmr/bx/n/10 m
....\kern 0.0
....\glue 3.83331 plus 1.91666 minus 1.27777
....\OT1/cmr/bx/n/10 1
....\kern 0.0
....\OT1/cmr/bx/n/10 .

The above shows the construction of Claim 1.. Immediately preceding it some glue is set. In particular 4.0 minus 3.0, \parskip and \baselineskip. Added together you can reverse the vertical skip:

enter image description here

\documentclass{article}
\usepackage{amsthm}
\newtheorem{claim}{Claim}

\begin{document}
Problem:
\begin{enumerate}
    \item First part of problem
    \item Second part of problem
\end{enumerate}

Solution:
\begin{enumerate}
    \item First part of solution
    \item \leavevmode\par\vspace*{\dimexpr-4pt-\parskip-\baselineskip}%
    \begin{claim}
        Result X holds
    \end{claim}
    By Result X, the second part follows.
\end{enumerate}
\end{document}
0

You must log in to answer this question.

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