summaryrefslogtreecommitdiff
path: root/macros/latex/base/ltpar.dtx
blob: 969954be0a7b520e3d436723d770f043b5a1e0e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
% \iffalse meta-comment
%
% Copyright (C) 1993-2021
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
%
% This file is part of the LaTeX base system.
% -------------------------------------------
%
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
%    https://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008 or later.
%
% This file has the LPPL maintenance status "maintained".
%
% The list of all files belonging to the LaTeX base distribution is
% given in the file `manifest.txt'. See also `legal.txt' for additional
% information.
%
% The list of derived (unpacked) files belonging to the distribution
% and covered by LPPL is defined by the unpacking scripts (with
% extension .ins) which are part of the distribution.
%
% \fi
%
% \iffalse
%%% From File: ltpar.dtx
%
%<*driver>
% \fi
\ProvidesFile{ltpar.dtx}
             [2021/04/13 v1.1c LaTeX Kernel (paragraphs)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltpar.dtx}
\title{\filename}
\date{\filedate}
 \author{%
  Johannes Braams\and
  David Carlisle\and
  Alan Jeffrey\and
  Leslie Lamport\and
  Frank Mittelbach\and
  Tobias Oetiker \thanks{Tobi did the documentation update}\and
  Chris Rowley\and
  Rainer Sch\"opf}
\begin{document}
 \MaintainedByLaTeXTeam{latex}
 \maketitle
 \DocInput{\filename}
\end{document}
%</driver>
% \fi
%
%
%
% \changes{v1.1a}{1994/05/16}{(ASAJ) Split from ltinit.dtx.}
% \changes{v1.1b}{1995/04/29}{(TO) Comments clean-up.}
%
% \section{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.
%
% This file here describes the interfaces that have been in the kernel
% forever, used to implement the scenarios described below. They
% remain valid but are now augmented in the next file
% (\texttt{ltpara.dtx}) to add hooks to paragraphs. At some point we
% will consolidate the two files further.
%
%
% There are two situations in which |\par| may be changed:
%
% \begin{itemize}
% \item 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:
%     \begin{itemize}
%         \item All list environments (itemize, quote, etc.)
%         \item Environments that turn |\par| into a noop:
%              tabbing, array and tabular.
%     \end{itemize}
%  \item  Temporary changes, in which |\par| is restored to its previous
%  value the next time it is executed. The following are all such uses.
%      \begin{itemize}
%        \item |\end| when preceded by |\@endparenv|, which is called by
%                 |\endtrivlist|
%        \item  The mechanism for avoiding page breaks and getting the
%           spacing right after section heads.
%       \end{itemize}
% \end{itemize}
%
%
% \StopEventually{}
%
% \subsection{Implementation}
%
%
% \DescribeMacro{\@setpar}
% To permit the proper interaction of these two situations, long-term
% changes are made by the |\@setpar{|\meta{VAL}|}| command.
% It's function is:
% \begin{quote}
%    To set |\par|. It |\def|'s |\par| and |\@par| to \meta{VAL}.
% \end{quote}
%
% \DescribeMacro{\@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.
%
% \DescribeMacro{\@@par}
% |\@@par| always is defined to be the original \TeX{} |\par|.
%
% \DescribeMacro{\everypar}
% |\everypar| is changed only for the short term.  Whenever |\everypar|
% is set non-null, it should restore itself to null when executed.
%
% The following commands change |\everypar| in this way:
% \begin{itemize}
%    \item |\item|
%    \item |\end| when preceded by |\@endparenv|, which is called by
%                 |endtrivlist|
%    \item |\minipage|
% \end{itemize}
%
% When dealing with |\par| and |\everypar| remember the following two
% warnings:
% \begin{enumerate}
%  \item 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.
%   \item Commands that change |\everypar| should remember that
%   |\everypar| might be supposed to set the following switches false:
%      \begin{itemize}
%        \item |@nobreak|
%        \item |@minipage|
%      \end{itemize}
%      they should do the setting if necessary.
%  \end{enumerate}
%    \begin{macrocode}
%<*2ekernel>
\message{par,}
%    \end{macrocode}
%
%
% \begin{macro}{\@setpar}
% \begin{macro}{\@par}
%    Initiate a long-term change to |\par|.
%    \begin{macrocode}
\def\@setpar#1{\def\par{#1}\def\@par{#1}}
%    \end{macrocode}
%
%    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.
%    \begin{macrocode}
\def\@par{\let\par\@@par\par}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@restorepar}
%    Restore from a short-term change to |\par|.
%    \begin{macrocode}
\def\@restorepar{\def\par{\@par}}
%</2ekernel>
%    \end{macrocode}
% \end{macro}
%
% \Finale
\endinput