According to https://en.wikibooks.org/wiki/LaTeX/Basics#Spaces
... opening space is generally ignored.
First of all, I don't know what generally refers to.
I came across this using chktex
a program to warn about possible typographic or logical errors which latex itself does not warn about.
For instance, chktex
raises a warning if in front of \label
or \index
a space/tab is found (Warning 24: Delete this space to maintain correct pagereferences.
).
The reason for this warning is that labels should always be on the same page to that the label relates to (see $ texdoc chktex
, chapt. 7, p. 19, v1.7.4).
However, I usually indent lines within my figure environments:
\begin{figure}
\centering
\includegraphics{}
\caption{}
\label{}
\end{figure}
Therefore, chktex complains about the indentation of \label{}
.
In this particular case being a floating box, everything inside the floating box is, afaik, anyhow on the same page (possibly similarly to \begin{equation}...\n\label{eq:first}\end{equation}
).
The question: I wonder whether an opening space in front of \label
can lead to a wrong pagereference?
Consider indentation in figure environments or for example this situation:
\paragraph{Introduction}%
text of paragraph...%
\label{par:end_intro}%can this be on a new page
Consequently, is it reasonable to extend chktex to distinguish "opening spaces" from spaces after first non-space characters to remove false positives as in my case the indentation within the figure environment? Or in other words is the warning in my case a false positive?
If someone knows a better situation where this is relevant, I'd be happy if you could insert this to the question.
Update chktex version 1.7.5 (2015-12-07) and higher tracks whether the previous line ended in a comment and does not raise warning 24 in the above given example.
PostLink = { \index }
to~/.chktexrc
. This leaves the analogous warning for indices intact.