LATEX News
Issue 38, November 2023 (LATEX release 2023-11-01)

Contents
News from the “LATEX Tagged PDF” project
Approaching an important milestone . . . . . .
A GitHub repository dedicated to the project .

111

Hooks, sockets and plugs

1Document properties and cross-referencing

2

New or improved commands
Testing for the LATEX3 programming layer
version: \IfExplAtLeastTF . . . . . . . .

3

Code improvements
Support for tabs in \verb* and verbatim* . .
Improved argument checking for box commands
Aligning status of tilde with other active
characters . . . . . . . . . . . . . . . . . .
In the programming layer . . . . . . . . . . . .

3
3
3

Removed kernel commands

4

Changes to packages in the tools category
longtable: correct p-column definition . . . . . .

4
4

3

3
4

News from the “LATEX Tagged PDF” project
The multi-year project to automatically tag LATEX
documents in order to make them accessible [3] isprogressing steadily (at this point in time mainly as
experimental latex-lab code).
Just recently we added support for automatic tagging
of tabular structures including environments fromtabularx and longtable. The code is still in its earlystages and lacks configuration possibilities—these will
be added in the future.
Approaching an important milestone
Nevertheless, with this new addition we are more or lessable to automatically tag any document that confines
itself to the commands and environments described in
Leslie Lamport’s LATEX Manual [1] by simply adding asingle configuration line at the top.
In addition, a number of extension packages that
go beyond Lamport are already supported, mostimportantly perhaps amsmath (providing extended
math capabilities) and hyperref (enhancing LATEXwith interactive hyperlinking features). Also alreadysupported are some of the major bibliography support
packages such as natbib and biblatex.
For now activation is done through the line
\DocumentMetadata{testphase={phase-III,math,table}}
The math and the tabular support are not yet
incorporated into phase-III but need their own
activation, so that we can better experiment withadditions and code adjustments.
The latex-lab bundle contains various (still untagged) documentation files about the new code thatcan be accessed with texdoc -l latex-lab.
A GitHub repository dedicated to the project
We have also started a new GitHub repository mainly
intended for reporting issues, and offering a platform
for discussions. For example, there is one discussion
on ways to extend the LATEX tabular syntax to allow
describing the logical structure of tables (e.g., whichcells are header cells, etc.).
Having all issues and discussions related to the projectin a single place instead of being spread across multiple
repositories such as latex2e, latex3, tagpdf, hyperref,
pdfresources, etc., helps people to find information
easily and report any issue related to the project
without needing to know in which code repository the
problematic code resides.
You find this repository at https://github.com/
latex3/tagging-project and the mentioned discussion
on tabular syntax at https://github.com/latex3/
tagging-project/discussions/1.
Your feedback is important and reporting what
doesn’t yet work is beneficial to all users, so we hope
to see you there and thank you for any contribution,
whether it is an issue or a post on a discussion thread.

Hooks, sockets and plugs
In previous releases of LATEX we introduced the general
concept of hooks (both specific and generic ones). Theseare places in the code into which different packages(or the user in the document preamble) can safely
add their own code to extend the functionality ofexisting commands and environments without the need
to overwrite or patch them in incompatible ways. An
important feature of such hooks is that the code chunks
added by different packages can be ordered by rules,
if necessary, thereby avoiding problems arising fromLATEX News, and the LATEX software, are brought to you by the LATEX Project Team; Copyright 2023, all rights reserved.

