-Robin- wrote:Now I'm going to google a bit to see what those extra commands are actually doing.
\leavevmode forces a paragraph start by leaving vertical mode (this should be described in some manual).
\ignorespaces ignores all spaces after the environment (which doesn't really change anything here because we are at the start of a paragraph).
And thanks for the tip of removing those newlines / spaces from the commands/environments definitions.
\begin{X} ... \end{X} is basically equivalent to
\begingroup\beginX ... \endX\endgroup. It is quite common to wrap an environment in another one, and then the inner group is unnecessary (but not harmful). The replacement texts of
\beginX and
\endX are inserted without any changes, and if they contain line breaks or spaces, those will be visible in the output—a single line break is the same as a space from TeX's point of view. This is why you got the space in your first code. You can either put the whole definition in one line, or mask every line break inside the definition by commenting it out:
Code: Select all
\newcommand{\XYZ}{XYZ}
% or
\newcommand{\XYZ}{%
X%
Y%
Z%
}
When you open a package or class file, you see lines like this all over the place.