# [texhax] Regarding {BEFORESKIP}{AFTERSKIP}{ parameters in \@startsection

Philip Taylor (Webmaster, Ret'd) P.Taylor at Rhul.Ac.Uk
Mon Mar 21 12:01:17 CET 2011

gpn return0 wrote:

> I could not able to understand the definition of the
> {BEFORESKIP}{AFTERSKIP} parameters in
>
> % \@startsection {NAME}{LEVEL}{INDENT}{BEFORESKIP}{AFTERSKIP}{STYLE}
>
>
> \def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus
>
> -.2ex}{2.3ex plus .2ex}{\Large\bf\centering}}
>
> Here what is {-3.5ex plus -1ex minus -.2ex}, as we use plus and minus
> what could be the {BEFORESKIP} value.(Why we use plus and minus instead
> for direct value)

The "plus ..." and "minus ..." components indicate what Knuth calls
"stretchability" and "shrinkability"; thus the default BEFORESKIP
in your example is 3.5ex, which can stretch to 4.5ex and shrink
to 3.3ex if needed to help achieve the target page height and depth.

Note that the leading "-" has a special significance : when present,
it indicates that the paragraph indent of any text following the heading
is suppressed.

> section levels.
>
> I have three levels - section/subsection/subsubsection with font size
> 12/10/9 pt. I need to set {AFTERSKIP} to zero for all the levels and
> {BEFORESKIP} to 2 blank lines for level one and 1 blank line for level
> two and three. So how I have to set the {BEFORESKIP}{AFTERSKIP} value.
>
> (blank line have to be of respective levels font size. so have to use ex
> unit)

Let's deal with AFTERSKIP first, since that is simple : the AFTERSKIP
parameter could be set to "-0ex" (if you want any following text to be
unindented -- the norm) or to "0ex" (if you want any following text to be
indented).  This assumes that the internals can differentiate between
"-0ex" and "0ex"; if they cannot, use "-1sp plus -0sp minus -1sp" for
the case requiring a leading "-".

BEFORESKIP could be set to "2\baselineskip" for level one,
and "1\baselineskip" for levels two and three.  Note that the leading
factor ("2" and "1", respectively) will have the effect of cancelling
any stretchability or shrinkability already present in \baselineskip,
so you will get two or one NORMAL blanks lines, which will not necessarily
match the blank lines that occur elsewhere on the same page, as they
may still be stretchable and/or shrinkable.

Note that LaTeX has some additional parameter that affects \baselineskip :
I don't know its name (I don't use LaTeX) and this /may/ need to be
taken into account in computing the correct value of BEFORESKIP.

Note also that I have not used ex's for your BEFORESKIP on the assumption
that \baselineskip will already be correctly set in terms of font size;
if this is not the case, then a more complex solution will be needed.

Caveat lector : I do not use LaTeX; all of the above is extrapolated
from my knowledge of Plain TeX with a little additional research;
you should take the advice of more LaTeX-competent authorities in
preference to mine if they offer any solutions.

Philip Taylor
--
Not sent from my i-Pad, i-Phone, Blackberry, Blueberry, or any
such similar poseurs' toy, none of which would I be seen dead
with even if they came free with every packet of cornflakes.