From b5b4196c736056d495a404ed6e98c3d8b8451bea Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 3 Apr 2022 20:55:18 +0000 Subject: create-theorem (3apr22) git-svn-id: svn://tug.org/texlive/trunk@62892 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/create-theorem/create-theorem.sty | 105 ++++++++++----------- 1 file changed, 50 insertions(+), 55 deletions(-) (limited to 'Master/texmf-dist/tex/latex/create-theorem') 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 b86af841ee7..2156f23ecd8 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/03/18} {} + {2022/04/02} {} {Initializing theorem-like environments with multilingual support} \keys_define:nn { create-theorem } @@ -610,20 +610,6 @@ { The~theorem-like~environment~"#1"~cannot~be~created,~you~have~to~name~it~before~initialization. } \cs_new:Nn \crthm_create_theorem:nn - { - \cs_if_exist:cTF { #1 } - { - \bool_if:NF \l__crthm_creating_quiet_bool - { - \msg_warning:nnn { create-theorem } { env-not-created } { #1 } - } - } - { - \__crthm_create_theorem:nn { #1 } { #2 } - } - } - -\cs_new:Nn \__crthm_create_theorem:nn { \tl_set:Nn \l__crthm_current_env_tl { #1 } \bool_set_false:N \l__crthm_creating_apply_style_bool @@ -633,72 +619,81 @@ \keys_set:nn { create-theorem-creating } { #2 } \bool_if:NTF \l__crthm_creating_copy_existed_bool { - \__crthm_define_env:en { #1 } { \l__crthm_creating_copy_existed_tl } + \__crthm_copy_env:ee { \l__crthm_current_env_tl } { \l__crthm_creating_copy_existed_tl } \bool_if:NT \l__crthm_creating_create_starred_bool { - \__crthm_define_env:en { #1 * } { \l__crthm_creating_copy_existed_tl * } + \__crthm_copy_env:ee { \l__crthm_current_env_tl * } { \l__crthm_creating_copy_existed_tl * } } } { - \cs_if_exist:cTF { c@ #1 } + \cs_if_exist:cTF { #1 } { - \group_begin: - \bool_if:NTF \l__crthm_creating_apply_style_bool + \bool_if:NF \l__crthm_creating_quiet_bool { - \exp_args:No \theoremstyle { \l__crthm_creating_apply_style_tl } + \msg_warning:nnn { create-theorem } { env-not-created } { #1 } } + } + { + \cs_if_exist:cTF { c@ #1 } { - \tl_if_exist:cT { c_crthm_theorem_style_preset_ #1 _tl } + \group_begin: + \bool_if:NTF \l__crthm_creating_apply_style_bool { - \exp_args:Nv \theoremstyle { c_crthm_theorem_style_preset_ #1 _tl } + \exp_args:No \theoremstyle { \l__crthm_creating_apply_style_tl } } - } - \bool_if:NTF \l__crthm_creating_numberless_bool - { - \newtheorem*{ #1 _crthm_regional } { \tl_use:c { g_crthm_name_heading_ #1 _ \languagename _tl } } - } - { - \newtheorem { #1 _crthm_regional } [#1] { \tl_use:c { g_crthm_name_heading_ #1 _ \languagename _tl } } - } - \group_end: - \NewDocumentEnvironment { #1 } { O{} } - % In "regionalref" mode, the counter received by the referencing system is "#1 _crthm_regional" - % while in "originalref" mode, the counter received is "#1 _crthm_original_\languagename" - { - \tl_if_blank:eTF { ##1 } { - \begin{ #1 _crthm_regional } + \tl_if_exist:cT { c_crthm_theorem_style_preset_ #1 _tl } + { + \exp_args:Nv \theoremstyle { c_crthm_theorem_style_preset_ #1 _tl } + } } + \bool_if:NTF \l__crthm_creating_numberless_bool { - \begin{ #1 _crthm_regional }[##1] + \newtheorem*{ #1 _crthm_regional } { \tl_use:c { g_crthm_name_heading_ #1 _ \languagename _tl } } } - \bool_if:NF \l__crthm_regionalref_bool - { - \addtocounter { #1 _crthm_original_\languagename } { -1 } - \refstepcounter { #1 _crthm_original_\languagename } - } - } - { - \end{ #1 _crthm_regional } + { + \newtheorem { #1 _crthm_regional } [#1] { \tl_use:c { g_crthm_name_heading_ #1 _ \languagename _tl } } + } + \group_end: + \NewDocumentEnvironment { #1 } { O{} } + % In "regionalref" mode, the counter received by the referencing system is "#1 _crthm_regional" + % while in "originalref" mode, the counter received is "#1 _crthm_original_\languagename" + { + \tl_if_blank:eTF { ##1 } + { + \begin{ #1 _crthm_regional } + } + { + \begin{ #1 _crthm_regional }[##1] + } + \bool_if:NF \l__crthm_regionalref_bool + { + \addtocounter { #1 _crthm_original_\languagename } { -1 } + \refstepcounter { #1 _crthm_original_\languagename } + } + } + { + \end{ #1 _crthm_regional } + } + \bool_if:NT \l__crthm_creating_create_starred_bool + { + \newtheorem*{ #1 * } { \tl_use:c { g_crthm_name_heading_ #1 _ \languagename _tl } } + } + \keys_set:nn { create-theorem-creating / counter-management } { #2 } } - \bool_if:NT \l__crthm_creating_create_starred_bool { - \newtheorem*{ #1 * } { \tl_use:c { g_crthm_name_heading_ #1 _ \languagename _tl } } + \msg_error:nnn { create-theorem } { env-not-named } { #1 } } - \keys_set:nn { create-theorem-creating / counter-management } { #2 } - } - { - \msg_error:nnn { create-theorem } { env-not-named } { #1 } } } } -\cs_new:Nn \__crthm_define_env:nn +\cs_new:Nn \__crthm_copy_env:nn { \cs_set_eq:cc { #1 } { #2 } \cs_set_eq:cc { end #1 } { end #2 } } -\cs_generate_variant:Nn \__crthm_define_env:nn { en } +\cs_generate_variant:Nn \__crthm_copy_env:nn { ee } \cs_new:Nn \crthm_counter_within:nn { -- cgit v1.2.3