Skip to content

Commit

Permalink
Merge branch 'develop' into shipout-lastpage
Browse files Browse the repository at this point in the history
# Conflicts:
#	base/doc/ltnews35.tex
  • Loading branch information
FrankMittelbach committed May 8, 2022
2 parents 1fe7611 + d6c2c58 commit 31374ee
Show file tree
Hide file tree
Showing 41 changed files with 596 additions and 106 deletions.
11 changes: 11 additions & 0 deletions base/changes.txt
Expand Up @@ -5,6 +5,17 @@ It is provided for convenience only. It therefore makes no claims to
completeness or accuracy and it contains some references to files that
are not part of the distribution.
================================================================================
2022-05-08 Marcel Krüger <Marcel.Krueger@latex-project.org>

* ltmath.dtx: Use more consistent default math styles on LuaLaTeX

2022-04-13 Ulrike Fischer <Ulrike.Fischer@latex-project.org>

* ltxref.dtx:
Added starred versions of \ref, \pageref and \Ref
Added expandable version for \pageref and \ref
* ifthen.dtx:
use new expandable version for \pageref and \ref

2022-05-08 Frank Mittelbach <Frank.Mittelbach@latex-project.org>

Expand Down
39 changes: 36 additions & 3 deletions base/doc/ltnews35.tex
Expand Up @@ -455,6 +455,19 @@ \subsection{Better allocator for Lua command ids}
%
\githubissue{536}

\subsection{Starred command version for \cs{ref}, \cs{Ref} and \cs{pageref}}

For a long time \pkg{hyperref} provides starred versions for the reference commands
that don't create active links. This syntax extension required users and
package authors to check if \pkg{hyperref} was loaded and adjust the coding
accordingly or take the starrred forms out if text was copied to a document
without \pkg{hyperref}. The commands have now been aligned with
the \pkg{hyperref} usage and always allow an optional star. The \pkg{showkeys} package
has been updated to handle the starred versions too, both with \pkg{hyperref} or \pkg{nameref}
and without. The commands are defined with \cs{NewDocumentCommand} and so no longer expand when
written to auxiliary files. This reduces the number of compilations needed to resolve references
in captions and sectioning commands. The package \pkg{ifthen} has been updated to ensure that
\cs{pageref} can still be used inside tests like \cs{isodd}.



Expand Down Expand Up @@ -708,6 +721,26 @@ \subsection{Warn if \hook{shipout/lastpage} hook is executed too early}
\githubissue{813}


\subsection{More consistent use of cramped math styles in \LuaTeX}

Using \LuaTeX's \cs{Udelimiterover} to place a horizontally extensible glyph
on top of a mathematical expression now causes the expression to be set in cramped
style as used in similar situations by traditional \TeX\ math rendering.
Similarly cramped style is now used for expressions set under such a delimiter
using \cs{Uunderdelimiter} but no longer used when setting an expression on top
of such extensible glyphs using \cs{Uoverdelimiter}.
This new behavior follows \TeX's rule that cramped style is used whenever something
else appears above the expression.
Additionally the math style of these constructs can now be detected using \cs{mathstyle}.

The old behavior can be restored by adding
\begin{verbatim}
\mathdefaultsmode=0
\end{verbatim}
to a document.




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

Expand All @@ -725,8 +758,8 @@ \subsection{\pkg{amsopn}: Do not reset \cs{operator@font}}

