From f158c892f4714e2dfef87c5edf8cd679fd09bb2b Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Sat, 7 Dec 2019 03:00:49 +0000
Subject: CTAN sync 201912070300

---
 macros/latex/contrib/mathcommand/mathcommand.dtx | 180 +++++++++++++++++++++--
 1 file changed, 170 insertions(+), 10 deletions(-)

(limited to 'macros/latex/contrib/mathcommand/mathcommand.dtx')

diff --git a/macros/latex/contrib/mathcommand/mathcommand.dtx b/macros/latex/contrib/mathcommand/mathcommand.dtx
index ca621c869d..e269646e1f 100644
--- a/macros/latex/contrib/mathcommand/mathcommand.dtx
+++ b/macros/latex/contrib/mathcommand/mathcommand.dtx
@@ -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,6 +167,17 @@
 \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\\
@@ -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 @@ For instance:
  \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 @@ defined with as main body \texttt{\cs\overline\{u\#2\}\#1\#3}
  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 @@ This directory contains the package
 
   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@irif.fr
   web: -
@@ -469,7 +533,7 @@ Content of the file mathcommand-ctan.zip:
 %<*package>
 %    \begin{macrocode}
 \NeedsTeXFormat{LaTeX2e}[1994/06/01]
-\RequirePackage{expl3}
+\RequirePackage{expl3,l3keys2e}
 \RequirePackage{etoolbox}
 \RequirePackage{xparse}
 
@@ -917,7 +981,7 @@ Content of the file mathcommand-ctan.zip:
    \__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,6 +1216,102 @@ Content of the file mathcommand-ctan.zip:
 }
 %    \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}
-- 
cgit v1.2.3

