You are here: Home / Przedsięwzięcia/Projects / TeX Pearls / 2007 Pearls / marcin-wolinski / bachotex2007-marcin-wolinski-pearl1.tex


TeX document icon bachotex2007-marcin-wolinski-pearl1.tex — TeX document, 1 KB (1741 bytes)

File contents

%%% How to make a box disappear at a line break

% Let us consider the problem of marking spaces in a paragraph with some
% symbol, like in the following example:

\def {%
Ten typowy testowy akapit tekstu daje przy okazji rodzaj filigranowego %
wysypu hodowli pieczarek w zielonym kasztanie regloryfikacji %
stanowisk ministerialnych i podsypanych minimalistom jako fetysz %
zaduchu studziennych barykad.%

% The hard part is to make the symbol disappear when such a ``space'' occurs at
% a line break.  We cannot use \discretionary for that purpose since we need
% the ``space'' to be stretchable to make justification possible. Moreover we
% want to be able to associate some penalty (e.g., 0) with our breakpoints
% other than \(ex)hyphenpenalty.

% As it turns out any box can be made discardable by putting it into \cleaders
% to the exact width of the box in question. According to his rules \TeX\ will
% put exactly one copy of the box in the text. So the construct will look
% exactly like the box itself but will behave like a glob of glue. In
% particular it will disappear at a line break.

% Stretchability is achieved with separate globs of glue not to allow \TeX\ to
% insert more than one copy of the box in case of an overstretched space.

% Note that this trick can be used in vertical mode as well (e.g., to separate
% paragraphs with some graphical element except the case when a paragraph
% boundary occurs at a page break).  A discardable box can have arbitrary
% complexity, it can include colour, EPS graphics, and so on.


Document Actions