Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

LaTeX offers a number of commands that can be used in macros that want to be invisible i.e., not leave any extra space when used in the middle of text. These macros include \@esphack, \@bsphack, \@Esphack, \@Vbsphack and can be found in ltspace.dtx.

Amongst all these commands \@vbsphack stands alone as it is described in the source, but not implemented and commented as follows:

Another variant which is useful for invisible things which should not live in vmode (this is how some people feel about marginals). If it occurs in vmode then it enters hmode and ensures that \@savsk is nonzero so that the \ignorespaces is put in later. It is not used at present.

The macro definition is copied below:

\def \@vbsphack{ %
\relax \ifvmode
\leavevmode
\@savsk 1sp
\@savsf \spacefactor
\else
\ifhmode
\@savsk \lastskip
\@savsf \spacefactor
\fi
\fi
}

Can someone explain why should the \@savsk should be non-zero? The explanation offered in the source is not very clear.

Lastly as I am sure the name of these macros is not a lisp relic, can anyone offer the origin or history of how the family name was derived?

share|improve this question
add comment

2 Answers 2

up vote 6 down vote accepted

I can help at least on the naming: these are 'space hacks' to try to avoid messing up spacing with commands that 'do nothing' in output terms. So you have \@bsphack = 'begin space hack', \@esphack = 'end space hack'. I think \@Esphack is intended only for floats, but on this I'm not certain.

share|improve this answer
    
Thanks for clarifying it! I was going to ask a colleague about it but I was afraid he was going to swear back at me:) –  Yiannis Lazarides Jan 4 '11 at 19:17
add comment

Joseph answered the naming question (I have always liked the idea of an esp hack).

The reason for making \@savsk nonzero is because it moves into horizontal mode (\leavevmode) and \@esphack checks if \@savsk is positive. If it is, then it uses \ignorespaces to gobble space tokens (as the quote says).

I'm not terribly sure I follow what this could be used for though.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.