From 2a87e431325f7af0a6d66a87692f219e06b84557 Mon Sep 17 00:00:00 2001 From: Karl Berry 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 --- .../doc/latex/create-theorem/DEPENDS.txt | 1 + .../latex/create-theorem/create-theorem-doc.pdf | Bin 120072 -> 119454 bytes .../latex/create-theorem/create-theorem-doc.tex | 3 +- .../tex/latex/create-theorem/create-theorem.sty | 71 ++++++++++++++++++++- Master/tlpkg/tlpsrc/create-theorem.tlpsrc | 1 + 5 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/create-theorem/DEPENDS.txt diff --git a/Master/texmf-dist/doc/latex/create-theorem/DEPENDS.txt b/Master/texmf-dist/doc/latex/create-theorem/DEPENDS.txt new file mode 100644 index 00000000000..c226a5857f8 --- /dev/null +++ b/Master/texmf-dist/doc/latex/create-theorem/DEPENDS.txt @@ -0,0 +1 @@ +hard crefthe \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/create-theorem/create-theorem-doc.pdf b/Master/texmf-dist/doc/latex/create-theorem/create-theorem-doc.pdf index e3472c17507..f6f8fb84d51 100644 Binary files a/Master/texmf-dist/doc/latex/create-theorem/create-theorem-doc.pdf and b/Master/texmf-dist/doc/latex/create-theorem/create-theorem-doc.pdf differ diff --git a/Master/texmf-dist/doc/latex/create-theorem/create-theorem-doc.tex b/Master/texmf-dist/doc/latex/create-theorem/create-theorem-doc.tex index e6d06817e66..37c4c56edf8 100644 --- a/Master/texmf-dist/doc/latex/create-theorem/create-theorem-doc.tex +++ b/Master/texmf-dist/doc/latex/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/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 diff --git a/Master/tlpkg/tlpsrc/create-theorem.tlpsrc b/Master/tlpkg/tlpsrc/create-theorem.tlpsrc index e69de29bb2d..15a90b22666 100644 --- a/Master/tlpkg/tlpsrc/create-theorem.tlpsrc +++ b/Master/tlpkg/tlpsrc/create-theorem.tlpsrc @@ -0,0 +1 @@ +depend crefthe -- cgit v1.2.3