[texhax] plain TeX macros for TOC
Wolfgang Schuster
schuster.wolfgang at googlemail.com
Fri Feb 5 15:16:51 CET 2010
Am 05.02.10 14:45, schrieb Rodolfo Medina:
> What did you put in place of `\dimexpr' when you tested it?
\dimexpr is only available with eTeX but here is a solution
which works also without eTeX.
\def\sectionnumberwidth{1.5em}
\def\pagenumberwidth {1.5em}
\def\listfill {\leaders\hbox to .5em{\hss.\hss}\hfill}
\def\tocentry#1#2#3%
{\endgraf
\noindent\hbox to \hsize
{\vbox
{\raggedright
\hangindent\sectionnumberwidth
\hangafter=1
\leavevmode\hbox to \sectionnumberwidth{#1\hss}%
%#2\nobreak\hskip.5em\listfill\hskip.5em\relax
\strut#2\nobreak\hskip.5em\listfill\hskip.5em\relax
\hbox to \pagenumberwidth{\hss#3}}}
\endgraf}
\showframe
\tocentry{1}{text text}{5}
\tocentry{1.3}{text text text text text text text text text text text
text text text text text}{34}
\bye
Wolfgang
More information about the texhax
mailing list