texlive[69600] Master/texmf-dist: memoir (26jan24)

commits+karl at tug.org commits+karl at tug.org
Fri Jan 26 23:00:47 CET 2024


Revision: 69600
          https://tug.org/svn/texlive?view=revision&revision=69600
Author:   karl
Date:     2024-01-26 23:00:47 +0100 (Fri, 26 Jan 2024)
Log Message:
-----------
memoir (26jan24)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/memoir/README
    trunk/Master/texmf-dist/doc/latex/memoir/memman.pdf
    trunk/Master/texmf-dist/doc/latex/memoir/memman.tex
    trunk/Master/texmf-dist/source/latex/memoir/memoir.dtx
    trunk/Master/texmf-dist/source/latex/memoir/mempatch.dtx
    trunk/Master/texmf-dist/tex/latex/memoir/memhfixc.sty
    trunk/Master/texmf-dist/tex/latex/memoir/memoir.cls

Modified: trunk/Master/texmf-dist/doc/latex/memoir/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/memoir/README	2024-01-26 22:00:36 UTC (rev 69599)
+++ trunk/Master/texmf-dist/doc/latex/memoir/README	2024-01-26 22:00:47 UTC (rev 69600)
@@ -22,6 +22,79 @@
 compatible. Instead we assume that users use updated memoir with an
 updated LaTeX installation.
 
+Changes (2024/01/26)
+
+o memoir v3.8.2
+
+-- In v3.8 I forgot to add some internal testing code related to
+   \@startsection. The code experiment has now been added, but is not
+   enabled by default.
+
+-- Axel Sommerfeldt suggested a useful macro abstraction for
+   sidecaption and sidecontcaption that simplifies his adjustments
+   whenever the caption package is loaded. 
+
+-- Fixed a small (but important) typo in my maintainers note (Peter started
+   memoir in 2001, not 2021)
+
+-- The Nov-2023 kernel update gave issued with our version of \verb.
+   Now fixed by un-embedding the verbatim package. Issue first
+   reported by Andrew Swann.
+
+-- Fixed a typo in \m at make@footnotetext where ##1 got interpreted as a
+   macro name, not contents. Reported by Richard Zach.
+
+-- Replaced the embedded copy of the shortvrb package by loading the
+   package instead.
+
+-- Replaced the embedded and modified copy of the verbatim package by
+   just loading the package.
+
+   Have chosen to *not* patch in the modification back in. Primarily
+   because they are (1) disabled by default, (2) unknown how many
+   users actually use them, (3) the implementation had errors.
+
+   \setverbatimfont and the system to make comment-like envs of course
+   stayed.
+
+   The features removed are
+
+   - marking tabs using several spaces
+   - wrapping webatim text at white space
+
+   Macros disabled
+
+   - \tabson  (\tabsoff redef to do nothing)
+   - \wrappingon (\wrappingoff redef to do nothing)
+
+   No longer used
+
+   - \verbatimbreakchar
+   - \verbatimindent
+
+   Removing the embedded verbatim copy also fixes the issue with
+   \verb+a b+ behaving like \verb*+a b+.
+
+   Many of the other verbatim-like creations have had tabs support
+   removed
+
+-- In verbatim 1.5x the macro \verbatiminput* has been altered
+   slightly such that it also marks tabs as spaces (just like \verb*
+   now also does via a kernel update). If 1.5x has not been released
+   yet, we automatically apply that patch.
+
+-- Updated \readverbatim* with the same patch as \verbatiminput* so it
+   also marks tabs as spaces.
+
+
+
+o memhfixc v1.22
+
+-- The change Axel S. suggested in memoir removes the need for
+   memhfixc to redefine \endsidecaption and \endsidecaption, thus
+   those redefinitions have been removed.
+
+
 Changes (2023/08/21)
 
 o memoir v3.8.1

Modified: trunk/Master/texmf-dist/doc/latex/memoir/memman.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/memoir/memman.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/memoir/memman.tex	2024-01-26 22:00:36 UTC (rev 69599)
+++ trunk/Master/texmf-dist/doc/latex/memoir/memman.tex	2024-01-26 22:00:47 UTC (rev 69600)
@@ -389,8 +389,8 @@
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2023-08-08 16:33:42 +0200 (Tue, 08 Aug 2023) $}
-{$LastChangedRevision: 772 $}
+{$LastChangedDate: 2024-01-26 14:56:06 +0100 (Fri, 26 Jan 2024) $}
+{$LastChangedRevision: 806 $}
 {$LastChangedBy: daleif at math.au.dk $}
 
 \chapter{Remarks from the maintainer}
@@ -398,7 +398,7 @@
 
 
 When Peter Wilson released the first version of \theclass{} (back in
-2021), \LaTeX{} land was very different. Updating packages outside of
+2001), \LaTeX{} land was very different. Updating packages outside of
 the yearly release (TeXLive) had to be done by hand. Manuals for
 packages was \emph{not} even a requirement for CTAN. Thus it made
 sense to embed the functionality from several packages and provide
@@ -462,31 +462,13 @@
 removing certain functionality from \theclass. This will be things
 that does not really belong in \theclass, users should really get this
 functionality from somewhere else (some additional package). Unless it
-is clear that the macro has to go due to reimplemantation of a
-feature, the removal will be announced in advance (say 12--18 months),
-by adding a warning to the macro (especially if we would like the user
-to use a different macro). It will also be marked in the manual that
-the macro/environment will be removed in a future release.
+is clear that the macro has to go due to reimplemantation of a feature
+or that the feature probably is not used by that many people, the
+removal will be announced in advance (say 12--18 months), by adding a
+warning to the macro (especially if we would like the user to use a
+different macro). It will also be marked in the manual that the
+macro/environment will be removed in a future release.
 
