diff --git a/base/changes.txt b/base/changes.txt index d860d4a9a..0ca3537b3 100644 --- a/base/changes.txt +++ b/base/changes.txt @@ -6,11 +6,16 @@ to completeness or accuracy and it contains some references to files that are not part of the distribution. ================================================================================ -2025-01-21 Frank Mittelbach +2025-01-23 Frank Mittelbach * ltoutput.dtx (subsection{Floats}): - Support extended syntax for \label, \index, and \glossary (gh/311) + * ltsect.dtx (subsection{Table of Contents etc.}): + Make \label, \index, and \glossary truely invisible + when typesetting (gh/1638) +2025-01-21 Frank Mittelbach + + * ltoutput.dtx (subsection{Floats}): * ltsect.dtx (subsection{Table of Contents etc.}): Support extended syntax for \label, \index, and \glossary (gh/311) diff --git a/base/doc/ltnews41.tex b/base/doc/ltnews41.tex index 998e1945c..527ed088f 100644 --- a/base/doc/ltnews41.tex +++ b/base/doc/ltnews41.tex @@ -440,6 +440,20 @@ \subsection{Process global options once per package} % \githubissue{1619} +\subsection{Make \cs{label}, \cs{index}, and \cs{glossary} truely invisible in running headers} + +\LaTeX{} had a bug since its initial implementation, in that it +correctly ignored any \cs{label}, \cs{index}, or \cs{glossary} +appearing in a mark, but neglected to handle the spaces around the +command. As a result one could end up with two spaces in the running +header when only one should be present. This was detected as part of +working on issue~311 and has now been corrected. +% +\githubissue{1638} + + + + %\section{Changes to packages in the \pkg{amsmath} category} \section{Changes to packages in the \pkg{graphics} category} diff --git a/base/ltoutput.dtx b/base/ltoutput.dtx index 009697951..3cfcd4e1a 100644 --- a/base/ltoutput.dtx +++ b/base/ltoutput.dtx @@ -30,7 +30,7 @@ %%% From File: ltoutput.dtx %\ProvidesPackage{flafter} %\ProvidesPackage{fltrace} -% [2025/01/21 v1.4l +% [2025/01/23 v1.4m % Standard LaTeX floats after reference (FMi)] % Tracing LaTeX floats algorithm (FMi)] % @@ -2201,10 +2201,13 @@ % {Move \cs{label} and \cs{index} (from patch file)} % \changes{v1.4l}{2025/01/21}{Support extended syntax % for \cs{label}, \cs{index}, and \cs{glossary} (gh/311)} +% \changes{v1.4m}{2025/01/23} +% {Make \cs{label}, \cs{index} and \cs{glossary} truely invisible +% when typesetting (gh/1638)} % \begin{macrocode} - \let\label\@gobble@om - \let\index\@gobble@som - \let\glossary\@gobble@om + \let\label\@gobble@with@sphack@om + \let\index\@gobble@with@sphack@som + \let\glossary\@gobble@with@sphack@om % \end{macrocode} % % \begin{macrocode} diff --git a/base/ltsect.dtx b/base/ltsect.dtx index 63a3d827c..c26b53e24 100644 --- a/base/ltsect.dtx +++ b/base/ltsect.dtx @@ -31,7 +31,7 @@ %%% From File: ltsect.dtx %<*driver> % \fi -\ProvidesFile{ltsect.dtx}[2025/01/21 v1.1g LaTeX Kernel (Sectioning)] +\ProvidesFile{ltsect.dtx}[2025/01/23 v1.1h LaTeX Kernel (Sectioning)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltsect.dtx} @@ -819,12 +819,10 @@ % % % -% \begin{macro}{\@gobble@om,\@gobble@som} -% Two commands that accept an optional and a mandatory argument or +% \begin{macro}{\@gobble@om,\@gobble@som,\@gobble@with@sphack@om,\@gobble@with@sphack@som} +% Four commands that accept an optional and a mandatory argument or % a star, optional and mandatory argument and then do nothing. Used % to disable commands such as \cs{index} in certain situations. -% \changes{v1.1g}{2025/01/21} -% {Support extended syntax for \cs{label}, \cs{index} and \cs{glossary} (gh/311)} % \begin{macrocode} % %<*2ekernel|latexrelease> @@ -832,10 +830,24 @@ % {\@gobble@som}{Extended index/label}% % \end{macrocode} % +% Just getting rid of the input in an expandable way is done by these two. +% \changes{v1.1g}{2025/01/21} +% {Support extended syntax for \cs{label}, \cs{index} and \cs{glossary} (gh/311)} % \begin{macrocode} \DeclareExpandableDocumentCommand\@gobble@om{+o+m}{} \DeclareExpandableDocumentCommand\@gobble@som{s+o+m}{} % \end{macrocode} +% +% When something needs to be suppress during typesetting one often +% also wants to make sure that we don't end up with two spaces (in +% case there is one before and one after). This can't happen expandably. +% \changes{v1.1h}{2025/01/23} +% {Make \cs{label}, \cs{index} and \cs{glossary} truely invisible +% when typesetting (gh/1638)} +% \begin{macrocode} +\DeclareDocumentCommand\@gobble@with@sphack@om{+o+m}{\@bsphack\@esphack} +\DeclareDocumentCommand\@gobble@with@sphack@som{s+o+m}{\@bsphack\@esphack} +% \end{macrocode} % \end{macro} % % diff --git a/base/testfiles/github-1638.lvt b/base/testfiles/github-1638.lvt new file mode 100644 index 000000000..cddb8bc0b --- /dev/null +++ b/base/testfiles/github-1638.lvt @@ -0,0 +1,22 @@ +% Showed 2 spaces in running header, but one (correct) in TOC + +\documentclass{book} + +\input{regression-test} + +\makeindex +\pagestyle{headings} + +\showoutput + +\begin{document} + +\START + +\tableofcontents + +\chapter{X \index{blub} X X} +\section{Y \label{bla} Y Y} +x \newpage x \newpage x \newpage +\OMIT +\end{document} diff --git a/base/testfiles/github-1638.tlg b/base/testfiles/github-1638.tlg new file mode 100644 index 000000000..e1e7cb45e --- /dev/null +++ b/base/testfiles/github-1638.tlg @@ -0,0 +1,334 @@ +This is a generated file for the l3build validation system. +Don't change this file in any respect. +(github-1638.toc +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <7> on input line .... +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <5> on input line .... +) +\tf@toc=\write... +Completed box being shipped out [1] +\vbox(627.36243+0.0)x380.0 +.\glue 22.0 +.\vbox(605.36243+0.0)x345.0, shifted 35.0 +..\vbox(12.0+0.0)x345.0, glue set 12.0fil +...\glue 0.0 plus 1.0fil +...\hbox(0.0+0.0)x345.0 +....\hbox(0.0+0.0)x345.0 +..\glue 18.06749 +..\glue(\lineskip) 0.0 +..\vbox(550.0+0.0)x345.0, glue set 385.99998fil +...\write-{} +...\write-{} +...\glue(\topskip) 10.0 +...\rule(0.0+0.0)x* +...\penalty 10000 +...\glue 50.0 +...\glue 0.0 +...\glue(\parskip) 0.0 plus 1.0 +...\glue(\parskip) 0.0 +...\glue(\baselineskip) 12.92955 +...\hbox(17.07045+0.0)x345.0, glue set 117.83168fil +....\hbox(0.0+0.0)x0.0 +....\OT1/cmr/bx/n/24.88 C +....\OT1/cmr/bx/n/24.88 o +....\OT1/cmr/bx/n/24.88 n +....\kern-0.77751 +....\OT1/cmr/bx/n/24.88 t +....\OT1/cmr/bx/n/24.88 e +....\OT1/cmr/bx/n/24.88 n +....\kern-0.77751 +....\OT1/cmr/bx/n/24.88 t +....\OT1/cmr/bx/n/24.88 s +....\penalty 10000 +....\glue(\parfillskip) 0.0 plus 1.0fil +....\glue(\rightskip) 0.0 plus 1.0fil +...\marks1{\__mark_value:nn {1}{\MakeUppercase []{Contents}}} +...\marks2{\__mark_value:nn {2}{\MakeUppercase []{Contents}}} +...\marks3{\__mark_value:nn {3}{\MakeUppercase []{Contents}}} +...\penalty 10000 +...\glue 40.0 +...\glue 10.00002 plus 1.0 +...\glue(\parskip) 0.0 plus 1.0 +...\glue(\parskip) 0.0 +...\glue(\baselineskip) 5.13889 +...\hbox(6.86111+0.0)x345.0, glue set 278.42523fil +....\glue(\leftskip) 15.00002 +....\glue -15.00002 +....\hbox(6.44444+0.0)x15.00002, glue set 9.25005fil +.....\OT1/cmr/bx/n/10 1 +.....\glue 0.0 plus 1.0fil +....\OT1/cmr/bx/n/10 X +....\glue 3.83331 plus 1.91473 minus 1.27904 +....\OT1/cmr/bx/n/10 X +....\glue 3.83331 plus 1.91473 minus 1.27904 +....\OT1/cmr/bx/n/10 X +....\penalty 10000 +....\glue 0.0 plus 1.0fil +....\penalty 10000 +....\hbox(6.44444+0.0)x17.82494, glue set 12.07497fil +.....\glue 0.0 plus 1.0fil minus 1.0fil +.....\OT1/cmr/bx/n/10 3 +.....\kern -1.0 +.....\kern 1.0 +....\penalty 10000 +....\glue(\parfillskip) -15.50005 +....\glue(\rightskip) 15.50005 +...\penalty 301 +...\glue 0.0 plus 0.2 +...\glue(\parskip) 0.0 plus 1.0 +...\glue(\parskip) 0.0 +...\glue(\baselineskip) 5.16669 +...\hbox(6.83331+0.0)x345.0, glue set 262.33318fill +....\glue(\leftskip) 38.00008 +....\hbox(0.0+0.0)x15.00002 +....\hbox(0.0+0.0)x0.0 +....\penalty 10000 +....\glue -38.00008 +....\hbox(6.44444+0.0)x23.00006, glue set 10.22224fil +.....\OT1/cmr/m/n/10 1 +.....\OT1/cmr/m/n/10 . +.....\OT1/cmr/m/n/10 1 +.....\glue 0.0 plus 1.0fil +....\OT1/cmr/m/n/10 Y +....\glue 3.33333 plus 1.66498 minus 1.11221 +....\OT1/cmr/m/n/10 Y +....\glue 3.33333 plus 1.66498 minus 1.11221 +....\OT1/cmr/m/n/10 Y +....\penalty 10000 +....\leaders 0.0 plus 1.0fill +.....\hbox(1.05554+0.0)x7.77766 +......\mathon +......\kern 2.49994 +......\hbox(1.05554+0.0)x2.77779 +.......\OT1/cmr/m/n/10 . +......\kern 2.49994 +......\mathoff +....\penalty 10000 +....\hbox(6.44444+0.0)x15.50005, glue set 10.50003fil +.....\glue 0.0 plus 1.0fil +.....\OT1/cmr/m/n/10 3 +.....\kern -1.0 +.....\kern 1.0 +....\penalty 10000 +....\glue(\parfillskip) -25.50006 +....\glue(\rightskip) 25.50006 +...\glue 0.0 plus 1.0fil +...\glue 0.0 +..\glue(\baselineskip) 18.8505 +..\hbox(6.44444+0.0)x345.0 +...\hbox(6.44444+0.0)x345.0, glue set 170.0fil +....\glue 0.0 plus 1.0fil +....\OT1/cmr/m/n/10 1 +....\glue 0.0 plus 1.0fil +Completed box being shipped out [2] +\vbox(627.36243+0.0)x434.0 +.\glue 22.0 +.\vbox(605.36243+0.0)x345.0, shifted 89.0 +..\vbox(12.0+0.0)x345.0, glue set 5.16669fil +...\glue 0.0 plus 1.0fil +...\hbox(6.83331+0.0)x345.0 +....\hbox(6.83331+0.0)x345.0, glue set 283.19432fil +.....\OT1/cmr/m/n/10 2 +.....\glue 0.0 plus 1.0fil +.....\OT1/cmr/m/sl/10 C +.....\OT1/cmr/m/sl/10 O +.....\OT1/cmr/m/sl/10 N +.....\OT1/cmr/m/sl/10 T +.....\OT1/cmr/m/sl/10 E +.....\OT1/cmr/m/sl/10 N +.....\OT1/cmr/m/sl/10 T +.....\OT1/cmr/m/sl/10 S +..\glue 18.06749 +..\glue(\lineskip) 0.0 +..\vbox(550.0+0.0)x0.0, glue set 540.0fil +...\write-{} +...\glue(\topskip) 10.0 +...\hbox(0.0+0.0)x0.0 +...\glue 0.0 plus 1.0fil +...\glue 0.0 +..\glue(\baselineskip) 25.29494 +..\hbox(0.0+0.0)x345.0 +...\hbox(0.0+0.0)x345.0 +Chapter 1. +Completed box being shipped out [3] +\vbox(627.36243+0.0)x380.0 +.\glue 22.0 +.\vbox(605.36243+0.0)x345.0, shifted 35.0 +..\vbox(12.0+0.0)x345.0, glue set 12.0fil +...\glue 0.0 plus 1.0fil +...\hbox(0.0+0.0)x345.0 +....\hbox(0.0+0.0)x345.0 +..\glue 18.06749 +..\glue(\lineskip) 0.0 +..\vbox(550.0+0.0)x345.0, glue set 335.09724fil +...\write1{\@writefile{toc}{\protect \contentsline {chapter}{\protect \numberline {1}X X X}{\thepage }{}\protected@file@percent }} +...\marks1{\__mark_value:nn {4}{\MakeUppercase []{Chapter\ 1. \ X \index {blub} X X}}} +...\marks2{\__mark_value:nn {5}{}} +...\write1{\@writefile{lof}{\protect \addvspace {10\p@ }}} +...\write1{\@writefile{lot}{\protect \addvspace {10\p@ }}} +...\glue(\topskip) 10.0 +...\rule(0.0+0.0)x* +...\penalty 10000 +...\glue 50.0 +...\glue 0.0 +...\glue(\parskip) 0.0 plus 1.0 +...\glue(\parskip) 0.0 +...\glue(\baselineskip) 10.59724 +...\hbox(14.40276+4.03276)x345.0, glue set 121.0941fil +....\hbox(0.0+0.0)x0.0 +....\OT1/cmr/bx/n/20.74 C +....\OT1/cmr/bx/n/20.74 h +....\OT1/cmr/bx/n/20.74 a +....\OT1/cmr/bx/n/20.74 p +....\OT1/cmr/bx/n/20.74 t +....\OT1/cmr/bx/n/20.74 e +....\OT1/cmr/bx/n/20.74 r +....\glue 7.7775 plus 3.88875 minus 2.5925 +....\OT1/cmr/bx/n/20.74 1 +....\penalty 10000 +....\glue(\parfillskip) 0.0 plus 1.0fil +....\glue(\rightskip) 0.0 plus 1.0fil +...\penalty 10000 +...\glue 20.0 +...\glue(\parskip) 0.0 plus 1.0 +...\glue(\parskip) 0.0 +...\glue(\baselineskip) 8.89679 +...\hbox(17.07045+0.0)x345.0, glue set 131.46524fil +....\hbox(0.0+0.0)x0.0 +....\OT1/cmr/bx/n/24.88 X +....\glue 9.33 plus 4.66032 minus 3.11311 +....\write3{\indexentry{blub}{\thepage }} +....\penalty 10000 +....\glue 0.0 +....\OT1/cmr/bx/n/24.88 X +....\glue 9.33 plus 4.66032 minus 3.11311 +....\OT1/cmr/bx/n/24.88 X +....\penalty 10000 +....\glue(\parfillskip) 0.0 plus 1.0fil +....\glue(\rightskip) 0.0 plus 1.0fil +...\penalty 10000 +...\glue 40.0 +...\glue(\parskip) 0.0 plus 1.0 +...\glue(\parskip) 0.0 +...\glue(\baselineskip) 8.12001 +...\hbox(9.87999+0.0)x345.0, glue set 260.60005fil +....\hbox(9.27998+0.0)x36.89995 +.....\glue 0.0 +.....\OT1/cmr/bx/n/14.4 1 +.....\OT1/cmr/bx/n/14.4 . +.....\OT1/cmr/bx/n/14.4 1 +.....\glue 16.19998 +....\OT1/cmr/bx/n/14.4 Y +....\glue 5.4 plus 2.6973 minus 1.80179 +....\write1{\newlabel{bla}{{1.1}{\thepage }{}{section.1.1}{}}} +....\penalty 10000 +....\glue 0.0 +....\OT1/cmr/bx/n/14.4 Y +....\glue 5.4 plus 2.6973 minus 1.80179 +....\OT1/cmr/bx/n/14.4 Y +....\penalty 10000 +....\glue(\parfillskip) 0.0 plus 1.0fil +....\glue(\rightskip) 0.0 +...\marks2{\__mark_value:nn {6}{\MakeUppercase []{1.1. \ Y \label {bla} Y Y}}} +...\penalty 10000 +...\marks3{\__mark_value:nn {7}{\MakeUppercase []{1.1. \ Y \label {bla} Y Y}}} +...\penalty 10000 +...\write1{\@writefile{toc}{\protect \contentsline {section}{\protect \numberline {1.1}Y Y Y}{\thepage }{}\protected@file@percent }} +...\penalty 10000 +...\penalty 10000 +...\glue 9.90276 plus 0.86108 +...\glue(\parskip) 0.0 plus 1.0 +...\glue(\parskip) 0.0 +...\glue(\baselineskip) 7.69446 +...\hbox(4.30554+0.0)x345.0, glue set 339.7222fil +....\OT1/cmr/m/n/10 x +....\penalty 10000 +....\glue(\parfillskip) 0.0 plus 1.0fil +....\glue(\rightskip) 0.0 +...\glue 0.0 plus 1.0fil +...\glue 0.0 +..\glue(\baselineskip) 18.8505 +..\hbox(6.44444+0.0)x345.0 +...\hbox(6.44444+0.0)x345.0, glue set 170.0fil +....\glue 0.0 plus 1.0fil +....\OT1/cmr/m/n/10 3 +....\glue 0.0 plus 1.0fil +Completed box being shipped out [4] +\vbox(627.36243+0.0)x434.0 +.\glue 22.0 +.\vbox(605.36243+0.0)x345.0, shifted 89.0 +..\vbox(12.0+0.0)x345.0, glue set 5.16669fil +...\glue 0.0 plus 1.0fil +...\hbox(6.83331+0.0)x345.0 +....\hbox(6.83331+0.0)x345.0, glue set 241.52763fil +.....\OT1/cmr/m/n/10 4 +.....\glue 0.0 plus 1.0fil +.....\OT1/cmr/m/sl/10 C +.....\OT1/cmr/m/sl/10 H +.....\OT1/cmr/m/sl/10 A +.....\OT1/cmr/m/sl/10 P +.....\OT1/cmr/m/sl/10 T +.....\OT1/cmr/m/sl/10 E +.....\OT1/cmr/m/sl/10 R +.....\glue 3.33333 plus 1.66666 minus 1.11111 +.....\OT1/cmr/m/sl/10 1 +.....\OT1/cmr/m/sl/10 . +.....\glue 4.44444 plus 4.99997 minus 0.37036 +.....\glue 3.33333 plus 1.66666 minus 1.11111 +.....\OT1/cmr/m/sl/10 X +.....\glue 3.33333 plus 1.66498 minus 1.11221 +.....\OT1/cmr/m/sl/10 X +.....\glue 3.33333 plus 1.66498 minus 1.11221 +.....\OT1/cmr/m/sl/10 X +..\glue 18.06749 +..\glue(\lineskip) 0.0 +..\vbox(550.0+0.0)x345.0, glue set 540.0fil +...\glue(\topskip) 5.69446 +...\hbox(4.30554+0.0)x345.0, glue set 324.7222fil +....\hbox(0.0+0.0)x15.0 +....\OT1/cmr/m/n/10 x +....\penalty 10000 +....\glue(\parfillskip) 0.0 plus 1.0fil +....\glue(\rightskip) 0.0 +...\glue 0.0 plus 1.0fil +...\glue 0.0 +..\glue(\baselineskip) 25.29494 +..\hbox(0.0+0.0)x345.0 +...\hbox(0.0+0.0)x345.0 +Completed box being shipped out [5] +\vbox(627.36243+0.0)x380.0 +.\glue 22.0 +.\vbox(605.36243+0.0)x345.0, shifted 35.0 +..\vbox(12.0+0.0)x345.0, glue set 5.16669fil +...\glue 0.0 plus 1.0fil +...\hbox(6.83331+0.0)x345.0 +....\hbox(6.83331+0.0)x345.0, glue set 287.49991fil +.....\OT1/cmr/m/sl/10 1 +.....\OT1/cmr/m/sl/10 . +.....\OT1/cmr/m/sl/10 1 +.....\OT1/cmr/m/sl/10 . +.....\glue 4.44444 plus 4.99997 minus 0.37036 +.....\glue 3.33333 plus 1.66666 minus 1.11111 +.....\OT1/cmr/m/sl/10 Y +.....\glue 3.33333 plus 1.66498 minus 1.11221 +.....\OT1/cmr/m/sl/10 Y +.....\glue 3.33333 plus 1.66498 minus 1.11221 +.....\OT1/cmr/m/sl/10 Y +.....\glue 0.0 plus 1.0fil +.....\OT1/cmr/m/n/10 5 +..\glue 18.06749 +..\glue(\lineskip) 0.0 +..\vbox(550.0+0.0)x345.0, glue set 540.0fil +...\glue(\topskip) 5.69446 +...\hbox(4.30554+0.0)x345.0, glue set 324.7222fil +....\hbox(0.0+0.0)x15.0 +....\OT1/cmr/m/n/10 x +....\penalty 10000 +....\glue(\parfillskip) 0.0 plus 1.0fil +....\glue(\rightskip) 0.0 +...\glue 0.0 plus 1.0fil +...\glue 0.0 +..\glue(\baselineskip) 25.29494 +..\hbox(0.0+0.0)x345.0 +...\hbox(0.0+0.0)x345.0