diff options
author | Karl Berry <karl@freefriends.org> | 2021-09-05 20:49:05 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-09-05 20:49:05 +0000 |
commit | 4841514f93738ae48601c6e37f8604dccd76dea4 (patch) | |
tree | 6633fe98c48be670131f815f27f39ad088ae3f7c /Master/texmf-dist/tex/latex | |
parent | a885837818d2bc1620e60f9e811b923b50f9d2b1 (diff) |
styledcmd
git-svn-id: svn://tug.org/texlive/trunk@60430 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/styledcmd/styledcmd.sty | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/Master/texmf-dist/tex/latex/styledcmd/styledcmd.sty b/Master/texmf-dist/tex/latex/styledcmd/styledcmd.sty index f0fec34cff7..5fecba7753f 100644 --- a/Master/texmf-dist/tex/latex/styledcmd/styledcmd.sty +++ b/Master/texmf-dist/tex/latex/styledcmd/styledcmd.sty @@ -26,7 +26,7 @@ %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3}[2018-04-12] -\ProvidesExplPackage{styledcmd}{2021/08/20}{1.0}{Command with different styles} +\ProvidesExplPackage{styledcmd}{2021/08/20}{1.1}{Command with different styles} \RequirePackage{xparse} \str_const:Nn \c__stycmd_defname_str{ default } @@ -57,7 +57,7 @@ { \msg_error:nnnn { stycmd } { noformat } {#1} {#2} } } -\cs_generate_variant:Nn \__stycmd_erroring:nn { nV } +\cs_generate_variant:Nn \__stycmd_erroring:nn { nV, VV } \msg_new:nnn { stycmd } { deferror } { Cannot~define~a~style~with~name~default @@ -113,29 +113,32 @@ \str_set:Nx \l__stycmd_fexp_str {#2} \__stycmd_deferr: } -\NewDocumentCommand \newstyledcmd { m m o +m } +\cs_new_protected:Npn \stycmd_generate:NN #1#2 { - \__stycmd_init_vars:Nn { #1 } { #2 } - \IfNoValueTF {#3} - { - \exp_args:Nc \newcommand { \__stycmd_cmd: } {#4} - } + \NewDocumentCommand #1 {m m} { - \exp_args:Nc \newcommand { \__stycmd_cmd: } [#3] {#4} + \__stycmd_init_vars:Nn { ##1 } { ##2 } + \__stycmd_macro_default:VV \l__stycmd_cexp_str \l__stycmd_fexp_str + \__stycmd_macro_declaration:V \l__stycmd_cexp_str + \exp_args:Nc #2 { \__stycmd_cmd: } } - - \__stycmd_macro_default:VV \l__stycmd_cexp_str \l__stycmd_fexp_str - \__stycmd_macro_declaration:V \l__stycmd_cexp_str } -\NewDocumentCommand \NewDocStyledCMD {m m m +m} - { - \__stycmd_init_vars:Nn { #1 } { #2 } - - \exp_args:Nc \NewDocumentCommand { \__stycmd_cmd: } {#3} {#4} - \__stycmd_macro_default:VV \l__stycmd_cexp_str \l__stycmd_fexp_str - \__stycmd_macro_declaration:V \l__stycmd_cexp_str +\cs_new_protected:Npn \stycmd_generate_renew:NN #1#2 + { + \NewDocumentCommand #1 {m m} + { + \__stycmd_init_vars:Nn { ##1 } { ##2 } + \__stycmd_erroring:VV \l__stycmd_cexp_str \l__stycmd_fexp_str + \exp_args:Nc #2 { \__stycmd_cmd: } + } } +\stycmd_generate:NN \newstyledcmd \newcommand +\stycmd_generate_renew:NN \renewstyledcmd \renewcommand +\stycmd_generate:NN \providestyledcmd \providecommand +\stycmd_generate:NN \NewDocStyledCMD \NewDocumentCommand +\stycmd_generate_renew:NN \RenewDocStyledCMD \RenewDocumentCommand +\stycmd_generate:NN \ProvideDocStyledCMD \ProvideDocumentCommand \NewDocumentCommand \setGlobalStyle{m m}{ \__stycmd_init_vars:Nn { #1 } { #2 } |