My document has lots of extra whitespace appearing between various elements. The problems appear around one macro which appears multiple times. After every line in the macro, I've placed %
's, however, extra white spaces are still appearing.
- What method can I use to track what is causing these white spaces?
- Is it possible that items such as
ifstrequal
(frometoolbox
), macros referenced inside macros, mathmode-textmode switching, glossary entries,\pageref
's and other cross-referencing and labeling commands. or indented space before code will cause these problems?
Best Answer
Scanner and parser for TeX are closely linked. If we assume that all characters have their usual catcode, then note:
\par
).\setcounter
,\addtocounter
,\value
,\roman
,\Roman
,\arabic
,\Alph
and\the
should be used to handle counters and their values.\normalsize \normalfont
is the same like\normalsize\normalfont
without space between\normalsize
and\normalfont
).\normalsize9
will be interpreted like\normalsize
and9
,\textbf9
is interpreted as\textbf
with argument9
and therefor will result in a bold 9, and\textbf98
will be interpreted as\textbf
with argument9
followed by8
and will result in a bold 9 followed by a nonbold 8).\makeatletter
and\makeatother
character@
if a non-letter.\stackrel{a} {b}
is same like\stackrel{a}{b}
).\section[foo]
) or optional stars off macros (e.g. after\section*
) are ignored.\index{foo}
). That does not always work.tabular
andminipage
that will used to set vertical material in horizontal mode) likeverbatim
.This means for example that with a macro like this:
three significant spaces will be set before and two after the argument.
Just for better illustration here the same definition again, but I've replaced the significant spaces by
\
and the line endings, which are significant spaces too, by¶
:To remove these spaces you have simply omit some of them and comment out the other:
That's it almost. The last thing to mention is that a horizontal shift to the right of an entire block, such as a
tabular
,\parbox
or aminipage
sometimes is caused simply by the normal paragraph indentation. This's always the case if that block is at the beginning of the paragraph or a stand alone paragraph. In this case, a simple solution may be to but\noindent
at the beginning of the paragraph (e.g. before the\begin{tabular}
).