character protrusion with the first letter in a paragraph
Hi, 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. Thanh
The Thanh Han wrote:
Hi,
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 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 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 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 Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
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
On Tue, Jan 18, 2005 at 10:57:10PM +0100, Hartmut Henkel wrote:
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?
definitively. How to *block* protrusion is trivial. How to make it work is more tricky :)
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.
making char protrusion work with metarial inside boxes is already a bug step and would solve a lot of problems.
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?
I don't know what it can be good for. If there is a need to protrude something that is not a character, using some virtual character may solve the problem faster. Thanh
participants (3)
-
Hans Hagen
-
Hartmut Henkel
-
The Thanh Han