texlive[53044] Master/texmf-dist: mathcommand (7dec19)

commits+karl at tug.org commits+karl at tug.org
Sat Dec 7 00:13:04 CET 2019


Revision: 53044
          http://tug.org/svn/texlive?view=revision&revision=53044
Author:   karl
Date:     2019-12-07 00:13:03 +0100 (Sat, 07 Dec 2019)
Log Message:
-----------
mathcommand (7dec19)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/mathcommand/README.md
    trunk/Master/texmf-dist/doc/latex/mathcommand/mathcommand.pdf
    trunk/Master/texmf-dist/source/latex/mathcommand/mathcommand.dtx
    trunk/Master/texmf-dist/tex/latex/mathcommand/mathcommand.sty

Modified: trunk/Master/texmf-dist/doc/latex/mathcommand/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/mathcommand/README.md	2019-12-06 23:12:38 UTC (rev 53043)
+++ trunk/Master/texmf-dist/doc/latex/mathcommand/README.md	2019-12-06 23:13:03 UTC (rev 53044)
@@ -3,8 +3,8 @@
 
   name: mathcommand
   license: LaTeX Project Public License version 1.2 or above
-  version: v1.02
-  date: 2019/07/03
+  version: v1.03
+  date: 2019/12/06
   author: Thomas Colcombet
   mail: thomas.colcombet at irif.fr
   web: -

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

Modified: trunk/Master/texmf-dist/source/latex/mathcommand/mathcommand.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/mathcommand/mathcommand.dtx	2019-12-06 23:12:38 UTC (rev 53043)
+++ trunk/Master/texmf-dist/source/latex/mathcommand/mathcommand.dtx	2019-12-06 23:13:03 UTC (rev 53044)
@@ -23,7 +23,7 @@
 %
 % \iffalse
 %<head>\usepackage{expl3}
-%<head>\ProvidesExplPackage{mathcommand}{2019/07/03}{1.02}{}
+%<head>\ProvidesExplPackage{mathcommand}{2019/12/06}{1.03}{}
 %<*driver>
 \documentclass{ltxdoc}
 \usepackage[utf8]{inputenc}
@@ -33,12 +33,13 @@
 \usepackage{expl3}
 \usepackage{mathcommand}
 \usepackage[hidelinks]{hyperref}
-\usepackage[quotation,scope,electronic]{knowledge}
+\usepackage[quotation,scope,notion,electronic]{knowledge}
 \usepackage{enumitem}
 
 \CheckSum{0}
 \changes{1.01}{2019/05/12}{Initial version} %
 \changes{1.02}{2019/07/03}{Bug correction} %
+\changes{1.03}{2019/12/06}{added disabling commands} %
 \GetFileInfo{mathcommand.sty} %
 \DoNotIndex{}
 \edef\mathcommandversiondate{\fileversion--\filedate}
@@ -166,7 +167,18 @@
 \knowledge{PIE}[PIEs]{doc notion}
 \knowledge{PIE command}[PIE commands]{doc notion}
 
+\knowledge{notion}
+ | Disabling
+ | deactivated
+ | Deactivating
 
+\knowledge{notion}
+ | disabled=warning
+\knowledge{notion}
+ | disabled=error
+\knowledge{notion}
+ | disabled=silent
+
 \begin{document}
 \title{The \texttt{mathcommand} package for \LaTeX\\
        {\small[version  \mathcommandversiondate]}}
@@ -177,8 +189,9 @@
  \noindent The "mathcommand" package provides functionalities for defining macros
   \begin{compactenum}
   \item that have different behaviors depending on whether in math or text mode,
-  \item that absorb Primes, Indices and Exponents (PIE) as extra parameters usable in the code, and
-  \item offers some iteration facilities for defining macros with similar code.
+  \item that absorb Primes, Indices and Exponents (PIE) as extra parameters usable in the code, 
+  \item offers some iteration facilities for defining macros with similar code,
+  \item and deactivating macros.
   \end{compactenum}
  The primary objective of this package is to be used together with the "knowledge"
  package for a proper handling of mathematical notations.
