summaryrefslogtreecommitdiff
path: root/macros/plain/contrib/misc/longtocline.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/plain/contrib/misc/longtocline.tex')
-rw-r--r--macros/plain/contrib/misc/longtocline.tex26
1 files changed, 26 insertions, 0 deletions
diff --git a/macros/plain/contrib/misc/longtocline.tex b/macros/plain/contrib/misc/longtocline.tex
new file mode 100644
index 0000000000..22766763e3
--- /dev/null
+++ b/macros/plain/contrib/misc/longtocline.tex
@@ -0,0 +1,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 ----------------------------%%%%%