diff options
author | Karl Berry <karl@freefriends.org> | 2024-02-20 21:05:57 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-02-20 21:05:57 +0000 |
commit | c44e1221e52cad1082ac77f9a8e7d4a8fef6da63 (patch) | |
tree | c60f8fd8f36b146dff24258ef4a81dbb6d8bf590 | |
parent | afaca2c1348d9e7ee7199b1ea219ecc1c959d1cf (diff) |
create-theorem (20feb24)
git-svn-id: svn://tug.org/texlive/trunk@70020 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/create-theorem/README.md | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/create-theorem/create-theorem-doc.pdf | bin | 88000 -> 88400 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/create-theorem/create-theorem-doc.tex | 8 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/create-theorem/create-theorem.sty | 50 |
4 files changed, 42 insertions, 18 deletions
diff --git a/Master/texmf-dist/doc/latex/create-theorem/README.md b/Master/texmf-dist/doc/latex/create-theorem/README.md index c731811c3dd..90ae54948b6 100644 --- a/Master/texmf-dist/doc/latex/create-theorem/README.md +++ b/Master/texmf-dist/doc/latex/create-theorem/README.md @@ -1,4 +1,4 @@ -<!-- Copyright (C) 2021-2023 by Jinwen XU --> +<!-- Copyright (C) 2021-2024 by Jinwen XU --> # `create-theorem` - Initializing and configuring theorem-like environments, with multilingual support 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 Binary files differindex 7f2154adcb2..6534126f296 100644 --- a/Master/texmf-dist/doc/latex/create-theorem/create-theorem-doc.pdf +++ b/Master/texmf-dist/doc/latex/create-theorem/create-theorem-doc.pdf 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 c61a73a87ef..888767dad79 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 @@ -107,13 +107,13 @@ \begin{document} -\def\PackageVersion{2023/07/23} +\def\PackageVersion{2024/02/20} \def\PackageSubVersion{} \title{\createtheorempackage{}\\\smallskip\itshape Initializing and configuring theorem-like environments, with multilingual support} \author{Jinwen XU} \thanks{Corresponding to: \texttt{\createtheorempackage{} \PackageVersion\PackageSubVersion}} -\date{\TheDate{\PackageVersion}[only-year-month], in Beijing} +\date{\TheDate{\PackageVersion}[only-year-month], in Paris} \maketitle @@ -725,7 +725,9 @@ The configuration using \lstinline|\NameTheorems| is compatible with that using \section{Known issues} \begin{itemize} - \item \createtheorempackage{} modifies some undocumented internal macros of \textsf{cleveref}, so the behaviour might not be stable if \textsf{cleveref} gets updated. + \item \createtheorempackage{} modifies some undocumented internal macros of \textsf{cleveref}, so the behavior might not be stable if \textsf{cleveref} gets updated one day. + \item The current naming mechanism for theorems essentially follows the syntax of \textsf{cleveref}. The configuration may look somewhat redundant. In a future version, a new mechanism is planed to be introduced, which would be similar to the method used by \textsf{zref-clever}. + \item It is current not possible to temporarily change the referencing type when referencing, which makes it difficult to reference a \textquote{\texttt{namedtheorem}}, or if you have both the singular and plural form of an environment, say \textquote{\texttt{example}} and \textquote{\texttt{examples}}, they would be referred to as two separate types. \item The counter aliasing function is still not perfect, (sometimes) causing incorrect ordering in the result of \lstinline|\cref|. \item There might 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 a488ad7bc34..d8e2ffbc35f 100644 --- a/Master/texmf-dist/tex/latex/create-theorem/create-theorem.sty +++ b/Master/texmf-dist/tex/latex/create-theorem/create-theorem.sty @@ -1,5 +1,5 @@ %% -%% Copyright (C) 2021-2023 by Jinwen XU +%% Copyright (C) 2021-2024 by Jinwen XU %% ------------------------------------ %% %% This file may be distributed and/or modified under the conditions of @@ -12,7 +12,7 @@ \NeedsTeXFormat{LaTeX2e}[2022-06-01] \ProvidesExplPackage {create-theorem} - {2023/07/23} {} + {2024/02/20} {} {Initializing theorem-like environments with multilingual support} \keys_define:nn { create-theorem } @@ -346,7 +346,8 @@ } % Redefine the cref formats so that definite articles are placed outside the hyperlinks - \crthm_define_format_short_version:nnnn { #2 } { #4 ref@ #1 @format } + \crthm_modify_format_according_to_nameinlink:nnn + { \crthm_define_format_short_version:nnnn { #2 } { #4 ref@ #1 @format } } { \tl_use:c { g_crthm_name_ #4 ref_article_singular_ #2 _ #3 _tl } } { \bool_if:NTF \g__crefthe_has_prep_bool @@ -357,7 +358,8 @@ \tl_use:c { g_crthm_name_ #4 ref_singular_ #2 _ #3 _tl } } } - \crthm_define_format_short_version:nnnn { #2 } { #4 ref@ #1 @format@first } + \crthm_modify_format_according_to_nameinlink:nnn + { \crthm_define_format_short_version:nnnn { #2 } { #4 ref@ #1 @format@first } } { \tl_use:c { g_crthm_name_ #4 ref_article_plural_ #2 _ #3 _tl } } { \bool_if:NTF \g__crefthe_has_prep_bool @@ -390,7 +392,8 @@ \group_end: } - \crthm_define_format_long_version:nnnn { #2 } { #4 refrange@ #1 @format } + \crthm_modify_format_according_to_nameinlink:nnn + { \crthm_define_format_long_version:nnnn { #2 } { #4 refrange@ #1 @format } } { \tl_use:c { g_crthm_name_ #4 ref_article_plural_ #2 _ #3 _tl } } { \bool_if:NTF \g__crefthe_has_prep_bool @@ -401,7 +404,8 @@ \tl_use:c { g_crthm_name_ #4 ref_plural_ #2 _ #3 _tl } } } - \crthm_define_format_long_version:nnnn { #2 } { #4 refrange@ #1 @format@first } + \crthm_modify_format_according_to_nameinlink:nnn + { \crthm_define_format_long_version:nnnn { #2 } { #4 refrange@ #1 @format@first } } { \tl_use:c { g_crthm_name_ #4 ref_article_plural_ #2 _ #3 _tl } } { \bool_if:NTF \g__crefthe_has_prep_bool @@ -507,11 +511,26 @@ } } +\cs_new:Nn \crthm_modify_format_according_to_nameinlink:nnn + % #1 = the macro (and argument) to be used + % #2 = content always before the hyperlink beginning mark + % #3 = content before or after the hyperlink beginning mark, depending on whether nameinlink=true + { + \bool_if:NTF \l__crthm_nameinlink_bool + { + #1 { #2 } { #3 } + } + { + #1 { #2 #3 \nobreakspace } { } + } + } + \cs_new:Nn \crthm_define_format_short_version:nnnn - { % #1 = name of the environment - % #2 = name of the format command - % #3 = content before the hyperlink beginning mark - % #4 = content after the hyperlink beginning mark + % #1 = name of the environment + % #2 = name of the format command + % #3 = content before the hyperlink beginning mark + % #4 = content after the hyperlink beginning mark + { \cs_if_exist:cF { crthm_format_ #2 :nnn } { \cs_new:cn { crthm_format_ #2 :nnn } @@ -524,10 +543,11 @@ } } \cs_new:Nn \crthm_define_format_long_version:nnnn - { % #1 = name of the environment - % #2 = name of the format command - % #3 = content before the hyperlink beginning mark - % #4 = content after the hyperlink beginning mark + % #1 = name of the environment + % #2 = name of the format command + % #3 = content before the hyperlink beginning mark + % #4 = content after the hyperlink beginning mark + { \cs_if_exist:cF { crthm_format_ #2 :nnnnnn } { \cs_new:cn { crthm_format_ #2 :nnnnnn } @@ -939,6 +959,8 @@ { The~theorem-like~environment~"#1"~cannot~be~created,~you~have~to~name~it~before~initialization. } \cs_new:Nn \crthm_create_theorem:nn + % #1 = env name + % #2 = options { \tl_set:Nn \l__crthm_current_env_tl { #1 } \bool_set_false:N \l__crthm_creating_apply_style_bool |