summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-03-19 20:01:43 +0000
committerKarl Berry <karl@freefriends.org>2022-03-19 20:01:43 +0000
commit6267c4a6bbbe9a1f5c1af42cff9ce498c1054859 (patch)
tree66bf2f6dd069de050e4fab015e20f97fdc054987
parent33f07a6690dc11dc1382f810f6bf66c553111dbd (diff)
create-theorem (19mar22) (branch)
git-svn-id: svn://tug.org/texlive/branches/branch2021.final@62806 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/create-theorem/create-theorem-doc.pdfbin117260 -> 117509 bytes
-rw-r--r--Master/texmf-dist/doc/latex/create-theorem/create-theorem-doc.tex9
-rw-r--r--Master/texmf-dist/tex/latex/create-theorem/create-theorem.sty78
3 files changed, 51 insertions, 36 deletions
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 c61567791b2..4f64d0b5d50 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
Binary files 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 3a726e50e1c..526eb153853 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
@@ -85,7 +85,7 @@
\begin{document}
-\def\PackageVersion{2022/03/11}
+\def\PackageVersion{2022/03/18}
\title{\createtheorempackage{}\\\smallskip\itshape Initializing theorem-like environments with multilingual support}
\author{Jinwen XU}
@@ -311,7 +311,7 @@ The previous two commands are especially useful for package or class writers, wh
Supported keys are:
\vspace{-.2\baselineskip}
\begin{itemize}
- \item \commandoption{name style}\lstinline| = |\meta{configuration}
+ \item \commandoption{name}\lstinline| = |\meta{configuration} and \commandoption{name style}\lstinline| = |\meta{configuration}
\begin{itemize}
\item Same as \lstinline|\NameTheorem{|\meta{name of environment}\lstinline|}{|\meta{configuration}\lstinline|}|.
\item Note that this configuration can overwrite those already specified in \lstinline|\NameTheorem|.
@@ -435,12 +435,11 @@ In each case, the two environments \texttt{idea} and \texttt{idea*} share the sa
\section{Known issues}
\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 later versions so as to support the various situations in German.
- \item If the option ``\packageoption{name in link}'' is enabled, the ``\packageoption{name as is}'' mode shall take longer time to produce the final result, for the current implementation uses \lstinline|\regexpatchcmd| to patch some of the referencing formats, which is not very efficient.
+ \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 There may be inaccuracies in the translation of those preset names.
\end{itemize}
-% \medskip
+\medskip
If you run into any issues or have ideas for improvement, feel free to discuss on:
\begin{center}
\url{https://github.com/Jinwen-XU/create-theorem/issues}
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 b0371749b83..b86af841ee7 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/11} {}
+ {2022/03/18} {}
{Initializing theorem-like environments with multilingual support}
\keys_define:nn { create-theorem }
@@ -605,6 +605,10 @@
{ env-not-created }
{ The~theorem-like~environment~"#1"~cannot~be~created,~an~environment~with~the~same~name~has~already~existed. }
+\msg_new:nnn { create-theorem }
+ { env-not-named }
+ { 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 }
@@ -636,44 +640,56 @@
}
}
{
- \group_begin:
- \bool_if:NT \l__crthm_creating_apply_style_bool
- {
- \exp_after:wN \theoremstyle \exp_after:wN { \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"
+ \cs_if_exist:cTF { c@ #1 }
{
- \tl_if_blank:eTF { ##1 }
+ \group_begin:
+ \bool_if:NTF \l__crthm_creating_apply_style_bool
{
- \begin{ #1 _crthm_regional }
+ \exp_args:No \theoremstyle { \l__crthm_creating_apply_style_tl }
}
{
- \begin{ #1 _crthm_regional }[##1]
+ \tl_if_exist:cT { c_crthm_theorem_style_preset_ #1 _tl }
+ {
+ \exp_args:Nv \theoremstyle { c_crthm_theorem_style_preset_ #1 _tl }
+ }
}
- \bool_if:NF \l__crthm_regionalref_bool
- {
- \addtocounter { #1 _crthm_original_\languagename } { -1 }
- \refstepcounter { #1 _crthm_original_\languagename }
- }
- }
- {
- \end{ #1 _crthm_regional }
+ \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 }
+ }
+ {
+ \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 }
}
}