diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/base/ltmiscen.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/base/ltmiscen.dtx | 510 |
1 files changed, 422 insertions, 88 deletions
diff --git a/Master/texmf-dist/source/latex/base/ltmiscen.dtx b/Master/texmf-dist/source/latex/base/ltmiscen.dtx index 97b1f4a572b..0c115d3be1b 100644 --- a/Master/texmf-dist/source/latex/base/ltmiscen.dtx +++ b/Master/texmf-dist/source/latex/base/ltmiscen.dtx @@ -32,7 +32,7 @@ %<*driver> % \fi \ProvidesFile{ltmiscen.dtx} - [2019/11/02 v1.1s LaTeX Kernel (Misc. Environments)] + [2020/08/21 v1.1v LaTeX Kernel (Misc. Environments)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltmiscen.dtx} @@ -73,6 +73,7 @@ % \cs{@noligs}.} % \changes{v1.1g}{1998/08/17}{(RmS) Minor documentation fixes.} % \changes{v1.1p}{2019/08/27}{Make various commands robust} +% \changes{v1.1v}{2020/08/21}{Integration of new hook management interface} % % \section{Miscellaneous Environments} % This section implements the basic environment mechanism, and also @@ -182,6 +183,7 @@ % \end{macrocode} % \end{macro} % +% \begin{environment}{document} % \begin{macro}{\enddocument} % \changes{LaTeX2.09}{1993/08/03} % {Changed redefinition of \cs{global} to redefinition @@ -190,6 +192,10 @@ % {Added warning in case of undefined references.}% % \changes{v0.9e}{1993/12/09}{Hook added} % \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2020/10/01}% +%<latexrelease> {\enddocument}{Use Hooks}% \def\enddocument{% % \end{macrocode} % The |\end{document}| hook is executed first. If necessary it can @@ -208,10 +214,15 @@ % \changes{v1.1i}{2000/05/19} % {Reset \cs{AtEndDocument} for latex/3060} % \begin{macrocode} - \let\AtEndDocument\@firstofone - \@enddocumenthook + \UseOneTimeHook{enddocument}% + \@kernel@after@enddocument +% \end{macrocode} +% +% \begin{macrocode} \@checkend{document}% \clearpage + \UseOneTimeHook{enddocument/afterlastpage}% + \@kernel@after@enddocument@afterlastpage \begingroup \if@filesw \immediate\closeout\@mainaux @@ -234,11 +245,52 @@ \@tempswafalse \makeatletter \@@input\jobname.aux \fi + \UseHook{enddocument/afteraux}% % \end{macrocode} -% \changes{v1.0w}{1994/11/30} -% {(DPC) Use \cs{@dofilelist}} +% Next hook is expect to contain only code for writing info +% messages on the terminal. +% \begin{macrocode} + \UseOneTimeHook{enddocument/info}% + \endgroup + \UseOneTimeHook{enddocument/end}% + \deadcycles\z@\@@end} +% \end{macrocode} +% +% The public hooks used in \cs{enddocument}: +% \begin{macrocode} +\NewHook{enddocument} +\NewHook{enddocument/afterlastpage} +\NewHook{enddocument/afteraux} +\NewHook{enddocument/info} +\NewHook{enddocument/end} +% \end{macrocode} +% +% This is one of the few places where we already add data and rules +% to a hook already in the kernel. +% \changes{v1.0w}{1994/11/30}{(DPC) Use \cs{@dofilelist}} +% \begin{macrocode} +\AddToHook{enddocument/info}[kernel/filelist]{\@dofilelist} +\AddToHook{enddocument/info}[kernel/warnings]{\@enddocument@kernel@warnings} +\DeclareHookRule{enddocument/info}{kernel/filelist}{before}{kernel/warnings} +% \end{macrocode} +% \end{macro} +% \end{environment} +% +% +% \begin{macro}{\@kernel@after@enddocument, +% \@kernel@after@enddocument@afterlastpage} +% +% The two kernel hooks above are used by the shipout code. +% \begin{macrocode} +\let\@kernel@after@enddocument\@empty +\let\@kernel@after@enddocument@afterlastpage\@empty +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@enddocument@kernel@warnings} +% % \begin{macrocode} - \@dofilelist +\def\@enddocument@kernel@warnings{% % \end{macrocode} % First we check for font size substitution bigger than % |\fontsubfuzz|. The |\relax| is necessary because this is a macro @@ -246,29 +298,29 @@ % \changes{v1.0w}{1994/11/30} % {(DPC) Do warnings even for \cs{nofiles}} % \begin{macrocode} - \ifdim \font@submax >\fontsubfuzz\relax + \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 + \@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 + \@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 + \@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 @@ -280,21 +332,78 @@ % \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 + \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 + \ifx \@extra@page@added \relax + \@latex@warning@no@line{Temporary extra page added at the end. + Rerun to get it removed}% \fi - \endgroup - \deadcycles\z@\@@end} +% \end{macrocode} +% We could think of adding a warning that nothing can be corrected +% while \cs{nofiles} is in force. In the past the warnings related +% to the \texttt{aux} file are simply suppressed in this case. +% \begin{macrocode} + \fi +} % \end{macrocode} % \end{macro} % +% \begin{macrocode} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\enddocument}{Use Hooks}% +%<latexrelease> +%<latexrelease>\def\enddocument{% +%<latexrelease> \let\AtEndDocument\@firstofone +%<latexrelease> \@enddocumenthook +%<latexrelease> \@checkend{document}% +%<latexrelease> \clearpage +%<latexrelease> \begingroup +%<latexrelease> \if@filesw +%<latexrelease> \immediate\closeout\@mainaux +%<latexrelease> \let\@setckpt\@gobbletwo +%<latexrelease> \let\@newl@bel\@testdef +%<latexrelease> \@tempswafalse +%<latexrelease> \makeatletter \@@input\jobname.aux +%<latexrelease> \fi +%<latexrelease> \@dofilelist +%<latexrelease> \ifdim \font@submax >\fontsubfuzz\relax +%<latexrelease> \@font@warning{Size substitutions with differences\MessageBreak +%<latexrelease> up to \font@submax\space have occurred.\@gobbletwo}% +%<latexrelease> \fi +%<latexrelease> \@defaultsubs +%<latexrelease> \@refundefined +%<latexrelease> \if@filesw +%<latexrelease> \ifx \@multiplelabels \relax +%<latexrelease> \if@tempswa +%<latexrelease> \@latex@warning@no@line{Label(s) may have changed. +%<latexrelease> Rerun to get cross-references right}% +%<latexrelease> \fi +%<latexrelease> \else +%<latexrelease> \@multiplelabels +%<latexrelease> \fi +%<latexrelease> \fi +%<latexrelease> \endgroup +%<latexrelease> \deadcycles\z@\@@end} +%<latexrelease> +%<latexrelease>\let\@kernel@after@enddocument\@undefined +%<latexrelease>\let\@kernel@after@enddocument@afterlastpage\@undefined +%<latexrelease>\let\@enddocument@kernel@warnings\@undefined +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} +% +% +% % \begin{macro}{\@testdef} % \begin{macrocode} \def\@testdef #1#2#3{% @@ -523,17 +632,107 @@ % \begin{macrocode} %</2ekernel> %<*2ekernel|latexrelease> -%<latexrelease>\IncludeInRelease{2019/10/01}% -%<latexrelease> {\begin}{Making \begin/\end robust}% -\DeclareRobustCommand\begin[1]{% +%<latexrelease>\IncludeInRelease{2020/10/01}% +%<latexrelease> {\begin}{Use hook system}% +\DeclareRobustCommand*\begin[1]{% + \UseHook{env/#1/before}% \@ifundefined{#1}% {\def\reserved@a{\@latex@error{Environment #1 undefined}\@eha}}% {\def\reserved@a{\def\@currenvir{#1}% - \edef\@currenvline{\on@line}% - \csname #1\endcsname}}% + \edef\@currenvline{\on@line}% + \@execute@begin@hook{#1}% + \csname #1\endcsname}}% \@ignorefalse \begingroup\@endpefalse\reserved@a} % \end{macrocode} +% +% Before the \cs{document} code is executed we have to first undo +% the \cs{endgroup} as there should be none for this environment to +% avoid that changes on top-level unnecessarily go to \TeX's +% savestack, and we have to initialize all hooks in the hook system. +% So we need to test for this environment name. But once it has be +% found all this testing is no longer needed and so we redefine +% \cs{@execute@begin@hook} to simply use the hook. +% \begin{macrocode} +\def\@execute@begin@hook #1{% + \expandafter\ifx\csname #1\endcsname\document + \endgroup + \gdef\@execute@begin@hook##1{\UseHook{env/##1/begin}}% + \@expl@@@initialize@all@@ + \fi +% \end{macrocode} +% If this is an environment before \verb=\begin{document}= we just +% run the hook so this can be outside the test. +% \begin{macrocode} + \UseHook{env/#1/begin}% +} +% \end{macrocode} +% +% The top level definition for \cs{end}. for an explanation see +% below (this is the same as the 2019 version where it was +% introduced, but for rollback we have to repeat it). +% \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} +% Version that adds hooks (so different from the 2019 version). It +% fixes tlb3722 but the change should perhaps be made in +% \texttt{tabularx} instead. +% \begin{macrocode} +\@namedef{end }#1{% + \romannumeral + \IfHookEmptyTF{env/#1/end}% + {\expandafter\z@}% + {\z@\UseHook{env/#1/end}}% + \csname end#1\endcsname\@checkend{#1}% + \expandafter\endgroup\if@endpe\@doendpe\fi + \UseHook{env/#1/after}% + \if@ignore\@ignorefalse\ignorespaces\fi +} +% \end{macrocode} +% Version without the fix for tlb3722 for the record: +% \begin{macrocode} +%\@namedef{end }#1{% +% \UseHook{env/#1/end}% +% \csname end#1\endcsname\@checkend{#1}% +% \expandafter\endgroup\if@endpe\@doendpe\fi +% \UseHook{env/#1/after}% +% \if@ignore\@ignorefalse\ignorespaces\fi}% +% \end{macrocode} +% +% \begin{macrocode} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} +% +% \begin{macrocode} +%<latexrelease>\IncludeInRelease{2019/10/01}% +%<latexrelease> {\begin}{Making \begin/\end robust}% +%<latexrelease>\DeclareRobustCommand\begin[1]{% +%<latexrelease> \@ifundefined{#1}% +%<latexrelease> {\def\reserved@a{\@latex@error{Environment #1 undefined}\@eha}}% +%<latexrelease> {\def\reserved@a{\def\@currenvir{#1}% +%<latexrelease> \edef\@currenvline{\on@line}% +%<latexrelease> \csname #1\endcsname}}% +%<latexrelease> \@ignorefalse +%<latexrelease> \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 @@ -606,41 +805,50 @@ % \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 - } +%<latexrelease>\edef\end +%<latexrelease> {\unexpanded{% +%<latexrelease> \romannumeral +%<latexrelease> \ifx\protect\@typeset@protect +%<latexrelease> \expandafter %1 +%<latexrelease> \expandafter %2 +%<latexrelease> \expandafter %1 +%<latexrelease> \expandafter %3 expands the \csname inside \end<space> +%<latexrelease> \expandafter %1 +%<latexrelease> \expandafter %2 expands \end<space> +%<latexrelease> \expandafter %1 expands the \else +%<latexrelease> \z@ +%<latexrelease> \else +%<latexrelease> \expandafter\z@\expandafter\protect +%<latexrelease> \fi +%<latexrelease> }% +%<latexrelease> \expandafter\noexpand\csname end \endcsname +%<latexrelease> } % \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>\@namedef{end }#1{% +%<latexrelease> \csname end#1\endcsname\@checkend{#1}% +%<latexrelease> \expandafter\endgroup\if@endpe\@doendpe\fi +%<latexrelease> \if@ignore\@ignorefalse\ignorespaces\fi} %<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>\def\begin#1{% +%<latexrelease> \@ifundefined{#1}% +%<latexrelease> {\def\reserved@a{\@latex@error{Environment #1 undefined}\@eha}}% +%<latexrelease> {\def\reserved@a{\def\@currenvir{#1}% +%<latexrelease> \edef\@currenvline{\on@line}% +%<latexrelease> \csname #1\endcsname}}% +%<latexrelease> \@ignorefalse +%<latexrelease> \begingroup\@endpefalse\reserved@a} +%<latexrelease>\def\end#1{% +%<latexrelease> \csname end#1\endcsname\@checkend{#1}% +%<latexrelease> \expandafter\endgroup\if@endpe\@doendpe\fi +%<latexrelease> \if@ignore\@ignorefalse\ignorespaces\fi} %<latexrelease> %<latexrelease>\EndIncludeInRelease %<*2ekernel> @@ -672,6 +880,47 @@ % \end{macro} % % +% +% \begin{macro}{\AtBeginEnvironment,\AtEndEnvironment, +% \BeforeBeginEnvironment,\AfterEndEnvironment} +% +% We provide 4 high-level hook interfaces directly, the others only when +% etoolbox is loaded +% \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2020/10/01}% +%<latexrelease> {\AtBeginEnvironment}{Hooks for environments}% +% \end{macrocode} +% +% \begin{macrocode} +\newcommand\AtBeginEnvironment[2][.] {\AddToHook{env/#2/begin}[#1]} +\newcommand\AtEndEnvironment[2][.] {\AddToHook{env/#2/end}[#1]} +\newcommand\BeforeBeginEnvironment[2][.]{\AddToHook{env/#2/before}[#1]} +\newcommand\AfterEndEnvironment[2][.] {\AddToHook{env/#2/after}[#1]} +% \end{macrocode} +% +% \begin{macrocode} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} +% +% \begin{macrocode} +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\AtBeginEnvironment}{Hooks for environments}% +%<latexrelease> +%<latexrelease>\let\AtBeginEnvironment\@undefined +%<latexrelease>\let\AtEndEnvironment\@undefined +%<latexrelease>\let\BeforeBeginEnvironment\@undefined +%<latexrelease>\let\AfterEndEnvironment\@undefined +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} +% \end{macro} +% +% +% % \subsection{Center, Flushright, Flushleft} % % \begin{macrocode} @@ -738,10 +987,25 @@ % \end{macro} % % \begin{macro}{\@icentercr} +% \changes{v1.1t}{2020/04/21}{Support calc syntax (gh/152)} % \begin{macrocode} -\def\@icentercr[#1]{\vskip #1\ignorespaces} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2020/10/01}% +%<latexrelease> {\@icentercr}{centering, etc support calc}% +\def\@icentercr[#1]{\@vspace@calcify{#1}\ignorespaces} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +% \end{macrocode} +% +% \begin{macrocode} +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\@icentercr}{centering, etc support calc}% +%<latexrelease> +%<latexrelease>\def\@icentercr[#1]{\vskip #1\ignorespaces} +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> % \end{macrocode} -% % \end{macro} % % @@ -763,33 +1027,39 @@ % \begin{macrocode} %</2ekernel> %<*2ekernel|latexrelease> -%<latexrelease>\IncludeInRelease{2019/10/01}% -%<latexrelease> {\centering}{Make commands robust}% +%<latexrelease>\IncludeInRelease{2020/10/01}% +%<latexrelease> {\centering}{Set finaldhypendemerits}% % \end{macrocode} % % \begin{macro}{\centering} +% \changes{v1.1u}{2020/05/31}{Added \cs{finalhyphendemerits} setting (gh/247)} % \begin{macrocode} \DeclareRobustCommand\centering{% \let\\\@centercr \rightskip\@flushglue\leftskip\@flushglue + \finalhyphendemerits=\z@ \parindent\z@\parfillskip\z@skip} % \end{macrocode} % \end{macro} % % \begin{macro}{\raggedright} +% \changes{v1.1u}{2020/05/31}{Added \cs{finalhyphendemerits} setting (gh/247)} % \begin{macrocode} \DeclareRobustCommand\raggedright{% \let\\\@centercr\@rightskip\@flushglue \rightskip\@rightskip + \finalhyphendemerits=\z@ \leftskip\z@skip \parindent\z@} % \end{macrocode} % \end{macro} % % \begin{macro}{\raggedleft} +% \changes{v1.1u}{2020/05/31}{Added \cs{finalhyphendemerits} setting (gh/247)} % \begin{macrocode} \DeclareRobustCommand\raggedleft{% \let\\\@centercr \rightskip\z@skip\leftskip\@flushglue + \finalhyphendemerits=\z@ \parindent\z@\parfillskip\z@skip} % \end{macrocode} % \end{macro} @@ -797,6 +1067,23 @@ % \begin{macrocode} %</2ekernel|latexrelease> %<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{2019/10/01}% +%<latexrelease> {\centering}{Make commands robust}% +%<latexrelease> +%<latexrelease>\DeclareRobustCommand\centering{% +%<latexrelease> \let\\\@centercr +%<latexrelease> \rightskip\@flushglue\leftskip\@flushglue +%<latexrelease> \parindent\z@\parfillskip\z@skip} +%<latexrelease>\DeclareRobustCommand\raggedright{% +%<latexrelease> \let\\\@centercr\@rightskip\@flushglue \rightskip\@rightskip +%<latexrelease> \leftskip\z@skip +%<latexrelease> \parindent\z@} +%<latexrelease>\DeclareRobustCommand\raggedleft{% +%<latexrelease> \let\\\@centercr +%<latexrelease> \rightskip\z@skip\leftskip\@flushglue +%<latexrelease> \parindent\z@\parfillskip\z@skip} +%<latexrelease>\EndIncludeInRelease +%<latexrelease> %<latexrelease>\IncludeInRelease{0000/00/00}% %<latexrelease> {\centering}{Make commands robust}% %<latexrelease> @@ -983,6 +1270,7 @@ % \end{macrocode} % \end{macro} % +% \begin{environment}{verbatim} % \begin{macro}{\verbatim} % \begin{macro}{\endverbatim} % (RmS 93/09/19) Protected against `missing item' error message @@ -993,6 +1281,7 @@ % \end{macrocode} % \end{macro} % \end{macro} +% \end{environment} % % \begin{macro}{\verbatim@font} % \changes{v0.9a}{1993/11/21}{Macro added} @@ -1010,7 +1299,7 @@ %</2ekernel> %<*2ekernel|latexrelease> %<latexrelease>\IncludeInRelease{2018/12/01}% -%<latexrelease> {\verbvisiblespace}{Setup visible space for verb}% +%<latexrelease> {\verbvisiblespace}{Setup visible space for \verb}% % \end{macrocode} % % @@ -1092,15 +1381,71 @@ % \end{macrocode} % \end{macro} % +%^^A \@sverb was here +% +% \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>\EndIncludeInRelease +%<*2ekernel> +% \end{macrocode} +% +% % % \begin{macro}{\@sverb} +% \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{% +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2020/10/01}% +%<latexrelease> {\@sverb}{Drop spaces before \verb delimiter}% +% \end{macrocode} +% +% If the users types \verb=\verb !~! foo= then surprisingly we would +% get the space as the delimiter and thus +% ``\verb=!~!foo='' in the output. +% To avoid this scenario we check if \verb=#1= has the character +% code of a space, if so we recurse otherwise we call \cs{@@sverb} +% (which is the original definition of \cs{@sverb}. +% \changes{v1.1u}{2020/04/22}{Drop spaces before \cs{verb} delimiter (gh/327)} +% \begin{macrocode} +\def\@sverb#1{\if\noexpand#1 \expandafter\@sverb\else\@@sverb{#1}\fi} +% \end{macrocode} +% +% \begin{macrocode} +\def\@@sverb#1{% \catcode`#1\active \lccode`\~`#1% \gdef\verb@balance@group{\verb@egroup @@ -1120,39 +1465,28 @@ \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>\IncludeInRelease{2018/12/01}% +%<latexrelease> {\@sverb}{Setup visible space for \verb}% %<latexrelease> -%<latexrelease>\let\asciispace \@undefined -%<latexrelease>\let\verbvisiblespace \@undefined -%<latexrelease>\let\@setupverbvisiblespace\@undefined -%<latexrelease>\let\@verbvisiblespacebox \@undefined +%<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> \ifnum\catcode`\ =\active +%<latexrelease> \else \@setupverbvisiblespace \@vobeyspaces \fi +%<latexrelease>} +%<latexrelease>\let\@@sverb\@undefined +%<latexrelease>\EndIncludeInRelease %<latexrelease> +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\@sverb}{Setup visible space for \verb}% %<latexrelease>\def\@sverb#1{% %<latexrelease> \catcode`#1\active %<latexrelease> \lccode`\~`#1% @@ -1164,8 +1498,8 @@ %<latexrelease>\EndIncludeInRelease %<*2ekernel> % \end{macrocode} -% -% +% \end{macro} +% \end{macro} % % % \begin{macro}{\@makeother} |