texlive[62892] Master/texmf-dist: create-theorem (3apr22)

commits+karl at tug.org commits+karl at tug.org
Sun Apr 3 22:55:18 CEST 2022


Revision: 62892
          http://tug.org/svn/texlive?view=revision&revision=62892
Author:   karl
Date:     2022-04-03 22:55:18 +0200 (Sun, 03 Apr 2022)
Log Message:
-----------
create-theorem (3apr22)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/create-theorem/create-theorem-doc.pdf
    trunk/Master/texmf-dist/doc/latex/create-theorem/create-theorem-doc.tex
    trunk/Master/texmf-dist/tex/latex/create-theorem/create-theorem.sty

Modified: trunk/Master/texmf-dist/doc/latex/create-theorem/create-theorem-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/create-theorem/create-theorem-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/create-theorem/create-theorem-doc.tex	2022-04-03 20:55:02 UTC (rev 62891)
+++ trunk/Master/texmf-dist/doc/latex/create-theorem/create-theorem-doc.tex	2022-04-03 20:55:18 UTC (rev 62892)
@@ -1,8 +1,6 @@
 %! TEX program = xelatex
 \documentclass[classical]{einfart}
 
-% \linenumbers
-
 \usepackage{ProjLib}
 
 %%================================
@@ -9,56 +7,70 @@
 %% For typesetting code
 %%================================
 \usepackage{listings}
