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

Joseph Wright joseph.wright at morningstar2.co.uk
Tue Nov 30 22:19:09 CET 2021


Repository : https://github.com/latex3/latex2e
On branch  : options
Link       : https://github.com/latex3/latex2e/commit/6d00e4f978b459ff7d24148febbafd1454d00ae9

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

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

    Enable new option handling approach


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

6d00e4f978b459ff7d24148febbafd1454d00ae9
 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 d173e3ee..76f746d2 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-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 06e0f437..07c55da3 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.