In the unlikely event that you want the resetting to happen, use
\begin{verbatim}
\makeatletter
\def\operator@font{\mathgroup\symoperators}
\makeatletter
\def\operator@font{\mathgroup\symoperators}
\makeatother
\end{verbatim}
after loading the package.
Expand Down Expand Up @@ -772,7 +805,7 @@ \subsection{Color in formulas}
% without {{ the superscript below is misplaced
_{{\color{black} i=1}}
% without {{ the \sum is black
^{{\color{black} n}}
^{{\color{black} n}}
\color{black} % without it the x_i is red
x_i \]
\end{verbatim}
Expand Down
15 changes: 12 additions & 3 deletions base/ifthen.dtx
Expand Up @@ -42,7 +42,7 @@
%<driver>\ProvidesFile{ifthen.drv}
% \fi
% \ProvidesFile{ifthen.dtx}
[2020/11/24 v1.1c Standard LaTeX ifthen package (DPC)]
[2022/04/13 v1.1d Standard LaTeX ifthen package (DPC)]
%
% \iffalse
%<*driver>
Expand Down Expand Up @@ -80,6 +80,7 @@
% \changes{v1.0k}{1995/04/25}{Fix `driver' docstrip guards.}
% \changes{v1.0n}{1997/11/03}{Documentation fix.}
% \changes{v1.0o}{1998/08/17}{Documentation fix.}
% \changes{v1.1d}{2022/04/13}{Make reference command locally expandable.}
%
% \section{Introduction}
%
Expand Down Expand Up @@ -263,6 +264,14 @@
% macros expanding to |T| or |F| has been completely replaced by a
% simpler system using |\iftrue|, which furthermore allows lazy
% evaluation on the second pass.
% With a LaTeX 2022/06/01 we have to ensure that |\pageref| is expandable.
% \begin{macrocode}
\@ifl@t@r\fmtversion{2022/06/01}
{\def\TE@ref@exp{\let\pageref\@kernel@pageref@exp
\let\ref\@kernel@ref@exp}}
{\def\TE@ref@exp{\def\@setref##1##2##3{%
\ifx##1\relax\z@\else\expandafter##2##1\fi}}}
% \end{macrocode}
% \begin{macrocode}
\long\def\ifthenelse#1{%
% \end{macrocode}
Expand Down Expand Up @@ -295,11 +304,11 @@
% \changes{v1.0l}{1996/03/22}
% {Use \cs{begingroup} not \cs{bgroup} for latex/2105}
% \changes{v1.1a}{1999/01/07}{\cs{isundefined} added for /2824}
% \changes{v1.1d}{2022/04/13}{changed method to make \cs{pageref} and \cs{ref} locally expandable.}
% \begin{macrocode}
\begingroup
\let\protect\@unexpandable@protect
\def\@setref##1##2##3{%
\ifx##1\relax\z@\else\expandafter##2##1\fi}%
\TE@ref@exp
\def\value##1{\the\csname c@##1\endcsname}%
\let\equal\TE@equal \let\(\TE@lparen \let\)\TE@rparen
\let\isodd\TE@odd \let\lengthtest\TE@length
Expand Down
14 changes: 13 additions & 1 deletion base/ltmath.dtx
Expand Up @@ -38,7 +38,7 @@
%<*driver>
% \fi
\ProvidesFile{ltmath.dtx}
[2022/04/08 v1.2k LaTeX Kernel (Math Setup)]
[2022/05/08 v1.2l LaTeX Kernel (Math Setup)]
% \iffalse
%</driver>
%
Expand Down Expand Up @@ -1090,6 +1090,18 @@
% \end{macrocode}
% \end{macro}
%
% \changes{v1.2l}{2022/05/08}{Use consistent math styles under \LuaTeX}
% \LuaTeX\ contains new math primitives to place expression over or under
% horizontally extensible glyphs. Before \LuaTeX\ 1.14 these did not work
% correctly with the |\mathstyle| primitive and sometimes did not use
% cramped style in consistent ways. For newer version, we opt into the
% corrected behavior.
% \begin{macrocode}
\ifx\mathdefaultsmode\@undefined\else
\mathdefaultsmode=1
\fi
% \end{macrocode}
%
% \begin{macrocode}
%</2ekernel>
% \end{macrocode}
Expand Down
83 changes: 71 additions & 12 deletions base/ltxref.dtx
Expand Up @@ -33,7 +33,7 @@
%<*driver>
% \fi
\ProvidesFile{ltxref.dtx}
[2020/12/05 v1.1o LaTeX Kernel (Cross Referencing)]
[2022/04/12 v1.1p LaTeX Kernel (Cross Referencing)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltxref.dtx}
Expand Down Expand Up @@ -63,17 +63,19 @@
% {Extract file ltxref from ltcntlen.}
% \changes{v1.1b}{1994/05/21}{Use new warning commands}
% \changes{v1.1c}{1994/05/25}{Modify documentation}
% \changes{v1.1p}{2022/04/12}{Add starred variants for the ref commands}
%
% \section{Cross Referencing}
% The user writes |\label|\marg{foo} to define the following
% cross-references:
%
% |\ref|\marg{foo}: value of most recently incremented referenceable
% |\ref|*\marg{foo}: value of most recently incremented referenceable
% counter. in the current environment. (Chapter, section,
% theorem and enumeration counters are
% referenceable, footnote counters are not.)
% theorem, footnote and enumeration counters and other counters
% stepped with \cs{refstepcounter} are
% referenceable.)
%
% |\pageref|\marg{foo}: page number at which |\label{foo}| command
% |\pageref|*\marg{foo}: page number at which |\label{foo}| command
% appeared. where foo can be any string of characters not
% containing `|\|', `|{|' or `|}|'.
%
Expand All @@ -87,6 +89,10 @@
% leaving a space on both sides of it is equivalent to leaving
% a space on either side.
%
% Note: the starred versions |\ref*| and |\pageref*| are provided
% to align with the use of \pkg{hyperref}. Without \pkg{hyperref} (or some
% other package using the starred form) the star is simply ignored.
%
%
% \MaybeStop{}
%
Expand Down Expand Up @@ -206,8 +212,10 @@
% \end{macrocode}
% \begin{macro}{\ref}
% \changes{LaTeX2e}{1993/12/11}{Macro reimplemented}
% \changes{LaTeX2e}{2022/04/12}{Macro reimplemented with a starred version}
% \begin{macro}{\pageref}
% \changes{LaTeX2e}{1993/12/11}{Macro reimplemented}
% \changes{LaTeX2e}{2022/04/12}{Macro reimplemented with a starred version}
% \begin{macro}{\@setref}
% \changes{LaTeX2e}{1993/12/11}{Macro added}
% \changes{v1.1h}{1995/10/24}{Switch for refundefined renamed}
Expand All @@ -229,9 +237,43 @@
\else
\expandafter#2#1\null
\fi}
\def\ref#1{\expandafter\@setref\csname r@#1\endcsname\@firstoftwo{#1}}
\def\pageref#1{\expandafter\@setref\csname r@#1\endcsname
\@secondoftwo{#1}}
% \end{macrocode}
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2022/06/01}%
%<latexrelease> {\ref}{Add starred reference commands}%
% \end{macrocode}
% \begin{macrocode}
\def\@kernel@sref#1{\expandafter\@setref\csname r@#1\endcsname\@firstoftwo{#1}}
\def\@kernel@spageref#1{\expandafter\@setref\csname r@#1\endcsname
\@secondoftwo{#1}}
\let\@kernel@ref\@kernel@sref
\let\@kernel@pageref\@kernel@spageref
\NewDocumentCommand\ref{s}
{\IfBooleanTF{#1}{\@kernel@sref}{\@kernel@ref}}
\NewDocumentCommand\pageref{s}
{\IfBooleanTF{#1}{\@kernel@spageref}{\@kernel@pageref}}
% \end{macrocode}
% As the commands are now protected we also need expandable versions for use
% in \cs{ifthenelse}:
% \begin{macrocode}
\def\@kernel@pageref@exp#1{\csname cs_if_exist:cTF\endcsname
{r@#1}{\csname tl_item:cn\endcsname{r@#1}{2}}{0}}
\def\@kernel@ref@exp#1{\csname cs_if_exist:cTF\endcsname
{r@#1}{\csname tl_item:cn\endcsname{r@#1}{1}}{0}}
% \end{macrocode}
% \begin{macrocode}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease> {\ref}{Add starred reference commands}%
%<latexrelease>\def\ref#1{\expandafter\@setref\csname r@#1\endcsname\@firstoftwo{#1}}
%<latexrelease>\def\pageref#1{\expandafter\@setref\csname r@#1\endcsname
%<latexrelease> \@secondoftwo{#1}}
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
% \end{macrocode}
% \end{macro}
% \end{macro}
Expand Down Expand Up @@ -311,8 +353,8 @@
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2020/10/01}%
%<latexrelease> {\refstepcounter}{Add \@currentcounter}%
%<latexrelease>\IncludeInRelease{2022/06/01}%
%<latexrelease> {\Ref}{Add starred version}%
% \end{macrocode}
%
% \begin{macro}{\refstepcounter}
Expand Down Expand Up @@ -373,9 +415,14 @@
% normal \texttt{\textbackslash ref} which might spoil kerning.
% Perhaps one day this needs redoing.}
% \changes{v1.1l}{2019/08/22}{Commanded moved from \texttt{varioref.sty}}
% \changes{v1.1p}{2022/04/12}{Macro reimplemented with a starred version}%
% \begin{macrocode}
\DeclareRobustCommand\Ref[1]{\protected@edef\@tempa{\ref{#1}}%
\expandafter\MakeUppercase\@tempa}
\def\@kernel@Ref#1{\protected@edef\@tempa{\@kernel@ref{#1}}%
\expandafter\MakeUppercase\@tempa}
\def\@kernel@sRef#1{\protected@edef\@tempa{\@kernel@sref{#1}}%
\expandafter\MakeUppercase\@tempa}
\NewDocumentCommand\Ref{s}
{\IfBooleanTF{#1}{\@kernel@sRef}{\@kernel@Ref}}
% \end{macrocode}
% \end{macro}
%
Expand All @@ -385,6 +432,18 @@
% \begin{macrocode}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{2020/10/01}%
%<latexrelease> {\Ref}{Add starred version}%
%<latexrelease>\def\@currentcounter{}
%<latexrelease>\def\refstepcounter#1{\stepcounter{#1}%
%<latexrelease> \edef\@currentcounter{#1}%
%<latexrelease> \protected@edef\@currentlabel
%<latexrelease> {\csname p@#1\expandafter\endcsname\csname the#1\endcsname}%
%<latexrelease>}
%<latexrelease>\def\labelformat#1{\expandafter\def\csname p@#1\endcsname##1}
%<latexrelease>\DeclareRobustCommand\Ref[1]{\protected@edef\@tempa{\ref{#1}}%
%<latexrelease> \expandafter\MakeUppercase\@tempa}
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{2019/10/01}%
%<latexrelease> {\refstepcounter}{Add \labelformat and \Ref}%
%<latexrelease>\let\@currentcounter\@undefined
Expand Down
2 changes: 0 additions & 2 deletions base/testfiles-legacy/utf8-test-001.tlg
Expand Up @@ -26,7 +26,6 @@ LaTeX Font Info: ... okay on input line ....
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line ....
LaTeX Font Info: ... okay on input line ....
(utf8-test-001.toc
LaTeX Warning: Reference `ab^^c3^^9f' on page 1 undefined on input line ....
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <7> on input line ....
LaTeX Font Info: External font `cmex10' loaded for size
Expand Down Expand Up @@ -54,4 +53,3 @@ l. ...\showbox0
] (utf8-test-001.aux (f^^c3^^bc^^c3^^9fe^^e2^^82^^ac^^e2^^82^^ac^^e2^^82^^ac.aux)
No file ^^e2^^82^^ac^^e2^^82^^ac^^e2^^82^^ac.aux.
)
LaTeX Warning: There were undefined references.
8 changes: 6 additions & 2 deletions base/testfiles/github-0479-often.luatex.tlg
Expand Up @@ -355,9 +355,13 @@ BEGIN module: lttextcomp (....-..-..) on input line ....
Skipping module lttextcomp on input line ....
Skipping: [....-..-..] Undefine text companion symbols on input line ....
END module: lttextcomp (....-..-..) on input line ....
Applying: [....-..-..] Add \@currentcounter on input line ....
Skipping: [....-..-..] Add starred reference commands on input line ....
Applying: [....-..-..] Add starred reference commands on input line ....
Skipping: [....-..-..] Add starred version on input line ....
Applying: [....-..-..] Add starred version on input line ....
LaTeX Info: Redefining \Ref on input line ....
Applying: [....-..-..] Add \labelformat and \Ref on input line ....
LaTeX Info: Redefining \Ref on input line ....
Already applied: [....-..-..] Add \labelformat and \Ref on input line ....
Already applied: [....-..-..] Add \labelformat and \Ref on input line ....
Applying: [....-..-..] Use Hooks on input line ....
Already applied: [....-..-..] Use Hooks on input line ....
Expand Down
8 changes: 6 additions & 2 deletions base/testfiles/github-0479-often.tlg
Expand Up @@ -345,9 +345,13 @@ BEGIN module: lttextcomp (....-..-..) on input line ....
Skipping module lttextcomp on input line ....
Skipping: [....-..-..] Undefine text companion symbols on input line ....
END module: lttextcomp (....-..-..) on input line ....
Applying: [....-..-..] Add \@currentcounter on input line ....
Skipping: [....-..-..] Add starred reference commands on input line ....
Applying: [....-..-..] Add starred reference commands on input line ....
Skipping: [....-..-..] Add starred version on input line ....
Applying: [....-..-..] Add starred version on input line ....
LaTeX Info: Redefining \Ref on input line ....
Applying: [....-..-..] Add \labelformat and \Ref on input line ....
LaTeX Info: Redefining \Ref on input line ....
Already applied: [....-..-..] Add \labelformat and \Ref on input line ....
Already applied: [....-..-..] Add \labelformat and \Ref on input line ....
Applying: [....-..-..] Use Hooks on input line ....
Already applied: [....-..-..] Use Hooks on input line ....
Expand Down
8 changes: 6 additions & 2 deletions base/testfiles/github-0479-often.xetex.tlg
Expand Up @@ -345,9 +345,13 @@ BEGIN module: lttextcomp (....-..-..) on input line ....
Skipping module lttextcomp on input line ....
Skipping: [....-..-..] Undefine text companion symbols on input line ....
END module: lttextcomp (....-..-..) on input line ....
Applying: [....-..-..] Add \@currentcounter on input line ....
Skipping: [....-..-..] Add starred reference commands on input line ....
Applying: [....-..-..] Add starred reference commands on input line ....
Skipping: [....-..-..] Add starred version on input line ....
Applying: [....-..-..] Add starred version on input line ....
LaTeX Info: Redefining \Ref on input line ....
Applying: [....-..-..] Add \labelformat and \Ref on input line ....
LaTeX Info: Redefining \Ref on input line ....
Already applied: [....-..-..] Add \labelformat and \Ref on input line ....
Already applied: [....-..-..] Add \labelformat and \Ref on input line ....
Applying: [....-..-..] Use Hooks on input line ....
Already applied: [....-..-..] Use Hooks on input line ....
Expand Down
4 changes: 2 additions & 2 deletions base/testfiles/github-robust-0123.luatex.tlg
Expand Up @@ -269,9 +269,9 @@ l. ...\mruntest{ccc}
---------------------------------------
\fnsymbol{page} -> \TextOrMath {\textasteriskcentered }{*}
---------------------------------------
\pageref{foo} -> \G@refundefinedtrue{\mbox {\normalfont \bfseries ??}}\GenericWarning { }{LaTeX Warning: Reference `foo' on page 1 undefined}
\pageref{foo} -> \pageref {foo}
---------------------------------------
\ref{foo} -> \G@refundefinedtrue{\mbox {\normalfont \bfseries ??}}\GenericWarning { }{LaTeX Warning: Reference `foo' on page 1 undefined}
\ref{foo} -> \ref {foo}
---------------------------------------
\roman{page} -> i
---------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions base/testfiles/github-robust-0123.tlg
Expand Up @@ -269,9 +269,9 @@ l. ...\mruntest{ccc}
---------------------------------------
\fnsymbol{page} -> \TextOrMath {\textasteriskcentered }{*}
---------------------------------------
\pageref{foo} -> \G@refundefinedtrue{\mbox {\normalfont \bfseries ??}}\GenericWarning { }{LaTeX Warning: Reference `foo' on page 1 undefined}
\pageref{foo} -> \pageref {foo}
---------------------------------------
\ref{foo} -> \G@refundefinedtrue{\mbox {\normalfont \bfseries ??}}\GenericWarning { }{LaTeX Warning: Reference `foo' on page 1 undefined}
\ref{foo} -> \ref {foo}
---------------------------------------
\roman{page} -> i
---------------------------------------
Expand Down

0 comments on commit 31374ee

Please sign in to comment.