[latex3-commits] [git/LaTeX3-latex3-latex2e] hotfix/gh580: raw option lists for issue #580 (b48fc2f7)
David Carlisle
d.p.carlisle at gmail.com
Sun Jun 6 19:37:52 CEST 2021
Repository : https://github.com/latex3/latex2e
On branch : hotfix/gh580
Link : https://github.com/latex3/latex2e/commit/b48fc2f7d0031bf037a6acec740b82d8dd58ae20
>---------------------------------------------------------------
commit b48fc2f7d0031bf037a6acec740b82d8dd58ae20
Author: David Carlisle <d.p.carlisle at gmail.com>
Date: Sun Jun 6 18:37:52 2021 +0100
raw option lists for issue #580
>---------------------------------------------------------------
b48fc2f7d0031bf037a6acec740b82d8dd58ae20
base/changes.txt | 11 +++++++++++
base/ltclass.dtx | 39 ++++++++++++++++++++++++++++++++++++---
base/testfiles/github-0580.lvt | 18 ++++++++++++++++++
base/testfiles/github-0580.tlg | 8 ++++++++
4 files changed, 73 insertions(+), 3 deletions(-)
diff --git a/base/changes.txt b/base/changes.txt
index 634eb0e3..f6f0a415 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -10,6 +10,17 @@ are not part of the distribution.
All changes above are only part of the development branch for the next release.
================================================================================
+#########################
+# 2020-06-01 PL1 Release
+#########################
+
+2021-06-06 David Carlisle <David.Carlisle at latex-project.org>
+
+ * ltclass.dtx: ensure raw option lists are copied in short circuit
+ loading by \LoadClassWithOptions, expand one step so
+ \CurrentOption expanded (gh #580)
+
+
#########################
# 2020-06-01 Release
#########################
diff --git a/base/ltclass.dtx b/base/ltclass.dtx
index a0ab0fa3..68a2040e 100644
--- a/base/ltclass.dtx
+++ b/base/ltclass.dtx
@@ -33,7 +33,7 @@
%<*driver>
% \fi
\ProvidesFile{ltclass.dtx}
- [2021/05/18 v1.4b LaTeX Kernel (Class & Package Interface)]
+ [2021/06/06 v1.4c LaTeX Kernel (Class & Package Interface)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltclass.dtx}
@@ -1237,10 +1237,14 @@
\csname opt@\reserved at a\endcsname
% \end{macrocode}
% Extend raw option list
+% \changes{v1.4c}{2021/06/06}
+% {apply \cs{expandafter} to raw options for gh/580}
% \begin{macrocode}
\@ifundefined{@raw at opt@#3.#1}%
- {\expandafter\gdef\csname @raw at opt@#3.#1\endcsname{#2}}%
- {\expandafter\g at addto@macro\csname @raw at opt@#3.#1\endcsname{,#2}}%
+ {\expandafter\gdef\csname @raw at opt@#3.#1\expandafter\endcsname
+ \expandafter{#2}}%
+ {\expandafter\g at addto@macro\csname @raw at opt@#3.#1\expandafter\endcsname
+ \expandafter{\expandafter,#2}}%
}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
@@ -1680,15 +1684,39 @@
%
% \begin{macro}{\@loadwithoptions}
% \changes{v1.0t}{1995/11/14}{macro added}
+% \changes{v1.4c}{2021/06/06}
+% {handle raw options for gh/580}
% Pass the current option list on to a class or package.
% |#1| is |\@|\emph{cls-or-pkg}|extension|,
% |#2| is |\RequirePackage| or |\LoadClass|,
% |#3| is the class or package to be loaded.
% \begin{macrocode}
+%</2ekernel>
+%<latexrelease>\IncludeInRelease{2021/06/01}%
+%<latexrelease> {\@loadwithoptions}{Raw option lists load with options}%
+%<*2ekernel|latexrelease>
\def\@loadwithoptions#1#2#3{%
\expandafter\let\csname opt@#3.#1\expandafter\endcsname
\csname opt@\@currname.\@currext\endcsname
+ \expandafter\let\csname @raw at opt@#3.#1\expandafter\endcsname
+ \csname @raw at opt@\@currname.\@currext\endcsname
#2{#3}}
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<latexrelease>\IncludeInRelease{0000/00/00}
+%<latexrelease> {\@loadwithoptions}{Raw option lists load with options}%
+%<latexrelease>\def\@loadwithoptions#1#2#3{%
+%<latexrelease> \expandafter\let\csname opt@#3.#1\expandafter\endcsname
+%<latexrelease> \csname opt@\@currname.\@currext\endcsname
+%<latexrelease> #2{#3}}
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
+% \end{macrocode}
+%
+% \begin{macrocode}
\@onlypreamble\@loadwithoptions
% \end{macrocode}
% \end{macro}
@@ -2234,10 +2262,15 @@
% \end{macrocode}
% \changes{v1.3u}{2020/11/20}
% {Copy option list to the requested package.}
+% \changes{v1.4c}{2021/06/06}
+% {Copy raw raw options for gh/580}
% \begin{macrocode}
\expandafter\let
\csname opt@\@currpkg at reqd\expandafter\endcsname
\csname opt@\@currname.\@currext\endcsname
+ \expandafter\let
+ \csname @raw at opt@\@currpkg at reqd\expandafter\endcsname
+ \csname @raw at opt@\@currname.\@currext\endcsname
\global\expandafter
\let\csname ver@\@currname.\@currext\endcsname\@empty
% \end{macrocode}
diff --git a/base/testfiles/github-0580.lvt b/base/testfiles/github-0580.lvt
new file mode 100644
index 00000000..d1abcb9b
--- /dev/null
+++ b/base/testfiles/github-0580.lvt
@@ -0,0 +1,18 @@
+\begin{filecontents}{class_test.cls}
+\ProvidesClass{class_test}
+\LoadClassWithOptions{article}
+\end{filecontents}
+\documentclass[twocolumn]{class_test}
+\input{test2e}
+
+
+% These should all show twocolumn (github #580)
+\makeatletter
+\START
+\typeout{Main class_test: \csname opt at class_test.cls\endcsname}
+\typeout{RAW class_test: \csname @raw at opt@class_test.cls\endcsname}
+\typeout{Main article: \csname opt at article.cls\endcsname}
+\typeout{RAW article : \csname @raw at opt@article.cls\endcsname}
+\typeout{Main class: \@classoptionslist}
+\typeout{RAW class: \@raw at classoptionslist}
+\END
\ No newline at end of file
diff --git a/base/testfiles/github-0580.tlg b/base/testfiles/github-0580.tlg
new file mode 100644
index 00000000..789c02ca
--- /dev/null
+++ b/base/testfiles/github-0580.tlg
@@ -0,0 +1,8 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+Main class_test: twocolumn
+RAW class_test: twocolumn
+Main article: twocolumn,
+RAW article : twocolumn,
+Main class: twocolumn
+RAW class: twocolumn
More information about the latex3-commits
mailing list.