summaryrefslogtreecommitdiff
path: root/macros/latex-dev/base/ltmiscen.dtx
blob: 8cd61207514ed10f68753f9bb9d8a625865877ef (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
% \iffalse meta-comment
%
% Copyright (C) 1993-2019
% 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: ltmiscen.dtx
%
%<*driver>
% \fi
\ProvidesFile{ltmiscen.dtx}
             [2019/08/29 v1.1p LaTeX Kernel (Misc. Environments)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltmiscen.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.0c}{1994/03/28}{Improve Documentation}
% \changes{v1.0d}{1994/03/29}{Remove counter macros to ltcntlen}
% \changes{v1.0g}{1994/05/02}{Changed 91 to 1991 and moved some bits}
% \changes{v1.0i}{1994/05/05}{Removed braces from ifnextchar and
% ifstar arguments}
% \changes{v1.0m}{1994/05/20}{Use new warning commands}
% \changes{v1.0n}{1994/05/21}{Use new error commands}
% \changes{v1.0s}{1994/10/14}{Move math to other file}
% \changes{v1.0v}{1994/11/17}
%         {\cs{@tempa} to \cs{reserved@a}}
% \changes{v1.0x}{1995/04/22}{Removed extra def of \cs{@gobble}}
% \changes{v1.0z}{1995/07/13}{Improve Documentation}
% \changes{v1.1c}{1996/04/22}{Improve Documentation}
% \changes{v1.1d}{1996/06/03}{Move setting of verbatim font and
%         \cs{@noligs}.}
% \changes{v1.1g}{1998/08/17}{(RmS) Minor documentation fixes.}
% \changes{v1.1p}{2019/08/27}{Make various commands robust}
%
% \section{Miscellaneous Environments}
%  This section implements the basic environment mechanism, and also
% a few specific environments including |document|, The math
% environments and related commands, the `flushing' environments,
% (|center|, |flushleft|, |flushright|), and |verbatim|.
%
% \StopEventually{}
%
%    \begin{macrocode}
%<*2ekernel>
\message{environments,}
%    \end{macrocode}
%
% \subsection{Environments}
%
%  |\begin{foo}| and |\end{foo}| are used to delimit environment |foo|.
%
%  |\begin{foo}| starts a group and calls |\foo| if it is defined,
%  otherwise it does nothing.
%
% |\end{foo}| checks to see that it matches the
%  corresponding |\begin| and if so, it calls |\endfoo| and does an
%  |\endgroup|.  Otherwise, |\end{foo}| does nothing.
%
%  If |\end{foo}| needs to ignore blanks after it, then |\endfoo| should
%  globally set the |@ignore| switch true with |\@ignoretrue|
%  (this will automatically be global).
%
%
%  NOTE: |\@@end| is defined to be the |\end| command of \TeX82.
%
%  |\enddocument| is the user's command for ending the manuscript file.
%
%  |\stop| is a panic button --- to end \TeX\ in the middle.
%
% \begin{oldcomments}
% \enddocument ==
%   BEGIN
%    \@checkend{document}   %% checks for unmatched \begin
%    \clearpage
%    \begingroup
%      if @filesw = true
%        then  close file @mainaux
%              if G@refundefined = true
%               then LaTeX Warning: 'There are undefined references.' fi
%              if @multiplelabels = true
%                then LaTeX Warning:
%                    'One or more label(s) multiply defined.'
%                else
%                \@setckpt {ARG1}{ARG2} == null
%                \newlabel{LABEL}{VAL} ==
%                    BEGIN
%                      \reserved@a == VAL
%                      if def(\reserved@a) = def(\r@LABEL)
%                        else @tempswa := true          fi
%                    END
%                \bibcite{LABEL}{VAL} == null
%                    BEGIN
%                      \reserved@a == VAL
%                      if def(\reserved@a) = def(\g@LABEL)
%                        else @tempswa := true          fi
%                    END
%                @tempswa := false
%                make @ a letter
%                \input \jobname.AUX
%                if @tempswa = true
%                  then LaTeX Warning: 'Label may have changed.
%                                  Rerun to get cross-references right.'
%       fi     fi     fi
%    \endgroup
%    finish up
%   END
%
%  \@writefile{EXT}{ENTRY} ==
%      if tf@EXT undefined
%        else \write\tf@EXT{ENTRY}
%      fi
% \end{oldcomments}
%
% \begin{macro}{\@currenvir}
%    The name of the current environment.  Initialized to
%    \texttt{document} to so that |\end{document}| works correctly.
%    \begin{macrocode}
\def\@currenvir{document}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\if@ignore}
% \begin{macro}{\@ignoretrue}
% \begin{macro}{\@ignorefalse}
% \changes{v1.1e}{1996/07/26}{put \cs{global} into definition}
%    \begin{macrocode}
\def\@ignorefalse{\global\let\if@ignore\iffalse}
\def\@ignoretrue {\global\let\if@ignore\iftrue}
\@ignorefalse
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \begin{macro}{\ignorespacesafterend}
% \changes{v1.1e}{1996/07/26}{user level macro added}
%    \begin{macrocode}
\let\ignorespacesafterend\@ignoretrue
%    \end{macrocode}
% \end{macro}
%
%  \begin{macro}{\enddocument}
% \changes{LaTeX2.09}{1993/08/03}
%         {Changed redefinition of \cs{global} to redefinition
%               of \cs{@setckpt}.}
% \changes{LaTeX2.09}{1993/09/08}
%         {Added warning in case of undefined references.}%
% \changes{v0.9e}{1993/12/09}{Hook added}
%    \begin{macrocode}
\def\enddocument{%
%    \end{macrocode}
%    The |\end{document}| hook is executed first. If necessary it can
%    contain a |\clearpage| to output dangling floats first. In this
%    position it can also contain something like |\end{foo}| so that
%    the whole document effectively starts and ends with some special
%    environment. However, this must be used with care, eg if two
%    applications would use this without knowledge of each other the
%    order of the environments will be wrong after all.
%    |\AtEndDocument| is redefined
%    at this point so that and such commands that get into the hook do
%    not chase their tail\ldots
% \changes{v1.0y}{1995/04/27}{\cs{@checkend} moved after hook}
% \changes{v1.0z}{1995/07/13}{Set \cs{@setckpt} to \cs{@gobbletwo}
%                    instead of defining it by hand}
% \changes{v1.1i}{2000/05/19}
%            {Reset \cs{AtEndDocument} for latex/3060}
%    \begin{macrocode}
   \let\AtEndDocument\@firstofone
   \@enddocumenthook
   \@checkend{document}%
   \clearpage
   \begingroup
     \if@filesw
       \immediate\closeout\@mainaux
       \let\@setckpt\@gobbletwo
       \let\@newl@bel\@testdef
%    \end{macrocode}
% \changes{v1.0z}{1995/07/13}{Shorten redefinition of \cs{bibcite} and
%          \cs{newlabel}}
%    The previous line is equiv to setting
%\begin{verbatim}
%       \def\newlabel{\@testdef r}%
%       \def\bibcite{\@testdef b}%
%\end{verbatim}
% \changes{v1.1k}{2010/08/17}{Use braces around \cs{input} arg (pr/4124)}
% \changes{v1.1l}{2010/08/17}{Change of plan: use \cs{@@input} instead
%                             (pr/4124)}
%    We use |\@@input| to load the \texttt{.aux} file, so that it doesn't
%    show up in the list of files produced by |\listfiles|.
%    \begin{macrocode}
       \@tempswafalse
       \makeatletter \@@input\jobname.aux
     \fi
%    \end{macrocode}
% \changes{v1.0w}{1994/11/30}
%         {(DPC) Use \cs{@dofilelist}}
%    \begin{macrocode}
     \@dofilelist
%    \end{macrocode}
%    First we check for font size substitution bigger than
%    |\fontsubfuzz|. The |\relax| is necessary because this is a macro
%    not a register.
% \changes{v1.0w}{1994/11/30}
%         {(DPC) Do warnings even for \cs{nofiles}}
%    \begin{macrocode}
     \ifdim \font@submax >\fontsubfuzz\relax
%    \end{macrocode}
%    In case you wonder about the |\@gobbletwo| inside the message
%    below, this is a horrible hack to remove the tokens |\on@line.|
%    that are added by |\@font@warning| at the end.
% \changes{v1.1j}{2000/07/11}{Fix typo in warning}
%    \begin{macrocode}
       \@font@warning{Size substitutions with differences\MessageBreak
                  up to \font@submax\space have occurred.\@gobbletwo}%
     \fi
%    \end{macrocode}
%    The macro |\@defaultsubs| is initially |\relax| but gets redefined
%    to produce
%    a warning if there have been some default font substitutions.
% \changes{v1.0z}{1995/07/13}{Use \cs{@defaultsubs} instead of switch}
%    \begin{macrocode}
     \@defaultsubs
%    \end{macrocode}
%    The macro |\@refundefined| is initially |\relax| but gets redefined
%    to produce a warning if there are undefined refs.
% \changes{v1.1b}{1995/10/24}{Use \cs{@refundefined} instead of switch}
%    \begin{macrocode}
     \@refundefined
%    \end{macrocode}
%    If a label is defined more than once, |\@tempswa| will always be
%    true and thus produce a ``Label(s) may \ldots'' warning. But
%    since a rerun will not solve that problem (unless one uses a
%    package like \texttt{varioref} that generates labels on the fly),
%    we suppress this message.
% \changes{v1.0e}{1994/04/20}{Changed logic for producing
%                             warning messages}
% \changes{v1.1b}{1995/10/24}{Changed logic for producing
%                             warning messages and removed switch}
%    \begin{macrocode}
     \if@filesw
       \ifx \@multiplelabels \relax
         \if@tempswa
           \@latex@warning@no@line{Label(s) may have changed.
               Rerun to get cross-references right}%
         \fi
       \else
         \@multiplelabels
       \fi
     \fi
   \endgroup
   \deadcycles\z@\@@end}
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\@testdef}
%    \begin{macrocode}
\def\@testdef #1#2#3{%
  \def\reserved@a{#3}\expandafter \ifx \csname #1@#2\endcsname
 \reserved@a  \else \@tempswatrue \fi}
%    \end{macrocode}
%  \end{macro}
%
%
% Reading data from auxiliary files (like \texttt{.toc} normally
% happens in vertical mode and it therefore doesn't matter if line
% endings are converted to spaces by \TeX{} during that process.
%
% However, especially the \texttt{.toc} file might be read in L-R mode
% (in cases the \cs{tableofcontents} attempts to put, say a list of
% sub-sections as a paragraph. In that case the newlines after a line
% like
% \begin{verbatim}
% \contentsline {subsubsection}{\numberline {1.1.1}A C-head}{2}
% \end{verbatim}
% might result in spurious spaces (e.g., when that level is not
% included).
%
% That could be fixed by reading in the file using
% \cs{endlinechar}\texttt{=-1} but that has the danger that it drops
% some valid endlines that should be converted to spaces (for example
% when the user edited the TOC and then used \cs{nofiles} to preserve
% it.
%
% So the approach taken instead is this:
% \begin{itemize}
% \item \cs{addcontentsline} adds the command
%    \cs{protected@file@percent} to the end of the second argument of
%    \cs{@writefile} that is written to the \texttt{.aux}. As the name
%    indicates this is a protected macro so it doesn't change if it is
%    written out.
%
% \item When the \texttt{.aux} is read back in at the end of the run,
%    \cs{@writefile} is executed and writes its second argument
%    unmodified to the file with the extension given by its first
%    argument. Or rather that was how it was in the past.
%
% \item Instead we change \cs{@writefile} slightly: basically it looks
%    at the second argument and if the last token in there is
%    \cs{protected@file@percent} then it is replaced by a percent
%    character and that is then written out. If not (for example, if
%    the data came from a user issued \cs{addtocontents}, or from some
%    package that uses \cs{@writefile} for writing its own files) then
%    the command behaves exactly as before.
% \end{itemize}
% 
%
%  \begin{macro}{\protected@file@percent}
%    Dummy cs to be replaced by a percent sign inside
%    \cs{@writefile}. If it survives (when used incorrectly) it will
%    expand to nothing in a typsetting context.
% \changes{v1.1n}{2018/09/26}{Sometimes mask the endline char when
%    writing to files (github/73)}
%    \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2018/12/01}%
%<latexrelease>                 {\protected@file@percent}{Mask line endings}%
\protected\def\protected@file@percent{} 
%    \end{macrocode}
%  \end{macro}


%  \begin{macro}{\add@percent@to@temptokena}
%    Helper function which is used to inspect a sequence of tokens
%    (the second argument of \cs{@writefile} and it the last token is
%    \cs{protected@file@percent} it will replace it by a harmless
%    percent. The result is saved in \cs{@temptokena} for later use.
% \changes{v1.1n}{2018/09/26}{Sometimes mask the endline char when
%    writing to files (github/73)}
%    \begin{macrocode}
\begingroup
\catcode`\%=12
%    \end{macrocode}
%    \texttt{latexrelease} will read this code in high-speed
%    mode in certain situations. During that it will only look for
%    \cs{if} tests but not actually execute the \cs{catcode} change
%    above. As a result it will drop anything after the |%| character
%    in the definition. Therefore the |\fi| needs to be on the next
%    line and we need locally another comment character to avoid
%    getting spaces into the definition---a weird problem :-)
%    \begin{macrocode}
\catcode`\^^A=9 
\long\gdef\add@percent@to@temptokena
    #1\protected@file@percent#2\add@percent@to@temptokena
%    \end{macrocode}
%    When we call this macro in |\@writefile| we stick in |\@empty| at
%   the beginning, so that in case the tokenlist consists of a single brace
%   group the braces aren't stripped. The |\expandafter| then expands
%   this extra token away again.
%    \begin{macrocode}
    {\ifx!#2!\@temptokena\expandafter{#1}\else
             \@temptokena\expandafter{#1%^^A
%    \end{macrocode}
%    Can't be on the same line as the |%| --- see above.
%    \begin{macrocode}
      }\fi}
\endgroup
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\@writefile}
% \changes{v1.0l}{1994/05/20}{Added correct setting of \cs{protect}.}
% \changes{v1.0t}{1994/11/04}{Removed setting of \cs{protect}. ASAJ.}
% \changes{v1.0z}{1995/07/13}{Added missing percent and use \cs{relax}
%  in the THEN case}
% \changes{v1.1n}{2018/09/26}{Sometimes mask the endline char when
%    writing to files (github/73)}
%    \begin{macrocode}
\long\def\@writefile#1#2{%
  \@ifundefined{tf@#1}\relax
    {%
%    \end{macrocode}
%    If we write to the file we first prepare |#2| using
%    \cs{add@percent@to@temptokena} and then write the token register
%    out.
%    \begin{macrocode}
      \add@percent@to@temptokena
        \@empty#2\protected@file@percent
        \add@percent@to@temptokena
     \immediate\write\csname tf@#1\endcsname{\the\@temptokena}%
    }%
}
%    \end{macrocode}
%    
%    \begin{macrocode}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\protected@file@percent}{Mask line endings}%
%<latexrelease>\let\protected@file@percent\@undefined
%<latexrelease>\let\add@percent@to@temptokena\@undefined
%<latexrelease>\long\def\@writefile#1#2{%
%<latexrelease>  \@ifundefined{tf@#1}\relax
%<latexrelease>    {\@temptokena{#2}%
%<latexrelease>     \immediate\write\csname tf@#1\endcsname{\the\@temptokena}%
%<latexrelease>    }%
%<latexrelease>}
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\stop}
%    \begin{macrocode}
\def\stop{\clearpage\deadcycles\z@\let\par\@@par\@@end}
%    \end{macrocode}
%  \end{macro}
%
%
% \begin{oldcomments}
%
%    \begin{macrocode}
\everypar{\@nodocument} %% To get an error if text appears before the
\nullfont               %% \begin{document}
%    \end{macrocode}
%
% \begin, \end, and \@checkend changed so \end{document} will catch
% an unmatched \begin.  Changed 24 May 89 as suggested by
% Frank Mittelbach and Rainer Sch\"opf.
%
% \begin{NAME} ==
%  BEGIN
%    IF \NAME undefined  THEN  \reserved@a == BEGIN report error END
%                        ELSE  \reserved@a ==
%                                   (\@currenvir :=L NAME) \NAME
%    FI
%    @ignore :=G F      %% Added 30 Nov 88
%    \begingroup
%    \@endpe := F
%    \@currenvir :=L NAME
%    \NAME
%  END
%
% \end{NAME} ==
%  BEGIN
%   \endNAME
%   \@checkend{NAME}
%   \endgroup
%   IF @endpe = T              %% @endpe set True by \@endparenv
%     THEN \@doendpe           %% \@doendpe redefines \par and \everypar
%                              %% to suppress paragraph indentation in
%   FI                         %% immediately following text
%   IF @ignore = T
%     THEN @ignore :=G F
%          \ignorespaces
%   FI
%  END
%
% \@checkend{NAME} ==
%  BEGIN
%   IF \@currenvir = NAME
%     ELSE \@badend{NAME}
%   FI
%  END
%
% \end{oldcomments}
%
%
% \begin{macro}{\begin}
% \changes{LaTeX2.09}{1992/03/18}{Changed \cs{@ignoretrue} to
%               \cs{@ignorefalse} (as documented)}
% \changes{LaTeX2.09}{1992/08/24}{Added code to \cs{begin} to
%      remember line number. Used by \cs{@badend} to display
%      position of non-matching \cs{begin}.}
% \changes{v1.1e}{1996/07/26}{remove \cs{global} before \cs{@ignore...}}
% \changes{v1.1p}{2019/08/27}{Make command robust}
%    \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2019/10/01}%
%<latexrelease>                 {\begin}{Making \begin/\end robust}%
\DeclareRobustCommand\begin[1]{%
  \@ifundefined{#1}%
    {\def\reserved@a{\@latex@error{Environment #1 undefined}\@eha}}%
    {\def\reserved@a{\def\@currenvir{#1}%
     \edef\@currenvline{\on@line}%
     \csname #1\endcsname}}%
  \@ignorefalse
  \begingroup\@endpefalse\reserved@a}
%    \end{macrocode}
%    A version that doesn't start out with \cs{relax} when in
%    typesetting mode would be the following, but since \cs{begin}
%    issues a \cs{begingroup} it wouldn't help much with respect to
%    allowing things like \cs{noalign} or \cs{multicolumn} inside.
%    \begin{macrocode}
%\edef\begin
%  {\unexpanded{%
%       \ifx\protect\@typeset@protect
%         \expandafter\@gobble
%       \fi
%       \protect
%     }%
%   \expandafter\noexpand\csname begin \endcsname
%  }
%\@namedef{begin }#1{%
%  \@ifundefined{#1}%
%    {\def\reserved@a{\@latex@error{Environment #1 undefined}\@eha}}%
%    {\def\reserved@a{\def\@currenvir{#1}%
%     \edef\@currenvline{\on@line}%
%     \csname #1\endcsname}}%
%  \@ignorefalse
%  \begingroup\@endpefalse\reserved@a}
%    \end{macrocode}
%
%  \begin{macro}{\end}
%    While \cs{begin} was made robust simply by using
%    \cs{DeclareRobustCommand} we need to be a bit more subtle with
%    \cs{end} as there are packages out there that try to look into
%    the top-level contents of \verb=\end{foo}= (that is at the expansion
%    of \verb=\endfoo=) to see if it contains certain macros. This is
%    done by hitting \verb=\end{foo}=  with three \cs{expandafter}s,
%    the first to get
%\begin{verbatim}
%  \csname endfoo\endcsname       \@checkend{foo}% etc.
%\end{verbatim}
%    the second to expand the \cs{csname}, i.e., to get to
%\begin{verbatim}
%  \endfoo                        \@checkend{foo}% etc.
%\end{verbatim}
%    and the third to finally get to the top-level content of
%    \verb=\endfoo=, i.e.
%\begin{verbatim}
%  <top-level content of \endfoo> \@checkend{foo}% etc.
%\end{verbatim}
%    Therefore a robust replacement should produce the same results
%    after three expansions (there first is obviously different).
%
%    Basically the definition of \cs{end} should either produce
%    \verb*=\protect\end = (when not doing typesetting) or it should
%    produce \verb*=\end = (without the \cs{protect}) when doing typesetting.
%    Furthermore, it should (when in typesetting mode) show exactly the
%    same result as
%    \verb*=\end = (which is the original fragile definition
%    of \cs{end}) when you expand either of them twice, i.e.,
%\begin{verbatim}
%  \endfoo                        \@checkend{foo}% etc.
%\end{verbatim}
%    That is achieved with the code below (which is worth studying
%    carefully).
%
%    There is some trickery involved here: in particular we use
%    \cs{romannumeral} to change a single expansion into three
%    successive expansions in one go. That primitive expands until it
%    has scanned a number (0 in this case, so it doesn't produce any
%    output) and so it allows us to place arbitrary many
%    \cs{expandafter}s inside that are all going to be executed when
%    \cs{romannumeral} is hit by a single \cs{expandafter}.
%
% \changes{v1.1e}{1996/07/26}{remove \cs{global} before \cs{@ignore...}}
% \changes{v1.1p}{2019/08/27}{Make command robust}
%
%    \begin{macrocode}
\edef\end
  {\unexpanded{%
     \romannumeral
       \ifx\protect\@typeset@protect
       \expandafter       %1
         \expandafter        %2
       \expandafter       %1
           \expandafter         %3 expands the \csname inside \end<space>
       \expandafter       %1
         \expandafter        %2  expands \end<space>
       \expandafter       %1     expands the \else
           \z@
       \else
         \expandafter\z@\expandafter\protect
       \fi
   }%
   \expandafter\noexpand\csname end \endcsname
  }
%    \end{macrocode}
%    And here is the original definition of \cs{end} the way it was in
%    \LaTeX{} for several decades now hidden in \verb*=\end =.
%    \begin{macrocode}
\@namedef{end }#1{%
  \csname end#1\endcsname\@checkend{#1}%
  \expandafter\endgroup\if@endpe\@doendpe\fi
  \if@ignore\@ignorefalse\ignorespaces\fi}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%    \end{macrocode}
%    An here the rollback in case that is ever needed.
%    \begin{macrocode}
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\begin}{Making \begin/\end robust}%
%<latexrelease>\kernel@make@fragile\begin
%<latexrelease>\kernel@make@fragile\end
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%
%
%
%
%  \begin{macro}{\@checkend}
%    \begin{macrocode}
\def\@checkend#1{\def\reserved@a{#1}\ifx
      \reserved@a\@currenvir \else\@badend{#1}\fi}
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\@currenvline}
%    We do need a default value for |\@currenvline| on top-level since
%    the document environment cancels the brace group. This means that
%    a mismatch with |\begin|\allowbreak|{document}| will not produce
%    a line number. Thus the outer default must be |\@empty| or we
%    will end up with two spaces.
% \changes{v1.0q}{1994/05/24}{Use \cs{@empty} as outer default}
%    \begin{macrocode}
\let\@currenvline\@empty
%    \end{macrocode}
%  \end{macro}
%
%
% \subsection{Center, Flushright, Flushleft}
%
%    \begin{macrocode}
\message{center,}
%    \end{macrocode}
%
% \begin{oldcomments}
%
% \center, \flushright and \flushleft set
%   \rightskip = 0pt or \@flushglue (as appropriate)
%   \leftskip  = 0pt or \@flushglue (as appropriate)
%   \parindent = 0pt
%   \parfillskip   = 0pt. (except \flushleft)
%   \\         == \par \vskip -\parskip
%   \\[LENGTH] == \\ \vskip LENGTH
%   \\*        == \par \penalty 10000 \vskip -\parskip
%   \\*[LEN]   == \\* \vskip LENGTH
%
% They invoke the trivlist environment to handle vertical spacing before
% and after them.
%
% \centering, \raggedright and \raggedleft are the declaration analogs
% of the above.
%
% \raggedright has a more universal effect, however.  It sets
% \@rightskip := flushglue.  Every environment, like the list
% environments,
% that set \rightskip to its 'normal' value set it to \@rightskip
%
% \end{oldcomments}
%
% \begin{macro}{\@centercr}
% \changes{v1.0h}{1994/05/03}{\cs{@badcrerr} replaced by \cs{@nolnerr}}
% \changes{v1.0z}{1995/07/13}{Use \cs{nobreak}}
%    \begin{macrocode}
\def\@centercr{\ifhmode \unskip\else \@nolnerr\fi
       \par\@ifstar{\nobreak\@xcentercr}\@xcentercr}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@xcentercr}
%    \begin{macrocode}
\def\@xcentercr{\addvspace{-\parskip}\@ifnextchar
    [\@icentercr\ignorespaces}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@icentercr}
%    \begin{macrocode}
\def\@icentercr[#1]{\vskip #1\ignorespaces}
%    \end{macrocode}
%    
% \end{macro}
%
%
% \begin{environment}{center}
% \changes{v0.9h}{1993/12/13}{Removed optional argument of \cs{item}}
% \changes{v1.0u}{1994/11/12}{Changed end macro to \cs{def}: safer and
% consistent}
%    We use |\relax| to prevent |\item| scanning too far.
%    \begin{macrocode}
\def\center{\trivlist \centering\item\relax}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\endcenter{\endtrivlist}
%    \end{macrocode}
% \end{environment}
%
%    
%    \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2019/10/01}%
%<latexrelease>                 {\centering}{Make commands robust}%
%    \end{macrocode}
%
% \begin{macro}{\centering}
%    \begin{macrocode}
\DeclareRobustCommand\centering{%
  \let\\\@centercr
  \rightskip\@flushglue\leftskip\@flushglue
  \parindent\z@\parfillskip\z@skip}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\raggedright}
%    \begin{macrocode}
\DeclareRobustCommand\raggedright{%
  \let\\\@centercr\@rightskip\@flushglue \rightskip\@rightskip
  \leftskip\z@skip
  \parindent\z@}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\raggedleft}
%    \begin{macrocode}
\DeclareRobustCommand\raggedleft{%
  \let\\\@centercr
  \rightskip\z@skip\leftskip\@flushglue
  \parindent\z@\parfillskip\z@skip}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\centering}{Make commands robust}%
%<latexrelease>
%<latexrelease>\kernel@make@fragile\centering
%<latexrelease>\kernel@make@fragile\raggedright
%<latexrelease>\kernel@make@fragile\raggedleft
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
%
%
%
% \begin{macro}{\@rightskip}
%    \begin{macrocode}
\newskip\@rightskip \@rightskip \z@skip
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{flushleft}
% \changes{v0.9h}{1993/12/13}{Removed optional argument of \cs{item}}
% \changes{v1.0u}{1994/11/12}{Changed end macro to \cs{def}: safer and
% consistent}
%    We use |\relax| to prevent |\item| scanning too far.
%    \begin{macrocode}
\def\flushleft{\trivlist \raggedright\item\relax}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\endflushleft{\endtrivlist}
%    \end{macrocode}
% \end{environment}
%
%
% \begin{environment}{flushright}
% \changes{v0.9h}{1993/12/13}{Removed optional argument of \cs{item}}
% \changes{v1.0u}{1994/11/12}{Changed end macro to \cs{def}: safer and
% consistent}
%    We use |\relax| to prevent |\item| scanning too far.
%    \begin{macrocode}
\def\flushright{\trivlist \raggedleft\item\relax}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\endflushright{\endtrivlist}
%    \end{macrocode}
% \end{environment}
%
%
% \subsection{Verbatim}
%
%    \begin{macrocode}
\message{verbatim,}
%    \end{macrocode}
%
%  The verbatim environment uses the fixed-width |\ttfamily| font, turns
%  blanks into spaces, starts a new line for each carriage return (or
%  sequence of consecutive carriage returns), and interprets
%  \emph{every} character literally.
%  I.e., all special characters |\, {, $|, etc.
%   are |\catcode|'d to 'other'.
%
% The command |\verb| produces in-line verbatim text, where the argument
% is delimited by any pair of characters.  E.g., |\verb #...#| takes
%  `|...|' as its argument, and sets it verbatim in |\ttfamily| font.
%
%  The *-variants of these commands are the same, except that spaces
%  print as the \TeX{}book's space character instead of as blank spaces.
%
%  \begin{macro}{\@vobeyspaces}
%    \begin{macrocode}
{\catcode`\ =\active%
\gdef\@vobeyspaces{\catcode`\ \active\let \@xobeysp}}
%    \end{macrocode}
% \end{macro}
%
%  \begin{macro}{\@xobeysp}
% \changes{v1.0z}{1995/07/13}{Use \cs{nobreak}}
% \changes{v1.1f}{1996/09/28}{Moved to ltspace.dtx}
% \end{macro}
%
%
%  \begin{macro}{\@xverbatim}
%  \begin{macro}{\@sxverbatim}
%    \begin{macrocode}
\begingroup \catcode `|=0 \catcode `[= 1
\catcode`]=2 \catcode `\{=12 \catcode `\}=12
\catcode`\\=12 |gdef|@xverbatim#1\end{verbatim}[#1|end[verbatim]]
|gdef|@sxverbatim#1\end{verbatim*}[#1|end[verbatim*]]
|endgroup
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%  \begin{macro}{\@verbatim}
% \changes{LaTeX2.09}{1991/07/24}{Added \cs{penalty}\cs{interlinepenalty}
%               to definition of \cs{par} so that \cs{samepage} works}
% \changes{v0.9h}{1993/12/13}{Removed optional argument of \cs{item}}
%    Real start of verbatim environment
%    We use |\relax| to prevent |\item| scanning too far.
% \changes{v0.9p}{1994/01/18}
%         {Add \cs{global}\cs{@inlabelfalse}}
% \changes{v1.0b}{1994/03/16}
%         {Remove \cs{global}\cs{@inlabelfalse} again.}
%    \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2017-04-15}{\@verbatim}%
%<latexrelease>                 {Disable hyphenation in verbatim}%
\def\@verbatim{\trivlist \item\relax
  \if@minipage\else\vskip\parskip\fi
  \leftskip\@totalleftmargin\rightskip\z@skip
  \parindent\z@\parfillskip\@flushglue\parskip\z@skip
%    \end{macrocode}
% \changes{LaTeX2.09}{1991/08/26}{\cs{@@par} added}
%    Added |\@@par| to clear possible |\parshape| definition
%    from a surrounding list (the verbatim guru says).
% \changes{v0.9p}{1994/01/18}
%         {Only add \cs{penalty} if in hmode}
% Switch language when in vertical mode.
%    \begin{macrocode}
  \@@par
%    \end{macrocode}
% Set |\language| here to suppress hyphenation. Done this way rather
% than setting |\hyphenchar| as that is a global setting.
%    \begin{macrocode}
  \language\l@nohyphenation
  \@tempswafalse
  \def\par{%
    \if@tempswa
%    \end{macrocode}
%    A |\leavevmode| added: needed if, for example, a blank verbatim
%    line is the first thing in a list item (wow!).
% \changes{v1.0f}{1994/04/29}{\cs{leavevmode} added}
%    \begin{macrocode}
      \leavevmode \null \@@par\penalty\interlinepenalty
    \else
      \@tempswatrue
      \ifhmode\@@par\penalty\interlinepenalty\fi
    \fi}%
%    \end{macrocode}
%    To allow customization we hide the font used in a separate macro.
%  \changes{v0.9a}{1993/11/21}{use \cs{verbatim@font} instead of \cs{tt}}
%  \changes{v0.9h}{1993/12/13}{Readded \cs{@noligs}}
%  \changes{v1.1d}{1996/06/03}{Exchanged the following two code lines
%           so that \cs{dospecials} cannot reset the category code
%           of characters handled by \cs{@noligs}.}
%  \changes{v1.1h}{2000/01/07}{Disable hyphenation even if the font allows it.}
%  \changes{v1.1m}{2017-03-09}{Use \cs{language} not \cs{hyphenchar}}
%    \begin{macrocode}
  \let\do\@makeother \dospecials
  \obeylines \verbatim@font \@noligs
%    \end{macrocode}
%    To avoid a breakpoint after the labels box, we remove the penalty
%    put there by the list macros: another use of |\unpenalty|!
% \changes{v1.0f}{1994/04/29}{Change to \cs{everypar} added}
%    \begin{macrocode}
  \everypar \expandafter{\the\everypar \unpenalty}%
}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000-00-00}{\@verbatim}%
%<latexrelease>                 {Disable hyphenation in verbatim}%
%<latexrelease>\def\@verbatim{\trivlist \item\relax
%<latexrelease>  \if@minipage\else\vskip\parskip\fi
%<latexrelease>  \leftskip\@totalleftmargin\rightskip\z@skip
%<latexrelease>  \parindent\z@\parfillskip\@flushglue\parskip\z@skip
%<latexrelease>  \@@par
%<latexrelease>  \@tempswafalse
%<latexrelease>  \def\par{%
%<latexrelease>    \if@tempswa
%<latexrelease>      \leavevmode \null \@@par\penalty\interlinepenalty
%<latexrelease>    \else
%<latexrelease>      \@tempswatrue
%<latexrelease>      \ifhmode\@@par\penalty\interlinepenalty\fi
%<latexrelease>    \fi}%
%<latexrelease>  \let\do\@makeother \dospecials
%<latexrelease>  \obeylines \verbatim@font \@noligs
%<latexrelease>  \hyphenchar\font\m@ne
%<latexrelease>  \everypar \expandafter{\the\everypar \unpenalty}%
%<latexrelease>}
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\verbatim}
%  \begin{macro}{\endverbatim}
%    (RmS 93/09/19) Protected against `missing item' error message
%               triggered by empty verbatim environment.
%    \begin{macrocode}
\def\verbatim{\@verbatim \frenchspacing\@vobeyspaces \@xverbatim}
\def\endverbatim{\if@newlist \leavevmode\fi\endtrivlist}
%    \end{macrocode}
%  \end{macro}
%  \end{macro}
%
%  \begin{macro}{\verbatim@font}
% \changes{v0.9a}{1993/11/21}{Macro added}
%    Macro to select the font  used for verbatim typesetting.
%    It also does other work if necessary for the font used.
% \changes{v0.9s}{1994/01/21}{Removed unnecessary category code
%                            hackery.}
%    \begin{macrocode}
\def\verbatim@font{\normalfont\ttfamily}
%    \end{macrocode}
%  \end{macro}
%
%    
%    \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2018/12/01}%
%<latexrelease>                 {\verbvisiblespace}{Setup visible space for verb}%
%    \end{macrocode}
%
%
%  \begin{macro}{\asciispace}
%    The character in slot 32, in typewriter fonts (historically) a
%    visible space but in other fonts a real space or something else
% \changes{v1.1o}{2018/10/11}
%     {Provide visible space in \cs{verb*} also for XeTeX and LuaTeX (github/69)}
%    \begin{macrocode}
\DeclareRobustCommand\asciispace{\char 32 }
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\verbvisiblespace}
%    This defines how to get a visible space in
%    |\verb*| and friends. In classic \TeX{} this is just the
%    slot 32, but in TU encoded fonts we switch fonts and take the
%    character from cmtt.
% \changes{v1.1o}{2018/10/11}
%     {Provide visible space in \cs{verb*} also for XeTeX and LuaTeX (github/69)}
% \changes{v1.1o}{2018/10/11}
%     {Provide \cs{verbvisiblespace} such that it is usable in normal text (github/70)}
%    \begin{macrocode}
\ifx\Umathcode\@undefined
  \let\verbvisiblespace\asciispace                                % Pdftex version
\else
  \DeclareRobustCommand\verbvisiblespace
           {\leavevmode{\usefont{OT1}{cmtt}{m}{n}\asciispace}}    % xetex/luatex version
\fi
%    \end{macrocode}
%  \end{macro}
%
%

%  \begin{macro}{\@setupverbvisiblespace}
%
%    In pdf\TeX{} a catcode 12 space will produce the character in
%   slot 32 which is assumed to be a visible space character (in a
%   typewriter font in OT1 or T1 encoding). In Xe\TeX{} or Lua\TeX{} a
%   font in TU encoding is normally used and that has a real space in
%   this slot. So what we do in this case is this: we check the
%   definition of
%   |\verbvisiblespace| and if it is |\asciispace| we assume that the
%   char32 can be used (e.g., in pdf\TeX{}). We then redefine
%   |\@xobeysp| so that after running |\@vobeyspaces| we get
%   characters from slot 32 for each active space.
%
% \changes{v1.1o}{2018/10/11}
%     {Provide visible space in \cs{verb*} also for XeTeX and LuaTeX (github/69)}
%    \begin{macrocode}
\def\@setupverbvisiblespace{%
  \ifx\verbvisiblespace\asciispace
    \let\@xobeysp\asciispace
  \else
%    \end{macrocode} Otherwise we measure the width of a character in
%   the mon-spaced current font and place a
%   |\verbvisiblespace| into a box of the right width which we are then
%   using as the character for a space. By default this will be the space
%   character from OT1 cmtt but by changing
%   |\verbvisiblespace| one could use, for example, the |\textvisiblespace|
%   of the current typewriter font.
%    \begin{macrocode}
    \setbox\z@\hbox{x}%
    \setbox\@verbvisiblespacebox\hbox to\wd\z@{\hss\verbvisiblespace\hss}%
    \def\@xobeysp{\leavevmode\copy\@verbvisiblespacebox}%
  \fi
}
%    \end{macrocode}
%  \end{macro}
%

%  \begin{macro}{\@verbvisiblespacebox}
%    The box to hold the visible space character if it isn't in slot
%    32 in the current typewriter font.
% \changes{v1.1o}{2018/10/11}
%     {Provide visible space in \cs{verb*} also for XeTeX and LuaTeX (github/69)}
%    \begin{macrocode}
\newbox\@verbvisiblespacebox
%    \end{macrocode}
%  \end{macro}
%
%
% \begin{macro}{\@sverb}
% \changes{v1.0j}{1994/05/10}{Slight change in error message text.}
% Definitions of |\@sverb| and |\@verb| changed so |\verb+ foo+|
% does not lose leading blanks when it comes at the beginning of a line.
% Change made 24 May 89. Suggested by Frank Mittelbach and Rainer
% Sch\"opf.
%    \begin{macrocode}
\def\@sverb#1{%
  \catcode`#1\active
  \lccode`\~`#1%
  \gdef\verb@balance@group{\verb@egroup
     \@latex@error{\noexpand\verb illegal in command argument}\@ehc}%
  \aftergroup\verb@balance@group
  \lowercase{\let~\verb@egroup}%