differences in package loading order. See LATEX Newsissues 32–34 [2] for more information.
However, sometimes you need a kind of “hook” into
which only a single chunk of code is placed at any time.1
For example, there is code that implements footnote
placement in relation to bottom floats (above or belowthem). But at any time in the document only one suchplacement code can be in force. Or consider the extra
code needed for making LATEX documents accessible(e.g., adding tags to the PDF output). Such code iseither there (perhaps in alternative versions) or not at
all, but it cannot have code from other packages addedat the same point interfering with the algorithm.
For these use cases we now introduce the concept ofsockets and plugs. A socket is a place in the code into
which one can put a plug (a chunk of code with a name)after which the socket is in use; to put in a different
plug, the former one has to be taken out first.2 A socket
may or may not have inputs that can then be used by
the plugs. While this is technically not much different
to putting a command in the code and at some point
alter its definition, the advantage is that this offersa consistent interface, allows for status information,
supports tracing, etc.
You declare a new socket and possibly some plugs forit with\NewSocket{⟨socket name⟩}{⟨# of inputs⟩}\NewSocketPlug{⟨socket name⟩}{⟨plug name⟩}{⟨code⟩}
For example, after the declaration \NewSocket{foo}{0}
you can immediately use this socket in your codewith \UseSocket{foo}. The \NewSocket declaration
automatically defines a simple plug with the namenoop for the socket and assigns it to the socket (plugs
it in), thus your \UseSocket sits idle doing nothing3
until you assign it a different plug, which is done with
\AssignSocketPlug. This takes the current plug out
and puts the new one in. All the declarations andcommands are also available in the LATEX3 programminglayer as \socket_new:nn, \socket_new_plug:nnn, etc.
With this concept we can, for example, add tagging
support for the “LATEX Tagged PDF” project to various
packages without altering their behavior if the tagging
code is inactive. Activating one or the other form oftagging then just means to assign named plugs to thedifferent sockets.
This is just a brief introduction to the mechanism; for more detailed documentation see texdoc
ltsockets-doc.

Document properties and cross-referencing
Traditional LATEX uses \label{⟨key⟩} to record thevalues of two “local” properties of the document: thetextual representations of the current page number
and the current \ref value set by \refstepcounterdeclarations [1, p. 209]. (These declarations are issued,
for example, by sectioning commands, by numberedenvironments like equation, and by \item in an
enumerate or similar environment.)
These two recorded values can then be accessed andtypeset (from anywhere in the next run of the document)by use of the (non-expandable) commands \ref and\pageref using the key that was specified as theargument to \label when recording these values. This
supported basic cross-referencing (within a document),
using these recorded values to provide both page-related
and counter-related information (such as the page xvii
or the subsection number 4.5.2).4
Over the years LATEX packages have appeared that
extend this basic “label-ref system” in various ways.
For example, the refcount package made a small but
significant change to the functions used to accessrecorded values, by making them expandable. And
the smart-ref package supports the storage of a larger
collection of counter values so that, for example, a crossreference can refer to the relevant chapter together withan equation tag. The cleveref package stores (by meansof a second, internal “logical label”) extra informationsuch as the name of the counter. The hyperref package
adds the \autoref command, which tries to retrieve
the name of a counter from the logical name used for alink target. The tikzmarks library records information
about labelled positions on the page when using tikz.
Finally, the zref package implements many related
ideas, including a general idea of properties and lists ofproperties, with methods to record, and subsequently
access, the value of any declared property.
Starting with this release, the LATEX kernel provides
handling of general document properties as a corefunctionality with standard interfaces. This is based on
concepts introduced by the zref package but with somedifferences in detail, particularly in the implementation.
It supports the declaration of new properties, and therecording of the values of any list of properties. These
values are retrieved expandably.
To set up a new property that is the current chapter
number, for example, here is the declaration to use.
\NewProperty{chapter}{now}{?}{\thechapter}1 While this is in theory possible to model with the existing hookmechanism, it is inefficient and cumbersome.
2 Think of electric outlets and plugging something into them.
3 Sockets with one input also define an identity plug and initially assign that to the socket—this means that their input is simply returned without processing.

4 In the Spring 2023 release of L
AT X, the \label command wasEextended to record, in addition, both a title (such as the text used
in a section head) and the logical name used for an associated linktarget provided these have been set by packages such as namerefor hyperref.

–2

The second argument means that the property value will
be recorded immediately (“now”), and not “during thenext \shipout”. The third argument sets a default to be
used when, for example, an unknown label is supplied.
The final argument contains the code that will, as partof the recording process, be expanded to obtain thevalue to record for this property.
Then, to record the value of this new property,
together with others, use this command.
\RecordProperties{mylabel}{chapter,page,label}This records the current values for the properties
chapter, page, and label, using mylabel as the label,or key, for the record.
To reference (i.e., retrieve) this recorded value
for use in a cross-reference to this chapter, use the\RefProperty command with two arguments: the label,or key, and the property.
\RefProperty{mylabel}{chapter}
The LATEX kernel itself contains declarations for some
generally useful properties, including these:label the textual representation of the current \refvalue, see above;
page the textual representation of the page number forthe page currently under construction;
title the title, if set by, e.g., nameref;target the logical name of the associated link target, if
set by, e.g., hyperref;
pagetarget the logical name of the target added byhyperref at the origin of each shipped out page;
pagenum the value of the LATEX counter page in Arabic
numerals;abspage the absolute page number of the page underconstruction, i.e., one more than the number of pages
shipped out so far (thus it starts at 1 and is increasedby 1 whenever a page is shipped out);
counter the name of the counter that produced thecurrent \ref value, i.e., the counter that was stepped in
the most recent \refstepcounter within the current
scope;
xpos, ypos the position on the shipped out page as set
by the most recent \pdfsavepos: recording theseproperties should be done as soon as possible aftersaving the position.
Both LATEX 2ε commands (using camel-case names)and LATEX3 programming layer commands are provided.
For a more complete documentation, see texdoc
ltproperties-doc.

New or improved commands
Testing for the LATEX3 programming layer version:\IfExplAtLeastTF
The integration of expl3 (the LATEX3 programminglayer) into the kernel means that programmers can use
all of the features available without needing to load
it explicitly. However, as expl3 is upgraded separatelyfrom LATEX 2ε and is not a separate package, itsversion is different from that of LATEX 2ε and cannot be
tested using \IfPackageAtLeastTF. To date, low-level
methods have therefore been needed to check for theavailability of features in expl3. We have now added\IfExplAtLeastTF as a test working in the same way
as \IfPackageAtLeastTF but focused on the pre-loaded
programming layer. Programmers can check the date of
expl3 they are using in the .log, as it appears both at
the start and end in the format
L3 programming layer <YYYY-MM-DD>
just after the line which identifies the format (LaTeX2e,etc.).
(github issue 1004)

Code improvements
Support for tabs in \verb* and verbatim*
LATEX converts a single tab to a single space, which isthen treated like a “real” space in typesetting. The samehas been true to date inside \verb, but was done in a
way that meant that they remained as normal spaces
even in \verb*, etc. We have now adjusted the code sothat tabs are retained within the argument to \verb and\verb*, and the verbatim and verbatim* environments,
independently from spaces, and are set up to print in thesame way spaces do. This means that they now generate
visible spaces inside \verb* and verbatim*, and their
behavior can be adjusted if required to be different fromthat of spaces.
(github issue 1085)
Improved argument checking for box commands
Previously if an alignment option had an unexpectedvalue, such as \makebox[4cm][x]{text}, no warning
was given but the box content was silently discarded.
This will now produce a warning and act like the default
c alignment. \framebox and \parbox have a similarchange.
(github issue 1072)
Aligning status of tilde with other active characters
Some time ago we revised the definition of active
characters in pdfTEX to allow the full range of UTF-8
codepoints to be used in for example labels, file names,
etc. However, ~ was not changed at that point as it isactive independent of the engine in use. This has now
been corrected: the definition of ~ is an engine-protected
one which gives the string version of the character ifused inside a csname.
–3In the programming layer
In the programming layer (expl3), we have revised the
behavior of the titlecasing function to enable this toeither titlecase only the first word of the input, or totitlecase every word. This should be transparent at the
document level but will be useful for programmers.
We have also added the ability to define variables
and functions inside \fpeval (at the expl3 level thisis \fp_eval:n). This allows programmers to create
non-standard functions that can then be used inside\fpeval. For example, this could be used to create a
new function dinner:

Changes to packages in the tools category\ExplSyntaxOn\fp_new_variable:n{duck}\fp_new_function:n{dinner}\fp_set_function:nnn{dinner}{duck}{duck - 0.25 * duck}\fp_set_variable:nn{duck}{1}$\fp_eval:n{duck}>\fp_eval:n{dinner(duck)}\fp_set_variable:nn{duck}{dinner(duck)}>\fp_eval:n{dinner(duck)}\fp_set_variable:nn{duck}{dinner(duck)}>\fp_eval:n{dinner(duck)}\fp_set_variable:nn{duck}{dinner(duck)}>\fp_eval:n{dinner(duck)}$\ExplSyntaxOff[1] Leslie Lamport. LATEX: A Document Preparation
System: User’s Guide and Reference Manual.
Addison-Wesley, Reading, MA, USA, 2nd edition,
1994. ISBN 0-201-52983-1. Reprinted withcorrections in 1996.

longtable: correct p-column definition
In general the longtable implementation follows the arrayusage but the package didn’t take over a change made1992 in array which adjusted the handling of the strut
inserted at the begin of p-columns. As a consequence
there are a number of inconsistencies in the output of
p-columns between tabular and longtable. This has beencorrected; longtable now uses for the strut the samedefinition as array.
(github issue 1128)

References[2] LATEX Project Team. LATEX 2ε news 1–38.
https://latex-project.org/news/
latex2e-news/ltnews.pdf[3] Frank Mittelbach and Chris Rowley. LATEX Tagged
PDF—A blueprint for a large project.
https://latex-project.org/publications/indexbyyear/2020/

The computation above would then generate
1 > 0.75 > 0.5625 > 0.421875 > 0.31640625
Users will be able to access added functions without
needing to use the expl3 layer. It is possible that a
future release of LATEX will add the ability to create andset floating point variables at the document level: thiswill be examined based on feedback on the utility of the
programming layer change.

Removed kernel commands
It is very rare that commands are removed fromthe LATEX kernel. However, in this release we haveelected to remove \GetDocumentCommandArgSpec,\GetDocumentEnvironmentArgSpec,\ShowDocumentCommandArgSpec and\ShowDocumentEnvironmentArgSpec from the kernel. These commands have been moved back to the“stub” xparse provided in l3packages. The reason forthis change is that the removed commands exposed
implementation details. They were essentially debugging
tools which with hindsight should not have been madeavailable directly in the kernel.
–4