@@ -190,6 +203,7 @@
 \item[2019-05-12] First version of the package. V1.01 on CTAN,
 \item[2019-05-14] New macros \cs\IfEmptyTF, \cs\GetExponent, and \cs\GetIndex.
 \item[2019-07-03] Corrects bug of functions declaring PIE's issuing an error when already existing. Version 1.02 on CTAN.
+\item[2019-12-06] Added disabling commands, and package options. Version 1.03 on CTAN.
 \end{compactdesc}
  
 
@@ -333,9 +347,9 @@
  \knowledge{name 7}{doc notion}
  \knowledge{code}{doc notion}
  The "mathcommand" package offer also some capabilities for automatically defining multiple
- similar macros. This is done using only one command:
+ similar macros. This is done using only one command:\AP
  \begin{center}
-    \AP\csintro{\LoopCommands}\{"list on which to iterate"\}["name 1"]["name 2"]\dots["name 7"]\{"code@@LoopCommands"\}
+    \csintro{\LoopCommands}\{"list on which to iterate"\}["name 1"]["name 2"]\dots["name 7"]\{"code@@LoopCommands"\}
  \end{center}
  \AP The ""list on which to iterate"" is a list of letters or braced sequences of letters.
  \AP the ""name 1"", ""name 2"" up to ""name 7"" optional parameters are expandable
@@ -410,6 +424,56 @@
  be displayed in blue (with the "xcolor" package loaded). Note in the last case
  the use of the third parameter used for accessing the macros \cs\LaTeXalpha,\dots\
  that are automatically generated by the \cs\renewmathcommand\ macro.
+ 
+\section{Disabling command}
+ 
+The package "mathcommand" has some facilities for deactivating commands, and suggesting replacements.
+This can be useful when working with coauthors and help them using the same macros.
+"Disabling" a command is achieved using \AP
+\begin{center}
+    \csintro{\disablecommand}\{sequence of control sequences\}
+ \end{center}
+ 
+The result of this command is that the control sequences appearing in the sequence are "deactivated". \AP ""Deactivating"" a macro~\cs\macro\ means that:
+\begin{itemize}
+\item The original macro is stored as \cs\LaTeXmacro, and thus can still be used.
+\item Using \cs\macro\ now displays an error message explaining that it has been disabled, that~\cs\LaTeXmacro\ can be used instead, and also provides a list suggestions of replacement that are defined by the command \cs\suggestcommand.
+\end{itemize}
+However, be careful: disabling a command which is used in the system or in the the style will yield an error.
+Hence, it is possible to disable all math symbols but macros like \cs\dagger\ would yield problem if used in footnotes or for the affiliation of the authors.
+\AP The syntax of~\cs\suggestcommand\ is as follows:
+ \begin{center}
+    \csintro{\suggestcommand}\cs\macro\{suggestion to be displayed when~\cs\macro\ is used\}
+ \end{center}
+ For instance:
+ \begin{code}%[10cm]
+ \cs\disablecommand\{\cs\leq\cs\geq\}\\
+ \cs\suggestcommand\{\cs\leq\}\{Use the better looking \cs\leqslant.\}\\
+ \cs\suggestcommand\{\cs\geq\}\{Use the better looking \cs\geqslant.\}
+ \end{code}
+Now, executing \cs\leq\ yields:
+\begin{verbatim} 
+./filename.tex:linenumber: Package mathcommand Error: 
+(mathcommand)                The command \geq is disabled. Instead:
+(mathcommand)                Use \LaTeXgeq for the original macro.
+(mathcommand)                Use the better looking \geqslant .
+\end{verbatim}
+ 
+ 
+\section{Options}
+
+\AP Options can either be triggered either when the package is loaded, or using:
+\begin{center}
+  \csintro\mathcommandconfigure\{option list\}
+\end{center}
+The available options are:
+\begin{itemize}
+\item ""disabled=error"" makes "disabled" commands produce errors,
+\item ""disabled=warning"" makes "disabled" commands produce warnings,
+\item ""disabled=silent"" makes "disabled" commands work as before being disabled
+   (useful when including code that cannot be modified).
+\end{itemize}
+
  \newpage
 
  \DocInput{mathcommand.dtx}
