[latex3-commits] [git/LaTeX3-latex3-latex2e] options: Enable new option handling approach (73c4c208)

Joseph Wright joseph.wright at morningstar2.co.uk
Wed Jan 12 18:26:18 CET 2022


Repository : https://github.com/latex3/latex2e
On branch  : options
Link       : https://github.com/latex3/latex2e/commit/73c4c2089ccac4cf0a55bed3194d33e1eb2fccc8

>---------------------------------------------------------------

commit 73c4c2089ccac4cf0a55bed3194d33e1eb2fccc8
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Tue Nov 30 21:18:36 2021 +0000

    Enable new option handling approach


>---------------------------------------------------------------

73c4c2089ccac4cf0a55bed3194d33e1eb2fccc8
 base/changes.txt |  5 +++++
 base/ltclass.dtx | 66 +++++++++++++++++++++++++++++++++++++-------------------
 2 files changed, 49 insertions(+), 22 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index c2ffc7b4..8ae1fd7b 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -84,6 +84,11 @@ are not part of the distribution.
 
 	* All *.dtx: Replaced \StopEventually by \MaybeStop
 
+2021-11-30 Joseph Wright <joseph.wright at latex-project.org>
+
+  * ltclasses.dtx
+	New option handling routine using ltkeys
+
 2021-11-26 Joseph Wright <joseph.wright at latex-project.org>
 
   * ltkeys.dtx
diff --git a/base/ltclass.dtx b/base/ltclass.dtx
index 573cd081..43aa403b 100644
--- a/base/ltclass.dtx
+++ b/base/ltclass.dtx
@@ -33,7 +33,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltclass.dtx}
-             [2021/08/25 v1.4f LaTeX Kernel (Class & Package Interface)]
+             [2021/11/30 v1.5a LaTeX Kernel (Class & Package Interface)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltclass.dtx}
@@ -2175,27 +2175,21 @@
 %    \begin{macrocode}
   \@ifl at aded\@currext\@currname
 %    \end{macrocode}
-%    If the package is already loaded, check that there were no option
-%    clashes:
-% \changes{v1.1b}{1998/05/07}
-%         {Modify help message for latex/2805}
-%    \begin{macrocode}
-    {\@if at ptions\@currext{\@currname}{#2}{}%
-      {\@latex at error
-        {Option clash for \@cls at pkg\space \@currname}%
-        {The package \@currname\space has already been loaded
-         with options:\MessageBreak
-         \space\space[\@ptionlist{\@currname.\@currext}]\MessageBreak
-         There has now been an attempt to load it
-          with options\MessageBreak
-         \space\space[#2]\MessageBreak
-         Adding the global options:\MessageBreak
-         \space\space
-              \@ptionlist{\@currname.\@currext},#2\MessageBreak
-         to your \noexpand\documentclass declaration may fix this.%
-         \MessageBreak
-         Try typing \space <return> \space to proceed.}}%
-     \@firstofone}%
+%    In the current preferred approach, a key family name will exist for
+%    processing using \pkg{ltkeys}.In that case, we replace the previous
+%    package options with with the new ones, then call the key handler.
+%    Otherwise, we use the more classical clash handler.
+%    \begin{macrocode}
+    {%
+      \@ifundefined{opt at fam@\@currname.\@currext}
+        {\@onefilewithoptions at clashchk{#2}}
+        {%
+          \@namedef{opt@\@currname.\@currext}{#2}%
+          \expandafter\expandafter\expandafter\ProcessKeysPackageOptions
+            \expandafter\expandafter\expandafter
+              [\csname opt at fam@\@currname.\@currext\endcsname]%
+        }%
+    }%
     {\makeatletter
 %    \end{macrocode}
 %    The next line seems to be necessary for 2.09 compatibility (the
@@ -2298,6 +2292,34 @@
     \@reset at ptions}
 %    \end{macrocode}
 %
+% \begin{macro}{\@onefilewithoptions at clashchk}
+%    If the package is already loaded, check that there were no option
+%    clashes.
+% \changes{v1.1b}{1998/05/07}
+%         {Modify help message for latex/2805}
+% \changes{v1.5a}{2021/11/30}
+%         {Separated out from \cs{@onefilewithoptions}}
+%    \begin{macrocode}
+\def\@onefilewithoptions at clashchk#1
+  {\@if at ptions\@currext{\@currname}{#1}{}%
+      {\@latex at error
+        {Option clash for \@cls at pkg\space \@currname}%
+        {The package \@currname\space has already been loaded
+         with options:\MessageBreak
+         \space\space[\@ptionlist{\@currname.\@currext}]\MessageBreak
+         There has now been an attempt to load it
+          with options\MessageBreak
+         \space\space[#1]\MessageBreak
+         Adding the global options:\MessageBreak
+         \space\space
+              \@ptionlist{\@currname.\@currext},#1\MessageBreak
+         to your \noexpand\documentclass declaration may fix this.%
+         \MessageBreak
+         Try typing \space <return> \space to proceed.}}%
+     \@firstofone}
+%    \end{macrocode}
+% \end{macro}
+%
 %    \begin{macrocode}
 \let\@currpkg at reqd\@empty
 %    \end{macrocode}





More information about the latex3-commits mailing list.