[texhax] modifying \@startsection

Uwe Lück uwe.lueck at web.de
Tue Jun 20 01:17:34 CEST 2006

Thanks a lot for this undisclosing this secret ...

At 13:24 16.06.06, Michael Barr wrote:
>I will tell you my secret for modifying section starts and similar things.
>I have made a number of such modifications, but I would not have been able
>had I had only LaTeX2e available.  The best such documentation for LaTeX
>is found in latex.tex, the source for the old original LaTeX.  The section
>macros have been copied verbatim, I believe, into LaTeX2e, but without the
>original comments that make it relatively easy to modify.

... I guess this is because of the pseudo-code documentation
of LaTeX 2 which has only partially survived in the LaTeX2e
documentation. And pseudo-code is perhaps (sometimes)
more helpful than the occasional natural language remarks
in the LaTeX2e documentation. Indeed due to an advice of
a friend, I have for many years studied the code instead of
any documentation.

Concerning headings (in case that I haven't posted this
earlier or clear enough):

1.  http://www.dante.de/CTAN/help/Catalogue/bytopic.html#title

(from the topical CTAN catalogue)
provides help for non-Standard sectioning formats;
and Peter Wilson's memoir class does as well.
I have some closer acquaintance with Alex Rozhenko's
nccsect package from ncctools.

2. [Learnt from many spoilt hours:] In designing new
heading macros from scratch, it is vital to launch the
\mark's and the .toc entry before setting the vertical
skip below. (Vital for ensuing \addvspace which
should not /add/ vertical space, rather /ensure/ some
minimal vertical space.)

3. Moreover, \@afterheading should be used to prevent
an immediately following page break. It is vital to know
here that something like \nopagebreak alone would
help very little -- rather the global switch \if at nobreak
is essential. And \@afterheading is essential for
using \if at nobreak in a helpful way.


More information about the texhax mailing list