1

Here Manfred Sauter asked for appropriate spacing in front of the first label in a list. However, if there is no text in front of the first label, the first label will not be indented at all. How can the line \advance\itemindent-\parindent be changed such that the first label will be indented (as much as the second, third, etc. label) when there is no preceding text?

The problem can be seen here (I changed the example from the referenced question):

\documentclass[twocolumn]{amsart}
\usepackage{enumitem}
\usepackage{etoolbox}

\makeatletter
\newenvironment{proofenum}
 {\enumerate[wide]%
  \edef\sauter@saveditemindent{\the\itemindent}%
  \advance\itemindent-\parindent
  \patchcmd{\@item}{\ignorespaces}{\sauter@restoreitemindent\ignorespaces}{}{}}
 {\endenumerate}
\newcommand\sauter@restoreitemindent{%
  \itemindent=\sauter@saveditemindent
  \def\sauter@restoreitemindent{}}
\makeatother

\begin{document}
This looks good:
\begin{proof}
\begin{proofenum}
\item One.
\item Abc
\item[XYZ] Def
\item \label{XXX} Two.\qedhere
\end{proofenum}
\end{proof}

\begin{proof} But we have text here.
\begin{proofenum}
\item It would be nice to have this first line indented automatically, just like Number 2 and 3.
\item Number 2.
\item Number 3. \qedhere
\end{proofenum}
\end{proof}

\end{document}

MWE

  • What you have in mind is not very clear, at least for me. Could you explain more? – Bernard Apr 27 '14 at 22:34
  • The answer to M. Sauter's question solves the problem that when there is text in front of the first label, there will generally be a large space between the label and the preceding text. However, when there is no preceding text, that solution will produce a first item which is not indented at all. – Deniz Apr 27 '14 at 22:40
  • Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – cfr Apr 28 '14 at 1:32
  • You were right. It's hard to imagine. This MWE should make it clear ;-) – Deniz Apr 28 '14 at 11:54
  • Just use enumerate in the second case. – Andrew Swann Jul 17 '14 at 11:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.