title: Suppress indentation after environment in LaTeX
body: <p>I'm trying to create a new environment in my LaTeX document where indentation in the next paragraph following the environment is suppressed.</p>
  
  <p>I have been told (TeXbook and LaTeX source) that by setting <code>\everypar</code> to <code>{\setbox0\lastbox}</code>, the TeX typesetter will execute this at the beginning of the next paragraph and thus remove the indentation:</p>
  
  <pre><code>\everypar{\setbox0\lastbox}
  </code></pre>
  
  <p>So this is what I do, but to no effect (following paragraph is still indented):</p>
  
  <pre><code>\newenvironment{example}
    {\begin{list}
       {}
       {\setlength\leftmargin{2em}}}
    {\end{list}\everypar{\setbox0\lastbox}}
  </code></pre>
  
  <p>I have studied LaTeX's internals as well as I could manage. It seems that the <code>\end</code> routine says <code>\endgroup</code> and <code>\par</code> at some point, which may be the reason LaTeX ignores my <code>\everypar</code> setting. <code>\global</code> doesn't help either. I know about <code>\noindent</code> but want to do this automatically.</p>
  
  <p>Example document fragment:</p>
  
  <pre><code>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.
  </code></pre>
  
  <p>Internal routines and switches of interest seem to be <code>\@endpetrue</code>, <code>\@endparenv</code> and others. Thanks for your help.</p>