diff options
author | Karl Berry <karl@freefriends.org> | 2021-06-07 20:06:05 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-06-07 20:06:05 +0000 |
commit | 81eca4c5a7f042ad3b39c5bcd95765b1725b4ebe (patch) | |
tree | 258d3c3cbe4601905bb63d498b653574e2fc7b49 /Master/texmf-dist/tex | |
parent | 9469f94f21a9dd6d51e1c81a9e761fc33df2723e (diff) |
mathcommand (7jun21)
git-svn-id: svn://tug.org/texlive/trunk@59512 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/mathcommand/mathcommand.sty | 147 |
1 files changed, 106 insertions, 41 deletions
diff --git a/Master/texmf-dist/tex/latex/mathcommand/mathcommand.sty b/Master/texmf-dist/tex/latex/mathcommand/mathcommand.sty index 5aa4c03ae66..30b7658d18e 100644 --- a/Master/texmf-dist/tex/latex/mathcommand/mathcommand.sty +++ b/Master/texmf-dist/tex/latex/mathcommand/mathcommand.sty @@ -5,21 +5,54 @@ %% The original source files were: %% %% mathcommand.dtx (with options: `head,package') +%% This is a generated file. %% -%% This is a generated file. Copyright (C) 2019 by Thomas Colcombet +%% Copyright (C) 2019-2021 by Thomas Colcombet %% -%% This file may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either -%% version 1.2 of this license or (at your option) any later -%% version. The latest version of this license is in: +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in %% -%% http://www.latex-project.org/lppl.txt +%% http://www.latex-project.org/lppl.txt %% -%% and version 1.2 or later is part of all distributions of -%% LaTeX version 1999/12/01 or later. +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. %% +%% This work has the LPPL maintenance status ‘maintained’. +%% +%% The Current Maintainer of this work is Thomas Colcombet. +%% +%% This work consists of the files +%% mathcommand.dtx, mathcommand.ins, and makefile, +%% and the derived files +%% mathcommand.sty and readme.md. +%% +%% mathcommand.dtx +%% +%% Copyright (C) 2019-2021 by Thomas Colcombet +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status ‘maintained’. +%% +%% The Current Maintainer of this work is Thomas Colcombet. +%% +%% This work consists of the files +%% mathcommand.dtx, mathcommand.ins, and makefile, +%% and the derived files +%% mathcommand.sty and readme.md. +%% \usepackage{expl3} -\ProvidesExplPackage{mathcommand}{2019/12/06}{1.03}{} +\ProvidesExplPackage{mathcommand}{2021/06/07}{1.04}{} %%%%%%%%%% \NeedsTeXFormat{LaTeX2e}[1994/06/01] \RequirePackage{expl3,l3keys2e} @@ -115,7 +148,7 @@ \__mathcommand_absorb_finished:} \__mathcommand_absorb_finished:} \NewDocumentCommand\newcommandPIE{ m o o m }{ - \__xparse_check_definable:nNT {#1} \newcommandPIE + \__mathcommand_check_definable:nNT {#1} \newcommandPIE { \cs_if_exist:NTF #1 { @@ -127,7 +160,7 @@ } } \NewDocumentCommand\renewcommandPIE{ m o o m }{ - \__xparse_check_definable:nNT {#1} \renewcommandPIE + \__mathcommand_check_definable:nNT {#1} \renewcommandPIE { \cs_if_exist:NTF #1 { \__mathcommand_declarecommandPIE:Nnnn #1{#2}{#3}{#4} } @@ -139,7 +172,7 @@ } } \NewDocumentCommand\declarecommandPIE{ m o o m }{ - \__xparse_check_definable:nNT {#1} \declarecommandPIE + \__mathcommand_check_definable:nNT {#1} \declarecommandPIE { \__mathcommand_declarecommandPIE:Nnnn #1{#2}{#3}{#4} } } \cs_new:Nn\__mathcommand_declarecommandPIE:Nnnn{ @@ -156,7 +189,7 @@ {\exp_not:n{#4}} }} \cs_new_protected:Npn\NewDocumentCommandPIE#1#2#3{ - \__xparse_check_definable:nNT {#1} \NewDocumentCommandPIE + \__mathcommand_check_definable:nNT {#1} \NewDocumentCommandPIE { \cs_if_exist:NTF #1 { @@ -168,25 +201,25 @@ } } \cs_new_protected:Npn\RenewDocumentCommandPIE#1#2#3{ - \__xparse_check_definable:nNT {#1} \RenewDocumentCommandPIE + \__mathcommand_check_definable:nNT {#1} \RenewDocumentCommandPIE { \cs_if_exist:NTF #1 { \__mathcommand_DeclareDocumentCommandPIE:Nnn #1 {#2} {#3} } { - \__kernel_msg_error:nnxx { xparse } { command-not-yet-defined } + \__kernel_msg_error:nnxx { mathcommand } { command-not-yet-defined } { \use:nnn \token_to_str:N #1 { } } { \token_to_str:N \RenewDocumentCommandPIE } } } } \cs_new_protected:Npn\DeclareDocumentCommandPIE#1#2#3{ - \__xparse_check_definable:nNT {#1} \DeclareDocumentCommandPIE + \__mathcommand_check_definable:nNT {#1} \DeclareDocumentCommandPIE { \__mathcommand_DeclareDocumentCommandPIE:Nnn #1 {#2} {#3} } } \cs_new_protected:Npn\ProvideDocumentCommandPIE#1#2#3{ - \__xparse_check_definable:nNT {#1} \ProvideDocumentCommandPIE + \__mathcommand_check_definable:nNT {#1} \ProvideDocumentCommandPIE { \cs_if_exist:NTF #1{} { @@ -344,7 +377,7 @@ }{ \cs_set_eq:NN#1\__mathcommand_tmp_cs } } \NewDocumentCommand\declarecommand{m}{ - \__xparse_check_definable:nNT {#1} \declarecommand + \__mathcommand_check_definable:nNT {#1} \declarecommand { \cs_if_exist:NTF#1 {\renewcommand#1} @@ -352,7 +385,7 @@ } } \newrobustcmd\storecommand[2][\__mathcommand_prefix_store_tl]{ - \__xparse_check_definable:nNT {#2} \storecommand + \__mathcommand_check_definable:nNT {#2} \storecommand { \cs_if_exist:NTF#2{ \cs_set_eq:cN{#1\cs_to_str:N#2}#2 @@ -366,7 +399,7 @@ } \NewDocumentCommand\NewDocumentMathCommand{m}{ - \__xparse_check_definable:nNT {#1} \NewDocumentMathCommand + \__mathcommand_check_definable:nNT {#1} \NewDocumentMathCommand { \__mathcommand_create_fork:N#1 \__mathcommand_error_if_exist_math:NF#1 @@ -374,7 +407,7 @@ } } \NewDocumentCommand\NewDocumentTextCommand{m}{ - \__xparse_check_definable:nNT {#1} \NewDocumentTextCommand + \__mathcommand_check_definable:nNT {#1} \NewDocumentTextCommand { \__mathcommand_create_fork:N#1 \__mathcommand_error_if_exist_text:NF#1 @@ -382,7 +415,7 @@ } } \NewDocumentCommand\newmathcommand{m}{ - \__xparse_check_definable:nNT {#1} \newmathcommand + \__mathcommand_check_definable:nNT {#1} \newmathcommand { \__mathcommand_create_fork:N#1 \__mathcommand_error_if_exist_math:NF#1 @@ -390,7 +423,7 @@ } } \NewDocumentCommand\newtextcommand{m}{ - \__xparse_check_definable:nNT {#1} \newtextcommand + \__mathcommand_check_definable:nNT {#1} \newtextcommand { \__mathcommand_create_fork:N#1 \__mathcommand_error_if_exist_text:NF#1 @@ -398,7 +431,7 @@ } } \NewDocumentCommand\RenewDocumentMathCommand{m}{ - \__xparse_check_definable:nNT {#1} \RenewDocumentMathCommand + \__mathcommand_check_definable:nNT {#1} \RenewDocumentMathCommand { \__mathcommand_create_fork:N#1 \__mathcommand_error_if_not_exist_math:NF#1 @@ -406,7 +439,7 @@ } } \NewDocumentCommand\RenewDocumentTextCommand{m}{ - \__xparse_check_definable:nNT {#1} \RenewDocumentMathCommand + \__mathcommand_check_definable:nNT {#1} \RenewDocumentMathCommand { \__mathcommand_create_fork:N#1 \__mathcommand_error_if_not_exist_text:NF#1 @@ -414,7 +447,7 @@ } } \NewDocumentCommand\renewmathcommand{m}{ - \__xparse_check_definable:nNT {#1} \renewmathcommand + \__mathcommand_check_definable:nNT {#1} \renewmathcommand { \__mathcommand_create_fork:N#1 \__mathcommand_error_if_not_exist_math:NF#1 @@ -422,7 +455,7 @@ } } \NewDocumentCommand\renewtextcommand{m}{ - \__xparse_check_definable:nNT {#1} \renewtextcommand + \__mathcommand_check_definable:nNT {#1} \renewtextcommand { \__mathcommand_create_fork:N#1 \__mathcommand_error_if_not_exist_text:NF#1 @@ -430,14 +463,14 @@ } } \NewDocumentCommand\declaremathcommand{m}{ - \__xparse_check_definable:nNT {#1} \renewmathcommand + \__mathcommand_check_definable:nNT {#1} \renewmathcommand { \__mathcommand_create_fork:N#1 \exp_args:Nc\declarecommand{\__mathcommand_to_mathtl:N#1} } } \NewDocumentCommand\declaretextcommand{m}{ - \__xparse_check_definable:nNT {#1} \renewtextcommand + \__mathcommand_check_definable:nNT {#1} \renewtextcommand { \__mathcommand_create_fork:N#1 \exp_args:Nc\declarecommand{\__mathcommand_to_texttl:N#1} @@ -445,35 +478,35 @@ } \NewDocumentCommand\DeclareDocumentMathCommand{m}{ - \__xparse_check_definable:nNT {#1} \DeclareDocumentMathCommand + \__mathcommand_check_definable:nNT {#1} \DeclareDocumentMathCommand { \__mathcommand_create_fork:N#1 \exp_args:Nc\DeclareDocumentCommand{\__mathcommand_to_mathtl:N#1} } } \NewDocumentCommand\DeclareDocumentTextCommand{m}{ - \__xparse_check_definable:nNT {#1} \DeclareDocumentTextCommand + \__mathcommand_check_definable:nNT {#1} \DeclareDocumentTextCommand { \__mathcommand_create_fork:N#1 \exp_args:Nc\DeclareDocumentCommand{\__mathcommand_to_texttl:N#1} } } \NewDocumentCommand\ProvideDocumentMathCommand{mmm}{ - \__xparse_check_definable:nNT {#1} \ProvideDocumentMathCommand + \__mathcommand_check_definable:nNT {#1} \ProvideDocumentMathCommand { \__mathcommand_create_fork:N#1 \exp_args:Nc\ProvideDocumentCommand{\__mathcommand_to_mathtl:N#1}{#2}{#3} } } \NewDocumentCommand\ProvideDocumentTextCommand{m}{ - \__xparse_check_definable:nNT {#1} \ProvideDocumentTextCommand + \__mathcommand_check_definable:nNT {#1} \ProvideDocumentTextCommand { \__mathcommand_create_fork:N#1 \exp_args:Nc\ProvideDocumentCommand{\__mathcommand_to_texttl:N#1} } } \NewDocumentCommand\NewDocumentMathCommandPIE{m}{ - \__xparse_check_definable:nNT {#1} \NewDocumentMathCommandPIE + \__mathcommand_check_definable:nNT {#1} \NewDocumentMathCommandPIE { \__mathcommand_create_fork:N#1 \__mathcommand_error_if_exist_math:NF#1 @@ -481,7 +514,7 @@ } } \NewDocumentCommand\newmathcommandPIE{m}{ - \__xparse_check_definable:nNT {#1} \newmathcommandPiE + \__mathcommand_check_definable:nNT {#1} \newmathcommandPiE { \__mathcommand_create_fork:N#1 \__mathcommand_error_if_exist_math:NF#1 @@ -489,7 +522,7 @@ } } \NewDocumentCommand\RenewDocumentMathCommandPIE{m}{ - \__xparse_check_definable:nNT {#1} \RenewDocumentMathCommandPIE + \__mathcommand_check_definable:nNT {#1} \RenewDocumentMathCommandPIE { \__mathcommand_create_fork:N#1 \__mathcommand_error_if_not_exist_math:NF#1 @@ -497,7 +530,7 @@ } } \NewDocumentCommand\renewmathcommandPIE{m}{ - \__xparse_check_definable:nNT {#1} \renewmathcommandPIE + \__mathcommand_check_definable:nNT {#1} \renewmathcommandPIE { \__mathcommand_create_fork:N#1 \__mathcommand_error_if_not_exist_math:NF#1 @@ -505,14 +538,14 @@ } } \NewDocumentCommand\DeclareDocumentMathCommandPIE{m}{ - \__xparse_check_definable:nNT {#1} \DeclareDocumentMathCommand + \__mathcommand_check_definable:nNT {#1} \DeclareDocumentMathCommand { \__mathcommand_create_fork:N#1 \exp_args:Nc\DeclareDocumentCommand{\__mathcommand_to_mathtl:N#1} } } \NewDocumentCommand\declaremathcommandPIE{m}{ - \__xparse_check_definable:nNT {#1} \declaremathcommandPIE + \__mathcommand_check_definable:nNT {#1} \declaremathcommandPIE { \__mathcommand_create_fork:N#1 \exp_args:Nc\declarecommandPIE{\__mathcommand_to_mathtl:N#1} @@ -520,7 +553,7 @@ } \NewDocumentCommand\ProvideDocumentMathCommandPIE{mmm}{ - \__xparse_check_definable:nNT {#1} \ProvideDocumentMathCommandPIE + \__mathcommand_check_definable:nNT {#1} \ProvideDocumentMathCommandPIE { \__mathcommand_create_fork:N#1 \exp_args:Nc\ProvideDocumentCommandPIE{\__mathcommand_to_mathtl:N#1}{#2}{#3} @@ -614,7 +647,7 @@ \cs_new:Nn\mathcommand_disablecommand:N { \cs_if_exist:NTF#1{ - \__xparse_check_definable:nNT#1\disablecommand + \__mathcommand_check_definable:nNT#1\disablecommand {\tl_if_exist:cTF{\__mathcommand_to_disabled_help_tl:N#1} {} {\storecommand#1 @@ -653,6 +686,38 @@ \ProcessKeysOptions { mathcommand } % Parses the option list \NewDocumentCommand\mathcommandconfigure{ m } {\keys_set:nn{ mathcommand}{ #1} } +\cs_new_protected:Npn \__mathcommand_check_definable:nNT #1 + { \tl_trim_spaces_apply:nN {#1} \__mathcommand_check_definable_aux:nN } +\group_begin: + \char_set_catcode_active:n { `? } + \cs_new_protected:Npn \__mathcommand_check_definable_aux:nN #1#2 + { + \group_begin: + \tl_if_single_token:nTF {#1} + { + \int_set:Nn \tex_escapechar:D { 92 } + \exp_args:Nx \tl_if_empty:nTF + { \exp_args:No \str_tail:n { \token_to_str:N #1 } } + { + \exp_args:Nx \char_set_lccode:nn + { ` \str_head:n {#1} } { `? } + \tex_lowercase:D { \tl_if_eq:nnTF {#1} } { ? } + { \group_end: \use_iii:nnn } + { \group_end: \use_i:nnn } + } + { \group_end: \use_iii:nnn } + } + { \group_end: \use_ii:nnn } + { + \__kernel_msg_error:nnxx { mathcommand } { not-definable } + { \tl_to_str:n {#1} } { \token_to_str:N #2 } + } + { + \__kernel_msg_error:nnxx { mathcommand } { not-one-token } + { \tl_to_str:n {#1} } { \token_to_str:N #2 } + } + } +\group_end: \ExplSyntaxOff \endinput |