% \iffalse meta-comment
%
% Copyright 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: ltnews42.tex
%
% This is issue 42 of LaTeX News.

\NeedsTeXFormat{LaTeX2e}[2020-02-02]

\documentclass{ltnews}

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

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

\usepackage[T1]{fontenc}

\usepackage{lmodern,url,hologo}

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

\providecommand\hook[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}

% issues from the tagging-project:

\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{November}
\publicationyear{2025  --- DRAFT version for upcoming release}

\publicationissue{42}

\begin{document}

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

\setlength\rightskip{0pt plus 3em}

\medskip

\section{Introduction}

\emph{to write}


\section{News from the Tagged PDF project}

\subsection{Expanding the \cs{DocumentMetadata} command}

In 2022 we introduced the \cs{DocumentMetadata} with a twofold purpose:
to provide a dedicated place for document wide settings and metadata,
and to act as a trigger command to identify documents that want to load new code.
The latter allows the use of the new, extended interfaces essential for the Tagging Project
but also useful also without tagging.

Initially, using \cs{DocumentMetadata} with an empty argument loaded only the
PDF management code and a new \pkg{hyperref} driver was used.
Since November 2024 \cs{DocumentMetadata} changes the default encoding from OT1 to
 T1; and since June 2025 it also changes the default PDF version from 1.7 to 2.0.

Additional code in latex-lab (needed, e.g., for the tagging project) had to be loaded
explicitly by using the \texttt{testphase} or the new \texttt{tagging} key in
the argument of \cs{DocumentMetadata}. Whilst this allowed for the selective loading and
testing of the new code, it also produced problems for classes and packages adapting
their code for the tagging project
since it was difficult to test which parts of the latex-lab code were active.

In this release we therefore extend \cs{DocumentMetadata} even further: it
will now load directly all the code that one get also when using the \texttt{tagging=off} or
the \texttt{testphase=latest} key.

The values \texttt{phase-I}, \texttt{phase-II}, \texttt{phase=III} of the
\texttt{testphase} key will no longer load different code variants but only
activate tagging. Extra modules not yet incorporated in the \texttt{latest} set of
modules can still be loaded by using  the \texttt{testphase} key.

For documents that want to load the PDF management but do not want the new tagging support
code we provide a dedicated package. Such documents should replace
\begin{verbatim}
\DocumentMetadata{pdfversion=1.7,
  pdfstandard=a-3b}
\end{verbatim}
by
\begin{verbatim}
\RequirePackage{pdfmanagement}
\SetKeys[document/metadata]{pdfversion=1.7,
  pdfstandard=a-3b}
\end{verbatim}


\subsection{Requiring or testing for the Tagging support code}

Classes or packages that are written only for the new code loaded by
\cs{DocumentMetadata} can use the new command \cs{NeedsDocumentMetadata} at the begin
of the class or package file. It will produce a suitable error message if
the tagging support code has not been loaded.

Classes and package that want to support both legacy documents and newer documents
using \cs{DocumentMetadata} can now use \cs{IfDocumentMetadataTF} to test whether the
new code has been loaded -- eventually in combination with a test of the date of
the format. To test whether the PDF management has been loaded, the test
\cs{IfPDFManagementActiveTF} is provided.

 
\subsection{Moving paragraph tagging into sockets}

Paragraphs in \LaTeX{} can be nested, e.g., you can have a paragraph
containing a display quote, which in turn consists of more than one
(sub)paragraph, followed by some more text which all belongs to the
same outer paragraph.

To model such \enquote{semantic paragraphs} \LaTeX{} uses a structure named 
\texttt{text-unit}\footnote{The name is under review and is likely to change in future.}
and use \texttt{text} (rolemapped to \texttt{P}) only for (portions of) 
the actual paragraph text\LaTeX{}. 

This is semantically clear and allows processors who care to identify
the complete paragraphs by looking for \texttt{text-unit} tags. 
But we got also request for an option to disable the tagging of the 
\enquote{semantic paragraphs}, so with this release we moved the relevant tagging 
code into sockets. The \enquote{semantic paragraphs} can now be disabled by 
assigning the \texttt{noop} plug to these sockets:
\begin{verbatim}
\AssignTaggingSocketPlug{para/semantic/begin}
  {noop}
