In addition to @Josephs's points, things to be aware of:
\unskip
acts on horizontal and vertical space, so it will remove vertical space if used between paragraphs.
Unlike \ignorespaces
which affects the conversion between input characters and tokens, \unskip
works on the actual lists inside boxes, after all tokenisation and commands have been executed.
\unskip
can not be used in outer vertical mode: Once an item has been added to the main vertical list of a page it can not be removed. So while in a minipage you can remove preceding vertical space with \unskip
, on the main page you have to use \vskip-\lastskip
to back up over the previous skip rather than actually removing it. This leaves breakable glue so you may also need to inject some \penalties
to prevent page breaking.
Consider:
\documentclass{article}
\showoutput
\begin{document}
\setbox0\vbox{
\hbox{g}
\vskip 10pt
\hbox{b}
}
\showbox0
\setbox2\vbox{
\hbox{g}
\vskip 10pt
\unskip\nobreak\hbox{b}
}
\showbox2
\setbox4\vbox{
\hbox{g}
\vskip 10pt
\vskip-\lastskip\nobreak\hbox{b}
}
\showbox2
\hbox{g}
\vskip 10pt
\unskip\nobreak\hbox{b}
\stop
Box 0 is
\vbox(26.30554+0.0)x5.55557
.\hbox(4.30554+1.94444)x5.00002
..\OT1/cmr/m/n/10 g
.\glue 10.0
.\glue(\baselineskip) 3.11111
.\hbox(6.94444+0.0)x5.55557
..\OT1/cmr/m/n/10 b
But suppose (as in box 2) That the code adding b
needs to remove space above, it could use \unskip
which literally removes it, resulting in
\vbox(16.30554+0.0)x5.55557
.\hbox(4.30554+1.94444)x5.00002
..\OT1/cmr/m/n/10 g
.\penalty 10000
.\glue(\baselineskip) 3.11111
.\hbox(6.94444+0.0)x5.55557
..\OT1/cmr/m/n/10 b
If instead of removing it, negative space is added to compensate as n box 4 then you get
\vbox(16.30554+0.0)x5.55557
.\hbox(4.30554+1.94444)x5.00002
..\OT1/cmr/m/n/10 g
.\glue 10.0
.\glue -10.0
.\penalty 10000
.\glue(\baselineskip) 3.11111
.\hbox(6.94444+0.0)x5.55557
..\OT1/cmr/m/n/10 b
This looks the same but if the penalty was not 10000 then it would be a feasible breakpoint at that position, which means that if the list was unboxed the end of the first part would have depth 0 rather than the depth of g
which can have subtle (or not so subtle) affects on positioning that are hard to correct (or at least hard to remember to correct).
So the issues surrounding \unskip
are a lot simpler than the vskip-\lastskip
combination, however if you are not in a box, you don't have a choice, as the last version on the main page produces:
! You can't use `\unskip' in vertical mode.
l.46 \unskip
The \lccode
of a character is used in hyphenation when \uchyph
is set to zero:
\documentclass{article}
\begin{document}
\uchyph=0 %
\begingroup
\lccode`\C=`\C
Some filler text.
Some filler text.
Some filler text.
Some filler text.
Capitalised word.
\par
\endgroup
\begingroup
\lccode`\C=`\c
Some filler text.
Some filler text.
Some filler text.
Some filler text.
Capitalised word.
\par
\endgroup
\begingroup
\uccode`\C=`\C
Some filler text.
Some filler text.
Some filler text.
Some filler text.
Capitalised word.
\par
\endgroup
\begingroup
\uccode`\C=`\c
Some filler text.
Some filler text.
Some filler text.
Some filler text.
Capitalised word.
\par
\endgroup
\end{document}
Notice that \uchyph
is therefore misleadingly-named, as what is tested is whether the word starts with a lower case letter (one with \lccode
equal to itself).
Best Answer
If
whatsits
are aptly named is a matter of opinion, as I think they would fit better in TeX's semantics if they were calledafterallnodes
;whatsits
represent commands whose execution is delayed or are special commands associated with a particular device or system and are not part of TeX's normal processing flow.It is interesting to investigate Knuth's rationale for introducing them. In a meeting with NTG members on March 13th, 1996 Knuth in reply to a question said:
A
whatsit
can appear in either a horizontal or a vertical list and has no dimensions. It signifies an operation that should be delayed as it doesn't fit in its ordinary scheme of things. The paragraph builder and the page builder scan lists submitted to them and execute certain types ofwhatsit
. They are useful when associated with specific implementations.The more common
whatsits
are the ones associated with the main vertical list:(a) delayed writes generated by
\write
. The token list of a delayed\write
is not written-out until the surrounding material of a\write
makes it to the output routine where a\shipout
is executed. Therefore, the write token list has to be stored on the main vertical list.(b) specials that use the
\special
command. The token list of a special command is stored with the main vertical list because the token list needs to be written to the dvi file. This happens, as in the case of write at the time of shipout.Practical implementations can be found in postcript, pdf, color drivers and graphics programs. An interesting read is always the hyperref manual. The package uses
\specials
extensively to implement the interface between TeX commands and the PDF page description language. They are very simple to write:To summarize it is a free for all hook/interface. Why they were called
whatsit
-- my guess is that it was a Knuth (ala\fi
)whatisit
. This simple innocentspecial
command enabled TeX to survive and adapt over the years, producing output frompostcript
toPDF
and introducing color and graphics.