From 2a87e431325f7af0a6d66a87692f219e06b84557 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Mon, 23 May 2022 19:56:14 +0000
Subject: create-theorem (23may22)

git-svn-id: svn://tug.org/texlive/trunk@63379 c570f23f-e606-0410-a88d-b1316a301751
---
 .../tex/latex/create-theorem/create-theorem.sty    | 71 +++++++++++++++++++++-
 1 file changed, 68 insertions(+), 3 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/create-theorem/create-theorem.sty')

diff --git a/Master/texmf-dist/tex/latex/create-theorem/create-theorem.sty b/Master/texmf-dist/tex/latex/create-theorem/create-theorem.sty
index fefe7a6119c..8e9ab307ce5 100644
--- a/Master/texmf-dist/tex/latex/create-theorem/create-theorem.sty
+++ b/Master/texmf-dist/tex/latex/create-theorem/create-theorem.sty
@@ -13,7 +13,7 @@
 \RequirePackage{l3keys2e}
 \ProvidesExplPackage
   {create-theorem}
-  {2022/04/23} {}
+  {2022/05/22} {}
   {Initializing theorem-like environments with multilingual support}
 
 \keys_define:nn { create-theorem }
@@ -401,6 +401,69 @@
           { ##3 } { ##4 } { ##5 } { ##6 }
         \group_end:
       }
+
+    % Redefine the labelcref formats to match the numbering format
+    \cs_set:cpn { labelcref@ #1 @format } ##1##2##3
+      {
+        \group_begin:
+        \crthm_format_short_generic:nnn { \tl_use:c { g_crthm_number_style_ #2 _tl } { ##1 } } { ##2 } { ##3 }
+        \group_end:
+      }
+    \cs_set_eq:cc { labelcref@ #1 @format@first } { labelcref@ #1 @format }
+    \cs_set:cpn { labelcref@ #1 @format@second } ##1##2##3
+      {
+        \crefpairconjunction
+        \group_begin:
+        \crthm_format_short_generic:nnn { \tl_use:c { g_crthm_number_style_ #2 _tl } { ##1 } } { ##2 } { ##3 }
+        \group_end:
+      }
+    \cs_set:cpn { labelcref@ #1 @format@middle } ##1##2##3
+      {
+        \crefmiddleconjunction
+        \group_begin:
+        \crthm_format_short_generic:nnn { \tl_use:c { g_crthm_number_style_ #2 _tl } { ##1 } } { ##2 } { ##3 }
+        \group_end:
+      }
+    \cs_set:cpn { labelcref@ #1 @format@last } ##1##2##3
+      {
+        \creflastconjunction
+        \group_begin:
+        \crthm_format_short_generic:nnn { \tl_use:c { g_crthm_number_style_ #2 _tl } { ##1 } } { ##2 } { ##3 }
+        \group_end:
+      }
+
+    \crthm_define_format_long_version:nnnn { #2 } { labelcrefrange@ #1 @format } {} {}
+    \crthm_define_format_long_version:nnnn { #2 } { labelcrefrange@ #1 @format@first } {} {}
+    \cs_set:cpn { labelcrefrange@ #1 @format@second } ##1##2##3##4##5##6
+      {
+        \crefpairconjunction
+        \group_begin:
+        \crthm_format_long_generic:nnnnnn
+          { \tl_use:c { g_crthm_number_style_ #2 _tl } { ##1 } }
+          { \tl_use:c { g_crthm_number_style_ #2 _tl } { ##2 } }
+          { ##3 } { ##4 } { ##5 } { ##6 }
+        \group_end:
+      }
+    \cs_set:cpn { labelcrefrange@ #1 @format@middle } ##1##2##3##4##5##6
+      {
+        \crefmiddleconjunction
+        \group_begin:
+        \crthm_format_long_generic:nnnnnn
+          { \tl_use:c { g_crthm_number_style_ #2 _tl } { ##1 } }
+          { \tl_use:c { g_crthm_number_style_ #2 _tl } { ##2 } }
+          { ##3 } { ##4 } { ##5 } { ##6 }
+        \group_end:
+      }
+    \cs_set:cpn { labelcrefrange@ #1 @format@last } ##1##2##3##4##5##6
+      {
+        \creflastconjunction
+        \group_begin:
+        \crthm_format_long_generic:nnnnnn
+          { \tl_use:c { g_crthm_number_style_ #2 _tl } { ##1 } }
+          { \tl_use:c { g_crthm_number_style_ #2 _tl } { ##2 } }
+          { ##3 } { ##4 } { ##5 } { ##6 }
+        \group_end:
+      }
   }
 
 \cs_new:Nn \crthm_define_format_short_version:nnnn
@@ -412,7 +475,9 @@
       {
         \cs_new:cn { crthm_format_ #2 :nnn }
           {
-            { #3 } ##2 { #4 } \nobreakspace { \tl_use:c { g_crthm_number_style_ #1 _tl } { ##1 } } ##3
+            { #3 } ##2 { #4 }
+            \tl_if_blank:nF { #4 } { \nobreakspace }
+            { \tl_use:c { g_crthm_number_style_ #1 _tl } { ##1 } } ##3
           }
         \cs_set_eq:cc { #2 } { crthm_format_ #2 :nnn }
       }
@@ -427,7 +492,7 @@
         \cs_new:cn { crthm_format_ #2 :nnnnnn }
           {
             { #3 } ##3 { #4 }
-            \nobreakspace \crefrangepreconjunction
+            \tl_if_blank:nF { #4 } { \nobreakspace } \crefrangepreconjunction
             { \tl_use:c { g_crthm_number_style_ #1 _tl } { ##1 } }
             ##4 \crefrangeconjunction
             ##5 { \tl_use:c { g_crthm_number_style_ #1 _tl } { ##2 } } ##6
-- 
cgit v1.2.3