-% Macros and environments currently under consideration (but not marked
-% yet) include: \begingroup
-% \renewcommand\descriptionlabel[1]{\hspace\labelsep\parbox[t]{\dimexpr\textwidth-5pt\relax}{#1}}
-% \begin{description}
-% \item[\cmd{\patchcommand}] 
-%   Users should use \cmd{\pretocmd} and \cmd{\apptocmd} from
-%   \Lpack{etoolbox}. The \Lpack{xpatch} package even have extended
-%   versions of them.
-% \item[ctabular]
-%   This is a breakable version of \Pe{tabular} but with not way of
-%   replicating the table header like for example \Lpack{longtable}
-%   can. These days there are several packages to handles tables.
-% \item[\cmd{\newloglike}]
-% \item[\cmd{\provideloglike}]
-%   Users should really use \cmd{\DeclareMathOperator} from
-%   \Lpack{amsopn} (autoloaded by the ever present \Lpack{amsmath}).
-% \end{description}
-% \endgroup
-
 \begin{flushright}
   Summer 2023
 
@@ -494,11 +476,13 @@
 \end{flushright}
 
 
+\begingroup
+\renewcommand\descriptionlabel[1]{\hspace\labelsep\parbox[t]{\dimexpr\textwidth-5pt\relax}{#1}}
+
+
 \section*{Public interfaces removed/disabled in v3.8}
 
 The four title macros was disabled due to the \cmd{\titleref} reimplementation.
-\begingroup
-\renewcommand\descriptionlabel[1]{\hspace\labelsep\parbox[t]{\dimexpr\textwidth-5pt\relax}{#1}}
 \begin{description}
 \item[\cmd{\currenttitle}] Would have given the title of the current
   sectional devide. Too risky to rely on, use
@@ -513,6 +497,21 @@
   formats before 2015. The package loading and the class option have
   been removed.
 \end{description}
+
+\section*{Public interfaces removed/disabled in v3.8.2}
+The following macros were discontinued due to the un-embedding of the \Lpack{verbatim package}
+\begin{description}
+\item[\cmd{\tabson}, \cmd{\tabsoff}] Used to be able to enable/disable
+  tab marking support in verbatim texts.
+\item[\cmd{\wrappingon}, \cmd{\wrappingoff}] Used to be able to enable
+  automatic line breaking at white space in verbatim
+  texts.\footnote{The implementation had bugs which were never
+    reported, thus probably not used that much.}
+\item[\cmd{\verbatimbreakchar}] Left on a verbatim line broken at
+  white space.
+\end{description}
+
+
 \endgroup
 
 
@@ -521,6 +520,10 @@
 
 
 
+
+
+
+
 %#% extend
 %#% extstart include preface.tex
 %\chapter{Foreword}
@@ -1451,8 +1454,8 @@
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2023-08-06 15:24:34 +0200 (Sun, 06 Aug 2023) $}
-{$LastChangedRevision: 767 $}
+{$LastChangedDate: 2024-01-10 16:45:12 +0100 (Wed, 10 Jan 2024) $}
+{$LastChangedRevision: 802 $}
 {$LastChangedBy: daleif at math.au.dk $}
 
 \chapter{Introduction to the eighth edition}
@@ -1831,7 +1834,7 @@
     \item \Lpack{parskip}
     \item \Lpack{patchcmd}
     \item \Lpack{setspace}
-    \item \Lpack{shortvrb}
+    %\item \Lpack{shortvrb}
     \item \Lpack{showidx}
       % \item \Lpack{tabularx}
     \item \Lpack{titleref}
@@ -1905,6 +1908,7 @@
   \item \Lpack{nameref}
   \item \Lpack{mparhack}~(if~twocolumn)
   \item \Lpack{memhfixc}~(if~\Lpack{hyperref}~is~loaded)
+  \item \Lpack{shortvrb}
   \end{lineitems}
 \end{center}
 
@@ -24121,8 +24125,8 @@
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2021-03-22 14:24:31 +0100 (Mon, 22 Mar 2021) $}
-{$LastChangedRevision: 706 $}
+{$LastChangedDate: 2024-01-25 16:57:21 +0100 (Thu, 25 Jan 2024) $}
+{$LastChangedRevision: 805 $}
 {$LastChangedBy: daleif at math.au.dk $}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -24259,7 +24263,7 @@
 
 \begin{recommended}
   See the \Lpack{tcolorbox} package by Thomas~F.~Sturm. An impressive
-  system of boxes and decorations and much much more. All based on TikZ.
+  system of boxes, decorations and much much more. All based on TikZ.
 \end{recommended}
 
 
@@ -24677,7 +24681,14 @@
     More encompassing \Ie{comment} environments are available if you
 use Victor Eijkhout's \Lpack{comment} package~\cite{COMMENT}.
 
+\fancybreak{}
 
+Do note that due to most syntax highlighting not being aware of your
+\Ie{comment}-like envs they are easy to miss in the code.
+
+
+
+
 \section{Verbatims}
 
 \index{verbatim|(}
@@ -24696,11 +24707,15 @@
 the \cmd{\verb}, or \cmd{\verb*}, ends the verbatim processing.
 \begin{syntax}
 \cmd{\MakeShortVerb}\marg{backslash-char} \\
+\cmd{\MakeShortVerb*}\marg{backslash-char} \\
 \cmd{\DeleteShortVerb}\marg{backslash-char} \\
 \end{syntax}
 \glossary(MakeShortVerb)%
   {\cs{MakeShortVerb}\marg{backslash-char}}%
   {Makes \meta{char} a shorthand for \cs{verb}\meta{char}.}
+\glossary(MakeShortVerb*)%
+  {\cs{MakeShortVerb*}\marg{backslash-char}}%
+  {Makes \meta{char} a shorthand for \cs{verb*}\meta{char}.}
 \glossary(DeleteShortVerb)%
   {\cs{DeleteShortVerb}\marg{backslash-char}}%
   {Returns \meta{char} to its normal meaning instead of being a shorthand 
@@ -24711,21 +24726,25 @@
 processing.
 Doing, for example \verb?\MakeShortVerb{\!}?, lets you then use 
 \verb?!verbatim text!?
-instead of the longer winded \verb?\verb!verbatim text!?. 
+instead of the longer winded \verb?\verb!verbatim text!?.
+The \cs{MakeShortVerb*} makes a version that uses \verb?\verb*? internally.
 
-    You have to pick
-as the short verb character one that you are unlikely to use; a good choice
-is often the \verb?|? bar character as this rarely used in normal text.
-This choice, though may be unfortunate if you want to have any tabulars with
-vertical lines, as the bar character is used to specify those. The
-\cmd{\DeleteShortVerb} macro is provided for this contingency; give it the
-same argument as an earlier \cmd{\MakeShortVerb} and it will restore
-the short verb character to its normal state.
+You have to pick as the short verb character one that you are unlikely
+to use; a good choice is often the \verb?|? bar character as this
+rarely used in normal text.  This choice, though may be unfortunate if
+you want to have any tabulars with vertical lines, as the bar
+character is used to specify those. The \cmd{\DeleteShortVerb} macro
+is provided for this contingency; give it the same argument as an
+earlier \cmd{\MakeShortVerb} and it will restore the short verb
+character to its normal state.
 
-    The \cmd{\MakeShortVerb} and \cmd{\DeleteShortVerb} macros come from the
-\Lpack{shortvrb} package which is part of the \ltx\ base system, but I 
-have found them so convenient that I added them to the class.
+The \cmd{\MakeShortVerb}, \cmd{\MakeShortVerb} and
+\cmd{\DeleteShortVerb} macros come from the \Lpack{shortvrb} package
+which is automatically loaded by the class.
 
+\fancybreak{}
+
+
 \begin{syntax}
 \cmd{\setverbatimfont}\marg{font-declaration} \\
 \end{syntax}
@@ -24760,12 +24779,12 @@
 After this we will switch back to the default verbatim font via
 \setverbatimfont{\normalfont\ttfamily}
 \end{verbatim}
-\setverbatimfont{\normalfont\ttfamily}
-In the normal way of things with an OT1 fontencoding, 
-typesetting the ligatures mentioned above
-in the sans font produces: 
-{\fontencoding{OT1}\fontfamily{cmss}\selectfont ligatures like ``, or '', or ---, or <, or >}, 
-which is not what happens in the \cmd{\verbatim} environment.
+\setverbatimfont{\normalfont\ttfamily} In the normal way of things
+with an OT1 fontencoding,\footnote{No-one should use OT1 encoding
+  anymore.}  typesetting the ligatures mentioned above in the sans
+font produces: {\fontencoding{OT1}\fontfamily{cmss}\selectfont
+  ligatures like ``, or '', or ---, or <, or >}, which is not what
+happens in the \cmd{\verbatim} environment.
 
 
 \begin{syntax}
@@ -24780,80 +24799,103 @@
 but does provide some extensions.}
  you can write anything you want (except
 \eenv{verbatim}), and it will be typeset exactly as written. The \Ie{verbatim*}
-environment is similar except, like with \cmd{\verb*}, spaces will be
+environment is similar except, like with \cmd{\verb*}, spaces and tabs will be
 indicated with a \verb*? ? mark.
 
-\begin{syntax}
-\cmd{\tabson}\oarg{number} \\
-\cmd{\tabsoff} \\
-\end{syntax}
-\glossary(tabson)%
-  {\cs{tabson}\oarg{number}}%
-  {Set \meta{number} of spaces in a verbatim for a TAB character;
-   default 4.}
-\glossary(tabsoff)%
-  {\cs{tabsoff}}%
-  {Ignore extra TAB spaces in a verbatim.} 
-\index{verbatim!with tab spaces}
-The standard \Ie{verbatim} environment ignores any TAB characters; with
-the class's environment after calling the \cmd{\tabson} declaration 
-the environment will handle TAB characters. By default 4 spaces are used
-to represent a TAB; the optional \meta{number} argument to the declaration
-will set the number of spaces for a TAB to be \meta{number}.
-Some folk like to use 8 spaces for a TAB, in which case they would need
-to declare \verb?\tabson[8]?. Unremarkably, the declaration \cmd{\tabsoff}
-switches off TABs. The class default is \cmd{\tabsoff}.
 
-\begin{syntax}
-\cmd{\wrappingon} \\
-\cmd{\wrappingoff} \\
-\lnc{\verbatimindent} \\
-\cmd{\verbatimbreakchar}\marg{char} \\
-\end{syntax}
-\glossary(wrappingon)%
-  {\cs{wrappingon}}%
-  {Wrap overlong verbatim lines.}
-\glossary(wrappingoff)%
-  {\cs{wrappingoff}}%
-  {The normal behaviour of not wrapping overlong verbatim lines.}
-\glossary(verbatimindent)%
-  {\cs{verbatimindent}}%
-  {Indent for wrapped overlong verbatim lines.}
-\glossary(verbatimbreakchar)%
-  {\cs{verbatimbreakchar}\marg{char}}%
-  {Character indicating a verbatim line is being wrapped.}
-As noted, whatever is written in a \Ie{verbatim} environment is output
-just as written, even if lines are too long\index{verbatim!wrap long lines} 
-to fit on the page. The
-declaration \cmd{\wrappingon} lets the environment break lines so that they
-do not overflow. The declaration \cmd{\wrappingoff} restores the normal
-behaviour.
+\begin{Changed}[January 2024]
+  The following macros are no longer used. They will either issue a
+  warning or do nothing. Users are encouraged to remove them.
+  \cmd{\tabson}\oarg{number}, \cmd{\tabsoff} (was the default),
+  \cmd{\wrappingon}, \cmd{\wrappingoff} (was the default).
 
-    The following is an example of how a wrapped verbatim line looks. In
-the source the contents of the \Ie{verbatim} was written as a single line.
-\wrappingon
-\begin{verbatim}
-This is an example of line wrapping in the verbatim environment. It is a single line in the source and the \wrappingon declaration has been used.
-\end{verbatim}
-\wrappingoff
+  These macro enabled tabs marking (by displaying tabs as sseveral
+  spaces) and automatic line wrapping (at white space) for
+  \Ie{verbatim} (it was never applied to \Ie{verbatim*}). As part of a
+  restructuring these features are no longer supported.
+\end{Changed}
 
-   The wrapped portion of verbatim lines are indented from the left margin
-by the length \lnc{\verbatimindent}. The value can be changed by the usual
-length changing commands. The end of each line that has been wrapped is marked
-with the \meta{char} character of the \cmd{\verbatimbreakchar} macro.
-The class default is \verb?\verbatimbreakchar{\char`\%}?, so that lines are 
-marked with \verb?%?.
-To put a `/' mark at the end of wrapped lines you can do
-\begin{lcode}
-\setverbatimbreak{\char'\/}
-\end{lcode}
-or similarly if you would like another character. Another possibility
-is
-\begin{lcode}
-\setverbatimchar{\char'\/\char'\*}
-\end{lcode}
-which will make `/*' the end marker.
 
+
+% \begin{syntax}
+% \cmd{\tabson}\oarg{number} \\
+% \cmd{\tabsoff} \\
+% \end{syntax}
+% \glossary(tabson)%
+%   {\cs{tabson}\oarg{number}}%
+%   {Set \meta{number} of spaces in a verbatim for a TAB character;
+%    default 4.}
+% \glossary(tabsoff)%
+%   {\cs{tabsoff}}%
+%   {Ignore extra TAB spaces in a verbatim.} 
+% \index{verbatim!with tab spaces}
+% The standard \Ie{verbatim} environment ignores any TAB characters; with
+% the class's environment after calling the \cmd{\tabson} declaration 
+% the environment will handle TAB characters. By default 4 spaces are used
+% to represent a TAB; the optional \meta{number} argument to the declaration
+% will set the number of spaces for a TAB to be \meta{number}.
+% Some folk like to use 8 spaces for a TAB, in which case they would need
+% to declare \verb?\tabson[8]?. Unremarkably, the declaration \cmd{\tabsoff}
+% switches off TABs. The class default is \cmd{\tabsoff}.
+
+% \begin{syntax}
+% \cmd{\wrappingon} \\
+% \cmd{\wrappingoff} \\
+% \lnc{\verbatimindent} \\
+% \cmd{\verbatimbreakchar} \\
+% \end{syntax}
+% \glossary(wrappingon)%
+%   {\cs{wrappingon}}%
+%   {Wrap overlong verbatim lines.}
+% \glossary(wrappingoff)%
+%   {\cs{wrappingoff}}%
+%   {The normal behaviour of not wrapping overlong verbatim lines.}
+% \glossary(verbatimindent)%
+%   {\cs{verbatimindent}}%
+%   {Indent for wrapped overlong verbatim lines.}
+% \glossary(verbatimbreakchar)%
+%   {\cs{verbatimbreakchar}}%
+%   {Character indicating a verbatim line is being wrapped.}
+% As noted, whatever is written in a \Ie{verbatim} environment is output
+% just as written, even if lines are too long\index{verbatim!wrap long lines} 
+% to fit on the page. The
+% declaration \cmd{\wrappingon} lets the environment break lines so that they
+% do not overflow. The declaration \cmd{\wrappingoff} restores the normal
+% behaviour.
+
+%     The following is an example of how a wrapped verbatim line looks. In
+% the source the contents of the \Ie{verbatim} was written as a single line.
+% \wrappingon
+% \begin{verbatim}
+% This is an example of line wrapping in the verbatim environment. It is a single line in the source and the \wrappingon declaration has been used.
+% \end{verbatim}
+% \wrappingoff
+
+%    The wrapped portion of verbatim lines are indented from the left margin
+% by the length \lnc{\verbatimindent}. The value can be changed by the usual
+% length changing commands. The end of each line that has been wrapped is marked
+% with the \meta{char} character of the \cmd{\verbatimbreakchar} macro.
+% The class default is \verb?\char`\%?, so that lines are 
+% marked with \verb?%?.
+% To put a `/' mark at the end of wrapped lines you can do
+% \begin{lcode}
+% \renewcommand*\verbatimbreakchar{\char'\/}
+% \end{lcode}
+% If you need something more exotic, you need to wrap it in a box:
+% \begin{lcode}
+% \renewcommand*\verbatimbreakchar{\mbox{$\downarrow$}}
+% \end{lcode}
+% which will make `$\downarrow$' the end marker.\footnote{Internally the
+%   \cs{discretionary} macro is used to typeset \cs{verbatimbreakchar},
+%   so the break char should be what ever \cs{discretionary} can
+%   handle.}
+
+% \begin{caveat}
+%   \cmd{\wrappingon} combined with \Ie{verbatim*} does not work, the
+%   wrapping part is ignored. Currently there are no plans to fix this.
+% \end{caveat}
+
+
 \subsection{Boxed verbatims}
 
     Verbatim environments are often used to present program code or, as
@@ -28290,8 +28332,8 @@
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2023-08-06 23:23:21 +0200 (Sun, 06 Aug 2023) $}
-{$LastChangedRevision: 768 $}
+{$LastChangedDate: 2024-01-25 16:57:21 +0100 (Thu, 25 Jan 2024) $}
+{$LastChangedRevision: 805 $}
 {$LastChangedBy: daleif at math.au.dk $}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -29906,186 +29948,7 @@
 which will result in an overall space of 5/18\,em 
 (from $(4 + 4 - 3)/18$).
 
-\begin{comment}
-\section{Cross references}\label{sec:xrefthis}  \label{sec:xref}
 
-    LaTeX supplies the \cmd{\ref} and \cmd{\pageref} commands for cross
-referencing to a label or a page which has a label on it.
-
-\begin{syntax}
-\cmd{\fref}\marg{label} \cmd{\figurerefname} \\
-\cmd{\tref}\marg{label} \cmd{\tablerefname} \\
-\cmd{\pref}\marg{label} \cmd{\pagerefname} \\
-\end{syntax}
- 
-    The class provides these more particular named references to a figure\index{figure!reference},
-table\index{table!reference} or page\index{page!reference}. For example the default definitions of \cmd{\fref} and 
-\cmd{\pref} are
-\begin{lcode}
-\newcommand{\fref}[1]{\figurerefname~\ref{#1}}
-\newcommand{\pref}[1]{\pagerefname~\pageref{#1}}
-\end{lcode}
-and can be used as 
-\begin{lcode}
-\ldots footnote parameters are shown in~\fref{fig:fn} on~\pref{fig:fn}.
-\end{lcode}
-which in this document prints as: 
-\begin{syntax}
-\ldots footnote parameters are shown in~\fref{fig:fn} on~\pref{fig:fn}. \\
-\end{syntax}
-
-\begin{syntax}
-\cmd{\Pref}\marg{label} \cmd{\partrefname} \\
-\cmd{\Cref}\marg{label} \cmd{\chapterrefname} \\
-\cmd{\Sref}\marg{label} \cmd{\sectionrefname} \\
-\end{syntax}
-
-    Also provided are named references to labelled 
-Part (\cmd{\Pref}), 
-Chapter (\cmd{\Cref}) and 
-sectional (\cmd{\Sref}) divisions.
-These are all defined like
-\begin{lcode}
-\newcommand{\Sref}[1]{\sectionrefname\ref{#1}}
-\end{lcode}
-with no tie between the name and the \cmd{\ref}. 
-
-    In this document
-\begin{lcode}
-`In \Cref{chap:misc} there is a section 
-(\Sref{sec:xrefthis}) about cross references.' 
-\end{lcode}
-is typeset as: 
-\begin{syntax}
-`In \Cref{chap:misc} there is a section 
-(\Sref{sec:xrefthis}) about cross references.' \\
-\end{syntax}
- 
-    It can be useful to refer to parts of a document by name rather than
-number, as in
-\begin{lcode}
-The chapter \textit{\titleref{chap:bringhurst}} describes \ldots
-\end{lcode}
-The chapter \textit{\titleref{chap:bringhurst}} describes \ldots
-
-    There are two packages, \Lpack{nameref}~\cite{NAMEREF} and 
-\Lpack{titleref}~\cite{TITLEREF},
- that let you refer to things by name instead of number.
-
-    Name references were added to the class as a consequence of adding
-a second optional argument to the sectioning commands. I found
-that this broke the \Lpack{nameref} package, and hence the
-\Lpack{hyperref} package as well, so they had to be fixed. The change 
-also broke Donald Arseneau's \Lpack{titleref} package, and it turned out
-that \Lpack{nameref} also clobbered \Lpack{titleref}. The class also
-provides titles, like \cmd{\poemtitle}, that are not recognised by
-either of the packages. From my viewpoint the most efficient
-thing to do was to enable the class itself to provide name 
-referencing.
-
-\begin{syntax}
-\cmd{\label}\marg{key} \cmd{\ref}\marg{key} \cmd{\pageref}\marg{key} \\
-\cmd{\titleref}\marg{key} \\
-\cmd{\headnamereftrue} \cmd{\headnamereffalse} \\
-\end{syntax}
-The macro \cmd{\titleref} is an addition to the usual set of cross referencing
-commands. Instead of typesetting a number it typesets the title associated
-with the labelled number. This is, of course, only useful if there is an
-associated title, such as from a \cmd{\caption} or \cmd{\section} command.
-As a bad example:
-\begin{lcode}
-Labelling for \verb?\titleref? may be applied to:
-\begin{enumerate}
-\item Chapters, sections, etc.       \label{sec:xref:item1}
-...
-\item Items in numbered lists, etc. \ldots \label{sec:xref:item3}
-\end{enumerate}
-Item \ref{sec:xref:item2} in section~\ref{sec:xref} mentions captions
-while item \titleref{sec:xref:item3} in the same section 
-\textit{\titleref{sec:xref}} lists other things.
-\end{lcode}
-Labelling for \verb?\titleref? may be applied to:
-\begin{enumerate}
-\item Chapters, sections, etc.       \label{sec:xref:item1}
-\item Captions                       \label{sec:xref:item2}
-\item Legends
-\item Poem titles
-\item Items in numbered lists, etc.  \label{sec:xref:item3}
-\end{enumerate}
-Item \ref{sec:xref:item2} in section~\ref{sec:xref} mentions captions
-while item \titleref{sec:xref:item3} in the same section 
-\textit{\titleref{sec:xref}} lists other things.
-
-
-    As the above example shows, you have to be a little careful in using
-\cmd{\titleref}.
-Generally speaking, \cmd{\titleref}\marg{key} produces the last named 
-thing before the \cmd{\label} that defines the \meta{key}. 
-
-    Chapters, and the lower level sectional divisions, may have three
-different title texts --- the main title, the title in the ToC, and a third
-in the page header. By default (\cmd{\headnamereffalse}) the ToC title
-is produced by \cmd{\titleref}. Following the declaration
-\cmd{\headnamereftrue} the text intended for page headers will be produced.
-
-\Note{} Specifically with the \Lclass{memoir} class, 
-do not put a \cmd{\label} command inside an
-argument to a \cmd{\chapter} or \cmd{\section} or \cmd{\caption}, etc.,
-command. Most likely it will either be ignored or referencing it will
-produce incorrect values. This restriction does not apply to the standard
-classes, but in any case I think it is good practice not to embed any 
-\cmd{\label} commands.
-
-\begin{syntax}
-\cmd{\currenttitle} \\
-\end{syntax}
-    If you just want to refer to the current title you can do so with
-\cmd{\currenttitle}. This acts as though there had been a label associated
-with the title and then \cmd{\titleref} had been used to refer to that label.
-For example:
-\begin{lcode}
-This sentence in the section titled `\currenttitle' is an example of the
-use of the command \verb?\currenttitle?.
-\end{lcode}
-This sentence in the section titled `\currenttitle' is an example of the
-use of the command \verb?\currenttitle?.
-
-
-\begin{syntax}
-\cmd{\theTitleReference}\marg{num}\marg{text} \\
-\end{syntax}
-Both \cmd{\titleref} and \cmd{\currenttitle} use the \cmd{\theTitleReference}
-to typeset the title. This is called with two arguments --- 
-the number, \meta{num}, and the text, \meta{text}, of the title. The
-default definition is:
-\begin{lcode}
-\newcommand{\theTitleReference}[2]{#2}
-\end{lcode}
-so that only the \meta{text} argument is printed. You could, for example,
-change the definition to
-\begin{lcode}
-\renewcommand{\theTitleReference}[2]{#1\space \textit{#2}}
-\end{lcode}
-to print the number followed by the title in italics. If you do this, only use
-\cmd{\titleref} for numbered titles, as a printed number for an 
-unnumbered title (a) makes no sense, and (b) will in any case be 
-incorrect.
-
-    The commands \cmd{\titleref}, \cmd{\theTitleReference} and 
-\cmd{\currenttitle} are direct equivalents of those in the \Lpack{titleref}
-package~\cite{TITLEREF}.
-
-\begin{syntax}
-\cmd{\namerefon} \cmd{\namerefoff} \\
-\end{syntax}
-   Implementing name referencing has had an unfortunate side effect of
-turning some arguments into moving ones; the argument to the \cmd{\legend}
-command is one example. If you don't need name referencing you can turn
-it off by the \cmd{\namerefoff} declaration; the \cmd{\namerefon}
-declaration enables name referencing.
-
-\end{comment}
-
 \section{Adding a period}
 
     Much earlier, when showing the code for the sectional division styles
@@ -32640,35 +32503,40 @@
 
 \svnidlong
 {$Ignore: $}
-{$LastChangedDate: 2023-08-14 12:41:03 +0200 (Mon, 14 Aug 2023) $}
-{$LastChangedRevision: 777 $}
+{$LastChangedDate: 2024-01-26 14:56:06 +0100 (Fri, 26 Jan 2024) $}
+{$LastChangedRevision: 806 $}
 {$LastChangedBy: daleif at math.au.dk $}
 
 \chapter{Packages and macros}
 
     The \Mname\ class does not provide for everything that you
-have seen in the manual. I have used some packages that you are very likely
+have seen in the manual. We have used some packages that you are very likely
 to have in your \ltx\ distribution, and have supplemented these with some
-additional macros, some of which I will show you.
+additional macros, some of which we will show you.
 
 \section{Packages}
 
-    The packages that I have used that you are likely to have, and if
+    The packages that we have used that you are likely to have, and if
 you do  not have them please consider getting them,
-are:\fxnote[author=dlf,vadj=0em]{2023/08/10: rewrite}
+are:
 \begin{itemize}
-\item \Lpack{etex} lets you take advantage of e\tx's extended support
-      for counters and such.
+% \item \Lpack{etex} lets you take advantage of e\tx's extended support
+%       for counters and such.
 
-      Note that from 2015 and onwards, the allocation of extra
-      registers have now been build into the LaTeX kernel. Thus in
-      most cases the \Lpack{etex} package is no longer
-      necessary. There are how ever extra very special features left
-      in \Lpack{etex} that \emph{some} users may need. In that case
-      please remember to load \Lpack{etex} by placing
-      \verb|\RequirePackage{etex}| \emph{before} \cs{documentclass}! 
+%       Note that from 2015 and onwards, the allocation of extra
+%       registers have now been build into the LaTeX kernel. Thus in
+%       most cases the \Lpack{etex} package is no longer
+%       necessary. There are how ever extra very special features left
+%       in \Lpack{etex} that \emph{some} users may need. In that case
+%       please remember to load \Lpack{etex} by placing
+%       \verb|\RequirePackage{etex}| \emph{before} \cs{documentclass}! 
 \item \Lpack{url}~\cite{URL} is for typesetting URL's without worrying
   about special characters or line breaking.
+
+  Nowadays \Lpack{xurl}~\cite{XURL} is probably better as it allows
+  more preak points.
+
+  
 % \item \Lpack{fixltx2e}~\cite{FIXLTX2E} eliminates some infelicities
 %       of the original LaTeX kernel. In particular it maintains the order
 %       of floats\index{float} on a twocolumn\index{column!double} page 
@@ -40407,37 +40275,37 @@
 \newblock Hartley \& Marks, 2nd edition, 1999.
 \newblock ISBN 0--88179--033--8.
 
-\bibitem[Car14a]{AFTERPAGE}
+\bibitem[Car14]{DELARRAY}
 David Carlisle.
-\newblock {\em The afterpage package}, 2014.
+\newblock {\em The delarray package}, 2014.
 \newblock \viaCTANurl{/macros/latex/required/tools/}.
 
-\bibitem[Car14b]{DCOLUMN}
+\bibitem[Car15]{ENUMERATE}
 David Carlisle.
-\newblock {\em The dcolumn package}, 2014.
+\newblock {\em The enumerate package}, 2015.
 \newblock \viaCTANurl{/macros/latex/required/tools/}.
 
-\bibitem[Car14c]{DELARRAY}
+\bibitem[Car21]{LONGTABLE}
 David Carlisle.
-\newblock {\em The delarray package}, 2014.
+\newblock {\em The longtable package}, 2021.
 \newblock \viaCTANurl{/macros/latex/required/tools/}.
 
-\bibitem[Car15]{ENUMERATE}
+\bibitem[Car23a]{AFTERPAGE}
 David Carlisle.
-\newblock {\em The enumerate package}, 2015.
+\newblock {\em The afterpage package}, 2023.
 \newblock \viaCTANurl{/macros/latex/required/tools/}.
 
-\bibitem[Car20]{TABULARX}
+\bibitem[Car23b]{DCOLUMN}
 David Carlisle.
-\newblock {\em The tabularx package}, 2020.
+\newblock {\em The dcolumn package}, 2023.
 \newblock \viaCTANurl{/macros/latex/required/tools/}.
 
-\bibitem[Car21]{LONGTABLE}
+\bibitem[Car23c]{TABULARX}
 David Carlisle.
-\newblock {\em The longtable package}, 2021.
+\newblock {\em The tabularx package}, 2023.
 \newblock \viaCTANurl{/macros/latex/required/tools/}.
 
-\bibitem[Car23]{textcase}
+\bibitem[Car23d]{textcase}
 David Carlisle.
 \newblock {\em The textcase package}, 2023.
 \newblock The package is marked \emph{obsolete} as of the June 2022 \LaTeX\
@@ -40495,10 +40363,10 @@
 
 \bibitem[dP84]{PARVILLE84}
 H.~de~Parville.
-\newblock {\em Recreations mathematique: {La Tour d'Hanoi} et la question du
-  {Tonkin}}.
+\newblock {\em R{\'e}cr{\'e}ations math{\'e}matiques: {La Tour d'Hanoi} et la
+  question du {Tonkin}}.
 \newblock La Nature, 1884.
-\newblock part {I}:285--286, Paris 1884\fixme{data not correct}.
+\newblock Part {I}: 285--286, Paris 1884.
 
 \bibitem[Eij07]{TEXBYTOPIC}
 Victor Eijkhout.
@@ -40551,6 +40419,13 @@
 \newblock Addison-Wesley, 2007.
 \newblock ISBN 0--321--50892--0.
 
+\bibitem[GR99]{WCOMPANION}
+Michel Goossens and Sebastian {Rahtz (with Eitan Gurari, Ross Moore and Robert
+  Sutor)}.
+\newblock {\em The LaTeX Web Companion: Integrating TeX, HTML and XML}.
+\newblock Addison-Wesley, 1999.
+\newblock ISBN 0--201--43311--7.
+
 \bibitem[Hoe98]{HOENIG98}
 Alan Hoenig.
 \newblock {\em TeX Unbound: LaTeX and TeX strategies for fonts, graphics, and
@@ -40652,12 +40527,12 @@
 \newblock Thames \& Hudson, 1980.
 \newblock ISBN 0--500--68022--1.
 
-\bibitem[{Mic}99]{WCOMPANION}
-{Michel Goossens and Sebastian Rahtz (with Eitan Gurari, Ross Moore and Robert
-  Sutor)}.
-\newblock {\em The LaTeX Web Companion: Integrating TeX, HTML and XML}.
-\newblock Addison-Wesley, 1999.
-\newblock ISBN 0--201--43311--7\fixme{author needs fixing}.
+\bibitem[MG04]{COMPANION}
+Frank Mittelbach and Michel {Goossens with Johannes Braams, David Carlisle and
+  Chris Rowley}.
+\newblock {\em The \LaTeX\ Companion}.
+\newblock Addison-Wesley, 2nd edition, 2004.
+\newblock ISBN 0--201--36299--6.
 
 \bibitem[Mit23a]{MULTICOL}
 Frank Mittelbach.
@@ -40684,13 +40559,6 @@
 \newblock {\em Geometric Modeling}.
 \newblock John Wiley \& Sons, 1985.
 
-\bibitem[Mw04]{COMPANION}
-Frank Mittelbach and Michel~Goossens {with Johannes Braams, David Carlisle and
-  Chris Rowley}.
-\newblock {\em The \LaTeX\ Companion}.
-\newblock Addison-Wesley, 2nd edition, 2004.
-\newblock ISBN 0--201--36299--6.\fixme{with authors}.
-
 \bibitem[NG23]{SIDECAP}
 Rolf Niespraschk and Hubert G{\"{a}\ss{}}lein.
 \newblock {\em The sidecap package}, 2023.
@@ -40797,9 +40665,8 @@
 \newblock The treasure chest: Package tours from ctan.
 \newblock {\em TUGboat}, 20(1):53--58, 1999.
 
-\bibitem[TJR17]{CALC}
-Kresten~Krab Thorup, Frank Jensen, and Chris {Rowley\fxnote{should be (and
-  Chris Rowley)}}.
+\bibitem[TJ17]{CALC}
+Kresten~Krab Thorup and Frank {Jensen (and Chris Rowley)}.
 \newblock {\em The calc package --- Infix notation arithmetic in LaTeX}, 2017.
 \newblock \viaCTANurl{/macros/latex/required/tools/}.
 

Modified: trunk/Master/texmf-dist/source/latex/memoir/memoir.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/memoir/memoir.dtx	2024-01-26 22:00:36 UTC (rev 69599)
+++ trunk/Master/texmf-dist/source/latex/memoir/memoir.dtx	2024-01-26 22:00:47 UTC (rev 69600)
@@ -20,7 +20,7 @@
 % This work consists of the files listed in the README file.
 % 
 % \fi
-% \CheckSum{28664} 
+% \CheckSum{28075} 
 %
 % \changes{v0.1}{2001/05/20}{First public alpha release}
 % \changes{v0.2}{2001/06/03}{First beta release}
@@ -203,6 +203,8 @@
 % \def\fileversion{v3.7r}          \def\filedate{2022/07/29} 
 % \def\fileversion{v3.7.19}          \def\filedate{2022/11/17} 
 % \def\fileversion{v3.8}          \def\filedate{2023/08/08} 
+% \def\fileversion{v3.8.1}          \def\filedate{2023/08/21} 
+% \def\fileversion{v3.8.2}          \def\filedate{2024/01/26} 
 % \title{The LaTeX \Lpack{memoir} class for configurable book 
 %        typesetting: Source code\thanks{This
 %        file (\texttt{\dtxfile}) has version number \fileversion, last revised
@@ -435,8 +437,8 @@
 %    Announce the name, option files and version for LaTeX2e files:
 %    \begin{macrocode}
 %<class>\ProvidesClass{memoir}%
-%<class>  [2023/08/21 v3.8.1 configurable book, report, article document class]
-%<class>\newcommand\memversion{v3.8.1, 2023/08/21}
+%<class>  [2024/01/26 v3.8.2 configurable book, report, article document class]
+%<class>\newcommand\memversion{v3.8.2, 2024/01/26}
 %    \end{macrocode}
 %
 % \changes{v3.7m}{2020/08/05}{Added \cs{IfFormatAtLeastTF}}
@@ -10854,60 +10856,132 @@
 % \changes{v1.4}{2003/11/22}{Added extra optional arg to \cs{@startsection}
 %                            (from patch v1.4)}
 % \item make sure it is not effected by a non-zero \cs{parskip}
-% \changes{v3.6j}{2011/03/02}{added the above feature}
+%   \changes{v3.6j}{2011/03/02}{added the above feature}
+% \item store the name of the type in \cs{m at msecn@me}
 % \end{itemize}
-% The original is in \file{ltsect.dtx}. \\
+% The original is in \file{latex.ltx}. \\
 % \cs{@startsection}\marg{name}\marg{level}\marg{indent} \\
 % \hspace*{1.5in} \marg{beforeskip}\marg{afterskip}\marg{style}
+%
+% In order to make experiments with the tagging code, we only make the
+% redefinition, if \textsf{dev-mode} is not active. Otherwise we
+% patch. It is intentional that the patches are ``talkative''.
+% \changes{v3.8.2}{2023/08/24}{Forgot to add this patching branch in 3.8}
 %    \begin{macrocode}
-\renewcommand{\@startsection}[6]{%
+\ifmem at devmode
+
 %    \end{macrocode}
+% The first patch add the block hook, the raggedbottom secton code,
+% and the storing of the name of the section type.
+%    \begin{macrocode}
+  \patchcmd\@startsection{%
+    \if at noskipsec \leavevmode \fi%
+  }{%
+    \@nameuse{#1block}%
+    \ifraggedbottomsection\if at nobreak\else
+        \vskip\z@\@plus\bottomsectionskip
+        \penalty\bottomsectionpenalty
+        \vskip\z@\@plus -\bottomsectionskip
+      \fi\fi
+    \def\m at msecn@me{#1}%
+    \if at noskipsec \leavevmode \fi%
+  }%
+  {\typeout{\string\@startsection\space patch 1 success}}
+  {\typeout{\string\@startsection\space patch 1 failed}}
+
+%    \end{macrocode}
+% The second patch adds a small adjustment that help counter the
+% effect of a non-zero \cs{parskip}
+%    \begin{macrocode}
+  \patchcmd\@startsection{%
+    \addpenalty\@secpenalty\addvspace\@tempskipa%
+  }{%
+    \addpenalty\@secpenalty\addvspace\@tempskipa
+    \addvspace{-\parskip}% <--- added 2011/03/02
+  }%
+  {\typeout{\string\@startsection\space patch 2 success}}
+  {\typeout{\string\@startsection\space patch 2 failed}}
+
+%    \end{macrocode}
+% The third patch completely replaces
+% \begin{verbatim}
+% \@ifstar
+%     {\@ssect{#3}{#4}{#5}{#6}}%
+%     {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}
+% \end{verbatim}
+% as we need to handle two optional args not just the normal
+% 1. Perhaps there are better ways.
+%    \begin{macrocode}
+  \patchcmd\@startsection{%
+     \@ifstar%
+     {\@ssect{#3}{#4}{#5}{#6}}%
+     {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}%
+   }{%
+     \@ifstar%
+    {\@ssect{#3}{#4}{#5}{#6}}%
+    {\@trplargoom{\M at sect{#1}{#2}{#3}{#4}{#5}{#6}}}%
+  }%
+  {\typeout{\string\@startsection\space patch 3 success}}
+  {\typeout{\string\@startsection\space patch 3 failed}}
+ 
+\else % standard branch for dev-mode false
+%    \end{macrocode}
+% Then the normal redefinition
+%    \begin{macrocode}
+  \renewcommand{\@startsection}[6]{%
+%    \end{macrocode}
 % \changes{v3.6h}{2011/02/07}{Added float block hook}
 %    \begin{macrocode}
-  \@nameuse{#1block}%
+    \@nameuse{#1block}%
 %    \end{macrocode}
 % Do raggedbottom stuff.
 % \changes{v3.6k}{2012/07/22}{Made the \cs{raggedbottomsection}
 % penalty configurable}
 %    \begin{macrocode}
-  \ifraggedbottomsection\if at nobreak\else
-    \vskip\z@\@plus\bottomsectionskip
-    \penalty\bottomsectionpenalty
-    \vskip\z@\@plus -\bottomsectionskip
-  \fi\fi
+    \ifraggedbottomsection\if at nobreak\else
+      \vskip\z@\@plus\bottomsectionskip
+      \penalty\bottomsectionpenalty
+      \vskip\z@\@plus -\bottomsectionskip
+    \fi\fi
 %    \end{macrocode}
 % Save the section name.
 %    \begin{macrocode}
-  \def\m at msecn@me{#1}%
+    \def\m at msecn@me{#1}%
 %    \end{macrocode}
 % The original code.
 %    \begin{macrocode}
-  \if at noskipsec \leavevmode \fi
-  \par
-  \@tempskipa #4\relax
-  \@afterindenttrue
-  \ifdim \@tempskipa <\z@
-    \@tempskipa -\@tempskipa \@afterindentfalse
-  \fi
-  \if at nobreak
-    \everypar{}%
-  \else
+    \if at noskipsec \leavevmode \fi
+    \par
+    \@tempskipa #4\relax
+    \@afterindenttrue
+    \ifdim \@tempskipa <\z@
+      \@tempskipa -\@tempskipa \@afterindentfalse
+    \fi
+    \if at nobreak
+      \everypar{}%
+    \else
 %    \end{macrocode}
 % Slight change such that the effect of \cs{parskip} is cancelled
 % \changes{v3.6j}{2011/03/02}{Adding a negative \cs{parskip} seem to
 % be able to remove the effect of a non-zero \cs{parskip}}
 %    \begin{macrocode}
-    \addpenalty\@secpenalty\addvspace\@tempskipa
-    \addvspace{-\parskip}% <--- added 2011/03/02
-  \fi
+      \addpenalty\@secpenalty\addvspace\@tempskipa
+      \addvspace{-\parskip}% <--- added 2011/03/02
+    \fi
 %    \end{macrocode}
 % For the extra optional argument, change the original \verb?\@dblarg{\@sect{...?
 % below to \verb?\@trplargoom{\M at sect{...?.
 %    \begin{macrocode}
-  \@ifstar
-    {\@ssect{#3}{#4}{#5}{#6}}%
-    {\@trplargoom{\M at sect{#1}{#2}{#3}{#4}{#5}{#6}}}}
+    \@ifstar
+      {\@ssect{#3}{#4}{#5}{#6}}%
+      {\@trplargoom{\M at sect{#1}{#2}{#3}{#4}{#5}{#6}}}}
+  
+%    \end{macrocode}
+% end dev-mode-else branch for \cs{@startsection}:
+%    \begin{macrocode}
 
+\fi % en dev-mode else branch
+
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
@@ -12682,7 +12756,31 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\raggedwrap}
+% 
+%   \changes{v3.8.2}{2024/01/25}{Code moved here from the verbatim
+%   section. The code where it was uses has been removed, but the
+%   macro might still be interesting.}
 %
+%   \cs{raggedwrap} is a variation on \cs{raggedright} (\cs{leftskip}
+%   is set to \cs{@totalleftmargin} instead of 0pt), and seems to have
+%   fixed the problem with the original code which used
+%   \cs{raggedright}.  \changes{v1.61803}{2008/01/30}{Added
+%   \cs{raggedwrap} (mempatch v4.4)}
+%   \changes{v1.61803398}{2009/07/18}{Added bidi support to
+%   \cs{raggedwrap}}
+%    \begin{macrocode}
+\newcommand*{\raggedwrap}{%
+  \@rightskip\@flushglue
+%%%  \rightskip\@rightskip
+  \memRTLrightskip\@rightskip
+%%%  \leftskip\@totalleftmargin
+  \memRTLleftskip\@totalleftmargin
+  \parindent\ragrparindent}
+
+%    \end{macrocode}
+% \end{macro}
+% 
 % \subsubsection{Hanging}
 %
 % \begin{macro}{\hangfrom}
@@ -18102,7 +18200,20 @@
 % \end{macro}
 %
 % \begin{macro}{\endsidecaption}
-% \cs{endsidecaption} does the work for \verb?\end{sidecaption}?.
+% \begin{macro}{\endsidecaption at refstepcounter}
+% \cs{endsidecaption} does the work for
+% \verb?\end{sidecaption}?.
+
+% First we define a helper macro that others can hook into. Here is
+% the default definition. The two arguments are either two copies of
+% \cs{@captype} or for the cont version, \cs{@captype} and
+% \texttt{memhycontfloat}. Then this macro is redefined whenever
+% \Lpack{hyperref} is loaded (via \Lpack{memhfixc}). The addition
+% eliminates the need for a full macro redef in \Lpack{memhfixc}.
+% \changes{v3.8.2}{2023/09/10}{Added macro at the suggestion of Axel Sommerfelt}
+%    \begin{macrocode}
+\newcommand*\sidecaption at refstepcounter[2]{\refstepcounter{#1}}
+%    \end{macrocode}
 %
 % Finish the float minipage, then increment the caption counter and
 % call \cs{label} via \cs{m at mscaplabel}.
@@ -18109,13 +18220,16 @@
 %    \begin{macrocode}
 \def\endsidecaption{%
   \m at mscapend@fbox
-  \refstepcounter\@captype
+%    \end{macrocode}
+% % \changes{v3.8.2}{2023/09/10}{Added macro call at the suggestion of Axel Sommerfelt}
+%    \begin{macrocode}
+  \sidecaption at refstepcounter\@captype\@captype
   \m at mscaplabel
 %    \end{macrocode}
 % \changes{v3.6k}{2012/08/19}{We need to move \cs{m at mscapcheckside}
 % here or the \cs{sidecapstyle} inside the box, will never work correctly.}
 %    \begin{macrocode}
-  \m at mscapcheckside %<--- added 2012/08/19
+  \m at mscapcheckside%
 %    \end{macrocode}
 % Set the caption inside a minipage, saving it in box \cs{m at mscap@capbox}.
 %    \begin{macrocode}
@@ -18131,6 +18245,7 @@
   \m at mscapopboxes}
 %    \end{macrocode}
 % \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\m at mscapopboxes}
 % Having determined how high the caption box must be raised with
@@ -18348,7 +18463,12 @@
 %    \begin{macrocode}
 \def\endsidecontcaption{%
   \m at mscapend@fbox
-  \addtocounter{\@captype}{\m at ne}\refstepcounter\@captype
+  \addtocounter{\@captype}{\m at ne}
+%    \end{macrocode}
+% \changes{3.8.2}{2023/09/10}{factor refstep counter as in \cs{endsidecaption}}
+%    \begin{macrocode}
+  \sidecaption at refstepcounter\@captype{memhycontfloat}
+  %\refstepcounter\@captype
   \m at mscaplabel
 %    \end{macrocode}
 % \changes{v3.7b}{2013/05/30}{Forgot the side check}
@@ -24152,20 +24272,24 @@
 %    \begin{macrocode}
 \newcommand{\m at make@footnotetext}[1]{%
   \@namelongdef{@footnotetext#1}##1{%
-  \insert\@nameuse{footins#1}{%
-  \def\baselinestretch{\m at m@footnote at spacing}% 
-  \reset at font\@nameuse{foottextfont#1}%
-  \@preamfntext
-  \hsize\columnwidth
-  \def\@currentcounter{footnote}%
-  \protected at edef\@currentlabel{%
-    \csname p at footnote#1\endcsname\@nameuse{@thefnmark#1}}% 
-  \color at begingroup
-    \@nameuse{@makefntext#1}{%
-      \rule\z@\footnotesep\ignorespaces\@nameuse{foottextfont#1 ##1}%
-      \@finalstrut\strutbox}%
+    \insert\@nameuse{footins#1}{%
+      \def\baselinestretch{\m at m@footnote at spacing}% 
+      \reset at font\@nameuse{foottextfont#1}%
+      \@preamfntext
+      \hsize\columnwidth
+      \def\@currentcounter{footnote}%
+      \protected at edef\@currentlabel{%
+        \csname p at footnote#1\endcsname\@nameuse{@thefnmark#1}}% 
+      \color at begingroup
+      \@nameuse{@makefntext#1}{%
+%    \end{macrocode}
+% \changes{v3.8.2}{2024/01/03}{Bug: \#\#1 needs to be outside of \cs{@nameuse}, reported in \url{https://tex.stackexchange.com/questions/706033/footnotes-defined-with-newfootnoteseries-dont-work/}}
+%    \begin{macrocode}
+        \rule\z@\footnotesep\ignorespaces\@nameuse{foottextfont#1}##1%
+        \@finalstrut\strutbox}%
   \color at endgroup}%
-  \m at mmf@prepare}}
+  \m at mmf@prepare}%
+}
 
 %    \end{macrocode}
 % \end{macro}
@@ -27563,523 +27687,81 @@
 
 %    \end{macrocode}
 %
+%
 % \section{Verbatims, boxes, and files}
 %
-% All the code in this section was added for version 1.2 of the class.
-% \changes{v1.2}{2002/07/27}{Section `Verbatims, boxes and files' added}
 %
-% \subsection{Modified version of the verbatim package}
-%
-% Much of this is from the \Lpack{verbatim} package code~\cite{VERBATIM}.
-% Unless indicated otherwise, the code and commentary is from that
+% Until January 2024 the class contained an embedded and modified
+% version of the \Lpack{verbatim} package where PW had added some
+% extra features to the verbatim system. As time have progressed the
+% LaTeX team has taken all the required tool packages under their wing
+% and continuously update them. Thus is it unfeasible to embed a
+% package like \Lpack{verbatim} anymore. The embeded copy have
+% therefore been replaced by simply loading the \Lpack{verbatim}
 % package.
 %
+% Eventhough we could patch in the changed PW made to \Lpack{verbatim}
+% we've decided against it. The two features he added was marking tabs
+% using a number of spaces (turned off by default) and enabling line
+% breaks at white space (turned off by default). It simply gets to
+% messy trying to patch in both features, given that the number of
+% users using it is probably very low.
 %
-% \subsubsection{Preliminaries}
+% Note that our modified copy of \Lpack{verbatim} had all references
+% to \cs{leftskip} and \cs{rightskip} replaced by \cs{memRTLleftskip}
+% and \cs{memRTLrightskip}. For now we have no intention of patching
+% these into the \Lpack{verbatim} code, but it should be straight
+% forward if needed.
 %
-% \begin{macro}{\every at verbatim}
-% \begin{macro}{\afterevery at verbatim}
-%    The hook (i.e., token register) \cs{every at verbatim}
-%    is initialized to \meta{empty}.
-%
-% PW added the \cs{afterevery at verbatim} hook.
+% \subsection{Additions to the verbatim package}
+% 
+% \changes{v3.8.2}{2024/01/24}{Replaced embedded altered copy of
+% \Lpack{verbatim} with loading the package}
+% Load the package instead of embedding it.
 %    \begin{macrocode}
-\newtoks\every at verbatim
-  \every at verbatim={}
-\newtoks\afterevery at verbatim
-  \afterevery at verbatim={}
-
+\RequirePackage{verbatim}      
 %    \end{macrocode}
-% \end{macro}
-% \end{macro}
 %
-%
-% \begin{macro}{\@makeother}
-%    \cs{@makeother} takes as argument a character and changes
-%    its category code to $12$ (other).
+% A future update (\verb|github #1245|) to \Lpack{verbatim} will enable
+% \cs{verbatiminput*} to mark tabs as if it was spaces. If that
+% version has not been released yet, we add the patch
 %    \begin{macrocode}
-\def\@makeother#1{\catcode`#112\relax}
-%    \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\@vobeyspaces}
-%    The macro \cs{@vobeyspaces} causes spaces in the input
-%    to be printed as spaces in the output.
-%    \begin{macrocode}
-\begingroup
- \catcode`\ =\active%
- \def\x{\def\@vobeyspaces{\catcode`\ \active\let \@xobeysp}}
- \expandafter\endgroup\x
-%    \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\@xobeysp}
-%    The macro \cs{@xobeysp} produces exactly one space in
-%    the output, protected against breaking just before it.
-%    (\cs{@M} is an abbreviation for the number $10000$.)
-%    \begin{macrocode}
-\def\@xobeysp{\leavevmode\penalty\@M\ }
-%    \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\verbatim at line}
-%    We use a newly defined token register called \cs{verbatim at line}
-%    that will be used as the character buffer.
-%    \begin{macrocode}
-\newtoks\verbatim at line
-%    \end{macrocode}
-% \end{macro}
-%
-% PW. I have extended the original \Lpack{verbatim} package code to handle
-% TABs within verbatims. Normally TeX replaces a TAB by either a single space or
-% ignores it altogether. For this purpose I have bits of code from the \Lpack{moreverb}
-% package~\cite{MOREVERB} for handling TABs.
-%
-% \textit{Code and commentary from moreverb.}
-%
-% We define a few auxiliary macros and counters for expanding tabs.
-%    \begin{macrocode}
-\newcount\tab at position 
-%    \end{macrocode}
-%
-% \begin{macro}{\@xobeytab}
-% \cs{@xobeytab} puts enough spaces in to get to the next nominal
-% tab stop
-%    \begin{macrocode}
-\def\@xobeytab{%
-  \loop
-    \toks@\expandafter{\the\toks@\@xobeysp}%
-    \advance\tab at position-1
-  \ifnum\tab at position>0 \repeat
+\@ifpackagelater{verbatim}{2024/01/21}{}{
+  \def\verbatiminput{\begingroup
+    \@ifstar{\verbatim at input{\@setupverbvisiblespace\@vobeyspaces}}%
+            {\verbatim at input{\frenchspacing\@vobeyspaces}}}
 }
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\@vobeytabs}
-% \cs{@vobeytabs} initialises use of \cs{@xobeytab}.  Needs to be
-% executed within a group, as mustn't be allowed to leak out into the
-% wide world.
-%
-%    \begin{macrocode}
-\begingroup
-  \catcode`\^^I=\active
-  \gdef\@vobeytabs{\catcode`\^^I\active\let^^I\@xobeytab}%
-\endgroup
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\verbatim at tabexpand}
-% \cs{verbatim at tabexpand}\marg{body of line}\cs{@nil} processes every
-% character of a line by tail recursion, counting the characters and
-% juggling things when a tab is encountered.
-%    \begin{macrocode}
-\def\verbatim at tabexpand#1{%
-  \ifx#1\@nil
-    \the\toks@
-    \expandafter\par
-  \else
-    \ifx#1\@xobeytab
-      \@xobeytab
-    \else
-%    \end{macrocode}
-%
-% We can safely put \cs{@xobeysp} into the token register, since it
-% does precisely what we need
-%    \begin{macrocode}
-      \toks@\expandafter{\the\toks@#1}%
-      \advance\tab at position\m at ne
-    \fi
-    \ifnum\tab at position=0 \tab at position\tab at size \fi
-    \expandafter\verbatim at tabexpand
-  \fi
-}
 
 %    \end{macrocode}
-% \end{macro}
+% it of course requires an updated kernel.
 %
-% \textit{End of code and commentary from moreverb.}
-%
-% PW. Some macros for turning tabbing on and off.
-%
-% \begin{macro}{\tabson}
-% \begin{macro}{\tabsoff}
-% \begin{macro}{\@maybeobeytabs}
-% \cs{tabson} turns tabbing on, and \cs{tabsoff} turns it off. Default
-% is no tabbing.
-%    \begin{macrocode}
-\newif\ift at bs
-\newcommand{\tabson}[1][4]{%
-  \ifnum\@ne > #1\relax
-    \tabsoff
-  \else
-    \t at bstrue
-    \def\tab at size{#1\relax}%
-    \def\@maybeobeytabs{\@vobeytabs}%
-  \fi
-}
-\newcommand{\tabsoff}{%
-  \t at bsfalse
-  \def\tab at size{\z@}%
-  \def\@maybeobeytabs{}%
-}
-\tabsoff
-
-%    \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\tabverbatim at processline}
-% Process a line with TABs (extracted from \Lpack{moreverb}).
-%    \begin{macrocode}
-\def\tabverbatim at processline{\tab at position\tab at size
-  \toks@{}%
-  \expandafter\verbatim at tabexpand\the\verbatim at line\@nil}
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\notabverbatim at processline}
-% Processes a line ignoring TABs (this is the original \Lpack{verbatim}
-% package definition of \cs{verbatim at processline}).
-%    \begin{macrocode}
-\def\notabverbatim at processline{\the\verbatim at line\par}
-
-%    \end{macrocode}
-% \end{macro}
-%
-% \textit{We are now back to the \Lpack{verbatim} code.}
-%
-% The following four macros are defined globally in a way suitable for
-% the \texttt{verbatim} and \texttt{verbatim*} environments.
-% \begin{macro}{\verbatim at startline}
-% \begin{macro}{\verbatim at addtoline}
-% \begin{macro}{\verbatim at processline}
-%    \cs{verbatim at startline} initializes processing of a line
-%    by emptying the character buffer (\cs{verbatim at line}).
-%    \begin{macrocode}
-\def\verbatim at startline{\verbatim at line{}}
-%    \end{macrocode}
-%    \cs{verbatim at addtoline} adds the tokens in its argument
-%    to our buffer register \cs{verbatim at line} without expanding
-%    them.
-%    \begin{macrocode}
-\def\verbatim at addtoline#1{%
-  \verbatim at line\expandafter{\the\verbatim at line#1}}
-%    \end{macrocode}
-%    Processing a line inside a \texttt{verbatim} or \texttt{verbatim*}
-%    environment means printing it.
-%    Ending the line means that we have to begin a new paragraph.
-%    We use \cs{par} for this purpose.  Note that \cs{par}
-%    is redefined in \cs{@verbatim} to force \TeX{} into horizontal
-%    mode and to insert an empty box so that empty lines in the input
-%    do appear in the output.
-% (PW changed next line from \\
-% \verb?\def\verbatim at processline{\the\verbatim at line\par}?
-%    \begin{macrocode}
-\def\verbatim at processline{\notabverbatim at processline}
-%    \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\verbatim at finish}
-%    As a default, \cs{verbatim at finish} processes the remaining
-%    characters.
-%    When this macro is called we are facing the following problem:
-%    when the \verb?\end{verbatim}?
-%    command is encountered \cs{verbatim at processline} is called
-%    to process the characters preceding the command on the same
-%    line.  If there are none, an empty line would be output if we
-%    did not check for this case.
-%
-%    If the line is empty \verb?\the\verbatim at line? expands to
-%    nothing.  To test this we use a trick similar to that on p.\ 376
-%    of the \TeX{}book, but with \verb?$?\ldots\verb?|$? instead of
-%    the \verb?!? tokens.  These \verb?$? tokens can never have the same
-%    category code as a \verb?$? token that might possibly appear in the
-%    token register \cs{verbatim at line}, as such a token will always have
-%    been read with category code $12$ (other).
-%    Note that \cs{ifcat} expands the following tokens so that
-%    \verb?\the\verbatim at line? is replaced by the accumulated
-%    characters
-%    \begin{macrocode}
-\def\verbatim at finish{\ifcat$\the\verbatim at line$\else
-  \verbatim at processline\fi}
-%    \end{macrocode}
-% \end{macro}
-%
-%
-% \subsubsection{The \texttt{verbatim} and \texttt{verbatim*} environments}
-%
-% \begin{macro}{\verbatim at font}
-%    We start by defining the macro \cs{verbatim at font} that is
-%    to select the font and to set font-dependent parameters.
-%    Then we go through \cs{verbatim at nolig@list} to avoid
-%    certain ligatures.
-%    \cs{verbatim at nolig@list} is a macro defined in the \LaTeXe{} kernel
-%    to expand to
-% \begin{verbatim}
-%    \do\`\do\<\do\>\do\,\do\'\do\-
-% \end{verbatim}
-%    All the characters in this list can be part of a ligature in some
-%    font or other.
-% 
-% PW. This is the original version which I'm going to replace.
-% \begin{verbatim}
-% \def\verbatim at font{\normalfont\ttfamily
-%                    \hyphenchar\font\m at ne
-%                    \let\do\do at noligs
-%                    \verbatim at nolig@list}
-% \end{verbatim}
-% Actually the kernel defines the macro \verb+\@noligs+ which just
-% runs the last two lines of the \verb+\verbatim at font+ above. As other
-% package may add stuff to \verb+\@noligs+, we will use that instead.
-% \end{macro}
-%
 % \begin{macro}{\setverbatimfont}
 % \begin{macro}{\m at mverbfont}
-% \begin{macro}{\verbatim at font}
-% User level handle for changing the font used for verbatim text.
-% \changes{v1.61803398}{2009/09/10}{Changed the last two lines of
-% \cs{verbatim at font} into using \cs{@noligs} instead. This fixes
-% problem with upquote.}
+% We do provide an interface to set the font used in
+% verbatims. Internally in \Lpack{verbatim} this is done via \cs{verbatim at font}.
 %    \begin{macrocode}
 \newcommand{\setverbatimfont}[1]{\def\m at mverbfont{#1}}
 \setverbatimfont{\normalfont\ttfamily}
+\patchcmd\verbatim at font{\normalfont\ttfamily}%
+  {\m at mverbfont}%
+  {}%
+  {\typeout{Paching \string\verbatim at font\space failed}}
 
-\def\verbatim at font{\m at mverbfont
-                   \hyphenchar\font\m at ne
-                   \@noligs}
-
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
-% \end{macro}
 %
-%
-% \begin{macro}{\@verbatim}
-%    The macro \cs{@verbatim} sets up things properly.
-%    First of all, the tokens of the \cs{every at verbatim} hook
-%    are inserted.
-%    Then a \texttt{trivlist} environment is started and its first
-%    \cs{item} command inserted.
-%    Each line of the \texttt{verbatim} or \texttt{verbatim*}
-%    environment will be treated as a separate paragraph.
-% \changes{v1.61803398}{2009/07/18}{Added bidi support to \cs{@verbatim}}
+% % \subsubsection{The \texttt{comment} environment}
+% 
+% The \Lpack{verbatim} package provides the \Lenv{comment} environment
+% that ignores its contents. This is a very useful feature, and we
+% would like users to be able todefine their own \Lenv{comment} like
+% envs. The following code is PWs original code, only difference is
+% that we do not define \Lenv{comment} using the code. We leave the
+% \Lpack{verbatim} alone.
+% % \begin{macro}{\setupcomment}
+% \cs{setupcomment} does all the \cs{let}s in the original \cs{comment} code. For reference see the \cite{VERBATIM} sources.
 %    \begin{macrocode}
-\def\@verbatim{\the\every at verbatim
-  \trivlist \item \relax
-%    \end{macrocode}
-%    The following extra vertical space is for compatibility with the
-%    \LaTeX kernel: otherwise, using the \Lpack{verbatim} package changes
-%    the vertical spacing of a \texttt{verbatim} environment nested within a
-%    \texttt{quote} environment.
-%    \begin{macrocode}
-  \if at minipage\else\vskip\parskip\fi
-%    \end{macrocode}
-%    The paragraph parameters are set appropriately:
-%    the penalty at the beginning of the environment,
-%    left and right margins, paragraph indentation, the glue to
-%    fill the last line, and the vertical space between paragraphs.
-%    The latter space has to be zero since we do not want to add
-%    extra space between lines.
-%    \begin{macrocode}
-  \@beginparpenalty \predisplaypenalty 
-%%%  \leftskip\@totalleftmargin\rightskip\z@
-  \memRTLleftskip\@totalleftmargin\memRTLrightskip\z@
-  \parindent\z@\parfillskip\@flushglue\parskip\z@
-%    \end{macrocode}
-%    There's one point to make here:
-%    the \texttt{list} environment uses \TeX's \cs{parshape}
-%    primitive to get a special indentation for the first line
-%    of the  list.
-%    If the list begins with a \texttt{verbatim} environment
-%    this \cs{parshape} is still in effect.
-%    Therefore we have to reset this internal parameter explicitly.
-%    We could do this by assigning $0$ to \cs{parshape}.
-%    However, there is a simpler way to achieve this:
-%    we simply tell \TeX{} to start a new paragraph.
-%    As is explained on p.~103 of the \TeX{}book, this resets
-%    \cs{parshape} to zero.
-%    \begin{macrocode}
-  \@@par
-%    \end{macrocode}
-%    We now ensure that \cs{par} has the correct definition,
-%    namely to force \TeX{} into horizontal mode
-%    and to include an empty box.
-%    This is to ensure that empty lines do appear in the output.
-%    Afterwards, we insert the \cs{interlinepenalty} since \TeX{}
-%    does not add a penalty between paragraphs (here: lines)
-%    by its own initiative. Otherwise a \texttt{verbatim} environment
-%    could be broken across pages even if a \cs{samepage}
-%    declaration were present.
-%
-%    However, in a top-aligned minipage, this will result in an extra
-%    empty line added at the top. Therefore, a slightly more
-%    complicated construct is necessary.
-%    One of the important things here is the inclusion of
-%    \cs{leavevmode} as the first macro in the first line, for example,
-%    a blank verbatim line is the first thing in a list item.
-%    \begin{macrocode}
-  \def\par{%
-    \if at tempswa
-      \leavevmode\null\@@par\penalty\interlinepenalty
-    \else
-      \@tempswatrue
-      \ifhmode\@@par\penalty\interlinepenalty\fi
-    \fi}%
-%    \end{macrocode}
-%    But to avoid an error message when the environment
-%    doesn't contain any text, we redefine \cs{@noitemerr}
-%    which will in this case be called by \cs{endtrivlist}.
-%    \begin{macrocode}
-  \def\@noitemerr{\@warning{No verbatim text}}%
-%    \end{macrocode}
-%    Now we call \cs{obeylines} to make the end of line character
-%    active,
-%    \begin{macrocode}
-  \obeylines
-%    \end{macrocode}
-%    change the category code of all special characters,
-%    to $12$ (other).
-%    \begin{macrocode}
-  \let\do\@makeother \dospecials
-%    \end{macrocode}
-%    and switch to the font to be used.
-%    \begin{macrocode}
-  \verbatim at font
-%    \end{macrocode}
-%    To avoid a breakpoint after the labels box, we remove the penalty
-%    put there by the list macros: another use of \cs{unpenalty}!
-%    \begin{macrocode}
-  \everypar \expandafter{\the\everypar \unpenalty}%
-%    \end{macrocode}
-% PW added next code at end of \cs{@verbatim}.
-%    \begin{macrocode}
-  \wrapright\the\afterevery at verbatim}
-%    \end{macrocode}   
-% \end{macro}
-%
-%
-% \begin{macro}{\verbatim}
-% \begin{macro}{\verbatim*}
-%    Now we define the toplevel macros.
-%    \cs{verbatim} is slightly changed:
-%    after setting up things properly it calls
-%    \cs{verbatim at start}.
-%    This is done inside a group, so that \cs{verbatim} can be used
-%    directly, without \cs{begin}.
-%
-% PW. The following is the original code, but I want a version of
-% \texttt{verbatim} that recognises TABs.
-% \begin{verbatim}
-%    \begin{macrocode}
-% \def\verbatim{%
-%    \begingroup\@verbatim \frenchspacing\@vobeyspaces 
-%    \verbatim at start}
-%    \end{macrocode}
-%    \cs{verbatim*} is defined accordingly.
-%    \begin{macrocode}
-% \@namedef{verbatim*}{\begingroup\@verbatim\verbatim at start}
-% \def\endverbatim{\endtrivlist\endgroup}
-% \expandafter\let\csname endverbatim*\endcsname=\endverbatim
-%    \end{macrocode}
-% \end{verbatim}
-%
-% PW. My code for these is a modified version of the original \Lpack{verbatim}
-% code.
-%    \begin{macrocode}
-\def\verbatim{\begingroup
-  \ift at bs
-    \def\verbatim at processline{\tabverbatim at processline}%
-  \fi
-  \@verbatim \frenchspacing\@vobeyspaces\@maybeobeytabs\verbatim at start}
-\@namedef{verbatim*}{\begingroup
-  \ift at bs
-    \def\verbatim at processline{\tabverbatim at processline}%
-  \fi
-  \@verbatim\@maybeobeytabs\verbatim at start}
-%    \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\endverbatim}
-% \begin{macro}{\endverbatim*}
-%    To end the \texttt{verbatim} and \texttt{verbatim*}
-%    environments it is only necessary to finish the
-%    \texttt{trivlist} environment started in \cs{@verbatim} and
-%    close the corresponding group, and handle\footnote{Noted by
-% Zarko Cucej (\url{zarko.cucej at uni-mb.si}).} following (non-) paragraph,
-% by using \cs{@doendpe}.
-% \changes{v1.4}{2003/11/22}{Added \cs{@doendpe} to \cs{endverbatim} 
-%                            (from patch v1.8)}
-% \changes{v2.0a}{2004/03/01}{Refixed \cs{endverbatim}}
-%    \begin{macrocode}
-\def\endverbatim{\endtrivlist\endgroup\@doendpe}
-\@namelet{endverbatim*}\endverbatim
-
-%    \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% For abnormal \cs{parskip}s the NTG class included the following, but I'm
-% not sure if it is relevant here, but if it is just how it should be included.
-% \begin{verbatim}
-% From NTG, where it is a \cs{def}
-% \providecommand*{\verbatim}{%
-%   \topsep=-0.5\parskip
-%   \@verbatim
-%   \frenchspacing\@vobeyspaces \@xverbatim}
-% \end{verbatim}
-%
-%
-% \subsubsection{The \texttt{comment} environment}
-%
-%    The \cs{comment} macro is similar to \cs{verbatim*}.
-%    However, we do not need to switch fonts or set special
-%    formatting parameters such as \cs{parindent} or \cs{parskip}.
-%    We need only set the category code of all special characters
-%    to $12$ (other) and that of \verb?^^M? (the end of line character)
-%    to $13$ (active).
-%    The latter is needed for macro parameter delimiter matching in
-%    the internal macros defined below.
-%    In contrast to the default definitions used by the
-%    \cs{verbatim} and \cs{verbatim*} macros,
-%    we define \cs{verbatim at addtoline} to throw away its argument
-%    and \cs{verbatim at processline}, \cs{verbatim at startline},
-%    and \cs{verbatim at finish} to act as no-ops.
-%    Then we call \cs{verbatim@}.
-%    But the first thing we do is to call \cs{@bsphack} so that
-%    this environment has no influence whatsoever upon the spacing.
-%
-% PW: This is the original code for the \texttt{comment} environment, 
-% which I'm going to change.
-% \begin{verbatim}
-% \def\comment{\@bsphack
-%              \let\do\@makeother\dospecials\catcode`\^^M\active
-%              \let\verbatim at startline\relax
-%              \let\verbatim at addtoline\@gobble
-%              \let\verbatim at processline\relax
-%              \let\verbatim at finish\relax
-%              \verbatim@}
-% \end{verbatim}
-%    \cs{endcomment} is very simple: it only calls
-%    \cs{@esphack} to take care of the spacing.
-%    The \cs{end} macro closes the group and therefore takes care
-%    of restoring everything we changed.
-% \begin{verbatim}
-% \let\endcomment=\@esphack
-% \end{verbatim}
-%
-% PW: The remainder of this section is my code.
-%
-% \begin{macro}{\setupcomment}
-% \cs{setupcomment} does all the \cs{let}s in the original \cs{comment} code.
-%    \begin{macrocode}
 \newcommand{\setupcomment}{%
   \let\do\@makeother\dospecials\catcode`\^^M\active
   \let\verbatim at startline\relax
@@ -28122,725 +27804,1471 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% We had better supply the \texttt{comment} environment, as promised.
-%    \begin{macrocode}
-\newcomment{comment}
-
-%    \end{macrocode}
+% 
+% 
+% \subsubsection{Disabled interface macros}
 %
-% PW: That is the end of my changes and extensions to the original 
-% \texttt{comment} environment code.
-%
-%
-% \subsubsection{The main loop}
-%
-% Here comes the tricky part:
-% During the definition of the macros we need to use the special
-% characters \verb?\?, \verb?{?, and \verb?}? not only with their
-% normal category codes,
-% but also with category code $12$ (other).
-% We achieve this by the following trick:
-% first we tell \TeX{} that \verb?\?, \verb?{?, and \verb?}?
-% are the lowercase versions of \verb?!?, \verb?[?, and \verb?]?.
-% Then we replace every occurrence of \verb?\?, \verb?{?, and \verb?}?
-% that should be read with category code $12$ by \verb?!?, \verb?[?,
-% and \verb?]?, respectively,
-% and give the whole list of tokens to \cs{lowercase},
-% knowing that category codes are not altered by this primitive!
-%
-% But first we have ensure that
-% \verb?!?, \verb?[?, and \verb?]? themselves have
-% the correct category code!
-% To allow special settings of these codes we hide their setting in
-% the macro \cs{vrb at catcodes}.  If it is already defined our new
-% definition is skipped.
+% These are macros that via the un-embedding are no longer
+% used. Relevant macros are defined to to issue a warning, others just
+% does not do anything.
+% 
+% \changes{v3.8.2}{2024/01/24}{Added defaults for disabled macros}
+% Macros for enabling marking tabs in verbatim, have been
+% discontinued.
 %    \begin{macrocode}
-\@ifundefined{vrb at catcodes}%
-  {\def\vrb at catcodes{%
-     \catcode`\!12\catcode`\[12\catcode`\]12}}{}
-%    \end{macrocode}
-% This trick allows us to use this code for applications where other
-% category codes are in effect.
-%
-% We start a group to keep the category code changes local.
-%    \begin{macrocode}
-\begingroup
- \vrb at catcodes
- \lccode`\!=`\\ \lccode`\[=`\{ \lccode`\]=`\}
-%    \end{macrocode}
-%    We also need the end-of-line character \verb?^^M?,
-%    as an active character.
-%    If we were to simply write \verb?\catcode`\^^M=\active?
-%    then we would get an unwanted active end of line character
-%    at the end of every line of the following macro definitions.
-%    Therefore we use the same trick as above:
-%    we write a tilde \verb?~? instead of \verb?^^M? and
-%    pretend that the
-%    latter is the lowercase variant of the former.
-%    Thus we have to ensure now that the tilde character has
-%    category code $13$ (active).
-%    \begin{macrocode}
- \catcode`\~=\active \lccode`\~=`\^^M
-%    \end{macrocode}
-%    The use of the \cs{lowercase} primitive leads to one problem:
-%    the uppercase character `\texttt{C}' needs to be used in the
-%    code below and its case must be preserved.
-%    So we add the command:
-%    \begin{macrocode}
- \lccode`\C=`\C
-%    \end{macrocode}
-%    Now we start the token list passed to \cs{lowercase}.
-%    We use the following little trick (proposed by Bernd Raichle):
-%    The very first token in the token list we give to \cs{lowercase} is
-%    the \cs{endgroup} primitive. This means that it is processed by
-%    \TeX{} immediately after \cs{lowercase} has finished its operation,
-%    thus ending the group started by \cs{begingroup} above. This avoids
-%    the global definition of all macros.
-%    \begin{macrocode}
- \lowercase{\endgroup
-%    \end{macrocode}
-% \begin{macro}{\verbatim at start}
-%    The purpose of \cs{verbatim at start} is to check whether there
-%    are any characters on the same line as the \verb?\begin{verbatim}?
-%    and to pretend that they were on a line by themselves.
-%    On the other hand, if there are no characters remaining
-%    on the current line we shall just find an end of line character.
-%    \cs{verbatim at start} performs its task by first grabbing the
-%    following character (its argument).
-%    This argument is then compared to an active \verb?^^M?,
-%    the end of line character.
-%    \begin{macrocode}
-    \def\verbatim at start#1{%
-      \verbatim at startline
-      \if\noexpand#1\noexpand~%
-%    \end{macrocode}
-%    If this is true we transfer control to \cs{verbatim@}
-%    to process the next line.  We use
-%    \cs{next} as the macro which will continue the work.
-%    \begin{macrocode}
-        \let\next\verbatim@
-%    \end{macrocode}
-%    Otherwise, we define \cs{next} to expand to a call
-%    to \cs{verbatim@} followed by the character just
-%    read so that it is reinserted into the text.
-%    This means that those characters remaining on this line
-%    are handled as if they formed a line by themselves.
-%    \begin{macrocode}
-      \else \def\next{\verbatim@#1}\fi
-%    \end{macrocode}
-%    Finally we call \cs{next}.
-%    \begin{macrocode}
-      \next}%
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\verbatim@}
-%    The three macros \cs{verbatim@}, \cs{verbatim@@},
-%    and \cs{verbatim@@@} form the ``main loop'' of the
-%    \texttt{verbatim} environment.
-%    The purpose of \cs{verbatim@} is to read exactly one line
-%    of input.
-%    \cs{verbatim@@} and \cs{verbatim@@@} work together to
-%    find out whether the four characters
-%    \cs{end} (all with category code $12$ (other)) occur in that
-%    line.
-%    If so, \cs{verbatim@@@} will call
-%    \cs{verbatim at test} to check whether this \cs{end} is
-%    part of \verb?\end{verbatim}? and will terminate the environment
-%    if this is the case.
-%    Otherwise we continue as if nothing had happened.
-%    So let's have a look at the definition of \cs{verbatim@}:
-%    \begin{macrocode}
-    \def\verbatim@#1~{\verbatim@@#1!end\@nil}%
-%    \end{macrocode}
-%    Note that the \verb?!? character will have been replaced by a
-%    \verb?\? with category code $12$ (other) by the \cs{lowercase}
-%    primitive governing this code before the definition of this
-%    macro actually takes place.
-%    That means that
-%    it takes the line, puts \cs{end} (four character tokens)
-%    and \cs{@nil} (one control sequence token) as a
-%    delimiter behind it, and
-%    then calls \cs{verbatim@@}.
-% \end{macro}
-%
-% \begin{macro}{\verbatim@@}
-%    \cs{verbatim@@} takes everything up to the next occurrence of
-%    the four characters \cs{end} as its argument.
-%    \begin{macrocode}
-    \def\verbatim@@#1!end{%
-%    \end{macrocode}
-%    That means: if they do not occur in the original line, then
-%    argument \verb?#1? is the
-%    whole input line, and \cs{@nil} is the next token
-%    to be processed.
-%    However, if the four characters \cs{end} are part of the
-%    original line, then
-%    \verb?#1? consists of the characters in front of \cs{end},
-%    and the next token is the following character (always remember
-%    that the line was lengthened by five tokens).
-%    Whatever \verb?#1? may be, it is verbatim text,
-%    so \verb?#1? is added to the line currently built.
-%    \begin{macrocode}
-       \verbatim at addtoline{#1}%
-%    \end{macrocode}
-%    The next token in the input stream
-%    is of special interest to us.
-%    Therefore \cs{futurelet} defines \cs{next} to be equal
-%    to it before calling \cs{verbatim@@@}.
-%    \begin{macrocode}
-       \futurelet\next\verbatim@@@}%
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\verbatim@@@}
-%    \cs{verbatim@@@} will now read the rest of the tokens on
-%    the current line,
-%    up to the final \cs{@nil} token.
-%    \begin{macrocode}
-    \def\verbatim@@@#1\@nil{%
-%    \end{macrocode}
-%    If the first of the above two cases occurred, i.e.\ no
-%    \cs{end} characters were on that line, \verb?#1? is empty
-%    and \cs{next} is equal to \cs{@nil}.
-%    This is easily checked.
-%    \begin{macrocode}
-       \ifx\next\@nil
-%    \end{macrocode}
-%    If so, this was a simple line.
-%    We finish it by processing the line we accumulated so far.
-%    Then we prepare to read the next line.
-%    \begin{macrocode}
-         \verbatim at processline
-         \verbatim at startline
-         \let\next\verbatim@
-%    \end{macrocode}
-%    Otherwise we have to check what follows these \cs{end}
-%    tokens.
-%    \begin{macrocode}
-       \else
-%    \end{macrocode}
-%    Before we continue, it's a good idea to stop for a moment
-%    and remember where we are:
-%    We have just read the four character tokens \cs{end}
-%    and must now check whether the name of the environment (surrounded
-%    by braces) follows.
-%    To this end we define a macro called \cs{@tempa}
-%    that reads exactly one character and decides what to do next.
-%    This macro should do the following: skip spaces until
-%    it encounters either a left brace or the end of the line.
-%    But it is important to remember which characters are skipped.
-%    The \cs{end}\meta{optional spaces}\verb?{? characters
-%    may be part of the verbatim text, i.e.\ these characters
-%    must be printed.
-%
-%    Assume for example that the current line contains
-%    \begin{verbatim*}
-%      \end {AVeryLongEnvironmentName}
-%\end{verbatim*}
-%    As we shall soon see, the scanning mechanism implemented here
-%    will not find out that this is text to be printed until
-%    it has read the right brace.
-%    Therefore we need a way to accumulate the characters read
-%    so that we can reinsert them if necessary.
-%    The token register \cs{@temptokena} is used for this purpose.
-%
-%    Before we do this we have to get rid of the superfluous
-%    \cs{end} tokens at the end of the line.
-%    To this end we define a temporary macro whose argument
-%    is delimited by \verb?\end\@nil? (four character tokens
-%    and one control sequence token) to be used below
-%    on the rest of the line, after appending a \cs{@nil} token to it.
-%    (Note that this token can never appear in \verb?#1?.)
-%    We use the following definition of
-%    \cs{@tempa} to get the rest of the line (after the first
-%    \cs{end}).
-%    \begin{macrocode}
-         \def\@tempa##1!end\@nil{##1}%
-%    \end{macrocode}
-%    We mentioned already that we use token register
-%    \cs{@temptokena}
-%    to remember the characters we skip, in case we need them again.
-%    We initialize this with the \cs{end} we have thrown away
-%    in the call to \cs{@tempa}.
-%    \begin{macrocode}
-         \@temptokena{!end}%
-%    \end{macrocode}
-%    We shall now call \cs{verbatim at test}
-%    to process the characters
-%    remaining on the current line.
-%    But wait a moment: we cannot simply call this macro
-%    since we have already read the whole line.
-%    Therefore we have to first expand the macro \cs{@tempa} to insert
-%    them again after the \cs{verbatim at test} token.
-%    A \verb?^^M? character is appended to denote the end of the line.
-%    (Remember that this character comes disguised as a tilde.)
-%    \begin{macrocode}
-         \def\next{\expandafter\verbatim at test\@tempa#1\@nil~}%
-%    \end{macrocode}
-%    That's almost all, but we still have to
-%    now call \cs{next} to do the work.
-%    \begin{macrocode}
-       \fi \next}%
-%    \end{macrocode}
-% \end{macro}
-%
-%
-% \begin{macro}{\verbatim at test}
-%    We define \cs{verbatim at test} to investigate every token
-%    in turn.
-%    \begin{macrocode}
-    \def\verbatim at test#1{%
-%    \end{macrocode}
-%    First of all we set \cs{next} equal to \cs{verbatim at test}
-%    in case this macro must call itself recursively in order to
-%    skip spaces.
-%    \begin{macrocode}
-           \let\next\verbatim at test
-%    \end{macrocode}
-%    We have to distinguish four cases:
-%    \begin{enumerate}
-%      \item The next token is a \verb?^^M?, i.e.\ we reached
-%            the end of the line.  That means that nothing
-%            special was found.
-%            Note that we use \cs{if} for the following
-%            comparisons so that the category code of the
-%            characters is irrelevant.
-%    \begin{macrocode}
-           \if\noexpand#1\noexpand~%
-%    \end{macrocode}
-%            We add the characters accumulated in token register
-%            \cs{@temptokena} to the current line.  Since
-%            \cs{verbatim at addtoline} does not expand its argument,
-%            we have to do the expansion at this point.  Then we
-%            \cs{let} \cs{next} equal to \cs{verbatim@}
-%            to prepare to read the next line.
-%    \begin{macrocode}
-             \expandafter\verbatim at addtoline
-               \expandafter{\the\@temptokena}%
-             \verbatim at processline
-             \verbatim at startline
-             \let\next\verbatim@
-%    \end{macrocode}
-%      \item A space character follows.
-%            This is allowed, so we add it to \cs{@temptokena}
-%            and continue.
-%    \begin{macrocode}
-           \else \if\noexpand#1
-             \@temptokena\expandafter{\the\@temptokena#1}%
-%    \end{macrocode}
-%      \item An open brace follows.
-%            This is the most interesting case.
-%            We must now collect characters until we read the closing
-%            brace and check whether they form the environment name.
-%            This will be done by \cs{verbatim at testend}, so here
-%            we let \cs{next} equal this macro.
-%            Again we will process the rest of the line, character
-%            by character.
-%            The characters forming the name of the environment will
-%            be accumulated in \cs{@tempc}.
-%            We initialize this macro to expand to nothing.
-%    \begin{macrocode}
-           \else \if\noexpand#1\noexpand[%
-             \let\@tempc\@empty
-             \let\next\verbatim at testend
-%    \end{macrocode}
-%            Note that the \verb?[? character will be a \verb?{? when
-%            this macro is defined.
-%      \item Any other character means that the \cs{end} was part
-%            of the verbatim text.
-%            Add the characters to the current line and prepare to call
-%            \cs{verbatim@} to process the rest of the line.
-%    \begin{macrocode}
-           \else
-             \expandafter\verbatim at addtoline
-               \expandafter{\the\@temptokena}%
-             \def\next{\verbatim@#1}%
-           \fi\fi\fi
-%    \end{macrocode}
-%    \end{enumerate}
-%    The last thing this macro does is to call \cs{next}
-%    to continue processing.
-%    \begin{macrocode}
-           \next}%
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\verbatim at testend}
-%    \cs{verbatim at testend} is called when
-%    \cs{end}\meta{optional spaces}\verb?{? was seen.
-%    Its task is to scan everything up to the next \verb?}?
-%    and to call \cs{verbatim@@testend}.
-%    If no \verb?}? is found it must reinsert the characters it read
-%    and return to \cs{verbatim@}.
-%    The following definition is similar to that of
-%    \cs{verbatim at test}:
-%    it takes the next character and decides what to do.
-%    \begin{macrocode}
-    \def\verbatim at testend#1{%
-%    \end{macrocode}
-%    Again, we have four cases:
-%    \begin{enumerate}
-%      \item \verb?^^M?: As no \verb?}? is found in the current line,
-%            add the characters to the buffer.  To avoid a
-%            complicated construction for expanding
-%            \cs{@temptokena}
-%            and \cs{@tempc} we do it in two steps.  Then we
-%            continue with \cs{verbatim@} to process the
-%            next line.
-%    \begin{macrocode}
-         \if\noexpand#1\noexpand~%
-           \expandafter\verbatim at addtoline
-             \expandafter{\the\@temptokena[}%
-           \expandafter\verbatim at addtoline
-             \expandafter{\@tempc}%
-           \verbatim at processline
-           \verbatim at startline
-           \let\next\verbatim@
-%    \end{macrocode}
-%      \item \verb?}?: Call \cs{verbatim@@testend} to check
-%            if this is the right environment name.
-%    \begin{macrocode}
-         \else\if\noexpand#1\noexpand]%
-           \let\next\verbatim@@testend
-%    \end{macrocode}
-%      \item \verb?\?: This character must not occur in the name of
-%            an environment.  Thus we stop collecting characters.
-%            In principle, the same argument would apply to other
-%            characters as well, e.g., \verb?{?.
-%            However, \verb?\? is a special case, since it may be
-%            the first character of \cs{end}.  This means that
-%            we have to look again for
-%            \cs{end}\marg{environment name}
-%            Note that we prefixed the \verb?!? by a \cs{noexpand}
-%            primitive, to protect ourselves against it being an
-%            active character.
-%    \begin{macrocode}
-         \else\if\noexpand#1\noexpand!%
-           \expandafter\verbatim at addtoline
-             \expandafter{\the\@temptokena[}%
-           \expandafter\verbatim at addtoline
-             \expandafter{\@tempc}%
-           \def\next{\verbatim@!}%
-%    \end{macrocode}
-%      \item Any other character: collect it and continue.
-%            We cannot use \cs{edef} to define \cs{@tempc}
-%            since its replacement text might contain active
-%            character tokens.
-%    \begin{macrocode}
-         \else \expandafter\def\expandafter\@tempc\expandafter
-           {\@tempc#1}\fi\fi\fi
-%    \end{macrocode}
-%    \end{enumerate}
-%    As before, the macro ends by calling itself, to
-%    process the next character if appropriate.
-%    \begin{macrocode}
-         \next}%
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\verbatim@@testend}
-%    Unlike the previous macros \cs{verbatim@@testend} is simple:
-%    it has only to check if the \cs{end}\marg{...}
-%    matches the corresponding \cs{begin}\marg{...}
-%    \begin{macrocode}
-    \def\verbatim@@testend{%
-%    \end{macrocode}
-%    We use \cs{next} again to define the things that are
-%    to be done.
-%    Remember that the name of the current environment is
-%    held in \cs{@currenvir}, the characters accumulated
-%    by \cs{verbatim at testend} are in \cs{@tempc}.
-%    So we simply compare these and prepare to execute
-%    \cs{end}\marg{current environment}
-%    macro if they match.
-%    Before we do this we call \cs{verbatim at finish} to process
-%    the last line.
-%    We define \cs{next} via \cs{edef} so that
-%    \cs{@currenvir} is replaced by its expansion.
-%    Therefore we need \cs{noexpand} to inhibit the expansion
-%    of \cs{end} at this point.
-%    \begin{macrocode}
-       \ifx\@tempc\@currenvir
-         \verbatim at finish
-         \edef\next{\noexpand\end{\@currenvir}%
-%    \end{macrocode}
-%    Without this trick the \cs{end} command would not be able
-%    to correctly check whether its argument matches the name of
-%    the current environment and you'd get an
-%    interesting \LaTeX{} error message such as:
-%    \begin{verbatim}
-%! \begin{verbatim*} ended by \end{verbatim*}.
-%\end{verbatim}
-%    But what do we do with the rest of the characters, those
-%    that remain on that line?
-%    We call \cs{verbatim at rescan} to take care of that.
-%    Its first argument is the name of the environment just
-%    ended, in case we need it again.
-%    \cs{verbatim at rescan} takes the list of characters to be
-%    reprocessed as its second argument.
-%    (This token list was inserted after the current macro
-%    by \cs{verbatim@@@}.)
-%    Since we are still in an \cs{edef} we protect it
-%    by means of\cs{noexpand}.
-%    \begin{macrocode}
-                    \noexpand\verbatim at rescan{\@currenvir}}%
-%    \end{macrocode}
-%    If the names do not match, we reinsert everything read up
-%    to now and prepare to call \cs{verbatim@} to process
-%    the rest of the line.
-%    \begin{macrocode}
-       \else
-         \expandafter\verbatim at addtoline
-           \expandafter{\the\@temptokena[}%
-           \expandafter\verbatim at addtoline
-             \expandafter{\@tempc]}%
-         \let\next\verbatim@
-       \fi
-%    \end{macrocode}
-%    Finally we call \cs{next}.
-%    \begin{macrocode}
-       \next}%
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\verbatim at rescan}
-%    In principle \cs{verbatim at rescan} could be used to
-%    analyse the characters remaining after the \verb?\end{...}?
-%    command and pretend that these were read
-%    ``properly'', assuming ``standard'' category codes are in
-%    force.\footnote{Remember that they were all read with
-%          category codes $11$ (letter) and $12$ (other) so
-%          that control sequences are not recognized as such.}
-%    But this is not always possible (when there are unmatched
-%    curly braces in the rest of the line).
-%    Besides, we think that this is not worth the effort:
-%    After a \texttt{verbatim} or \texttt{verbatim*} environment
-%    a new line in the output is begun anyway,
-%    and an \verb?\end{comment}? can easily be put on a line by itself.
-%    So there is no reason why there should be any text here.
-%    For the benefit of the user who did put something there
-%    (a comment, perhaps)
-%    we simply issue a warning and drop them.
-%    The method of testing is explained in Appendix~D, p.\ 376 of
-%    the \TeX{}book. We use \verb?^^M? instead of the \verb?!?
-%    character used there
-%    since this is a character that cannot appear in \verb?#1?.
-%    The two \cs{noexpand} primitives are necessary to avoid
-%    expansion of active characters and macros.
-%
-%    One extra subtlety should be noted here: remember that
-%    the token list we are currently building will first be
-%    processed by the \cs{lowercase} primitive before \TeX{}
-%    carries out the definitions.
-%    This means that the `\texttt{C}' character in the
-%    argument to the \cs{@warning} macro must be protected against
-%    being changed to `\texttt{c}'.  That's the reason why we added the
-%    \verb?\lccode`\C=`\C? assignment above.
-%    We can now finish the argument to \cs{lowercase} as well as the
-%    group in which the category codes were changed.
-%    \begin{macrocode}
-    \def\verbatim at rescan#1#2~{\if\noexpand~\noexpand#2~\else
-        \@warning{Characters dropped after `\string\end{#1}'}\fi}}
-%    \end{macrocode}
-% \end{macro}
-%
-% \subsubsection{The \cs{verbatiminput} command}
-%
-% \begin{macro}{\verbatim at in@stream}
-%    We begin by allocating an input stream (out of the 16 available
-%    input streams).
-%    \begin{macrocode}
-\newread\verbatim at in@stream
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\verbatim at readfile}
-%    The macro \cs{verbatim at readfile} encloses the main loop by calls to
-%    the macros \cs{verbatim at startline} and \cs{verbatim at finish},
-%    respectively.  This makes sure
-%    that the user can initialize and finish the command when the file
-%    is empty or doesn't exist.  The \texttt{verbatim} environment has a
-%    similar behaviour when called with an empty text.
-%    \begin{macrocode}
-\def\verbatim at readfile#1{%
-  \verbatim at startline
-%    \end{macrocode}
-%    When the file is not found we issue a warning.
-%    \begin{macrocode}
-  \openin\verbatim at in@stream #1\relax
-  \ifeof\verbatim at in@stream
-    \typeout{No file #1.}%
-  \else
-%    \end{macrocode}
-%    At this point we pass the name of the file to \cs{@addtofilelist}
-%    so that its appears appears in the output of a \cs{listfiles}
-%    command.
-%    In addition, we use \cs{ProvidesFile} to make a log entry in the
-%    transcript file and to distinguish files read in via
-%    \cs{verbatiminput} from others.
-%    \begin{macrocode}
-    \@addtofilelist{#1}%
-    \ProvidesFile{#1}[(verbatim)]%
-%    \end{macrocode}
-%    While reading from the file it is useful to switch off the
-%    recognition of the end-of-line character.  This saves us stripping
-%    off spaces from the contents of the line.
-%    \begin{macrocode}
-    \expandafter\endlinechar\expandafter\m at ne
-    \expandafter\verbatim at read@file
-    \expandafter\endlinechar\the\endlinechar\relax
-    \closein\verbatim at in@stream
-  \fi
-  \verbatim at finish
+\newcommand*\tabsoff{} % defined to do nothing
+\newcommand*\tabson{
+  \@memwarn{As of January 2024, \string\tabson\space has been discontinued.}
 }
+
 %    \end{macrocode}
-% \end{macro}
 %
-% \begin{macro}{\verbatim at read@file}
-%    All the work is done in \cs{verbatim at read@file}.  It reads the input
-%    file line by line and recursively calls itself until the end of
-%    the file.
+% Code for automatic line breaking in verbatim has been discontinued.
 %    \begin{macrocode}
-\def\verbatim at read@file{%
-  \read\verbatim at in@stream to\next
-  \ifeof\verbatim at in@stream
-  \else
-%    \end{macrocode}
-%    For each line we call \cs{verbatim at addtoline} with the contents of
-%    the line. \hskip0pt plus 3cm\penalty0\hskip0pt plus -3cm
-%    \cs{verbatim at processline} is called next.
-%    \begin{macrocode}
-    \expandafter\verbatim at addtoline\expandafter{\next}%
-    \verbatim at processline
-%    \end{macrocode}
-%    After processing the line we call \cs{verbatim at startline} to
-%    initialize all before we read the next line.
-%    \begin{macrocode}
-    \verbatim at startline
-%    \end{macrocode}
-%    Without \cs{expandafter} each call of \cs{verbatim at read@file} uses
-%    space in \TeX's input stack.\footnote{A standard \TeX\ would
-%    report an overflow error if you try to read a file with more than
-%    ca.\ 200~lines.  The same error occurs if the first line of code
-%    in \S 390 of \textsl{``TeX: The Program''\/} is missing.}
-%    \begin{macrocode}
-    \expandafter\verbatim at read@file
-  \fi
+\newlength\verbatimindent
+\newcommand*\verbatimbreakchar{} % silently does nothing as it
+                                 % needs \wrappingon to be enabled
+\newcommand*\setverbatimbreak{} % never used
+\newcommand*\wrappingon{
+  \@memwarn{As of January 2024, \string\wrappingon\space has been discontinued.}
 }
+\newcommand*\wrappingoff{} % defined to do nothing
+\def\wrapright{} % internal macro no longer used
 %    \end{macrocode}
-% \end{macro}
 %
+%   
+% \subsubsection{About the \texttt{verbatim} adjustments that have been removed}
 %
-% \begin{macro}{\verbatiminput}
-%    \cs{verbatiminput} first starts a group to keep font and category
-%    changes local.
-%    Then it calls the macro \cs{verbatim at input} with additional
-%    arguments, depending on whether an asterisk follows.
+% The adjustments PW made that we removed (in January 2024) can
+% actually be patched back in using the following code and
+% patches. Left here for reference. Will probably be removed at some
+% point.
 %
-% PW. I added the TAB checking code.
-%    \begin{macrocode}
-\def\verbatiminput{\begingroup
-  \ift at bs
-    \def\verbatim at processline{\tabverbatim at processline}%
-  \fi
-  \@ifstar{\verbatim at input{\@maybeobeytabs}}%
-          {\verbatim at input{\frenchspacing\@vobeyspaces\@maybeobeytabs}}}
-%    \end{macrocode}
-% \end{macro}
+% First the code needed by the patches
+% \begin{verbatim}
+% % extra hook to be added at the end of verbatims
+% \newtoks\afterevery at verbatim
+% \afterevery at verbatim={}
+% % code for marking tabs using a number of spaces
+% \newcount\tab at position
+% \def\mem at xobeytab{%
+%   \typeout{\the\tab at position}
+%   \loop
+%    \toks@\expandafter{\the\toks@\@xobeysp}%
+%    \advance\tab at position-1
+%   \ifnum\tab at position>-1 \repeat% was 0, but that never gave 4 spaces
+% }
+% \def\verbatim at tabexpand#1{%
+%   \ifx#1\@nil
+%     \the\toks@
+%     \expandafter\par
+%   \else
+%     \ifx#1\@xobeytab
+%       \@xobeytab
+%     \else
+%       \toks@\expandafter{\the\toks@#1}%
+%       \advance\tab at position\m at ne
+%     \fi
+%     \ifnum\tab at position=0 \tab at position\tab at size \fi
+%     \expandafter\verbatim at tabexpand
+%   \fi
+% }
+% \newif\ift at bs
+% \def\@maybeobeytabs{}%
+% % The code to enable marking tabs
+% \newcommand{\tabson}[1][4]{%
+%   % firstly, has to be at least 1, so if less than one, we disable visible tabs
+%   \ifnum\@ne > #1\relax
+%     \typeout{#1 gives tabs off}
+%     \tabsoff
+%   \else
+%     \t at bstrue
+%     \let\@xobeytab\mem at xobeytab
+%     \def\tab at size{#1\relax}%
+%     \def\@maybeobeytabs{\@vobeytabs}%
+%   \fi
+% }
+% \newcommand{\tabsoff}{%
+%   \t at bsfalse
+%   \def\tab at size{\z@}%
+%   \def\@maybeobeytabs{}%
+% }
+% % default is off
+% \tabsoff
+% % \verbatim at processline is redefined to this in certain places if tabs are on
+% \def\tabverbatim at processline{\tab at position\tab at size%
+%   \toks@{}%
+%   \expandafter\verbatim at tabexpand\the\verbatim at line\@nil}
+% %   Code for the wrapping system, \cs{raggedwrap} was moved
+% %   elsewhere in the code so is still there.
+% \newcommand*{\wrappingon}{%
+%   \def\@xobeysp{~\discretionary{\verbatimbreakchar}%
+%     {\kern\verbatimindent}{}}%
+%   \def\wrapright{\raggedwrap}}
+% \newcommand*{\wrappingoff}{%
+%   \def\@xobeysp{\leavevmode\penalty\@M\ }%
+%   \def\wrapright{}}
+% \wrappingoff
+% \end{verbatim}
 %
-% \begin{macro}{\verbatim at input}
-%    \cs{verbatim at input} first checks whether the file exists, using
-%    the standard macro cs{IfFileExists} which leaves the name of the
-%    file found in \cs{@filef at und}.
-%    Then everything is set up as in the \cs{verbatim} macro.
-%    \begin{macrocode}
-\def\verbatim at input#1#2{%
-   \IfFileExists {#2}{\@verbatim #1\relax
-%    \end{macrocode}
-%    Then it reads in the file, finishes off the \texttt{trivlist}
-%    environment started by \cs{@verbatim} and closes the group.
-%    This restores everything to its normal settings.
-%    \begin{macrocode}
-    \verbatim at readfile{\@filef at und}\endtrivlist\endgroup\@doendpe}%
-%    \end{macrocode}
-%   If the file is not found a more or less helpful message is
-%    printed. The final \cs{endgroup} is  needed to close the group
-%    started in \cs{verbatiminput} above.
-%    \begin{macrocode}
-   {\typeout {No file #2.}\endgroup}}
-%    \end{macrocode}
-% \end{macro}
+% Next the actual patching
+% \begin{verbatim}
+% % % patch \@verbatim, two changes
+% % firstly change leftskip into the memoir aliases
+% \patchcmd\@verbatim{%
+%   \leftskip\@totalleftmargin\rightskip\z@%
+% }{%
+%   \memRTLleftskip\@totalleftmargin\memRTLrightskip\z@%
+% }{}{\typeout{first patch for \string\@verbatim\space failed}}
+% % secondly add the wrapping code at the very end, we could probably
+% % use the macro hook here
+% \patchcmd\@verbatim{%
+%   \everypar \expandafter{\the\everypar \unpenalty}%
+% }{%
+%   \everypar \expandafter{\the\everypar \unpenalty}%
+%   \wrapright\the\afterevery at verbatim%
+% }{}{\typeout{second patch for \string\@verbatim\space failed}}
+%   
+% % add tabs support for \verbatim
+% \patchcmd\verbatim{\begingroup\@verbatim}{%
+%   \begingroup%
+%     \ift at bs%
+%       \def\verbatim at processline{\tabverbatim at processline}%
+%     \fi%
+%     \@verbatim%
+% }{}{\typeout{Patch 1 for \string\verbatim\space failed}}
+% % add tab support  
+% \patchcmd\verbatim{\@vobeyspaces}{%
+%   \@vobeyspaces\@maybeobeytabs%
+% }{}{\typeout{Patch 2 for \string\verbatim\space failed}}
+% 
+% \expandafter\patchcmd\expandafter{\csname verbatim*\endcsname}%
+% {\begingroup\@verbatim}{%
+%     \begingroup%
+%     \ift at bs%
+%       \def\verbatim at processline{\tabverbatim at processline}%
+%       \def\@setupverbvisibletab{}% remove redef of \@xobeytab
+%     \fi%
+%     \@verbatim%
+% }{}{\typeout{Patch 1 for \string\verbatim*\space failed}}
+% \expandafter\patchcmd\expandafter{\csname verbatim*\endcsname}%
+% {\@vobeyspaces}{%
+%   \@vobeyspaces\@maybeobeytabs%
+% }{}{\typeout{Patch 2 for \string\verbatim*\space failed}}              
 %
-% \textit{That completes my borrowings from \Lpack{verbatim}.}
+% patches for \verbatiminput, there are 3
+% \patchcmd\verbatiminput{\begingroup\@ifstar}{%
+%   \begingroup%
+%     \ift at bs%
+%       \def\verbatim at processline{\tabverbatim at processline}%
+%     \fi%
+%     \@ifstar%
+% }{}{\typeout{Patch 1 for \string\verbatiminput\space failed}}
+% 
+% \patchcmd\verbatiminput{\@ifstar{\verbatim at input\relax}}{%
+%   \@ifstar{\verbatim at input{\@maybeobeytabs}}%
+% }{}{\typeout{Patch 2 for \string\verbatiminput\space failed}}
+% 
+% \patchcmd\verbatiminput{\frenchspacing\@vobeyspaces}{%
+%   \frenchspacing\@vobeyspaces\@maybeobeytabs%
+% }{}{\typeout{Patch 3 for \string\verbatiminput\space failed}}
+% 
+% \end{verbatim}
+% 
 %
-% The next bunch of code implements wrapping verbatim lines so they, hopefully,
-% stay within the typeblock.
 %
-% \begin{macro}{\verbatimindent}
-% \begin{macro}{\verbatimbreakchar}
-% \begin{macro}{\setverbatimbreak}
-% The length \cs{verbatimindent} is the distance continuation lines are indented
-% from the left margin. \cs{verbatimbreakchar} is the character to indicate
-% a wrapped line.
-%    \begin{macrocode}
-\newlength{\verbatimindent}
-  \setlength{\verbatimindent}{3em}
-\newcommand*{\verbatimbreakchar}{\char`\%}
-\newcommand*{\setverbatimbreak}{%
-  \vspace*{-\baselineskip}%
-  \def\@xobeysp{~\discretionary{\verbatimbreakchar}%
-    {\kern\verbatimindent}{}}%
-}
-
-%    \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
 %
-% \begin{macro}{\raggedwrap}
-% \begin{macro}{\wrappingon}
-% \begin{macro}{\wrapright}
-% \begin{macro}{\wrappingoff}
-% \cs{wrappingon} and \cs{wrappingoff} enable/prohibit wrapping. The
-% default is \cs{wrappingoff}.
-%
-% The macro
-% \cs{wrapright}  is used to set paragraph skips; without raggedright the 
-% lines
-% may break at the first space \emph{outside} the text area. However,
-% Paul (\url{paulaugust2003 at yahoo.com}) found that wrapped verbatims
-% in a list (e.g., \texttt{itemize}) were not indented although regular
-% verbatims were indented. \cs{raggedwrap} is a variation on \cs{raggedright}
-% (\cs{leftskip} is set to \cs{@totalleftmargin} instead of 0pt), and seems
-% to have fixed the problem with the original code which used 
-% \cs{raggedright}. 
-% \changes{v1.61803}{2008/01/30}{Added \cs{raggedwrap} (mempatch v4.4)}
-% \changes{v1.61803398}{2009/07/18}{Added bidi support to \cs{raggedwrap}}
-%    \begin{macrocode}
-\newcommand*{\raggedwrap}{%
-  \@rightskip\@flushglue
-%%%  \rightskip\@rightskip
-  \memRTLrightskip\@rightskip
-%%%  \leftskip\@totalleftmargin
-  \memRTLleftskip\@totalleftmargin
-  \parindent\ragrparindent}
-\newcommand*{\wrappingon}{%
-  \def\@xobeysp{~\discretionary{\verbatimbreakchar}%
-    {\kern\verbatimindent}{}}%
-  \def\wrapright{\raggedwrap}}
-\newcommand*{\wrappingoff}{%
-  \def\@xobeysp{\leavevmode\penalty\@M\ }%
-  \def\wrapright{}}
-\wrappingoff
-
-%    \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
+% ^^A % All the code in this section was added for version 1.2 of the class.
+% ^^A % \changes{v1.2}{2002/07/27}{Section `Verbatims, boxes and files' added}
+% ^^A %
+% ^^A % \subsection{Modified version of the verbatim package}
+% ^^A %
+% ^^A % \noindent{\color{red}\rule\textwidth{5mm}}
+% ^^A % 
+% ^^A % Much of this is from the \Lpack{verbatim} package code~\cite{VERBATIM}.
+% ^^A % Unless indicated otherwise, the code and commentary is from that
+% ^^A % package.
+% ^^A %
+% ^^A %
+% ^^A % \subsubsection{Preliminaries}
+% ^^A %
+% ^^A % \begin{macro}{\every at verbatim}
+% ^^A % \begin{macro}{\afterevery at verbatim}
+% ^^A %    The hook (i.e., token register) \cs{every at verbatim}
+% ^^A %    is initialized to \meta{empty}.
+% ^^A %
+% ^^A % PW added the \cs{afterevery at verbatim} hook.
+% ^^A %    \begin{macrocode}
+% ^^A \newtoks\every at verbatim
+% ^^A   \every at verbatim={}
+% ^^A \newtoks\afterevery at verbatim
+% ^^A   \afterevery at verbatim={}
+% ^^A 
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A %
+% ^^A % \begin{macro}{\@makeother}
+% ^^A %    \cs{@makeother} takes as argument a character and changes
+% ^^A %    its category code to $12$ (other).
+% ^^A %    \begin{macrocode}
+% ^^A \def\@makeother#1{\catcode`#112\relax}
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A %
+% ^^A % \begin{macro}{\@vobeyspaces}
+% ^^A %    The macro \cs{@vobeyspaces} causes spaces in the input
+% ^^A %    to be printed as spaces in the output.
+% ^^A %    
+% ^^A %    In the Nov-2023 kernel update, some changes were made to how
+% ^^A %    \verb|\verb| handles tabs. We need to adjust accordingly. Note
+% ^^A %    that it will be better to just load the \Lpack{verbatim} package
+% ^^A %    and make adjustments to it. The fix comes from \url{https://github.com/latex3/latex2e/issues/1160#issuecomment-1793564381}.
+% ^^A % \changes{v3.8.2}{2023/11/07}{Added fix for kernel update}
+% ^^A %    \begin{macrocode}
+% ^^A \begingroup
+% ^^A   \catcode`\ =\active%
+% ^^A   \IfFormatAtLeastTF{2023-11-01}% 
+% ^^A % active spaces at line beginning are absorbed as macro arguments
+% ^^A {\def\x{\def\@vobeyspaces{\catcode`\ \active\let \@xobeysp\@vobeytabs}}}%
+% ^^A {\def\x{\def\@vobeyspaces{\catcode`\ \active\let \@xobeysp}}}%
+% ^^A   % was: \def\x{\def\@vobeyspaces{\catcode`\ \active\let \@xobeysp}}
+% ^^A   \expandafter\endgroup\x
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A %
+% ^^A % \begin{macro}{\@xobeysp}
+% ^^A %    The macro \cs{@xobeysp} produces exactly one space in
+% ^^A %    the output, protected against breaking just before it.
+% ^^A %    (\cs{@M} is an abbreviation for the number $10000$.)
+% ^^A %    \begin{macrocode}
+% ^^A \def\@xobeysp{\leavevmode\penalty\@M\ }
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A %
+% ^^A % \begin{macro}{\verbatim at line}
+% ^^A %    We use a newly defined token register called \cs{verbatim at line}
+% ^^A %    that will be used as the character buffer.
+% ^^A %    \begin{macrocode}
+% ^^A \newtoks\verbatim at line
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % PW. I have extended the original \Lpack{verbatim} package code to handle
+% ^^A % TABs within verbatims. Normally TeX replaces a TAB by either a single space or
+% ^^A % ignores it altogether. For this purpose I have bits of code from the \Lpack{moreverb}
+% ^^A % package~\cite{MOREVERB} for handling TABs.
+% ^^A %
+% ^^A % \textit{Code and commentary from moreverb.}
+% ^^A %
+% ^^A % We define a few auxiliary macros and counters for expanding tabs.
+% ^^A %    \begin{macrocode}
+% ^^A \newcount\tab at position 
+% ^^A %    \end{macrocode}
+% ^^A %
+% ^^A % \begin{macro}{\@xobeytab}
+% ^^A % \cs{@xobeytab} puts enough spaces in to get to the next nominal
+% ^^A % tab stop
+% ^^A %    \begin{macrocode}
+% ^^A \def\@xobeytab{%
+% ^^A   \loop
+% ^^A     \toks@\expandafter{\the\toks@\@xobeysp}%
+% ^^A     \advance\tab at position-1
+% ^^A   \ifnum\tab at position>0 \repeat
+% ^^A }
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % \begin{macro}{\@vobeytabs}
+% ^^A % \cs{@vobeytabs} initialises use of \cs{@xobeytab}.  Needs to be
+% ^^A % executed within a group, as mustn't be allowed to leak out into the
+% ^^A % wide world.
+% ^^A %
+% ^^A %    \begin{macrocode}
+% ^^A \begingroup
+% ^^A   \catcode`\^^I=\active
+% ^^A   \gdef\@vobeytabs{\catcode`\^^I\active\let^^I\@xobeytab}%
+% ^^A \endgroup
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % \begin{macro}{\verbatim at tabexpand}
+% ^^A % \cs{verbatim at tabexpand}\marg{body of line}\cs{@nil} processes every
+% ^^A % character of a line by tail recursion, counting the characters and
+% ^^A % juggling things when a tab is encountered.
+% ^^A %    \begin{macrocode}
+% ^^A \def\verbatim at tabexpand#1{%
+% ^^A   \ifx#1\@nil
+% ^^A     \the\toks@
+% ^^A     \expandafter\par
+% ^^A   \else
+% ^^A     \ifx#1\@xobeytab
+% ^^A       \@xobeytab
+% ^^A     \else
+% ^^A %    \end{macrocode}
+% ^^A %
+% ^^A % We can safely put \cs{@xobeysp} into the token register, since it
+% ^^A % does precisely what we need
+% ^^A %    \begin{macrocode}
+% ^^A       \toks@\expandafter{\the\toks@#1}%
+% ^^A       \advance\tab at position\m at ne
+% ^^A     \fi
+% ^^A     \ifnum\tab at position=0 \tab at position\tab at size \fi
+% ^^A     \expandafter\verbatim at tabexpand
+% ^^A   \fi
+% ^^A }
+% ^^A 
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % \textit{End of code and commentary from moreverb.}
+% ^^A %
+% ^^A % PW. Some macros for turning tabbing on and off.
+% ^^A %
+% ^^A % \begin{macro}{\tabson}
+% ^^A % \begin{macro}{\tabsoff}
+% ^^A % \begin{macro}{\@maybeobeytabs}
+% ^^A % \cs{tabson} turns tabbing on, and \cs{tabsoff} turns it off. Default
+% ^^A % is no tabbing.
+% ^^A %    \begin{macrocode}
+% ^^A \newif\ift at bs
+% ^^A \newcommand{\tabson}[1][4]{%
+% ^^A   \ifnum\@ne > #1\relax
+% ^^A     \tabsoff
+% ^^A   \else
+% ^^A     \t at bstrue
+% ^^A     \def\tab at size{#1\relax}%
+% ^^A     \def\@maybeobeytabs{\@vobeytabs}%
+% ^^A   \fi
+% ^^A }
+% ^^A \newcommand{\tabsoff}{%
+% ^^A   \t at bsfalse
+% ^^A   \def\tab at size{\z@}%
+% ^^A   \def\@maybeobeytabs{}%
+% ^^A }
+% ^^A \tabsoff
+% ^^A 
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A % \end{macro}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % \begin{macro}{\tabverbatim at processline}
+% ^^A % Process a line with TABs (extracted from \Lpack{moreverb}).
+% ^^A %    \begin{macrocode}
+% ^^A \def\tabverbatim at processline{\tab at position\tab at size
+% ^^A   \toks@{}%
+% ^^A   \expandafter\verbatim at tabexpand\the\verbatim at line\@nil}
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % \begin{macro}{\notabverbatim at processline}
+% ^^A % Processes a line ignoring TABs (this is the original \Lpack{verbatim}
+% ^^A % package definition of \cs{verbatim at processline}).
+% ^^A %    \begin{macrocode}
+% ^^A \def\notabverbatim at processline{\the\verbatim at line\par}
+% ^^A 
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % \textit{We are now back to the \Lpack{verbatim} code.}
+% ^^A %
+% ^^A % The following four macros are defined globally in a way suitable for
+% ^^A % the \texttt{verbatim} and \texttt{verbatim*} environments.
+% ^^A % \begin{macro}{\verbatim at startline}
+% ^^A % \begin{macro}{\verbatim at addtoline}
+% ^^A % \begin{macro}{\verbatim at processline}
+% ^^A %    \cs{verbatim at startline} initializes processing of a line
+% ^^A %    by emptying the character buffer (\cs{verbatim at line}).
+% ^^A %    \begin{macrocode}
+% ^^A \def\verbatim at startline{\verbatim at line{}}
+% ^^A %    \end{macrocode}
+% ^^A %    \cs{verbatim at addtoline} adds the tokens in its argument
+% ^^A %    to our buffer register \cs{verbatim at line} without expanding
+% ^^A %    them.
+% ^^A %    \begin{macrocode}
+% ^^A \def\verbatim at addtoline#1{%
+% ^^A   \verbatim at line\expandafter{\the\verbatim at line#1}}
+% ^^A %    \end{macrocode}
+% ^^A %    Processing a line inside a \texttt{verbatim} or \texttt{verbatim*}
+% ^^A %    environment means printing it.
+% ^^A %    Ending the line means that we have to begin a new paragraph.
+% ^^A %    We use \cs{par} for this purpose.  Note that \cs{par}
+% ^^A %    is redefined in \cs{@verbatim} to force \TeX{} into horizontal
+% ^^A %    mode and to insert an empty box so that empty lines in the input
+% ^^A %    do appear in the output.
+% ^^A % (PW changed next line from \\
+% ^^A % \verb?\def\verbatim at processline{\the\verbatim at line\par}?
+% ^^A %    \begin{macrocode}
+% ^^A \def\verbatim at processline{\notabverbatim at processline}
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A % \end{macro}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % \begin{macro}{\verbatim at finish}
+% ^^A %    As a default, \cs{verbatim at finish} processes the remaining
+% ^^A %    characters.
+% ^^A %    When this macro is called we are facing the following problem:
+% ^^A %    when the \verb?\end{verbatim}?
+% ^^A %    command is encountered \cs{verbatim at processline} is called
+% ^^A %    to process the characters preceding the command on the same
+% ^^A %    line.  If there are none, an empty line would be output if we
+% ^^A %    did not check for this case.
+% ^^A %
+% ^^A %    If the line is empty \verb?\the\verbatim at line? expands to
+% ^^A %    nothing.  To test this we use a trick similar to that on p.\ 376
+% ^^A %    of the \TeX{}book, but with \verb?$?\ldots\verb?|$? instead of
+% ^^A %    the \verb?!? tokens.  These \verb?$? tokens can never have the same
+% ^^A %    category code as a \verb?$? token that might possibly appear in the
+% ^^A %    token register \cs{verbatim at line}, as such a token will always have
+% ^^A %    been read with category code $12$ (other).
+% ^^A %    Note that \cs{ifcat} expands the following tokens so that
+% ^^A %    \verb?\the\verbatim at line? is replaced by the accumulated
+% ^^A %    characters
+% ^^A %    \begin{macrocode}
+% ^^A \def\verbatim at finish{\ifcat$\the\verbatim at line$\else
+% ^^A   \verbatim at processline\fi}
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A %
+% ^^A % \subsubsection{The \texttt{verbatim} and \texttt{verbatim*} environments}
+% ^^A %
+% ^^A % \begin{macro}{\verbatim at font}
+% ^^A %    We start by defining the macro \cs{verbatim at font} that is
+% ^^A %    to select the font and to set font-dependent parameters.
+% ^^A %    Then we go through \cs{verbatim at nolig@list} to avoid
+% ^^A %    certain ligatures.
+% ^^A %    \cs{verbatim at nolig@list} is a macro defined in the \LaTeXe{} kernel
+% ^^A %    to expand to
+% ^^A % \begin{verbatim}
+% ^^A %    \do\`\do\<\do\>\do\,\do\'\do\-
+% ^^A % \end{verbatim}
+% ^^A %    All the characters in this list can be part of a ligature in some
+% ^^A %    font or other.
+% ^^A % 
+% ^^A % PW. This is the original version which I'm going to replace.
+% ^^A % \begin{verbatim}
+% ^^A % \def\verbatim at font{\normalfont\ttfamily
+% ^^A %                    \hyphenchar\font\m at ne
+% ^^A %                    \let\do\do at noligs
+% ^^A %                    \verbatim at nolig@list}
+% ^^A % \end{verbatim}
+% ^^A % Actually the kernel defines the macro \verb+\@noligs+ which just
+% ^^A % runs the last two lines of the \verb+\verbatim at font+ above. As other
+% ^^A % package may add stuff to \verb+\@noligs+, we will use that instead.
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % \begin{macro}{\setverbatimfont}
+% ^^A % \begin{macro}{\m at mverbfont}
+% ^^A % \begin{macro}{\verbatim at font}
+% ^^A % User level handle for changing the font used for verbatim text.
+% ^^A % \changes{v1.61803398}{2009/09/10}{Changed the last two lines of
+% ^^A % \cs{verbatim at font} into using \cs{@noligs} instead. This fixes
+% ^^A % problem with upquote.}
+% ^^A %    \begin{macrocode}
+% ^^A \newcommand{\setverbatimfont}[1]{\def\m at mverbfont{#1}}
+% ^^A \setverbatimfont{\normalfont\ttfamily}
+% ^^A 
+% ^^A \def\verbatim at font{\m at mverbfont
+% ^^A                    \hyphenchar\font\m at ne
+% ^^A                    \@noligs}
+% ^^A 
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A % \end{macro}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A %
+% ^^A % \begin{macro}{\@verbatim}
+% ^^A %    The macro \cs{@verbatim} sets up things properly.
+% ^^A %    First of all, the tokens of the \cs{every at verbatim} hook
+% ^^A %    are inserted.
+% ^^A %    Then a \texttt{trivlist} environment is started and its first
+% ^^A %    \cs{item} command inserted.
+% ^^A %    Each line of the \texttt{verbatim} or \texttt{verbatim*}
+% ^^A %    environment will be treated as a separate paragraph.
+% ^^A % \changes{v1.61803398}{2009/07/18}{Added bidi support to \cs{@verbatim}}
+% ^^A %    \begin{macrocode}
+% ^^A \def\@verbatim{\the\every at verbatim
+% ^^A   \trivlist \item \relax
+% ^^A %    \end{macrocode}
+% ^^A %    The following extra vertical space is for compatibility with the
+% ^^A %    \LaTeX kernel: otherwise, using the \Lpack{verbatim} package changes
+% ^^A %    the vertical spacing of a \texttt{verbatim} environment nested within a
+% ^^A %    \texttt{quote} environment.
+% ^^A %    \begin{macrocode}
+% ^^A   \if at minipage\else\vskip\parskip\fi
+% ^^A %    \end{macrocode}
+% ^^A %    The paragraph parameters are set appropriately:
+% ^^A %    the penalty at the beginning of the environment,
+% ^^A %    left and right margins, paragraph indentation, the glue to
+% ^^A %    fill the last line, and the vertical space between paragraphs.
+% ^^A %    The latter space has to be zero since we do not want to add
+% ^^A %    extra space between lines.
+% ^^A %    \begin{macrocode}
+% ^^A   \@beginparpenalty \predisplaypenalty 
+% ^^A %%%  \leftskip\@totalleftmargin\rightskip\z@
+% ^^A   \memRTLleftskip\@totalleftmargin\memRTLrightskip\z@
+% ^^A   \parindent\z@\parfillskip\@flushglue\parskip\z@
+% ^^A %    \end{macrocode}
+% ^^A %    There's one point to make here:
+% ^^A %    the \texttt{list} environment uses \TeX's \cs{parshape}
+% ^^A %    primitive to get a special indentation for the first line
+% ^^A %    of the  list.
+% ^^A %    If the list begins with a \texttt{verbatim} environment
+% ^^A %    this \cs{parshape} is still in effect.
+% ^^A %    Therefore we have to reset this internal parameter explicitly.
+% ^^A %    We could do this by assigning $0$ to \cs{parshape}.
+% ^^A %    However, there is a simpler way to achieve this:
+% ^^A %    we simply tell \TeX{} to start a new paragraph.
+% ^^A %    As is explained on p.~103 of the \TeX{}book, this resets
+% ^^A %    \cs{parshape} to zero.
+% ^^A %    \begin{macrocode}
+% ^^A   \@@par
+% ^^A %    \end{macrocode}
+% ^^A %    We now ensure that \cs{par} has the correct definition,
+% ^^A %    namely to force \TeX{} into horizontal mode
+% ^^A %    and to include an empty box.
+% ^^A %    This is to ensure that empty lines do appear in the output.
+% ^^A %    Afterwards, we insert the \cs{interlinepenalty} since \TeX{}
+% ^^A %    does not add a penalty between paragraphs (here: lines)
+% ^^A %    by its own initiative. Otherwise a \texttt{verbatim} environment
+% ^^A %    could be broken across pages even if a \cs{samepage}
+% ^^A %    declaration were present.
+% ^^A %
+% ^^A %    However, in a top-aligned minipage, this will result in an extra
+% ^^A %    empty line added at the top. Therefore, a slightly more
+% ^^A %    complicated construct is necessary.
+% ^^A %    One of the important things here is the inclusion of
+% ^^A %    \cs{leavevmode} as the first macro in the first line, for example,
+% ^^A %    a blank verbatim line is the first thing in a list item.
+% ^^A %    \begin{macrocode}
+% ^^A   \def\par{%
+% ^^A     \if at tempswa
+% ^^A       \leavevmode\null\@@par\penalty\interlinepenalty
+% ^^A     \else
+% ^^A       \@tempswatrue
+% ^^A       \ifhmode\@@par\penalty\interlinepenalty\fi
+% ^^A     \fi}%
+% ^^A %    \end{macrocode}
+% ^^A %    But to avoid an error message when the environment
+% ^^A %    doesn't contain any text, we redefine \cs{@noitemerr}
+% ^^A %    which will in this case be called by \cs{endtrivlist}.
+% ^^A %    \begin{macrocode}
+% ^^A   \def\@noitemerr{\@warning{No verbatim text}}%
+% ^^A %    \end{macrocode}
+% ^^A %    Now we call \cs{obeylines} to make the end of line character
+% ^^A %    active,
+% ^^A %    \begin{macrocode}
+% ^^A   \obeylines
+% ^^A %    \end{macrocode}
+% ^^A %    change the category code of all special characters,
+% ^^A %    to $12$ (other).
+% ^^A %    \begin{macrocode}
+% ^^A   \let\do\@makeother \dospecials
+% ^^A %    \end{macrocode}
+% ^^A %    and switch to the font to be used.
+% ^^A %    \begin{macrocode}
+% ^^A   \verbatim at font
+% ^^A %    \end{macrocode}
+% ^^A %    To avoid a breakpoint after the labels box, we remove the penalty
+% ^^A %    put there by the list macros: another use of \cs{unpenalty}!
+% ^^A %    \begin{macrocode}
+% ^^A   \everypar \expandafter{\the\everypar \unpenalty}%
+% ^^A %    \end{macrocode}
+% ^^A % PW added next code at end of \cs{@verbatim}.
+% ^^A %    \begin{macrocode}
+% ^^A   \wrapright\the\afterevery at verbatim}
+% ^^A %    \end{macrocode}   
+% ^^A % \end{macro}
+% ^^A %
+% ^^A %
+% ^^A % \begin{macro}{\verbatim}
+% ^^A % \begin{macro}{\verbatim*}
+% ^^A %    Now we define the toplevel macros.
+% ^^A %    \cs{verbatim} is slightly changed:
+% ^^A %    after setting up things properly it calls
+% ^^A %    \cs{verbatim at start}.
+% ^^A %    This is done inside a group, so that \cs{verbatim} can be used
+% ^^A %    directly, without \cs{begin}.
+% ^^A %
+% ^^A % PW. The following is the original code, but I want a version of
+% ^^A % \texttt{verbatim} that recognises TABs.
+% ^^A % \begin{verbatim}
+% ^^A %    \begin{macrocode}
+% ^^A % \def\verbatim{%
+% ^^A %    \begingroup\@verbatim \frenchspacing\@vobeyspaces 
+% ^^A %    \verbatim at start}
+% ^^A %    \end{macrocode}
+% ^^A %    \cs{verbatim*} is defined accordingly.
+% ^^A %    \begin{macrocode}
+% ^^A % \@namedef{verbatim*}{\begingroup\@verbatim\verbatim at start}
+% ^^A % \def\endverbatim{\endtrivlist\endgroup}
+% ^^A % \expandafter\let\csname endverbatim*\endcsname=\endverbatim
+% ^^A %    \end{macrocode}
+% ^^A % \end{verbatim}
+% ^^A %
+% ^^A % PW. My code for these is a modified version of the original \Lpack{verbatim}
+% ^^A % code.
+% ^^A %    \begin{macrocode}
+% ^^A \def\verbatim{\begingroup
+% ^^A   \ift at bs
+% ^^A     \def\verbatim at processline{\tabverbatim at processline}%
+% ^^A   \fi
+% ^^A   \@verbatim \frenchspacing\@vobeyspaces\@maybeobeytabs\verbatim at start}
+% ^^A \@namedef{verbatim*}{\begingroup
+% ^^A   \ift at bs
+% ^^A     \def\verbatim at processline{\tabverbatim at processline}%
+% ^^A   \fi
+% ^^A   \@verbatim\@maybeobeytabs\verbatim at start}
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A %
+% ^^A % \begin{macro}{\endverbatim}
+% ^^A % \begin{macro}{\endverbatim*}
+% ^^A %    To end the \texttt{verbatim} and \texttt{verbatim*}
+% ^^A %    environments it is only necessary to finish the
+% ^^A %    \texttt{trivlist} environment started in \cs{@verbatim} and
+% ^^A %    close the corresponding group, and handle\footnote{Noted by
+% ^^A % Zarko Cucej (\url{zarko.cucej at uni-mb.si}).} following (non-) paragraph,
+% ^^A % by using \cs{@doendpe}.
+% ^^A % \changes{v1.4}{2003/11/22}{Added \cs{@doendpe} to \cs{endverbatim} 
+% ^^A %                            (from patch v1.8)}
+% ^^A % \changes{v2.0a}{2004/03/01}{Refixed \cs{endverbatim}}
+% ^^A %    \begin{macrocode}
+% ^^A \def\endverbatim{\endtrivlist\endgroup\@doendpe}
+% ^^A \@namelet{endverbatim*}\endverbatim
+% ^^A 
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % For abnormal \cs{parskip}s the NTG class included the following, but I'm
+% ^^A % not sure if it is relevant here, but if it is just how it should be included.
+% ^^A % \begin{verbatim}
+% ^^A % From NTG, where it is a \cs{def}
+% ^^A % \providecommand*{\verbatim}{%
+% ^^A %   \topsep=-0.5\parskip
+% ^^A %   \@verbatim
+% ^^A %   \frenchspacing\@vobeyspaces \@xverbatim}
+% ^^A % \end{verbatim}
+% ^^A %
+% ^^A %
+% ^^A % \subsubsection{The \texttt{comment} environment}
+% ^^A %
+% ^^A %    The \cs{comment} macro is similar to \cs{verbatim*}.
+% ^^A %    However, we do not need to switch fonts or set special
+% ^^A %    formatting parameters such as \cs{parindent} or \cs{parskip}.
+% ^^A %    We need only set the category code of all special characters
+% ^^A %    to $12$ (other) and that of \verb?^^M? (the end of line character)
+% ^^A %    to $13$ (active).
+% ^^A %    The latter is needed for macro parameter delimiter matching in
+% ^^A %    the internal macros defined below.
+% ^^A %    In contrast to the default definitions used by the
+% ^^A %    \cs{verbatim} and \cs{verbatim*} macros,
+% ^^A %    we define \cs{verbatim at addtoline} to throw away its argument
+% ^^A %    and \cs{verbatim at processline}, \cs{verbatim at startline},
+% ^^A %    and \cs{verbatim at finish} to act as no-ops.
+% ^^A %    Then we call \cs{verbatim@}.
+% ^^A %    But the first thing we do is to call \cs{@bsphack} so that
+% ^^A %    this environment has no influence whatsoever upon the spacing.
+% ^^A %
+% ^^A % PW: This is the original code for the \texttt{comment} environment, 
+% ^^A % which I'm going to change.
+% ^^A % \begin{verbatim}
+% ^^A % \def\comment{\@bsphack
+% ^^A %              \let\do\@makeother\dospecials\catcode`\^^M\active
+% ^^A %              \let\verbatim at startline\relax
+% ^^A %              \let\verbatim at addtoline\@gobble
+% ^^A %              \let\verbatim at processline\relax
+% ^^A %              \let\verbatim at finish\relax
+% ^^A %              \verbatim@}
+% ^^A % \end{verbatim}
+% ^^A %    \cs{endcomment} is very simple: it only calls
+% ^^A %    \cs{@esphack} to take care of the spacing.
+% ^^A %    The \cs{end} macro closes the group and therefore takes care
+% ^^A %    of restoring everything we changed.
+% ^^A % \begin{verbatim}
+% ^^A % \let\endcomment=\@esphack
+% ^^A % \end{verbatim}
+% ^^A %
+% ^^A % PW: The remainder of this section is my code.
+% ^^A %
+% ^^A % \begin{macro}{\setupcomment}
+% ^^A % \cs{setupcomment} does all the \cs{let}s in the original \cs{comment} code.
+% ^^A %    \begin{macrocode}
+% ^^A \newcommand{\setupcomment}{%
+% ^^A   \let\do\@makeother\dospecials\catcode`\^^M\active
+% ^^A   \let\verbatim at startline\relax
+% ^^A   \let\verbatim at addtoline\@gobble
+% ^^A   \let\verbatim at processline\relax
+% ^^A   \let\verbatim at finish\relax}
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % The macros below do no checking to see if something has (not) been defined
+% ^^A % previously. It's `user beware' time.
+% ^^A %
+% ^^A % \begin{macro}{\newcomment}
+% ^^A % \cs{newcomment}\marg{name} creates a new comment environment called 
+% ^^A % \meta{name}. This is a generalisation of the original comment code.
+% ^^A %    \begin{macrocode}
+% ^^A \newcommand{\newcomment}[1]{%
+% ^^A   \expandafter\def\csname #1\endcsname{\@bsphack\setupcomment\verbatim@}%
+% ^^A   \expandafter\let\csname end#1\endcsname=\@esphack}
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % \begin{macro}{\commentsoff}
+% ^^A % \cs{commentsoff}\marg{name} switches off the \meta{name} comment 
+% ^^A % environment by defining the relevent macros to do nothing.
+% ^^A %    \begin{macrocode}
+% ^^A \newcommand{\commentsoff}[1]{%
+% ^^A   \expandafter\def\csname #1\endcsname{}%
+% ^^A   \expandafter\def\csname end#1\endcsname{}}
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % \begin{macro}{\commentson}
+% ^^A % \cs{commentson}\marg{name} switches on the \meta{name} comment 
+% ^^A % environment. It has to do the same things as \cs{newcomment} does,
+% ^^A % so let \cs{newcomment} do the work.
+% ^^A %    \begin{macrocode}
+% ^^A \newcommand{\commentson}[1]{\newcomment{#1}}
+% ^^A 
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % We had better supply the \texttt{comment} environment, as promised.
+% ^^A %    \begin{macrocode}
+% ^^A \newcomment{comment}
+% ^^A 
+% ^^A %    \end{macrocode}
+% ^^A %
+% ^^A % PW: That is the end of my changes and extensions to the original 
+% ^^A % \texttt{comment} environment code.
+% ^^A %
+% ^^A %
+% ^^A % \subsubsection{The main loop}
+% ^^A %
+% ^^A % Here comes the tricky part:
+% ^^A % During the definition of the macros we need to use the special
+% ^^A % characters \verb?\?, \verb?{?, and \verb?}? not only with their
+% ^^A % normal category codes,
+% ^^A % but also with category code $12$ (other).
+% ^^A % We achieve this by the following trick:
+% ^^A % first we tell \TeX{} that \verb?\?, \verb?{?, and \verb?}?
+% ^^A % are the lowercase versions of \verb?!?, \verb?[?, and \verb?]?.
+% ^^A % Then we replace every occurrence of \verb?\?, \verb?{?, and \verb?}?
+% ^^A % that should be read with category code $12$ by \verb?!?, \verb?[?,
+% ^^A % and \verb?]?, respectively,
+% ^^A % and give the whole list of tokens to \cs{lowercase},
+% ^^A % knowing that category codes are not altered by this primitive!
+% ^^A %
+% ^^A % But first we have ensure that
+% ^^A % \verb?!?, \verb?[?, and \verb?]? themselves have
+% ^^A % the correct category code!
+% ^^A % To allow special settings of these codes we hide their setting in
+% ^^A % the macro \cs{vrb at catcodes}.  If it is already defined our new
+% ^^A % definition is skipped.
+% ^^A %    \begin{macrocode}
+% ^^A \@ifundefined{vrb at catcodes}%
+% ^^A   {\def\vrb at catcodes{%
+% ^^A      \catcode`\!12\catcode`\[12\catcode`\]12}}{}
+% ^^A %    \end{macrocode}
+% ^^A % This trick allows us to use this code for applications where other
+% ^^A % category codes are in effect.
+% ^^A %
+% ^^A % We start a group to keep the category code changes local.
+% ^^A %    \begin{macrocode}
+% ^^A \begingroup
+% ^^A  \vrb at catcodes
+% ^^A  \lccode`\!=`\\ \lccode`\[=`\{ \lccode`\]=`\}
+% ^^A %    \end{macrocode}
+% ^^A %    We also need the end-of-line character \verb?^^M?,
+% ^^A %    as an active character.
+% ^^A %    If we were to simply write \verb?\catcode`\^^M=\active?
+% ^^A %    then we would get an unwanted active end of line character
+% ^^A %    at the end of every line of the following macro definitions.
+% ^^A %    Therefore we use the same trick as above:
+% ^^A %    we write a tilde \verb?~? instead of \verb?^^M? and
+% ^^A %    pretend that the
+% ^^A %    latter is the lowercase variant of the former.
+% ^^A %    Thus we have to ensure now that the tilde character has
+% ^^A %    category code $13$ (active).
+% ^^A %    \begin{macrocode}
+% ^^A  \catcode`\~=\active \lccode`\~=`\^^M
+% ^^A %    \end{macrocode}
+% ^^A %    The use of the \cs{lowercase} primitive leads to one problem:
+% ^^A %    the uppercase character `\texttt{C}' needs to be used in the
+% ^^A %    code below and its case must be preserved.
+% ^^A %    So we add the command:
+% ^^A %    \begin{macrocode}
+% ^^A  \lccode`\C=`\C
+% ^^A %    \end{macrocode}
+% ^^A %    Now we start the token list passed to \cs{lowercase}.
+% ^^A %    We use the following little trick (proposed by Bernd Raichle):
+% ^^A %    The very first token in the token list we give to \cs{lowercase} is
+% ^^A %    the \cs{endgroup} primitive. This means that it is processed by
+% ^^A %    \TeX{} immediately after \cs{lowercase} has finished its operation,
+% ^^A %    thus ending the group started by \cs{begingroup} above. This avoids
+% ^^A %    the global definition of all macros.
+% ^^A %    \begin{macrocode}
+% ^^A  \lowercase{\endgroup
+% ^^A %    \end{macrocode}
+% ^^A % \begin{macro}{\verbatim at start}
+% ^^A %    The purpose of \cs{verbatim at start} is to check whether there
+% ^^A %    are any characters on the same line as the \verb?\begin{verbatim}?
+% ^^A %    and to pretend that they were on a line by themselves.
+% ^^A %    On the other hand, if there are no characters remaining
+% ^^A %    on the current line we shall just find an end of line character.
+% ^^A %    \cs{verbatim at start} performs its task by first grabbing the
+% ^^A %    following character (its argument).
+% ^^A %    This argument is then compared to an active \verb?^^M?,
+% ^^A %    the end of line character.
+% ^^A %    \begin{macrocode}
+% ^^A     \def\verbatim at start#1{%
+% ^^A       \verbatim at startline
+% ^^A       \if\noexpand#1\noexpand~%
+% ^^A %    \end{macrocode}
+% ^^A %    If this is true we transfer control to \cs{verbatim@}
+% ^^A %    to process the next line.  We use
+% ^^A %    \cs{next} as the macro which will continue the work.
+% ^^A %    \begin{macrocode}
+% ^^A         \let\next\verbatim@
+% ^^A %    \end{macrocode}
+% ^^A %    Otherwise, we define \cs{next} to expand to a call
+% ^^A %    to \cs{verbatim@} followed by the character just
+% ^^A %    read so that it is reinserted into the text.
+% ^^A %    This means that those characters remaining on this line
+% ^^A %    are handled as if they formed a line by themselves.
+% ^^A %    \begin{macrocode}
+% ^^A       \else \def\next{\verbatim@#1}\fi
+% ^^A %    \end{macrocode}
+% ^^A %    Finally we call \cs{next}.
+% ^^A %    \begin{macrocode}
+% ^^A       \next}%
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % \begin{macro}{\verbatim@}
+% ^^A %    The three macros \cs{verbatim@}, \cs{verbatim@@},
+% ^^A %    and \cs{verbatim@@@} form the ``main loop'' of the
+% ^^A %    \texttt{verbatim} environment.
+% ^^A %    The purpose of \cs{verbatim@} is to read exactly one line
+% ^^A %    of input.
+% ^^A %    \cs{verbatim@@} and \cs{verbatim@@@} work together to
+% ^^A %    find out whether the four characters
+% ^^A %    \cs{end} (all with category code $12$ (other)) occur in that
+% ^^A %    line.
+% ^^A %    If so, \cs{verbatim@@@} will call
+% ^^A %    \cs{verbatim at test} to check whether this \cs{end} is
+% ^^A %    part of \verb?\end{verbatim}? and will terminate the environment
+% ^^A %    if this is the case.
+% ^^A %    Otherwise we continue as if nothing had happened.
+% ^^A %    So let's have a look at the definition of \cs{verbatim@}:
+% ^^A %    \begin{macrocode}
+% ^^A     \def\verbatim@#1~{\verbatim@@#1!end\@nil}%
+% ^^A %    \end{macrocode}
+% ^^A %    Note that the \verb?!? character will have been replaced by a
+% ^^A %    \verb?\? with category code $12$ (other) by the \cs{lowercase}
+% ^^A %    primitive governing this code before the definition of this
+% ^^A %    macro actually takes place.
+% ^^A %    That means that
+% ^^A %    it takes the line, puts \cs{end} (four character tokens)
+% ^^A %    and \cs{@nil} (one control sequence token) as a
+% ^^A %    delimiter behind it, and
+% ^^A %    then calls \cs{verbatim@@}.
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % \begin{macro}{\verbatim@@}
+% ^^A %    \cs{verbatim@@} takes everything up to the next occurrence of
+% ^^A %    the four characters \cs{end} as its argument.
+% ^^A %    \begin{macrocode}
+% ^^A     \def\verbatim@@#1!end{%
+% ^^A %    \end{macrocode}
+% ^^A %    That means: if they do not occur in the original line, then
+% ^^A %    argument \verb?#1? is the
+% ^^A %    whole input line, and \cs{@nil} is the next token
+% ^^A %    to be processed.
+% ^^A %    However, if the four characters \cs{end} are part of the
+% ^^A %    original line, then
+% ^^A %    \verb?#1? consists of the characters in front of \cs{end},
+% ^^A %    and the next token is the following character (always remember
+% ^^A %    that the line was lengthened by five tokens).
+% ^^A %    Whatever \verb?#1? may be, it is verbatim text,
+% ^^A %    so \verb?#1? is added to the line currently built.
+% ^^A %    \begin{macrocode}
+% ^^A        \verbatim at addtoline{#1}%
+% ^^A %    \end{macrocode}
+% ^^A %    The next token in the input stream
+% ^^A %    is of special interest to us.
+% ^^A %    Therefore \cs{futurelet} defines \cs{next} to be equal
+% ^^A %    to it before calling \cs{verbatim@@@}.
+% ^^A %    \begin{macrocode}
+% ^^A        \futurelet\next\verbatim@@@}%
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % \begin{macro}{\verbatim@@@}
+% ^^A %    \cs{verbatim@@@} will now read the rest of the tokens on
+% ^^A %    the current line,
+% ^^A %    up to the final \cs{@nil} token.
+% ^^A %    \begin{macrocode}
+% ^^A     \def\verbatim@@@#1\@nil{%
+% ^^A %    \end{macrocode}
+% ^^A %    If the first of the above two cases occurred, i.e.\ no
+% ^^A %    \cs{end} characters were on that line, \verb?#1? is empty
+% ^^A %    and \cs{next} is equal to \cs{@nil}.
+% ^^A %    This is easily checked.
+% ^^A %    \begin{macrocode}
+% ^^A        \ifx\next\@nil
+% ^^A %    \end{macrocode}
+% ^^A %    If so, this was a simple line.
+% ^^A %    We finish it by processing the line we accumulated so far.
+% ^^A %    Then we prepare to read the next line.
+% ^^A %    \begin{macrocode}
+% ^^A          \verbatim at processline
+% ^^A          \verbatim at startline
+% ^^A          \let\next\verbatim@
+% ^^A %    \end{macrocode}
+% ^^A %    Otherwise we have to check what follows these \cs{end}
+% ^^A %    tokens.
+% ^^A %    \begin{macrocode}
+% ^^A        \else
+% ^^A %    \end{macrocode}
+% ^^A %    Before we continue, it's a good idea to stop for a moment
+% ^^A %    and remember where we are:
+% ^^A %    We have just read the four character tokens \cs{end}
+% ^^A %    and must now check whether the name of the environment (surrounded
+% ^^A %    by braces) follows.
+% ^^A %    To this end we define a macro called \cs{@tempa}
+% ^^A %    that reads exactly one character and decides what to do next.
+% ^^A %    This macro should do the following: skip spaces until
+% ^^A %    it encounters either a left brace or the end of the line.
+% ^^A %    But it is important to remember which characters are skipped.
+% ^^A %    The \cs{end}\meta{optional spaces}\verb?{? characters
+% ^^A %    may be part of the verbatim text, i.e.\ these characters
+% ^^A %    must be printed.
+% ^^A %
+% ^^A %    Assume for example that the current line contains
+% ^^A %    \begin{verbatim*}
+% ^^A %      \end {AVeryLongEnvironmentName}
+% ^^A %\end{verbatim*}
+% ^^A %    As we shall soon see, the scanning mechanism implemented here
+% ^^A %    will not find out that this is text to be printed until
+% ^^A %    it has read the right brace.
+% ^^A %    Therefore we need a way to accumulate the characters read
+% ^^A %    so that we can reinsert them if necessary.
+% ^^A %    The token register \cs{@temptokena} is used for this purpose.
+% ^^A %
+% ^^A %    Before we do this we have to get rid of the superfluous
+% ^^A %    \cs{end} tokens at the end of the line.
+% ^^A %    To this end we define a temporary macro whose argument
+% ^^A %    is delimited by \verb?\end\@nil? (four character tokens
+% ^^A %    and one control sequence token) to be used below
+% ^^A %    on the rest of the line, after appending a \cs{@nil} token to it.
+% ^^A %    (Note that this token can never appear in \verb?#1?.)
+% ^^A %    We use the following definition of
+% ^^A %    \cs{@tempa} to get the rest of the line (after the first
+% ^^A %    \cs{end}).
+% ^^A %    \begin{macrocode}
+% ^^A          \def\@tempa##1!end\@nil{##1}%
+% ^^A %    \end{macrocode}
+% ^^A %    We mentioned already that we use token register
+% ^^A %    \cs{@temptokena}
+% ^^A %    to remember the characters we skip, in case we need them again.
+% ^^A %    We initialize this with the \cs{end} we have thrown away
+% ^^A %    in the call to \cs{@tempa}.
+% ^^A %    \begin{macrocode}
+% ^^A          \@temptokena{!end}%
+% ^^A %    \end{macrocode}
+% ^^A %    We shall now call \cs{verbatim at test}
+% ^^A %    to process the characters
+% ^^A %    remaining on the current line.
+% ^^A %    But wait a moment: we cannot simply call this macro
+% ^^A %    since we have already read the whole line.
+% ^^A %    Therefore we have to first expand the macro \cs{@tempa} to insert
+% ^^A %    them again after the \cs{verbatim at test} token.
+% ^^A %    A \verb?^^M? character is appended to denote the end of the line.
+% ^^A %    (Remember that this character comes disguised as a tilde.)
+% ^^A %    \begin{macrocode}
+% ^^A          \def\next{\expandafter\verbatim at test\@tempa#1\@nil~}%
+% ^^A %    \end{macrocode}
+% ^^A %    That's almost all, but we still have to
+% ^^A %    now call \cs{next} to do the work.
+% ^^A %    \begin{macrocode}
+% ^^A        \fi \next}%
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A %
+% ^^A % \begin{macro}{\verbatim at test}
+% ^^A %    We define \cs{verbatim at test} to investigate every token
+% ^^A %    in turn.
+% ^^A %    \begin{macrocode}
+% ^^A     \def\verbatim at test#1{%
+% ^^A %    \end{macrocode}
+% ^^A %    First of all we set \cs{next} equal to \cs{verbatim at test}
+% ^^A %    in case this macro must call itself recursively in order to
+% ^^A %    skip spaces.
+% ^^A %    \begin{macrocode}
+% ^^A            \let\next\verbatim at test
+% ^^A %    \end{macrocode}
+% ^^A %    We have to distinguish four cases:
+% ^^A %    \begin{enumerate}
+% ^^A %      \item The next token is a \verb?^^M?, i.e.\ we reached
+% ^^A %            the end of the line.  That means that nothing
+% ^^A %            special was found.
+% ^^A %            Note that we use \cs{if} for the following
+% ^^A %            comparisons so that the category code of the
+% ^^A %            characters is irrelevant.
+% ^^A %    \begin{macrocode}
+% ^^A            \if\noexpand#1\noexpand~%
+% ^^A %    \end{macrocode}
+% ^^A %            We add the characters accumulated in token register
+% ^^A %            \cs{@temptokena} to the current line.  Since
+% ^^A %            \cs{verbatim at addtoline} does not expand its argument,
+% ^^A %            we have to do the expansion at this point.  Then we
+% ^^A %            \cs{let} \cs{next} equal to \cs{verbatim@}
+% ^^A %            to prepare to read the next line.
+% ^^A %    \begin{macrocode}
+% ^^A              \expandafter\verbatim at addtoline
+% ^^A                \expandafter{\the\@temptokena}%
+% ^^A              \verbatim at processline
+% ^^A              \verbatim at startline
+% ^^A              \let\next\verbatim@
+% ^^A %    \end{macrocode}
+% ^^A %      \item A space character follows.
+% ^^A %            This is allowed, so we add it to \cs{@temptokena}
+% ^^A %            and continue.
+% ^^A %    \begin{macrocode}
+% ^^A            \else \if\noexpand#1
+% ^^A              \@temptokena\expandafter{\the\@temptokena#1}%
+% ^^A %    \end{macrocode}
+% ^^A %      \item An open brace follows.
+% ^^A %            This is the most interesting case.
+% ^^A %            We must now collect characters until we read the closing
+% ^^A %            brace and check whether they form the environment name.
+% ^^A %            This will be done by \cs{verbatim at testend}, so here
+% ^^A %            we let \cs{next} equal this macro.
+% ^^A %            Again we will process the rest of the line, character
+% ^^A %            by character.
+% ^^A %            The characters forming the name of the environment will
+% ^^A %            be accumulated in \cs{@tempc}.
+% ^^A %            We initialize this macro to expand to nothing.
+% ^^A %    \begin{macrocode}
+% ^^A            \else \if\noexpand#1\noexpand[%
+% ^^A              \let\@tempc\@empty
+% ^^A              \let\next\verbatim at testend
+% ^^A %    \end{macrocode}
+% ^^A %            Note that the \verb?[? character will be a \verb?{? when
+% ^^A %            this macro is defined.
+% ^^A %      \item Any other character means that the \cs{end} was part
+% ^^A %            of the verbatim text.
+% ^^A %            Add the characters to the current line and prepare to call
+% ^^A %            \cs{verbatim@} to process the rest of the line.
+% ^^A %    \begin{macrocode}
+% ^^A            \else
+% ^^A              \expandafter\verbatim at addtoline
+% ^^A                \expandafter{\the\@temptokena}%
+% ^^A              \def\next{\verbatim@#1}%
+% ^^A            \fi\fi\fi
+% ^^A %    \end{macrocode}
+% ^^A %    \end{enumerate}
+% ^^A %    The last thing this macro does is to call \cs{next}
+% ^^A %    to continue processing.
+% ^^A %    \begin{macrocode}
+% ^^A            \next}%
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % \begin{macro}{\verbatim at testend}
+% ^^A %    \cs{verbatim at testend} is called when
+% ^^A %    \cs{end}\meta{optional spaces}\verb?{? was seen.
+% ^^A %    Its task is to scan everything up to the next \verb?}?
+% ^^A %    and to call \cs{verbatim@@testend}.
+% ^^A %    If no \verb?}? is found it must reinsert the characters it read
+% ^^A %    and return to \cs{verbatim@}.
+% ^^A %    The following definition is similar to that of
+% ^^A %    \cs{verbatim at test}:
+% ^^A %    it takes the next character and decides what to do.
+% ^^A %    \begin{macrocode}
+% ^^A     \def\verbatim at testend#1{%
+% ^^A %    \end{macrocode}
+% ^^A %    Again, we have four cases:
+% ^^A %    \begin{enumerate}
+% ^^A %      \item \verb?^^M?: As no \verb?}? is found in the current line,
+% ^^A %            add the characters to the buffer.  To avoid a
+% ^^A %            complicated construction for expanding
+% ^^A %            \cs{@temptokena}
+% ^^A %            and \cs{@tempc} we do it in two steps.  Then we
+% ^^A %            continue with \cs{verbatim@} to process the
+% ^^A %            next line.
+% ^^A %    \begin{macrocode}
+% ^^A          \if\noexpand#1\noexpand~%
+% ^^A            \expandafter\verbatim at addtoline
+% ^^A              \expandafter{\the\@temptokena[}%
+% ^^A            \expandafter\verbatim at addtoline
+% ^^A              \expandafter{\@tempc}%
+% ^^A            \verbatim at processline
+% ^^A            \verbatim at startline
+% ^^A            \let\next\verbatim@
+% ^^A %    \end{macrocode}
+% ^^A %      \item \verb?}?: Call \cs{verbatim@@testend} to check
+% ^^A %            if this is the right environment name.
+% ^^A %    \begin{macrocode}
+% ^^A          \else\if\noexpand#1\noexpand]%
+% ^^A            \let\next\verbatim@@testend
+% ^^A %    \end{macrocode}
+% ^^A %      \item \verb?\?: This character must not occur in the name of
+% ^^A %            an environment.  Thus we stop collecting characters.
+% ^^A %            In principle, the same argument would apply to other
+% ^^A %            characters as well, e.g., \verb?{?.
+% ^^A %            However, \verb?\? is a special case, since it may be
+% ^^A %            the first character of \cs{end}.  This means that
+% ^^A %            we have to look again for
+% ^^A %            \cs{end}\marg{environment name}
+% ^^A %            Note that we prefixed the \verb?!? by a \cs{noexpand}
+% ^^A %            primitive, to protect ourselves against it being an
+% ^^A %            active character.
+% ^^A %    \begin{macrocode}
+% ^^A          \else\if\noexpand#1\noexpand!%
+% ^^A            \expandafter\verbatim at addtoline
+% ^^A              \expandafter{\the\@temptokena[}%
+% ^^A            \expandafter\verbatim at addtoline
+% ^^A              \expandafter{\@tempc}%
+% ^^A            \def\next{\verbatim@!}%
+% ^^A %    \end{macrocode}
+% ^^A %      \item Any other character: collect it and continue.
+% ^^A %            We cannot use \cs{edef} to define \cs{@tempc}
+% ^^A %            since its replacement text might contain active
+% ^^A %            character tokens.
+% ^^A %    \begin{macrocode}
+% ^^A          \else \expandafter\def\expandafter\@tempc\expandafter
+% ^^A            {\@tempc#1}\fi\fi\fi
+% ^^A %    \end{macrocode}
+% ^^A %    \end{enumerate}
+% ^^A %    As before, the macro ends by calling itself, to
+% ^^A %    process the next character if appropriate.
+% ^^A %    \begin{macrocode}
+% ^^A          \next}%
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % \begin{macro}{\verbatim@@testend}
+% ^^A %    Unlike the previous macros \cs{verbatim@@testend} is simple:
+% ^^A %    it has only to check if the \cs{end}\marg{...}
+% ^^A %    matches the corresponding \cs{begin}\marg{...}
+% ^^A %    \begin{macrocode}
+% ^^A     \def\verbatim@@testend{%
+% ^^A %    \end{macrocode}
+% ^^A %    We use \cs{next} again to define the things that are
+% ^^A %    to be done.
+% ^^A %    Remember that the name of the current environment is
+% ^^A %    held in \cs{@currenvir}, the characters accumulated
+% ^^A %    by \cs{verbatim at testend} are in \cs{@tempc}.
+% ^^A %    So we simply compare these and prepare to execute
+% ^^A %    \cs{end}\marg{current environment}
+% ^^A %    macro if they match.
+% ^^A %    Before we do this we call \cs{verbatim at finish} to process
+% ^^A %    the last line.
+% ^^A %    We define \cs{next} via \cs{edef} so that
+% ^^A %    \cs{@currenvir} is replaced by its expansion.
+% ^^A %    Therefore we need \cs{noexpand} to inhibit the expansion
+% ^^A %    of \cs{end} at this point.
+% ^^A %    \begin{macrocode}
+% ^^A        \ifx\@tempc\@currenvir
+% ^^A          \verbatim at finish
+% ^^A          \edef\next{\noexpand\end{\@currenvir}%
+% ^^A %    \end{macrocode}
+% ^^A %    Without this trick the \cs{end} command would not be able
+% ^^A %    to correctly check whether its argument matches the name of
+% ^^A %    the current environment and you'd get an
+% ^^A %    interesting \LaTeX{} error message such as:
+% ^^A %    \begin{verbatim}
+% ^^A %! \begin{verbatim*} ended by \end{verbatim*}.
+% ^^A %\end{verbatim}
+% ^^A %    But what do we do with the rest of the characters, those
+% ^^A %    that remain on that line?
+% ^^A %    We call \cs{verbatim at rescan} to take care of that.
+% ^^A %    Its first argument is the name of the environment just
+% ^^A %    ended, in case we need it again.
+% ^^A %    \cs{verbatim at rescan} takes the list of characters to be
+% ^^A %    reprocessed as its second argument.
+% ^^A %    (This token list was inserted after the current macro
+% ^^A %    by \cs{verbatim@@@}.)
+% ^^A %    Since we are still in an \cs{edef} we protect it
+% ^^A %    by means of\cs{noexpand}.
+% ^^A %    \begin{macrocode}
+% ^^A                     \noexpand\verbatim at rescan{\@currenvir}}%
+% ^^A %    \end{macrocode}
+% ^^A %    If the names do not match, we reinsert everything read up
+% ^^A %    to now and prepare to call \cs{verbatim@} to process
+% ^^A %    the rest of the line.
+% ^^A %    \begin{macrocode}
+% ^^A        \else
+% ^^A          \expandafter\verbatim at addtoline
+% ^^A            \expandafter{\the\@temptokena[}%
+% ^^A            \expandafter\verbatim at addtoline
+% ^^A              \expandafter{\@tempc]}%
+% ^^A          \let\next\verbatim@
+% ^^A        \fi
+% ^^A %    \end{macrocode}
+% ^^A %    Finally we call \cs{next}.
+% ^^A %    \begin{macrocode}
+% ^^A        \next}%
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % \begin{macro}{\verbatim at rescan}
+% ^^A %    In principle \cs{verbatim at rescan} could be used to
+% ^^A %    analyse the characters remaining after the \verb?\end{...}?
+% ^^A %    command and pretend that these were read
+% ^^A %    ``properly'', assuming ``standard'' category codes are in
+% ^^A %    force.\footnote{Remember that they were all read with
+% ^^A %          category codes $11$ (letter) and $12$ (other) so
+% ^^A %          that control sequences are not recognized as such.}
+% ^^A %    But this is not always possible (when there are unmatched
+% ^^A %    curly braces in the rest of the line).
+% ^^A %    Besides, we think that this is not worth the effort:
+% ^^A %    After a \texttt{verbatim} or \texttt{verbatim*} environment
+% ^^A %    a new line in the output is begun anyway,
+% ^^A %    and an \verb?\end{comment}? can easily be put on a line by itself.
+% ^^A %    So there is no reason why there should be any text here.
+% ^^A %    For the benefit of the user who did put something there
+% ^^A %    (a comment, perhaps)
+% ^^A %    we simply issue a warning and drop them.
+% ^^A %    The method of testing is explained in Appendix~D, p.\ 376 of
+% ^^A %    the \TeX{}book. We use \verb?^^M? instead of the \verb?!?
+% ^^A %    character used there
+% ^^A %    since this is a character that cannot appear in \verb?#1?.
+% ^^A %    The two \cs{noexpand} primitives are necessary to avoid
+% ^^A %    expansion of active characters and macros.
+% ^^A %
+% ^^A %    One extra subtlety should be noted here: remember that
+% ^^A %    the token list we are currently building will first be
+% ^^A %    processed by the \cs{lowercase} primitive before \TeX{}
+% ^^A %    carries out the definitions.
+% ^^A %    This means that the `\texttt{C}' character in the
+% ^^A %    argument to the \cs{@warning} macro must be protected against
+% ^^A %    being changed to `\texttt{c}'.  That's the reason why we added the
+% ^^A %    \verb?\lccode`\C=`\C? assignment above.
+% ^^A %    We can now finish the argument to \cs{lowercase} as well as the
+% ^^A %    group in which the category codes were changed.
+% ^^A %    \begin{macrocode}
+% ^^A     \def\verbatim at rescan#1#2~{\if\noexpand~\noexpand#2~\else
+% ^^A         \@warning{Characters dropped after `\string\end{#1}'}\fi}}
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % \subsubsection{The \cs{verbatiminput} command}
+% ^^A %
+% ^^A % \begin{macro}{\verbatim at in@stream}
+% ^^A %    We begin by allocating an input stream (out of the 16 available
+% ^^A %    input streams).
+% ^^A %    \begin{macrocode}
+% ^^A \newread\verbatim at in@stream
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % \begin{macro}{\verbatim at readfile}
+% ^^A %    The macro \cs{verbatim at readfile} encloses the main loop by calls to
+% ^^A %    the macros \cs{verbatim at startline} and \cs{verbatim at finish},
+% ^^A %    respectively.  This makes sure
+% ^^A %    that the user can initialize and finish the command when the file
+% ^^A %    is empty or doesn't exist.  The \texttt{verbatim} environment has a
+% ^^A %    similar behaviour when called with an empty text.
+% ^^A %    \begin{macrocode}
+% ^^A \def\verbatim at readfile#1{%
+% ^^A   \verbatim at startline
+% ^^A %    \end{macrocode}
+% ^^A %    When the file is not found we issue a warning.
+% ^^A %    \begin{macrocode}
+% ^^A   \openin\verbatim at in@stream #1\relax
+% ^^A   \ifeof\verbatim at in@stream
+% ^^A     \typeout{No file #1.}%
+% ^^A   \else
+% ^^A %    \end{macrocode}
+% ^^A %    At this point we pass the name of the file to \cs{@addtofilelist}
+% ^^A %    so that its appears appears in the output of a \cs{listfiles}
+% ^^A %    command.
+% ^^A %    In addition, we use \cs{ProvidesFile} to make a log entry in the
+% ^^A %    transcript file and to distinguish files read in via
+% ^^A %    \cs{verbatiminput} from others.
+% ^^A %    \begin{macrocode}
+% ^^A     \@addtofilelist{#1}%
+% ^^A     \ProvidesFile{#1}[(verbatim)]%
+% ^^A %    \end{macrocode}
+% ^^A %    While reading from the file it is useful to switch off the
+% ^^A %    recognition of the end-of-line character.  This saves us stripping
+% ^^A %    off spaces from the contents of the line.
+% ^^A %    \begin{macrocode}
+% ^^A     \expandafter\endlinechar\expandafter\m at ne
+% ^^A     \expandafter\verbatim at read@file
+% ^^A     \expandafter\endlinechar\the\endlinechar\relax
+% ^^A     \closein\verbatim at in@stream
+% ^^A   \fi
+% ^^A   \verbatim at finish
+% ^^A }
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % \begin{macro}{\verbatim at read@file}
+% ^^A %    All the work is done in \cs{verbatim at read@file}.  It reads the input
+% ^^A %    file line by line and recursively calls itself until the end of
+% ^^A %    the file.
+% ^^A %    \begin{macrocode}
+% ^^A \def\verbatim at read@file{%
+% ^^A   \read\verbatim at in@stream to\next
+% ^^A   \ifeof\verbatim at in@stream
+% ^^A   \else
+% ^^A %    \end{macrocode}
+% ^^A %    For each line we call \cs{verbatim at addtoline} with the contents of
+% ^^A %    the line. \hskip0pt plus 3cm\penalty0\hskip0pt plus -3cm
+% ^^A %    \cs{verbatim at processline} is called next.
+% ^^A %    \begin{macrocode}
+% ^^A     \expandafter\verbatim at addtoline\expandafter{\next}%
+% ^^A     \verbatim at processline
+% ^^A %    \end{macrocode}
+% ^^A %    After processing the line we call \cs{verbatim at startline} to
+% ^^A %    initialize all before we read the next line.
+% ^^A %    \begin{macrocode}
+% ^^A     \verbatim at startline
+% ^^A %    \end{macrocode}
+% ^^A %    Without \cs{expandafter} each call of \cs{verbatim at read@file} uses
+% ^^A %    space in \TeX's input stack.\footnote{A standard \TeX\ would
+% ^^A %    report an overflow error if you try to read a file with more than
+% ^^A %    ca.\ 200~lines.  The same error occurs if the first line of code
+% ^^A %    in \S 390 of \textsl{``TeX: The Program''\/} is missing.}
+% ^^A %    \begin{macrocode}
+% ^^A     \expandafter\verbatim at read@file
+% ^^A   \fi
+% ^^A }
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A %
+% ^^A % \begin{macro}{\verbatiminput}
+% ^^A %    \cs{verbatiminput} first starts a group to keep font and category
+% ^^A %    changes local.
+% ^^A %    Then it calls the macro \cs{verbatim at input} with additional
+% ^^A %    arguments, depending on whether an asterisk follows.
+% ^^A %
+% ^^A % PW. I added the TAB checking code.
+% ^^A %    \begin{macrocode}
+% ^^A \def\verbatiminput{\begingroup
+% ^^A   \ift at bs
+% ^^A     \def\verbatim at processline{\tabverbatim at processline}%
+% ^^A   \fi
+% ^^A   \@ifstar{\verbatim at input{\@maybeobeytabs}}%
+% ^^A           {\verbatim at input{\frenchspacing\@vobeyspaces\@maybeobeytabs}}}
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % \begin{macro}{\verbatim at input}
+% ^^A %    \cs{verbatim at input} first checks whether the file exists, using
+% ^^A %    the standard macro cs{IfFileExists} which leaves the name of the
+% ^^A %    file found in \cs{@filef at und}.
+% ^^A %    Then everything is set up as in the \cs{verbatim} macro.
+% ^^A %    \begin{macrocode}
+% ^^A \def\verbatim at input#1#2{%
+% ^^A    \IfFileExists {#2}{\@verbatim #1\relax
+% ^^A %    \end{macrocode}
+% ^^A %    Then it reads in the file, finishes off the \texttt{trivlist}
+% ^^A %    environment started by \cs{@verbatim} and closes the group.
+% ^^A %    This restores everything to its normal settings.
+% ^^A %    \begin{macrocode}
+% ^^A     \verbatim at readfile{\@filef at und}\endtrivlist\endgroup\@doendpe}%
+% ^^A %    \end{macrocode}
+% ^^A %   If the file is not found a more or less helpful message is
+% ^^A %    printed. The final \cs{endgroup} is  needed to close the group
+% ^^A %    started in \cs{verbatiminput} above.
+% ^^A %    \begin{macrocode}
+% ^^A    {\typeout {No file #2.}\endgroup}}
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % \textit{That completes my borrowings from \Lpack{verbatim}.}
+% ^^A %
+% ^^A 
+% ^^A  % ^^A end embedded verbatim
+% ^^A 
+% ^^A % The next bunch of code implements wrapping verbatim lines so they, hopefully,
+% ^^A % stay within the typeblock.
+% ^^A %
+% ^^A % \begin{macro}{\verbatimindent}
+% ^^A % \begin{macro}{\verbatimbreakchar}
+% ^^A % \begin{macro}{\setverbatimbreak}
+% ^^A % The length \cs{verbatimindent} is the distance continuation lines are indented
+% ^^A % from the left margin. \cs{verbatimbreakchar} is the character to indicate
+% ^^A % a wrapped line.
+% ^^A %    \begin{macrocode}
+% ^^A \newlength{\verbatimindent}
+% ^^A   \setlength{\verbatimindent}{3em}
+% ^^A \newcommand*{\verbatimbreakchar}{\char`\%}
+% ^^A \newcommand*{\setverbatimbreak}{%
+% ^^A   \vspace*{-\baselineskip}%
+% ^^A   \def\@xobeysp{~\discretionary{\verbatimbreakchar}%
+% ^^A     {\kern\verbatimindent}{}}%
+% ^^A }
+% ^^A 
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A % \end{macro}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A % ^^A \begin{macro}{\wrappingon}
+% ^^A % \begin{macro}{\wrapright}
+% ^^A % \begin{macro}{\wrappingoff}
+% ^^A % \cs{wrappingon} and \cs{wrappingoff} enable/prohibit wrapping. The
+% ^^A % default is \cs{wrappingoff}.
+% ^^A %
+% ^^A % The macro
+% ^^A % \cs{wrapright}  is used to set paragraph skips; without raggedright the 
+% ^^A % lines
+% ^^A % may break at the first space \emph{outside} the text area. However,
+% ^^A % Paul (\url{paulaugust2003 at yahoo.com}) found that wrapped verbatims
+% ^^A % in a list (e.g., \texttt{itemize}) were not indented although regular
+% ^^A % verbatims were indented. \cs{raggedwrap} is a variation on \cs{raggedright}
+% ^^A % (\cs{leftskip} is set to \cs{@totalleftmargin} instead of 0pt), and seems
+% ^^A % to have fixed the problem with the original code which used 
+% ^^A % \cs{raggedright}. 
+% ^^A % \changes{v1.61803}{2008/01/30}{Added \cs{raggedwrap} (mempatch v4.4)}
+% ^^A % \changes{v1.61803398}{2009/07/18}{Added bidi support to \cs{raggedwrap}}
+% ^^A %    \begin{macrocode}
+% ^^A  % \newcommand*{\raggedwrap}{%
+% ^^A  %  \@rightskip\@flushglue
+% ^^A  %  %%%  \rightskip\@rightskip
+% ^^A  %  \memRTLrightskip\@rightskip
+% ^^A  % %%%  \leftskip\@totalleftmargin
+% ^^A  %  \memRTLleftskip\@totalleftmargin
+% ^^A  %  \parindent\ragrparindent}
+% ^^A \newcommand*{\wrappingon}{%
+% ^^A   \def\@xobeysp{~\discretionary{\verbatimbreakchar}%
+% ^^A     {\kern\verbatimindent}{}}%
+% ^^A   \def\wrapright{\raggedwrap}}
+% ^^A \newcommand*{\wrappingoff}{%
+% ^^A   \def\@xobeysp{\leavevmode\penalty\@M\ }%
+% ^^A   \def\wrapright{}}
+% ^^A \wrappingoff
+% ^^A 
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A % \end{macro}
+% ^^A % \end{macro}
+% ^^A % ^^A \end{macro}
+% ^^A %
+% ^^A % \noindent{\color{red}\rule\textwidth{5mm}}
+% 
 % \subsection{Writing and boxing verbatim}
 %
 %    This bunch of code is from the \Lpack{moreverb} package.
@@ -28926,6 +29354,7 @@
   \fbox{\box0}% <<<=== change here for centering,...
 \endgroup}
 %    \end{macrocode}
+
 % \end{environment}
 %
 %
@@ -28932,146 +29361,173 @@
 %
 % \subsection{The shortvrb package}
 %
-% The following is the \Lpack{shortvrb} package code (from \texttt{doc.dtx}
-% by Frank Mittelbach). It has been so useful to me that I wanted
-% to include it in the class.
+% 
+% \changes{v3.8.2}{2024/01/10}{Replaced embedded copy if
+% \Lpack{shortvrb} with loading the package. The embedded code is just
+% outcommented for now.}
 %
-% CODE AND COMMENTARY IS BY FRANK MITTELBACH
+% In earlier versions of the class we had an embedded copy of the code
+% from the \Lpack{shortvrb} package, as the functionality is very
+% useful.
 %
-% \begin{macro}{\MakeShortVerb}
-%    \begin{macrocode}
-\def\MakeShortVerb#1{%
-  \expandafter\ifx\csname cc\string#1\endcsname\relax
-%    \end{macrocode}
-%    \begin{macrocode}
-    \@shortvrbinfo{Made }{#1}%
-    \add at special{#1}%
-%    \end{macrocode}
-% Then the character's current catcode is stored in \verb?\cc\?\meta{c}.
-%    \begin{macrocode}
-    \expandafter
-    \xdef\csname cc\string#1\endcsname{\the\catcode`#1}%
-%    \end{macrocode}
-% The character is spliced into the definition using the same trick as
-% used in \cs{verb} (for instance), having activated \verb?~? in a group.
-%    \begin{macrocode}
-    \begingroup
-      \catcode`\~\active  \lccode`\~`#1%
-      \lowercase{%
-%    \end{macrocode}
-% The character's old meaning is recorded in \verb?\ac\?\meta{c} prior to
-% assigning it a new one.
-%    \begin{macrocode}
-      \global\expandafter\let
-         \csname ac\string#1\endcsname~%
-      \gdef~{\verb~}}%
-    \endgroup
-%    \end{macrocode}
-% Finally the character is made active.
-%    \begin{macrocode}
-    \global\catcode`#1\active
-%    \end{macrocode}
-% If we suspect that \meta{c} is already a short reference, we tell
-% the user. Now he or she is responsible if anything goes wrong\,\dots
-%    \begin{macrocode}
-  \else
-%    \end{macrocode}
-%    \begin{macrocode}
-    \@shortvrbinfo\@empty{#1 already}%
-  \fi}
-%    \end{macrocode}
-% \end{macro}
-% \begin{macro}{\DeleteShortVerb}
-% Here's the means of undoing a \cs{MakeShortVerb}, for instance in a
-% region where you need to use the character outside a verbatim
-% environment.  It arranges for \cs{dospecials} and \cs{@sanitize} to be
-% altered appropriately, restores the saved catcode and, if necessary,
-% the character's meaning (as stored by 
-% \cs{MakeShortVerb}).  If the catcode wasn't stored in
-% \verb?\cc\?\meta{c} (by \cs{MakeShortVerb}) the command is silently
-% ignored. 
-%    \begin{macrocode}
-\def\DeleteShortVerb#1{%
-  \expandafter\ifx\csname cc\string#1\endcsname\relax
-  \else
-%    \end{macrocode}
-%    \begin{macrocode}
-    \@shortvrbinfo{Deleted }{#1 as}%
-    \rem at special{#1}%
-    \global\catcode`#1\csname cc\string#1\endcsname
-%    \end{macrocode}
-% We must not forget to reset \verb?\cc\?\meta{c}, otherwise the check in
-% \cs{MakeShortVerb} for a repeated definition will not work.
-%    \begin{macrocode}
-    \global \expandafter\let \csname cc\string#1\endcsname \relax
-    \ifnum\catcode`#1=\active
-      \begingroup
-        \catcode`\~\active   \lccode`\~`#1%
-        \lowercase{%
-          \global\expandafter\let\expandafter~%
-          \csname ac\string#1\endcsname}%
-      \endgroup \fi \fi}
-%    \end{macrocode}
-% \end{macro}
+% As of 2024 we load the package instead. This also gives us access to
+% the starred version of \verb!\MakeShortVerb!. For details see
+% \cite{SHORTVRB}.
 %
-%  \begin{macro}{\@shortvrbinfo}
-% Helper function for info messages.
+% It adds the following macros
+% \begin{verbatim}
+% \MakeShortVerb
+% \MakeShortVerb*
+% \DeleteShortVerb
+% \end{verbatim}
 %    \begin{macrocode}
-\def\@shortvrbinfo#1#2{%
-  \ClassInfo{memoir}{%
-     #1\expandafter\@gobble\string#2 a short reference
-                                          for \string\verb}}
+ % load shortvrb instead of embedding it
+\RequirePackage{shortvrb}
+
 %    \end{macrocode}
-%  \end{macro}
-%
-% \begin{macro}{\add at special}
-% This helper macro adds its argument to the
-% \cs{dospecials} macro which is conventionally used by verbatim macros
-% to alter the catcodes of the currently active characters.  We need
-% to add \verb?\do\?\meta{c} to the expansion of \cs{dospecials} after
-% removing the character if it was already there to avoid multiple
-% copies building up should \cs{MakeShortVerb} not be balanced by
-% \cs{DeleteShortVerb} (in case anything that uses \cs{dospecials} cares
-% about repetitions).
-%    \begin{macrocode}
-\def\add at special#1{%
-  \rem at special{#1}%
-  \expandafter\gdef\expandafter\dospecials\expandafter
-    {\dospecials \do #1}%
-%    \end{macrocode}
-% Similarly we have to add \verb?\@makeother\?\meta{c} to \cs{@sanitize}
-% (which is used in things like \cs{index} to re-catcode all special
-% characters except braces).
-%    \begin{macrocode}
-  \expandafter\gdef\expandafter\@sanitize\expandafter
-    {\@sanitize \@makeother #1}}
-%    \end{macrocode}
-% \end{macro}
-% \begin{macro}{\rem at special}
-% The inverse of cs{add at special} is slightly trickier.  \cs{do} is
-% re-defined to expand to nothing if its argument is the character of
-% interest, otherwise to expand simply to the argument.  We can then
-% re-define \cs{dospecials} to be the expansion of itself.  The space
-% after \verb?=`##1? prevents an expansion to \cs{relax}!
-%    \begin{macrocode}
-\def\rem at special#1{%
-  \def\do##1{%
-    \ifnum`#1=`##1 \else \noexpand\do\noexpand##1\fi}%
-  \xdef\dospecials{\dospecials}%
-%    \end{macrocode}
-% Fixing \cs{@sanitize} is the same except that we need to re-define
-% \cs{@makeother} which obviously needs to be done in a group. 
-%    \begin{macrocode}
-  \begingroup
-    \def\@makeother##1{%
-      \ifnum`#1=`##1 \else \noexpand\@makeother\noexpand##1\fi}%
-    \xdef\@sanitize{\@sanitize}%
-  \endgroup}
-%    \end{macrocode}
-% \end{macro}
-%
-% END OF MITTELBACH CODE AND COMMENTARY.
-%
+% 
+% ^^A % The following is the \Lpack{shortvrb} package code (from \texttt{doc.dtx}
+% ^^A % by Frank Mittelbach). It has been so useful to me that I wanted
+% ^^A % to include it in the class.
+% ^^A %
+% ^^A % CODE AND COMMENTARY IS BY FRANK MITTELBACH
+% ^^A  % start shortvrb code
+% ^^A %
+% ^^A % \begin{macro}{\MakeShortVerb}
+% ^^A %    \begin{macrocode}
+% ^^A \def\MakeShortVerb#1{%
+% ^^A   \expandafter\ifx\csname cc\string#1\endcsname\relax
+% ^^A %    \end{macrocode}
+% ^^A %    \begin{macrocode}
+% ^^A     \@shortvrbinfo{Made }{#1}%
+% ^^A     \add at special{#1}%
+% ^^A %    \end{macrocode}
+% ^^A % Then the character's current catcode is stored in \verb?\cc\?\meta{c}.
+% ^^A %    \begin{macrocode}
+% ^^A     \expandafter
+% ^^A     \xdef\csname cc\string#1\endcsname{\the\catcode`#1}%
+% ^^A %    \end{macrocode}
+% ^^A % The character is spliced into the definition using the same trick as
+% ^^A % used in \cs{verb} (for instance), having activated \verb?~? in a group.
+% ^^A %    \begin{macrocode}
+% ^^A     \begingroup
+% ^^A       \catcode`\~\active  \lccode`\~`#1%
+% ^^A       \lowercase{%
+% ^^A %    \end{macrocode}
+% ^^A % The character's old meaning is recorded in \verb?\ac\?\meta{c} prior to
+% ^^A % assigning it a new one.
+% ^^A %    \begin{macrocode}
+% ^^A       \global\expandafter\let
+% ^^A          \csname ac\string#1\endcsname~%
+% ^^A       \gdef~{\verb~}}%
+% ^^A     \endgroup
+% ^^A %    \end{macrocode}
+% ^^A % Finally the character is made active.
+% ^^A %    \begin{macrocode}
+% ^^A     \global\catcode`#1\active
+% ^^A %    \end{macrocode}
+% ^^A % If we suspect that \meta{c} is already a short reference, we tell
+% ^^A % the user. Now he or she is responsible if anything goes wrong\,\dots
+% ^^A %    \begin{macrocode}
+% ^^A   \else
+% ^^A %    \end{macrocode}
+% ^^A %    \begin{macrocode}
+% ^^A     \@shortvrbinfo\@empty{#1 already}%
+% ^^A   \fi}
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A % \begin{macro}{\DeleteShortVerb}
+% ^^A % Here's the means of undoing a \cs{MakeShortVerb}, for instance in a
+% ^^A % region where you need to use the character outside a verbatim
+% ^^A % environment.  It arranges for \cs{dospecials} and \cs{@sanitize} to be
+% ^^A % altered appropriately, restores the saved catcode and, if necessary,
+% ^^A % the character's meaning (as stored by 
+% ^^A % \cs{MakeShortVerb}).  If the catcode wasn't stored in
+% ^^A % \verb?\cc\?\meta{c} (by \cs{MakeShortVerb}) the command is silently
+% ^^A % ignored. 
+% ^^A %    \begin{macrocode}
+% ^^A \def\DeleteShortVerb#1{%
+% ^^A   \expandafter\ifx\csname cc\string#1\endcsname\relax
+% ^^A   \else
+% ^^A %    \end{macrocode}
+% ^^A %    \begin{macrocode}
+% ^^A     \@shortvrbinfo{Deleted }{#1 as}%
+% ^^A     \rem at special{#1}%
+% ^^A     \global\catcode`#1\csname cc\string#1\endcsname
+% ^^A %    \end{macrocode}
+% ^^A % We must not forget to reset \verb?\cc\?\meta{c}, otherwise the check in
+% ^^A % \cs{MakeShortVerb} for a repeated definition will not work.
+% ^^A %    \begin{macrocode}
+% ^^A     \global \expandafter\let \csname cc\string#1\endcsname \relax
+% ^^A     \ifnum\catcode`#1=\active
+% ^^A       \begingroup
+% ^^A         \catcode`\~\active   \lccode`\~`#1%
+% ^^A         \lowercase{%
+% ^^A           \global\expandafter\let\expandafter~%
+% ^^A           \csname ac\string#1\endcsname}%
+% ^^A       \endgroup \fi \fi}
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A %  \begin{macro}{\@shortvrbinfo}
+% ^^A % Helper function for info messages.
+% ^^A %    \begin{macrocode}
+% ^^A \def\@shortvrbinfo#1#2{%
+% ^^A   \ClassInfo{memoir}{%
+% ^^A      #1\expandafter\@gobble\string#2 a short reference
+% ^^A                                           for \string\verb}}
+% ^^A %    \end{macrocode}
+% ^^A %  \end{macro}
+% ^^A %
+% ^^A % \begin{macro}{\add at special}
+% ^^A % This helper macro adds its argument to the
+% ^^A % \cs{dospecials} macro which is conventionally used by verbatim macros
+% ^^A % to alter the catcodes of the currently active characters.  We need
+% ^^A % to add \verb?\do\?\meta{c} to the expansion of \cs{dospecials} after
+% ^^A % removing the character if it was already there to avoid multiple
+% ^^A % copies building up should \cs{MakeShortVerb} not be balanced by
+% ^^A % \cs{DeleteShortVerb} (in case anything that uses \cs{dospecials} cares
+% ^^A % about repetitions).
+% ^^A %    \begin{macrocode}
+% ^^A \def\add at special#1{%
+% ^^A   \rem at special{#1}%
+% ^^A   \expandafter\gdef\expandafter\dospecials\expandafter
+% ^^A     {\dospecials \do #1}%
+% ^^A %    \end{macrocode}
+% ^^A % Similarly we have to add \verb?\@makeother\?\meta{c} to \cs{@sanitize}
+% ^^A % (which is used in things like \cs{index} to re-catcode all special
+% ^^A % characters except braces).
+% ^^A %    \begin{macrocode}
+% ^^A   \expandafter\gdef\expandafter\@sanitize\expandafter
+% ^^A     {\@sanitize \@makeother #1}}
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A % \begin{macro}{\rem at special}
+% ^^A % The inverse of cs{add at special} is slightly trickier.  \cs{do} is
+% ^^A % re-defined to expand to nothing if its argument is the character of
+% ^^A % interest, otherwise to expand simply to the argument.  We can then
+% ^^A % re-define \cs{dospecials} to be the expansion of itself.  The space
+% ^^A % after \verb?=`##1? prevents an expansion to \cs{relax}!
+% ^^A %    \begin{macrocode}
+% ^^A \def\rem at special#1{%
+% ^^A   \def\do##1{%
+% ^^A     \ifnum`#1=`##1 \else \noexpand\do\noexpand##1\fi}%
+% ^^A   \xdef\dospecials{\dospecials}%
+% ^^A %    \end{macrocode}
+% ^^A % Fixing \cs{@sanitize} is the same except that we need to re-define
+% ^^A % \cs{@makeother} which obviously needs to be done in a group. 
+% ^^A %    \begin{macrocode}
+% ^^A   \begingroup
+% ^^A     \def\@makeother##1{%
+% ^^A       \ifnum`#1=`##1 \else \noexpand\@makeother\noexpand##1\fi}%
+% ^^A     \xdef\@sanitize{\@sanitize}%
+% ^^A   \endgroup}
+% ^^A %    \end{macrocode}
+% ^^A % \end{macro}
+% ^^A %
+% ^^A  % end shortvrb code
+% ^^A % END OF MITTELBACH CODE AND COMMENTARY.
+% 
 % \subsection{General verbatim boxing and line numbering}
 %
 %    A while ago I wrote a package that I never released. Here it is
@@ -29284,6 +29740,7 @@
   \fi
 %    \end{macrocode}
 % \begin{macro}{\verbatim at processline}
+% \changes{v3.8.2}{2024/01/25}{Removed tab support}
 %    \begin{macrocode}
   \def\verbatim at processline{\leavevmode
     \b at vdocount%
@@ -29291,11 +29748,11 @@
                                  \linewidth-.8\p@ \@@line
       {\b at vdooutside\strut\kern\bvboxsep%
        \b at vdoinside%
-       \ift at bs
-         \tabverbatim at processline
-       \else
+       %\ift at bs
+       %  \tabverbatim at processline
+       %\else
          \the\verbatim at line
-       \fi
+       %\fi
        \hss}%
      \kern\bvboxsep}\bvrightsidehook\par}}
 
@@ -29306,7 +29763,9 @@
 %
 % \begin{macro}{\setupbox at verb}
 % Use a macro for the second main part of DA's code, and integrate it
-% with the other verbatim codes (e.g., include \cs{@maybeobeytags}).
+% with the other verbatim codes.
+% 
+% \changes{v3.8.2}{2024/01/25}{Removed \cs{@maybeobeytags}}
 %    \begin{macrocode}
 \newcommand{\setupbox at verb}{%
   \leftskip\z at skip \rightskip\z at skip
@@ -29313,7 +29772,7 @@
   \interlinepenalty\boxverbflag
   \parfillskip\z@ plus\p@ minus\p@
   \lineskip-\bvboxsep \baselineskip\z at skip
-  \frenchspacing\@vobeyspaces\@maybeobeytabs
+  \frenchspacing\@vobeyspaces%\@maybeobeytabs
   \boxverb at toprule}
 
 %    \end{macrocode}
@@ -30384,13 +30843,15 @@
 % \cs{stre at mverb@input}\marg{setup}\marg{stream} and
 % \cs{verbatim at readstre@m}\marg{stream}. Finally, \cs{verbatim at read@file}
 % is a \Lpack{verbatim} package macro.
+% \changes{v3.8.2}{2024/01/26}{Removed tabs support and added the tab
+% marking support to the starred version like we did for \cs{verbatiminput}}
 %    \begin{macrocode}
 \def\readverbatim{\begingroup
-  \ift at bs
-    \def\verbatim at processline{\tabverbatim at processline}%
-  \fi
-  \@ifstar{\stre at mverb@input{\@maybeobeytabs}}%
-     {\stre at mverb@input{\frenchspacing\@vobeyspaces\@maybeobeytabs}}}
+  %\ift at bs
+  %  \def\verbatim at processline{\tabverbatim at processline}%
+  %\fi
+  \@ifstar{\stre at mverb@input{\@setupverbvisiblespace\@vobeyspaces}}%{\@maybeobeytabs}}%
+     {\stre at mverb@input{\frenchspacing\@vobeyspaces}}}%\@maybeobeytabs}}}
 
 %    \end{macrocode}
 % \end{macro}
@@ -33559,7 +34020,7 @@
 %   \newblock \emph{The ltfilehook package}
 %    \newblock July 2020. 
 %
-%  \bibitem[Mit2023]{LTHOOKS}
+%  \bibitem[Mit2023a]{LTHOOKS}
 %   Frank Mittelbach
 %   \newblock \emph{\LaTeX's hook management}
 %    \newblock June 2023. 
@@ -33568,7 +34029,12 @@
 %   Frank Mittelbach
 %   \newblock \emph{The ltshipout package}
 %    \newblock July 2020. 
-% 
+%
+%  \bibitem[Mit2023b]{SHORTVRB}
+%    Frank Mittelbach
+%    \newblock \emph{The doc and shortvrb Packages}
+%   \newblock November 2023.
+%
 % \bibitem[Oos96]{FANCYHDR}
 % Piet van Oostrum.
 % \newblock \emph{Page layout in LaTeX}.

Modified: trunk/Master/texmf-dist/source/latex/memoir/mempatch.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/memoir/mempatch.dtx	2024-01-26 22:00:36 UTC (rev 69599)
+++ trunk/Master/texmf-dist/source/latex/memoir/mempatch.dtx	2024-01-26 22:00:47 UTC (rev 69600)
@@ -20,7 +20,7 @@
 %
 % 
 % \fi
-% \CheckSum{562}
+% \CheckSum{549}
 %
 % \def\dtxfile{\texttt{mempatch.dtx}}
 % \def\fileversion{v1.0} \def\filedate{2003/10/04}
@@ -312,7 +312,9 @@
 %% With the new hooking system from 2020+ memhfixc is automatically
 %% added after loading hyperref with the memoir class
 %%
+%% Version 1.22  2023/09/10
 %% Version 1.21  2023/07/28
+%% Version 1.21  2023/07/28
 %% Version 1.20  2022/11/17
 %% Version 1.19  2021/06/16
 %% Version 1.18  2019/10/24
@@ -339,7 +341,7 @@
 % 
 %
 %    \begin{macrocode}
-\ProvidesPackage{memhfixc}[2023/07/28 v1.21 hyperref package fixes for memoir class]
+\ProvidesPackage{memhfixc}[2023/09/10 v1.22 hyperref package fixes for memoir class]
 %    \end{macrocode}
 %
 % \begin{macro}{\M at hfixcfinish}
@@ -647,56 +649,75 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{macro}{\endsidecaption}
-% Tweak the \texttt{sidecaption} environment. I don't know why it 
-% works but it took a lot of time trying all sorts of combinations
-% of commands to get it to do so (if it really does).
+% \begin{macro}{\sidecaption at refstepcounter}
+%   Under \Lpack{hyperref} we redefine what
+%   \cs{sidecaption at refstepcounter} does. Here we use that it is
+%   called with two args.
+% \changes{v1.22}{2023/09/10}{Redef of new macro from memoir 3.8.2,
+% that makes sidecaption handling easier.}
 %    \begin{macrocode}
-\def\endsidecaption{%
-  \m at mscapend@fbox
-  \H at refstepcounter{\@captype}%
-  \hyper at makecurrent{\@captype}%
-  \m at mscaplabel
-%    \end{macrocode}
-% \changes{v1.17}{2013/05/30}{Forgot to add \cs{m at mscapcheckside}}
-%    \begin{macrocode}
-  \m at mscapcheckside %<--- added 2013/05/30
-  \begin{lrbox}{\m at mscap@capbox}%
-    \begin{minipage}[c]{\sidecapwidth}%
-      \sidecapstyle
-      \@caption\@captype[\m at mscap@fortoc]{\m at mscap@forcap}%
-    \end{minipage}%
-  \end{lrbox}%
-  \m at mscapopboxes}
+\renewcommand*\sidecaption at refstepcounter[2]{%
+  \H at refstepcounter{#1}%
+  \hyper at makecurrent{#2}%
+}
 
 %    \end{macrocode}
 % \end{macro}
 %
+% \changes{v1.22}{2023/09/10}{Because of the redef in memoir 3.8.2 we
+% no longer need this}
+% ^^A \begin{macro}{\endsidecaption}
+% ^^A % Tweak the \texttt{sidecaption} environment. I don't know why it 
+% ^^A works but it took a lot of time trying all sorts of combinations
+% ^^A of commands to get it to do so (if it really does).
+% ^^A    \begin{macrocode}
+ % \def\endsidecaption{%
+ % \m at mscapend@fbox
+ % \H at refstepcounter{\@captype}%
+ % \hyper at makecurrent{\@captype}%
+ % \m at mscaplabel
+% ^^A    \end{macrocode}
+% ^^A\changes{v1.17}{2013/05/30}{Forgot to add \cs{m at mscapcheckside}}
+% ^^A    \begin{macrocode}
+ % \m at mscapcheckside %<--- added 2013/05/30
+ % \begin{lrbox}{\m at mscap@capbox}%
+ %   \begin{minipage}[c]{\sidecapwidth}%
+ %     \sidecapstyle
+ %     \@caption\@captype[\m at mscap@fortoc]{\m at mscap@forcap}%
+ %   \end{minipage}%
+ % \end{lrbox}%
+ % \m at mscapopboxes}
+
+%  ^^A   \end{macrocode}
+% ^^A \end{macro}
+%
 % \begin{macro}{\sidecontcaption}
 % \begin{macro}{\endsidecontcaption}
 % Tweaks for the \texttt{sidecontcaption} environment. Again it was 
 % a miss, miss, \ldots hit method to get something that appears 
 % to work.
+% \changes{v1.22}{2023/09/10}{Because of the redef in memoir 3.8.2 we
+% no longer need the redef of \cs{endsidecontcaption}}
 %    \begin{macrocode}
 \renewcommand*{\sidecontcaption}{%
   \refstepcounter{memhycontfloat}%
   \@sidecontcaption}
-\def\endsidecontcaption{%
-  \m at mscapend@fbox
-  \addtocounter{\@captype}{\m at ne}\H at refstepcounter{\@captype}%
-  \hyper at makecurrent{memhycontfloat}%
-  \m at mscaplabel
-%    \end{macrocode}
-% \changes{v1.17}{2013/05/30}{Forgot to add \cs{m at mscapcheckside}}
-%    \begin{macrocode}
-  \m at mscapcheckside %<--- added 2013/05/30
-  \begin{lrbox}{\m at mscap@capbox}%
-    \begin{minipage}[c]{\sidecapwidth}%
-      \sidecapstyle
-      \@contcaption\@captype{\m at mscap@forcap}%
-    \end{minipage}%
-  \end{lrbox}%
-  \m at mscapopboxes}
+ % \def\endsidecontcaption{%
+ % \m at mscapend@fbox
+ % \addtocounter{\@captype}{\m at ne}\H at refstepcounter{\@captype}%
+ % \hyper at makecurrent{memhycontfloat}%
+ % \m at mscaplabel
+% ^^A    \end{macrocode}
+% ^^A \changes{v1.17}{2013/05/30}{Forgot to add \cs{m at mscapcheckside}}
+% ^^A    \begin{macrocode}
+ % \m at mscapcheckside %<--- added 2013/05/30
+ % \begin{lrbox}{\m at mscap@capbox}%
+ %   \begin{minipage}[c]{\sidecapwidth}%
+ %     \sidecapstyle
+ %     \@contcaption\@captype{\m at mscap@forcap}%
+ %   \end{minipage}%
+ % \end{lrbox}%
+ % \m at mscapopboxes}
 
 %    \end{macrocode}
 % \end{macro}

Modified: trunk/Master/texmf-dist/tex/latex/memoir/memhfixc.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/memoir/memhfixc.sty	2024-01-26 22:00:36 UTC (rev 69599)
+++ trunk/Master/texmf-dist/tex/latex/memoir/memhfixc.sty	2024-01-26 22:00:47 UTC (rev 69600)
@@ -44,7 +44,9 @@
 %% With the new hooking system from 2020+ memhfixc is automatically
 %% added after loading hyperref with the memoir class
 %%
+%% Version 1.22  2023/09/10
 %% Version 1.21  2023/07/28
+%% Version 1.21  2023/07/28
 %% Version 1.20  2022/11/17
 %% Version 1.19  2021/06/16
 %% Version 1.18  2019/10/24
@@ -67,7 +69,7 @@
 %% Version 1.1  2003/01/22
 %% Version 1.0  2002/10/22
 %%
-\ProvidesPackage{memhfixc}[2023/07/28 v1.21 hyperref package fixes for memoir class]
+\ProvidesPackage{memhfixc}[2023/09/10 v1.22 hyperref package fixes for memoir class]
 \let\M at hfixcfinish\relax
 \@ifclassloaded{memoir}{}%
                        {\let\M at hfixcfinish\endinput
@@ -220,36 +222,41 @@
   \addtocounter{\@captype}{\m at ne}\H at refstepcounter{\@captype}%
   \@contcaption\@captype}
 
-\def\endsidecaption{%
-  \m at mscapend@fbox
-  \H at refstepcounter{\@captype}%
-  \hyper at makecurrent{\@captype}%
-  \m at mscaplabel
-  \m at mscapcheckside %<--- added 2013/05/30
-  \begin{lrbox}{\m at mscap@capbox}%
-    \begin{minipage}[c]{\sidecapwidth}%
-      \sidecapstyle
-      \@caption\@captype[\m at mscap@fortoc]{\m at mscap@forcap}%
-    \end{minipage}%
-  \end{lrbox}%
-  \m at mscapopboxes}
+\renewcommand*\sidecaption at refstepcounter[2]{%
+  \H at refstepcounter{#1}%
+  \hyper at makecurrent{#2}%
+}
 
+ % \def\endsidecaption{%
+ % \m at mscapend@fbox
+ % \H at refstepcounter{\@captype}%
+ % \hyper at makecurrent{\@captype}%
+ % \m at mscaplabel
+ % \m at mscapcheckside %<--- added 2013/05/30
+ % \begin{lrbox}{\m at mscap@capbox}%
+ %   \begin{minipage}[c]{\sidecapwidth}%
+ %     \sidecapstyle
+ %     \@caption\@captype[\m at mscap@fortoc]{\m at mscap@forcap}%
+ %   \end{minipage}%
+ % \end{lrbox}%
+ % \m at mscapopboxes}
+
 \renewcommand*{\sidecontcaption}{%
   \refstepcounter{memhycontfloat}%
   \@sidecontcaption}
-\def\endsidecontcaption{%
-  \m at mscapend@fbox
-  \addtocounter{\@captype}{\m at ne}\H at refstepcounter{\@captype}%
-  \hyper at makecurrent{memhycontfloat}%
-  \m at mscaplabel
-  \m at mscapcheckside %<--- added 2013/05/30
-  \begin{lrbox}{\m at mscap@capbox}%
-    \begin{minipage}[c]{\sidecapwidth}%
-      \sidecapstyle
-      \@contcaption\@captype{\m at mscap@forcap}%
-    \end{minipage}%
-  \end{lrbox}%
-  \m at mscapopboxes}
+ % \def\endsidecontcaption{%
+ % \m at mscapend@fbox
+ % \addtocounter{\@captype}{\m at ne}\H at refstepcounter{\@captype}%
+ % \hyper at makecurrent{memhycontfloat}%
+ % \m at mscaplabel
+ % \m at mscapcheckside %<--- added 2013/05/30
+ % \begin{lrbox}{\m at mscap@capbox}%
+ %   \begin{minipage}[c]{\sidecapwidth}%
+ %     \sidecapstyle
+ %     \@contcaption\@captype{\m at mscap@forcap}%
+ %   \end{minipage}%
+ % \end{lrbox}%
+ % \m at mscapopboxes}
 
  %\def\@mem at titlerefnolink#1{\begingroup \let\numberline\@gobble
  % \let\M at TitleReference\@mem at theTR % interrupt recursion of \ref

Modified: trunk/Master/texmf-dist/tex/latex/memoir/memoir.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/memoir/memoir.cls	2024-01-26 22:00:36 UTC (rev 69599)
+++ trunk/Master/texmf-dist/tex/latex/memoir/memoir.cls	2024-01-26 22:00:47 UTC (rev 69600)
@@ -29,8 +29,8 @@
 \def\mem at atleast@kernel{2021/06/01}
 \NeedsTeXFormat{LaTeX2e}[\mem at atleast@kernel]
 \ProvidesClass{memoir}%
-  [2023/08/21 v3.8.1 configurable book, report, article document class]
-\newcommand\memversion{v3.8.1, 2023/08/21}
+  [2024/01/26 v3.8.2 configurable book, report, article document class]
+\newcommand\memversion{v3.8.2, 2024/01/26}
 \providecommand\IfFormatAtLeastTF{\@ifl at t@r\fmtversion}
 \IfFormatAtLeastTF{\mem at atleast@kernel}{}{
   \ClassError{memoir}{%
@@ -3646,31 +3646,73 @@
 \newcommand{\memsecinfo}[5]{}
 \newcommand{\memsecstarinfo}[2]{}
 
-\renewcommand{\@startsection}[6]{%
-  \@nameuse{#1block}%
-  \ifraggedbottomsection\if at nobreak\else
-    \vskip\z@\@plus\bottomsectionskip
-    \penalty\bottomsectionpenalty
-    \vskip\z@\@plus -\bottomsectionskip
-  \fi\fi
-  \def\m at msecn@me{#1}%
-  \if at noskipsec \leavevmode \fi
-  \par
-  \@tempskipa #4\relax
-  \@afterindenttrue
-  \ifdim \@tempskipa <\z@
-    \@tempskipa -\@tempskipa \@afterindentfalse
-  \fi
-  \if at nobreak
-    \everypar{}%
-  \else
+\ifmem at devmode
+
+  \patchcmd\@startsection{%
+    \if at noskipsec \leavevmode \fi%
+  }{%
+    \@nameuse{#1block}%
+    \ifraggedbottomsection\if at nobreak\else
+        \vskip\z@\@plus\bottomsectionskip
+        \penalty\bottomsectionpenalty
+        \vskip\z@\@plus -\bottomsectionskip
+      \fi\fi
+    \def\m at msecn@me{#1}%
+    \if at noskipsec \leavevmode \fi%
+  }%
+  {\typeout{\string\@startsection\space patch 1 success}}
+  {\typeout{\string\@startsection\space patch 1 failed}}
+
+  \patchcmd\@startsection{%
+    \addpenalty\@secpenalty\addvspace\@tempskipa%
+  }{%
     \addpenalty\@secpenalty\addvspace\@tempskipa
     \addvspace{-\parskip}% <--- added 2011/03/02
-  \fi
-  \@ifstar
+  }%
+  {\typeout{\string\@startsection\space patch 2 success}}
+  {\typeout{\string\@startsection\space patch 2 failed}}
+
+  \patchcmd\@startsection{%
+     \@ifstar%
+     {\@ssect{#3}{#4}{#5}{#6}}%
+     {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}%
+   }{%
+     \@ifstar%
     {\@ssect{#3}{#4}{#5}{#6}}%
-    {\@trplargoom{\M at sect{#1}{#2}{#3}{#4}{#5}{#6}}}}
+    {\@trplargoom{\M at sect{#1}{#2}{#3}{#4}{#5}{#6}}}%
+  }%
+  {\typeout{\string\@startsection\space patch 3 success}}
+  {\typeout{\string\@startsection\space patch 3 failed}}
 
+\else % standard branch for dev-mode false
+  \renewcommand{\@startsection}[6]{%
+    \@nameuse{#1block}%
+    \ifraggedbottomsection\if at nobreak\else
+      \vskip\z@\@plus\bottomsectionskip
+      \penalty\bottomsectionpenalty
+      \vskip\z@\@plus -\bottomsectionskip
+    \fi\fi
+    \def\m at msecn@me{#1}%
+    \if at noskipsec \leavevmode \fi
+    \par
+    \@tempskipa #4\relax
+    \@afterindenttrue
+    \ifdim \@tempskipa <\z@
+      \@tempskipa -\@tempskipa \@afterindentfalse
+    \fi
+    \if at nobreak
+      \everypar{}%
+    \else
+      \addpenalty\@secpenalty\addvspace\@tempskipa
+      \addvspace{-\parskip}% <--- added 2011/03/02
+    \fi
+    \@ifstar
+      {\@ssect{#3}{#4}{#5}{#6}}%
+      {\@trplargoom{\M at sect{#1}{#2}{#3}{#4}{#5}{#6}}}}
+
+
+\fi % en dev-mode else branch
+
 \def\@xsect#1{%
   \@tempskipa #1\relax
   \ifdim \@tempskipa>\z@
@@ -4464,6 +4506,14 @@
   \parfillskip \z@
   \everypar{\hskip \z@ \@plus -1fill}}
 
+\newcommand*{\raggedwrap}{%
+  \@rightskip\@flushglue
+%%%  \rightskip\@rightskip
+  \memRTLrightskip\@rightskip
+%%%  \leftskip\@totalleftmargin
+  \memRTLleftskip\@totalleftmargin
+  \parindent\ragrparindent}
+
 \newcommand{\hangfrom}[1]{%
   \setbox\@tempboxa\hbox{{#1}}%
   \hangindent \wd\@tempboxa\noindent\box\@tempboxa}
@@ -6472,11 +6522,13 @@
     \end{minipage}%
   \end{lrbox}}
 
+
+\newcommand*\sidecaption at refstepcounter[2]{\refstepcounter{#1}}
 \def\endsidecaption{%
   \m at mscapend@fbox
-  \refstepcounter\@captype
+  \sidecaption at refstepcounter\@captype\@captype
   \m at mscaplabel
-  \m at mscapcheckside %<--- added 2012/08/19
+  \m at mscapcheckside%
   \begin{lrbox}{\m at mscap@capbox}%
     \begin{minipage}[c]{\sidecapwidth}%
       \sidecapstyle
@@ -6604,7 +6656,9 @@
 
 \def\endsidecontcaption{%
   \m at mscapend@fbox
-  \addtocounter{\@captype}{\m at ne}\refstepcounter\@captype
+  \addtocounter{\@captype}{\m at ne}
+  \sidecaption at refstepcounter\@captype{memhycontfloat}
+  %\refstepcounter\@captype
   \m at mscaplabel
   \m at mscapcheckside %<--- added 2013/05/30
   \begin{lrbox}{\m at mscap@capbox}%
@@ -8683,20 +8737,21 @@
 
 \newcommand{\m at make@footnotetext}[1]{%
   \@namelongdef{@footnotetext#1}##1{%
-  \insert\@nameuse{footins#1}{%
-  \def\baselinestretch{\m at m@footnote at spacing}%
-  \reset at font\@nameuse{foottextfont#1}%
-  \@preamfntext
-  \hsize\columnwidth
-  \def\@currentcounter{footnote}%
-  \protected at edef\@currentlabel{%
-    \csname p at footnote#1\endcsname\@nameuse{@thefnmark#1}}%
-  \color at begingroup
-    \@nameuse{@makefntext#1}{%
-      \rule\z@\footnotesep\ignorespaces\@nameuse{foottextfont#1 ##1}%
-      \@finalstrut\strutbox}%
+    \insert\@nameuse{footins#1}{%
+      \def\baselinestretch{\m at m@footnote at spacing}%
+      \reset at font\@nameuse{foottextfont#1}%
+      \@preamfntext
+      \hsize\columnwidth
+      \def\@currentcounter{footnote}%
+      \protected at edef\@currentlabel{%
+        \csname p at footnote#1\endcsname\@nameuse{@thefnmark#1}}%
+      \color at begingroup
+      \@nameuse{@makefntext#1}{%
+        \rule\z@\footnotesep\ignorespaces\@nameuse{foottextfont#1}##1%
+        \@finalstrut\strutbox}%
   \color at endgroup}%
-  \m at mmf@prepare}}
+  \m at mmf@prepare}%
+}
 
 \newcommand{\m at make@mpfootnotetext}[1]{%
   \@namelongdef{@mpfootnotetext#1}##1{%
@@ -10253,114 +10308,20 @@
   \fi
 } % end format check, else part
 
-\newtoks\every at verbatim
-  \every at verbatim={}
-\newtoks\afterevery at verbatim
-  \afterevery at verbatim={}
-
-\def\@makeother#1{\catcode`#112\relax}
-\begingroup
- \catcode`\ =\active%
- \def\x{\def\@vobeyspaces{\catcode`\ \active\let \@xobeysp}}
- \expandafter\endgroup\x
-\def\@xobeysp{\leavevmode\penalty\@M\ }
-\newtoks\verbatim at line
-\newcount\tab at position
-\def\@xobeytab{%
-  \loop
-    \toks@\expandafter{\the\toks@\@xobeysp}%
-    \advance\tab at position-1
-  \ifnum\tab at position>0 \repeat
+\RequirePackage{verbatim}
+\@ifpackagelater{verbatim}{2024/01/21}{}{
+  \def\verbatiminput{\begingroup
+    \@ifstar{\verbatim at input{\@setupverbvisiblespace\@vobeyspaces}}%
+            {\verbatim at input{\frenchspacing\@vobeyspaces}}}
 }
-\begingroup
-  \catcode`\^^I=\active
-  \gdef\@vobeytabs{\catcode`\^^I\active\let^^I\@xobeytab}%
-\endgroup
-\def\verbatim at tabexpand#1{%
-  \ifx#1\@nil
-    \the\toks@
-    \expandafter\par
-  \else
-    \ifx#1\@xobeytab
-      \@xobeytab
-    \else
-      \toks@\expandafter{\the\toks@#1}%
-      \advance\tab at position\m at ne
-    \fi
-    \ifnum\tab at position=0 \tab at position\tab at size \fi
-    \expandafter\verbatim at tabexpand
-  \fi
-}
 
-\newif\ift at bs
-\newcommand{\tabson}[1][4]{%
-  \ifnum\@ne > #1\relax
-    \tabsoff
-  \else
-    \t at bstrue
-    \def\tab at size{#1\relax}%
-    \def\@maybeobeytabs{\@vobeytabs}%
-  \fi
-}
-\newcommand{\tabsoff}{%
-  \t at bsfalse
-  \def\tab at size{\z@}%
-  \def\@maybeobeytabs{}%
-}
-\tabsoff
-
-\def\tabverbatim at processline{\tab at position\tab at size
-  \toks@{}%
-  \expandafter\verbatim at tabexpand\the\verbatim at line\@nil}
-\def\notabverbatim at processline{\the\verbatim at line\par}
-
-\def\verbatim at startline{\verbatim at line{}}
-\def\verbatim at addtoline#1{%
-  \verbatim at line\expandafter{\the\verbatim at line#1}}
-\def\verbatim at processline{\notabverbatim at processline}
-\def\verbatim at finish{\ifcat$\the\verbatim at line$\else
-  \verbatim at processline\fi}
 \newcommand{\setverbatimfont}[1]{\def\m at mverbfont{#1}}
 \setverbatimfont{\normalfont\ttfamily}
+\patchcmd\verbatim at font{\normalfont\ttfamily}%
+  {\m at mverbfont}%
+  {}%
+  {\typeout{Paching \string\verbatim at font\space failed}}
 
-\def\verbatim at font{\m at mverbfont
-                   \hyphenchar\font\m at ne
-                   \@noligs}
-
-\def\@verbatim{\the\every at verbatim
-  \trivlist \item \relax
-  \if at minipage\else\vskip\parskip\fi
-  \@beginparpenalty \predisplaypenalty
-%%%  \leftskip\@totalleftmargin\rightskip\z@
-  \memRTLleftskip\@totalleftmargin\memRTLrightskip\z@
-  \parindent\z@\parfillskip\@flushglue\parskip\z@
-  \@@par
-  \def\par{%
-    \if at tempswa
-      \leavevmode\null\@@par\penalty\interlinepenalty
-    \else
-      \@tempswatrue
-      \ifhmode\@@par\penalty\interlinepenalty\fi
-    \fi}%
-  \def\@noitemerr{\@warning{No verbatim text}}%
-  \obeylines
-  \let\do\@makeother \dospecials
-  \verbatim at font
-  \everypar \expandafter{\the\everypar \unpenalty}%
-  \wrapright\the\afterevery at verbatim}
-\def\verbatim{\begingroup
-  \ift at bs
-    \def\verbatim at processline{\tabverbatim at processline}%
-  \fi
-  \@verbatim \frenchspacing\@vobeyspaces\@maybeobeytabs\verbatim at start}
-\@namedef{verbatim*}{\begingroup
-  \ift at bs
-    \def\verbatim at processline{\tabverbatim at processline}%
-  \fi
-  \@verbatim\@maybeobeytabs\verbatim at start}
-\def\endverbatim{\endtrivlist\endgroup\@doendpe}
-\@namelet{endverbatim*}\endverbatim
-
 \newcommand{\setupcomment}{%
   \let\do\@makeother\dospecials\catcode`\^^M\active
   \let\verbatim at startline\relax
@@ -10375,152 +10336,20 @@
   \expandafter\def\csname end#1\endcsname{}}
 \newcommand{\commentson}[1]{\newcomment{#1}}
 
-\newcomment{comment}
+\newcommand*\tabsoff{} % defined to do nothing
+\newcommand*\tabson{
+  \@memwarn{As of January 2024, \string\tabson\space has been discontinued.}
+}
 
-\@ifundefined{vrb at catcodes}%
-  {\def\vrb at catcodes{%
-     \catcode`\!12\catcode`\[12\catcode`\]12}}{}
-\begingroup
- \vrb at catcodes
- \lccode`\!=`\\ \lccode`\[=`\{ \lccode`\]=`\}
- \catcode`\~=\active \lccode`\~=`\^^M
- \lccode`\C=`\C
- \lowercase{\endgroup
-    \def\verbatim at start#1{%
-      \verbatim at startline
-      \if\noexpand#1\noexpand~%
-        \let\next\verbatim@
-      \else \def\next{\verbatim@#1}\fi
-      \next}%
-    \def\verbatim@#1~{\verbatim@@#1!end\@nil}%
-    \def\verbatim@@#1!end{%
-       \verbatim at addtoline{#1}%
-       \futurelet\next\verbatim@@@}%
-    \def\verbatim@@@#1\@nil{%
-       \ifx\next\@nil
-         \verbatim at processline
-         \verbatim at startline
-         \let\next\verbatim@
-       \else
-         \def\@tempa##1!end\@nil{##1}%
-         \@temptokena{!end}%
-         \def\next{\expandafter\verbatim at test\@tempa#1\@nil~}%
-       \fi \next}%
-    \def\verbatim at test#1{%
-           \let\next\verbatim at test
-           \if\noexpand#1\noexpand~%
-             \expandafter\verbatim at addtoline
-               \expandafter{\the\@temptokena}%
-             \verbatim at processline
-             \verbatim at startline
-             \let\next\verbatim@
-           \else \if\noexpand#1
-             \@temptokena\expandafter{\the\@temptokena#1}%
-           \else \if\noexpand#1\noexpand[%
-             \let\@tempc\@empty
-             \let\next\verbatim at testend
-           \else
-             \expandafter\verbatim at addtoline
-               \expandafter{\the\@temptokena}%
-             \def\next{\verbatim@#1}%
-           \fi\fi\fi
-           \next}%
-    \def\verbatim at testend#1{%
-         \if\noexpand#1\noexpand~%
-           \expandafter\verbatim at addtoline
-             \expandafter{\the\@temptokena[}%
-           \expandafter\verbatim at addtoline
-             \expandafter{\@tempc}%
-           \verbatim at processline
-           \verbatim at startline
-           \let\next\verbatim@
-         \else\if\noexpand#1\noexpand]%
-           \let\next\verbatim@@testend
-         \else\if\noexpand#1\noexpand!%
-           \expandafter\verbatim at addtoline
-             \expandafter{\the\@temptokena[}%
-           \expandafter\verbatim at addtoline
-             \expandafter{\@tempc}%
-           \def\next{\verbatim@!}%
-         \else \expandafter\def\expandafter\@tempc\expandafter
-           {\@tempc#1}\fi\fi\fi
-         \next}%
-    \def\verbatim@@testend{%
-       \ifx\@tempc\@currenvir
-         \verbatim at finish
-         \edef\next{\noexpand\end{\@currenvir}%
-                    \noexpand\verbatim at rescan{\@currenvir}}%
-       \else
-         \expandafter\verbatim at addtoline
-           \expandafter{\the\@temptokena[}%
-           \expandafter\verbatim at addtoline
-             \expandafter{\@tempc]}%
-         \let\next\verbatim@
-       \fi
-       \next}%
-    \def\verbatim at rescan#1#2~{\if\noexpand~\noexpand#2~\else
-        \@warning{Characters dropped after `\string\end{#1}'}\fi}}
-\newread\verbatim at in@stream
-\def\verbatim at readfile#1{%
-  \verbatim at startline
-  \openin\verbatim at in@stream #1\relax
-  \ifeof\verbatim at in@stream
-    \typeout{No file #1.}%
-  \else
-    \@addtofilelist{#1}%
-    \ProvidesFile{#1}[(verbatim)]%
-    \expandafter\endlinechar\expandafter\m at ne
-    \expandafter\verbatim at read@file
-    \expandafter\endlinechar\the\endlinechar\relax
-    \closein\verbatim at in@stream
-  \fi
-  \verbatim at finish
+\newlength\verbatimindent
+\newcommand*\verbatimbreakchar{} % silently does nothing as it
+                                 % needs \wrappingon to be enabled
+\newcommand*\setverbatimbreak{} % never used
+\newcommand*\wrappingon{
+  \@memwarn{As of January 2024, \string\wrappingon\space has been discontinued.}
 }
-\def\verbatim at read@file{%
-  \read\verbatim at in@stream to\next
-  \ifeof\verbatim at in@stream
-  \else
-    \expandafter\verbatim at addtoline\expandafter{\next}%
-    \verbatim at processline
-    \verbatim at startline
-    \expandafter\verbatim at read@file
-  \fi
-}
-\def\verbatiminput{\begingroup
-  \ift at bs
-    \def\verbatim at processline{\tabverbatim at processline}%
-  \fi
-  \@ifstar{\verbatim at input{\@maybeobeytabs}}%
-          {\verbatim at input{\frenchspacing\@vobeyspaces\@maybeobeytabs}}}
-\def\verbatim at input#1#2{%
-   \IfFileExists {#2}{\@verbatim #1\relax
-    \verbatim at readfile{\@filef at und}\endtrivlist\endgroup\@doendpe}%
-   {\typeout {No file #2.}\endgroup}}
-\newlength{\verbatimindent}
-  \setlength{\verbatimindent}{3em}
-\newcommand*{\verbatimbreakchar}{\char`\%}
-\newcommand*{\setverbatimbreak}{%
-  \vspace*{-\baselineskip}%
-  \def\@xobeysp{~\discretionary{\verbatimbreakchar}%
-    {\kern\verbatimindent}{}}%
-}
-
-\newcommand*{\raggedwrap}{%
-  \@rightskip\@flushglue
-%%%  \rightskip\@rightskip
-  \memRTLrightskip\@rightskip
-%%%  \leftskip\@totalleftmargin
-  \memRTLleftskip\@totalleftmargin
-  \parindent\ragrparindent}
-\newcommand*{\wrappingon}{%
-  \def\@xobeysp{~\discretionary{\verbatimbreakchar}%
-    {\kern\verbatimindent}{}}%
-  \def\wrapright{\raggedwrap}}
-\newcommand*{\wrappingoff}{%
-  \def\@xobeysp{\leavevmode\penalty\@M\ }%
-  \def\wrapright{}}
-\wrappingoff
-
+\newcommand*\wrappingoff{} % defined to do nothing
+\def\wrapright{} % internal macro no longer used
 \newwrite \verbatim at out
 \def\verbatimoutput#1{%
   \@bsphack
@@ -10549,56 +10378,10 @@
   \egroup
   \fbox{\box0}% <<<=== change here for centering,...
 \endgroup}
-\def\MakeShortVerb#1{%
-  \expandafter\ifx\csname cc\string#1\endcsname\relax
-    \@shortvrbinfo{Made }{#1}%
-    \add at special{#1}%
-    \expandafter
-    \xdef\csname cc\string#1\endcsname{\the\catcode`#1}%
-    \begingroup
-      \catcode`\~\active  \lccode`\~`#1%
-      \lowercase{%
-      \global\expandafter\let
-         \csname ac\string#1\endcsname~%
-      \gdef~{\verb~}}%
-    \endgroup
-    \global\catcode`#1\active
-  \else
-    \@shortvrbinfo\@empty{#1 already}%
-  \fi}
-\def\DeleteShortVerb#1{%
-  \expandafter\ifx\csname cc\string#1\endcsname\relax
-  \else
-    \@shortvrbinfo{Deleted }{#1 as}%
-    \rem at special{#1}%
-    \global\catcode`#1\csname cc\string#1\endcsname
-    \global \expandafter\let \csname cc\string#1\endcsname \relax
-    \ifnum\catcode`#1=\active
-      \begingroup
-        \catcode`\~\active   \lccode`\~`#1%
-        \lowercase{%
-          \global\expandafter\let\expandafter~%
-          \csname ac\string#1\endcsname}%
-      \endgroup \fi \fi}
-\def\@shortvrbinfo#1#2{%
-  \ClassInfo{memoir}{%
-     #1\expandafter\@gobble\string#2 a short reference
-                                          for \string\verb}}
-\def\add at special#1{%
-  \rem at special{#1}%
-  \expandafter\gdef\expandafter\dospecials\expandafter
-    {\dospecials \do #1}%
-  \expandafter\gdef\expandafter\@sanitize\expandafter
-    {\@sanitize \@makeother #1}}
-\def\rem at special#1{%
-  \def\do##1{%
-    \ifnum`#1=`##1 \else \noexpand\do\noexpand##1\fi}%
-  \xdef\dospecials{\dospecials}%
-  \begingroup
-    \def\@makeother##1{%
-      \ifnum`#1=`##1 \else \noexpand\@makeother\noexpand##1\fi}%
-    \xdef\@sanitize{\@sanitize}%
-  \endgroup}
+
+ % load shortvrb instead of embedding it
+\RequirePackage{shortvrb}
+
 \def\boxverbflag{14 }
 \newlength{\bvboxsep}      % user can change this
 \setlength{\bvboxsep}{1em}
@@ -10661,11 +10444,11 @@
                                  \linewidth-.8\p@ \@@line
       {\b at vdooutside\strut\kern\bvboxsep%
        \b at vdoinside%
-       \ift at bs
-         \tabverbatim at processline
-       \else
+       %\ift at bs
+       %  \tabverbatim at processline
+       %\else
          \the\verbatim at line
-       \fi
+       %\fi
        \hss}%
      \kern\bvboxsep}\bvrightsidehook\par}}
 
@@ -10674,7 +10457,7 @@
   \interlinepenalty\boxverbflag
   \parfillskip\z@ plus\p@ minus\p@
   \lineskip-\bvboxsep \baselineskip\z at skip
-  \frenchspacing\@vobeyspaces\@maybeobeytabs
+  \frenchspacing\@vobeyspaces%\@maybeobeytabs
   \boxverb at toprule}
 
 \def\boxedverbatim{\begingroup
@@ -11151,11 +10934,11 @@
     \fi}}
 
 \def\readverbatim{\begingroup
-  \ift at bs
-    \def\verbatim at processline{\tabverbatim at processline}%
-  \fi
-  \@ifstar{\stre at mverb@input{\@maybeobeytabs}}%
-     {\stre at mverb@input{\frenchspacing\@vobeyspaces\@maybeobeytabs}}}
+  %\ift at bs
+  %  \def\verbatim at processline{\tabverbatim at processline}%
+  %\fi
+  \@ifstar{\stre at mverb@input{\@setupverbvisiblespace\@vobeyspaces}}%{\@maybeobeytabs}}%
+     {\stre at mverb@input{\frenchspacing\@vobeyspaces}}}%\@maybeobeytabs}}}
 
 \newcommand{\stre at mverb@input}[2]{%
   \IfStreamOpen{#2}%



More information about the tex-live-commits mailing list.