3

When using the asparaenum environment from paralist, sometimes the \parindent in front of the first item is undesirable. For example, if one uses the asparaenum environment directly after starting the proof environment, then this results in an additional \parindent between ‘Proof.’  and the label of the first item.

How can I set up an environment that behaves like paralist, but that does not introduce this first \parindent? Specifically, I hope for a solution based on paralist or enumitem that does not break the optional argument for \item.

I attached a small example to illustrate what happens and what output I want. Note that while I can manually modify an instance of the asparaenum environment to get the desired output (third part of the example), I don't know how to do this automatically with a new list environment.

\documentclass{amsart}
\usepackage{paralist}
\usepackage{enumitem}

\begin{document}
What \verb!asparaenum! does:
\begin{proof}
\begin{asparaenum}
\item One.
\item Two.\qedhere
\end{asparaenum}
\end{proof}

What \verb!enumitem! does:
\begin{proof}
\begin{enumerate}[wide]
\item One.
\item Two.\qedhere
\end{enumerate}
\end{proof}

What I want:
\begin{proof}
\begin{asparaenum}
\newlength\saveitemindent
\saveitemindent=\itemindent
\advance\itemindent-\parindent
\item\itemindent=\saveitemindent One.
\item Two.\qedhere
\end{asparaenum}
\end{proof}
\end{document}

1 Answers1

2

You can abstract what you do in the last example. The most flexible package is enumitem, but if you prefer paralist just change \enumitem[wide] into \asparaenum and \endenumerate into \endasaparaenum.

\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}
\begin{proof}
\begin{proofenum}
\item One.
\item Abc
\item[XYZ] Def
\item \label{XXX} Two.\qedhere
\end{proofenum}
\end{proof}
\end{document}

(The twocolumn option is just to reduce the size of the following picture.)

enter image description here

We adjust the first \itemindent and then restore it as part of the final working of the first \item command; the \sauter@restoreitemindent command redefines itself to do nothing, so we won't do the reset any more and the command will do nothing bad in nested lists.

egreg
  • 1,121,712