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.

I am currently looking somewhat carefully at how TeX manipulates skips, and I am having trouble finding practical use cases for skips with a negative stretch or shrink component, such as \Askip and \Bskip in the following.

\newskip\Askip
\newskip\Bskip
\Askip 0pt plus -2pt minus 3pt
\Bskip 0pt plus 1fil minus -4bp

They lead to odd situations. For instance, putting a skip with a large negative stretch component in a box that it somewhat underfull will cause other skips to shrink proportionally to their stretch component.

\hbox to 200pt{A B C\hskip 0pt plus -50pt}\bye

What happens is that since the box is underfull, TeX looks at the sum of the available stretch components. Since this sum is negative, the stretch components are multipled by a negative number.

So, obviously this example is not useful, but are there some more useful examples of what negative glue can be used for?

share|improve this question
5  
I'd say that negative shrink components might be useful for compensating positive ones. See \hfilneg and \vfilneg (where the shrink component is infinite). –  egreg Mar 6 '12 at 13:56

2 Answers 2

up vote 9 down vote accepted

As @egreg mentioned in comments, they are usually paired with equal positive values.

plain and latex both have

 \def\filbreak{\par\vfil\penalty-200\vfilneg}

if the break happens the negative stretch is thrown away at the top of the next page, but if it does not happen, it counteracts the fil space before the penalty leaving zero total stretch.

share|improve this answer

maybe not exactly what is requested, but an absolute negative skip is useful in creating composite symbols, e.g.

x \rightarrow\mskip-15mu\rightarrow\mskip-15mu\rightarrow y

will give you

a three-headed arrow

it's also instructive to notice that \llap, \rlap, \clap and their vertical friends are all based on \hss or \vss which are primitives defined with infinite negative shrink and stretch. \llap is immensely useful for positioning page numbers flush right in a table of contents. and marginal notes couldn't exist without these facilities.

share|improve this answer
    
I could see how absolute negative skips are useful (although here you could equally well use \mkern, I believe). Thanks for mentionning \llap and friends. –  Bruno Le Floch Mar 6 '12 at 19:42
    
yes, you could definitely use \mkern and i probably should have. still, it's the negative value that's most relevant to your question. there are some good examples in the texbook if you follow the index entries for hss. –  barbara beeton Mar 6 '12 at 21:55
    
Actually, \hss and \vss do not have negative stretch and shrink. They are equivalent to skips by 0pt plus 1fil minus 1fil. –  Bruno Le Floch Jul 11 at 23:00

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.