%    \end{macrocode}
%    If |\@sverb| is called from |\@verb| then space is already active
%    and supposed to produce a real space. In this case we do
%    nothing. Otherwise we run |\@setupverbvisiblespace| to setup the
%    right visible space char and afterwards |\@vobeyspaces| to make
%    it the definition for the active space character.
% \changes{v1.1o}{2018/10/11}
%     {Provide visible space in \cs{verb*} also for XeTeX and LuaTeX (github/69)}
%    \begin{macrocode}
  \ifnum\catcode`\ =\active
  \else  \@setupverbvisiblespace \@vobeyspaces \fi
}
%    \end{macrocode}
%  \end{macro}
%
%  \begin{environment}{verbatim*}
%    For \texttt{verbatim*} we also set up the correct visible space
%    character definition and then run |\@vobeyspaces|. As this code
%    is not called as part of the normal verbatim environment (the
%    method is done the other way around this time) we don't have to
%    check if space is already active---it shouldn't be.
% \changes{v1.1o}{2018/10/11}
%     {Provide visible space in \cs{verb*} also for XeTeX and LuaTeX (github/69)}
%    \begin{macrocode}
\@namedef{verbatim*}{\@verbatim
  \@setupverbvisiblespace
  \frenchspacing\@vobeyspaces\@sxverbatim}
\expandafter\let\csname endverbatim*\endcsname =\endverbatim
%    \end{macrocode}
%  \end{environment}
%
%
%
%    \begin{macrocode}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\verbvisiblespace}{Setup visible space for verb}%
%<latexrelease>
%<latexrelease>\@namedef{verbatim*}{\@verbatim\@sxverbatim}
%<latexrelease>
%<latexrelease>\let\asciispace            \@undefined
%<latexrelease>\let\verbvisiblespace      \@undefined
%<latexrelease>\let\@setupverbvisiblespace\@undefined
%<latexrelease>\let\@verbvisiblespacebox  \@undefined
%<latexrelease>
%<latexrelease>\def\@sverb#1{%
%<latexrelease>  \catcode`#1\active
%<latexrelease>  \lccode`\~`#1%
%<latexrelease>  \gdef\verb@balance@group{\verb@egroup
%<latexrelease>     \@latex@error{\noexpand\verb illegal in command argument}\@ehc}%
%<latexrelease>  \aftergroup\verb@balance@group
%<latexrelease>  \lowercase{\let~\verb@egroup}}%
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
%
%
%
%
%  \begin{macro}{\@makeother}
%    \begin{macrocode}
\def\@makeother#1{\catcode`#112\relax}
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\verb@balance@group}
% \changes{LaTeX2.09}{1993/09/07}
%     {(RmS) Changed definition of \cs{verb} so that it detects a
%              missing second delimiter.}
%    \begin{macrocode}
\let\verb@balance@group\@empty
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\verb@egroup}
%    \begin{macrocode}
\def\verb@egroup{\global\let\verb@balance@group\@empty\egroup}
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\verb@eol@error}
%    \begin{macrocode}
\begingroup
  \obeylines%
  \gdef\verb@eol@error{\obeylines%
    \def^^M{\verb@egroup\@latex@error{%
            \noexpand\verb ended by end of line}\@ehc}}%
