1 % \iffalse meta-comment
4 % The LaTeX3 Project and any individual authors listed elsewhere
7 % This file is part of the LaTeX base system.
8 % -------------------------------------------
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 % http://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX
16 % version 2005/12/01 or later.
18 % This file has the LPPL maintenance status "maintained".
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
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.
31 %%% From File: ltspace.dtx
34 \ProvidesFile{ltspace.dtx}
35 [2015/01/14 v1.3e LaTeX Kernel (spacing)]
37 \documentclass{ltxdoc}
38 \GetFileInfo{ltspace.dtx}
50 \MaintainedByLaTeXTeam{latex}
59 % \changes{v1.1a}{1994/05/16}{(ASAJ) Split from ltinit.dtx.}
60 % \changes{v1.2f}{1995/05/25}{Macros moved to ltlists.dtx}
61 % \changes{v1.2n}{1996/04/22}{Documentation Improvements}
62 % \changes{v1.2o}{1996/06/22}{Documentation of problems added}
63 % \changes{v1.2q}{1996/07/27}{Further documentation of problems}
64 % \changes{v1.2r}{1996/07/27}{Correct documentation of problems}
65 % \changes{v1.2w}{1998/08/17}{Documentation fixes.}
70 % This section deals with spacing, and line- and page-breaking.
72 % \subsection{User Commands}
74 % \DescribeMacro\nopagebreak\oarg{i} : \meta{i} = 0,...,4.
76 % Default argument = 4. Puts a penalty into the vertical list
77 % output as follows:\\
79 % 1 : penalty = |\@lowpenalty|\\
80 % 2 : penalty = |\@medpenalty|\\
81 % 3 : penalty = |\@highpenalty|\\
84 % \DescribeMacro\pagebreak\oarg{i} :
85 % same as \nopagebreak except negatives of its penalty
87 % \DescribeMacro\linebreak\oarg{i} : analog of the above
89 % \DescribeMacro\nolinebreak\oarg{i} : analog of the above
91 % \DescribeMacro\samepage :
92 % inhibits page breaking most places by setting the
93 % following penalties to 10000:\\
94 % |\interlinepenalty|\\
95 % |\postdisplaypenalty|\\
96 % |\interdisplaylinepenalty|\\
97 % |\@beginparpenalty|\\
101 % |\interfootnotelinepenalty|
103 % \DescribeMacro{\\} : initially defined to be |\newline|
105 % |\\|\oarg{length} : initially defined to be
106 % |\vspace|\marg{length}|\newline|\\
107 % Note: |\\*| adds a |\vadjust{\penalty 10000}|
109 % OBSOLETE COMMANDS (which never made it into the manual):
111 % |\obeycr| : defines <CR> == |\\\relax|\\
112 % |\restorecr| : restores <CR> to its usual meaning.
117 % \subsection{Chris' comments}
119 % There are several aspects of the handling of space in horizontal
120 % mode that are inconsistent or do not work well in some cases.
121 % These are largely concerned with ignoring the effect of space
122 % tokens that would otherwise typeset an inter-word space.
124 % Negating the effect of such space tokens is achieved by two
127 % \item |\unskip| is used to remove the glue just added by
128 % a space that has already had its effect; it is sometimes
129 % invoked after an |\ifdim| test on |\lastskip| (see below);
130 % \item |\ignorespaces| is used to ignore space-tokens yet to come.
133 % The test done on |\lastskip| is sometimes for equality with zero and
134 % sometimes for being positive. Recall also that the test is only on
135 % the natural length of the glue and that no glue cannot be
136 % distinguished from glue whose natural length is zero: to summarise,
137 % a pretty awful test. It is not clear why these tests are not all
138 % the same; I think that they should all be for equality. One place
139 % where |\unskip| is often used is just before a |\par| (which itself
140 % internally does an |\unskip|) and one bit of code (in |\@item|) even
141 % has two |\unskips| before a |\par|. These uses may be fossil code
142 % but if they are necessary, maybe |\@killglue| would be even safer.
144 % Such removal of glue by |\unskip| may sometimes have the wrong result,
145 % removing not the glue from a space-token but other explicit glue;
146 % this is sometimes not what is intended.
148 % A common way to prevent such removal is to add an |\hskip\z@| after
149 % the glue that should not be removed. This protects that glue
150 % against one |\unskip| with no test but not against more than one.
151 % It does work for `tested |\unskip|s'. This is used
152 % by |\hspace*| but not by |\hspace|; this is inconsistent as the star
153 % is supposed to prevent removal only at the beginning of a line, not
154 % at the end, or in a tabular, etc.
156 % If this reason for removing glue were the only consideration then a
157 % tested-|\unskip| and protection by |\hskip\z@| would suffice but
158 % would need to be consistently implemented.
160 % However, the class of invisibles, commands and environments tries to
161 % be even cleverer: one of these tries to leave only one inter-word
162 % space whenever there is one before it and one after it; and it does
165 % But problems can arise when there is not a space-token on
166 % both sides of it; in particular, when an invisible appears at the
167 % beginning or end of a piece of text the method still leaves one space
168 % token whereas usually in these cases it should leave none.
170 % Also, the current rules do not work well when more than one such
171 % command appears consecutively, separated by space-tokens; it leaves
172 % glue between every other invisible.
174 % There is also a question about what these commands should do when
175 % they occur next to spaces that do not come from space tokens but,
176 % for example, from |\hspace|. Should they still produce `just one
177 % space'? If so, which one? It is good to note that the manual
178 % is sufficiently cautious about invisibles that we are not obliged to
179 % make anything work.
181 % Another interesting side-road to explore is whether the space-tokens
182 % either side of an |\hspace{...}| should be ignored.
184 % One alternative to the current algorithm that is often suggested is
185 % that all glue around the invisible should be consolidated into a
186 % space after it (usually without stating how much glue should be put
187 % there). The command |\nolinebreak| is implemented this way (and
188 % |\linebreak| should also be). This does not work correctly for the
189 % following common case:
193 % some-word and more text.
195 % This is optimal coding since it is normal to index a word that gets
196 % split across a page-break on its starting page. This would, on the
197 % other hand, fix another common (and documented) failure of the
198 % current system: when the invisible is the last thing in a paragraph
199 % the space before it is not removed and, worse, it is also hidden
200 % from the paragraph-ending mechanism so that an `empty' line can be
201 % created at the end of the paragraph.
203 % Another deficiency (I think) of the current system is that the
204 % following is treated as having the |\index| command between the
205 % paragraphs, which is probably not what the author intended (since
206 % there is no empty line after it).
210 % Beginnings of paragraphs ...
213 % I know of no algorithm that will handle satisfactorily even
214 % all the most common cases; note that it could be that the best
215 % algorithm may be different for different invisibles since,
216 % for example, the common uses and expected behaviour of
217 % |\index|, |\marginpar|, |\linebreak|, |\pagebreak| and
218 % |\vspace| are somewhat different. [For example, is
219 % |\vspace| ever used in the middle of a paragraph?]
221 % One method that can (and is) used to make invisible commands produce
222 % no space when used at the beginning of text is to put in some glue
223 % that is nearly enough the same as no glue or glue of zero length in
224 % all respects except for the precise test for not being exactly equal
225 % to zero; examples of such glue are |\hskip 1sp| and, possibly better
226 % but more complex, |\hskip -1sp \hskip 1sp|. However, this only works
227 % when it is known that user-supplied text is about to start.
229 % Some similar concerns apply to the handling of space and penalties
230 % in vertical mode; there is an extra hurdle here as |\unskip| does
231 % not work on the main vertical list. The complexity of the tests done
232 % by |\addvspace| have never been explained.
234 % The implementation of space hacks etc for vertical mode is another
235 % major area that needs further attention; my earlier experiments
236 % did not produce much improvement over the current unsatisfactory
239 % One particular problem is what happens when the following very
240 % natural coding is used (part of the problem here is that this looks
241 % like an hmode problem, but it is not):
246 % \item \label{item:xxx} Item text.
250 % \subsection{Some immediate actions}
253 % \item Fix bug in |\linebreak|.
254 % \item Fix bug in |\\*|.
255 % \item Reimplement |\\|, etc, removing extra |\vadjust|s and getting
256 % better error trapping (this seems to involve a lot more tokens).
257 % \item Investigate whether |\\|, etc need to be errors in vmode; I
258 % think that they could be noops (maybe with a warning).
259 % \item Make all(?) |\unskips| include test for zero skip (rather than
260 % other tests or no test).
261 % \item Consider replacing |\hskip 1sp| by something better (here
262 % called an `infinitesimal' skip).
263 % \item Look at all |\hskip\z@| (or similar) to see if they should be
264 % changed to an `infinitesimal' skip.
265 % \item Resolve the inconsistency between |\hspace| and |\hspace*|.
266 % \item Remove unnecessary |\unskips|.
267 % \item Investigate and rationalise the `newline' code.
268 % \item Find better algorithms for all sorts of things or, easier(?),
272 % \subsection{The code}
279 % \begin{macro}{\pagebreak}
280 % \begin{macro}{\nopagebreak}
281 % \changes{v1.2h}{1995/07/05}{Reimplemented both using \cs{@no@pgbk}}
282 % \changes{v1.2j}{1995/10/16}{(DPC) Use \cs{@testopt} /1911}
284 \def\pagebreak{\@testopt{\@no@pgbk-}4}
285 \def\nopagebreak{\@testopt\@no@pgbk4}
291 % \begin{macro}{\@no@pgbk}
292 % \changes{v1.2h}{1995/07/05}{Macro replaces \cs{@pgbk}
295 \def\@no@pgbk #1[#2]{%
297 \penalty #1\@getpen{#2}%
300 \vadjust{\penalty #1\@getpen{#2}}%
306 % \begin{macro}{\linebreak}
307 % \begin{macro}{\nolinebreak}
308 % \changes{v1.2u}{1996/10/29}{Reimplemented both using \cs{@no@lnbk}}
309 % \changes{v1.2j}{1995/10/16}{(DPC) Use \cs{@testopt} /1911}
311 \def\linebreak{\@testopt{\@no@lnbk-}4}
312 \def\nolinebreak{\@testopt\@no@lnbk4}
316 % \begin{macro}{\@no@lnbk}
317 % \changes{v1.2u}{1996/10/29}{Macro replaces \cs{@lnbk}
320 \def\@no@lnbk #1[#2]{%
326 \penalty #1\@getpen{#2}%
327 \ifdim\@tempskipa>\z@
335 % \begin{macro}{\samepage}
337 \def\samepage{\interlinepenalty\@M
338 \postdisplaypenalty\@M
339 \interdisplaylinepenalty\@M
344 \interfootnotelinepenalty\@M}
350 % \changes{v1.2a}{1994/11/11}{(DPC) Make robust}
351 % \changes{v1.2d}{1994/11/14}{(DPC) Macro modified}
353 % \changes{v1.2u}{1996/10/29}{Corrected and rationalised code}
354 % The purpose of the new code is to fix a few bugs; however, it also
355 % attempts to optimize the following, in order of priority:
357 % \item efficient execution of plain |\\|;
358 % \item efficient execution of |\\[...]|;
360 % \item name-space use.
362 % The changes should make no difference to the typeset output.
363 % It appears to be safe to use |\reserved@e| and |\reserved@f| here
364 % (other reserved macros are somewhat disastrous).
366 % These changes made |\newline| even less robust than it had been,
367 % so now it is explicitly robust, like |\\|.
368 % \begin{macro}{\@normalcr}
369 % The internal definition of the `normal' definition of |\\|.
371 \DeclareRobustCommand\\{%
372 \let \reserved@e \relax
373 \let \reserved@f \relax
374 \@ifstar{\let \reserved@e \vadjust \let \reserved@f \nobreak
377 \expandafter\let\expandafter\@normalcr
378 \csname\expandafter\@gobble\string\\ \endcsname
382 % \begin{macro}{\newline}
383 % A simple form of the `normal' definition of |\\|.
384 % \changes{v1.2v}{1997/05/07}{Made completely robust.}
386 \DeclareRobustCommand\newline{\@normalcr\relax}
390 % \begin{macro}{\@xnewline}
392 \def\@xnewline{\@ifnextchar[% ] bracket matching
398 % \begin{macro}{\@newline}
400 \def\@newline[#1]{\let \reserved@e \vadjust
401 \@gnewline {\vskip #1}}
405 % \begin{macro}{\@gnewline}
406 % \changes{v1.2u}{1996/10/29}{Added macro}
407 % The |\nobreak| added to prevent null lines when |\\|
408 % ends an overfull line. Change made 24 May 89 as suggested by
409 % Frank Mittelbach and Rainer Sch\"opf
410 % \changes{v1.2h}{1995/07/05}{Use \cs{break}}
416 \unskip \reserved@e {\reserved@f#1}\nobreak \hfil \break
422 % \begin{macro}{\@getpen}
424 \def\@getpen#1{\ifcase #1 \z@ \or \@lowpenalty\or
425 \@medpenalty \or \@highpenalty
431 % \begin{macro}{\if@nobreak}
432 % \changes{v1.2p}{1996/07/26}{put \cs{global} inside definition}
433 % Switch used to avoid page breaks caused by |\label| after a
434 % section heading, etc. It should be \textbf{GLOBALLY} set true
435 % after the |\nobreak| and \textbf{globally} set false by the
436 % next invocation of |\everypar|.
438 % Commands that reset |\everypar| should globally set it false if
441 \def\@nobreakfalse{\global\let\if@nobreak\iffalse}
442 \def\@nobreaktrue {\global\let\if@nobreak\iftrue}
449 % \begin{macro}{\@savsk}
450 % \begin{macro}{\@savsf}
451 % Registers used to save the space factor and last skip.
462 % \begin{macro}{\@bsphack}
463 % \changes{LaTeX2e}{1993/12/08}
464 % {Command reimplemented; late birthday present for Chris}
465 % \changes{LaTeX2e}{1993/12/08}{Command reimplemented}
466 % \changes{LaTeX2e}{1993/12/16}{Corrected optimisation :-)}
467 % |\@bsphack| and |\@esphack|
468 % used by macros such as |\index| and
469 % |\begin{@float}| \ldots |\end{@float}|
470 % that want to be invisible --- i.e.,
471 % not leave any extra space when used in the middle of text. Such
472 % a macro should begin with |\@bsphack| and end with |\@esphack|
473 % The macro in question should not create any text, nor change the
476 % Before giving the current definition we give an extended definition
477 % that is currently not used (because it doesn't work as advertised:-)
479 % These are generalised hacks which attempt to do sensible things
480 % when `invisible commands' appear in vmode too.
482 % They need to cope with space in both hmode (plus spacefactor) and
483 % vmode, and also cope with breaks etc. In vmode this means
484 % ensuring that any following |\addvspace|, etc sees the correct
485 % glue in |\lastskip|.
487 % In fact, these improved versions should be used for other cases
488 % of `whatsits, thingies etc' which should be invisible. They are
489 % only for commands, not environments (see notes on |\@Esphack|).
491 % BTW, anyone know why the standard hacks are surrounded by
492 % |\ifmmode\else| rather than simply |\ifhmode|?
494 % And are there any cases where saving the spacefactor is
495 % essential? I have some extensions where it is, but it does not
496 % appear to be so in the standard uses.
501 % \ifdim \lastskip=\z@
508 % \@savsf \spacefactor
513 % I think that, in vmode, it is the safest to put
514 % in a |\nobreak| immediately after such things since writes,
515 % inserts etc followed by glue give valid breakpoints and, in
516 % general, it is possible to create breaks but impossible to
528 % \spacefactor \@savsf
536 % For the moment we are going to ignore the vertical versions until
538 % \changes{LaTeX2e}{1993/12/19}{There seem to be problems with selfmade
550 % \begin{macro}{\@esphack}
551 % Companion to |\@bsphack|.
552 % \changes{v1.3d}{2015/01/11}{Allow hyphenation (Donald Arseneau pr/3498) (latexrelease)}
555 %<latexrelease>\IncludeInRelease{2015/01/01}%
556 %<latexrelease> {\@esphack}{hyphenation after space hack}%
557 %<*2ekernel|latexrelease>
563 \nobreak \hskip\z@skip
567 %</2ekernel|latexrelease>
568 %<latexrelease>\EndIncludeInRelease
569 %<latexrelease>\IncludeInRelease{0000/00/00}%
570 %<latexrelease> {\@esphack}{hyphenation after space hack}%
571 %<latexrelease>\def\@esphack{%
572 %<latexrelease> \relax
573 %<latexrelease> \ifhmode
574 %<latexrelease> \spacefactor\@savsf
575 %<latexrelease> \ifdim\@savsk>\z@
576 %<latexrelease> \ignorespaces
578 %<latexrelease> \fi}%
579 %<latexrelease>\EndIncludeInRelease
584 % \begin{macro}{\@Esphack}
585 % A variant of |\@esphack| that sets the |@ignore| switch to
586 % true (as |\@esphack| used to do previously).
587 % This is currently used only for floats and similar environments.
588 % \changes{v1.2s}{1996/08/02}{Remove \cs{global} before \cs{@ignore...}}
589 % \changes{v1.3d}{2015/01/11}{Allow hyphenation (Donald Arseneau pr/3498) (latexrelease)}w
592 %<latexrelease>\IncludeInRelease{2015/01/01}%
593 %<latexrelease> {\Eesphack}{hyphenation after space hack}%
594 %<*2ekernel|latexrelease>
600 \nobreak \hskip\z@skip
605 %</2ekernel|latexrelease>
606 %<latexrelease>\EndIncludeInRelease
607 %<latexrelease>\IncludeInRelease{0000/00/00}%
608 %<latexrelease> {\@Esphack}{hyphenation after space hack}%
609 %<latexrelease>\def\@Esphack{%
610 %<latexrelease> \relax
611 %<latexrelease> \ifhmode
612 %<latexrelease> \spacefactor\@savsf
613 %<latexrelease> \ifdim\@savsk>\z@
614 %<latexrelease> \@ignoretrue
615 %<latexrelease> \ignorespaces
617 %<latexrelease> \fi}%
618 %<latexrelease>\EndIncludeInRelease
624 % \begin{macro}{\@vbsphack}
625 % \changes{LaTeX2e}{1993/12/08}{Command added}
626 % Another variant which is useful for invisible things which should
627 % not live in vmode (this is how some people feel about marginals).
629 % If it occurs in vmode then it enters hmode and ensures that
630 % |\@savsk| is nonzero so that the |\ignorespaces| is put in later.
631 % It is not used at present.
632 % \changes{v1.2f}{1995/05/25}{(CAR) not used so `removed'.}
638 % \@savsf \spacefactor
642 % \@savsf \spacefactor
650 % \subsection{Vertical spacing}
653 % \LaTeX\ supports the plain \TeX\ commands
654 % |\smallskip|, |\medskip| and |\bigskip|.
655 % However, it redefines them using |\vspace| instead of |\vskip|.
657 % Extra vertical space is added by the command
658 % |\addvspace|\marg{skip},
659 % which adds a vertical skip of \meta{skip} to the document.
661 % |\addvspace|\marg{s1} |\addvspace|\marg{s2}
663 % |\addvspace|\marg{maximum of s1, s2}.
665 % |\addvspace| should be used only in vertical mode, and gives an
666 % error if it's not. The |\addvspace| command does \emph{not} add
667 % vertical space if |@minipage| is true. The minipage environment uses
668 % this to inhibit the addition of extra vertical space at the beginning.
670 % Penalties are put into the vertical list with the
671 % |\addpenalty|\marg{penalty}
672 % command. It works properly when |\addpenalty| and |\addvspace|
673 % commands are mixed.
675 % The |@nobreak| switch is set true used when in vertical mode and no
676 % page break should occur. (Right now, it is used only by the section
677 % heading commands to inhibit page breaking after a heading.)
681 % \addvspace{SKIP} ==
685 % else if \lastskip =0
687 % else if \lastskip < SKIP
688 % then \vskip -\lastskip
690 % else if SKIP < 0 and \lastskip >= 0
691 % then \vskip -\lastskip
692 % \vskip \lastskip + SKIP
694 % else useful error message (CAR).
699 % \begin{macro}{\@xaddvskip}
700 % Internal macro for |\vspace| handling the case that space has
701 % previously been added.
704 \ifdim\lastskip<\@tempskipb
708 \ifdim\@tempskipb<\z@
711 \advance\@tempskipb\lastskip
721 % \begin{macro}{\addvspace}
722 % \changes{v1.2b}{1994/11/12}{Corrected error message}
723 % \changes{v1.2c}{1994/11/13}{Recorrected error message}
724 % Add vertical space taking into account space already added, as
730 \ifdim \lastskip =\z@
743 % \begin{macro}{\addpenalty}
744 % \changes{v1.2b}{1994/11/12}{Corrected error message}
745 % \changes{v1.2c}{1994/11/13}{Recorrected error message}
746 % \changes{v1.1h}{2015/01/09}{Donald Arseneau's fix from PR/377703 (latexrelease)}
749 %<latexrelease>\IncludeInRelease{2015/01/01}%
750 %<latexrelease> {\addpenalty}{\addpenalty}%
751 %<*2ekernel|latexrelease>
753 % Fix provided by Donald (though the original fix was not good
754 % enough). In 2005 Plamen Tanovski discovered that this fix wasn't
755 % good enough either as the \cs{vskip} kept getting bigger if
756 % several \cs{addpenalty} commands followed each other. Donald
757 % kindly send a new fix.
770 % We have to make sure the final \cs{vskip} seen by \TeX\ is the
771 % correct one, namely \cs{@tempskipb}. However we may have to
772 % adjust for \cs{prevdepth} when placing the penalty but that
773 % should not affect the skip we pass on to \TeX.
774 % \changes{v1.3e}{2015/01/14}{Avoid adding redundant skips (DPC)}
777 \@tempskipa\@tempskipb
779 \ifdim\prevdepth>\maxdepth\maxdepth\else
781 % If |\prevdepth| is -1000pt due to |\nointerlineskip| we better
784 \ifdim \prevdepth = -\@m\p@ \z@ \else \prevdepth \fi
788 \ifdim\@tempskipa=\@tempskipb
790 % Do nothing if the |\prevdepth| check made no adjustment.
794 % Combine the prevdepth adjustment into a single skip.
796 \advance\@tempskipb -\@tempskipa
800 % The final skip is always the specified length.
813 %</2ekernel|latexrelease>
814 %<latexrelease>\EndIncludeInRelease
815 %<latexrelease>\IncludeInRelease{0000/00/00}%
816 %<latexrelease> {\addpenalty}{\addpenalty}%
817 %<latexrelease>\def\addpenalty#1{%
818 %<latexrelease> \ifvmode
819 %<latexrelease> \if@minipage
820 %<latexrelease> \else
821 %<latexrelease> \if@nobreak
822 %<latexrelease> \else
823 %<latexrelease> \ifdim\lastskip=\z@
824 %<latexrelease> \penalty#1\relax
825 %<latexrelease> \else
826 %<latexrelease> \@tempskipb\lastskip
827 %<latexrelease> \vskip -\lastskip
828 %<latexrelease> \penalty#1%
829 %<latexrelease> \vskip\@tempskipb
833 %<latexrelease> \else
834 %<latexrelease> \@noitemerr
835 %<latexrelease> \fi}%
836 %<latexrelease>\EndIncludeInRelease
841 % \begin{macro}{\vspace}
842 % \changes{v1.2m}{1996/01/20}{Made robust}
843 % \begin{macro}{\@vspace}
844 % \begin{macro}{\@vspacer}
845 % \changes{v1.2f}{1995/05/25}
846 % {(CAR) macros modified to be more efficient}
847 % \changes{v1.2f}{1995/05/25}{(CAR) \cs{@restorepar} added to avoid
848 % possible infinite tail recursion caused by a typo in the argument.}
849 % The new code for these commands depends on the following facts:
851 % \item The value of prevdepth is changed only when a box or rule
852 % is created and added to a vertical list;
853 % \item The value of prevdepth is used only when a box is created
854 % and added to a vertical list;
855 % \item The value of prevdepth is always local to the building of
859 \DeclareRobustCommand\vspace{\@ifstar\@vspacer\@vspace}
866 \vadjust{\@restorepar
885 \vadjust{\@restorepar
897 % \begin{macro}{\smallskip}
898 % \begin{macro}{\medskip}
899 % \begin{macro}{\bigskip}
901 \def\smallskip{\vspace\smallskipamount}
902 \def\medskip{\vspace\medskipamount}
903 \def\bigskip{\vspace\bigskipamount}
909 % \begin{macro}{\smallskipamount}
910 % \begin{macro}{\medskipamount}
911 % \begin{macro}{\bigskipamount}
913 \newskip\smallskipamount \smallskipamount=3pt plus 1pt minus 1pt
914 \newskip\medskipamount \medskipamount =6pt plus 2pt minus 2pt
915 \newskip\bigskipamount \bigskipamount =12pt plus 4pt minus 4pt
923 % \subsection{Horizontal space (and breaks)}
925 % \begin{macro}{\nobreakdashes}
926 % \changes{v1.3}{2004/02/04}{(Macro added}
927 % \changes{v1.3a}{2004/02/15}{(Added spacefactor setting}
928 % This idea is borrowed from the \textsf{amsmath} package but
929 % here we define a robust command.
931 % This command is a low-level command designed for use only before
932 % hyphens or dashes (such as |-|, |--|, or |---|).
934 % It could probably be better implemented: it may need its own
935 % private token register and temporary command.
937 % Setting the hyphen in a box and then unboxing it means that the
938 % normal penalty will not be added after it---and if the penalty is
939 % not there a break will not be taken (unless an explicit penalty
940 % or glue follows, thus the final \verb=\nobreak=).
942 % Note that even if it is not followed by a `-', it still leaves
943 % vmode and sets the spacefactor; so use it carefully!
946 \DeclareRobustCommand{\nobreakdashes}{%
949 \def\reserved@a##1{\toks@\expandafter{\the\toks@-}%
950 \futurelet\@let@token \reserved@b}%
951 \def\reserved@b {\ifx\@let@token -%
952 \expandafter\reserved@a
954 \setbox\z@ \hbox{\the\toks@\nobreak}%
956 \spacefactor\sfcode`\-
958 \futurelet\@let@token \reserved@b
963 % \begin{macro}{\nobreakspace}
964 % \changes{v1.2k}{1995/12/04}{(Macro added}
965 % \begin{macro}{\@xobeysp}
966 % \changes{v1.2t}{1996/09/28}{Moved from ltmiscen.dtx and redefined to
967 % use \cs{nobreakspace }}
969 % This is a robust command that produces a horizontal space at
970 % which, in paragraph-mode, a line-break is not possible. We then
971 % define an active |~| to expand to it since this is the documented
972 % behaviour of |~|. One reason for introducing this is that some
973 % 8-bit input encodings have a slot for such a space and we do not
974 % want to use active characters as the \LaTeX{} internal commands.
976 % The braces in the definition of |~| are needed to ensure that a
977 % following space is preserved when reading to/from internal files.
978 % \changes{v1.2l}{1995/12/04}{(braces added to definition of tilde}
980 % We need to keep \cs{@xobeysp} as it is widely used; so here it is
981 % let to the non-robust command \cs{nobreakspace }.
984 \DeclareRobustCommand{\nobreakspace}{%
985 \leavevmode\nobreak\ }
987 \def~{\nobreakspace{}}
988 \expandafter\let\expandafter\@xobeysp\csname nobreakspace \endcsname
998 % Used in paragraph mode produces a |\thinspace|. It has the
999 % ordinary definition in math mode. Useful for quotes inside quotes,
1000 % as in |``\,`Foo', he said.''|
1001 % \changes{v1.0o}{1994/05/11}{Use \cs{DeclareRobustCommand}. ASAJ.}
1003 \DeclareRobustCommand{\,}{%
1004 \relax\ifmmode\mskip\thinmuskip\else\thinspace\fi
1010 % Placed before a '.', makes it a sentence-ending period. Does the
1011 % right thing for other punctuation marks as well. Does this by
1012 % setting spacefactor to 1000.
1013 % \changes{v1.3b}{2014/12/30}{\cs{@} discards spaces when moving
1014 % (pr3039)(latexrelease)}
1017 %<latexrelease>\IncludeInRelease{2015/01/01}%
1018 %<latexrelease> {\@}{Space after \@}%
1019 %<*2ekernel|latexrelease>
1022 \def\@{\spacefactor\@m{}}%
1023 %</2ekernel|latexrelease>
1024 %<latexrelease>\EndIncludeInRelease
1025 %<latexrelease>\IncludeInRelease{0000/00/00}%
1026 %<latexrelease> {\@}{Space after \@}%
1027 %<latexrelease>\def\@{\spacefactor\@m}%
1028 %<latexrelease>\EndIncludeInRelease
1034 % \begin{macro}{\hspace}
1035 % \changes{v1.0o}{1994/05/11}{Use \cs{DeclareRobustCommand}. ASAJ.}
1037 \DeclareRobustCommand\hspace{\@ifstar\@hspacer\@hspace}
1041 % \begin{macro}{\@hspace}
1042 % \changes{LaTeX2e}{1993/08/05}
1043 % {(RmS) Removed superfluous \cs{leavevmode} in \cs{@hspace} and
1044 % \cs{@hspacer}, as suggested by CAR.}
1046 \def\@hspace#1{\hskip #1\relax}
1051 % \begin{macro}{\@hspacer}
1052 % extra |\hskip 0pt| added 1985/17/12 to guard
1053 % against a following |\unskip|
1054 % |\relax| added 13 Oct 88 for usual \TeX\ lossage
1055 % replaced both changes by |\hskip\z@skip| 27 Nov 91
1057 \def\@hspacer#1{\vrule \@width\z@\nobreak
1058 \hskip #1\hskip \z@skip}
1064 % \begin{macro}{\fill}
1067 \fill = 0pt plus 1fill
1073 % \begin{macro}{\stretch}
1075 \def\stretch#1{\z@ \@plus #1fill\relax}
1082 % \begin{macro}{\thinspace}
1083 % \begin{macro}{\negthinspace}
1084 % \begin{macro}{\enspace}
1086 \def\thinspace{\kern .16667em }
1087 \def\negthinspace{\kern-.16667em }
1088 \def\enspace{\kern.5em }
1094 % \begin{macro}{\enskip}
1095 % \begin{macro}{\quad}
1096 % \begin{macro}{\qquad}
1098 \def\enskip{\hskip.5em\relax}
1099 \def\quad{\hskip1em\relax}
1100 \def\qquad{\hskip2em\relax}
1106 % \begin{macro}{\obeycr}
1107 % \begin{macro}{\restorecr}
1108 % The following definitions will probably get deleted or moved to
1109 % compatibility mode soon.
1111 % \changes{v1.2g}{1995/06/11}
1112 % {(CAR) \cs{relax} added to stop silent eating of *.}
1114 {\catcode`\^^M=13 \gdef\obeycr{\catcode`\^^M13 \def^^M{\\\relax}%
1116 {\catcode`\^^M=13 \gdef\@gobblecr{\@ifnextchar
1117 \@gobble\ignorespaces}}
1118 \gdef\restorecr{\catcode`\^^M5 }}