Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
    
I would suggest using \usepackage[inline]{enumitem} and then you can use inline lists via the starred variant \begin{enunmerate*} ... \end{enunmerate*}. –  Peter Grill Nov 23 '12 at 10:45
    
@PeterGrill Does an inline list format items as paragraphs? –  Manfred Sauter Nov 23 '12 at 10:56
    
Yes, that is correct. These might be useful references for you: What are the differences between using paralist vs. enumitem, and Suggestions for transitioning from paralist to enumitem package. –  Peter Grill Nov 23 '12 at 11:03
    
@PeterGrill The inline list from enumitem formats items only within a paragraph. Still, using something like \begin{enumerate*}[itemjoin={\\\indent},mode=unboxed] indeed produces output that looks right (at least as long as I don't use additional paragraph breaks). –  Manfred Sauter Nov 26 '12 at 0:14
add comment

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.