wouldn’t a “\ “(backslash-space) have worked also?
– tj 2010-09-12 12:43 UTC
Well, it almost works, but is not very elegant (and has a visible side effect).
First of all, TeX discards trailing spaces, so “\
” at the end of line becomes effectively a backslash-newline (which happens to expand to—but not mean—”\
”—see line b158 of the LaTeX2e source). (You may say “\ %
” if you don’t want TeX to discard that space.)
Further, all whitespace is discarded in vertical mode (and after a \\
, TeX is indeed in vmode), but “\
” is not considered to be “whitespace” here—instead, it’s a horizontal command putting a space on a horizontal list. So we get a spurious space at the beginning of the next line. (Try \tracingcommands=1\tracingmacros=1\tracingonline=1
if you want to see it for yourself!)
I believe that \relax
is the cleanest way to solve this problem. It’s not very “LaTeX-ish”, since \relax
is rather a low-level TeX primitive, but I can’t think of any “better” alternative.
Notice also that a similar problem in amsmath
displayed environments is solved by the mathtools
package.
– Marcin Borkowski 2010-09-12 23:31 UTC