summaryrefslogtreecommitdiff
path: root/macros/latex/base/ltspace.dtx
blob: 1a672c6455dd67e6ffd674f417eca225730bb33e (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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
% \iffalse meta-comment
%
% Copyright (C) 1993-2020
% The LaTeX3 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: ltspace.dtx
%<*driver>
% \fi
\ProvidesFile{ltspace.dtx}
             [2020/05/06 v1.3n LaTeX Kernel (spacing)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltspace.dtx}
\title{\filename}
\date{\filedate}
 \author{%
  Johannes Braams\and
  David Carlisle\and
  Alan Jeffrey\and
  Leslie Lamport\and
  Frank Mittelbach\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.2f}{1995/05/25}{Macros moved to ltlists.dtx}
% \changes{v1.2n}{1996/04/22}{Documentation Improvements}
% \changes{v1.2o}{1996/06/22}{Documentation of problems added}
% \changes{v1.2q}{1996/07/27}{Further documentation of problems}
% \changes{v1.2r}{1996/07/27}{Correct documentation of problems}
% \changes{v1.2w}{1998/08/17}{Documentation fixes.}
% \changes{v1.3j}{2019/08/27}{Make various commands robust}
% \changes{v1.3l}{2020/03/07}{Moved \cs{thinspace}, \cs{negthinspace}
%    and  \cs{,} to ltmath.dtx (gh/303)}
%
%
% \section{Spacing}
%
% This section deals with spacing, and line- and page-breaking.
%
% \subsection{User Commands}
%
% \DescribeMacro\nopagebreak\oarg{i} : \meta{i} = 0,...,4.
%
% Default argument = 4.  Puts a penalty into the vertical list
% output as follows:\\
%                   0 : penalty = 0\\
%                   1 : penalty = |\@lowpenalty|\\
%                   2 : penalty = |\@medpenalty|\\
%                   3 : penalty = |\@highpenalty|\\
%                   4 : penalty = 10000
%
% \DescribeMacro\pagebreak\oarg{i} :
%          same as \nopagebreak except negatives of its penalty
%
% \DescribeMacro\linebreak\oarg{i} : analog of the above
%
% \DescribeMacro\nolinebreak\oarg{i} : analog of the above
%
% \DescribeMacro\samepage :
% inhibits page breaking most places by setting the
% following penalties to 10000:\\
%                    |\interlinepenalty|\\
%                    |\postdisplaypenalty|\\
%                    |\interdisplaylinepenalty|\\
%                    |\@beginparpenalty|\\
%                    |\@endparpenalty|\\
%                    |\@itempenalty|\\
%                    |\@secpenalty|\\
%                    |\interfootnotelinepenalty|
%
% \DescribeMacro{\\}         : initially defined to be |\newline|
%
% |\\|\oarg{length} : initially defined to be
%              |\vspace|\marg{length}|\newline|\\
%              Note: |\\*| adds a |\vadjust{\penalty 10000}|
%
% OBSOLETE COMMANDS (which never made it into the manual):
%
% |\obeycr|    : defines <CR> == |\\\relax|\\
% |\restorecr| : restores <CR> to its usual meaning.
%
%
% \StopEventually{}
%
% \subsection{Chris' comments}
%
% There are several aspects of the handling of space in horizontal
% mode that are inconsistent or do not work well in some cases.
% These are largely concerned with ignoring the effect of space
% tokens that would otherwise typeset an inter-word space.
%
% Negating the effect of such space tokens is achieved by two
% mechanisms:
% \begin{itemize}
% \item |\unskip| is used to remove the glue just added by
% a space that has already had its effect; it is sometimes
% invoked after an |\ifdim| test on |\lastskip| (see below);
% \item |\ignorespaces| is used to ignore space-tokens yet to come.
% \end{itemize}
%
% The test done on |\lastskip| is sometimes for equality with zero and
% sometimes for being positive.  Recall also that the test is only on
% the natural length of the glue and that no glue cannot be
% distinguished from glue whose natural length is zero: to summarise,
% a pretty awful test.  It is not clear why these tests are not all
% the same; I think that they should all be for equality.  One place
% where |\unskip| is often used is just before a |\par| (which itself
% internally does an |\unskip|) and one bit of code (in |\@item|) even
% has two |\unskips| before a |\par|.  These uses may be fossil code
% but if they are necessary, maybe |\@killglue| would be even safer.
%
% Such removal of glue by |\unskip| may sometimes have the wrong result,
% removing not the glue from a space-token but other explicit glue;
% this is sometimes not what is intended.
%
% A common way to prevent such removal is to add an |\hskip\z@| after
% the glue that should not be removed.  This protects that glue
% against one |\unskip| with no test but not against more than one.
% It does work for `tested |\unskip|s'.   This is used
% by |\hspace*| but not by |\hspace|; this is inconsistent as the star
% is supposed to prevent removal only at the beginning of a line, not
% at the end, or in a tabular, etc.
%
% If this reason for removing glue were the only consideration then a
% tested-|\unskip| and protection by |\hskip\z@| would suffice but
% would need to be consistently implemented.
%
% However, the class of invisibles, commands and environments tries to
% be even cleverer: one of these tries to leave only one inter-word
% space whenever there is one before it and one after it; and it does
% this quite well.
%
% But problems can arise when there is not a space-token on
% both sides of it; in particular, when an invisible appears at the
% beginning or end of a piece of text the method still leaves one space
% token whereas usually in these cases it should leave none.
%
% Also, the current rules do not work well when more than one such
% command appears consecutively, separated by space-tokens; it leaves
% glue between every other invisible.
%
% There is also a question about what these commands should do when
% they occur next to spaces that do not come from space tokens but,
% for example, from |\hspace|.  Should they still produce `just one
% space'?  If so, which one?  It is good to note that the manual
% is sufficiently cautious about invisibles that we are not obliged to
% make anything work.
%
% Another interesting side-road to explore is whether the space-tokens
% either side of an |\hspace{...}| should be ignored.
%
% One alternative to the current algorithm that is often suggested is
% that all glue around the invisible  should be consolidated into a
% space after it (usually without stating how much glue should be put
% there).  The command |\nolinebreak| is implemented this way (and
% |\linebreak| should also be). This does not work correctly for the
% following common case:
% \begin{verbatim}
%   ... some text
%   \index{some-word}
%   some-word and more text.
% \end{verbatim}
% This is optimal coding since it is normal to index a word that gets
% split across a page-break on its starting page.  This would, on the
% other hand, fix another common (and documented) failure of the
% current system: when the invisible is the last thing in a paragraph
% the space before it is not removed and, worse, it is also hidden
% from the paragraph-ending mechanism so that an `empty' line can be
% created at the end of the paragraph.
%
% Another deficiency (I think) of the current system is that the
% following is treated as having the |\index| command between the
% paragraphs, which is probably not what the author intended (since
% there is no empty line after it).
% \begin{verbatim}
%
%   \index{beginnings}
%   Beginnings of paragraphs ...
% \end{verbatim}
%
% I know of no algorithm that will handle satisfactorily even
% all the most common cases; note that it could be that the best
% algorithm may be different for different invisibles since,
% for example, the common uses and expected behaviour of
% |\index|, |\marginpar|, |\linebreak|, |\pagebreak| and
% |\vspace| are somewhat different.  [For example, is
% |\vspace| ever used in the middle of a paragraph?]
%
% One method that can (and is) used to make invisible commands produce
% no space when used at the beginning of text is to put in some glue
% that is nearly enough the same as no glue or glue of zero length in
% all respects except for the precise test for not being exactly equal
% to zero; examples of such glue are |\hskip 1sp| and, possibly better
% but more complex, |\hskip -1sp \hskip 1sp|.  However, this only works
% when it is known that user-supplied text is about to start.
%
% Some similar concerns apply to the handling of space and penalties
% in vertical mode; there is an extra hurdle here as |\unskip| does
% not work on the main vertical list.  The complexity of the tests done
% by |\addvspace| have never been explained.
%
% The implementation of space hacks etc for vertical mode is another
% major area that needs further attention; my earlier experiments
% did not produce much improvement over the current unsatisfactory
% situation.
%
% One particular problem is what happens when the following very
% natural coding is used (part of the problem here is that this looks
% like an hmode problem, but it is not):
% \begin{verbatim}
%   ... end of text.
%
%   \begin{enumerate}
%     \item \label{item:xxx} Item text.
%   \end{enumerate}
% \end{verbatim}
%
% \subsection{Some immediate actions}
%
% \begin{itemize}
% \item Fix bug in |\linebreak|.
% \item Fix bug in |\\*|.
% \item Reimplement |\\|, etc, removing extra |\vadjust|s and getting
% better error trapping (this seems to involve a lot more tokens).
% \item Investigate whether |\\|, etc need to be errors in vmode; I
% think that they could be noops (maybe with a warning).
% \item Make all(?) |\unskips| include test for zero skip (rather than
%   other tests or no test).
% \item Consider replacing |\hskip 1sp| by something better (here
%   called an `infinitesimal' skip).
% \item Look at all |\hskip\z@| (or similar) to see if they should be
%   changed to an `infinitesimal' skip.
% \item Resolve the inconsistency between |\hspace| and |\hspace*|.
% \item Remove unnecessary |\unskips|.
% \item Investigate and rationalise the `newline' code.
% \item Find better algorithms for all sorts of things or, easier(?),
%   fix \TeX{} itself.
% \end{itemize}
%
% \subsection{The code}
%
%    \begin{macrocode}
%<*2ekernel>
\message{spacing,}
%    \end{macrocode}
%
%    \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2019/10/01}%
%<latexrelease>                 {\pagebreak}{Make commands robust}%
%    \end{macrocode}
%
%  \begin{macro}{\pagebreak}
%  \begin{macro}{\nopagebreak}
% \changes{v1.2h}{1995/07/05}{Reimplemented both using \cs{@no@pgbk}}
% \changes{v1.2j}{1995/10/16}{(DPC) Use \cs{@testopt} /1911}
%    \begin{macrocode}
\DeclareRobustCommand\pagebreak{\@testopt{\@no@pgbk-}4}
\DeclareRobustCommand\nopagebreak{\@testopt\@no@pgbk4}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%  \begin{macro}{\linebreak}
%  \begin{macro}{\nolinebreak}
% \changes{v1.2u}{1996/10/29}{Reimplemented both using \cs{@no@lnbk}}
% \changes{v1.2j}{1995/10/16}{(DPC) Use \cs{@testopt} /1911}
%    \begin{macrocode}
\DeclareRobustCommand\linebreak{\@testopt{\@no@lnbk-}4}
\DeclareRobustCommand\nolinebreak{\@testopt\@no@lnbk4}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%  \begin{macro}{\samepage}
%    \begin{macrocode}
\DeclareRobustCommand\samepage{\interlinepenalty\@M
   \postdisplaypenalty\@M
   \interdisplaylinepenalty\@M
   \@beginparpenalty\@M
   \@endparpenalty\@M
   \@itempenalty\@M
   \@secpenalty\@M
   \interfootnotelinepenalty\@M}
%    \end{macrocode}
%  \end{macro}
%
%    \begin{macrocode}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\pagebreak}{Make commands robust}%
%<latexrelease>
%<latexrelease>\kernel@make@fragile\pagebreak
%<latexrelease>\kernel@make@fragile\nopagebreak
%<latexrelease>\kernel@make@fragile\linebreak
%<latexrelease>\kernel@make@fragile\nolinebreak
%<latexrelease>\kernel@make@fragile\samepage
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
%
%
%
%  \begin{macro}{\@no@pgbk}
% \changes{v1.2h}{1995/07/05}{Macro replaces \cs{@pgbk}
%                 and \cs{@nopgbk}}
%    \begin{macrocode}
\def\@no@pgbk #1[#2]{%
  \ifvmode
    \penalty #1\@getpen{#2}%
  \else
    \@bsphack
    \vadjust{\penalty #1\@getpen{#2}}%
    \@esphack
  \fi}
