| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% Copyright (C) 1993-2025 |
| 4 |
% The LaTeX Project and any individual authors listed elsewhere |
| 5 |
% in this file. |
| 6 |
% |
| 7 |
% This file is part of the LaTeX base system. |
| 8 |
% ------------------------------------------- |
| 9 |
% |
| 10 |
% It may be distributed and/or modified under the |
| 11 |
% conditions of the LaTeX Project Public License, either version 1.3c |
| 12 |
% of this license or (at your option) any later version. |
| 13 |
% The latest version of this license is in |
| 14 |
% https://www.latex-project.org/lppl.txt |
| 15 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 16 |
% version 2008 or later. |
| 17 |
% |
| 18 |
% This file has the LPPL maintenance status "maintained". |
| 19 |
% |
| 20 |
% The list of all files belonging to the LaTeX base distribution is |
| 21 |
% given in the file `manifest.txt'. See also `legal.txt' for additional |
| 22 |
% information. |
| 23 |
% |
| 24 |
% The list of derived (unpacked) files belonging to the distribution |
| 25 |
% and covered by LPPL is defined by the unpacking scripts (with |
| 26 |
% extension .ins) which are part of the distribution. |
| 27 |
% |
| 28 |
% \fi |
| 29 |
% |
| 30 |
% \iffalse |
| 31 |
%%% From File: ltspace.dtx |
| 32 |
%<*driver> |
| 33 |
% \fi |
| 34 |
\ProvidesFile{ltspace.dtx} |
| 35 |
[2025/06/05 v1.3s LaTeX Kernel (spacing)] |
| 36 |
% \iffalse |
| 37 |
\documentclass{ltxdoc} |
| 38 |
\GetFileInfo{ltspace.dtx} |
| 39 |
\title{\filename} |
| 40 |
\date{\filedate} |
| 41 |
\author{% |
| 42 |
Johannes Braams\and |
| 43 |
David Carlisle\and |
| 44 |
Alan Jeffrey\and |
| 45 |
Leslie Lamport\and |
| 46 |
Frank Mittelbach\and |
| 47 |
Chris Rowley\and |
| 48 |
Rainer Sch\"opf} |
| 49 |
\begin{document} |
| 50 |
\MaintainedByLaTeXTeam{latex} |
| 51 |
\maketitle |
| 52 |
\DocInput{\filename} |
| 53 |
\end{document} |
| 54 |
%</driver> |
| 55 |
% \fi |
| 56 |
% |
| 57 |
% |
| 58 |
% \changes{v1.1a}{1994/05/16}{(ASAJ) Split from ltinit.dtx.} |
| 59 |
% \changes{v1.2f}{1995/05/25}{Macros moved to ltlists.dtx} |
| 60 |
% \changes{v1.2n}{1996/04/22}{Documentation Improvements} |
| 61 |
% \changes{v1.2o}{1996/06/22}{Documentation of problems added} |
| 62 |
% \changes{v1.2q}{1996/07/27}{Further documentation of problems} |
| 63 |
% \changes{v1.2r}{1996/07/27}{Correct documentation of problems} |
| 64 |
% \changes{v1.2w}{1998/08/17}{Documentation fixes.} |
| 65 |
% \changes{v1.3j}{2019/08/27}{Make various commands robust} |
| 66 |
% \changes{v1.3l}{2020/03/07}{Moved \cs{thinspace}, \cs{negthinspace} |
| 67 |
% and \cs{,} to ltmath.dtx (gh/303)} |
| 68 |
% |
| 69 |
% |
| 70 |
% \section{Spacing} |
| 71 |
% |
| 72 |
% This section deals with spacing, and line- and page-breaking. |
| 73 |
% |
| 74 |
% \subsection{User Commands} |
| 75 |
% |
| 76 |
% \DescribeMacro\nopagebreak\oarg{i} : \meta{i} = 0,...,4. |
| 77 |
% |
| 78 |
% Default argument = 4. Puts a penalty into the vertical list |
| 79 |
% output as follows:\\ |
| 80 |
% 0 : penalty = 0\\ |
| 81 |
% 1 : penalty = |\@lowpenalty|\\ |
| 82 |
% 2 : penalty = |\@medpenalty|\\ |
| 83 |
% 3 : penalty = |\@highpenalty|\\ |
| 84 |
% 4 : penalty = 10000 |
| 85 |
% |
| 86 |
% \DescribeMacro\pagebreak\oarg{i} : |
| 87 |
% same as \nopagebreak except negatives of its penalty |
| 88 |
% |
| 89 |
% \DescribeMacro\linebreak\oarg{i} : analog of the above |
| 90 |
% |
| 91 |
% \DescribeMacro\nolinebreak\oarg{i} : analog of the above |
| 92 |
% |
| 93 |
% \DescribeMacro\samepage : |
| 94 |
% inhibits page breaking most places by setting the |
| 95 |
% following penalties to 10000:\\ |
| 96 |
% |\interlinepenalty|\\ |
| 97 |
% |\predisplaypenalty|\\ |
| 98 |
% |\postdisplaypenalty|\\ |
| 99 |
% |\interdisplaylinepenalty|\\ |
| 100 |
% |\@beginparpenalty|\\ |
| 101 |
% |\@endparpenalty|\\ |
| 102 |
% |\@itempenalty|\\ |
| 103 |
% |\@secpenalty|\\ |
| 104 |
% |\interfootnotelinepenalty| |
| 105 |
% |
| 106 |
% \DescribeMacro{\\} : initially defined to be |\newline| |
| 107 |
% |
| 108 |
% |\\|\oarg{length} : initially defined to be |
| 109 |
% |\vspace|\marg{length}|\newline|\\ |
| 110 |
% Note: |\\*| adds a |\vadjust{\penalty 10000}| |
| 111 |
% |
| 112 |
% OBSOLETE COMMANDS (which never made it into the manual): |
| 113 |
% |
| 114 |
% |\obeycr| : defines <CR> == |\\\relax|\\ |
| 115 |
% |\restorecr| : restores <CR> to its usual meaning. |
| 116 |
% |
| 117 |
% |
| 118 |
% \MaybeStop{} |
| 119 |
% |
| 120 |
% \subsection{Chris' comments} |
| 121 |
% |
| 122 |
% There are several aspects of the handling of space in horizontal |
| 123 |
% mode that are inconsistent or do not work well in some cases. |
| 124 |
% These are largely concerned with ignoring the effect of space |
| 125 |
% tokens that would otherwise typeset an inter-word space. |
| 126 |
% |
| 127 |
% Negating the effect of such space tokens is achieved by two |
| 128 |
% mechanisms: |
| 129 |
% \begin{itemize} |
| 130 |
% \item |\unskip| is used to remove the glue just added by |
| 131 |
% a space that has already had its effect; it is sometimes |
| 132 |
% invoked after an |\ifdim| test on |\lastskip| (see below); |
| 133 |
% \item |\ignorespaces| is used to ignore space-tokens yet to come. |
| 134 |
% \end{itemize} |
| 135 |
% |
| 136 |
% The test done on |\lastskip| is sometimes for equality with zero and |
| 137 |
% sometimes for being positive. Recall also that the test is only on |
| 138 |
% the natural length of the glue and that no glue cannot be |
| 139 |
% distinguished from glue whose natural length is zero: to summarise, |
| 140 |
% a pretty awful test. It is not clear why these tests are not all |
| 141 |
% the same; I think that they should all be for equality. One place |
| 142 |
% where |\unskip| is often used is just before a |\par| (which itself |
| 143 |
% internally does an |\unskip|) and one bit of code (in |\@item|) even |
| 144 |
% has two |\unskips| before a |\par|. These uses may be fossil code |
| 145 |
% but if they are necessary, maybe |\@killglue| would be even safer. |
| 146 |
% |
| 147 |
% Such removal of glue by |\unskip| may sometimes have the wrong result, |
| 148 |
% removing not the glue from a space-token but other explicit glue; |
| 149 |
% this is sometimes not what is intended. |
| 150 |
% |
| 151 |
% A common way to prevent such removal is to add an |\hskip\z@| after |
| 152 |
% the glue that should not be removed. This protects that glue |
| 153 |
% against one |\unskip| with no test but not against more than one. |
| 154 |
% It does work for `tested |\unskip|s'. This is used |
| 155 |
% by |\hspace*| but not by |\hspace|; this is inconsistent as the star |
| 156 |
% is supposed to prevent removal only at the beginning of a line, not |
| 157 |
% at the end, or in a tabular, etc. |
| 158 |
% |
| 159 |
% If this reason for removing glue were the only consideration then a |
| 160 |
% tested-|\unskip| and protection by |\hskip\z@| would suffice but |
| 161 |
% would need to be consistently implemented. |
| 162 |
% |
| 163 |
% However, the class of invisibles, commands and environments tries to |
| 164 |
% be even cleverer: one of these tries to leave only one inter-word |
| 165 |
% space whenever there is one before it and one after it; and it does |
| 166 |
% this quite well. |
| 167 |
% |
| 168 |
% But problems can arise when there is not a space-token on |
| 169 |
% both sides of it; in particular, when an invisible appears at the |
| 170 |
% beginning or end of a piece of text the method still leaves one space |
| 171 |
% token whereas usually in these cases it should leave none. |
| 172 |
% |
| 173 |
% Also, the current rules do not work well when more than one such |
| 174 |
% command appears consecutively, separated by space-tokens; it leaves |
| 175 |
% glue between every other invisible. |
| 176 |
% |
| 177 |
% There is also a question about what these commands should do when |
| 178 |
% they occur next to spaces that do not come from space tokens but, |
| 179 |
% for example, from |\hspace|. Should they still produce `just one |
| 180 |
% space'? If so, which one? It is good to note that the manual |
| 181 |
% is sufficiently cautious about invisibles that we are not obliged to |
| 182 |
% make anything work. |
| 183 |
% |
| 184 |
% Another interesting side-road to explore is whether the space-tokens |
| 185 |
% either side of an |\hspace{...}| should be ignored. |
| 186 |
% |
| 187 |
% One alternative to the current algorithm that is often suggested is |
| 188 |
% that all glue around the invisible should be consolidated into a |
| 189 |
% space after it (usually without stating how much glue should be put |
| 190 |
% there). The command |\nolinebreak| is implemented this way (and |
| 191 |
% |\linebreak| should also be). This does not work correctly for the |
| 192 |
% following common case: |
| 193 |
% \begin{verbatim} |
| 194 |
% ... some text |
| 195 |
% \index{some-word} |
| 196 |
% some-word and more text. |
| 197 |
% \end{verbatim} |
| 198 |
% This is optimal coding since it is normal to index a word that gets |
| 199 |
% split across a page-break on its starting page. This would, on the |
| 200 |
% other hand, fix another common (and documented) failure of the |
| 201 |
% current system: when the invisible is the last thing in a paragraph |
| 202 |
% the space before it is not removed and, worse, it is also hidden |
| 203 |
% from the paragraph-ending mechanism so that an `empty' line can be |
| 204 |
% created at the end of the paragraph. |
| 205 |
% |
| 206 |
% Another deficiency (I think) of the current system is that the |
| 207 |
% following is treated as having the |\index| command between the |
| 208 |
% paragraphs, which is probably not what the author intended (since |
| 209 |
% there is no empty line after it). |
| 210 |
% \begin{verbatim} |
| 211 |
% |
| 212 |
% \index{beginnings} |
| 213 |
% Beginnings of paragraphs ... |
| 214 |
% \end{verbatim} |
| 215 |
% |
| 216 |
% I know of no algorithm that will handle satisfactorily even |
| 217 |
% all the most common cases; note that it could be that the best |
| 218 |
% algorithm may be different for different invisibles since, |
| 219 |
% for example, the common uses and expected behaviour of |
| 220 |
% |\index|, |\marginpar|, |\linebreak|, |\pagebreak| and |
| 221 |
% |\vspace| are somewhat different. [For example, is |
| 222 |
% |\vspace| ever used in the middle of a paragraph?] |
| 223 |
% |
| 224 |
% One method that can (and is) used to make invisible commands produce |
| 225 |
% no space when used at the beginning of text is to put in some glue |
| 226 |
% that is nearly enough the same as no glue or glue of zero length in |
| 227 |
% all respects except for the precise test for not being exactly equal |
| 228 |
% to zero; examples of such glue are |\hskip 1sp| and, possibly better |
| 229 |
% but more complex, |\hskip -1sp \hskip 1sp|. However, this only works |
| 230 |
% when it is known that user-supplied text is about to start. |
| 231 |
% |
| 232 |
% Some similar concerns apply to the handling of space and penalties |
| 233 |
% in vertical mode; there is an extra hurdle here as |\unskip| does |
| 234 |
% not work on the main vertical list. The complexity of the tests done |
| 235 |
% by |\addvspace| have never been explained. |
| 236 |
% |
| 237 |
% The implementation of space hacks etc for vertical mode is another |
| 238 |
% major area that needs further attention; my earlier experiments |
| 239 |
% did not produce much improvement over the current unsatisfactory |
| 240 |
% situation. |
| 241 |
% |
| 242 |
% One particular problem is what happens when the following very |
| 243 |
% natural coding is used (part of the problem here is that this looks |
| 244 |
% like an hmode problem, but it is not): |
| 245 |
% \begin{verbatim} |
| 246 |
% ... end of text. |
| 247 |
% |
| 248 |
% \begin{enumerate} |
| 249 |
% \item \label{item:xxx} Item text. |
| 250 |
% \end{enumerate} |
| 251 |
% \end{verbatim} |
| 252 |
% |
| 253 |
% \subsection{Some immediate actions} |
| 254 |
% |
| 255 |
% \begin{itemize} |
| 256 |
% \item Fix bug in |\linebreak|. |
| 257 |
% \item Fix bug in |\\*|. |
| 258 |
% \item Reimplement |\\|, etc, removing extra |\vadjust|s and getting |
| 259 |
% better error trapping (this seems to involve a lot more tokens). |
| 260 |
% \item Investigate whether |\\|, etc need to be errors in vmode; I |
| 261 |
% think that they could be noops (maybe with a warning). |
| 262 |
% \item Make all(?) |\unskips| include test for zero skip (rather than |
| 263 |
% other tests or no test). |
| 264 |
% \item Consider replacing |\hskip 1sp| by something better (here |
| 265 |
% called an `infinitesimal' skip). |
| 266 |
% \item Look at all |\hskip\z@| (or similar) to see if they should be |
| 267 |
% changed to an `infinitesimal' skip. |
| 268 |
% \item Resolve the inconsistency between |\hspace| and |\hspace*|. |
| 269 |
% \item Remove unnecessary |\unskips|. |
| 270 |
% \item Investigate and rationalise the `newline' code. |
| 271 |
% \item Find better algorithms for all sorts of things or, easier(?), |
| 272 |
% fix \TeX{} itself. |
| 273 |
% \end{itemize} |
| 274 |
% |
| 275 |
% \subsection{The code} |
| 276 |
% |
| 277 |
% \begin{macrocode} |
| 278 |
%<*2ekernel> |
| 279 |
\message{spacing,} |
| 280 |
% \end{macrocode} |
| 281 |
% |
| 282 |
% \begin{macrocode} |
| 283 |
%</2ekernel> |
| 284 |
%<*2ekernel|latexrelease> |
| 285 |
%<latexrelease>\IncludeInRelease{2019/10/01}% |
| 286 |
%<latexrelease> {\pagebreak}{Make commands robust}% |
| 287 |
% \end{macrocode} |
| 288 |
% |
| 289 |
% \begin{macro}{\pagebreak} |
| 290 |
% \begin{macro}{\nopagebreak} |
| 291 |
% \changes{v1.2h}{1995/07/05}{Reimplemented both using \cs{@no@pgbk}} |
| 292 |
% \changes{v1.2j}{1995/10/16}{(DPC) Use \cs{@testopt} /1911} |
| 293 |
% \begin{macrocode} |
| 294 |
\DeclareRobustCommand\pagebreak{\@testopt{\@no@pgbk-}4} |
| 295 |
\DeclareRobustCommand\nopagebreak{\@testopt\@no@pgbk4} |
| 296 |
% \end{macrocode} |
| 297 |
% \end{macro} |
| 298 |
% \end{macro} |
| 299 |
% |
| 300 |
% \begin{macro}{\linebreak} |
| 301 |
% \begin{macro}{\nolinebreak} |
| 302 |
% \changes{v1.2u}{1996/10/29}{Reimplemented both using \cs{@no@lnbk}} |
| 303 |
% \changes{v1.2j}{1995/10/16}{(DPC) Use \cs{@testopt} /1911} |
| 304 |
% \begin{macrocode} |
| 305 |
\DeclareRobustCommand\linebreak{\@testopt{\@no@lnbk-}4} |
| 306 |
\DeclareRobustCommand\nolinebreak{\@testopt\@no@lnbk4} |
| 307 |
% \end{macrocode} |
| 308 |
% \end{macro} |
| 309 |
% \end{macro} |
| 310 |
% |
| 311 |
% \begin{macro}{\samepage} |
| 312 |
% \changes{v1.3p}{2023/03/22}{Add \cs{predisplaypenalty} setting (gh/1022)} |
| 313 |
% \begin{macrocode} |
| 314 |
\DeclareRobustCommand\samepage{\interlinepenalty\@M |
| 315 |
\predisplaypenalty\@M |
| 316 |
\postdisplaypenalty\@M |
| 317 |
\interdisplaylinepenalty\@M |
| 318 |
\@beginparpenalty\@M |
| 319 |
\@endparpenalty\@M |
| 320 |
\@itempenalty\@M |
| 321 |
\@secpenalty\@M |
| 322 |
\interfootnotelinepenalty\@M} |
| 323 |
% \end{macrocode} |
| 324 |
% \end{macro} |
| 325 |
% |
| 326 |
% \begin{macrocode} |
| 327 |
%</2ekernel|latexrelease> |
| 328 |
%<latexrelease>\EndIncludeInRelease |
| 329 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 330 |
%<latexrelease> {\pagebreak}{Make commands robust}% |
| 331 |
%<latexrelease> |
| 332 |
%<latexrelease>\kernel@make@fragile\pagebreak |
| 333 |
%<latexrelease>\kernel@make@fragile\nopagebreak |
| 334 |
%<latexrelease>\kernel@make@fragile\linebreak |
| 335 |
%<latexrelease>\kernel@make@fragile\nolinebreak |
| 336 |
%<latexrelease>\kernel@make@fragile\samepage |
| 337 |
%<latexrelease> |
| 338 |
%<latexrelease>\EndIncludeInRelease |
| 339 |
%<*2ekernel> |
| 340 |
% \end{macrocode} |
| 341 |
% |
| 342 |
% |
| 343 |
% |
| 344 |
% \begin{macro}{\@no@pgbk} |
| 345 |
% \changes{v1.2h}{1995/07/05}{Macro replaces \cs{@pgbk} |
| 346 |
% and \cs{@nopgbk}} |
| 347 |
% \begin{macrocode} |
| 348 |
\def\@no@pgbk #1[#2]{% |
| 349 |
\ifvmode |
| 350 |
\penalty #1\@getpen{#2}% |
| 351 |
\else |
| 352 |
\@bsphack |
| 353 |
\vadjust{\penalty #1\@getpen{#2}}% |
| 354 |
\@esphack |
| 355 |
\fi} |
| 356 |
% \end{macrocode} |
| 357 |
% \end{macro} |
| 358 |
% |
| 359 |
% |
| 360 |
% \begin{macro}{\@no@lnbk} |
| 361 |
% \changes{v1.2u}{1996/10/29}{Macro replaces \cs{@lnbk} |
| 362 |
% and \cs{@nolnbk}} |
| 363 |
% \begin{macrocode} |
| 364 |
\def\@no@lnbk #1[#2]{% |
| 365 |
\ifvmode |
| 366 |
\@nolnerr |
| 367 |
\else |
| 368 |
\@tempskipa\lastskip |
| 369 |
\unskip |
| 370 |
\penalty #1\@getpen{#2}% |
| 371 |
\ifdim\@tempskipa>\z@ |
| 372 |
\hskip\@tempskipa |
| 373 |
\ignorespaces |
| 374 |
\fi |
| 375 |
\fi} |
| 376 |
% \end{macrocode} |
| 377 |
% \end{macro} |
| 378 |
% |
| 379 |
% |
| 380 |
% \begin{macro}{\\} |
| 381 |
% \changes{v1.2a}{1994/11/11}{(DPC) Make robust} |
| 382 |
% \changes{v1.2d}{1994/11/14}{(DPC) Macro modified} |
| 383 |
% |
| 384 |
% \changes{v1.2u}{1996/10/29}{Corrected and rationalised code} |
| 385 |
% The purpose of the new code is to fix a few bugs; however, it also |
| 386 |
% attempts to optimize the following, in order of priority: |
| 387 |
% \begin{enumerate} |
| 388 |
% \item efficient execution of plain |\\|; |
| 389 |
% \item efficient execution of |\\[...]|; |
| 390 |
% \item memory use; |
| 391 |
% \item name-space use. |
| 392 |
% \end{enumerate} |
| 393 |
% The changes should make no difference to the typeset output. |
| 394 |
% It appears to be safe to use |\reserved@e| and |\reserved@f| here |
| 395 |
% (other reserved macros are somewhat disastrous). |
| 396 |
% |
| 397 |
% These changes made |\newline| even less robust than it had been, |
| 398 |
% so now it is explicitly robust, like |\\|. |
| 399 |
% \begin{macro}{\@normalcr} |
| 400 |
% The internal definition of the `normal' definition of |\\|. |
| 401 |
% \changes{v1.3k}{2019/11/02}{Make also \cs{@normalcr} robust} |
| 402 |
% \begin{macrocode} |
| 403 |
%</2ekernel> |
| 404 |
%<*2ekernel|latexrelease> |
| 405 |
%<latexrelease>\IncludeInRelease{2020/02/02}% |
| 406 |
%<latexrelease> {\@normalcr}{Make robust}% |
| 407 |
\protected\def\@normalcr{% |
| 408 |
\let \reserved@e \relax |
| 409 |
\let \reserved@f \relax |
| 410 |
\@ifstar{\let \reserved@e \vadjust \let \reserved@f \nobreak |
| 411 |
\@xnewline}% |
| 412 |
\@xnewline} |
| 413 |
% \end{macrocode} |
| 414 |
% |
| 415 |
% \begin{macrocode} |
| 416 |
\let\\\@normalcr |
| 417 |
%</2ekernel|latexrelease> |
| 418 |
%<latexrelease>\EndIncludeInRelease |
| 419 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 420 |
%<latexrelease> {\@normalcr}{Make robust}% |
| 421 |
%<latexrelease> |
| 422 |
%<latexrelease>\DeclareRobustCommand\\{% |
| 423 |
%<latexrelease> \let \reserved@e \relax |
| 424 |
%<latexrelease> \let \reserved@f \relax |
| 425 |
%<latexrelease> \@ifstar{\let \reserved@e \vadjust \let \reserved@f \nobreak |
| 426 |
%<latexrelease> \@xnewline}% |
| 427 |
%<latexrelease> \@xnewline} |
| 428 |
%<latexrelease>\expandafter\let\expandafter\@normalcr |
| 429 |
%<latexrelease> \csname\expandafter\@gobble\string\\ \endcsname |
| 430 |
%<latexrelease> |
| 431 |
%<latexrelease>\EndIncludeInRelease |
| 432 |
%<*2ekernel> |
| 433 |
% \end{macrocode} |
| 434 |
% \end{macro} |
| 435 |
% \end{macro} |
| 436 |
% |
| 437 |
% |
| 438 |
% |
| 439 |
% \begin{macro}{\@vspace@calcify} |
| 440 |
% Helper command to produce a \cs{vskip} that is first run through |
| 441 |
% \cs{setlength}. This way the \texttt{calc} package can operate on |
| 442 |
% the argument value. |
| 443 |
% \changes{v1.3m}{2020/04/21}{Support calc syntax (gh/152)} |
| 444 |
% \changes{v1.3o}{2022/11/28}{Support calc syntax without a group (gh/967)} |
| 445 |
% \begin{macrocode} |
| 446 |
%</2ekernel> |
| 447 |
%<*2ekernel|latexrelease> |
| 448 |
%<latexrelease>\IncludeInRelease{2020/10/01}% |
| 449 |
%<latexrelease> {\@vspace@calcify}{Add calc support}% |
| 450 |
\def\@vspace@calcify#1{\setlength\sp@ce@skip{#1}\vskip\sp@ce@skip} |
| 451 |
%</2ekernel|latexrelease> |
| 452 |
%<latexrelease>\EndIncludeInRelease |
| 453 |
% \end{macrocode} |
| 454 |
% |
| 455 |
% \begin{macrocode} |
| 456 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 457 |
%<latexrelease> {\@vspace@calcify}{Add calc support}% |
| 458 |
%<latexrelease> |
| 459 |
%<latexrelease>\let\@vspace@calcify\@undefined |
| 460 |
%<latexrelease>\EndIncludeInRelease |
| 461 |
%<*2ekernel> |
| 462 |
% \end{macrocode} |
| 463 |
% \end{macro} |
| 464 |
% |
| 465 |
% |
| 466 |
|
| 467 |
|
| 468 |
% \begin{macro}{\newline} |
| 469 |
% A simple form of the `normal' definition of |\\|. |
| 470 |
% \changes{v1.2v}{1997/05/07}{Made completely robust.} |
| 471 |
% \begin{macrocode} |
| 472 |
\DeclareRobustCommand\newline{\@normalcr\relax} |
| 473 |
% \end{macrocode} |
| 474 |
% \end{macro} |
| 475 |
% |
| 476 |
% \begin{macro}{\@xnewline} |
| 477 |
% \begin{macrocode} |
| 478 |
\def\@xnewline{\@ifnextchar[% ] bracket matching |
| 479 |
\@newline |
| 480 |
{\@gnewline\relax}} |
| 481 |
% \end{macrocode} |
| 482 |
% \end{macro} |
| 483 |
% |
| 484 |
% \begin{macro}{\@newline} |
| 485 |
% \changes{v1.3m}{2020/04/21}{Support calc syntax (gh/152)} |
| 486 |
% \begin{macrocode} |
| 487 |
%</2ekernel> |
| 488 |
%<*2ekernel|latexrelease> |
| 489 |
%<latexrelease>\IncludeInRelease{2020/10/01}% |
| 490 |
%<latexrelease> {\@newline}{\newline calc support}% |
| 491 |
\def\@newline[#1]{\let \reserved@e \vadjust |
| 492 |
\@gnewline {\@vspace@calcify{#1}}} |
| 493 |
%</2ekernel|latexrelease> |
| 494 |
%<latexrelease>\EndIncludeInRelease |
| 495 |
% \end{macrocode} |
| 496 |
% |
| 497 |
% \begin{macrocode} |
| 498 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 499 |
%<latexrelease> {\@newline}{\newline calc support}% |
| 500 |
%<latexrelease> |
| 501 |
%<latexrelease>\def\@newline[#1]{\let \reserved@e \vadjust |
| 502 |
%<latexrelease> \@gnewline {\vskip #1}} |
| 503 |
%<latexrelease>\EndIncludeInRelease |
| 504 |
%<*2ekernel> |
| 505 |
% \end{macrocode} |
| 506 |
% \end{macro} |
| 507 |
% |
| 508 |
% |
| 509 |
% |
| 510 |
% \begin{macro}{\@gnewline} |
| 511 |
% \changes{v1.2u}{1996/10/29}{Added macro} |
| 512 |
% The |\nobreak| added to prevent null lines when |\\| |
| 513 |
% ends an overfull line. Change made 24 May 89 as suggested by |
| 514 |
% Frank Mittelbach and Rainer Sch\"opf |
| 515 |
% \changes{v1.2h}{1995/07/05}{Use \cs{break}} |
| 516 |
% \begin{macrocode} |
| 517 |
\def\@gnewline #1{% |
| 518 |
\ifvmode |
| 519 |
\@nolnerr |
| 520 |
\else |
| 521 |
\unskip \reserved@e {\reserved@f#1}\nobreak \hfil \break |
| 522 |
\fi} |
| 523 |
% \end{macrocode} |
| 524 |
% \end{macro} |
| 525 |
% |
| 526 |
% |
| 527 |
% \begin{macro}{\@getpen} |
| 528 |
% \begin{macrocode} |
| 529 |
\def\@getpen#1{\ifcase #1 \z@ \or \@lowpenalty\or |
| 530 |
\@medpenalty \or \@highpenalty |
| 531 |
\else \@M \fi} |
| 532 |
% \end{macrocode} |
| 533 |
% \end{macro} |
| 534 |
% |
| 535 |
% |
| 536 |
% \begin{macro}{\if@nobreak} |
| 537 |
% \changes{v1.2p}{1996/07/26}{put \cs{global} inside definition} |
| 538 |
% Switch used to avoid page breaks caused by |\label| after a |
| 539 |
% section heading, etc. It should be \textbf{GLOBALLY} set true |
| 540 |
% after the |\nobreak| and \textbf{globally} set false by the |
| 541 |
% next invocation of |\everypar|. |
| 542 |
% |
| 543 |
% Commands that reset |\everypar| should globally set it false if |
| 544 |
% appropriate. |
| 545 |
% \begin{macrocode} |
| 546 |
\def\@nobreakfalse{\global\let\if@nobreak\iffalse} |
| 547 |
\def\@nobreaktrue {\global\let\if@nobreak\iftrue} |
| 548 |
\@nobreakfalse |
| 549 |
% \end{macrocode} |
| 550 |
% \end{macro} |
| 551 |
% |
| 552 |
% |
| 553 |
% |
| 554 |
% \begin{macro}{\@savsk} |
| 555 |
% \begin{macro}{\@savsf} |
| 556 |
% Registers used to save the space factor and last skip. |
| 557 |
% \begin{macrocode} |
| 558 |
\newdimen\@savsk |
| 559 |
\newcount\@savsf |
| 560 |
% \end{macrocode} |
| 561 |
% \end{macro} |
| 562 |
% \end{macro} |
| 563 |
% |
| 564 |
% |
| 565 |
% |
| 566 |
% |
| 567 |
% \begin{macro}{\@bsphack} |
| 568 |
% \changes{LaTeX2e}{1993/12/08} |
| 569 |
% {Command reimplemented; late birthday present for Chris} |
| 570 |
% \changes{LaTeX2e}{1993/12/08}{Command reimplemented} |
| 571 |
% \changes{LaTeX2e}{1993/12/16}{Corrected optimisation} |
| 572 |
% |\@bsphack| and |\@esphack| |
| 573 |
% used by macros such as |\index| and |
| 574 |
% |\begin{@float}| \ldots |\end{@float}| |
| 575 |
% that want to be invisible --- i.e., |
| 576 |
% not leave any extra space when used in the middle of text. Such |
| 577 |
% a macro should begin with |\@bsphack| and end with |\@esphack|. |
| 578 |
% The macro in question should not create any text, nor change the |
| 579 |
% mode. |
| 580 |
% |
| 581 |
% Before giving the current definition we give an extended definition |
| 582 |
% that is currently not used (because it doesn't work as advertised:-) |
| 583 |
% |
| 584 |
% These are generalised hacks which attempt to do sensible things |
| 585 |
% when `invisible commands' appear in vmode too. |
| 586 |
% |
| 587 |
% They need to cope with space in both hmode (plus spacefactor) and |
| 588 |
% vmode, and also cope with breaks etc. In vmode this means |
| 589 |
% ensuring that any following |\addvspace|, etc sees the correct |
| 590 |
% glue in |\lastskip|. |
| 591 |
% |
| 592 |
% In fact, these improved versions should be used for other cases |
| 593 |
% of `whatsits, thingies etc' which should be invisible. They are |
| 594 |
% only for commands, not environments (see notes on |\@Esphack|). |
| 595 |
% |
| 596 |
% BTW, anyone know why the standard hacks are surrounded by |
| 597 |
% |\ifmmode\else| rather than simply |\ifhmode|? |
| 598 |
% |
| 599 |
% And are there any cases where saving the spacefactor is |
| 600 |
% essential? I have some extensions where it is, but it does not |
| 601 |
% appear to be so in the standard uses. |
| 602 |
%\begin{verbatim} |
| 603 |
%\def \@bsphack{% |
| 604 |
% \relax \ifvmode |
| 605 |
% \@savsk \lastskip |
| 606 |
% \ifdim \lastskip=\z@ |
| 607 |
% \else |
| 608 |
% \vskip -\lastskip |
| 609 |
% \fi |
| 610 |
% \else |
| 611 |
% \ifhmode |
| 612 |
% \@savsk \lastskip |
| 613 |
% \@savsf \spacefactor |
| 614 |
% \fi |
| 615 |
% \fi |
| 616 |
%} |
| 617 |
%\end{verbatim} |
| 618 |
% I think that, in vmode, it is the safest to put |
| 619 |
% in a |\nobreak| immediately after such things since writes, |
| 620 |
% inserts etc followed by glue give valid breakpoints and, in |
| 621 |
% general, it is possible to create breaks but impossible to |
| 622 |
% destroy them. |
| 623 |
%\begin{verbatim} |
| 624 |
%\def \@esphack{% |
| 625 |
% \relax \ifvmode |
| 626 |
% \nobreak |
| 627 |
% \ifdim \@savsk=\z@ |
| 628 |
% \else |
| 629 |
% \vskip\@savsk |
| 630 |
% \fi |
| 631 |
% \else |
| 632 |
% \ifhmode |
| 633 |
% \spacefactor \@savsf |
| 634 |
% \ifdim \@savsk>\z@ |
| 635 |
% \ignorespaces |
| 636 |
% \fi |
| 637 |
% \fi |
| 638 |
% \fi |
| 639 |
%} |
| 640 |
%\end{verbatim} |
| 641 |
% For the moment we are going to ignore the vertical versions until |
| 642 |
% they are correct. |
| 643 |
% \changes{LaTeX2e}{1993/12/19}{There seem to be problems with selfmade |
| 644 |
% birthday presents} |
| 645 |
% \begin{macrocode} |
| 646 |
\def\@bsphack{% |
| 647 |
\relax |
| 648 |
\ifhmode |
| 649 |
\@savsk\lastskip |
| 650 |
\@savsf\spacefactor |
| 651 |
\fi} |
| 652 |
% \end{macrocode} |
| 653 |
% \end{macro} |
| 654 |
% |
| 655 |
% \begin{macro}{\@esphack} |
| 656 |
% Companion to |\@bsphack|. If this command is not properly paired |
| 657 |
% with |\@bsphack| one might end up with a low-level \TeX{} error: |
| 658 |
% ``BAD spacefactor''. One possible cause is calling |\@bsphack| in |
| 659 |
% vertical mode, then doing something that gets you (sometimes) into |
| 660 |
% horizontal mode and finally calling |\@esphack|. Even if no error |
| 661 |
% is generated that is wrong, because |\@esphack| will then use the |
| 662 |
% saved values for |\@savsk| and |\@savsf| from some earlier |
| 663 |
% invocation of |\@bsphack| which will have nothing to do with the |
| 664 |
% current situation. |
| 665 |
% \changes{v1.3d}{2015/01/11}{Allow hyphenation (Donald Arseneau pr/3498) (latexrelease)} |
| 666 |
% \begin{macrocode} |
| 667 |
%</2ekernel> |
| 668 |
%<latexrelease>\IncludeInRelease{2018/10/10}% |
| 669 |
%<latexrelease> {\@esphack}{hyphenation and nobreak after space hack}% |
| 670 |
%<*2ekernel|latexrelease> |
| 671 |
\def\@esphack{% |
| 672 |
\relax |
| 673 |
\ifhmode |
| 674 |
\spacefactor\@savsf |
| 675 |
\ifdim\@savsk>\z@ |
| 676 |
% \end{macrocode} |
| 677 |
% \changes{v1.3f}{2015/11/07} |
| 678 |
% {Only space if there is no space at the end of the hlist latex/4443} |
| 679 |
% \begin{macrocode} |
| 680 |
\ifdim\lastskip=\z@ |
| 681 |
\nobreak \hskip\z@skip |
| 682 |
\fi |
| 683 |
\ignorespaces |
| 684 |
\fi |
| 685 |
% \end{macrocode} |
| 686 |
% \changes{v1.3i}{2018/10/10} |
| 687 |
% {Don't introduce breakpoints if @nobreak is true and after sections} |
| 688 |
% \begin{macrocode} |
| 689 |
\else |
| 690 |
\ifvmode |
| 691 |
\if@nobreak\nobreak\else\if@noskipsec\nobreak\fi\fi |
| 692 |
\fi |
| 693 |
% \end{macrocode} |
| 694 |
% |
| 695 |
% \begin{macrocode} |
| 696 |
\fi}% |
| 697 |
%</2ekernel|latexrelease> |
| 698 |
%<latexrelease>\EndIncludeInRelease |
| 699 |
%<latexrelease>\IncludeInRelease{2015/10/01}% |
| 700 |
%<latexrelease> {\@esphack}{hyphenation and nobreak after space hack}% |
| 701 |
%<latexrelease>\def\@esphack{% |
| 702 |
%<latexrelease> \relax |
| 703 |
%<latexrelease> \ifhmode |
| 704 |
%<latexrelease> \spacefactor\@savsf |
| 705 |
%<latexrelease> \ifdim\@savsk>\z@ |
| 706 |
%<latexrelease> \ifdim\lastskip=\z@ |
| 707 |
%<latexrelease> \nobreak \hskip\z@skip |
| 708 |
%<latexrelease> \fi |
| 709 |
%<latexrelease> \ignorespaces |
| 710 |
%<latexrelease> \fi |
| 711 |
%<latexrelease> \fi}% |
| 712 |
%<latexrelease>\EndIncludeInRelease |
| 713 |
%<latexrelease>\IncludeInRelease{2015/01/01}% |
| 714 |
%<latexrelease> {\@esphack}{hyphenation and nobreak after space hack}% |
| 715 |
%<latexrelease>\def\@esphack{% |
| 716 |
%<latexrelease> \relax |
| 717 |
%<latexrelease> \ifhmode |
| 718 |
%<latexrelease> \spacefactor\@savsf |
| 719 |
%<latexrelease> \ifdim\@savsk>\z@ |
| 720 |
%<latexrelease> \nobreak \hskip\z@skip |
| 721 |
%<latexrelease> \ignorespaces |
| 722 |
%<latexrelease> \fi |
| 723 |
%<latexrelease> \fi}% |
| 724 |
%<latexrelease>\EndIncludeInRelease |
| 725 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 726 |
%<latexrelease> {\@esphack}{hyphenation and nobreak after space hack}% |
| 727 |
%<latexrelease>\def\@esphack{% |
| 728 |
%<latexrelease> \relax |
| 729 |
%<latexrelease> \ifhmode |
| 730 |
%<latexrelease> \spacefactor\@savsf |
| 731 |
%<latexrelease> \ifdim\@savsk>\z@ |
| 732 |
%<latexrelease> \ignorespaces |
| 733 |
%<latexrelease> \fi |
| 734 |
%<latexrelease> \fi}% |
| 735 |
%<latexrelease>\EndIncludeInRelease |
| 736 |
%<*2ekernel> |
| 737 |
% \end{macrocode} |
| 738 |
% \end{macro} |
| 739 |
% |
| 740 |
% \begin{macro}{\@Esphack} |
| 741 |
% A variant of |\@esphack| that sets the |@ignore| switch to |
| 742 |
% true (as |\@esphack| used to do previously). |
| 743 |
% This is currently used only for floats and similar environments. |
| 744 |
% \changes{v1.2s}{1996/08/02}{Remove \cs{global} before \cs{@ignore...}} |
| 745 |
% \changes{v1.3d}{2015/01/11}{Allow hyphenation (Donald Arseneau pr/3498) (latexrelease)} |
| 746 |
% \begin{macrocode} |
| 747 |
%</2ekernel> |
| 748 |
%<latexrelease>\IncludeInRelease{2015/01/01}% |
| 749 |
%<latexrelease> {\@Esphack}{hyphenation after space hack}% |
| 750 |
%<*2ekernel|latexrelease> |
| 751 |
\def\@Esphack{% |
| 752 |
\relax |
| 753 |
\ifhmode |
| 754 |
\spacefactor\@savsf |
| 755 |
\ifdim\@savsk>\z@ |
| 756 |
\nobreak \hskip\z@skip |
| 757 |
\@ignoretrue |
| 758 |
\ignorespaces |
| 759 |
\fi |
| 760 |
\fi}% |
| 761 |
%</2ekernel|latexrelease> |
| 762 |
%<latexrelease>\EndIncludeInRelease |
| 763 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 764 |
%<latexrelease> {\@Esphack}{hyphenation after space hack}% |
| 765 |
%<latexrelease>\def\@Esphack{% |
| 766 |
%<latexrelease> \relax |
| 767 |
%<latexrelease> \ifhmode |
| 768 |
%<latexrelease> \spacefactor\@savsf |
| 769 |
%<latexrelease> \ifdim\@savsk>\z@ |
| 770 |
%<latexrelease> \@ignoretrue |
| 771 |
%<latexrelease> \ignorespaces |
| 772 |
%<latexrelease> \fi |
| 773 |
%<latexrelease> \fi}% |
| 774 |
%<latexrelease>\EndIncludeInRelease |
| 775 |
%<*2ekernel> |
| 776 |
% \end{macrocode} |
| 777 |
% \end{macro} |
| 778 |
% |
| 779 |
% |
| 780 |
% \begin{macro}{\@vbsphack} |
| 781 |
% \changes{LaTeX2e}{1993/12/08}{Command added} |
| 782 |
% Another variant which is useful for invisible things which should |
| 783 |
% not live in vmode (this is how some people feel about marginals). |
| 784 |
% |
| 785 |
% If it occurs in vmode then it enters hmode and ensures that |
| 786 |
% |\@savsk| is nonzero so that the |\ignorespaces| is put in later. |
| 787 |
% It is not used at present. |
| 788 |
% \changes{v1.2f}{1995/05/25}{(CAR) not used so `removed'.} |
| 789 |
%\begin{verbatim} |
| 790 |
% \def \@vbsphack{ % |
| 791 |
% \relax \ifvmode |
| 792 |
% \leavevmode |
| 793 |
% \@savsk 1sp |
| 794 |
% \@savsf \spacefactor |
| 795 |
% \else |
| 796 |
% \ifhmode |
| 797 |
% \@savsk \lastskip |
| 798 |
% \@savsf \spacefactor |
| 799 |
% \fi |
| 800 |
% \fi |
| 801 |
% } |
| 802 |
%\end{verbatim} |
| 803 |
% \end{macro} |
| 804 |
% |
| 805 |
% |
| 806 |
% \subsection{Vertical spacing} |
| 807 |
% |
| 808 |
% |
| 809 |
% \LaTeX\ supports the plain \TeX\ commands |
| 810 |
% |\smallskip|, |\medskip| and |\bigskip|. |
| 811 |
% However, it redefines them using |\vspace| instead of |\vskip|. |
| 812 |
% |
| 813 |
% Extra vertical space is added by the command |
| 814 |
% |\addvspace|\marg{skip}, |
| 815 |
% which adds a vertical skip of \meta{skip} to the document. |
| 816 |
% The sequence\\ |
| 817 |
% |\addvspace|\marg{s1} |\addvspace|\marg{s2} |
| 818 |
% is equivalent to\\ |
| 819 |
% |\addvspace|\marg{maximum of s1, s2}. |
| 820 |
% |
| 821 |
% |\addvspace| should be used only in vertical mode, and gives an |
| 822 |
% error if it's not. The |\addvspace| command does \emph{not} add |
| 823 |
% vertical space if |@minipage| is true. The minipage environment uses |
| 824 |
% this to inhibit the addition of extra vertical space at the beginning. |
| 825 |
% |
| 826 |
% Penalties are put into the vertical list with the |
| 827 |
% |\addpenalty|\marg{penalty} |
| 828 |
% command. It works properly when |\addpenalty| and |\addvspace| |
| 829 |
% commands are mixed. |
| 830 |
% |
| 831 |
% The |@nobreak| switch is set true used when in vertical mode and no |
| 832 |
% page break should occur. (Right now, it is used only by the section |
| 833 |
% heading commands to inhibit page breaking after a heading.) |
| 834 |
% |
| 835 |
% |
| 836 |
% \begin{macro}{\@xaddvskip} |
| 837 |
% Internal macro for |\vspace| handling the case that space has |
| 838 |
% previously been added. |
| 839 |
% \begin{macrocode} |
| 840 |
\def\@xaddvskip{% |
| 841 |
\ifdim\lastskip<\@tempskipb |
| 842 |
\vskip-\lastskip |
| 843 |
\vskip\@tempskipb |
| 844 |
\else |
| 845 |
\ifdim\@tempskipb<\z@ |
| 846 |
\ifdim\lastskip<\z@ |
| 847 |
\else |
| 848 |
\advance\@tempskipb\lastskip |
| 849 |
\vskip-\lastskip |
| 850 |
\vskip \@tempskipb |
| 851 |
\fi |
| 852 |
\fi |
| 853 |
\fi} |
| 854 |
% \end{macrocode} |
| 855 |
% \end{macro} |
| 856 |
% |
| 857 |
% |
| 858 |
% \begin{macro}{\addvspace} |
| 859 |
% \changes{v1.2b}{1994/11/12}{Corrected error message} |
| 860 |
% \changes{v1.2c}{1994/11/13}{Recorrected error message} |
| 861 |
% Add vertical space taking into account space already added, as |
| 862 |
% described above. |
| 863 |
% \changes{v1.3m}{2020/04/21}{Support calc syntax (gh/152)} |
| 864 |
% \changes{v1.3s}{2024/09/10}{Drop unnecessary \cs{@noitemerr} and |
| 865 |
% instead generate \cs{@LRmoderr} if we are in restricted hmode (gh/1460)} |
| 866 |
% \begin{macrocode} |
| 867 |
%</2ekernel> |
| 868 |
%<*2ekernel|latexrelease> |
| 869 |
%<latexrelease>\IncludeInRelease{2024/11/01}% |
| 870 |
%<latexrelease> {\addvspace}{drop unnecessary no-item error}% |
| 871 |
\protected\def\addvspace#1{% |
| 872 |
% \end{macrocode} |
| 873 |
% When this is encountered in hmode, we check whether we are in an hbox and if so |
| 874 |
% generate a \LaTeX{} error, as otherwise this would cause a bunch |
| 875 |
% of low-level errors. In unrestricted hmode we simply switch to vmode by |
| 876 |
% issuing a \cs{par}. |
| 877 |
% \begin{macrocode} |
| 878 |
\ifhmode \ifinner \@LRmoderr \else \par \fi \fi |
| 879 |
% \end{macrocode} |
| 880 |
% |
| 881 |
% \begin{macrocode} |
| 882 |
\if@minipage\else |
| 883 |
\ifdim \lastskip =\z@ |
| 884 |
\@vspace@calcify{#1}% |
| 885 |
\else |
| 886 |
\setlength\@tempskipb{#1}% |
| 887 |
\@xaddvskip |
| 888 |
\fi |
| 889 |
\fi |
| 890 |
} |
| 891 |
%</2ekernel|latexrelease> |
| 892 |
%<latexrelease>\EndIncludeInRelease |
| 893 |
% \end{macrocode} |
| 894 |
% |
| 895 |
% \begin{macrocode} |
| 896 |
%<latexrelease>\IncludeInRelease{2020/10/01}% |
| 897 |
%<latexrelease> {\addvspace}{\addvspace calc support}% |
| 898 |
%<latexrelease>\def\addvspace#1{% |
| 899 |
%<latexrelease> \ifvmode |
| 900 |
%<latexrelease> \if@minipage\else |
| 901 |
%<latexrelease> \ifdim \lastskip =\z@ |
| 902 |
%<latexrelease> \@vspace@calcify{#1}% |
| 903 |
%<latexrelease> \else |
| 904 |
%<latexrelease> \setlength\@tempskipb{#1}% |
| 905 |
%<latexrelease> \@xaddvskip |
| 906 |
%<latexrelease> \fi |
| 907 |
%<latexrelease> \fi |
| 908 |
%<latexrelease> \else |
| 909 |
%<latexrelease> \@noitemerr |
| 910 |
%<latexrelease> \fi} |
| 911 |
%<latexrelease>\EndIncludeInRelease |
| 912 |
% \end{macrocode} |
| 913 |
% |
| 914 |
% \begin{macrocode} |
| 915 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 916 |
%<latexrelease> {\addvspace}{\addvspace calc support}% |
| 917 |
%<latexrelease> |
| 918 |
%<latexrelease>\def\addvspace#1{% |
| 919 |
%<latexrelease> \ifvmode |
| 920 |
%<latexrelease> \if@minipage\else |
| 921 |
%<latexrelease> \ifdim \lastskip =\z@ |
| 922 |
%<latexrelease> \vskip #1\relax |
| 923 |
%<latexrelease> \else |
| 924 |
%<latexrelease> \@tempskipb#1\relax |
| 925 |
%<latexrelease> \@xaddvskip |
| 926 |
%<latexrelease> \fi |
| 927 |
%<latexrelease> \fi |
| 928 |
%<latexrelease> \else |
| 929 |
%<latexrelease> \@noitemerr |
| 930 |
%<latexrelease> \fi} |
| 931 |
%<latexrelease>\EndIncludeInRelease |
| 932 |
%<*2ekernel> |
| 933 |
% \end{macrocode} |
| 934 |
% \end{macro} |
| 935 |
% |
| 936 |
% \begin{macro}{\addpenalty} |
| 937 |
% \changes{v1.2b}{1994/11/12}{Corrected error message} |
| 938 |
% \changes{v1.2c}{1994/11/13}{Recorrected error message} |
| 939 |
% \changes{v1.1h}{2015/01/09}{Donald Arseneau's fix from PR/377703 (latexrelease)} |
| 940 |
% \changes{v1.3s}{2024/09/10}{Drop unnecessary \cs{@noitemerr} and |
| 941 |
% instead generate \cs{@LRmoderr} if we are in restricted hmode (gh/1460)} |
| 942 |
% \begin{macrocode} |
| 943 |
%</2ekernel> |
| 944 |
%<latexrelease>\IncludeInRelease{2024/11/01}% |
| 945 |
%<latexrelease> {\addpenalty}{\addpenalty drop error}% |
| 946 |
%<*2ekernel|latexrelease> |
| 947 |
% \end{macrocode} |
| 948 |
% \begin{macrocode} |
| 949 |
\protected\def\addpenalty#1{% |
| 950 |
% \end{macrocode} |
| 951 |
% See description of \cs{addvspace} for documentation of the next |
| 952 |
% line of code. |
| 953 |
% \begin{macrocode} |
| 954 |
\ifhmode \ifinner \@LRmoderr \else \par \fi \fi |
| 955 |
% \end{macrocode} |
| 956 |
% Fix provided by Donald (though the original fix was not good |
| 957 |
% enough). In 2005 Plamen Tanovski discovered that this fix wasn't |
| 958 |
% good enough either as the \cs{vskip} kept getting bigger if |
| 959 |
% several \cs{addpenalty} commands followed each other. Donald |
| 960 |
% kindly send a new fix. |
| 961 |
% \begin{macrocode} |
| 962 |
\if@minipage |
| 963 |
\else |
| 964 |
\if@nobreak |
| 965 |
\else |
| 966 |
\ifdim\lastskip=\z@ |
| 967 |
\penalty#1\relax |
| 968 |
\else |
| 969 |
\@tempskipb\lastskip |
| 970 |
% \end{macrocode} |
| 971 |
% We have to make sure the final \cs{vskip} seen by \TeX\ is the |
| 972 |
% correct one, namely \cs{@tempskipb}. However, we may have to |
| 973 |
% adjust for \cs{prevdepth} when placing the penalty; that |
| 974 |
% should not affect the skip we pass on to \TeX. |
| 975 |
% \changes{v1.3e}{2015/01/14}{Avoid adding redundant skips (DPC)} |
| 976 |
% \begin{macrocode} |
| 977 |
\begingroup |
| 978 |
\@tempskipa\@tempskipb |
| 979 |
\advance \@tempskipb |
| 980 |
\ifdim\prevdepth>\maxdepth\maxdepth\else |
| 981 |
% \end{macrocode} |
| 982 |
% If |\prevdepth| is -1000pt due to |\nointerlineskip| we better |
| 983 |
% not add it! |
| 984 |
% \begin{macrocode} |
| 985 |
\ifdim \prevdepth = -\@m\p@ \z@ \else \prevdepth \fi |
| 986 |
\fi |
| 987 |
\vskip -\@tempskipb |
| 988 |
\penalty#1% |
| 989 |
\ifdim\@tempskipa=\@tempskipb |
| 990 |
% \end{macrocode} |
| 991 |
% Do nothing if the |\prevdepth| check made no adjustment. |
| 992 |
% \begin{macrocode} |
| 993 |
\else |
| 994 |
% \end{macrocode} |
| 995 |
% Combine the prevdepth adjustment into a single skip. |
| 996 |
% \begin{macrocode} |
| 997 |
\advance\@tempskipb -\@tempskipa |
| 998 |
\vskip \@tempskipb |
| 999 |
\fi |
| 1000 |
% \end{macrocode} |
| 1001 |
% The final skip is always the specified length. |
| 1002 |
% \begin{macrocode} |
| 1003 |
\vskip \@tempskipa |
| 1004 |
\endgroup |
| 1005 |
\fi |
| 1006 |
\fi |
| 1007 |
\fi |
| 1008 |
} |
| 1009 |
%</2ekernel|latexrelease> |
| 1010 |
%<latexrelease>\EndIncludeInRelease |
| 1011 |
% \end{macrocode} |
| 1012 |
% |
| 1013 |
% \begin{macrocode} |
| 1014 |
%<latexrelease>\IncludeInRelease{2015/01/01}% |
| 1015 |
%<latexrelease> {\addpenalty}{\addpenalty}% |
| 1016 |
%<latexrelease>\def\addpenalty#1{% |
| 1017 |
%<latexrelease> \ifvmode |
| 1018 |
%<latexrelease> \if@minipage |
| 1019 |
%<latexrelease> \else |
| 1020 |
%<latexrelease> \if@nobreak |
| 1021 |
%<latexrelease> \else |
| 1022 |
%<latexrelease> \ifdim\lastskip=\z@ |
| 1023 |
%<latexrelease> \penalty#1\relax |
| 1024 |
%<latexrelease> \else |
| 1025 |
%<latexrelease> \@tempskipb\lastskip |
| 1026 |
%<latexrelease> \begingroup |
| 1027 |
%<latexrelease> \@tempskipa\@tempskipb |
| 1028 |
%<latexrelease> \advance \@tempskipb |
| 1029 |
%<latexrelease> \ifdim\prevdepth>\maxdepth\maxdepth\else |
| 1030 |
%<latexrelease> \ifdim \prevdepth = -\@m\p@ \z@ \else \prevdepth \fi |
| 1031 |
%<latexrelease> \fi |
| 1032 |
%<latexrelease> \vskip -\@tempskipb |
| 1033 |
%<latexrelease> \penalty#1% |
| 1034 |
%<latexrelease> \ifdim\@tempskipa=\@tempskipb |
| 1035 |
%<latexrelease> \else |
| 1036 |
%<latexrelease> \advance\@tempskipb -\@tempskipa |
| 1037 |
%<latexrelease> \vskip \@tempskipb |
| 1038 |
%<latexrelease> \fi |
| 1039 |
%<latexrelease> \vskip \@tempskipa |
| 1040 |
%<latexrelease> \endgroup |
| 1041 |
%<latexrelease> \fi |
| 1042 |
%<latexrelease> \fi |
| 1043 |
%<latexrelease> \fi |
| 1044 |
%<latexrelease> \else |
| 1045 |
%<latexrelease> \@noitemerr |
| 1046 |
%<latexrelease> \fi}% |
| 1047 |
% \end{macrocode} |
| 1048 |
% |
| 1049 |
% \begin{macrocode} |
| 1050 |
%<latexrelease>\EndIncludeInRelease |
| 1051 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 1052 |
%<latexrelease> {\addpenalty}{\addpenalty}% |
| 1053 |
%<latexrelease>\def\addpenalty#1{% |
| 1054 |
%<latexrelease> \ifvmode |
| 1055 |
%<latexrelease> \if@minipage |
| 1056 |
%<latexrelease> \else |
| 1057 |
%<latexrelease> \if@nobreak |
| 1058 |
%<latexrelease> \else |
| 1059 |
%<latexrelease> \ifdim\lastskip=\z@ |
| 1060 |
%<latexrelease> \penalty#1\relax |
| 1061 |
%<latexrelease> \else |
| 1062 |
%<latexrelease> \@tempskipb\lastskip |
| 1063 |
%<latexrelease> \vskip -\lastskip |
| 1064 |
%<latexrelease> \penalty#1% |
| 1065 |
%<latexrelease> \vskip\@tempskipb |
| 1066 |
%<latexrelease> \fi |
| 1067 |
%<latexrelease> \fi |
| 1068 |
%<latexrelease> \fi |
| 1069 |
%<latexrelease> \else |
| 1070 |
%<latexrelease> \@noitemerr |
| 1071 |
%<latexrelease> \fi}% |
| 1072 |
%<latexrelease>\EndIncludeInRelease |
| 1073 |
%<*2ekernel> |
| 1074 |
% \end{macrocode} |
| 1075 |
% \end{macro} |
| 1076 |
% |
| 1077 |
% |
| 1078 |
% |
| 1079 |
% \begin{macro}{\vspace} |
| 1080 |
% \changes{v1.2m}{1996/01/20}{Made robust} |
| 1081 |
% \begin{macro}{\@vspace} |
| 1082 |
% \begin{macro}{\@vspacer} |
| 1083 |
% \changes{v1.2f}{1995/05/25} |
| 1084 |
% {(CAR) macros modified to be more efficient} |
| 1085 |
% \changes{v1.2f}{1995/05/25}{(CAR) \cs{@restorepar} added to avoid |
| 1086 |
% possible infinite tail recursion caused by a typo in the argument.} |
| 1087 |
% The new code for these commands depends on the following facts: |
| 1088 |
% \begin{itemize} |
| 1089 |
% \item The value of prevdepth is changed only when a box or rule |
| 1090 |
% is created and added to a vertical list; |
| 1091 |
% \item The value of prevdepth is used only when a box is created |
| 1092 |
% and added to a vertical list; |
| 1093 |
% \item The value of prevdepth is always local to the building of |
| 1094 |
% one vertical list. |
| 1095 |
% \end{itemize} |
| 1096 |
% \begin{macrocode} |
| 1097 |
\DeclareRobustCommand\vspace{\@ifstar\@vspacer\@vspace} |
| 1098 |
% \end{macrocode} |
| 1099 |
% |
| 1100 |
% \begin{macrocode} |
| 1101 |
%</2ekernel> |
| 1102 |
%<*2ekernel|latexrelease> |
| 1103 |
%<latexrelease>\IncludeInRelease{2020/10/01}% |
| 1104 |
%<latexrelease> {\@vspace}{Support calc in \vspace}% |
| 1105 |
% \end{macrocode} |
| 1106 |
% We support calc syntax in the argument and therefore use \cs{setlength}. |
| 1107 |
% \changes{v1.3m}{2020/04/21}{Support calc syntax (gh/152)} |
| 1108 |
% \begin{macrocode} |
| 1109 |
\def\@vspace #1{% |
| 1110 |
\ifvmode |
| 1111 |
\@vspace@calcify{#1}% |
| 1112 |
\vskip\z@skip |
| 1113 |
\else |
| 1114 |
\@bsphack |
| 1115 |
\vadjust{\@restorepar |
| 1116 |
\@vspace@calcify{#1}% |
| 1117 |
\vskip\z@skip |
| 1118 |
}% |
| 1119 |
\@esphack |
| 1120 |
\fi} |
| 1121 |
% \end{macrocode} |
| 1122 |
% |
| 1123 |
% \begin{macrocode} |
| 1124 |
\def\@vspacer#1{% |
| 1125 |
\ifvmode |
| 1126 |
\dimen@\prevdepth |
| 1127 |
\hrule \@height\z@ |
| 1128 |
\nobreak |
| 1129 |
\@vspace@calcify{#1}% |
| 1130 |
\vskip\z@skip |
| 1131 |
\prevdepth\dimen@ |
| 1132 |
\else |
| 1133 |
\@bsphack |
| 1134 |
\vadjust{\@restorepar |
| 1135 |
\hrule \@height\z@ |
| 1136 |
\nobreak |
| 1137 |
\@vspace@calcify{#1}% |
| 1138 |
\vskip\z@skip}% |
| 1139 |
\@esphack |
| 1140 |
\fi} |
| 1141 |
%</2ekernel|latexrelease> |
| 1142 |
%<latexrelease>\EndIncludeInRelease |
| 1143 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 1144 |
%<latexrelease> {\@vspace}{Support calc in \vspace}% |
| 1145 |
%<latexrelease> |
| 1146 |
%<latexrelease>\def\@vspace #1{% |
| 1147 |
%<latexrelease> \ifvmode |
| 1148 |
%<latexrelease> \vskip #1 |
| 1149 |
%<latexrelease> \vskip\z@skip |
| 1150 |
%<latexrelease> \else |
| 1151 |
%<latexrelease> \@bsphack |
| 1152 |
%<latexrelease> \vadjust{\@restorepar |
| 1153 |
%<latexrelease> \vskip #1 |
| 1154 |
%<latexrelease> \vskip\z@skip |
| 1155 |
%<latexrelease> }% |
| 1156 |
%<latexrelease> \@esphack |
| 1157 |
%<latexrelease> \fi} |
| 1158 |
%<latexrelease>\def\@vspacer#1{% |
| 1159 |
%<latexrelease> \ifvmode |
| 1160 |
%<latexrelease> \dimen@\prevdepth |
| 1161 |
%<latexrelease> \hrule \@height\z@ |
| 1162 |
%<latexrelease> \nobreak |
| 1163 |
%<latexrelease> \vskip #1 |
| 1164 |
%<latexrelease> \vskip\z@skip |
| 1165 |
%<latexrelease> \prevdepth\dimen@ |
| 1166 |
%<latexrelease> \else |
| 1167 |
%<latexrelease> \@bsphack |
| 1168 |
%<latexrelease> \vadjust{\@restorepar |
| 1169 |
%<latexrelease> \hrule \@height\z@ |
| 1170 |
%<latexrelease> \nobreak |
| 1171 |
%<latexrelease> \vskip #1 |
| 1172 |
%<latexrelease> \vskip\z@skip}% |
| 1173 |
%<latexrelease> \@esphack |
| 1174 |
%<latexrelease> \fi} |
| 1175 |
%<latexrelease>\EndIncludeInRelease |
| 1176 |
%<*2ekernel> |
| 1177 |
% \end{macrocode} |
| 1178 |
% \end{macro} |
| 1179 |
% \end{macro} |
| 1180 |
% \end{macro} |
| 1181 |
% |
| 1182 |
% \begin{macro}{\smallskip} |
| 1183 |
% \begin{macro}{\medskip} |
| 1184 |
% \begin{macro}{\bigskip} |
| 1185 |
% \begin{macrocode} |
| 1186 |
\def\smallskip{\vspace\smallskipamount} |
| 1187 |
\def\medskip{\vspace\medskipamount} |
| 1188 |
\def\bigskip{\vspace\bigskipamount} |
| 1189 |
% \end{macrocode} |
| 1190 |
% \end{macro} |
| 1191 |
% \end{macro} |
| 1192 |
% \end{macro} |
| 1193 |
% |
| 1194 |
% \begin{macro}{\smallskipamount} |
| 1195 |
% \begin{macro}{\medskipamount} |
| 1196 |
% \begin{macro}{\bigskipamount} |
| 1197 |
% \begin{macrocode} |
| 1198 |
\newskip\smallskipamount \smallskipamount=3pt plus 1pt minus 1pt |
| 1199 |
\newskip\medskipamount \medskipamount =6pt plus 2pt minus 2pt |
| 1200 |
\newskip\bigskipamount \bigskipamount =12pt plus 4pt minus 4pt |
| 1201 |
% \end{macrocode} |
| 1202 |
% \end{macro} |
| 1203 |
% \end{macro} |
| 1204 |
% \end{macro} |
| 1205 |
% |
| 1206 |
% |
| 1207 |
% |
| 1208 |
% \subsection{Horizontal space (and breaks)} |
| 1209 |
% |
| 1210 |
% \begin{macro}{\nobreakdashes} |
| 1211 |
% \changes{v1.3}{2004/02/04}{Macro added} |
| 1212 |
% \changes{v1.3a}{2004/02/15}{Added spacefactor setting} |
| 1213 |
% This idea is borrowed from the \textsf{amsmath} package but |
| 1214 |
% here we define a robust command. |
| 1215 |
% |
| 1216 |
% This command is a low-level command designed for use only before |
| 1217 |
% hyphens or dashes (such as |-|, |--|, or |---|). |
| 1218 |
% |
| 1219 |
% It could probably be better implemented: it may need its own |
| 1220 |
% private token register and temporary command. |
| 1221 |
% |
| 1222 |
% Setting the hyphen in a box and then unboxing it means that the |
| 1223 |
% normal penalty will not be added after it---and if the penalty is |
| 1224 |
% not there a break will not be taken (unless an explicit penalty |
| 1225 |
% or glue follows, thus the final \verb=\nobreak=). |
| 1226 |
% |
| 1227 |
% Note that even if it is not followed by a `-', it still leaves |
| 1228 |
% vmode and sets the spacefactor; so use it carefully! |
| 1229 |
% |
| 1230 |
% \begin{macrocode} |
| 1231 |
\DeclareRobustCommand{\nobreakdashes}{% |
| 1232 |
\leavevmode |
| 1233 |
\toks@{}% |
| 1234 |
\def\reserved@a##1{\toks@\expandafter{\the\toks@-}% |
| 1235 |
\futurelet\@let@token \reserved@b}% |
| 1236 |
\def\reserved@b {\ifx\@let@token -% |
| 1237 |
\expandafter\reserved@a |
| 1238 |
\else |
| 1239 |
\setbox\z@ \hbox{\the\toks@\nobreak}% |
| 1240 |
\unhbox\z@ |
| 1241 |
\spacefactor\sfcode`\- |
| 1242 |
\fi}% |
| 1243 |
\futurelet\@let@token \reserved@b |
| 1244 |
} |
| 1245 |
% \end{macrocode} |
| 1246 |
% \end{macro} |
| 1247 |
% |
| 1248 |
% \begin{macro}{\nobreakspace} |
| 1249 |
% \changes{v1.2k}{1995/12/04}{Macro added} |
| 1250 |
% \changes{v1.3r}{2023/10/26}{Protected definition for tilde} |
| 1251 |
% \begin{macro}{\@xobeysp} |
| 1252 |
% \changes{v1.2t}{1996/09/28}{Moved from ltmiscen.dtx and redefined to |
| 1253 |
% use \cs{nobreakspace }} |
| 1254 |
% |
| 1255 |
% This is a robust command that produces a horizontal space at |
| 1256 |
% which, in paragraph-mode, a line-break is not possible. We then |
| 1257 |
% define an active |~| to expand to it since this is the documented |
| 1258 |
% behaviour of |~|. One reason for introducing this is that some |
| 1259 |
% 8-bit input encodings have a slot for such a space and we do not |
| 1260 |
% want to use active characters as the \LaTeX{} internal commands. |
| 1261 |
% |
| 1262 |
% The braces in the definition of |~| are needed to ensure that a |
| 1263 |
% following space is preserved when reading to/from internal files. |
| 1264 |
% \changes{v1.2l}{1995/12/04}{braces added to definition of tilde} |
| 1265 |
% |
| 1266 |
% We need to keep \cs{@xobeysp} as it is widely used; so here it is |
| 1267 |
% let to the non-robust command \cs{nobreakspace }. |
| 1268 |
% |
| 1269 |
% The fragile version of |~| needs a brace group after \cs{nobreakspace} |
| 1270 |
% to prevent loss of spaces if it occurs in an expansion context. That's |
| 1271 |
% not an issue with the updated \cs{protected} definition, so we keep the |
| 1272 |
% code shorter and avoid that. |
| 1273 |
% \begin{macrocode} |
| 1274 |
\DeclareRobustCommand{\nobreakspace}{% |
| 1275 |
\leavevmode\nobreak\ } |
| 1276 |
\catcode `\~=13 |
| 1277 |
%</2ekernel> |
| 1278 |
%<latexrelease>\IncludeInRelease{2023/11/01}% |
| 1279 |
%<latexrelease> {\tilde}{Protected tilde}% |
| 1280 |
%<*2ekernel|latexrelease> |
| 1281 |
\protected\edef~{% |
| 1282 |
\noexpand\ifincsname\noexpand\expandafter\string~% |
| 1283 |
\noexpand\else |
| 1284 |
\noexpand\expandafter\noexpand\nobreakspace |
| 1285 |
\noexpand\fi |
| 1286 |
} |
| 1287 |
%</2ekernel|latexrelease> |
| 1288 |
%<latexrelease>\EndIncludeInRelease |
| 1289 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 1290 |
%<latexrelease> {\tilde}{Protected tilde}% |
| 1291 |
%<latexrelease>\def~{\nobreakspace{}} |
| 1292 |
%<latexrelease>\EndIncludeInRelease |
| 1293 |
%<*2ekernel> |
| 1294 |
\expandafter\let\expandafter\@xobeysp\csname nobreakspace \endcsname |
| 1295 |
% \end{macrocode} |
| 1296 |
% \end{macro} |
| 1297 |
% \end{macro} |
| 1298 |
% |
| 1299 |
% \begin{macro}{\@xobeytab} |
| 1300 |
% \changes{v1.3q}{2023/06/14}{Macro added} |
| 1301 |
% Equivalent to the space case with the default settings. |
| 1302 |
% \begin{macrocode} |
| 1303 |
%</2ekernel> |
| 1304 |
%<latexrelease>\IncludeInRelease{2023/11/01}% |
| 1305 |
%<latexrelease> {\@xobeytab}{Obeyed tabs}% |
| 1306 |
%<*2ekernel|latexrelease> |
| 1307 |
\let\@xobeytab\@xobeysp |
| 1308 |
%</2ekernel|latexrelease> |
| 1309 |
%<latexrelease>\EndIncludeInRelease |
| 1310 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 1311 |
%<latexrelease> {\@xobeytab}{Obeyed tabs}% |
| 1312 |
%<latexrelease>\let\@xobeytab\@undefined |
| 1313 |
%<latexrelease>\EndIncludeInRelease |
| 1314 |
%<*2ekernel> |
| 1315 |
% \end{macrocode} |
| 1316 |
% \end{macro} |
| 1317 |
% |
| 1318 |
% |
| 1319 |
% \begin{macro}{\@} |
| 1320 |
% Placed before a '.', makes it a sentence-ending period. Does the |
| 1321 |
% right thing for other punctuation marks as well. Does this by |
| 1322 |
% setting spacefactor to 1000. |
| 1323 |
% \changes{v1.3b}{2014/12/30}{\cs{@} discards spaces when moving |
| 1324 |
% (pr3039)(latexrelease)} |
| 1325 |
% \begin{macrocode} |
| 1326 |
%</2ekernel> |
| 1327 |
%<latexrelease>\IncludeInRelease{2015/01/01}% |
| 1328 |
%<latexrelease> {\@}{Space after \@}% |
| 1329 |
%<*2ekernel|latexrelease> |
| 1330 |
% \end{macrocode} |
| 1331 |
% \begin{macrocode} |
| 1332 |
\def\@{\spacefactor\@m{}}% |
| 1333 |
%</2ekernel|latexrelease> |
| 1334 |
%<latexrelease>\EndIncludeInRelease |
| 1335 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 1336 |
%<latexrelease> {\@}{Space after \@}% |
| 1337 |
%<latexrelease>\def\@{\spacefactor\@m}% |
| 1338 |
%<latexrelease>\EndIncludeInRelease |
| 1339 |
%<*2ekernel> |
| 1340 |
% \end{macrocode} |
| 1341 |
% \end{macro} |
| 1342 |
% |
| 1343 |
% |
| 1344 |
% \begin{macro}{\hspace} |
| 1345 |
% \changes{v1.0o}{1994/05/11}{Use \cs{DeclareRobustCommand}. ASAJ.} |
| 1346 |
% \begin{macrocode} |
| 1347 |
\DeclareRobustCommand\hspace{\@ifstar\@hspacer\@hspace} |
| 1348 |
% \end{macrocode} |
| 1349 |
% \end{macro} |
| 1350 |
% |
| 1351 |
% \begin{macro}{\@hspace} |
| 1352 |
% \changes{LaTeX2e}{1993/08/05} |
| 1353 |
% {(RmS) Removed superfluous \cs{leavevmode} in \cs{@hspace} and |
| 1354 |
% \cs{@hspacer}, as suggested by CAR.} |
| 1355 |
% \changes{v1.3m}{2020/04/21}{Support calc syntax (gh/152)} |
| 1356 |
% \changes{v1.3o}{2022/11/28}{Support calc syntax correctly (gh/967)} |
| 1357 |
% \begin{macrocode} |
| 1358 |
%</2ekernel> |
| 1359 |
%<*2ekernel|latexrelease> |
| 1360 |
%<latexrelease>\IncludeInRelease{2020/10/01}% |
| 1361 |
%<latexrelease> {\@hspace}{Support calc with \hspace}% |
| 1362 |
% \end{macrocode} |
| 1363 |
% We use a private register to calculate the space (if \pkg{calc} is used). Previously |
| 1364 |
% we used a group but that results in |
| 1365 |
% \cs{everypar} etc.\ being executed inside the group if the \cs{hspace} starts a paragraph. |
| 1366 |
% This is a bug fix so |
| 1367 |
% we do not provide rollback to the incorrect intermediate version. |
| 1368 |
% \begin{macrocode} |
| 1369 |
\newskip\sp@ce@skip |
| 1370 |
\def\@hspace#1{\setlength\sp@ce@skip{#1}\hskip\sp@ce@skip} |
| 1371 |
%</2ekernel|latexrelease> |
| 1372 |
%<latexrelease>\EndIncludeInRelease |
| 1373 |
% \end{macrocode} |
| 1374 |
% |
| 1375 |
% \begin{macrocode} |
| 1376 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 1377 |
%<latexrelease> {\@hspace}{Support calc with \hspace}% |
| 1378 |
|
| 1379 |
%<latexrelease> |
| 1380 |
%<latexrelease>\def\@hspace#1{\hskip #1\relax} |
| 1381 |
%<latexrelease>\EndIncludeInRelease |
| 1382 |
%<*2ekernel> |
| 1383 |
% \end{macrocode} |
| 1384 |
% \end{macro} |
| 1385 |
% |
| 1386 |
% |
| 1387 |
% \begin{macro}{\@hspacer} |
| 1388 |
% Extra |\hskip 0pt| added 1985/17/12 to guard |
| 1389 |
% against a following |\unskip| |
| 1390 |
% |\relax| added 13 Oct 88 for usual \TeX\ lossage |
| 1391 |
% replaced both changes by |\hskip\z@skip| 27 Nov 91 |
| 1392 |
% \begin{macrocode} |
| 1393 |
\def\@hspacer#1{\vrule \@width\z@\nobreak |
| 1394 |
\@hspace{#1}\hskip \z@skip} |
| 1395 |
% \end{macrocode} |
| 1396 |
% \end{macro} |
| 1397 |
% |
| 1398 |
% |
| 1399 |
% |
| 1400 |
% \begin{macro}{\fill} |
| 1401 |
% \begin{macrocode} |
| 1402 |
\newskip\fill |
| 1403 |
\fill = 0pt plus 1fill |
| 1404 |
% \end{macrocode} |
| 1405 |
% \end{macro} |
| 1406 |
% |
| 1407 |
% |
| 1408 |
% |
| 1409 |
% \begin{macro}{\stretch} |
| 1410 |
% \begin{macrocode} |
| 1411 |
\def\stretch#1{\z@ \@plus #1fill\relax} |
| 1412 |
% \end{macrocode} |
| 1413 |
% \end{macro} |
| 1414 |
% |
| 1415 |
% |
| 1416 |
% \begin{macrocode} |
| 1417 |
%</2ekernel> |
| 1418 |
%<*2ekernel|latexrelease> |
| 1419 |
%<latexrelease>\IncludeInRelease{2018/12/01}% |
| 1420 |
%<latexrelease> {\thinspace}{Start LR-mode}% |
| 1421 |
% \end{macrocode} |
| 1422 |
% |
| 1423 |
% \begin{macro}{\enspace} |
| 1424 |
% \changes{v1.3h}{2018/09/24}{Start LR-mode if necessary (gh/49)} |
| 1425 |
% \begin{macrocode} |
| 1426 |
\DeclareRobustCommand\enspace{\leavevmode@ifvmode\kern.5em } |
| 1427 |
% \end{macrocode} |
| 1428 |
% \end{macro} |
| 1429 |
% |
| 1430 |
% \begin{macro}{\leavevmode@ifvmode} |
| 1431 |
% Leave vmode but only if we are really in vmode, otherwise the |
| 1432 |
% expansion is empty (which is not the case with the default definition). |
| 1433 |
% \changes{v1.3h}{2018/09/24}{Macro added (gh/49)} |
| 1434 |
% \begin{macrocode} |
| 1435 |
\protected\def\leavevmode@ifvmode{\ifvmode\expandafter\indent\fi} |
| 1436 |
% \end{macrocode} |
| 1437 |
% \end{macro} |
| 1438 |
% |
| 1439 |
% \begin{macrocode} |
| 1440 |
%</2ekernel|latexrelease> |
| 1441 |
%<latexrelease>\EndIncludeInRelease |
| 1442 |
%<latexrelease>\IncludeInRelease{0000/00/00}% |
| 1443 |
%<latexrelease> {\thinspace}{Start LR-mode}% |
| 1444 |
%<latexrelease>\def\thinspace{\kern .16667em } |
| 1445 |
%<latexrelease>\def\negthinspace{\kern-.16667em } |
| 1446 |
%<latexrelease>\def\enspace{\kern.5em } |
| 1447 |
%<latexrelease>\let\leavevmode@ifvmode\@undefined |
| 1448 |
%<latexrelease>\EndIncludeInRelease |
| 1449 |
%<*2ekernel> |
| 1450 |
% \end{macrocode} |
| 1451 |
% |
| 1452 |
% |
| 1453 |
% |
| 1454 |
% \begin{macro}{\enskip} |
| 1455 |
% \begin{macro}{\quad} |
| 1456 |
% \begin{macro}{\qquad} |
| 1457 |
% \begin{macrocode} |
| 1458 |
\def\enskip{\hskip.5em\relax} |
| 1459 |
\def\quad{\hskip1em\relax} |
| 1460 |
\def\qquad{\hskip2em\relax} |
| 1461 |
% \end{macrocode} |
| 1462 |
% \end{macro} |
| 1463 |
% \end{macro} |
| 1464 |
% \end{macro} |
| 1465 |
% |
| 1466 |
% \changes{v1.3n}{2020/05/06}{Made softhyphen active in TU engines} |
| 1467 |
% |
| 1468 |
% For Unicode engines, make the Unicode soft hyphen an active |
| 1469 |
% character defined as \cs{-}. |
| 1470 |
% |
| 1471 |
% \begin{macrocode} |
| 1472 |
\ifx\Umathcode\@undefined\else |
| 1473 |
\catcode "AD=13 |
| 1474 |
\def^^ad{\-} |
| 1475 |
\fi |
| 1476 |
% \end{macrocode} |
| 1477 |
% |
| 1478 |
% \begin{macro}{\obeycr} |
| 1479 |
% \begin{macro}{\restorecr} |
| 1480 |
% The following definitions will probably get deleted or moved to |
| 1481 |
% compatibility mode soon. |
| 1482 |
% |
| 1483 |
% \changes{v1.2g}{1995/06/11} |
| 1484 |
% {(CAR) \cs{relax} added to stop silent eating of *.} |
| 1485 |
% \begin{macrocode} |
| 1486 |
{\catcode`\^^M=13 \gdef\obeycr{\catcode`\^^M13 \def^^M{\\\relax}% |
| 1487 |
\@gobblecr}% |
| 1488 |
{\catcode`\^^M=13 \gdef\@gobblecr{\@ifnextchar |
| 1489 |
\@gobble\ignorespaces}} |
| 1490 |
\gdef\restorecr{\catcode`\^^M5 }} |
| 1491 |
% \end{macrocode} |
| 1492 |
% \end{macro} |
| 1493 |
% \end{macro} |
| 1494 |
% |
| 1495 |
% \begin{macrocode} |
| 1496 |
%</2ekernel> |
| 1497 |
% \end{macrocode} |
| 1498 |
% |
| 1499 |
% \Finale |
| 1500 |
\endinput |