summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/create-theorem
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-05-24 03:01:29 +0000
committerNorbert Preining <norbert@preining.info>2022-05-24 03:01:29 +0000
commit0c7d079315627312627c83bc9ce6f5e4f1b436f6 (patch)
tree72e360334a6044a049939ba5fa437402e4f83ad6 /macros/latex/contrib/create-theorem
parent989493fc0cf04ec736a261d39eee40e1d7bdf4be (diff)
CTAN sync 202205240301
Diffstat (limited to 'macros/latex/contrib/create-theorem')
-rw-r--r--macros/latex/contrib/create-theorem/DEPENDS.txt1
-rw-r--r--macros/latex/contrib/create-theorem/create-theorem-doc.pdfbin120072 -> 119454 bytes
-rw-r--r--macros/latex/contrib/create-theorem/create-theorem-doc.tex3
-rw-r--r--macros/latex/contrib/create-theorem/create-theorem.sty71
4 files changed, 71 insertions, 4 deletions
diff --git a/macros/latex/contrib/create-theorem/DEPENDS.txt b/macros/latex/contrib/create-theorem/DEPENDS.txt
new file mode 100644
index 0000000000..c226a5857f
--- /dev/null
+++ b/macros/latex/contrib/create-theorem/DEPENDS.txt
@@ -0,0 +1 @@
+hard crefthe \ No newline at end of file
diff --git a/macros/latex/contrib/create-theorem/create-theorem-doc.pdf b/macros/latex/contrib/create-theorem/create-theorem-doc.pdf
index e3472c1750..f6f8fb84d5 100644
--- a/macros/latex/contrib/create-theorem/create-theorem-doc.pdf
+++ b/macros/latex/contrib/create-theorem/create-theorem-doc.pdf
Binary files differ
diff --git a/macros/latex/contrib/create-theorem/create-theorem-doc.tex b/macros/latex/contrib/create-theorem/create-theorem-doc.tex
index e6d06817e6..37c4c56edf 100644
--- a/macros/latex/contrib/create-theorem/create-theorem-doc.tex
+++ b/macros/latex/contrib/create-theorem/create-theorem-doc.tex
@@ -97,7 +97,7 @@
\begin{document}
-\def\PackageVersion{2022/04/23}
+\def\PackageVersion{2022/05/22}
\title{\createtheorempackage{}\\\smallskip\itshape Initializing theorem-like environments with multilingual support}
\author{Jinwen XU}
@@ -450,6 +450,7 @@ In each case, the two environments \texttt{idea} and \texttt{idea*} share the sa
\begin{itemize}
\item The current mechanism does not work well for German, a problem originated in the package \textsf{crefthe}. The author plans to adopt a more refined approach in a later version so as to support the various grammatical situations in German.
+ \item \createtheorempackage{} modifies some undocumented internal macros of \textsf{cleveref}, so the behaviour might not be stable if \textsf{cleveref} gets updated.
\item There may be inaccuracies in the translation of those preset names.
\end{itemize}
diff --git a/macros/latex/contrib/create-theorem/create-theorem.sty b/macros/latex/contrib/create-theorem/create-theorem.sty
index fefe7a6119..8e9ab307ce 100644
--- a/macros/latex/contrib/create-theorem/create-theorem.sty
+++ b/macros/latex/contrib/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