%    \end{macrocode}
%  \end{macro}
%
%
%  \begin{macro}{\@no@lnbk}
% \changes{v1.2u}{1996/10/29}{Macro replaces \cs{@lnbk}
%                 and \cs{@nolnbk}}
%    \begin{macrocode}
\def\@no@lnbk #1[#2]{%
  \ifvmode
    \@nolnerr
  \else
    \@tempskipa\lastskip
    \unskip
    \penalty #1\@getpen{#2}%
    \ifdim\@tempskipa>\z@
      \hskip\@tempskipa
      \ignorespaces
    \fi
  \fi}
%    \end{macrocode}
%  \end{macro}
%
%
%  \begin{macro}{\\}
% \changes{v1.2a}{1994/11/11}{(DPC) Make robust}
% \changes{v1.2d}{1994/11/14}{(DPC) Macro modified}
%
% \changes{v1.2u}{1996/10/29}{Corrected and rationalised code}
% The purpose of the new code is to fix a few bugs; however, it also
% attempts to optimize the following, in order of priority:
%     \begin{enumerate}
%       \item efficient execution of plain |\\|;
%       \item efficient execution of |\\[...]|;
%       \item memory use;
%       \item name-space use.
%     \end{enumerate}
% The changes should make no difference to the typeset output.
% It appears to be safe to use |\reserved@e| and |\reserved@f| here
% (other reserved macros are somewhat disastrous).
%
% These changes made |\newline| even less robust than it had been,
% so now it is explicitly robust, like |\\|.
%  \begin{macro}{\@normalcr}
% The internal definition of the `normal' definition of |\\|.
% \changes{v1.3k}{2019/11/02}{Make also \cs{@normalcr} robust}
%    \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2020/02/02}%
%<latexrelease>                 {\@normalcr}{Make robust}%
\protected\def\@normalcr{%
  \let \reserved@e \relax
  \let \reserved@f \relax
  \@ifstar{\let \reserved@e \vadjust \let \reserved@f \nobreak
             \@xnewline}%
  \@xnewline}
%    \end{macrocode}
%
%    \begin{macrocode}
\let\\\@normalcr
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\@normalcr}{Make robust}%
%<latexrelease>
%<latexrelease>\DeclareRobustCommand\\{%
%<latexrelease>   \let \reserved@e \relax
%<latexrelease>   \let \reserved@f \relax
%<latexrelease>   \@ifstar{\let \reserved@e \vadjust \let \reserved@f \nobreak
%<latexrelease>             \@xnewline}%
%<latexrelease>  \@xnewline}
%<latexrelease>\expandafter\let\expandafter\@normalcr
%<latexrelease>     \csname\expandafter\@gobble\string\\ \endcsname
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%
%
% \begin{macro}{\@vspace@calcify}
%    Helper command to produce a \cs{vskip} that is first run through
%    \cs{setlength}. This way the \texttt{calc} package can operate on
%    the argument value.
% \changes{v1.3m}{2020/04/21}{Support calc syntax (gh/152)}
%    \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2020/10/01}%
%<latexrelease>                 {\@vspace@calcify}{Add calc support}%
\def\@vspace@calcify#1{\begingroup\setlength\skip@{#1}\vskip\skip@\endgroup}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%    \end{macrocode}
%    
%    \begin{macrocode}
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\@vspace@calcify}{Add calc support}%
%<latexrelease>
%<latexrelease>\let\@vspace@calcify\@undefined
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
% \end{macro}
%    
%


%  \begin{macro}{\newline}
% A simple form of the `normal' definition of |\\|.
% \changes{v1.2v}{1997/05/07}{Made completely robust.}
%    \begin{macrocode}
\DeclareRobustCommand\newline{\@normalcr\relax}
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\@xnewline}
%    \begin{macrocode}
\def\@xnewline{\@ifnextchar[% ] bracket matching
                  \@newline
                 {\@gnewline\relax}}
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\@newline}
% \changes{v1.3m}{2020/04/21}{Support calc syntax (gh/152)}
%    \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2020/10/01}%
%<latexrelease>                 {\@newline}{\newline calc support}%
\def\@newline[#1]{\let \reserved@e \vadjust
                   \@gnewline {\@vspace@calcify{#1}}}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%    \end{macrocode}
%    
%    \begin{macrocode}
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\@newline}{\newline calc support}%
%<latexrelease>
%<latexrelease>\def\@newline[#1]{\let \reserved@e \vadjust
%<latexrelease>                   \@gnewline {\vskip #1}}
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
%  \end{macro}
%
%
%
%  \begin{macro}{\@gnewline}
% \changes{v1.2u}{1996/10/29}{Added macro}
% The |\nobreak| added to prevent null lines when |\\|
% ends an overfull line.  Change made 24 May 89 as suggested by
% Frank Mittelbach and Rainer Sch\"opf
% \changes{v1.2h}{1995/07/05}{Use \cs{break}}
%    \begin{macrocode}
\def\@gnewline #1{%
  \ifvmode
    \@nolnerr
  \else
    \unskip \reserved@e {\reserved@f#1}\nobreak \hfil \break
  \fi}
%    \end{macrocode}
%  \end{macro}
%
%
% \begin{macro}{\@getpen}
%    \begin{macrocode}
\def\@getpen#1{\ifcase #1 \z@ \or \@lowpenalty\or
         \@medpenalty \or \@highpenalty
         \else \@M \fi}
%    \end{macrocode}
%  \end{macro}
%
%
% \begin{macro}{\if@nobreak}
% \changes{v1.2p}{1996/07/26}{put \cs{global} inside definition}
% Switch used to avoid page breaks caused by |\label| after a
%      section heading, etc. It should be \textbf{GLOBALLY} set true
%      after the  |\nobreak| and \textbf{globally} set false by the
%      next invocation of |\everypar|.
%
%      Commands that reset |\everypar| should globally set it false if
%      appropriate.
%    \begin{macrocode}
\def\@nobreakfalse{\global\let\if@nobreak\iffalse}
\def\@nobreaktrue {\global\let\if@nobreak\iftrue}
\@nobreakfalse
%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\@savsk}
% \begin{macro}{\@savsf}
% Registers used to save the space factor and last skip.
%    \begin{macrocode}
\newdimen\@savsk
\newcount\@savsf
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
%
%
%  \begin{macro}{\@bsphack}
% \changes{LaTeX2e}{1993/12/08}
%         {Command reimplemented; late birthday present for Chris}
% \changes{LaTeX2e}{1993/12/08}{Command reimplemented}
% \changes{LaTeX2e}{1993/12/16}{Corrected optimisation :-)}
%  |\@bsphack| and |\@esphack|
%  used by macros such as |\index| and
% |\begin{@float}| \ldots |\end{@float}|
%  that want to be invisible --- i.e.,
%  not leave any extra space when used in the middle of text.  Such
%  a macro should begin with |\@bsphack| and end with |\@esphack|.
%  The macro in question should not create any text, nor change the
%  mode.
%
% Before giving the current definition we give an extended definition
% that is currently not used (because it doesn't work as advertised:-)
%
%    These are generalised hacks which attempt to do sensible things
%    when `invisible commands' appear in vmode too.
%
%    They need to cope with space in both hmode (plus spacefactor) and
%    vmode, and also cope with breaks etc.  In vmode this means
%    ensuring that any following |\addvspace|, etc sees the correct
%    glue in |\lastskip|.
%
%    In fact, these improved versions should be used for other cases
%    of `whatsits, thingies etc' which should be invisible.  They are
%    only for commands, not environments (see notes on |\@Esphack|).
%
%    BTW, anyone know why the standard hacks are surrounded by
%    |\ifmmode\else| rather than simply |\ifhmode|?
%
%    And are there any cases where saving the spacefactor is
%    essential?  I have some extensions where it is, but it does not
%    appear to be so in the standard uses.
%\begin{verbatim}
%\def \@bsphack{%
%  \relax \ifvmode
%    \@savsk \lastskip
%    \ifdim \lastskip=\z@
%    \else
%      \vskip -\lastskip
%    \fi
%  \else
%    \ifhmode
%      \@savsk \lastskip
%      \@savsf \spacefactor
%    \fi
%  \fi
%}
%\end{verbatim}
%    I think that, in vmode, it is the safest to put
%    in a |\nobreak| immediately after such things since writes,
%    inserts etc followed by glue give valid breakpoints and, in
%    general, it is possible to create breaks but impossible to
%    destroy them.
%\begin{verbatim}
%\def \@esphack{%
%   \relax \ifvmode
%     \nobreak
%     \ifdim \@savsk=\z@
%     \else
%       \vskip\@savsk
%     \fi
%   \else
%     \ifhmode
%       \spacefactor \@savsf
%       \ifdim \@savsk>\z@
%         \ignorespaces
%       \fi
%     \fi
%   \fi
%}
%\end{verbatim}
%    For the moment we are going to ignore the vertical versions until
%    they are correct.
% \changes{LaTeX2e}{1993/12/19}{There seem to be problems with selfmade
%                           birthday presents}
%    \begin{macrocode}
\def\@bsphack{%
  \relax
  \ifhmode
    \@savsk\lastskip
    \@savsf\spacefactor
  \fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@esphack}
%   Companion to |\@bsphack|.  If this command is not properly paired
%   with |\@bsphack| one might end up with a low-level \TeX{} error:
%   ``BAD spacefactor''. One possible cause is calling |\@bsphack| in
%   vertical mode, then doing something that gets you (sometimes) into
%   horizontal mode and finally calling |\@esphack|. Even if no error
%   is generated that is wrong, because |\@esphack| will then use the
%   saved values for |\@savsk| and |\@savsf| from some earlier
%   invocation of |\@bsphack| which will have nothing to do with the
%   current situation.
% \changes{v1.3d}{2015/01/11}{Allow hyphenation (Donald Arseneau pr/3498) (latexrelease)}
%    \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2018/10/10}%
%<latexrelease>                 {\@esphack}{hyphenation and nobreak after space hack}%
%<*2ekernel|latexrelease>
\def\@esphack{%
  \relax
  \ifhmode
    \spacefactor\@savsf
    \ifdim\@savsk>\z@
%    \end{macrocode}
% \changes{v1.3f}{2015/11/07}
%         {Only space if there is no space at the end of the hlist latex/4443}
%    \begin{macrocode}
      \ifdim\lastskip=\z@
        \nobreak \hskip\z@skip
      \fi
      \ignorespaces
    \fi
%    \end{macrocode}
% \changes{v1.3i}{2018/10/10}
%         {Don't introduce breakpoints if @nobreak is true and after sections}
%    \begin{macrocode}
  \else
    \ifvmode
      \if@nobreak\nobreak\else\if@noskipsec\nobreak\fi\fi
    \fi
%    \end{macrocode}
%
%    \begin{macrocode}
  \fi}%
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{2015/10/01}%
%<latexrelease>                 {\@esphack}{hyphenation and nobreak after space hack}%
%<latexrelease>\def\@esphack{%
%<latexrelease>  \relax
%<latexrelease>  \ifhmode
%<latexrelease>    \spacefactor\@savsf
%<latexrelease>    \ifdim\@savsk>\z@
%<latexrelease>      \ifdim\lastskip=\z@
%<latexrelease>        \nobreak \hskip\z@skip
%<latexrelease>      \fi
%<latexrelease>      \ignorespaces
%<latexrelease>    \fi
%<latexrelease>  \fi}%
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{2015/01/01}%
%<latexrelease>                 {\@esphack}{hyphenation and nobreak after space hack}%
%<latexrelease>\def\@esphack{%
%<latexrelease>  \relax
%<latexrelease>  \ifhmode
%<latexrelease>    \spacefactor\@savsf
%<latexrelease>    \ifdim\@savsk>\z@
%<latexrelease>      \nobreak \hskip\z@skip
%<latexrelease>      \ignorespaces
%<latexrelease>    \fi
%<latexrelease>  \fi}%
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\@esphack}{hyphenation and nobreak after space hack}%
%<latexrelease>\def\@esphack{%
%<latexrelease>  \relax
%<latexrelease>  \ifhmode
%<latexrelease>    \spacefactor\@savsf
%<latexrelease>    \ifdim\@savsk>\z@
%<latexrelease>      \ignorespaces
%<latexrelease>    \fi
%<latexrelease>  \fi}%
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@Esphack}
% A variant of |\@esphack| that sets the |@ignore| switch to
%     true (as |\@esphack| used to do previously).
% This is currently used only for floats and similar environments.
% \changes{v1.2s}{1996/08/02}{Remove \cs{global} before \cs{@ignore...}}
% \changes{v1.3d}{2015/01/11}{Allow hyphenation (Donald Arseneau pr/3498) (latexrelease)}w
%    \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2015/01/01}%
%<latexrelease>                 {\@Esphack}{hyphenation after space hack}%
%<*2ekernel|latexrelease>
\def\@Esphack{%
  \relax
  \ifhmode
    \spacefactor\@savsf
    \ifdim\@savsk>\z@
      \nobreak \hskip\z@skip
      \@ignoretrue
      \ignorespaces
    \fi
   \fi}%
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\@Esphack}{hyphenation after space hack}%
%<latexrelease>\def\@Esphack{%
%<latexrelease>  \relax
%<latexrelease>  \ifhmode
%<latexrelease>    \spacefactor\@savsf
%<latexrelease>    \ifdim\@savsk>\z@
%<latexrelease>      \@ignoretrue
%<latexrelease>      \ignorespaces
%<latexrelease>    \fi
%<latexrelease>   \fi}%
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
%  \end{macro}
%
%
%  \begin{macro}{\@vbsphack}
% \changes{LaTeX2e}{1993/12/08}{Command added}
%    Another variant which is useful for invisible things which should
%    not live in vmode (this is how some people feel about marginals).
%
%    If it occurs in vmode then it enters hmode and ensures that
%    |\@savsk| is nonzero so that the |\ignorespaces| is put in later.
%    It is not used at present.
% \changes{v1.2f}{1995/05/25}{(CAR) not used so `removed'.}
%\begin{verbatim}
% \def \@vbsphack{ %
%    \relax \ifvmode
%      \leavevmode
%      \@savsk 1sp
%      \@savsf \spacefactor
%    \else
%      \ifhmode
%        \@savsk \lastskip
%        \@savsf \spacefactor
%      \fi
%    \fi
% }
%\end{verbatim}
%  \end{macro}
%
%
% \subsection{Vertical spacing}
%
%
% \LaTeX\ supports the plain \TeX\ commands
% |\smallskip|, |\medskip| and |\bigskip|.
% However, it redefines them using |\vspace| instead of |\vskip|.
%
% Extra vertical space is added by the command
% |\addvspace|\marg{skip},
% which adds a vertical skip of \meta{skip} to the document.
% The sequence\\
%         |\addvspace|\marg{s1} |\addvspace|\marg{s2}
% is equivalent to\\
%         |\addvspace|\marg{maximum of s1, s2}.
%
% |\addvspace| should be used only in vertical mode, and gives an
% error if it's not.  The |\addvspace| command does \emph{not} add
% vertical space if |@minipage| is true. The minipage environment uses
% this to inhibit the addition of extra vertical space at the beginning.
%
% Penalties are put into the vertical list with the
% |\addpenalty|\marg{penalty}
% command.  It works properly when |\addpenalty| and |\addvspace|
% commands are mixed.
%
% The |@nobreak| switch is set true used when in vertical mode and no
% page break should occur.  (Right now, it is used only by the section
% heading commands to inhibit page breaking after a heading.)
%
%
%\begin{verbatim}
% \addvspace{SKIP} ==
%  BEGIN
%   if vmode
%     then if @minipage
%            else if \lastskip =0
%                    then  \vskip SKIP
%                    else  if \lastskip < SKIP
%                             then  \vskip -\lastskip
%                                   \vskip SKIP
%                             else if SKIP < 0 and \lastskip >= 0
%                                    then \vskip -\lastskip
%                                         \vskip \lastskip + SKIP
%          fi      fi       fi      fi
%     else useful error message (CAR).
%   fi
%  END
%\end{verbatim}
%
% \begin{macro}{\@xaddvskip}
% Internal macro for |\vspace| handling the case that space has
% previously been added.
%    \begin{macrocode}
\def\@xaddvskip{%
  \ifdim\lastskip<\@tempskipb
    \vskip-\lastskip
    \vskip\@tempskipb
  \else
    \ifdim\@tempskipb<\z@
      \ifdim\lastskip<\z@
      \else
        \advance\@tempskipb\lastskip
        \vskip-\lastskip
        \vskip \@tempskipb
      \fi
    \fi
  \fi}
%    \end{macrocode}
% \end{macro}
%
%
%  \begin{macro}{\addvspace}
% \changes{v1.2b}{1994/11/12}{Corrected error message}
% \changes{v1.2c}{1994/11/13}{Recorrected error message}
%  Add vertical space taking into account space already added, as
%  described above.
% \changes{v1.3m}{2020/04/21}{Support calc syntax (gh/152)}
%    \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2020/10/01}%
%<latexrelease>                 {\addvspace}{\addvspace calc support}%
\def\addvspace#1{%
  \ifvmode
     \if@minipage\else
       \ifdim \lastskip =\z@
         \@vspace@calcify{#1}%
       \else
       \setlength\@tempskipb{#1}%
         \@xaddvskip
       \fi
     \fi
  \else
    \@noitemerr
  \fi}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%    \end{macrocode}
%    
%    \begin{macrocode}
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\addvspace}{\addvspace calc support}%
%<latexrelease>
%<latexrelease>\def\addvspace#1{%
%<latexrelease>  \ifvmode
%<latexrelease>     \if@minipage\else
%<latexrelease>       \ifdim \lastskip =\z@
%<latexrelease>         \vskip #1\relax
%<latexrelease>       \else
%<latexrelease>       \@tempskipb#1\relax
%<latexrelease>         \@xaddvskip
%<latexrelease>       \fi
%<latexrelease>     \fi
%<latexrelease>  \else
%<latexrelease>    \@noitemerr
%<latexrelease>  \fi}
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\addpenalty}
% \changes{v1.2b}{1994/11/12}{Corrected error message}
% \changes{v1.2c}{1994/11/13}{Recorrected error message}
% \changes{v1.1h}{2015/01/09}{Donald Arseneau's fix from PR/377703 (latexrelease)}
%    \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2015/01/01}%
%<latexrelease>                 {\addpenalty}{\addpenalty}%
%<*2ekernel|latexrelease>
%    \end{macrocode}
%   Fix provided by Donald (though the original fix was not good
%   enough).  In 2005 Plamen Tanovski discovered that this fix wasn't
%   good enough either as the \cs{vskip} kept getting bigger if
%   several \cs{addpenalty} commands followed each other. Donald
%   kindly send a new fix.
%    \begin{macrocode}
\def\addpenalty#1{%
  \ifvmode
    \if@minipage
    \else
      \if@nobreak
      \else
        \ifdim\lastskip=\z@
          \penalty#1\relax
        \else
          \@tempskipb\lastskip
%    \end{macrocode}
%    We have to make sure the final \cs{vskip} seen by \TeX\ is the
%    correct one, namely \cs{@tempskipb}. However we may have to
%    adjust for \cs{prevdepth} when placing the penalty but that
%    should not affect the skip we pass on to \TeX.
% \changes{v1.3e}{2015/01/14}{Avoid adding redundant skips (DPC)}
%    \begin{macrocode}
          \begingroup
            \@tempskipa\@tempskipb
            \advance \@tempskipb
              \ifdim\prevdepth>\maxdepth\maxdepth\else
%    \end{macrocode}
%    If |\prevdepth| is -1000pt due to |\nointerlineskip| we better
%    not add it!
%    \begin{macrocode}
                 \ifdim \prevdepth = -\@m\p@ \z@ \else \prevdepth \fi
               \fi
             \vskip -\@tempskipb
             \penalty#1%
             \ifdim\@tempskipa=\@tempskipb
%    \end{macrocode}
% Do nothing if the |\prevdepth| check made no adjustment.
%    \begin{macrocode}
             \else
%    \end{macrocode}
% Combine the prevdepth adjustment into a single skip.
%    \begin{macrocode}
               \advance\@tempskipb -\@tempskipa
               \vskip \@tempskipb
             \fi
%    \end{macrocode}
% The final skip is always the specified length.
%    \begin{macrocode}
             \vskip \@tempskipa
          \endgroup
        \fi
      \fi
    \fi
  \else
    \@noitemerr
  \fi}%
%    \end{macrocode}
%
%    \begin{macrocode}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\addpenalty}{\addpenalty}%
%<latexrelease>\def\addpenalty#1{%
%<latexrelease>  \ifvmode
%<latexrelease>    \if@minipage
%<latexrelease>    \else
%<latexrelease>      \if@nobreak
%<latexrelease>      \else
%<latexrelease>        \ifdim\lastskip=\z@
%<latexrelease>          \penalty#1\relax
%<latexrelease>        \else
%<latexrelease>          \@tempskipb\lastskip
%<latexrelease>          \vskip -\lastskip
%<latexrelease>          \penalty#1%
%<latexrelease>          \vskip\@tempskipb
%<latexrelease>        \fi
%<latexrelease>      \fi
%<latexrelease>    \fi
%<latexrelease>  \else
%<latexrelease>    \@noitemerr
%<latexrelease>  \fi}%
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
%  \end{macro}
%
%
%
% \begin{macro}{\vspace}
% \changes{v1.2m}{1996/01/20}{Made robust}
% \begin{macro}{\@vspace}
% \begin{macro}{\@vspacer}
% \changes{v1.2f}{1995/05/25}
%         {(CAR) macros modified to be more efficient}
% \changes{v1.2f}{1995/05/25}{(CAR) \cs{@restorepar} added to avoid
%   possible infinite tail recursion caused by a typo in the argument.}
%    The new code for these commands depends on the following facts:
%    \begin{itemize}
%      \item The value of prevdepth is changed only when a box or rule
%        is created and added to a vertical list;
%      \item The value of prevdepth is used only when a box is created
%        and added to a vertical list;
%      \item The value of prevdepth is always local to the building of
%        one vertical list.
%    \end{itemize}
%    \begin{macrocode}
\DeclareRobustCommand\vspace{\@ifstar\@vspacer\@vspace}
%    \end{macrocode}
%
%    \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2020/10/01}%
%<latexrelease>                 {\@vspace}{Support calc in \vspace}%
%    \end{macrocode}
%    We support calc syntax in the argument and therefore use \cs{setlength}.
% \changes{v1.3m}{2020/04/21}{Support calc syntax (gh/152)}
%    \begin{macrocode}
\def\@vspace #1{%
  \ifvmode
    \@vspace@calcify{#1}%
    \vskip\z@skip
   \else
     \@bsphack
     \vadjust{\@restorepar
              \@vspace@calcify{#1}%
              \vskip\z@skip
              }%
     \@esphack
   \fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@vspacer#1{%
  \ifvmode
    \dimen@\prevdepth
    \hrule \@height\z@
    \nobreak
    \@vspace@calcify{#1}%
    \vskip\z@skip
    \prevdepth\dimen@
  \else
    \@bsphack
    \vadjust{\@restorepar
             \hrule \@height\z@
             \nobreak
             \@vspace@calcify{#1}%
             \vskip\z@skip}%
    \@esphack
  \fi}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\@vspace}{Support calc in \vspace}%
%<latexrelease>
%<latexrelease>\def\@vspace #1{%
%<latexrelease>  \ifvmode
%<latexrelease>    \vskip #1
%<latexrelease>    \vskip\z@skip
%<latexrelease>   \else
%<latexrelease>     \@bsphack
%<latexrelease>     \vadjust{\@restorepar
%<latexrelease>              \vskip #1
%<latexrelease>              \vskip\z@skip
%<latexrelease>              }%
%<latexrelease>     \@esphack
%<latexrelease>   \fi}
%<latexrelease>\def\@vspacer#1{%
%<latexrelease>  \ifvmode
%<latexrelease>    \dimen@\prevdepth
%<latexrelease>    \hrule \@height\z@
%<latexrelease>    \nobreak
%<latexrelease>    \vskip #1
%<latexrelease>    \vskip\z@skip
%<latexrelease>    \prevdepth\dimen@
%<latexrelease>  \else
%<latexrelease>    \@bsphack
%<latexrelease>    \vadjust{\@restorepar
%<latexrelease>             \hrule \@height\z@
%<latexrelease>             \nobreak
%<latexrelease>             \vskip #1
%<latexrelease>             \vskip\z@skip}%
%<latexrelease>    \@esphack
%<latexrelease>  \fi}
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\smallskip}
% \begin{macro}{\medskip}
% \begin{macro}{\bigskip}
%    \begin{macrocode}
\def\smallskip{\vspace\smallskipamount}
\def\medskip{\vspace\medskipamount}
\def\bigskip{\vspace\bigskipamount}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\smallskipamount}
% \begin{macro}{\medskipamount}
% \begin{macro}{\bigskipamount}
%    \begin{macrocode}
\newskip\smallskipamount \smallskipamount=3pt plus 1pt minus 1pt
\newskip\medskipamount   \medskipamount  =6pt plus 2pt minus 2pt
\newskip\bigskipamount   \bigskipamount =12pt plus 4pt minus 4pt
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
%
% \subsection{Horizontal space (and breaks)}
%
% \begin{macro}{\nobreakdashes}
% \changes{v1.3}{2004/02/04}{(Macro added}
% \changes{v1.3a}{2004/02/15}{(Added spacefactor setting}
%    This idea is borrowed from the \textsf{amsmath} package but
%    here we define a robust command.
%
%    This command is a low-level command designed for use only before
%    hyphens or dashes (such as |-|, |--|, or |---|).
%
%    It could probably be better implemented: it may need its own
%    private token register and temporary command.
%
%    Setting the hyphen in a box and then unboxing it means that the
%    normal penalty will not be added after it---and if the penalty is
%    not there a break will not be taken (unless an explicit penalty
%    or glue follows, thus the final \verb=\nobreak=).
%
%    Note that even if it is not followed by a `-', it still leaves
%    vmode and sets the spacefactor; so use it carefully!
%
%    \begin{macrocode}
\DeclareRobustCommand{\nobreakdashes}{%
  \leavevmode
  \toks@{}%
  \def\reserved@a##1{\toks@\expandafter{\the\toks@-}%
                     \futurelet\@let@token \reserved@b}%
  \def\reserved@b   {\ifx\@let@token -%
                        \expandafter\reserved@a
                     \else
                       \setbox\z@ \hbox{\the\toks@\nobreak}%
                       \unhbox\z@
                       \spacefactor\sfcode`\-
                     \fi}%
  \futurelet\@let@token \reserved@b
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\nobreakspace}
% \changes{v1.2k}{1995/12/04}{(Macro added}
% \begin{macro}{\@xobeysp}
% \changes{v1.2t}{1996/09/28}{Moved from ltmiscen.dtx and redefined to
%                 use \cs{nobreakspace }}
%
%   This is a robust command that produces a horizontal space at
%   which, in paragraph-mode, a line-break is not possible.  We then
%   define an active |~| to expand to it since this is the documented
%   behaviour of |~|.  One reason for introducing this is that some
%   8-bit input encodings have a slot for such a space and we do not
%   want to use active characters as the \LaTeX{} internal commands.
%
%   The braces in the definition of |~| are needed to ensure that a
%   following space is preserved when reading to/from internal files.
% \changes{v1.2l}{1995/12/04}{(braces added to definition of tilde}
%
%   We need to keep \cs{@xobeysp} as it is widely used; so here it is
%   let to the non-robust command \cs{nobreakspace }.
%
%    \begin{macrocode}
\DeclareRobustCommand{\nobreakspace}{%
   \leavevmode\nobreak\ }
\catcode `\~=13
\def~{\nobreakspace{}}
\expandafter\let\expandafter\@xobeysp\csname nobreakspace \endcsname
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    \begin{macrocode}
%    \end{macrocode}
%
%
%
% \begin{macro}{\@}
%     Placed before a '.', makes it a sentence-ending period.  Does the
%     right thing for other punctuation marks as well.  Does this by
%     setting spacefactor to 1000.
% \changes{v1.3b}{2014/12/30}{\cs{@} discards spaces when moving
%             (pr3039)(latexrelease)}
%    \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2015/01/01}%
%<latexrelease>                 {\@}{Space after \@}%
%<*2ekernel|latexrelease>
%    \end{macrocode}
%    \begin{macrocode}
\def\@{\spacefactor\@m{}}%
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\@}{Space after \@}%
%<latexrelease>\def\@{\spacefactor\@m}%
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\hspace}
% \changes{v1.0o}{1994/05/11}{Use \cs{DeclareRobustCommand}. ASAJ.}
%    \begin{macrocode}
\DeclareRobustCommand\hspace{\@ifstar\@hspacer\@hspace}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@hspace}
% \changes{LaTeX2e}{1993/08/05}
%    {(RmS) Removed superfluous \cs{leavevmode} in \cs{@hspace} and
%               \cs{@hspacer}, as suggested by CAR.}
% \changes{v1.3m}{2020/04/21}{Support calc syntax (gh/152)}
%    \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2020/10/01}%
%<latexrelease>                 {\@hspace}{Support calc with \hspace}%
\def\@hspace#1{\begingroup\setlength\skip@{#1}\hskip\skip@\endgroup}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%    \end{macrocode}
%    
%    \begin{macrocode}
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\@hspace}{Support calc with \hspace}%

