summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/mathcommand
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-12-06 23:13:03 +0000
committerKarl Berry <karl@freefriends.org>2019-12-06 23:13:03 +0000
commit5e53627de7235518856ec30f758a20ef9fadc5e4 (patch)
tree562f259bf1fa1b9a04d2075dedf5a8d628140abd /Master/texmf-dist/tex/latex/mathcommand
parent76fb2142ad97b7b04ad28687472e3c29036971a1 (diff)
mathcommand (7dec19)
git-svn-id: svn://tug.org/texlive/trunk@53044 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/mathcommand')
-rw-r--r--Master/texmf-dist/tex/latex/mathcommand/mathcommand.sty82
1 files changed, 79 insertions, 3 deletions
diff --git a/Master/texmf-dist/tex/latex/mathcommand/mathcommand.sty b/Master/texmf-dist/tex/latex/mathcommand/mathcommand.sty
index 95389e7d4c5..5aa4c03ae66 100644
--- a/Master/texmf-dist/tex/latex/mathcommand/mathcommand.sty
+++ b/Master/texmf-dist/tex/latex/mathcommand/mathcommand.sty
@@ -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