From 8c590f682f900bf14e0570db531249a9e3ce07cd Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Thu, 23 Jan 2025 03:03:44 +0000
Subject: CTAN sync 202501230303

---
 .../latex/contrib/keytheorems/tex/keytheorems.sty  | 43 ++++++++++++----------
 1 file changed, 23 insertions(+), 20 deletions(-)

(limited to 'macros/latex/contrib/keytheorems/tex/keytheorems.sty')

diff --git a/macros/latex/contrib/keytheorems/tex/keytheorems.sty b/macros/latex/contrib/keytheorems/tex/keytheorems.sty
index efc25150be..4f1d145935 100644
--- a/macros/latex/contrib/keytheorems/tex/keytheorems.sty
+++ b/macros/latex/contrib/keytheorems/tex/keytheorems.sty
@@ -2,8 +2,8 @@
 % Please report all issues and feature requests at https://github.com/mbertucci47/keytheorems
 % This work is licensed under the LPPL version 1.3c or later: https://www.latex-project.org/lppl.txt
 \NeedsTeXFormat{LaTeX2e}[2023-06-01]
-\def\@keythms@date{2025-01-07}
-\def\@keythms@version{0.2.3}
+\def\@keythms@date{2025-01-21}
+\def\@keythms@version{0.2.4}
 \ProvidesExplPackage{keytheorems}{\@keythms@date}{\@keythms@version}
   {l3keys interface to amsthm}
 
@@ -1212,10 +1212,10 @@
                   \cs_new:cpe
                     { __keythms_getthm_ \l__keythms_thmuse_store_tl _body }
                     {
-                      \exp_not:N \__keythms_getthm_body:nn
+                      \exp_not:N \__keythms_getthm_body:nnn
                       \exp_args:No \exp_not:o
                         {
-                          \exp_after:wN \__keythms_use_iii_v_braced:nnnnn
+                          \exp_after:wN \__keythms_use_i_iii_v_braced:nnnnn
                             \g__keythms_thmuse_temprestatedata_tl
                         }
                     }
@@ -1243,7 +1243,7 @@
             }
         }
   }
-\cs_new:Npn \__keythms_use_iii_v_braced:nnnnn #1#2#3#4#5 { {#3}{#5} }
+\cs_new:Npn \__keythms_use_i_iii_v_braced:nnnnn #1#2#3#4#5 { {#1}{#3}{#5} }
 
 % withhooks_begin does not include prehead hook because we want to be able to access note
 \cs_new_protected:Npn \__keythms_withhooks_begin:nnn #1#2#3
@@ -1300,7 +1300,10 @@
       }
     \tl_if_empty:NF \l__keythms_thmuse_manualnum_tl
       {
-        \cs_set:cpn { the #1 } { \l__keythms_thmuse_manualnum_tl }
+        \cs_set:cpn { the #1 }
+          { % prevent expansion for unexpandable tokens in \the<counter>
+            \exp_not:N \exp_not:n { \l__keythms_thmuse_manualnum_tl }
+          }
         \cs_set_eq:cN { c@ #1 } \c@keythms_manualnum_dummyctr
         \cs_set_eq:cN { theH #1 } \theHkeythms_manualnum_dummyctr
       }
@@ -1398,11 +1401,11 @@
 
 \keys_define:nn { keytheorems/storeatbegin }
   {
-    restate  .meta:n      = { store = {#1} },
-    restate* .meta:n      = { store* = {#1} },
-    store    .tl_set:N    = \l__keythms_storeatbegin_store_tl,
-    store*   .tl_set:N    = \l__keythms_storeatbegin_storereversed_tl,
-    unknown  .code:n      = { } % do nothing with unknown keys
+    restate  .meta:n   = { store = {#1} },
+    restate* .meta:n   = { store* = {#1} },
+    store    .tl_set:N = \l__keythms_storeatbegin_store_tl,
+    store*   .tl_set:N = \l__keythms_storeatbegin_storereversed_tl,
+    unknown  .code:n   = { } % do nothing with unknown keys
   }
 
 \cs_new_protected:Npn \KeyThmsContentsLine #1 { }
@@ -1444,7 +1447,7 @@
             \cs_new_protected:cpn
               { __keythms_getthm_ \l__keythms_storeatbegin_store_tl _body }
               {
-                \__keythms_getthm_body:nn {#5}{#7}
+                \__keythms_getthm_body:nnn {#1}{#5}{#7}
               }
           }
         \tl_if_empty:NF \l__keythms_storeatbegin_storereversed_tl
@@ -1458,7 +1461,7 @@
             \cs_new_protected:cpn
               { __keythms_getthm_ \l__keythms_storeatbegin_storereversed_tl _body }
               {
-                \__keythms_getthm_body:nn {#5}{#7}
+                \__keythms_getthm_body:nnn {#1}{#5}{#7}
               }
           }
         \group_end:
@@ -1549,11 +1552,11 @@
     \group_end:
   }
 
-\cs_new_protected:Npn \__keythms_getthm_body:nn #1#2
-  { % #1 = restate counters, #2 = theorem body
+\cs_new_protected:Npn \__keythms_getthm_body:nnn #1#2#3
+  { % #1 = name, #2 = restate counters, #3 = theorem body
     \group_begin:
     \bool_set_true:N \l__keythms_thmuse_restating_bool
-    \prop_set_from_keyval:Nn \l__keythms_restate_counters_prop { #1 }
+    \prop_set_from_keyval:Nn \l__keythms_restate_counters_prop { #2 }
     \prop_map_inline:Nn \l__keythms_restate_counters_prop
       {
         \tl_set:ce { l_keythms_restate_current_##1_tl } { \the\value{##1} }
@@ -1565,9 +1568,9 @@
           { \use:c { the ##1 } . \theHkeythms_restate_dummyctr }
       }
     \refstepcounter{keythms_restate_dummyctr}
-    % \hook_use:n { keytheorems/#1/restated } % FIX!
+    \hook_use:n { keytheorems/#1/restated }
     \hook_use:n { keytheorems/allthms/restated }
-    #2
+    #3
     \prop_map_inline:Nn \l__keythms_restate_counters_prop
       {
         \exp_args:Nnc \setcounter { ##1 }
@@ -1606,10 +1609,10 @@
         \cs_new:cpe
           { __keythms_getthm_ \l__keythms_thmuse_storereversed_tl _body }
           {
-            \exp_not:N \__keythms_getthm_body:nn
+            \exp_not:N \__keythms_getthm_body:nnn
             \exp_args:No \exp_not:o
               {
-                \exp_after:wN \__keythms_use_iii_v_braced:nnnnn
+                \exp_after:wN \__keythms_use_i_iii_v_braced:nnnnn
                   \g__keythms_thmuse_temprestatedata_tl
               }
           }
-- 
cgit v1.2.3

