summaryrefslogtreecommitdiff
path: root/macros/plain/contrib/misc/longtocline.tex
blob: 22766763e3441e95dbc92bc9bcbcda3154e30d22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
%%%------------- tear neatly -------------------------------------%%%%
\def\leaderfill{\kern0.5em\leaders\hbox to 0.5em{\hss.\hss}\hfill\kern
0.5em}% right out of the 'bible'
\newcount\nmbroflines \newbox\scratch \newbox\rule \newdimen\myindent
%caution! \myindent needs to be set first, say e.g.
\myindent=1.5true cm
\def\hugeheader#1#2#3{\bgroup\parskip=0pt
\setbox\scratch=\vbox{{\advance\hsize by-\myindent
\advance\hsize by-3true cm\noindent#2\par}% to prevent blanks
\global\nmbroflines=\prevgraf}%             'you never know'
\unvbox\scratch \setbox\rule=\lastbox
\loop\ifnum\nmbroflines>1
\unskip\unpenalty\setbox\scratch=\lastbox
\advance\nmbroflines by-1\repeat
\setbox\scratch=\hbox{\unhbox\rule\unskip\unskip\unpenalty}%
{\par\advance\hsize by-3true cm\hangindent\myindent
\noindent\hbox to\myindent{#1\hss}#2\par}%
\vskip-\baselineskip
\line{\kern\myindent\kern\wd\scratch\leaderfill#3}\egroup}
\endinput
% usage:
\line{\hbox to\myindent{1.0\hfil}Normal Heading\leaderfill 66}
\hugeheader{1.1}{Abnormal heading of a chapter about giant holes all
over Australia caused by elephants interbreeded with local kangaroos}%
{77}
%%%------------- cut along this line ----------------------------%%%%%