\endgroup
%    \end{macrocode}
% \end{macro}
%
%  \begin{macro}{\verb}
% \changes{LaTeX2.09}{1992/08/24}
%         {Changed \cs{verb} and \cs{@sverb} to work correctly
%            in math mode}
% \changes{v0.9a}{1993/11/21}{Use \cs{verbatim@font} instead of
%                             \cs{tt}.}
% \changes{v1.1a}{1995/09/19}{Put \cs{@noligs} after
%                    \cs{verbatim@font} where it belongs.}
%    Typesetting a small piece verbatim.
%  \changes{v1.1d}{1996/06/03}{Put setting of verbatim font after
%           \cs{dospecials}
%           so that \cs{dospecials} cannot reset the category code
%           of characters handled by \cs{@noligs}.}
%  \changes{v1.1m}{2017/03/09}
%         {Use \cs{language} to stop hyphenation}
%    \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2017-04-15}{\verb}%
%<latexrelease>                 {Disable hyphenation in verb}%
\def\verb{\relax\ifmmode\hbox\else\leavevmode\null\fi
  \bgroup
    \verb@eol@error \let\do\@makeother \dospecials
    \verbatim@font\@noligs
%    \end{macrocode}
% Set |\language| here to suppress hyphenation. Done this way rather
% than setting |\hyphenchar| as that is a global setting.
%    \begin{macrocode}
    \language\l@nohyphenation
    \@ifstar\@sverb\@verb}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000-00-00}{\verb}%
