summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/create-theorem
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-06-16 03:01:30 +0000
committerNorbert Preining <norbert@preining.info>2022-06-16 03:01:30 +0000
commitb83d15e1ff2e551eb7391d45becd87dce59d39b8 (patch)
tree756378eacbe575ca119b77f81022940f022c69d9 /macros/latex/contrib/create-theorem
parentda68bce1d25d68087ca3b70134a61ae1c3a96b67 (diff)
CTAN sync 202206160301
Diffstat (limited to 'macros/latex/contrib/create-theorem')
-rw-r--r--macros/latex/contrib/create-theorem/create-theorem-doc.pdfbin125733 -> 67394 bytes
-rw-r--r--macros/latex/contrib/create-theorem/create-theorem-doc.tex6
-rw-r--r--macros/latex/contrib/create-theorem/create-theorem.sty49
3 files changed, 42 insertions, 13 deletions
diff --git a/macros/latex/contrib/create-theorem/create-theorem-doc.pdf b/macros/latex/contrib/create-theorem/create-theorem-doc.pdf
index 33d62ab403..ff4cd4769e 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 64b9677251..7ed8864a19 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/06/01}
+\def\PackageVersion{2022/06/15}
\title{\createtheorempackage{}\\\smallskip\itshape Initializing theorem-like environments with multilingual support}
\author{Jinwen XU}
@@ -286,6 +286,7 @@ Supported keys are:
\item \commandoption{create starred version}
\begin{itemize}
\item Defining a corresponding starred (unnumbered) version of the current environment.
+ \item It must be placed \emph{before} \commandoption{qed} if you want the starred version to have a Q.E.D symbol.
\item Synonymous names: \commandoption{create-starred-version} \,$|$\, \commandoption{createstarredversion} \,$|$\, \\\phantom{Synonymous names: }\commandoption{create numberless version} \,$|$\, \commandoption{create-numberless-version} \\\phantom{Synonymous names: }\,$|$ \commandoption{createnumberlessversion}
\end{itemize}
\item \commandoption{copy existed}\lstinline| = |\meta{existed environment}
@@ -476,7 +477,8 @@ The code above defines two new environments \lstinline|theorem+| and \lstinline|
\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.
+ \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}
\medskip
diff --git a/macros/latex/contrib/create-theorem/create-theorem.sty b/macros/latex/contrib/create-theorem/create-theorem.sty
index 35b07ffd32..44ba44d9a4 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/06/01} {}
+ {2022/06/15} {}
{Initializing theorem-like environments with multilingual support}
\keys_define:nn { create-theorem }
@@ -39,8 +39,6 @@
}
\ProcessKeysOptions { create-theorem }
-\RequirePackage { aliascnt }
-
\bool_if:NT \l__crthm_nameinlink_bool
{
\PassOptionsToPackage { nameinlink } { cleveref }
@@ -244,7 +242,7 @@
{% "originalref" mode
\tl_if_exist:cF { c@ #1 _crthm_original_ #2 }
{
- \newaliascnt { #1 _crthm_original_ #2 } { #1 }
+ \crthm_counter_alias:nn { #1 _crthm_original_ #2 } { #1 }
\hook_gput_code:nnn { begindocument/before } { crthm }
{
\cs_set_eq:cc { the #1 _crthm_original_ #2 } { the #1 }
@@ -704,6 +702,11 @@
, qed .code:n = {
\exp_args:Nx \hook_gput_code:nnn { env/ \l__crthm_current_env_tl /begin } { crthm } { \cs_set:Npn \qedsymbol { \ensuremath { #1 } } \pushQED{\qed} }
\exp_args:Nx \hook_gput_code:nnn { env/ \l__crthm_current_env_tl /end } { crthm } { \popQED }
+ \bool_if:NT \l__crthm_creating_create_starred_bool
+ {
+ \exp_args:Nx \hook_gput_code:nnn { env/ \l__crthm_current_env_tl * /begin } { crthm } { \cs_set:Npn \qedsymbol { \ensuremath { #1 } } \pushQED{\qed} }
+ \exp_args:Nx \hook_gput_code:nnn { env/ \l__crthm_current_env_tl * /end } { crthm } { \popQED }
+ }
}
, qed .default:n = \c_crthm_original_qedsymbol_tl
, qed~symbol .meta:n = { qed = #1 }
@@ -822,6 +825,10 @@
{
\crthm_newtheorem:w { #1 _crthm_regional } [#1] { \tl_use:c { g_crthm_name_heading_ #1 _ \languagename _tl } }
}
+ \bool_if:NT \l__crthm_creating_create_starred_bool
+ {
+ \crthm_newtheorem:w*{ #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"
@@ -843,10 +850,6 @@
{
\end{ #1 _crthm_regional }
}
- \bool_if:NT \l__crthm_creating_create_starred_bool
- {
- \crthm_newtheorem:w*{ #1 * } { \tl_use:c { g_crthm_name_heading_ #1 _ \languagename _tl } }
- }
\keys_set:nn { create-theorem-creating / counter-management } { #2 }
}
{
@@ -871,8 +874,17 @@
\cs_new:Nn \crthm_counter_alias:nn
{
- \cs_set_eq:cc { c@ #1 } { c@ #2 }
- \cs_set_eq:cc { the #1 } { the #2 }
+ \cs_if_exist:cTF { c@ #2 }
+ {
+ \cs_gset_eq:cc { c@ #1 } { c@ #2 }
+ \cs_gset_eq:cc { the #1 } { the #2 }
+ \cs_gset_eq:cc { theH #1 } { theH #2 }
+ \cs_gset_eq:cc { p@ #1 } { p@ #2 }
+ \cs_gset_eq:cc { cl@ #1 } { cl@ #2 }
+ }
+ {
+ \@nocounterr { #2 }
+ }
}
\cs_generate_variant:Nn \crthm_counter_alias:nn { en }
@@ -929,11 +941,26 @@
{
\clist_map_inline:nn { #1 }
{
- \tl_set:Nn \l__crthm_current_env_tl { ##1 }
+ \prop_if_in:NnTF \l_crthm_binding_prop { ##1 }
+ {
+ \prop_get:NnN \l_crthm_binding_prop { ##1 } \l__crthm_current_env_tl
+ }
+ {
+ \tl_set:Nn \l__crthm_current_env_tl { ##1 }
+ }
\keys_set:nn { create-theorem-setting } { #2 }
}
}
+\prop_new:N \l_crthm_binding_prop
+\NewDocumentCommand \SetTheoremBinding { m m }
+ {
+ \clist_map_inline:nn { #1 }
+ {
+ \prop_put:Nxx \l_crthm_binding_prop { ##1 } { #2 }
+ }
+ }
+
\bool_if:NF \l__crthm_presetname_bool { \endinput }