2

Looking at the source code I could not figure out what the command does, I know it is a "skip" (I admit I'm unaware about how skips work), since it is defined by

\newskip\@tempskipa

as on latex.ltx file, but in the sectioning commands is used everywhere without a precise setting.

GiuTeX
  • 1,309
  • 6
    \@tempskipa is a skip register which is temporarily used by many macros for internal stuff. E.g., a macro could use \@tempskipa to do some calculations and another macro could reuse it. LaTeX was written when there weren't too many registers available in TeX and therefore it had to be economical in the usage of them. – Skillmon Jan 03 '20 at 18:51

1 Answers1

4

As the name says, it's a temporary (or scratch) skip register. LaTeX defines two of these, \@tempskipa and \@tempskipb. Skip registers are length registers that may contain glue (either stretch or shrink).

LaTeX defines these temporary skip to be used in all kinds of calculations and conditionals. Specifically in \@startsection (in latex.ltx), this is what it looks like:

\def\@startsection#1#2#3#4#5#6{%
  \if@noskipsec \leavevmode \fi
  \par
  \@tempskipa #4\relax
  \@afterindenttrue
  \ifdim \@tempskipa <\z@
    \@tempskipa -\@tempskipa \@afterindentfalse
  \fi
  \if@nobreak
    \everypar{}%
  \else
    \addpenalty\@secpenalty\addvspace\@tempskipa
  \fi
  \@ifstar
    {\@ssect{#3}{#4}{#5}{#6}}%
    {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}

The line

\@tempskipa #4\relax

is actually an assignment of the fourth argument in \@startsection to \@tempskipa, since the "assignment operator" = is optional. Subsequently

  \ifdim \@tempskipa <\z@
    \@tempskipa -\@tempskipa \@afterindentfalse
  \fi

\@tempskipa is checked against \z@ (which is the length 0pt). If \@tempskipa is less than 0pt (in other words, negative), it's changed to be positive via

    \@tempskipa -\@tempskipa

Remember, the assignment operator is optional, so the above statement changes \@tempskipa. Later on, \@tempskipa is added to the vertical space (if needed) via \addvspace.


Back to the fourth argument of \@startsection. See Where can I find help files or documentation for commands like \@startsection for LaTeX?. The fourth argument

\@startsection{<name>} % #1
  {<level>} % #2
  {<indent>} % #3
  {<beforeskip>} % #4
  {<afterskip>} % #5
  {<style>} % #6

denotes the <beforeskip> which is an "Absolute value = skip to leave above the heading. If negative, then paragraph indent of text following heading is suppressed." It should now make sense how \@tempskipa is used to condition on whether or not the skip value is negative, and then converted to positive again.

Werner
  • 603,163