%<latexrelease>                 {Disable hyphenation in verb}%
%<latexrelease>\def\verb{\relax\ifmmode\hbox\else\leavevmode\null\fi
%<latexrelease>  \bgroup
%<latexrelease>    \verb@eol@error \let\do\@makeother \dospecials
%<latexrelease>    \verbatim@font\@noligs
%<latexrelease>    \@ifstar\@sverb\@verb}
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
%  \end{macro}
%
%
%
% \begin{macro}{\@verb}
%    \begin{macrocode}
\def\@verb{\@vobeyspaces \frenchspacing \@sverb}
%    \end{macrocode}
% \end{macro}
%
%  \begin{macro}{\verbatim@nolig@list}
% \changes{LaTeX2.09}{1993/09/03}
%         {Replaced \cs{@noligs} by extensible list}
%    \begin{macrocode}
\def\verbatim@nolig@list{\do\`\do\<\do\>\do\,\do\'\do\-}
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\do@noligs}
%    \begin{macrocode}
\def\do@noligs#1{%
  \catcode`#1\active
  \begingroup
     \lccode`\~`#1\relax
     \lowercase{\endgroup\def~{\leavevmode\kern\z@\char`#1}}}
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\@noligs}
%    To stay compatible with packages that use |\@noligs| we keep it.
% \changes{v0.9h}{1993/12/13}{Readded \cs{@noligs}}
%    \begin{macrocode}
\def\@noligs{\let\do\do@noligs \verbatim@nolig@list}
%    \end{macrocode}
%  \end{macro}
%
% \changes{v0.9i}{1993/12/16}{\cs{literal} added}
% \changes{v1.0r}{1994/05/26/16}{\cs{literal} removed}
%    \begin{macrocode}
%</2ekernel>
%    \end{macrocode}
%
% \Finale
%