diff options
author | Karl Berry <karl@freefriends.org> | 2020-12-19 21:26:22 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-12-19 21:26:22 +0000 |
commit | 3320cb1941d08cbcf8838f61a16a436fabe1df2a (patch) | |
tree | 97f98d1a74c8aec49fa44769da91d7ed035d723a /Master/texmf-dist/tex/latex/menukeys | |
parent | 2908eb2689ddc98f7cfba4a9b7391afdbcf31d38 (diff) |
menukeys (19dec20)
git-svn-id: svn://tug.org/texlive/trunk@57172 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/menukeys')
-rw-r--r-- | Master/texmf-dist/tex/latex/menukeys/menukeys.sty | 137 |
1 files changed, 80 insertions, 57 deletions
diff --git a/Master/texmf-dist/tex/latex/menukeys/menukeys.sty b/Master/texmf-dist/tex/latex/menukeys/menukeys.sty index 3765286a07a..b6c28a440ba 100644 --- a/Master/texmf-dist/tex/latex/menukeys/menukeys.sty +++ b/Master/texmf-dist/tex/latex/menukeys/menukeys.sty @@ -16,7 +16,7 @@ %% 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 +%% https://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. @@ -28,11 +28,11 @@ %% license or (at your option) any later version. The latest version %% of this license is in the file %% -%% http://www.latex-project.org/lppl.txt +%% https://www.latex-project.org/lppl.txt %% \NeedsTeXFormat{LaTeX2e}[2009/01/01] \ProvidesPackage{menukeys} - [2020/10/31 v1.6 -- A package to format menus, paths and shortcuts] + [2020/12/19 v1.6.1 -- A package to format menus, paths and shortcuts] \RequirePackage{xparse} \RequirePackage{xstring} \RequirePackage{etoolbox} @@ -43,7 +43,8 @@ \RequirePackage{relsize} \ExplSyntaxOn \cs_new_eq:NN \tw@mk@trimspaces \tl_trim_spaces:n -\cs_new_eq:NN \tw@mk@expanded \use:x +\cs_new_eq:NN \tw@mk@exp@Nnno \exp_args:Nnno +\cs_new_eq:NN \tw@mk@string \cs_to_str:N \prg_generate_conditional_variant:Nnn \tl_if_in:nn { xx } { TF } \cs_new:Npn \tw@mk@xifinsetTF #1 #2 { @@ -85,12 +86,12 @@ \int_set:Nn \l__twmk_indris_int \l__twmk_indris_tl } } -\cs_generate_variant:Nn \seq_set_split:Nnn { Nno } +\cs_generate_variant:Nn \seq_set_split:Nnn { Noo } \cs_new_protected:Npn \tw@mk@indrisloop #1 #2 #3 { \__twmk_pushseq: \__twmk_pushint: - \seq_set_split:Nno \l__twmk_indris_seq {#1} {#2} + \seq_set_split:Noo \l__twmk_indris_seq {#1} {#2} \int_zero:N \l__twmk_indris_int \bool_do_while:nn { \bool_not_p:n { \seq_if_empty_p:N \l__twmk_indris_seq } } { @@ -651,7 +652,7 @@ \drawtikzfolder[\usemenucolor{c}][\usemenucolor{b}]% \hspace{0.2em plus 0.1em}% } -\edef\tw@default@input@sep{,} +\def\tw@default@input@sep{,} \def\CurrentMenuElement{} \begingroup \lccode`\,=1 @@ -664,60 +665,82 @@ }% }% } -\newcommand\tw@define@menu@macro[4]{% - \ifcsundef{tw@style@#4@sep}{% - \tw@mk@error{Can't define menu macro \string#2\space,\MessageBreak - because the style '#4' is not available!} - }{% - \csdef{tw@parse@menu@list@\expandafter\@gobble\string#2}##1{% - \tw@mk@iflastindris +\newcommand\tw@define@menu@macro[3] + {% + \IfNoValueTF{#3} + {\tw@mk@exp@Nnno\tw@define@menu@macro@{#1}{#2}\tw@default@input@sep} + {\tw@define@menu@macro@{#1}{#2}{#3}}% + } +\newcommand\tw@define@menu@macro@[4] + {% + \ifcsundef{tw@style@#4@sep} + {% + \tw@mk@error {% - \ifnum\tw@mk@indrisnr=\@ne - \def\CurrentMenuElement{##1}% - \@nameuse{tw@style@#4@single}% - \else - \def\CurrentMenuElement{##1}% - \@nameuse{tw@style@#4@sep}\@nameuse{tw@style@#4@last}% - \fi - } + Can't define menu macro \string#2\space,\MessageBreak + because the style '#4' is not available!% + }% + } + {% + \csdef{tw@parse@menu@list@\tw@mk@string#2}##1% {% - \ifnum\tw@mk@indrisnr=\@ne - \def\CurrentMenuElement{##1}% - \@nameuse{tw@style@#4@first}% - \else - \def\CurrentMenuElement{##1}% - \@nameuse{tw@style@#4@sep}\@nameuse{tw@style@#4@mid}% - \fi + \def\CurrentMenuElement{##1}% + \tw@mk@iflastindris + {% + \ifnum\tw@mk@indrisnr=\@ne + \@nameuse{tw@style@#4@single}% + \else + \@nameuse{tw@style@#4@sep}% + \@nameuse{tw@style@#4@last}% + \fi + } + {% + \ifnum\tw@mk@indrisnr=\@ne + \@nameuse{tw@style@#4@first}% + \else + \@nameuse{tw@style@#4@sep}% + \@nameuse{tw@style@#4@mid}% + \fi + }% + }% + #1#2{+O{#3}+m}% + {% + \leavevmode + \begingroup + \def\tw@current@color@theme + {\csname tw@style@#4@color@theme\endcsname}% + \@nameuse{tw@style@#4@pre}% + \tw@mk@test@input@sep{##1} + {% + \edef\tw@menu@list{\detokenize{##2}}% + \edef\tw@mk@tempa{\@backslashchar}% + } + {% + \edef\tw@menu@list{\unexpanded{##2}}% + \edef\tw@mk@tempa{\tw@mk@trimspaces{##1}}% + }% + \begingroup + \letcs{\tw@mk@tempb}{tw@parse@menu@list@\tw@mk@string#2}% + \tw@mk@indrisloop\tw@mk@tempa\tw@menu@list\tw@mk@tempb + \endgroup + \@nameuse{tw@style@#4@post}% + \endgroup }% }% - #1 #2 { +O{#3} +m }{% - \leavevmode% - {\def\tw@current@color@theme{\csname tw@style@#4@color@theme\endcsname}% - \@nameuse{tw@style@#4@pre}% - \tw@mk@test@input@sep{##1}{% - \edef\tw@menu@list{\detokenize{##2}}\edef\tw@mk@tempa{\@backslashchar}% - }{% - \edef\tw@menu@list{\unexpanded{##2}}\edef\tw@mk@tempa{\tw@mk@trimspaces{##1}}% - }% - {\letcs{\tw@mk@tempb}{tw@parse@menu@list@\expandafter\@gobble\string#2}% - \tw@mk@expanded{\tw@mk@indrisloop{\tw@mk@tempa}}\tw@menu@list\tw@mk@tempb}% - \@nameuse{tw@style@#4@post}}% - }% - }% -} -\NewDocumentCommand{\newmenumacro}{m O{\tw@default@input@sep} m}{% - \ifcsundef{\expandafter\@gobble\string#1}{% + } +\NewDocumentCommand{\newmenumacro}{m o m}{% + \ifcsundef{\tw@mk@string#1}{% \tw@define@menu@macro\NewDocumentCommand{#1}{#2}{#3}% }{% \tw@mk@error{Menu macro '\string#1' already defined!\MessageBreak Use \string\renewmenustyle\space instead.}% }% } -\NewDocumentCommand{\renewmenumacro}{m O{\tw@default@input@sep} m}{% +\NewDocumentCommand{\renewmenumacro}{m o m}{% \tw@define@menu@macro\RenewDocumentCommand{#1}{#2}{#3}% } -\NewDocumentCommand{\providemenumacro}{m O{\tw@default@input@sep} m}{% - \ifcsundef{\expandafter\@gobble\string#1}{% +\NewDocumentCommand{\providemenumacro}{m o m}{% + \ifcsundef{\tw@mk@string#1}{% \tw@define@menu@macro\ProvideDocumentCommand{#1}{#2}{#3}% }{% \tw@mk@warning{Menu macro '\string#1' already defined!\MessageBreak @@ -737,25 +760,25 @@ } \NewDocumentCommand{\tw@make@key@macro}{s m}{% \IfBooleanTF{#1}{% - \expandafter\providecommand\csname\expandafter\@gobble\string#2\endcsname{% + \expandafter\providecommand\csname\tw@mk@string#2\endcsname{% \expandonce{\maxsizebox{!}{1.8ex}{% - \@nameuse{tw@mk@\expandafter\@gobble\string#2@\tw@mk@os}}% + \@nameuse{tw@mk@\tw@mk@string#2@\tw@mk@os}}% }% }% - \expandafter\providecommand\csname\expandafter\@gobble\string#2mac\endcsname{% + \expandafter\providecommand\csname\tw@mk@string#2mac\endcsname{% \expandonce{\maxsizebox{!}{1.8ex}{% - \@nameuse{tw@mk@\expandafter\@gobble\string#2@mac}}% + \@nameuse{tw@mk@\tw@mk@string#2@mac}}% }% }% - \expandafter\providecommand\csname\expandafter\@gobble\string#2win\endcsname{% + \expandafter\providecommand\csname\tw@mk@string#2win\endcsname{% \expandonce{\maxsizebox{!}{1.8ex}{% - \@nameuse{tw@mk@\expandafter\@gobble\string#2@win}}% + \@nameuse{tw@mk@\tw@mk@string#2@win}}% }% }% }{% - \expandafter\providecommand\csname\expandafter\@gobble\string#2\endcsname{% + \expandafter\providecommand\csname\tw@mk@string#2\endcsname{% \expandonce{\maxsizebox{!}{1.8ex}{% - \@nameuse{tw@mk@\expandafter\@gobble\string#2}}% + \@nameuse{tw@mk@\tw@mk@string#2}}% }% }% }% |