> > Of course the macro also needs to be upgraded to properly format
> > multi-line TOC entries, but that's a different problem.

> Anyone want to volunteer?  :)

I just realized it is not necessary.  The TOC mechanism in ms is
very general.  It requires the user to provide content for the
TOC between calls to XS and XE, but that content can contain
arbitrary control lines, so we can just set up the indents
any way we like.

Here's a demonstration using Joerg's example.


.\" ms
.\" ----------------------------------------------------------------
.ds FAM T
.nr PS 15700
.nr VS \n(PS+4p
.\" ----------------------------------------------------------------
.de MHEAD
.XS
.sp 1v
.nh
.in \\n[tocw1]u+1n
.ti 0
.ta \\n[tocw1]uR +1n
.ft B
\t\\$1\t\\$2\h'1n'\c
.ft P
.XE
..
.\" ----------------------------------------------------------------
.de SHEAD
.XS
.nh
.in \\n[tocw1]u+1n+\\n[tocw2]u+1n
.ti \\n[tocw1]u+1n
.ta \\n[tocw2]uR +1n
\t\\$1\t\\$2\h'1n'\c
.XE
..
.\" ----------------------------------------------------------------
.LP
.nr tocw1 \w'\fB1.\fP' \" these should reflect the longest
.nr tocw2 \w'1.11.'    \" section numbers at each level
.MHEAD 1.    "Chapter whatever
.SHEAD 1.1.  "long entry not honouring indent after line break as one\~can see: 
foo bar baz foo bar baz
.SHEAD 1.2.  "short and good entry
.SHEAD 1.3.  "this entry fails to line break but instead pushes numbers to the 
right
.SHEAD 1.4.  "short and good entry
.SHEAD 1.5.  "long entry not honouring indent after line breaking. the\~word 
`elaboration' seem hyphenated too late, too (hyphenation aligned with page 
numbers)
.SHEAD 1.6.  "short and good entry
.SHEAD 1.7.  "the next entry below shows additional problem of spurious ruler 
(single dot) way too close to preceding\~text
.SHEAD 1.8.  "short and good entry
.SHEAD 1.9.  "Distributed Model als unendlich-dimensionales Kompartmentmodell
.SHEAD 1.10. "Of course none of the above happens anymore
.MHEAD 2.    "Chapter whatever
.PX

Attachment: tocbug.pdf
Description: Adobe PDF document

Reply via email to