\AssignTaggingSocketPlug{para/semantic/end}
  {noop}
\end{verbatim}

\subsection{Hooks for \cs{includegraphics} keys}

The three keys definitions \texttt{alt}, \texttt{actualtext} and
\texttt{artifact} used by \cs{includegraphics} contain now hooks,
named \texttt{Gin/alt}, \texttt{Gin/actualtext}, and
\texttt{Gin/artifact}\footnote{\texttt{Gin} refers to the family name
used by keys in the \pkg{graphicx} package}.  The first two are hooks
with two arguments and get as first argument the (with
\verb+\text_purify:n+) purified value of the key which is also used in
the PDF and as second argument the raw value.  The hooks are processed
even if tagging is not activated.  With them it is, for example,
possible to store the alternative text:
\begin{verbatim}
  \AddToHookWithArguments{Gin/alt}
    {\gdef\myalttext{#2}}
  \includegraphics[alt=Hello World]
    {example-image}
  The alt text of the graphic was \myalttext.
\end{verbatim}


\subsection{Symbolic structure names}

 The names of structure elements tags may be taken from the standard PDF namespaces 
 like \verb|Sect|, \verb|H1| or \verb|Figure| but they can also use alternative names 
 provided the latter are role mapped to a standard name. The second approach is useful for three reasons:
  \begin{itemize}
  \item It looks nicer, if, e.g., a bible uses tag names like \texttt{Testament} or 
  \texttt{Chapter} or \texttt{Book} instead of \texttt{Sect}.
\item It is possible to formulate additional constraints on such
  structures in a schema and thus ensure that there is no
  \texttt{Testament} inside a \texttt{Book}, something that cannot be
  done if \texttt{Sect} is used everywhere.
  \item We can provide a uniform LaTeX set of names for tags.
  \end{itemize}
  
  Currently it is difficult for document authors to change tag
  names as the tagging support code uses either a fixed name or some
  ad hoc internal variable. We therefore added three commands that
  offer an interface to declare, use and reassign
  \emph{symbolic structure names}. \verb+\NewStructureName+ takes one argument and
  declares a \emph{symbolic structure name}. The expandable command
  \verb+\UseStructureName+ takes one argument and allows to use name
  in a \cs{tagstructbegin} command. \verb+\AssignStructureRole+ allows
  to assign the symbolic structure name a role.

  In the coming months the various tag names in the tagging code will be
  replaced by such symbolic names. Once the process is finished,
  document and class authors will have a flexible tool to set up the
  tag names of their documents.


\subsection{Normalizing key names for block environments}

\emph{to write}


\subsection{Contexts in typesetting}

\emph{to write if latex-lab-context makes it to the next stage before 2025/11/01}


\subsection{MathML intent attributes}
Two new commands, \cs{MathMLintent} and \cs{MathMLarg} are added. They are defined
in the format as no-op so they may be added to command definitions in packages.
If \pkg{luamml} is enabled to generate MathML, these commands allow \emph{intent} and
\emph{arg} attributes to be specified.

A  definition such as
\begin{verbatim}
\newcommand\abs[1]{%
\MathMLintent{absolute-value($x)}
             {{\lvert\MathMLarg{x}{#1}\rvert}}%
}
\end{verbatim}
would cause \verb|\abs{y}| to generate
\begin{verbatim}
 <mrow intent="absolute-value($x)">
   <mo>|</mo><mi arg="x">y</mi><mo>|</mo>
 </mrow>
\end{verbatim}
which will allow AT to correctly read the ambiguous notation $|y|$
as  \enquote{the absolute value of y}
or some similar reading depending on the chosen language.


\subsection{Correctly handle tagging of math in tabular cells}

Mathematical content in tabular cells was not correctly tagged when a
MathML representation was automatically generated by \LuaTeX{}. Also 
tabular preambles of the form \verb=>{$}c<{$}= or \verb=>{\(}c<{\)}=
failed. This has been corrected.
%
\taggingissue[s]{973 983}



\section{New or improved commands}

\subsection{Support separate font families for script fonts}

In \TeX's math processing separate fonts can be selected for text, script and
scriptscript sizes. \LaTeX's NFSS traditionally uses the same font family at
different sizes, handling adjustment needed for making fonts appear better in a
script location through the use of optical sizes. This works great for
traditional \TeX{} fonts, but for OpenType fonts this leads to issues. OpenType
MATH assumes the font in a script location has separate features set and
therefore received specific adjustments.

To support this without relying on heuristics based on the font size, a new
command \verb+\DeclareMathScriptfontMapping+ has been added. It takes 3 pairs of
encoding/family arguments to indicate that for the first pair when used as the
math main font the second and the third should be used as the script and
scriptscript font, respectively.
%
\githubissue{1707}


\subsection[Programming support for font metafamilies]
           {Programming support for \LaTeX's font metafamilies}

\LaTeX{} knows three main document font families: \cs{rmfamily} for
the document's serifed font family, \cs{sffamily} for its sans serif
font family, and \cs{ttfamily} for its monospaced font family. In
addition, other font families can be used by the user or in a document
class or package by explicitly loading them through
\cs{fontfamily}\texttt\{\meta{name}\texttt\}\cs{selectfont}.

In some cases it is helpful to know which of the three metafamilies
(if any) is currently used for typesetting, and this information is
now made available for programmers in \cs{@currentmetafamily}. It
returns either \texttt{rm}, \texttt{sf}, \texttt{tt}, or \texttt{??} (in case
none of the metafamilies is currently used).

As a small application of this, the \LaTeX{} kernel now also contains
\cs{@restoremetafamily}. If the current metafamily is
\meta{name} it executes \cs{\meta{name}family}, e.g., \cs{sffamily},
and that then executes the hook \texttt{\meta{name}family} besides
other re-initializations. This can be useful if that hook contains
conditional code and the condition has changed and therefore requires
re-initialization.

\subsection{Recovering the argument specifier for document commands}

In \LaTeX{} News 38~\cite{42:ltnews38} we explained that we had \emph{removed}
\cs{GetDocumentCommandArgSpec} since we felt that it was only required for
debugging. However, there are some specialist use cases where access to the
argument specification is useful: see, for example,
\url{https://github.com/latex3/latex3/pull/1799}. We have therefore looked
again at this area and added a \emph{code} interface
\cs{\detokenize{cmd_arg_spec:N}} for accessing the argument specification. The
use of a code-level rather than design-level name here reflects the fact that
this is an very specialized use case, mainly of interest to package authors.

\section{Code improvements}

\subsection{Ensure that commands without arguments are not \cs{long}}

In its original implementation \cs{newcommand} or \cs{renewcommand}
always defined commands using \cs{long}\cs{def} even if the commands
had no arguments, i.e., in situations where the concept of \cs{long}
made no sense whatsoever.

The issue with that behavior is that
commands differing only in their \cs{long} status are nevertheless
considered different when compared with \cs{ifx} even if there are no
arguments to which the \cs{long} would apply. Thus, after
\verb=\renewcommand\rmdefault{lmr}= and \verb=\def\test{lmr}= the test
\verb=\ifx\test\rmdefault= would be \emph{false}, but it would be
\emph{true} if \cs{rmdefault} had been defined using \cs{def} (as many
class files do).  This made comparing commands without argument rather
difficult.
%
We have therefore changed \cs{newcommand} and friends so that
commands without arguments are always defined without using the
unnecessary \cs{long} prefix.

Going forward, this will simplify package and kernel code as the code
can reliably assume that such macros are not \cs{long}
regardless of whether they are defined by \cs{renewcommand} or \cs{def}.

There is a small chance that this is a breaking change for some
package code (though we don't know of any case), i.e., if the code
was deliberately checking against \cs{long}\cs{def} only\Dash in that
case the test now needs to be made against the definition without
\cs{long} (or against both, which is what the NFSS implementation of
the kernel did in the past).
%
\githubissue{571}



\subsection{Avoid strange warnings about font substitutions}

A font series value such as \texttt{sbc} contains both the weight
(\texttt{sb}, i.e.\ ``semibold'') and the width (\texttt{c},
i.e.\ ``condensed'') of the font. If you want to reset only one of the two to
``medium'' and keep the other, you can use \verb+\fontseries{m?}+ or
\verb+\fontseries{?m}+: The former switches \texttt{sbc} to \texttt{c}, the
latter switches \texttt{sbc} to \texttt{sb}. However, if the resulting series
does not exist, you got strange warnings in the past, e.g.:
\begin{verbatim}
LaTeX Font Warning:
Font shape `OT1/cmss/c/n' undefined
using `OT1/cmss/m?/n' instead on input line 7.
LaTeX Font Warning:
Font shape `OT1/cmss/m?/n' undefined
using `OT1/cmss/m/n' instead on input line 7.
\end{verbatim}
This has now been corrected so that you get a single, more meaningful warning:
\begin{verbatim}
LaTeX Font Warning:
Font shape `OT1/cmss/c/n' undefined
using `OT1/cmss/m/n' instead on input line 7.
\end{verbatim}
If the \texttt{m} series does not exist either, you will still get strange
warnings, but this should only affect very few fonts. The source file was
also tidied up a little on this occasion.
%
\githubissue{1727}


\subsection{Improved handling of infinite shrinkage errors}

In the June 2024 release~\cite{42:ltnews39} we described the improved
mark mechanism and the problems we had when working around \TeX's
\enquote{infinite shrinkage error}. By now the engines got a new
primitive \cs{ignoreprimitiveerror} which can be used to turn this
error into a warning, when, for example, you do only a trial splitting of
a box. This noticeably improves the output in the \texttt{.log} file
from
\begin{verbatim}
! Infinite glue shrinkage found in box being split.
<argument> Infinite shrink error above ignored !
l. ...   }
The box you are \vsplitting contains some
infinitely shrinkable glue, e.g., `\vss' or
`\vskip 0pt minus 1fil'. Such glue doesn't belong
there; but you can safely proceed, since the
offensive shrinkability has been made finite.
\end{verbatim}
to a simple
\begin{verbatim}
ignored error: Infinite glue shrinkage found in
box being split
\end{verbatim}
As an important side effect, the return code from the \TeX{} run stays at
0 (unless there are real errors); so in workflows that want to test whether
a \TeX{} run ended without errors, you don't get a bogus result
because there is no longer an ignored error.
%
\githubissue{1750}


\subsection{Allow multiple family names in \cs{ProcessKeyOptions}}

The ability to process key--value options was introduced into the kernel in the
June 2022 release~\cite{42:ltnews35}, with the command \cs{ProcessKeyOptions}
carrying out the option assignment. In the original version, this takes an
optional argument which can select one key family (namespace) for options. We
have now extended this to take a comma list of possible families.
%
\githubissue{1756}

\subsection{Control of value expansion in keys}

Normally, key--value input is treated ``as is'', with no expansion of either
key names or values. However, there are occasions when the expansion of selected
values is useful. We have now extended the key handling for templates
(\cs{DeclareInstance}, etc.) and for keys created using the L3 programming
layer to allow selective expansion. In both cases, the syntax uses a trailing
colon and a single letter specifier: these letters are those used in
\cs{ExpandArgs} or the L3 programming layer. For example, to use the values of
the \LaTeXe{} variable \cs{@itemdepth}, one could have settings
\begin{verbatim}
  key-a:c =  @itemdepth ,
  key-b:v =  @itemdepth
\end{verbatim}
This facility will \emph{automatically} be available in any package setup
macro using the L3 programming layer, for example \pkg{siunitx}.
%
\githubissue{1801}

\subsection{Support word exclusion in case changing}

Work on improving automatic case changing over previous releases has continued.
We have now added the ability to `register' words for exclusion from case
changing, using \cs{DeclareLowercaseExclusions}, \cs{DeclareTitlecaseExclusions}
and \cs{DeclareUppercaseExclusions}.


\subsection{Automatic insertion of \cs{par} tokens}
Since 2022 the major \TeX\ engines have a parameter, \cs{partokencontext},
that controls whether a \cs{par} token is added when \TeX\ is in horizontal mode
at the end of \cs{vbox} and in similar contexts. This gives more control
than the classical behavior where the internal \textit{end paragraph} routine
is invoked with no explicit token being added.

This allows the paragraph hooks to detect the end of paragraph even in
contexts such as at the end of a \cs{vbox}, where traditionally package
code has had to be modified to add an explicit \cs{par}. This is expected
to improve compatibility of existing packages with the tagging code.

\LaTeX\ now sets this parameter to 2 by default to enable automatic insertion
of \cs{par}.
%
\githubissue{1864}


\section{Bug fixes}

\subsection{Support active characters correctly with \cs{DeclareRobustCommand}}

The mechanism used by \cs{DeclareRobustCommand} creates an internal command
which has a space added to the name of the document one: so \verb*|\foo | for a
command \verb|\foo|. That fails if applied to an active character: unlike
normal commands, these have to be exactly one character long. Due to the way
the implementation works, to date this would result in redefining \verb*|\ |
every time \cs{DeclareRobustCommand} was used with an active character. This
has now been corrected: robust active characters are now created using the
engine \cs{protected} mechanism and do not use an internal auxiliary. They
still work in file names and labels to give the character itself.
%
\githubissue{345}

\subsection{Avoid a \enquote{Corrupted NFSS tables} error}

When a character with an accent is typeset, say \enquote{ä} or
\enquote{é}, it might be the case that it doesn't exist in the font
but has to be constructed from the base character and a standalone
accent. If that accent is also not available in the font then \LaTeX{}
attempts to find it in a different font, typically one in a different
encoding, e.g., \texttt{OT1}. Unfortunately, when that involved font
substitutions it resulted in a loop generating the mentioned error.
This has now been corrected by adding necessary
\cs{DeclareFontSubstitution} statements.
%
\githubissue{1709}



%\subsection{A fix}

%% Some text
%
%%\githubissue{XXXX}

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

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

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

\subsection{Updating the status of some components}

The \pkg{tools} bundle contains a range of packages with different usage
profiles. Some of these were necessary in the transition from \LaTeX{}~2.09 to
\LaTeXe{}, while others are very widely used in current documents (for example
\pkg{array}). We have therefore marked a small number of packages in
\pkg{tools} as \emph{retained only for historical and stability reasons}, and
where relevant pointed to more up-to-date alternatives; the list is:
\begin{itemize}
  \item \pkg{enumerate}: use \pkg{enumitem} instead
  \item \pkg{rawfonts}: retained as part of \LaTeX{}~2.09 support
  \item \pkg{somedefs}: retained as part of \LaTeX{}~2.09 support
  \item \pkg{theorem}: use \pkg{amsthm} instead
  \item \pkg{verbatim}: use \pkg{fancyvrb} instead
\end{itemize}

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

\begin{thebibliography}{9}\frenchspacing

%\fontsize{9.3}{11.3}\selectfont

\bibitem{42: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{42:ltnews} \LaTeX{} Project Team.
  \emph{\LaTeXe{} News 1--42}. November 2025.
  \url{https://latex-project.org/news/latex2e-news/ltnews.pdf}

\bibitem{42:ltnews35} \LaTeX{} Project Team.
  \emph{\LaTeXe{} News 35}. June 2022.
  \url{https://latex-project.org/news/latex2e-news/ltnews35.pdf}

\bibitem{42:ltnews38} \LaTeX{} Project Team.
  \emph{\LaTeXe{} News 38}. November 2023.
  \url{https://latex-project.org/news/latex2e-news/ltnews38.pdf}

\bibitem{42:ltnews39} \LaTeX{} Project Team.
  \emph{\LaTeXe{} News 39}. June 2024.
  \url{https://latex-project.org/news/latex2e-news/ltnews39.pdf}

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

\end{thebibliography}

\end{document}
