ltpar.dtx

Johannes Braams  David Carlisle  Alan Jeffrey
Leslie Lamport  Frank Mittelbach  Tobias Oetiker ^{∗}
Chris Rowley  Rainer Schöpf

1995/04/29

1 Paragraphs

This section of the kernel declares the commands used to set \par and \everypar when ever their function needs to be changed for a long time.

1.1 Implementation

There are two situations in which \par may be changed:

• Long-term changes, in which the new value is to remain in effect until the current environment is left. The environments that change \par in this way are the following:

– All list environments (itemize, quote, etc.)

– Environments that turn \par into a noop: tabbing, array and tabular.

• Temporary changes, in which \par is restored to its previous value the next time it is executed. The following are all such uses.

– \end when preceded by \@endparenv, which is called by \endtrivlist – The mechanism for avoiding page breaks and getting the spacing right

after section heads.

\@setpar To permit the proper interaction of these two situations, long-term changes are made by the \@setpar{⟨VAL⟩} command. It’s function is:

To set \par. It \def’s \par and \@par to ⟨VAL⟩.

\@restorepar Short-term changes are made by the usual \def\par commands. The original

values are restored after a short-term change by the \@restorepar commands. \@@par \@@par always is defined to be the original TEX \par.

\everypar \everypar is changed only for the short term. Whenever \everypar is set non-null, it should restore itself to null when executed.

∗Tobi did the documentation update

The following commands change \everypar in this way:

• \item

• \end when preceded by \@endparenv, which is called by endtrivlist

• \minipage

When dealing with \par and \everypar remember the following two warnings:

1. Commands that make short-term changes to \par and \everypar must take account of the possibility that the new commands and the ones that do the restoration may be executed inside a group. In particular, \everypar is executed inside a group whenever a new paragraph begins with a left brace. The \everypar command that restores its definition should be local to the current group (in case the command is inside a minipage used inside someplace where \everypar has been redefined). Thus, if \everypar is redefined to do an \everypar{} it could take several executions of \everypar before the restoration “holds”. This usually causes no problem. However, to prevent the extra executions from doing harm, use a global switch to keep anything harmful in the new \everypar from being done twice.

2. Commands that change \everypar should remember that \everypar might be supposed to set the following switches false:

  • @nobreak
  • @minipage

they should do the setting if necessary.

1 ⟨∗2ekernel⟩

2 \message{par,}

\@setpar \@par Initiate a long-term change to \par.

3 \def\@setpar#1{\def\par{#1}\def\@par{#1}}

The default definition of \@par will ensure that if \@restorepar defines \par to execute \@par it will redefine itself to the primitive \@@par after one iteration.

4 \def\@par{\let\par\@@par\par}

5 ⟨/2ekernel⟩

\@restorepar Restore from a short-term change to \par.

6 \def\@restorepar{\def\par{\@par}}