[texhax] dotfill leaders on first line of paragraph only ?
Philip TAYLOR
P.Taylor at Rhul.Ac.Uk
Mon Dec 5 14:15:46 CET 2011
Philip TAYLOR wrote:
> As I wrote to Herb, I have now cracked this,
> and will post my solution once it is in a fit state
> for publication.
and here it is. Please treat it as "proof of concept" only --
it records (but does not make use of) \lastskip and \lastpenalty,
and obviously these should be re-inserted into the re-built
\vtop if it is to be a perfect replica of the one with which
we started.
** Phil.
--------
% !TeX Program=XeTeX
\font \Text = "Palatino Linotype" at 11.25 pt
\font \Vietnamese = "Palatino Linotype: color=0000FF" at 11.25 pt
\font \English = "Palatino Linotype: color=003F00" at 11.25 pt
\font \Seqno = "Palatino Linotype: color=FF0000" at 11.25 pt
\font \Price = "Palatino Linotype: color=0000FF" at 11.25 pt
\newif \ifmore
\newskip \Lastskip
\newcount \Lastpenalty
\tabskip = 0 pt plus 1 fil
\hsize = 25pc
\catcode `\~ = \catcode `\@
\parindent = 0 pt
\parskip = 3 ex
\def \Note #1{{\Text #1} \vskip 1 ex }
\def \Shewsample #1{\halign to \hsize {&##\hfil \cr {\Seqno 1. }&\copy #1& {\Price £9-99}\cr}}
\def \Sample #1%
{
\setbox 0 = \vtop
\bgroup
\parindent = 0 pt
\raggedright
\emergencystretch = 1 pt
\multiply \tolerance by 8
\hsize = 247pt
#1
\egroup
}
\def \Dotfilllineone
{
\vtop
\bgroup
\global \setbox 4 = \vtop {}
\parindent = 0 pt
\showboxbreadth = 400
\showboxdepth = 3
\unvbox 0
\loop
\setbox 0 = \lastbox
\ifvoid 0
\morefalse
\global \setbox 4 = \vtop {\hsize = 247 pt \unhbox 2 \unskip \ \dotfill \break \box 4 }
\else
\moretrue
\Lastskip = \lastskip \unskip
\Lastpenalty = \lastpenalty \unpenalty
\ifvoid 2 \else \global \setbox 4 = \vtop {\hsize = 227 pt \box 2 \box 4 }\fi
\setbox 2 = \box 0
\fi
\ifmore
\repeat
\egroup
}
\Note {First test : one-line item}
\Sample {{\Vietnamese Heo nồi đất} \English ~ Minced pork hot pot}
\Shewsample 0
\Dotfilllineone
\Shewsample 4
\Note {Second test : two-line item}
\Sample {{\Vietnamese Heo nồi đất} \English ~ Minced pork hot pot with tofu and aubergine}
\Shewsample 0
\Dotfilllineone
\Shewsample 4
\end
More information about the texhax
mailing list