@@ -432,8 +496,8 @@
 
   name: mathcommand
   license: LaTeX Project Public License version 1.2 or above
-  version: v1.02
-  date: 2019/07/03
+  version: v1.03
+  date: 2019/12/06
   author: Thomas Colcombet
   mail: thomas.colcombet at irif.fr
   web: -
@@ -469,7 +533,7 @@
 %<*package>
 %    \begin{macrocode}
 \NeedsTeXFormat{LaTeX2e}[1994/06/01]
-\RequirePackage{expl3}
+\RequirePackage{expl3,l3keys2e}
 \RequirePackage{etoolbox}
 \RequirePackage{xparse}
 
@@ -917,7 +981,7 @@
    \__xparse_check_definable:nNT {#2} \storecommand
    {
        \cs_if_exist:NTF#2{
-           \cs_set_eq:cN{\__mathcommand_prefix_store_tl\cs_to_str:N#2}#2
+           \cs_set_eq:cN{#1\cs_to_str:N#2}#2
        }
        {
            \PackageError{mathcommand} 
@@ -1152,7 +1216,103 @@
 }
 %    \end{macrocode}
 %
+% \subsection{Deactivating macros}
+%
 %    \begin{macrocode}
+\bool_new:N\__mathcommand_disabled_error_bool
+\bool_set_true:N\__mathcommand_disabled_error_bool
+\bool_new:N\__mathcommand_disabled_suggest_original_bool
+\bool_set_true:N\__mathcommand_disabled_suggest_original_bool
+\bool_new:N\__mathcommand_force_enabled_bool
+\bool_set_false:N\__mathcommand_force_enabled_bool
+%    \end{macrocode}
+%    \begin{macrocode}
+\cs_new:Nn\__mathcommand_to_disabled_help_tl:N
+    {mathcommand_disabled_help_\cs_to_str:N#1_tl}
+%    \end{macrocode}
+%    \begin{macrocode}
+\cs_new:Nn\__mathcommand_error:nn
+{  \msg_new:nnn{mathcommand}{#1}{#2}
+   \msg_error:nn{mathcommand}{#1}
+}
+\cs_new:Nn\__mathcommand_dc_error:n
+{  \msg_new:nnn{mathcommand}{disabled~command}{#1}
+   \msg_error:nn{mathcommand}{disabled~command}
+}
+\cs_new:Nn\__mathcommand_dc_warning:n
+{  \msg_set:nnn{mathcommand}{disabled~command}{#1}
+   \msg_warning:nn{mathcommand}{disabled~command}
+}
+\cs_new:Nn\mathcommand_disabled_error:N
+{  \bool_if:NTF\__mathcommand_disabled_error_bool
+     {\exp_args:Nx\__mathcommand_dc_error:n}
+     {\exp_args:Nx\__mathcommand_dc_warning:n}
+       {\exp_not:n{\\The~command~\string#1~is~disabled.~Instead:\\ } 
+        \bool_if:NT\__mathcommand_disabled_suggest_original_bool
+           {Use~\exp_not:c{\__mathcommand_to_storetl:N#1} for~the~original~macro.}
+        \exp_not:v{\__mathcommand_to_disabled_help_tl:N#1}}
+}
+%    \end{macrocode}
+%    \begin{macrocode}
+\msg_new:nnn{mathcommand}{unknown~command}
+   {\\The~control~sequence~#1 is~not~defined \\Origin~macro:~#2}
+%    \end{macrocode}
+%    \begin{macrocode}
+\NewDocumentCommand\disablecommand{m}{
+    \tl_map_function:nN{#1}\mathcommand_disablecommand:N
+}
+
+
+\cs_new:Nn\mathcommand_disablecommand:N
+  { \cs_if_exist:NTF#1{
+     \__xparse_check_definable:nNT#1\disablecommand
+     {\tl_if_exist:cTF{\__mathcommand_to_disabled_help_tl:N#1}
+        {}
+        {\storecommand#1
+          \tl_new:c{\__mathcommand_to_disabled_help_tl:N#1}
+         \renewcommand#1
+            {\bool_if:NF
+                \__mathcommand_force_enabled_bool
+                {\mathcommand_disabled_error:N#1}
+            \use:c{\__mathcommand_to_storetl:N#1}}}
+      }
+      }{
+        \msg_error:nnnn{mathcommand}{unknown~command}{#1}{\disablecommand}
+      }
+}
+%    \end{macrocode}
+%    \begin{macrocode}
+\NewDocumentCommand\suggestcommand{mm}
+    { \cs_if_exist:NTF#1{
+        \cs_if_exist:cTF{\__mathcommand_to_disabled_help_tl:N#1}{
+            \tl_put_right:cx{\__mathcommand_to_disabled_help_tl:N#1}{\exp_not:N\\\tl_to_str:n{#2}}
+           }{
+            \__mathcommand_error:nn{command~not~disabled}
+              {\\\string\suggestcommand :~Command~#1~has~not~been~disabled.}
+           }
+        }
+        {  \__mathcommand_error:nn{unknown~command}
+            {\\\string\suggestcommand :~Unknown~command~#1.}
+        }
+}
+%    \end{macrocode}
+%
+% \subsection{Options}
+%
+%    \begin{macrocode}
+\keys_define:nn { mathcommand }{
+  disabled .multichoice:,
+  disabled / silent .code:n = {\bool_set_true:N\__mathcommand_force_enabled_bool },
+  disabled / error .code:n = {\bool_set_false:N\__mathcommand_force_enabled_bool
+                                \bool_set_true:N\__mathcommand_disabled_error_bool},
+  disabled / warning .code:n = {\bool_set_false:N\__mathcommand_force_enabled_bool
+                                \bool_set_false:N\__mathcommand_disabled_error_bool},
+}
+\ProcessKeysOptions { mathcommand } % Parses the option list
+\NewDocumentCommand\mathcommandconfigure{ m }
+  {\keys_set:nn{ mathcommand}{ #1} }
+%    \end{macrocode}
+%    \begin{macrocode}
 \ExplSyntaxOff
 %    \end{macrocode}
 %

Modified: trunk/Master/texmf-dist/tex/latex/mathcommand/mathcommand.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/mathcommand/mathcommand.sty	2019-12-06 23:12:38 UTC (rev 53043)
+++ trunk/Master/texmf-dist/tex/latex/mathcommand/mathcommand.sty	2019-12-06 23:13:03 UTC (rev 53044)
@@ -19,10 +19,10 @@
 %% LaTeX version 1999/12/01 or later.
 %% 
 \usepackage{expl3}
-\ProvidesExplPackage{mathcommand}{2019/07/03}{1.02}{}
+\ProvidesExplPackage{mathcommand}{2019/12/06}{1.03}{}
 %%%%%%%%%%
 \NeedsTeXFormat{LaTeX2e}[1994/06/01]
-\RequirePackage{expl3}
+\RequirePackage{expl3,l3keys2e}
 \RequirePackage{etoolbox}
 \RequirePackage{xparse}
 
@@ -355,7 +355,7 @@
    \__xparse_check_definable:nNT {#2} \storecommand
    {
        \cs_if_exist:NTF#2{
-           \cs_set_eq:cN{\__mathcommand_prefix_store_tl\cs_to_str:N#2}#2
+           \cs_set_eq:cN{#1\cs_to_str:N#2}#2
        }
        {
            \PackageError{mathcommand}
@@ -577,6 +577,82 @@
             {#1}
       }{#1}
 }
+\bool_new:N\__mathcommand_disabled_error_bool
+\bool_set_true:N\__mathcommand_disabled_error_bool
+\bool_new:N\__mathcommand_disabled_suggest_original_bool
+\bool_set_true:N\__mathcommand_disabled_suggest_original_bool
+\bool_new:N\__mathcommand_force_enabled_bool
+\bool_set_false:N\__mathcommand_force_enabled_bool
+\cs_new:Nn\__mathcommand_to_disabled_help_tl:N
+    {mathcommand_disabled_help_\cs_to_str:N#1_tl}
+\cs_new:Nn\__mathcommand_error:nn
+{  \msg_new:nnn{mathcommand}{#1}{#2}
+   \msg_error:nn{mathcommand}{#1}
+}
+\cs_new:Nn\__mathcommand_dc_error:n
+{  \msg_new:nnn{mathcommand}{disabled~command}{#1}
+   \msg_error:nn{mathcommand}{disabled~command}
+}
+\cs_new:Nn\__mathcommand_dc_warning:n
+{  \msg_set:nnn{mathcommand}{disabled~command}{#1}
+   \msg_warning:nn{mathcommand}{disabled~command}
+}
+\cs_new:Nn\mathcommand_disabled_error:N
+{  \bool_if:NTF\__mathcommand_disabled_error_bool
+     {\exp_args:Nx\__mathcommand_dc_error:n}
+     {\exp_args:Nx\__mathcommand_dc_warning:n}
+       {\exp_not:n{\\The~command~\string#1~is~disabled.~Instead:\\ }
+        \bool_if:NT\__mathcommand_disabled_suggest_original_bool
+           {Use~\exp_not:c{\__mathcommand_to_storetl:N#1} for~the~original~macro.}
+        \exp_not:v{\__mathcommand_to_disabled_help_tl:N#1}}
+}
+\msg_new:nnn{mathcommand}{unknown~command}
+   {\\The~control~sequence~#1 is~not~defined \\Origin~macro:~#2}
+\NewDocumentCommand\disablecommand{m}{
+    \tl_map_function:nN{#1}\mathcommand_disablecommand:N
+}
+
+\cs_new:Nn\mathcommand_disablecommand:N
+  { \cs_if_exist:NTF#1{
+     \__xparse_check_definable:nNT#1\disablecommand
+     {\tl_if_exist:cTF{\__mathcommand_to_disabled_help_tl:N#1}
+        {}
+        {\storecommand#1
+          \tl_new:c{\__mathcommand_to_disabled_help_tl:N#1}
+         \renewcommand#1
+            {\bool_if:NF
+                \__mathcommand_force_enabled_bool
+                {\mathcommand_disabled_error:N#1}
+            \use:c{\__mathcommand_to_storetl:N#1}}}
+      }
+      }{
+        \msg_error:nnnn{mathcommand}{unknown~command}{#1}{\disablecommand}
+      }
+}
+\NewDocumentCommand\suggestcommand{mm}
+    { \cs_if_exist:NTF#1{
+        \cs_if_exist:cTF{\__mathcommand_to_disabled_help_tl:N#1}{
+            \tl_put_right:cx{\__mathcommand_to_disabled_help_tl:N#1}{\exp_not:N\\\tl_to_str:n{#2}}
+           }{
+            \__mathcommand_error:nn{command~not~disabled}
+              {\\\string\suggestcommand :~Command~#1~has~not~been~disabled.}
+           }
+        }
+        {  \__mathcommand_error:nn{unknown~command}
+            {\\\string\suggestcommand :~Unknown~command~#1.}
+        }
+}
+\keys_define:nn { mathcommand }{
+  disabled .multichoice:,
+  disabled / silent .code:n = {\bool_set_true:N\__mathcommand_force_enabled_bool },
+  disabled / error .code:n = {\bool_set_false:N\__mathcommand_force_enabled_bool
+                                \bool_set_true:N\__mathcommand_disabled_error_bool},
+  disabled / warning .code:n = {\bool_set_false:N\__mathcommand_force_enabled_bool
+                                \bool_set_false:N\__mathcommand_disabled_error_bool},
+}
+\ProcessKeysOptions { mathcommand } % Parses the option list
+\NewDocumentCommand\mathcommandconfigure{ m }
+  {\keys_set:nn{ mathcommand}{ #1} }
 \ExplSyntaxOff
 
 \endinput



More information about the tex-live-commits mailing list