%<latexrelease>
%<latexrelease>\def\@hspace#1{\hskip #1\relax}
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\@hspacer}
% Extra |\hskip 0pt| added 1985/17/12 to guard
% against a following |\unskip|
% |\relax| added 13 Oct 88 for usual \TeX\ lossage
% replaced both changes by |\hskip\z@skip| 27 Nov 91
%    \begin{macrocode}
\def\@hspacer#1{\vrule \@width\z@\nobreak
                \@hspace{#1}\hskip \z@skip}
%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\fill}
%    \begin{macrocode}
\newskip\fill
\fill = 0pt plus 1fill
%    \end{macrocode}
% \end{macro}
%
%
%
% \begin{macro}{\stretch}
%    \begin{macrocode}
\def\stretch#1{\z@ \@plus #1fill\relax}
%    \end{macrocode}
% \end{macro}
%
%
%    \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2018/12/01}%
%<latexrelease>                 {\thinspace}{Start LR-mode}%
%    \end{macrocode}
%
% \begin{macro}{\enspace}
% \changes{v1.3h}{2018/09/24}{Start LR-mode if necessary (git/49)}
%    \begin{macrocode}
\DeclareRobustCommand\enspace{\leavevmode@ifvmode\kern.5em }
%    \end{macrocode}
% \end{macro}
%
%  \begin{macro}{\leavevmode@ifvmode}
%    Leave vmode but only if we are really in vmode, otherwise the
%    expansion is empty (which is not the case with the default definition).
% \changes{v1.3h}{2018/09/24}{Macro added (git/49)}
%    \begin{macrocode}
\protected\def\leavevmode@ifvmode{\ifvmode\expandafter\indent\fi}
%    \end{macrocode}
%  \end{macro}
%
%    \begin{macrocode}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\thinspace}{Start LR-mode}%
%<latexrelease>\def\thinspace{\kern .16667em }
%<latexrelease>\def\negthinspace{\kern-.16667em }
%<latexrelease>\def\enspace{\kern.5em }
%<latexrelease>\let\leavevmode@ifvmode\@undefined
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
%
%
%
% \begin{macro}{\enskip}
% \begin{macro}{\quad}
% \begin{macro}{\qquad}
%    \begin{macrocode}
\def\enskip{\hskip.5em\relax}
\def\quad{\hskip1em\relax}
\def\qquad{\hskip2em\relax}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \changes{v1.3n}{2020/05/06}{Made softhyphen active in TU engines}
%
%   For Unicode engines, make the Unicode soft hyphen an active
%   character defined as \cs{-}.
%
%    \begin{macrocode}
\ifx\Umathcode\@undefined\else
  \catcode "AD=13
  \def^^ad{\-}
\fi
%    \end{macrocode}
%
% \begin{macro}{\obeycr}
% \begin{macro}{\restorecr}
% The following definitions will probably get deleted or moved to
% compatibility mode soon.
%
% \changes{v1.2g}{1995/06/11}
%                {(CAR) \cs{relax} added to stop silent eating of *.}
%    \begin{macrocode}
{\catcode`\^^M=13 \gdef\obeycr{\catcode`\^^M13 \def^^M{\\\relax}%
    \@gobblecr}%
{\catcode`\^^M=13 \gdef\@gobblecr{\@ifnextchar
\@gobble\ignorespaces}}
\gdef\restorecr{\catcode`\^^M5 }}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%    \begin{macrocode}
%</2ekernel>
%    \end{macrocode}
%
% \Finale
\endinput