[latex3-commits] [git/LaTeX3-latex3-latex2e] gh488: fix for #488 (4f03f9b7)
Frank Mittelbach
frank.mittelbach at latex-project.org
Thu Feb 4 00:30:58 CET 2021
Repository : https://github.com/latex3/latex2e
On branch : gh488
Link : https://github.com/latex3/latex2e/commit/4f03f9b7e20e8deb9f3a54cdbd98d21b2f9b1f92
>---------------------------------------------------------------
commit 4f03f9b7e20e8deb9f3a54cdbd98d21b2f9b1f92
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date: Thu Feb 4 00:30:58 2021 +0100
fix for #488
>---------------------------------------------------------------
4f03f9b7e20e8deb9f3a54cdbd98d21b2f9b1f92
base/changes.txt | 5 ++
base/doc/ltnews33.tex | 15 ++++
base/ltboxes.dtx | 80 +++++++++++++++-------
.../tlb-latexrelease-rollback-003-often.luatex.tlg | 4 ++
.../tlb-latexrelease-rollback-003-often.tlg | 4 ++
.../tlb-latexrelease-rollback-003-often.xetex.tlg | 4 ++
base/testfiles/tlb-rollback-004-often.luatex.tlg | 2 +
base/testfiles/tlb-rollback-004-often.tlg | 2 +
base/testfiles/tlb-rollback-004-often.xetex.tlg | 2 +
9 files changed, 92 insertions(+), 26 deletions(-)
diff --git a/base/changes.txt b/base/changes.txt
index 48f9ebe6..4ed1fbe3 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -6,6 +6,11 @@ completeness or accuracy and it contains some references to files that
are not part of the distribution.
================================================================================
+2021-02-04 Frank Mittelbach <Frank.Mittelbach at latex-project.org>
+
+ * ltboxes.dtx (section{\LaTeX\ Box commands}):
+ Always add the color groups (gh/488)
+
2021-01-31 David Carlisle <David.Carlisle at latex-project.org>
* ltfilehook.dtx: set \protect to \string to avoid bad
diff --git a/base/doc/ltnews33.tex b/base/doc/ltnews33.tex
index 972909ef..d06f653b 100644
--- a/base/doc/ltnews33.tex
+++ b/base/doc/ltnews33.tex
@@ -216,6 +216,21 @@ entered directly instead of resorting to \verb=\d{m}= and so forth.
\githubissue{484}
+\subsection{Always have color groups set up}
+
+To use color in \LaTeX{} certain constructs, especially boxes, need an
+extra layer of groups to ensure that the color setting does not
+\emph{escape} and continue outside the box when it shouldn't. To
+arrange for this the \LaTeX{} defined a number of commands, e.g.,
+\cs{color at begingroup} to be used in such places. they have been
+initally no-ops and only the color packages redefined them to become
+real groups. This arrangement complicates the coding as one has to
+account for a group being there (or not there) depending of what is
+loaded in the document. So now the kernel already adds the groups.
+%
+\githubissue{488}
+
+
\subsection{\ldots}
diff --git a/base/ltboxes.dtx b/base/ltboxes.dtx
index e06f6285..752aeb9b 100644
--- a/base/ltboxes.dtx
+++ b/base/ltboxes.dtx
@@ -33,7 +33,7 @@
%<*driver>
% \fi
\ProvidesFile{ltboxes.dtx}
- [2020/12/05 v1.4a LaTeX Kernel (Box Commands)]
+ [2021/02/04 v1.4b LaTeX Kernel (Box Commands)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltboxes.dtx}
@@ -222,7 +222,7 @@
% \changes{v1.0j}{1994/10/18}
% {stuff from ltpatch done}
% \changes{v1.0p}{1994/11/09}
-% {more colour changes\ldots}
+% {more color changes\ldots}
% \changes{v1.0q}{1994/11/17}
% {\cs{@tempa} to \cs{reserved at a}}
% \changes{v1.0t}{1995/05/07}{Use \cs{hb at xt@}}
@@ -422,7 +422,7 @@
% {macro added}
% \changes{v0.1a}{1993/12/03}
% {color support}
-% This macro is initially a no-op, but the colour package will redefine
+% This macro is initially a no-op, but the color package will redefine
% it to insert a |\special|.
% \begin{macrocode}
\let\set at color\relax
@@ -431,38 +431,66 @@
%
% \begin{macro}{\color at begingroup}
% \changes{v1.0b}{1994/03/14}
-% {macro added for colour support}
+% {macro added for color support}
% \begin{macro}{\color at endgroup}
% \changes{v1.0b}{1994/03/14}
-% {macro added for colour support}
+% {macro added for color support}
% \begin{macro}{\color at setgroup}
% \changes{v1.0f}{1994/05/11}
-% {macro added for colour support}
+% {macro added for color support}
% \begin{macro}{\normalcolor}
% \changes{v1.0g}{1994/05/12}
-% {macro added for colour support}
+% {macro added for color support}
% \begin{macro}{\color at hbox}
% \changes{v1.0n}{1994/11/05}
-% {macro added for colour support}
+% {macro added for color support}
% \begin{macro}{\color at vbox}
% \changes{v1.0r}{1994/11/18}
-% {macro added for colour support}
+% {macro added for color support}
% \begin{macro}{\color at endbox}
% \changes{v1.0n}{1994/11/05}
-% {macro added for colour support}
-% These macros are initially a no-op, but the colour package will
+% {macro added for color support}
+% \changes{v1.4b}{2021/02/04}
+% {Always add the color groups (gh/488)}
+% In the past these macros were initially no-ops, and the \pkg{color}
+% package redefined
% redefine them to be |\begingroup|, |\endgroup|,
% |\begingroup\set at color|,\\ |\hbox\bgroup\color at begingroup|,
% |\color at endgroup\egroup|.
-% and \meta{set to main document colour} respectively.
+% and \meta{set to main document color} respectively.
+%
+% Nowadays we always set the group already in the kernel as this makes the
+% coding simpler.
% \begin{macrocode}
-\let\color at begingroup\relax
-\let\color at endgroup\relax
-\let\color at setgroup\relax
-\let\normalcolor\relax
-\let\color at hbox\relax
-\let\color at vbox\relax
-\let\color at endbox\relax
+%</2ekernel>
+%<*2ekernel|latexrelease>
+%<latexrelease>\IncludeInRelease{2021/05/01}%
+%<latexrelease> {\color at begingroup}{color group settings}%
+\let\color at begingroup\begingroup
+\def\color at endgroup{\endgraf\endgroup}
+\def\color at setgroup{\color at begingroup} % changed further in color package
+\let\normalcolor\relax % remains untouched; only changed in a color package
+\def\color at hbox{\hbox\bgroup\color at begingroup}
+\def\color at vbox{\vbox\bgroup\color at begingroup}
+\def\color at endbox{\color at endgroup\egroup}
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<latexrelease>\IncludeInRelease{0000/00/00}%
+%<latexrelease> {\color at begingroup}{color group settings}%
+%<latexrelease>
+%<latexrelease>\let\color at begingroup\relax
+%<latexrelease>\let\color at endgroup\relax
+%<latexrelease>\let\color at setgroup\relax
+%<latexrelease>\let\normalcolor\relax
+%<latexrelease>\let\color at hbox\relax
+%<latexrelease>\let\color at vbox\relax
+%<latexrelease>\let\color at endbox\relax
+%<latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1016,7 +1044,7 @@
%
% \begin{macro}{\@iiiminipage}
% \changes{v1.0e}{1994/04/21}
-% {Extra \cs{bgroup} for colour}
+% {Extra \cs{bgroup} for color}
% \changes{v1.0f}{1994/05/11}
% {Use new \cs{color at setgroup} concept.}
% Internal form of |minipage|.
@@ -1054,11 +1082,11 @@
% {(RmS) replaced \cs{vskip}-\cs{lastskip} by \cs{unskip}
% (proposed by FMi)}
% \changes{v1.0e}{1994/04/21}
-% {Extra \cs{egroup} for colour}
+% {Extra \cs{egroup} for color}
% \changes{v1.0f}{1994/05/11}
% {Use new \cs{color at setgroup} concept.}
% \changes{v1.0n}{1994/11/05}
-% {Colour resetting for footnotes moved to here: as for main
+% {Color resetting for footnotes moved to here: as for main
% page.}
% \begin{macrocode}
\def\endminipage{%
@@ -1093,9 +1121,9 @@
% Final |\strut| added 27 Mar 89, on suggestion by Don Hosek
% \changes{LaTeX2.09}{1991/09/29}{(RmS) added \cs{reset at font}}
% \changes{LaTeX2.09}{1992/11/26}{(RmS) added protection for \cs{edef}}
-% \changes{v0.1a}{1994/03/07}{Extra group for colour}
+% \changes{v0.1a}{1994/03/07}{Extra group for color}
% \changes{v1.0e}{1994/04/21}
-% {Extra \cs{endgraf} for colour}
+% {Extra \cs{endgraf} for color}
% \changes{v1.0f}{1994/05/11}
% {Use new \cs{color at setgroup} concept.}
% \changes{v1.0f}{1994/05/11}
@@ -1103,10 +1131,10 @@
% \changes{v1.0m}{1994/11/04}
% {Added \cs{protected at edef}. ASAJ.}
% \changes{v1.0n}{1994/11/05}
-% {Colour resetting for footnotes moved to endminipage: as for main
+% {Color resetting for footnotes moved to endminipage: as for main
% page.}
% \changes{v1.0o}{1994/11/05}
-% {Colour groups restored here.}
+% {Color groups restored here.}
% \begin{macrocode}
\long\def\@mpfootnotetext#1{%
\global\setbox\@mpfootins\vbox{%
diff --git a/base/testfiles/tlb-latexrelease-rollback-003-often.luatex.tlg b/base/testfiles/tlb-latexrelease-rollback-003-often.luatex.tlg
index 710a4efe..d8bbc9b3 100644
--- a/base/testfiles/tlb-latexrelease-rollback-003-often.luatex.tlg
+++ b/base/testfiles/tlb-latexrelease-rollback-003-often.luatex.tlg
@@ -277,6 +277,8 @@ Skipping: [....-..-..] Make \makebox robust on input line ....
Applying: [....-..-..] Make \makebox robust on input line ....
Skipping: [....-..-..] default units on input line ....
Applying: [....-..-..] default units on input line ....
+Skipping: [....-..-..] color group settings on input line ....
+Applying: [....-..-..] color group settings on input line ....
Skipping: [....-..-..] Make \savebox robust on input line ....
Applying: [....-..-..] Make \savebox robust on input line ....
Skipping: [....-..-..] Make \framebox robust on input line ....
@@ -777,6 +779,8 @@ LaTeX Info: Redefining \makebox on input line ....
Already applied: [....-..-..] Make \makebox robust on input line ....
Skipping: [....-..-..] default units on input line ....
Applying: [....-..-..] default units on input line ....
+Skipping: [....-..-..] color group settings on input line ....
+Applying: [....-..-..] color group settings on input line ....
Applying: [....-..-..] Make \savebox robust on input line ....
LaTeX Info: Redefining \savebox on input line ....
Already applied: [....-..-..] Make \savebox robust on input line ....
diff --git a/base/testfiles/tlb-latexrelease-rollback-003-often.tlg b/base/testfiles/tlb-latexrelease-rollback-003-often.tlg
index 66d5cb70..b4300ff6 100644
--- a/base/testfiles/tlb-latexrelease-rollback-003-often.tlg
+++ b/base/testfiles/tlb-latexrelease-rollback-003-often.tlg
@@ -271,6 +271,8 @@ Skipping: [....-..-..] Make \makebox robust on input line ....
Applying: [....-..-..] Make \makebox robust on input line ....
Skipping: [....-..-..] default units on input line ....
Applying: [....-..-..] default units on input line ....
+Skipping: [....-..-..] color group settings on input line ....
+Applying: [....-..-..] color group settings on input line ....
Skipping: [....-..-..] Make \savebox robust on input line ....
Applying: [....-..-..] Make \savebox robust on input line ....
Skipping: [....-..-..] Make \framebox robust on input line ....
@@ -761,6 +763,8 @@ LaTeX Info: Redefining \makebox on input line ....
Already applied: [....-..-..] Make \makebox robust on input line ....
Skipping: [....-..-..] default units on input line ....
Applying: [....-..-..] default units on input line ....
+Skipping: [....-..-..] color group settings on input line ....
+Applying: [....-..-..] color group settings on input line ....
Applying: [....-..-..] Make \savebox robust on input line ....
LaTeX Info: Redefining \savebox on input line ....
Already applied: [....-..-..] Make \savebox robust on input line ....
diff --git a/base/testfiles/tlb-latexrelease-rollback-003-often.xetex.tlg b/base/testfiles/tlb-latexrelease-rollback-003-often.xetex.tlg
index e4218d22..3ef9cd45 100644
--- a/base/testfiles/tlb-latexrelease-rollback-003-often.xetex.tlg
+++ b/base/testfiles/tlb-latexrelease-rollback-003-often.xetex.tlg
@@ -271,6 +271,8 @@ Skipping: [....-..-..] Make \makebox robust on input line ....
Applying: [....-..-..] Make \makebox robust on input line ....
Skipping: [....-..-..] default units on input line ....
Applying: [....-..-..] default units on input line ....
+Skipping: [....-..-..] color group settings on input line ....
+Applying: [....-..-..] color group settings on input line ....
Skipping: [....-..-..] Make \savebox robust on input line ....
Applying: [....-..-..] Make \savebox robust on input line ....
Skipping: [....-..-..] Make \framebox robust on input line ....
@@ -770,6 +772,8 @@ LaTeX Info: Redefining \makebox on input line ....
Already applied: [....-..-..] Make \makebox robust on input line ....
Skipping: [....-..-..] default units on input line ....
Applying: [....-..-..] default units on input line ....
+Skipping: [....-..-..] color group settings on input line ....
+Applying: [....-..-..] color group settings on input line ....
Applying: [....-..-..] Make \savebox robust on input line ....
LaTeX Info: Redefining \savebox on input line ....
Already applied: [....-..-..] Make \savebox robust on input line ....
diff --git a/base/testfiles/tlb-rollback-004-often.luatex.tlg b/base/testfiles/tlb-rollback-004-often.luatex.tlg
index c203dad4..43c6e6b9 100644
--- a/base/testfiles/tlb-rollback-004-often.luatex.tlg
+++ b/base/testfiles/tlb-rollback-004-often.luatex.tlg
@@ -623,6 +623,8 @@ LaTeX Info: Redefining \makebox on input line ....
Already applied: [....-..-..] Make \makebox robust on input line ....
Skipping: [....-..-..] default units on input line ....
Applying: [....-..-..] default units on input line ....
+Skipping: [....-..-..] color group settings on input line ....
+Applying: [....-..-..] color group settings on input line ....
Applying: [....-..-..] Make \savebox robust on input line ....
LaTeX Info: Redefining \savebox on input line ....
Already applied: [....-..-..] Make \savebox robust on input line ....
diff --git a/base/testfiles/tlb-rollback-004-often.tlg b/base/testfiles/tlb-rollback-004-often.tlg
index 3c86f5fc..aad5bf87 100644
--- a/base/testfiles/tlb-rollback-004-often.tlg
+++ b/base/testfiles/tlb-rollback-004-often.tlg
@@ -611,6 +611,8 @@ LaTeX Info: Redefining \makebox on input line ....
Already applied: [....-..-..] Make \makebox robust on input line ....
Skipping: [....-..-..] default units on input line ....
Applying: [....-..-..] default units on input line ....
+Skipping: [....-..-..] color group settings on input line ....
+Applying: [....-..-..] color group settings on input line ....
Applying: [....-..-..] Make \savebox robust on input line ....
LaTeX Info: Redefining \savebox on input line ....
Already applied: [....-..-..] Make \savebox robust on input line ....
diff --git a/base/testfiles/tlb-rollback-004-often.xetex.tlg b/base/testfiles/tlb-rollback-004-often.xetex.tlg
index ba45bce7..e0b72d5c 100644
--- a/base/testfiles/tlb-rollback-004-often.xetex.tlg
+++ b/base/testfiles/tlb-rollback-004-often.xetex.tlg
@@ -612,6 +612,8 @@ LaTeX Info: Redefining \makebox on input line ....
Already applied: [....-..-..] Make \makebox robust on input line ....
Skipping: [....-..-..] default units on input line ....
Applying: [....-..-..] default units on input line ....
+Skipping: [....-..-..] color group settings on input line ....
+Applying: [....-..-..] color group settings on input line ....
Applying: [....-..-..] Make \savebox robust on input line ....
LaTeX Info: Redefining \savebox on input line ....
Already applied: [....-..-..] Make \savebox robust on input line ....
More information about the latex3-commits
mailing list.