-\definecolor{maintheme}{RGB}{70,130,180}
-\definecolor{forestgreen}{RGB}{21,122,81}
-\definecolor{lightergray}{gray}{0.99}
-\lstset{language=[LaTeX]TeX,
-    keywordstyle=\color{maintheme},
-    basicstyle=\ttfamily,
-    commentstyle=\color{forestgreen}\ttfamily,
-    stringstyle=\rmfamily,
-    showstringspaces=false,
-    breaklines=true,
-    frame=lines,
-    backgroundcolor=\color{lightergray},
-    flexiblecolumns=true,
-    escapeinside={(*}{*)},
-    % numbers=left,
-    numberstyle=\scriptsize, stepnumber=1, numbersep=5pt,
-    % firstnumber=last,
+\usepackage{xcolor}
+\usepackage{setspace}
+\definecolor{code-main}{RGB}{70,130,180}
+\definecolor{code-expl3}{RGB}{240,50,60}
+\definecolor{code-option}{RGB}{40,110,20}
+\definecolor{code-keys}{RGB}{100,130,150}
+\definecolor{code-comment}{RGB}{20,120,80}
+\definecolor{code-background}{gray}{0.99}
+\lstset{
+    language = [LaTeX]TeX,
+    basicstyle = \ttfamily,
+    keywordstyle = \color{code-main},
+    commentstyle = \color{code-comment},
+    showstringspaces = false,
+    breaklines = true,
+    frame = lines,
+    backgroundcolor = \color{code-background},
+    flexiblecolumns = true,
+    escapeinside = {(*}{*)},
+    alsoletter = {_,:},
+    % numbers = left,
+    % firstnumber = last,
+    numberstyle = \scriptsize\ttfamily,
+    stepnumber = 1,
+    numbersep = 5pt,
 }
-\providecommand{\meta}[1]{$\langle${\normalfont\itshape#1}$\rangle$}
-\lstset{moretexcs=%
-    {
+\newcommand{\meta}[1]{$\langle${\normalfont\itshape#1}$\rangle$}
+\lstset{% LaTeX2 commands
+    classoffset = 0,
+    texcsstyle =* \color{code-main},
+    moretexcs =
+      {
         cref,crefname,
         Cref,Crefname,
         crefformat,
-        crefthe,crefthename,crefthemark,
+        crefthe,crefthename,
         Crefthe,Crefthename,
+        crefthemark,
         selectlanguage,
         theoremstyle,
         NameTheorem,
         CreateTheorem,
         SetTheorem,
-        regexpatchcmd,
-    }
+      }
 }
-\lstnewenvironment{code}%
-{\setstretch{1.07}\LocallyStopLineNumbers%
-\setkeys{lst}{columns=fullflexible,keepspaces=true}%
+\lstset{% LaTeX3 commands
+    classoffset = 1,
+    texcsstyle =* \color{code-expl3},
+    moretexcs =
+      {
+      }
 }
-{\ResumeLineNumbers\vspace{-.25\baselineskip}}
-\lstnewenvironment{code*}%
-{\setstretch{1.07}\LocallyStopLineNumbers%
-\setkeys{lst}{numbers=left,columns=fullflexible,keepspaces=true}%
-}
-{\ResumeLineNumbers}
+\lstnewenvironment{code}{\setstretch{1.05}\LocallyStopLineNumbers}{\ResumeLineNumbers\vspace{-.3\baselineskip}\vspace{-.5\parskip}}
+\lstnewenvironment{code*}{\setstretch{1.05}\lstset{numbers=left}\LocallyStopLineNumbers}{\ResumeLineNumbers\vspace{-.3\baselineskip}\vspace{-.5\parskip}}
 
+\newcommand{\packageoption}[1]{\texttt{\textcolor{code-option}{#1}}}
+\newcommand{\commandoption}[1]{\texttt{\textcolor{code-keys}{#1}}}
+
 %%================================
 %% tip
 %%================================
 \usepackage[many]{tcolorbox}
-\newenvironment{tip}[1][Tip]{%
+\newenvironment{tip}[1][Tip]
+  {%
     \LocallyStopLineNumbers%
     \begin{tcolorbox}[breakable,
         enhanced,
@@ -74,18 +86,18 @@
         top = 2.5mm,
         bottom = 1.5mm,
         title={\scshape\sffamily #1}]%
-}{\end{tcolorbox}\ResumeLineNumbers}
+  }
+  {%
+    \end{tcolorbox}%
+    \ResumeLineNumbers%
+  }
 
 
-\newcommand{\packageoption}[1]{\texttt{\textcolor{black!67!green}{#1}}}
-\newcommand{\commandoption}[1]{\texttt{\textcolor{black!67!cyan}{#1}}}
-
-
 \newcommand{\createtheorempackage}{\textsf{create-theorem}}
 
 \begin{document}
 
-\def\PackageVersion{2022/03/18}
+\def\PackageVersion{2022/04/02}
 
 \title{\createtheorempackage{}\\\smallskip\itshape Initializing theorem-like environments with multilingual support}
 \author{Jinwen XU}
@@ -119,7 +131,7 @@
 
 \medskip
 It has the following options:
-\begin{itemize}
+\begin{itemize}[label=,leftmargin=1.25em,itemindent=-1.25em]
     % \item \packageoption{draft} or \packageoption{fast}
     %     \begin{itemize}
     %         \item Fast mode. The functionality will be appropriately reduced to get faster compilation speed, recommended to use during the writing stage.
@@ -148,7 +160,7 @@
 
 \section{How to use it}
 
-\subsection[Naming theorem-like environments]{Naming theorem-like environments with \texttt{\textbackslash\textcolor{maintheme}{NameTheorem}}}
+\subsection[Naming theorem-like environments]{Naming theorem-like environments with \texttt{\textbackslash\textcolor{code-main}{NameTheorem}}}
 
 The syntax of \lstinline|\NameTheorem| is as follows:
 \begin{code}
@@ -157,7 +169,7 @@
 
 Supported keys are:
 \vspace{-.2\baselineskip}
-\begin{itemize}
+\begin{itemize}[label=,leftmargin=1.25em,itemindent=-1.25em]
     \item \commandoption{heading}\lstinline| = |\meta{configuration}
         \begin{itemize}
             \item The heading of the environment, where \meta{configuration} can be:
@@ -215,18 +227,13 @@
         \end{itemize}
 \end{itemize}
 
-\medskip
-\begin{center}
-    \itshape
-    If you're feeling confused, don't worry, there is an Examples section later illustrating its usage.
-\end{center}
-
+\vspace{-.3\baselineskip}
 \begin{tip}
     You can also define the names within \lstinline|\CreateTheorem| while initializing the theorem-like environments. \lstinline|\NameTheorem| is especially useful for package or class authors who wish to preset suitable names (with styles) in their packages or classes.
 \end{tip}
 
 
-\subsection[Initializing theorem-like environments]{Initializing theorem-like environments with \texttt{\textbackslash\textcolor{maintheme}{CreateTheorem}}}
+\subsection[Initializing theorem-like environments]{Initializing theorem-like environments with \texttt{\textbackslash\textcolor{code-main}{CreateTheorem}}}
 
 The syntax of \lstinline|\CreateTheorem| is as follows:
 \begin{code}
@@ -235,7 +242,7 @@
 
 Supported keys are:
 \vspace{-.2\baselineskip}
-\begin{itemize}
+\begin{itemize}[label=,leftmargin=1.25em,itemindent=-1.25em]
     \item \commandoption{name}\lstinline| = |\meta{configuration}
         \begin{itemize}
             \item Setting the names. Same as \lstinline|\NameTheorem{|\meta{name of environment}\lstinline|}{|\meta{configuration}\lstinline|}|.
@@ -281,11 +288,6 @@
         \end{itemize}
 \end{itemize}
 
-\begin{center}
-    \itshape
-    If you're feeling confused, don't worry, there is an Examples section later illustrating its usage.
-\end{center}
-
 \begin{tip}
     The names for the following environments have been preset: \texttt{assertion}, \texttt{assumption}, \texttt{axiom}, \texttt{conclusion}, \texttt{conjecture}, \texttt{convention}, \texttt{corollary}, \texttt{definition}, \texttt{definition-proposition}, \texttt{definition-theorem}, \texttt{example}, \texttt{exercise}, \texttt{fact}, \texttt{hypothesis}, \texttt{lemma}, \texttt{notation}, \texttt{observation}, \texttt{postulate}, \texttt{problem}, \texttt{property}, \texttt{proposition}, \texttt{question}, \texttt{remark} and \texttt{theorem}. If you are fine with the preset names, then you don't need to specify the key ``\commandoption{name}'' while creating them, otherwise you shall have to use the package option ``\packageoption{no preset names}'' to disable the presets and then define your own ones.
 \end{tip}
@@ -296,7 +298,7 @@
 
 
 \bigskip
-\subsection[Configuring theorem-like environments]{Configuring theorem-like environments with \texttt{\textbackslash\textcolor{maintheme}{SetTheorem}}}
+\subsection[Configuring theorem-like environments]{Configuring theorem-like environments with \texttt{\textbackslash\textcolor{code-main}{SetTheorem}}}
 
 The previous two commands are especially useful for package or class writers, while this one is more for the users. If you are not satisfied with preset name styles or numbering settings, then even after initializing the environments, you can still further configure them by means of \lstinline|\SetTheorem|, the syntax of which is as follows:
 
@@ -310,7 +312,7 @@
 
 Supported keys are:
 \vspace{-.2\baselineskip}
-\begin{itemize}
+\begin{itemize}[label=,leftmargin=1.25em,itemindent=-1.25em]
     \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|}|.
@@ -331,7 +333,13 @@
         \end{itemize}
 \end{itemize}
 
+\bigskip
+\begin{center}
+    \itshape
+    If you're feeling confused, don't worry. Let's now take a look at some examples.
+\end{center}
 
+
 \section{Examples}
 
 \subsection{The environment \texttt{idea}}

Modified: trunk/Master/texmf-dist/tex/latex/create-theorem/create-theorem.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/create-theorem/create-theorem.sty	2022-04-03 20:55:02 UTC (rev 62891)
+++ trunk/Master/texmf-dist/tex/latex/create-theorem/create-theorem.sty	2022-04-03 20:55:18 UTC (rev 62892)
@@ -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 }
@@ -611,20 +611,6 @@
 
 \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
     \bool_set_false:N \l__crthm_creating_numberless_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 }
-                    }
+                  {
+                    \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 }
               }
               {
-                \end{ #1 _crthm_regional }
+                \msg_error:nnn  { create-theorem } { env-not-named } { #1 }
               }
-            \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 }
           }
-          {
-            \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
   {



More information about the tex-live-commits mailing list.