When I wrap a verbatim-environment into an additional group, a new paragraph will be started after that group.
(In the example below, \parindent
-glue is inserted before the YYY when \begingroup
and \endgroup
are there.)
Why? How can this be avoided?
\documentclass{article}
\parindent=2cm
\begin{document}
XXX\begin{verbatim}
\LaTeX
\LaTeX
\LaTeX
\end{verbatim}
YYY
\noindent\null\hrulefill\null
XXX\begingroup\begin{verbatim}
\LaTeX
\LaTeX
\LaTeX
\end{verbatim}
\endgroup YYY
\end{document}
\parindent
is not there in the first case, there is, it would seem, a\par
of some sort. Just set\parskip=5ex
, for example, to see where the paragraphs are inserted. That is to say,\endgroup\noindent
would appear to give the same result as the 1st case, regardless of\parskip
and\parindent
.\trivlist
. This implies: In case the verbatim-environment itself is not the begin of a new paragraph, there is vertical\topsep
-glue at the top and at the bottom of the verbatimized text. In case the verbatim-environment itself is the begin of a new paragraph, there is vertical\topsep
-glue and vertical\partopsep
-glue at the top and at the bottom of the verbatimized text.\scantokens
. Some sort of\label
-\ref
-thingie for saving arbitrary snippets of code where the\label
-part is done by an environment whose argument holds the label name and whose body contains the snippet of code which might as well form a verbatim-environment...