% \iffalse meta-comment
%
% Copyright 2024-2025
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
%
% This file is part of the LaTeX base system.
% -——————————————
%
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
%    https://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008 or later.
%
% This file has the LPPL maintenance status "maintained".
%
% The list of all files belonging to the LaTeX base distribution is
% given in the file `manifest.txt'. See also `legal.txt' for additional
% information.
%
% The list of derived (unpacked) files belonging to the distribution
% and covered by LPPL is defined by the unpacking scripts (with
% extension .ins) which are part of the distribution.
%
% \fi
% Filename: ltnews41.tex
%
% This is issue 41 of LaTeX News.

\ifx\TUB\undefined
\NeedsTeXFormat{LaTeX2e}[2020-02-02]

\documentclass{ltnews}
\fi

%% Maybe needed only for Chris' inadequate system:
\providecommand\Dash {\unskip \textemdash}

%% NOTE: Chris' preferred hyphens!
%% \hyphenation{because}

\usepackage[T1]{fontenc}

\usepackage{lmodern,url,hologo}

\usepackage{csquotes}
\usepackage{multicol}
\usepackage{color}

\providecommand\hook[1]{\texttt{#1}}
\providecommand\socket[1]{\texttt{#1}}
\providecommand\plug[1]{\texttt{#1}}

\providecommand\meta[1]{$\langle$\textrm{\itshape#1}$\rangle$}
\providecommand\option[1]{\texttt{#1}}
\providecommand\env[1]{\texttt{#1}}
\providecommand\Arg[1]{\texttt\{\meta{#1}\texttt\}}


\providecommand\eTeX{\hologo{eTeX}}
\providecommand\XeTeX{\hologo{XeTeX}}
\providecommand\LuaTeX{\hologo{LuaTeX}}
\providecommand\pdfTeX{\hologo{pdfTeX}}
\providecommand\MiKTeX{\hologo{MiKTeX}}
\providecommand\CTAN{\textsc{ctan}}
\providecommand\TL{\TeX\,Live}

\providecommand\githubissue[2][]{\ifhmode\unskip\fi
     \quad\penalty500\strut\nobreak\hfill
     \mbox{\small\slshape(%
       \href{https://github.com/latex3/latex2e/issues/\getfirstgithubissue#2 \relax}%
          	    {github issue#1 #2}%
           )}%
     \par\smallskip}

% simple solution right now (just link to the first issue if there are more)
\def\getfirstgithubissue#1 #2\relax{#1}


\providecommand\taggingissue[2][]{\ifhmode\unskip\fi
     \quad\penalty500\strut\nobreak\hfill
     \mbox{\small\slshape(%
       \href{https://github.com/latex3/tagging-project/issues/\getfirstgithubissue#2 \relax}%
          	    {tagging-project issue#1 #2}%
           )}%
     \par\smallskip}
    


\providecommand\sxissue[1]{\ifhmode\unskip
     \else
       % githubissue preceding
       \vskip-\smallskipamount
       \vskip-\parskip
     \fi
     \quad\penalty500\strut\nobreak\hfill
     \mbox{\small\slshape(\url{https://tex.stackexchange.com/#1})}\par}

\providecommand\gnatsissue[2]{\ifhmode\unskip\fi
     \quad\penalty500\strut\nobreak\hfill
     \mbox{\small\slshape(%
       \href{https://www.latex-project.org/cgi-bin/ltxbugs2html?pr=#1\%2F\getfirstgithubissue#2 \relax}%
          	    {gnats issue #1/#2}%
           )}%
     \par}

\let\cls\pkg
\providecommand\env[1]{\texttt{#1}}
\providecommand\acro[1]{\textsc{#1}}

\vbadness=1400  % accept slightly empty columns

\let\finalpagebreak\pagebreak % for TUB (if they use it)
\let\finalvspace\vspace       % for document layout fixes

\makeatletter
% maybe not the greatest design but normally we wouldn't have subsubsections
\renewcommand{\subsubsection}{%
   \@startsection {subsubsection}{2}{0pt}{1.5ex \@plus 1ex \@minus .2ex}%
                  {-1em}{\@subheadingfont\colonize}%
}
\providecommand\colonize[1]{#1:}
\makeatother


% Undo ltnews's \verbatim@font with active < and >
\makeatletter
\def\verbatim@font{\normalsize\ttfamily}
\makeatother


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\providecommand\tubcommand[1]{}
\tubcommand{\input{tubltmac}}

\publicationmonth{June}
\publicationyear{2025}

\publicationissue{41}


\begin{document}

\maketitle
{\hyphenpenalty=10000 \exhyphenpenalty=10000 \spaceskip=3.33pt \hbadness=10000
 \small
\tableofcontents}

\setlength\rightskip{0pt plus 3em}

\medskip

\section{Introduction}

We are continuing to work on the support of tagged PDF output and on
wider kernel development, much of which is needed to make this
happen.  Probably the most notable changes in this latest release of
the kernel are those in the output routine and in the mark mechanism:
these are described in the first two sections.

Work also continues apace on further aspects of the tagging project,
where some highlights are: new sockets, better graphics tagging,
improved math mode support and the promotion of PDF~2.0.

In addition to this tagging-focussed work, we have also made advances
in these areas: a new argument type for use in
\cs{NewDocumentEnvironment} and friends which will make working with
verbatim content a \emph{lot} easier; further improvements to case
changing; and, of course, several bug fixes.

Finally, we have highlighted a few of the recent changes in the L3
programming layer, where development work continues in parallel with
other improvements to the \LaTeX{} kernel; and we are integrating
more, formerly \enquote{experimental}, ideas into this core
programming system.



\section{A configurable output routine}

For nearly 40 years \LaTeX's output routine (the mechanism to paginate
the document and attach footnotes, floats and headers \& footers) was
a largely hardwired algorithm with a limited number of configuration
possibilities.  Packages that attempted to alter any aspect of this
process had to overwrite the internals, which led to the usual
problems: incompatibilities and out-of-date code whenever something
was changed in \LaTeX{}.

To improve this, and to support the production of accessible PDF
documents, we have started to refactor the output routine by adding a
number of hooks and sockets.  This means that packages needing to
adjust the output routine can do so safely, avoiding the dangers
previously associated with such activities.


For packages that need to hook into the output routine we have implemented
the following hooks:
\begin{description}

\item[\hook{build/page/before}, \hook{build/page/after}]

   These two hooks enable packages to prepend or append code to the
   processing of each page in the output routine. They are implemented
   as mirrored hooks.  Technically, they are executed at the start and
   the end, respectively, of the internal \LaTeXe{} \cs{@outputpage}
   command.  Currently, a number of packages change this command by
   adding code in exactly these two places\Dash so they can now
   instead simply add code to these hooks.

 \item[\hook{build/page/reset}]

   Packages that set up special conventions for the main text (such as
   catcode changes, etc.)\ can use this hook to undo these changes
   within the output routine, so that they aren't applied to unrelated
   material such as the text for running headers or footers.

\item[\hook{build/column/before}, \hook{build/column/after}]

  These two hooks enable packages to prepend or append code to the
  column processing in the output routine. They are implemented as
  mirrored hooks.  Technically, they are executed at the start and the
  end, respectively, of the internal \LaTeXe{} \cs{@makecol} command.
  A number of packages alter \cs{@makecol} to place code in exactly
  these two places\Dash they can now instead simply add their code to
  these hooks.
  
\end{description}

We have also added a number of sockets: for configuring the algorithm
and also to support tagging.  Two of these sockets are of interest for
use in class files and also in the document preamble.

The first and most complex of these is the socket
\socket{build/column/outputbox}, which controls how the column text,
the column floats (top and bottom) and the footnotes are combined in a
column: i.e., their order and spacing.

Thus in order to change the layout, all one now has to do is to assign
a suitable plug to this socket, like this:
\begin{flushleft}
  \verb= \AssignSocketPlug{build/column/outputbox}=
  \verb=                  {=\meta{plug-name}\verb=}=
\end{flushleft}
%
For this socket we have provided the following plugs:
\begin{description}
\item[\plug{space-footnotes-floats}]

   After the galley text there is a vertical \cs{vfil} followed by the
   footnotes, followed by the bottom floats, if any.

\item[\plug{footnotes-space-floats}]

   As before but the \cs{vfil} is between the footnotes and the
   floats.

\item[\plug{floats-space-footnotes}]

   The floats come directly after the text, followed by a \cs{vfil}
   and then the footnotes at the bottom.

\item[\plug{space-floats-footnotes}]

   Both floats and footnotes are pushed to the bottom, the footnotes
   coming last.\footnote{There are two more permutations but neither
   of them has ever been requested; so these two are not set up by
   default\Dash doing that in a class would be trivial though.}

\item[\plug{floats-footnotes}]

   All excess space is distributed across the existing glue on the
   page: e.g., within the text galley, the separation between blocks,
   etc.  The order is text, floats, footnotes.

\item[\plug{footnotes-floats}]

   Like the previous plug, but floats and footnotes are swapped. This
   is the \LaTeX{} default for newer documents, i.e., this plug is
   assigned to the socket when \cs{DocumentMetadata} is used.

\item[\plug{footnotes-floats-legacy}]

   Like the previous plug, but \LaTeX{}'s bottom skip bug is not
   corrected: i.e., in ragged bottom designs where footnotes are
   supposed to be directly attached to the text, they suddenly appear
   at the bottom of the page when the page ends with a \cs{newpage} or
   \cs{clearpage}.  While this is clearly a bug, it has been like this
   since the days of \LaTeX~2.09; thus, for compatibility, we continue
   to support this behavior.  This plug is assigned to the socket when
   \cs{DocumentMetadata} is \emph{not} used.
\end{description}

By default the separation between the last line of text and the
footnotes (\cs{skip}\cs{footins}) is not measured from the baseline of
the last text line, but from its bottom. This goes back to plain
\TeX{} where it is done in this way.  Similarly, \cs{textfloatsep} is
added between text and bottom floats, not starting from the baseline of
the last text line. Typographically speaking this is suboptimal,
because it means that with \cs{flushbottom} in effect, the position of
the last text line, when it is followed by footnotes or floats,
depends on whether or not that line contains characters with
descenders.

For this reason there is now also a socket
\socket{build/column/baselineattach} with a plug \plug{on}: this
causes the attachment of footnotes/floats to be measured from the
baseline of the last text line. To mimic the behavior of old
documents, this socket is, by default, assigned the plug \plug{off}.
For documents using \cs{DocumentMetadata}, the plug \plug{on} will
probably become the default here.

There are more configuration possibilities, mainly for class
developers to use: documentation of these can be found in \cite[\S54
  \texttt{ltoutput.dtx}]{41:source2e}.


\section{Replacement for the legacy mark mechanism}

\LaTeX{}'s legacy mechanism supported only two classes of marks, left
and right marks, and setting the left mark (with \cs{markboth}) always
altered the state of the right mark as well, i.e., they were far from
independent. For generating running headers with \enquote{chapter
  titles} on the left and \enquote{section titles} on the right, they
work reasonably well but without much flexibility: e.g., \cs{leftmark}
always generated the last \enquote{left}-mark on the page, while
\cs{rightmark} always generated the first \enquote{right}-mark.

A few releases ago~\cite[p.\,76]{41:ltnews} we therefore introduced a
new mark mechanism for \LaTeX{}, one that supports any number of truly
independent mark classes. This mechanism also offers the ability to
query the mark status at the top of the page, something that wasn't
previously available at all.

Up to now these two mechanisms coexisted, with completely separate
implementations; but we have now retired the legacy code and
reimplemented its public interfaces using the new concepts.  Thus
the old commands (\cs{markboth}, \cs{markright}, \cs{leftmark} and
\cs{rightmark}) remain supported, but internally these commands all
use \cs{InsertMark}, etc.

Existing document classes, and documents using the legacy interfaces,
will therefore continue to work without any modifications; but they
now use a single underlying implementation. Also, new documents can
benefit from the additional flexibility, e.g., by being able to
display not only the first right-mark (\cs{rightmark} or
\verb=\FirstMark{2e-right}=) but also, or alternatively, the last
right-mark (\verb=\LastMark{2e-right}=) or the top right-mark
(\verb=\TopMark{2e-right}=), etc.

More information concerning all of this extended functionality can be
found in~\cite{41:ltmarks}.


\section{News from the Tagged PDF project}

In the Tagged PDF project we have now reached a state where, within
certain limits, it is possible to generate accessible PDF output that
conforms to PDF/UA for arbitrarily complex documents as long as they
only use (a growing number of) compatible packages and classes.

The focus for this release was on adding special sockets for tagging
support, on improving the tagging of math formulas, and on extending
the tagging support for various types of graphics.

\subsection{New Metadata keys, to activate tagging}

Up to now users had to activate tagging by loading modules from
\texttt{latex-lab} with the help of the \texttt{testphase}
key. Further configuration of the tagging then had to be done by using
the \cs{tagpdfsetup} command.  We now offer Metadata keys for this
that do not use \enquote{test} in their names, reflecting the fact
that producing tagged PDF documents has become
\enquote{production-ready}.\footnote{To be fully precise, this is true
provided only compatible\\
packages and classes are used: these are listed at\\
\url{https://latex3.github.io/tagging-project/tagging-status/}.}

The \texttt{tagging} key allows for the activation and deactivation of the
tagging support.  It accepts the three values \texttt{on},
\texttt{off} and \texttt{draft}.  When this key is used it loads the
\pkg{tagpdf} package and all the modules that we currently recommend 
should be loaded.\footnote{This set of modules can also be loaded with 
the key\\ \texttt{testphase=latest}.}
The list of loaded modules will be adjusted as needed as
the project progresses. For reference, it is also written to the log.
Setting \texttt{tagging=off} loads the 
same set of modules and then
deactivates the tagging commands in the \texttt{class/before} hook;
and \texttt{tagging=draft} leaves the tagging commands active, so as
to preserve warnings and errors in the tagging, but it deactivates the
writing of the structure tree at the end of the compilation. This can
save time when drafting a long document.

The \texttt{tagging-setup} key allows configuration of the tagging. It
accepts as values all the keys that can be used in \cs{tagpdfsetup},
such as the \texttt{math/setup} key described below. It knows about
both the key \texttt{modules}, which allows overwriting of the set of
loaded modules, and the key \texttt{extra-modules}, which allows
loading of experimental modules that are not yet in \texttt{latest}.
%
The \texttt{tagging-setup} key implies \texttt{tagging=on} so that, if
this key is used, then it is not necessary to also set the
\texttt{tagging} key unless you want to turn tagging \texttt{off}, or
to set it to \texttt{draft}.

With these new Metadata keys a standard setup might look like this:
\begin{verbatim}
\DocumentMetadata{
   pdfstandard={UA-2,A-4f},
   tagging=on,
   tagging-setup=
      {math/setup=mathml-SE,
       extra-modules=verbatim-alt}
 }      
\end{verbatim}


\subsection{New value \texttt{latest} for \texttt{testphase} key}

With the new keys for enabling tagging the use of the
\texttt{testphase} key is now of minor importance and mainly of
interest for developers and for backwards compatibility.

With this release it also supports the value \texttt{latest}.  This
will load all modules that we currently recommend should be loaded, so
that it is not necessary to specify a long list of individual
modules. The list of loaded modules will be adjusted as needed when
the project progresses. For reference, it is also written to the log.


\subsection{Sockets for tagging support}

A lot of the tagging support in packages is handled through the
socket-and-plug mechanism that was introduced in \LaTeX{}
2023-11-01~\cite[p.\,93]{41:ltnews}.
%
Sockets offer an easily used interface for package developers to
invoke variable code at pre-specified places: code that then can be
changed from outside the package by assigning a different plug to
alter the processing.

For the tagging support, a specialized set of sockets is available:
their plugs are invoked by using the \cs{UseTaggingSocket} command,
instead of the normal \cs{UseSocket} command. This allows tagging to
be turned off or on at high speed by the commands \cs{SuspendTagging}
and \cs{ResumeTagging}, without the need to individually reassign
plugs to each of the many tagging
sockets~\cite[p.\,97]{41:ltnews}. This is very useful when there is a
need to typeset material several times during trials.

In the current release we now also offer three dedicated declaration
commands for these \enquote{tagging sockets}: this works better than
directly using the underlying general socket interface.  These new
commands also better support the special conventions used for
\enquote{tagging sockets}. They are: \cs{NewTaggingSocket},
\cs{NewTaggingSocketPlug} and \cs{AssignTaggingSocketPlug}.


\subsection{Setting the version to PDF 2.0}

Creating a PDF 2.0 version is considered essential for any document
that has substantial mathematical content.  This is because only this
PDF version supports the straightforward use of tags from the MathML
namespace.

When \cs{DocumentMetadata} is used, \LaTeX{} will therefore, by
default, set PDF~2.0 as the PDF version.  A different PDF version can,
if required, be set by explicit use of the \texttt{pdfversion} key.




\subsection{Setting up math tagging}

With the \LuaTeX{} engine there are now various options for the
production of accessible math which are described in full detail in
\texttt{latex-lab-math.pdf}. To simplify the setup, a new key
\texttt{math/setup} can be used in \cs{tagpdfsetup} (or in
\texttt{tagging-setup} as shown above) that accepts a comma list with
the values \texttt{mathml-SE} (add MathML structure elements),
\texttt{mathml-AF} (attach MathML associated files) or \texttt{tex-AF}
(attach the \TeX{} sources).


\subsection{The use of \texttt{\$\$...\$\$} for math displays}

Use of the plain \TeX{} method \verb=$$...$$= in \LaTeX{}, to mark up
a display math formula, is not officially supported because it
produces a fixed visual result that is not receptive to style changes
such as the \texttt{fleqn} option. Instead, the recommended way is to
use \verb=\[ ... \]= or the \env{displaymath} environment. However,
since many authors have used this input method in their documents, we
are doing our best to support it for the production of accessible
PDFs; but users should be aware that it has some limitations.

However, these accommodations for tagged PDF clash with the direct use
of \verb=$$= in environment definitions for special math environments
(such as those defined in \pkg{amsmath}).  The kernel therefore now
contains the two commands \cs{dollardollar@begin} and
\cs{dollardollar@end}.  These new commands must be used by packages
and classes to specify where inside an environment the displayed math
formula starts and ends: their use is essential in order to make the
package or a class compatible with tagging, and to allow its use when
producing accessible documents.
%
No more explicit \texttt{\$\$}s in
code, please!

Package and class developers can prepare code to meet
this new requirement by adding these two commands:
\begin{verbatim}
\providecommand\dollardollar@begin{$$}
\providecommand\dollardollar@end{$$}
\end{verbatim}
and replacing every occurrence of \verb=$$= with the appropriate start
or end command.

Adding these \cs{providecommand} lines to classes and packages doesn't
hurt but ensures that they will work with older \LaTeX{} kernels.



\subsection{Fixing the spacing after display math}

When \LaTeX{} produces accessible (tagged) PDF it has to add structure
data in the PDF to mark (i.e., tag) individual elements. If the
\pdfTeX{} engine is used this has to be done with the help of
\cs{pdfliteral}s, which are whatsit nodes like \cs{special} or
\cs{write}. This means that they should be added only in places where
these extra nodes do not affect the spacing\Dash \TeX{} can't, for
example, look backwards past such a whatsit node, so consecutive
spaces, that are normally collapsed into one, suddenly both appear
when such a node separates them.

The situation is especially complicated in displayed math because
there \TeX{} adds penalties and spaces using low-level procedures that
are not directly accessible from the macro level.  Moreover, the PDF
tagging structures have to be added somewhere in the middle of this
processing: this is needed to ensure that the formula and these PDF
structures do not get separated by a page break. Because of this it is
necessary to use some fairly complex methods (essentially, we disable
\TeX's mechanisms and reprogram them on the macro level) to get the
structure data in the right places.

Our first attempt to do this was slightly faulty and, in some cases,
resulted in the addition of an incorrect \cs{parskip} space; this has
now been corrected.  The implementation that achieves this is a rather
\enquote{interesting} study in obfuscated \TeX{} coding\Dash it is
described in \file{latex-lab-math.pdf} for the interested.

When using \LuaTeX{} the situation is much better because the
necessary extra structures can be added at a later stage, after the
formula has been typeset.
%
\taggingissue{762}


\subsection{Local changes to spacing around math displays}

Due to \TeX{}'s low-level handling of display math, it is very
difficult to add the code needed for tagging within such display math
formulas whilst ensuring that such code always stays on the same page
as the formula.  This is because such code must be placed after the
end of the display, but before the \TeX{} engine adds a
\cs{postdisplaypenalty} to the page. However, there is no way to add
code in the middle of this low-level \TeX{} processing, which is why
we have to resort to complex gymnastics as already hinted at: we set
\cs{postdisplaypenalty} locally to 10000 and also make sure that
\cs{belowdisplayskip} when used by \TeX{} is negative. Then we let
\TeX{} do its job and afterwards regain control via \cs{aftergroup}
and insert the tagging code.  Finally, we add the real
\cs{postdisplaypenalty} and make a space correction.

With our first implementation of this approach it was not possible for
a user to add an explicit \cs{postdisplaypenalty} or
\cs{belowdisplayskip} setting inside the formula.  In this release we
have slightly altered our algorithm to make such user adjustments
possible again.
%
\taggingissue{809}


\subsection{Extended support for pictures}


The tagging of graphics has been reimplemented and now uses tagging
sockets (see above).  Document authors can choose between four tagging
flavors on a per-graphic basis: as illustrative figures, as artifacts
(i.e., decorations), as replacements for symbols, and if applicable as
normal text (for example, \enquote{todo notes}). To this effect the
options of \cs{includegraphics} and the environments \env{picture} and
\env{tikzpicture} have been extended and now accept keys such as
\texttt{alt} (for the description text of illustrative figures),
\texttt{actualtext} (to set the symbol), and \texttt{artifact}.
%% 
The code supports graphics produced using the \pkg{tikz} packages and
\enquote{todo notes} from the \pkg{todonotes} package. The
extended documentation in \texttt{latex-lab-graphics.pdf} lists the
full set of options and also describes what authors of other graphic
packages can do to make their packages tagging aware.




\section{New or improved commands}

\subsection{Socket-and-plug conditionals}

It is sometimes necessary, or helpful, to know whether a particular
socket or plug exists (or whether a plug is assigned to a certain
socket) and, based on such information, to take different
actions. With the current release we added conditionals, such as
\cs{IfSocketExistsTF}, to support such scenarios. Corresponding L3
programming layer conditionals are also provided.
%
\githubissue{1577}


\subsection{Accessing the current counter}

Counter commands such as \cs{alph}, \cs{stepcounter}, can now use the
argument \texttt{*} to denote the \emph{current counter} (in the sense
used by \cs{label}).  This is compatible with the use by the
\pkg{enumitem} package of \verb|\alph*| in item labels; and it is now
generally available.  Not all commands accept \verb|*|; for example,
\verb|\counterwithin| and \verb|\counterwithout| still require counter
names as before.
%
\githubissue{1632}

\subsection{Collecting environment bodies verbatim}

The mechanisms provided with \cs{NewDocumentCommand}, etc., offer a
powerful way to specify a range of types of document command and
environment syntax. This includes the ability to collect the entire
body of an environment, for cases where treating it as a standard
argument is useful. It is also possible to use this mechanism to define
arguments which grab their content verbatim.  To date, however, it was
not possible to combine these two ideas.

In this release a new specifier,~\texttt{c}, has been introduced for
use in \cs{NewDocumentEnvironment} and friends: this collects the body
of an environment in a verbatim-like way.  As with the existing
\texttt{+v}~specification, each separate line is marked by the special
\cs{obeyedline} marker, which
%FMi
%, as usual,
by default
issues a normal
paragraph. Thus, this new specifier is usable both for typesetting and
for collecting file contents (the letter~\texttt{c} indicates
\enquote{collect code}).  Thus, we may use\footnote{Proper support 
for Tagged PDF needs additional code which is not shown here.}
\begin{verbatim}
  \NewDocumentEnvironment
    {MyVerbatim}{!O{\ttfamily} c}
    {\begin{flushright}#1 #2\end{flushright}}
    {}
  \begin{MyVerbatim}[\ttfamily\itshape]
    % Some code is shown here
    $y = mx + c$
  \end{MyVerbatim}
\end{verbatim}
to obtain
\begin{quote}
\makeatletter
\def\@verbatim{%
  \trivlist
  \raggedleft
  \let \do \@makeother
  \dospecials
  \obeylines
  \normalfont \ttfamily \itshape
  \@noligs
}
\begin{verbatim}
  % Some code is shown here
  $y = mx + c$
\end{verbatim}
\end{quote}



\section{Code improvements}

\subsection{Refinement of \cs{MakeTitlecase}}

We introduced \cs{MakeTitlecase} as a late addition to the June 2022
release, making use of the improved case code in the L3 programming
layer. Compared to upper and lowercasing, making text titlecased is even
trickier to get right: it can be applied either to the whole text, or
on a word-by-word basis.

A subtle issue was reported concerning the L3 programming layer
(\url{https://github.com/latex3/latex3/issues/1316}); this
is related to how we deal with the case changing of \enquote{words}
but it also shows up when you titlecase some text stored in a command.

We have looked again at how to implement \cs{MakeTitlecase} in order
to make it as predictable as possible, and we have made a change in
this release. The command no longer tries to lowercase text before
applying titlecasing, and it therefore gives correct results for text
stored in commands.

We have also added an additional key to the optional argument to
\cs{MakeTitlecase} which allows the user to decide if the case change
gets applied only to the first word (the default) or to all the words.


\subsection{Tab character as a special character}

In \LaTeX{} News~38~\cite[p.\,95]{41:ltnews}, we described a change to \cs{verb}, etc., that
makes the tab character equivalent to a space; we have now completed
this work by adding the tab character to the list of characters
covered by \cs{dospecials}.  This allows tab to be used, for example,
in a \texttt{v}~specification document command without the need for
additional steps.


\subsection{Refinement of \texttt{v}~specification category codes}

Work on verbatim argument handling has highlighted that it is
problematic to store all characters as \enquote{other} (category
code~12) when using a \texttt{v}~specification in
\cs{NewDocumentCommand}, etc. We have therefore now revised this so
that characters of category code letter retain their original category
code.


\subsection{Logging declarations of commands and symbols}

For thirty years the documentation claimed that
\cs{DeclareTextSymbol}, \cs{DeclareTextCommand} and friends all log
their changes. However, in contrast to their math counterparts, they never
in fact did so. This behavior has now finally been corrected.
%
\githubissue{1242}

\subsection{Improved management of the NFSS font series} 

\LaTeX's font selection mechanism (NFSS) supports 9~weight levels,
from ultra-light~(\texttt{ul}) to ultra-bold~(\texttt{ub}), and also
9~width levels, from ultra-condensed~(\texttt{uc}) to
ultra-expanded~(\texttt{ux}). In the February~2020 release this
mechanism was extended, so that requests to set the weight or the
width attributes of a font series are combined in a sensible
way~\cite[p.\,52]{41:ltnews}: for example, if you typeset a paragraph
in a condensed face using \verb+\fontseries{c}\selectfont+ and then
you use \cs{textbf} inside the paragraph, a bold condensed face is
selected. The combination of such values is done by consulting a
simple lookup table whose entries are defined by using the command
\cs{DeclareFontSeriesChangeRule}.

Until now, this lookup table was missing some entries, especially with
regard to rarely used width values. In such cases, the series values
were not combined as expected. This has been fixed (thanks to Maurice
Hansen) by adding numerous \cs{DeclareFontSeriesChangeRule} entries so
that, when combining these font series values, the full range of
weights (from \texttt{ul} to \texttt{ub}) and widths (from \texttt{uc}
to \texttt{ux}) is now supported.
%
\githubissue{1583}


\subsection{Supporting the \texttt{ssc} and \texttt{sw} font shapes}

The \texttt{ssc} font shape (spaced small capitals) is supported in
\LaTeX{} through the commands \cs{sscshape} and \cs{textssc}. However,
until this release there were no font shape change rules defined for
this, admittedly seldom available, shape; so
\begin{verbatim}
  \sscshape\itshape
\end{verbatim}
changed unconditionally to \texttt{it} (italics) rather than to
\texttt{sscit} (spaced small italic capitals).  Thanks to Michael
Ummels, the missing declarations have now been added, so shape changes
in font families that support spaced small capitals work properly.
%
At the same time we took the opportunity to improve the fallbacks for
the \texttt{sw} (swash) shapes, which are accessible through the
commands \cs{swshape} or \cs{textsw}. If an \texttt{sw} combination is
not available, the rules now try to replace \texttt{sw} with
\texttt{it} rather than falling back to \texttt{n}.
%
\githubissue{1581}


\subsection{Improving the handling of \cs{label}, \cs{index}, and \cs{glossary}}

In standard \LaTeX{}, the three commands \cs{label}, \cs{index}, and
\cs{glossary} take exactly one mandatory argument, e.g.,
\verb=\index{=\meta{entry}\verb=}=. In some extension packages, for
example \pkg{index} or \pkg{cleveref}, these are all augmented to
accept an optional argument and, in the case of \cs{index}, also a
star form. These extensions conflicted with \LaTeX's way of disabling
these commands within the table of contents and within running headers
because they were, in these places, redefined to expect just a
mandatory argument and then do nothing. We have now changed this
behavior, so that the redefinitions in these places now accept this
extended syntax.
%
\githubissue{311}

\subsection{Tracing lost characters}

In \LaTeX\ News 33~\cite[p.\,63]{41:ltnews} we announced that
\cs{tracingall} changes \cs{tracinglostchars} to an error
condition. This change has been reverted and \cs{tracingall} and
\cs{tracingnone} no longer alter \cs{tracinglostchars}, so its
current setting is retained.

The default value used in \LaTeX{} is set so that lost character
information is written as a warning to both the log and the terminal.
Users may wish to change this into an error, in which case
\cs{tracinglostchars} should be set to~5 (not~3) as this works in all
engines.
%
\githubissue{1687}


\subsection{Always use the extended pool of registers} 

As the kernel has grown, the use of registers has risen to the
point where rolling back to the classical register allocation approach
(using only 256 registers) is no longer viable. We have therefore
adjusted the rollback code so that even when requesting a pre-2015
\LaTeX{}, the extended pool remains in use.

\subsection{A version of \cs{input} for expansion contexts}

The \LaTeX{} definition of \cs{input} cannot be used in places where
\TeX{} is performing expansion: the classic example is at the start of
a tabular cell.  There are a number of reasons for this: the key ones
are that \LaTeX{}'s \cs{input} records which files are read, and
provides pre- and post-file hooks.
%
To support the need to carry out file input in expansion contexts, we
have now added \cs{expandableinput}; this skips recording the file
name and does not apply any file hooks, but otherwise behaves like
\cs{input}. In particular, it still uses \cs{input@path} when doing
file lookup (contrasting with the behavior of the \TeX{} primitive,
which remains internally available for programmers as \cs{@@input}).
%
\githubissue{514}


\section{Bug fixes}


\subsection{Avoid problems with page breaks in the middle of \env{verbatim}-like environments}

If a page break occurs in the middle of an environment that sets up
special \cs{catcode} settings, such as a \env{verbatim} environment,
then these settings will remain active when the output routine is
building the page. This is normally harmless, because the material
contained in the page had been previously tokenized, so that the
\cs{catcode} changes do not matter. However, in certain circumstances
tokenization can happen during this page processing: for example, if
processing the header involves reading in a file; or if there is a
command that uses \cs{scantokens} so that it retokenizes some material
using the verbatim settings.

This has been fixed and \LaTeX{} now explicitly resets the
\cs{catcode} values to their default settings when entering the output
routine. Furthermore, packages that make changes to the tokenization
beyond what is done by \env{verbatim} can use the newly introduced
hook \hook{build/page/reset} to add their own resets to the output
routine processing. This hook is evaluated after \LaTeX{} has done its
reset, so it is also possible, if necessary, to overwrite \LaTeX{}'s
default behavior.
%
\githubissue{600}



\subsection{Fix for nested use of \texttt{localmathalphabets}}

In 2021 we introduced a method to overcome the problem that classic
\TeX{} engines (but not the Unicode engines) have only a very limited
number of math alphabets available (so they easily got used up by
loading math font packages, even if their symbols got used only
occasionally). The idea was to avoid allocating all math alphabets
globally, but instead to allow a number of them (defined by counter
\texttt{localmathalphabets}) to vary from one formula to the next. This
means that different formulas can make use of different alphabets,
so the chances are much higher that the processing of a complex
document succeeds.  See~\cite[p.\,69]{41:ltnews} for details.

Unfortunately, the approach we took back then failed in some cases of
nested formulas, with the result that the wrong glyphs were used.
This has now been corrected.
%
\githubissue[s]{1101 1028}


\subsection{\pkg{docstrip}:\ Error if an \texttt{.ins} file is problematic}

If the file to be generated had the same name as a preamble declared
with \cs{declarepreamble} then the preamble definition was
overwritten, because the macro used to store it got reused to denote
the output stream. The same problem happened with postambles declared
with \cs{declarepostamble}. This situation is now detected and an
error message is issued. To circumvent the issue, simply
use a different macro name for the preamble or postamble.
%
\githubissue{1150}


\subsection{Prevent a \texttt{cmd} hook from defining an undefined command}

Using \verb=\AddToHook{cmd/FOO/...}= when the command \cs{FOO} was
undefined resulted in this command becoming \cs{relax}. Thus, if used,
it no longer raised an \enquote{Undefined control sequence} error, but
silently did nothing. This behavior has been corrected, and, if the
command \cs{FOO} does not get defined later, e.g., in a package, it
now raises an error when it is used in the document.
%
\githubissue{1591}


\subsection{Process global options just once per package}

In 2022, we introduced key--value (keyval) option processing in the
kernel~\cite[p.\,77]{41:ltnews}. This also added the idea that keys
could have scope: load-only, preamble-only and general use. However,
we overlooked that an option given globally (in the optional argument
to \cs{documentclass}) would be repeatedly processed and could
therefore lead to spurious warnings. This has now been corrected so
that now each global option is seen, by the keyval-based option
handling system, exactly once per package.
%
\githubissue{1619}


\subsection{Make \cs{label}, \cs{index}, and \cs{glossary} truly invisible in running headers}

\LaTeX{} has had this bug since its initial implementation: whilst it
correctly ignored any \cs{label}, \cs{index}, or \cs{glossary} command
that appears in a mark, it neglected correct handling of the spaces
around the command. As a result, one could end up with two spaces in
the running header where only one should be present. This was detected
as part of working on issue~311 and has now been corrected.
%
\githubissue{1638}



\subsection [Fully expand the arguments of \cs{counterwithin} and \cs{counterwithout}]%
{Fully expand the arguments of the declarations \cs{counterwithin} and \cs{counterwithout}}

The arguments of the commands \cs{counterwithin} and
\cs{counterwithout} are two counter names that are used to reset (or
not reset) one counter when the other is stepped.  They also redefine
the representation of that counter, e.g.,
\verb=\counterwithin{section}{chapter}= would lead to:
\begin{verbatim}
  \renewcommand\thesection
     {\thechapter.\arabic{section}}
\end{verbatim}
However, if one of these counters was not named explicitly, as in this
example:
\begin{verbatim}
  \newcommand\sectioncounter{section}
  \counterwithin{\sectioncounter}{chapter}
\end{verbatim}
then we ended up with
\begin{verbatim}
  \renewcommand\thesection
     {\thechapter.\arabic{\sectioncounter}}
\end{verbatim}
which could lead to strange results if \cs{sectioncounter} got changed
later on.
%
This has been corrected: these arguments now get fully expanded when
the declaration is made.
%
\githubissue{1675}



\subsection{Correction in the float placement algorithm}

When floats are added to the current or next page, \LaTeX{} makes
several tests in order to find an area that can receive the float. One
of these tests calculates how much space is already used on the page
and how much additional space is needed to place the float in a
particular area. This means that it looks not only at the height of
the float but also at the values from \cs{intextsep} (for \texttt{h}
floats) or \cs{textfloatsep} and \cs{floatsep} (for \texttt{t} and
\texttt{b} floats). The resulting space requirement was then stored in
an internal variable and compared to the space still available on the
page.  If the test failed, the algorithm tried the next area.

Unfortunately, the code was reusing the value in that internal
variable as the starting point for the next test, without removing the
added space for the float separation (\cs{intextsep}, \cs{floatsep},
or \cs{textfloatsep}). Thus the comparison was being made with the
wrong value (i.e., too high); therefore the test may have incorrectly
concluded that a float doesn't fit, even when it would in fact have fit.
This has now been corrected.
%
\githubissue{1645}


\subsection{Correct \cs{CheckEncodingSubset}}

In \cite[p.\,83]{41:ltnews}, and again in \cite[p.\,100]{41:ltnews},
we suggested that font maintainers should place an appropriate
\cs{DeclareEncodingSubset} declaration in each
\texttt{ts1\meta{family}.fd} file, so that this is tied to the font
definition and so will be available whenever a font family is
explicitly selected by \cs{fontfamily}\texttt{\{\meta{name}\}} instead
of using a font support package.  Unfortunately, however, this method
could result in incorrect selection of glyphs if the font encoding
subset setting was evaluated before the \texttt{.fd} file was loaded
\finalpagebreak
(as subset 9 would then be assumed).  This has been corrected:
\cs{CheckEncodingSubset} now first loads the \texttt{.fd} file when
this is necessary.
%
\githubissue{1669}


\subsection{Ensuring late \cs{write} commands aren't lost}

If a non-\cs{immediate} \cs{write} command is used after the final
page has been shipped out then no write will happen because the system
waits for a \cs{shipout} that will never happen.  After the last page
has been shipped out, we therefore force all further \cs{write} calls
to be \cs{immediate}: this ensures that they get written even though
we are not going to ship out any more pages. This change of behavior
is implemented just before the \texttt{enddocument/afterlastpage} hook
because this hook may contain such \cs{write} commands.
%
\githubissue{1689}


\section{Documentation}

\subsection{Clarifying the handling of spaces by \cs{textcolor}}

In contrast to other \cs{text}-commands such as \cs{textbf} or
\cs{textrm}, the command \cs{textcolor} gobbles spaces at the start of
its argument. Thus, for example,
\verb*=Hello\textcolor{red}{ World}= will produce the output
Hello\textcolor{red}{ World}\tubcommand{ (grayscaled for
the printed \textsl{TUGboat})}.
There are technical as well as
compatibility reasons for this, so the behavior will not change. This
is now correctly documented.
%
\githubissue{1474}


\section{Changes to packages in the \pkg{amsmath} category}

\subsection{\cs{numberwithin} now aliased to \cs{counterwithin}}

The \pkg{amsmath} package offers a \cs{numberwithin} declaration to
specify that a counter should be reset whenever some other counter is
stepped. This is a restricted version of the more general kernel
command \cs{counterwithin} which was introduced in the \LaTeX{} kernel
in 2018 and extended in 2021~\cite[p.\,72]{41:ltnews}. With the
current release we have made \cs{numberwithin} an alias for the more
powerful \cs{counterwithin} and we suggest that the latter command is
used in new documents.
%
\githubissue{1673}


\subsection{\pkg{amsmath}:\ Correct equation tag placement}

If there is not enough space to place an equation tag on the same line
as the equation then \pkg{amsmath} calculates a suitable offset
placement for the tag, above (or below) the equation. In the case of
the \env{gather} environment this offset was not reset correctly, so
that it also got applied to these tags in any following environment,
which gave incorrect placement in certain situations. The fix for
this, implemented in 2024/06, was not entirely correct; so this has
been changed to do such resetting at the start of every displayed
math environment.
%
\githubissue{1289}


\section{Changes to packages in the \pkg{graphics} category}

\subsection{More accessibility keys in \pkg{graphicx}}

The \cs{includegraphics} command now accepts \verb|actualtext| and
\verb|artifact| keys, which by default do nothing but are used by the
tagging code to provide an ActualText string or a boolean flag to
indicate that the graphic is an artifact.
%
\githubissue{1552}


\section{Changes to packages in the \pkg{tools} category}

\subsection{\pkg{multicol}:\ Full support for extended marks}

In 2022 we introduced a new mark mechanism for
\LaTeX{}~\cite[p.\,76]{41:ltnews}. However, the initial implementation
covered only the standard output routine of \LaTeX{}. As a result the
extended marks were not available within columns produced with the
\pkg{multicol} package (where they would be especially useful). This
limitation has finally been lifted so that the new mechanism is now
fully supported by all of our packages.
%
\githubissue{1421}


\subsection{\pkg{array}:\ Improve preamble code for \texttt{p}, \texttt{m} and \texttt{b}}

When the preamble of a \env{tabular} or \env{array} is being built,
the arguments to \texttt{p}, \texttt{m}, or \texttt{b} columns all get
expanded several times. This is normally harmless because that
argument usually contains just an explicit dimension. However, in a
case such as \verb=p{\fpeval{15}pt}= these expansions resulted in an
error; this happened because \cs{fpeval} was expanded a few times, but
not often enough to result in a single number. This has now been
corrected: these arguments are not expanded at all. This allows for
such edge cases and also for the extensions available with the
\pkg{calc} package, such as \verb=p{\widthof{AAAAAA}}=.
%
\githubissue{1585}


\subsection{\pkg{array}:\ Fix handling of empty p-cells}

If an \cs{arraystretch} greater than \texttt{1} is used, table rows are
spread apart by placing suitable struts (invisible rules) into each
row, or in case of p-cells into each cell. If such a cell was empty
the placement of the strut was not correct so that the cell appeared
to be larger than it should have been. This has now been corrected.
%
\githubissue{1730}




\subsection[\pkg{varioref}:\ How to make \cs{reftext...}\ empty]
           {\pkg{varioref}:\ How to make \cs{reftextfaceafter}, etc.\ empty}

In the case that one wants to make a command such as
\cs{reftextfaceafter} produce truly nothing, one has to get rid of the
space that is automatically placed in front of the command by
\cs{vref}. This can be done by simply defining the command to remove
it, e.g.,
\begin{verbatim}
  \renewcommand\reftextfaceafter{\unskip}
\end{verbatim}
The \pkg{varioref} package does not test if such strings are empty,
\finalpagebreak
because that would require a lot of tests each time \cs{vref} is used,
and it would nearly always find that the text is not empty. However,
as shown above, the solution for this uncommon case is simple, and it
is now explicitly documented in the package documentation.
%
\githubissue{1622}


\section{Changes to files in the L3 programming layer}


Work on the L3 programming layer continues in parallel with
development of the rest of the \LaTeX{} kernel.  Of note for
developers is that we have integrated more code into the main
\pkg{l3kernel} bundle, and therefore into the functionality available
automatically in \LaTeX{}. Most notably, \pkg{l3benchmark}, which
provides tools for checking code performance, is now part of
\pkg{l3kernel}.

We have also extended the \pkg{color} module to recognize the Oklab
and Oklch color models; thanks to Markus Kurtz for contributing this
code. The Oklab color space
(\url{https://bottosson.github.io/posts/oklab}) is a perceptual color
space which is supported by CSS and so also by modern web browsers;
Oklch expresses the Oklab color space in cylindrical form.

%\section{Changes to files in the \pkg{cyrillic} category}

\begin{thebibliography}{9}\frenchspacing

%\fontsize{9.3}{11.3}\selectfont

\bibitem{41:Lamport}
Leslie Lamport.
\newblock \emph{{\LaTeX}: {A} Document Preparation System: User's Guide and Reference
  Manual}.
\newblock \mbox{Addison}-Wesley, Reading, MA, USA, 2nd edition, 1994.
\newblock ISBN 0-201-52983-1.
\newblock Reprinted with corrections in 1996.

\bibitem{41:ltnews} \LaTeX{} Project Team.
  \emph{\LaTeXe{} news 1--41}. June~2025.
  \url{https://latex-project.org/news/latex2e-news/ltnews.pdf}

\bibitem{41:ltmarks} Frank Mittelbach, \LaTeX{} Project Team.
  \emph{The \texttt{ltmarks.dtx} code}. June~2025.
  \url{https://latex-project.org/help/documentation/ltmarks-doc.pdf}

\bibitem{41:source2e} \LaTeX{} Project Team.
  \emph{The \LaTeXe{} Sources}. June~2025.
  \url{https://latex-project.org/help/documentation/source2e.pdf}

\end{thebibliography}

\end{document}
