[NTG-pdftex] character protrusion with the first letter in a paragraph

Hartmut Henkel hartmut_henkel at gmx.de
Tue Jan 18 22:57:10 CET 2005


On Mon, 15 Nov 2004, Hans Hagen wrote:

> The Thanh Han wrote:
> >
> > I have been thinking of the question how to make char protrusion
> > work with the first char of a paragraph. The simplest (and quite
> > robust) solution can be as follows: when considering whether a
> > marginal kern should be inserted, we skip certain kinds of
> > `invisible' node (like adjust node, penalty node and the like). Now
> > to make it work with the first char of a par, we also skip null
> > boxes (box with zero dimen and empty contents) at the left margin.
> > The question is whether such behaviour is ``correct'', and what
> > surprises it can bring in certain situations.
>
> there are several solutions possible:
>
> <nothing><null box>text text text text
>
> here it looks safe to me to do as you suggest, it can of course be
> made into an option, say \pdfprotrudeparstart=1 or so
>
> <something><null box>text text text text

these two cases i tried to handle in the experimental patch 257. At
paragraph start the empty \hbox{} inserted by TeX is skipped, if
\parindent=0pt. Else, inside the paragraph the discardable items at line
start are skipped. Then the cp_skipable things are skipped, while diving
in and out \hboxes, if any.

> is more tricky since one may use the box in order to prevent
> protruding; on the other hand, if you ignore all null boxes, then it
> maybe nice to have something
>
> \noprotrusion, which introduces a special node, which in itself may be
> tricky, although pdftex introduces new nodes anyway

Also any empty or non-empty box with some height or depth does this, e.
g. "\vphantom." Maybe that's enough?

> I can also imagine something \pdfprotrudeleft (and right) that can be
> inserted manually (or everypar'd; in that case it would be handy to
> finally have \everyendpar available as well); imagine:
>
> \pdfprotrudeleft \hbox {somechar} some text
>
> \pdfprotrudeleft \hbox {\hbox {somechar}} some text

at least now it would find "somechar" inside the box if this is
protrudable.

> how difficult is it to let pdftex in that case follow the list until
> it finds a char (here 's'); this woudl permit things like
>
> \pdfprotrudeleft \hbox {x\hskip-2pt x} some text

To _hide_ the whole \hbox until "s" is found and active at the margin?

Or should one allow protrusion of "s" in things like \llap{foo}s?

Regards, Hartmut


More information about the ntg-pdftex mailing list