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.

I have a theorem which lists a bunch of properties, and then I prove them one-by-one. Because the proofs are long, it looks awkward when every line is automatically indented by the enumerate environment.

Is it possible to define a new environment, call it enumproof, which is exactly the same as the enumerate environment, but without the indentation?

Bonus challenge: Is it possible to re-define the enumerate environment so that it knows when it is inside the proof environment (from the amsthm package)--and in that case, it automatically switches to act like the enumproof environment (meaning, without the indentation)?

\documentclass{article}

\usepackage{amsthm}
\usepackage{enumitem}

\begin{document}

\noindent I want this enumeration to look normal:
\begin{enumerate}
\item Hello
\item to
\item you
\end{enumerate}

\begin{proof}
But I want this enumeration to have no extra indentation:
\begin{enumerate}
\item Hello
\item to
\item you
\end{enumerate}
\end{proof}

\end{document}
share|improve this question
1  
I usually write normal paragraphs. The initial number is sufficient to give clues and a long indented text is not so nice. –  egreg Mar 9 '12 at 21:17

1 Answer 1

up vote 8 down vote accepted

The Bonus one can be done by checking the command \@currenvir. Therefor I am using the command BeforBeginEnvironment provided by etoolbox. The changings of the environment enumerate are local because they will be passed only inside the group proof.

For your result you need the following settings:

\setlist[enumerate]{leftmargin=0pt,itemindent=*,listparindent=\parindent,parsep=0pt}

The example:

\documentclass{article}
\usepackage{showframe}
\usepackage{amsthm}
\usepackage{enumitem}
\usepackage{kantlipsum}
\usepackage{etoolbox}
\makeatletter
\BeforeBeginEnvironment{enumerate}{%
   \def\@tempa{proof}%
   \ifx\@currenvir\@tempa
     \setlist[enumerate]{leftmargin=0pt,itemindent=*,listparindent=\parindent,parsep=0pt}%
   \fi}  
\makeatother
\begin{document}

\noindent I want this enumeration to look normal:
\begin{enumerate}
\item Hello
\item to
\item you
\end{enumerate}

\begin{proof}
But I want this enumeration to have no extra indentation:
\begin{enumerate}
\item Hello \kant[1]\kant[2]
\item to
\item you
\end{enumerate}
\end{proof}


\begin{enumerate}
\item Hello
\item to
\item you
\end{enumerate}
\end{document}

output of code

share|improve this answer
1  
@jamaicanworm: Please see my edit –  Marco Daniel Mar 9 '12 at 21:29
2  
@jamaicanworm Clearly your question wasn't so clear, since both Marco and I interpreted it the same way. But Marco has now solved both your problems, so I've deleted my answer. –  Alan Munn Mar 9 '12 at 21:42
    
This is good, but there is still one problem: if I have a paragraph break within an \item (inside an enumerate inside a proof), for some reason the new paragraph is still not indented as normal paragraphs should be... –  jamaicanworm Mar 10 '12 at 21:13
1  
@jamaicanworm Are you sure Marco's code doesn't do what you want? I've updated his code slightly, and shown an example image. Does this do what you want? If not, you really need to be clearer on what the problem is. –  Alan Munn Mar 10 '12 at 22:26
    
Before it didn't do what I needed, by thanks to your edit now it does. Thank you Alan! –  jamaicanworm Mar 10 '12 at 22:35

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.