[tex-eplain] \leavevmode in front of hyperlinks

geolsoft at mail.ru geolsoft at mail.ru
Sun Jul 24 22:22:32 CEST 2005


On Sun, Jul 24, 2005 at 08:58:09PM +0200, Karl Berry wrote:
>       \hlstart{}{}{LABEL}
>       Text of the link\hlend.
> 
>     When \hloff (and therefore no \leavevmode) there will be no
>     space before `Text'; 
> 
> I don't understand this example, though.  What does \leavevmode have to
> do with whether there is a space or not?  Should \hlstart end with
> \ignorespaces?  (Sorry, maybe it'd be obvious if I looked at the code,
> but I still haven't. :)

TeX generates a space token at the end of the first line,
after seeing end-of-line after the `}'.  This space is
ignored in vertical mode, in which we still remain after
\hlstart if it does not say \leavevmode.  But this space is
not ignored in horizontal mode, in which we are after
\hlstart if it does say \leavevmode.

This was just an example to show how omitting \leavevmode
may change behavior of \hlstart.  Even if we do add
\ignorespaces, I can still come up with another example
(probably contrived, though) where omitting \leavevmode does
make a difference.  But since you agree that \leavevmode
should always be produced, it doesn't matter now.

As for the \ignorespaces, I don't really see any pros or
cons.  It seems just a matter of taste.  But since all
eplain macros which define cross-reference labels do
\ignorespaces, I think it is better to do it too, if only
for consistency.

-- 
Best regards,
Oleg Katsitadze



More information about the tex-eplain mailing list