Suppress indentation after environment in LaTeX

Posted by David on Stack Overflow See other posts from Stack Overflow or by David
Published on 2010-04-29T15:44:11Z Indexed on 2010/04/29 15:47 UTC
Read the original article Hit count: 369

Filed under:
|
|

I'm trying to create a new environment in my LaTeX document where indentation in the next paragraph following the environment is suppressed.

I have been told (TeXbook and LaTeX source) that by setting \everypar to {\setbox0\lastbox}, the TeX typesetter will execute this at the beginning of the next paragraph and thus remove the indentation:

\everypar{\setbox0\lastbox}

So this is what I do, but to no effect (following paragraph is still indented):

\newenvironment{example}
  {\begin{list}
     {}
     {\setlength\leftmargin{2em}}}
  {\end{list}\everypar{\setbox0\lastbox}}

I have studied LaTeX's internals as well as I could manage. It seems that the \end routine says \endgroup and \par at some point, which may be the reason LaTeX ignores my \everypar setting. \global doesn't help either. I know about \noindent but want to do this automatically.

Example document fragment:

This is paragraph text. This is paragraph text, too.

\begin{example}
  \item This is the first item in the list.
  \item This is the second item in the list.
\end{example}

This is more paragraph text. I don't want this indented, please.

Internal routines and switches of interest seem to be \@endpetrue, \@endparenv and others. Thanks for your help.

© Stack Overflow or respective owner

Related posts about latex

Related posts about environment