texlive[56822] Master/texmf-dist: menukeys (31oct20)
commits+karl at tug.org
commits+karl at tug.org
Sat Oct 31 22:05:52 CET 2020
Revision: 56822
http://tug.org/svn/texlive?view=revision&revision=56822
Author: karl
Date: 2020-10-31 22:05:52 +0100 (Sat, 31 Oct 2020)
Log Message:
-----------
menukeys (31oct20)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/menukeys/README
trunk/Master/texmf-dist/doc/latex/menukeys/menukeys.pdf
trunk/Master/texmf-dist/source/latex/menukeys/menukeys.dtx
trunk/Master/texmf-dist/source/latex/menukeys/menukeys.ins
trunk/Master/texmf-dist/tex/latex/menukeys/menukeys.sty
Modified: trunk/Master/texmf-dist/doc/latex/menukeys/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/menukeys/README 2020-10-31 21:05:36 UTC (rev 56821)
+++ trunk/Master/texmf-dist/doc/latex/menukeys/README 2020-10-31 21:05:52 UTC (rev 56822)
@@ -20,11 +20,14 @@
License:
-This material is subject to the LaTeX Project Public License.
-See http://mirror.ctan.org/help/Catalogue/licenses.lppl.html
-for the details of that license.
+This material is subject to the LaTeX Project Public License
+(LPPL), either version 1.3c of this 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
+
Files:
* README - this file
* menukeys.dtx - source file
Modified: trunk/Master/texmf-dist/doc/latex/menukeys/menukeys.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/menukeys/menukeys.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/menukeys/menukeys.dtx 2020-10-31 21:05:36 UTC (rev 56821)
+++ trunk/Master/texmf-dist/source/latex/menukeys/menukeys.dtx 2020-10-31 21:05:52 UTC (rev 56822)
@@ -1,24 +1,17 @@
% \iffalse meta-comment
-%
-% Copyright (c) 2016 by Tobias Weh
-% www.tobias-weh.de
-%
-% This file 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.2 or later is part of all distributions of
-% LaTeX version 1999/12/01 or later.
-%
-% \fi
-%
-% \iffalse
+%% File: menukeys.dtx Copyright (c) Tobias Weh
+%%
+%% This file may be distributed and/or modified under the conditions of the
+%% LaTeX Project Public License (LPPL), either version 1.3c of this
+%% 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
+%%
%<package>\NeedsTeXFormat{LaTeX2e}[2009/01/01]
%<package>\ProvidesPackage{menukeys}
-%<package> [2016/08/08 v1.5 -- A package to format menus, paths and shortcuts]
+%<package> [2020/10/31 v1.6 -- A package to format menus, paths and shortcuts]
%
%<*driver>
\documentclass{ltxdoc}
@@ -29,7 +22,6 @@
\usepackage[english]{babel}
\usepackage{menukeys}
\usepackage{xspace}
-\usepackage{lmodern}
\usepackage[hang]{footmisc}
\usepackage{dblfnote}
\setlength{\footnotemargin}{1em}
@@ -269,10 +261,10 @@
% \DoNotIndex{\viipt,\vipt,\vskip,\vspace}
% \DoNotIndex{\wd,\xiipt,\year,\z@}
% \expandafter\DoNotIndex{\,}
-% \DoNotIndex{\next,\unexpanded,\xifinsetTF,\robust at def,\@backslashchar,
-% \@ifundefinedcolor,\@nameuse,\detokenize,\cpt at parserlist,\cptexpanded
-% \cptrobustify,\cpttrimspaces,\cslet,\csname,\edef,\endcsname,\iflastindris,
-% \indrisloop,\indrisnr,\NewDocumentCommand,\cptexpanded}
+% \DoNotIndex{\next,\unexpanded,\@backslashchar,
+% \@ifundefinedcolor,\@nameuse,\detokenize,
+% \cslet,\csname,\edef,\endcsname,
+% \NewDocumentCommand}
% \DoNotIndex{\@afterheading,\@afterindentfalse,\@ifpackageloaded,\ ,
% \appto,\AtBeginDocument,\AtEndPreamble,\baselineskip,\BODY,
% \centering,\contentspage,\CurrentOption,\dots,\endquote,\fill,\filright,
@@ -285,7 +277,8 @@
% \DoNotIndex{\lccode,\listof,\lowercase,\PackageWarningNoLine,\PackageError,
% \PackageWarning,\renewenvironment,\romannumeral,\string,\strut}
% \DoNotIndex{\csdef,\cslet\csletcs,\letcs,\DeclareDocumentCommand,\ifcsundef,
-% \RenewDocumentCommand,\NewDocumentCommand,\hspace,\IfBooleanTF,\IfSubStr}
+% \RenewDocumentCommand,\ProvideDocumentCommand,\NewDocumentCommand,\hspace,
+% \IfBooleanTF,\IfSubStr}
% \DoNotIndex{\tikz,\node,\draw,\definecolor,\colorlet,\usetikzlibrary,
% \texttt,\textcolor,\raisebox,\maxsizebox,\small,\ttfamily,\DeclareBoolOption}
% \DoNotIndex{\value,\usebox,\sbox,\providecommand,\ProcessKeyvalOptions,\newbox,
@@ -310,9 +303,13 @@
% If you like to support this package -- especially improving or proofreading the
% manual -- send me an e-mail, please.
% \par\bigskip\noindent
-% \emph{Many thanks to Ahmed Musa, who provided the list parsing code at
-% \url{http://tex.stackexchange.com/a/44989/4918}.}
-% \end{abstract}
+% \emph{Many thanks to Ahmed Musa, who provided the original list parsing
+% code at \url{http://tex.stackexchange.com/a/44989/4918}.}
+% \par\bigskip\noindent
+% \emph{Special thanks to Jonathan P.\@ Spratte, who made the changes in v1.6
+% to remove the \pkg{catoptions} dependency so that \pkg{menukeys} works with
+% \LaTeX\ releases starting from 2020/10/01.}
+% \end{abstract}
%
% \newpage\tableofcontents\newpage
%
@@ -369,10 +366,12 @@
% \end{verbatim}
%
% \section{Package loading and options}\label{options}
-% Since \menukeys uses \pkg{catoptions}, which does some heavy changes on key-value
-% options, it is recommended to load \menukeys as the \textbf{last package}
+% \changes{v1.6}{2020/10/27}{Load order no longer important}
+% Since \menukeys used to use \pkg{catoptions}, which does some heavy changes on key-value
+% options, it \textbf{was} recommended to load \menukeys as the last package
% (even after \pkg{hyperref}\footnote{See \url{http://tex.stackexchange.com/q/237683/4918}
-% and \url{https://github.com/tweh/menukeys/issues/41}.})!
+% and \url{https://github.com/tweh/menukeys/issues/41}.}).
+% \textbf{This is no longer the case!}
%
% These are the possible options:
% \begin{description}
@@ -394,8 +393,7 @@
% value is |symbols|.
% \item [os:] You can specify the OS \DO{os} by saying |os=mac| or |os=win|. This will cause
% some key macros to be rendered differently. The default value is |mac|.
-% \item [hyperrefcolorlinks:] Use this if you want \pkg{hyperref}'s \DO{hyperrefcolorlinks}
-% colored links, since you can't use the \pkg{hyperref} option \opt{colorlinks} directly
+% \item [hyperrefcolorlinks:] \emph{Obsolete}
% (see sec.~\ref{sec:issues} and~\ref{sec:hyperref-colorlinks}).
% \end{description}
%
@@ -743,18 +741,17 @@
% \menukeys must be loaded after \pkg{xcolor}, if you load
% the latter with options. Otherwise you'll get an option clash
% Since \menukeys loads \pkg{xcolor} internally you may pass
-% options as global options via |\documentclass|.
+% options as global options via |\documentclass| or directly to it via
+% |\PassOptionsToPackage|.
% \example Set \pkg{xcolor} to |cmyk| model:
% \begin{verbatim}
-% \documentclass[cmyk]{article}
+% \documentclass{article}
+% \PassOptionsToPackage{cmyk}{xcolor}
% \usepackage{menukeys}
% \begin{document}
% Hello World!
% \end{document}
% \end{verbatim}
-% \item Using \pkg{hyperref} with the \opt{colorlinks} options causes
-% an option clash. If you want colored links please load \pkg{hyperref}
-% \emph{without} this option and load \pkg{menukeys} with \opt{hyperrefcolorlinks}.
% \end{itemize}
%
% If you find something to add to this list please send me an e-mail or report a
@@ -764,6 +761,7 @@
%
% \section{Implementation}
% \subsection{Required packages}
+% \changes{v1.6}{2020/10/27}{Don't load \pkg{catoptions}}
% Load the required packages
% \begin{macrocode}
\RequirePackage{xparse}
@@ -787,10 +785,103 @@
\RequirePackage{relsize}
% \end{macrocode}
% To define the list parsing commands and allow |\| as
-% a separator we load \pkg{catoptions}
+% a separator we used to load \pkg{catoptions}. Instead we now use some
+% \pkg{expl3} functions to replace the macros we required from \pkg{catoptions}.
+%
+% The first few of these functions are more or less direct equivalents. A bit of
+% attention has to be paid for |\tw at mk@xifinsetTF| as it requires the arguments
+% to get swapped.
% \begin{macrocode}
-\RequirePackage{catoptions}[2011/12/07]
+\ExplSyntaxOn
+\cs_new_eq:NN \tw at mk@trimspaces \tl_trim_spaces:n
+\cs_new_eq:NN \tw at mk@expanded \use:x
+\prg_generate_conditional_variant:Nnn \tl_if_in:nn { xx } { TF }
+\cs_new:Npn \tw at mk@xifinsetTF #1 #2
+ {
+ \tl_if_in:xxTF {#2} {#1}
+ }
% \end{macrocode}
+% The replacement for |\indrisloop| will not set the conditional
+% |\iflastindris|, instead we can check whether the sequence is empty to see
+% whether this is the last element. This test will not use a TeX-like
+% |\iflastindris...\else...\fi| construct but instead two branches.
+% \begin{macrocode}
+\cs_new:Npn \tw at mk@iflastindris
+ {
+ \seq_if_empty:NTF \l__twmk_indris_seq
+ }
+% \end{macrocode}
+% Replacing |\indrisloop| is a bit more work as it requires us to push some
+% values to a stack (to allow nested usage, this may not be necessary for
+% \pkg{menukeys}, but it is part of the original |\indrisloop| so we should
+% play nice here). First we'll need a few variables.
+% \begin{macrocode}
+\seq_new:N \l__twmk_indris_seq
+\int_new:N \l__twmk_indris_int
+\tl_new:N \l__twmk_indris_tl
+\cs_new_eq:NN \tw at mk@indrisnr \l__twmk_indris_int
+\seq_new:N \l__twmk_indris_seqstack_seq
+\seq_new:N \l__twmk_indris_intstack_seq
+% \end{macrocode}
+% Our stack will use another sequence in which the definitions of the parent
+% call will be stored for the sequence and the integer. The other variables put
+% on a stack by |\indrisloop| aren't required. The synopsis of
+% |\tw at mk@indrisloop| will be different to the one provided by \pkg{catoptions}.
+% The delimiter will be a mandatory argument (not in brackets), and there is no
+% starred version.
+% \begin{macrocode}
+\cs_new_protected:Npn \__twmk_pushseq:
+ {
+ \seq_push:No \l__twmk_indris_seqstack_seq \l__twmk_indris_seq
+ }
+\cs_new_protected:Npn \__twmk_pushint:
+ {
+ \seq_push:NV \l__twmk_indris_intstack_seq \l__twmk_indris_int
+ }
+\cs_new_protected:Npn \__twmk_popseq:
+ {
+ \seq_if_empty:NTF \l__twmk_indris_seqstack_seq
+ { \seq_clear:N \l__twmk_indris_seq }
+ { \seq_pop:NN \l__twmk_indris_seqstack_seq \l__twmk_indris_seq }
+ }
+\cs_new_protected:Npn \__twmk_popint:
+ {
+ \seq_if_empty:NTF \l__twmk_indris_intstack_seq
+ { \int_zero:N \l__twmk_indris_int }
+ {
+ \group_begin:
+ \seq_pop:NN \l__twmk_indris_intstack_seq \l__twmk_indris_tl
+ \exp_args:NNNo
+ \group_end:
+ \int_set:Nn \l__twmk_indris_int \l__twmk_indris_tl
+ }
+ }
+% \end{macrocode}
+% The real loop works by first splitting the input into a sequence according to
+% the delimiter in |#1|. Then this sequence is stepped through, but instead of
+% using |\seq_map:NN| we'll have to pop the sequence into a local variable so
+% that our test for the last element works. The parameter |#2| has to be
+% expanded once as it is handed in as a token storing the real argument in later
+% use.
+% \begin{macrocode}
+\cs_generate_variant:Nn \seq_set_split:Nnn { Nno }
+\cs_new_protected:Npn \tw at mk@indrisloop #1 #2 #3
+ {
+ \__twmk_pushseq:
+ \__twmk_pushint:
+ \seq_set_split:Nno \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 } }
+ {
+ \int_incr:N \l__twmk_indris_int
+ \seq_pop_left:NN \l__twmk_indris_seq \l__twmk_indris_tl
+ \exp_args:No #3 \l__twmk_indris_tl
+ }
+ \__twmk_popseq:
+ \__twmk_popint:
+ }
+\ExplSyntaxOff
+% \end{macrocode}
%
% \subsection{Helper macros}
% \begin{macro}{\tw at mk@error}\begin{macro}{\tw at mk@warning}
@@ -853,32 +944,22 @@
% \end{macrocode}
%
% \subsection{Workarounds}
-% Some workarounds to ``slove'' some incompatibilities:
+% Some workarounds to ``solve'' some incompatibilities:
% \subsubsection{\pkg{hyperref}'s \opt{colorlinks} option}\label{sec:hyperref-colorlinks}
+% \changes{v1.6}{2020/10/27}{\opt{hyperrefcolorlinks} obsolete}
% \changes{v1.5}{2016/08/08}{New option \opt{hyperrefcolorlinks}}
-% Since the \opt{colorlinks} option of \pkg{hyperref} loads \pkg{color} (with
-% some kind of |\AtBeginDocument|) it results in an option clas due to the
-% changes made by \pkg{catoptions}. Thus one can't use \opt{colorlinks}. Here we
-% provide the code to activate colored links without the extra loading of
-% \pkg{color}.
+% There used to be an issue with using the \opt{colorlinks} option of
+% \pkg{hyperref} due to \pkg{catoptions} being loaded. Since \pkg{catoptions}
+% isn't required any more, this workaround isn't necessary. For backwards
+% compatibility the \opt{hyperrefcolorlinks} option is still evaluated and just
+% uses |\hypersetup| or |\PassOptionsToPackage| depending on whether
+% \pkg{hyperref} is already loaded.
% \begin{macrocode}
\iftw at mk@hyperrefcolorlinks
- \Hy at AtBeginDocument{% (hyperref.sty, line 4790)
- \def\@pdfborder{0 0 0}% (hyperref.sty, line 4806...)
- \let\@pdfborderstyle\@empty
-% \ifHy at typexml% <--------------+
-% \else% | This part
-% \Hy at CatcodeWrapper{% | bust be
-% \RequirePackage{color}% | omitted
-% }% |
-% \fi% <------------------------+
- \def\Hy at colorlink#1{%
- \begingroup
- \HyColor at UseColor#1%
- }%
- \def\Hy at endcolorlink{\endgroup}%
- \Hy at Info{Link coloring ON}%
- }
+ \tw at mk@warning{The option `hyperrefcolorlinks' is obsolete}
+ \@ifpackageloaded{hyperref}
+ {\hypersetup{colorlinks}}
+ {\PassOptionsToPackage{colorlinks}{hyperref}}
\fi
% \end{macrocode}
%
@@ -1505,88 +1586,95 @@
% by deleting the line to make the command robust.}
% \changes{v1.2}{2013/07/23}{Replaced \cs{edef} by \cs{protected at edef}}
% \changes{v1.2c}{2013/07/23}{Replaced \cs{protected at edef} by \cs{def}}
-% \changes{v1.2}{2013/07/23}{Addded \cs{leavevmode}}
+% \changes{v1.2}{2013/07/23}{Added \cs{leavevmode}}
+% \changes{v1.6}{2020/10/27}{Don't use \cs{NewDocumentCommand}}
% Then we set up the internal command to create new menu macros.
% The list parsing code was essentially provided by Ahmed Musa at
-% \url{http://tex.stackexchange.com/a/44989/4918}. Thank you very much!
+% \url{http://tex.stackexchange.com/a/44989/4918}. Jonathan P.\@ Spratte
+% made some major changes to make \pkg{menukeys} work without \pkg{catoptions}
+% and reimplemented the parsing code usding \LaTeX3. Thank you both very much!
% \begin{macrocode}
\begingroup
\lccode`\,=1
\lowercase{\endgroup
- \robust at def*\tw at mk@test at input@sep#1{%
- \xifinsetTF{,\cpttrimspaces{#1},}{,bslash,backslash,directory,location,}%
- }%
+ \@ifdefinable\tw at mk@test at input@sep
+ {%
+ \protected\def\tw at mk@test at input@sep#1{%
+ \tw at mk@xifinsetTF
+ {,\tw at mk@trimspaces{#1},}{,bslash,backslash,directory,location,}%
+ }%
+ }%
}
-\NewDocumentCommand{\tw at define@menu at macro}{%
- m O{\tw at default@input at sep} m
-}{%
- \ifcsundef{tw at style@#3 at sep}{%
- \tw at mk@error{Can't define menu macro \string#1\space,\MessageBreak
- because the style '#3' is not available!}
+\newcommand\tw at define@menu at macro[4]{%
+ \ifcsundef{tw at style@#4 at sep}{%
+ \tw at mk@error{Can't define menu macro \string#2\space,\MessageBreak
+ because the style '#4' is not available!}
}{%
- \csdef{tw at parse@menu at list@\expandafter\@gobble\string#1}##1{%
- \iflastindris
- \ifnum\indrisnr=\@ne
+ \csdef{tw at parse@menu at list@\expandafter\@gobble\string#2}##1{%
+ \tw at mk@iflastindris
+ {%
+ \ifnum\tw at mk@indrisnr=\@ne
\def\CurrentMenuElement{##1}%
- \@nameuse{tw at style@#3 at single}%
+ \@nameuse{tw at style@#4 at single}%
\else
\def\CurrentMenuElement{##1}%
- \@nameuse{tw at style@#3 at sep}\@nameuse{tw at style@#3 at last}%
+ \@nameuse{tw at style@#4 at sep}\@nameuse{tw at style@#4 at last}%
\fi
- \else
- \ifnum\indrisnr=\@ne
+ }
+ {%
+ \ifnum\tw at mk@indrisnr=\@ne
\def\CurrentMenuElement{##1}%
- \@nameuse{tw at style@#3 at first}%
+ \@nameuse{tw at style@#4 at first}%
\else
\def\CurrentMenuElement{##1}%
- \@nameuse{tw at style@#3 at sep}\@nameuse{tw at style@#3 at mid}%
+ \@nameuse{tw at style@#4 at sep}\@nameuse{tw at style@#4 at mid}%
\fi
- \fi
+ }%
}%
- \expandafter\newcommand\csname\expandafter\@gobble\string#1\endcsname[2][#2]{%
+ #1 #2 { +O{#3} +m }{%
\leavevmode%
- {\def\tw at current@color at theme{\csname tw at style@#3 at color@theme\endcsname}%
- \@nameuse{tw at style@#3 at pre}%
+ {\def\tw at current@color at theme{\csname tw at style@#4 at color@theme\endcsname}%
+ \@nameuse{tw at style@#4 at pre}%
\tw at mk@test at input@sep{##1}{%
\edef\tw at menu@list{\detokenize{##2}}\edef\tw at mk@tempa{\@backslashchar}%
}{%
- \edef\tw at menu@list{\unexpanded{##2}}\edef\tw at mk@tempa{\cpttrimspaces{##1}}%
+ \edef\tw at menu@list{\unexpanded{##2}}\edef\tw at mk@tempa{\tw at mk@trimspaces{##1}}%
}%
- {\letcs{\tw at mk@tempb}{tw at parse@menu at list@\expandafter\@gobble\string#1}%
- \cptexpanded{\indrisloop*[\tw at mk@tempa]}\tw at menu@list\tw at mk@tempb}%
- \@nameuse{tw at style@#3 at post}}%
+ {\letcs{\tw at mk@tempb}{tw at parse@menu at list@\expandafter\@gobble\string#2}%
+ \tw at mk@expanded{\tw at mk@indrisloop{\tw at mk@tempa}}\tw at menu@list\tw at mk@tempb}%
+ \@nameuse{tw at style@#4 at post}}%
}%
}%
}
-\edef\cpt at parserlist{\cpt at parserlist\@backslashchar}
% \end{macrocode}
% \end{macro}
% \subsubsection{User-level commands}
% \begin{macro}{\newmenumacro}
% \changes{v1.1a}{2013/05/28}{Added a line to make a new macro robust.}
+% \changes{v1.6}{2020/10/27}{use \cs{NewDocumentCommand}}
% \begin{macro}{\renewmenumacro}
+% \changes{v1.6}{2020/10/27}{use \cs{RenewDocumentCommand}}
% \begin{macro}{\providemenumacro}
+% \changes{v1.6}{2020/10/27}{use \cs{ProvideDocumentCommand}}
% Now it's time to build the user-level commands
% \begin{macrocode}
\NewDocumentCommand{\newmenumacro}{m O{\tw at default@input at sep} m}{%
\ifcsundef{\expandafter\@gobble\string#1}{%
- \tw at define@menu at macro{#1}[#2]{#3}%
- \expandafter\cptrobustify\csname\expandafter\@gobble\string#1\endcsname
- }{
+ \tw at define@menu at macro\NewDocumentCommand{#1}{#2}{#3}%
+ }{%
\tw at mk@error{Menu macro '\string#1' already defined!\MessageBreak
- Use \string\renewmenustyle\space instead.}
+ Use \string\renewmenustyle\space instead.}%
}%
}
\NewDocumentCommand{\renewmenumacro}{m O{\tw at default@input at sep} m}{%
- \cslet{\expandafter\@gobble\string#1}{\relax}%
- \tw at define@menu at macro{#1}[#2]{#3}%
+ \tw at define@menu at macro\RenewDocumentCommand{#1}{#2}{#3}%
}
\NewDocumentCommand{\providemenumacro}{m O{\tw at default@input at sep} m}{%
\ifcsundef{\expandafter\@gobble\string#1}{%
- \tw at define@menu at macro{#1}[#2]{#3}%
- }{
+ \tw at define@menu at macro\ProvideDocumentCommand{#1}{#2}{#3}%
+ }{%
\tw at mk@warning{Menu macro '\string#1' already defined!\MessageBreak
- Use \string\renewmenustyle\space to redefine it.}
+ Use \string\renewmenustyle\space to redefine it.}%
}%
}
% \end{macrocode}
@@ -1989,4 +2077,4 @@
%
%
% \Finale
-\endinput
\ No newline at end of file
+\endinput
Modified: trunk/Master/texmf-dist/source/latex/menukeys/menukeys.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/menukeys/menukeys.ins 2020-10-31 21:05:36 UTC (rev 56821)
+++ trunk/Master/texmf-dist/source/latex/menukeys/menukeys.ins 2020-10-31 21:05:52 UTC (rev 56822)
@@ -1,18 +1,16 @@
-%%
-%% Copyright (C) 2016 by Tobias Weh
-%% www.tobiw.de/en
-%%
-%% This file 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.2 or later is part of all distributions of
-%% LaTeX version 1999/12/01 or later.
-%%
+\iffalse meta-comment
+File menukeys.ins Copyright (c) Tobias Weh
+
+This file may be distributed and/or modified under the conditions of the
+LaTeX Project Public License (LPPL), either version 1.3c of this
+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
+
+\fi
+
\input docstrip.tex
\keepsilent
Modified: trunk/Master/texmf-dist/tex/latex/menukeys/menukeys.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/menukeys/menukeys.sty 2020-10-31 21:05:36 UTC (rev 56821)
+++ trunk/Master/texmf-dist/tex/latex/menukeys/menukeys.sty 2020-10-31 21:05:52 UTC (rev 56822)
@@ -21,9 +21,18 @@
%% and version 1.2 or later is part of all distributions of
%% LaTeX version 1999/12/01 or later.
%%
+%% File: menukeys.dtx Copyright (c) Tobias Weh
+%%
+%% This file may be distributed and/or modified under the conditions of the
+%% LaTeX Project Public License (LPPL), either version 1.3c of this
+%% 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
+%%
\NeedsTeXFormat{LaTeX2e}[2009/01/01]
\ProvidesPackage{menukeys}
- [2016/08/08 v1.5 -- A package to format menus, paths and shortcuts]
+ [2020/10/31 v1.6 -- A package to format menus, paths and shortcuts]
\RequirePackage{xparse}
\RequirePackage{xstring}
\RequirePackage{etoolbox}
@@ -32,7 +41,67 @@
\RequirePackage{xcolor}
\RequirePackage{adjustbox}
\RequirePackage{relsize}
-\RequirePackage{catoptions}[2011/12/07]
+\ExplSyntaxOn
+\cs_new_eq:NN \tw at mk@trimspaces \tl_trim_spaces:n
+\cs_new_eq:NN \tw at mk@expanded \use:x
+\prg_generate_conditional_variant:Nnn \tl_if_in:nn { xx } { TF }
+\cs_new:Npn \tw at mk@xifinsetTF #1 #2
+ {
+ \tl_if_in:xxTF {#2} {#1}
+ }
+\cs_new:Npn \tw at mk@iflastindris
+ {
+ \seq_if_empty:NTF \l__twmk_indris_seq
+ }
+\seq_new:N \l__twmk_indris_seq
+\int_new:N \l__twmk_indris_int
+\tl_new:N \l__twmk_indris_tl
+\cs_new_eq:NN \tw at mk@indrisnr \l__twmk_indris_int
+\seq_new:N \l__twmk_indris_seqstack_seq
+\seq_new:N \l__twmk_indris_intstack_seq
+\cs_new_protected:Npn \__twmk_pushseq:
+ {
+ \seq_push:No \l__twmk_indris_seqstack_seq \l__twmk_indris_seq
+ }
+\cs_new_protected:Npn \__twmk_pushint:
+ {
+ \seq_push:NV \l__twmk_indris_intstack_seq \l__twmk_indris_int
+ }
+\cs_new_protected:Npn \__twmk_popseq:
+ {
+ \seq_if_empty:NTF \l__twmk_indris_seqstack_seq
+ { \seq_clear:N \l__twmk_indris_seq }
+ { \seq_pop:NN \l__twmk_indris_seqstack_seq \l__twmk_indris_seq }
+ }
+\cs_new_protected:Npn \__twmk_popint:
+ {
+ \seq_if_empty:NTF \l__twmk_indris_intstack_seq
+ { \int_zero:N \l__twmk_indris_int }
+ {
+ \group_begin:
+ \seq_pop:NN \l__twmk_indris_intstack_seq \l__twmk_indris_tl
+ \exp_args:NNNo
+ \group_end:
+ \int_set:Nn \l__twmk_indris_int \l__twmk_indris_tl
+ }
+ }
+\cs_generate_variant:Nn \seq_set_split:Nnn { Nno }
+\cs_new_protected:Npn \tw at mk@indrisloop #1 #2 #3
+ {
+ \__twmk_pushseq:
+ \__twmk_pushint:
+ \seq_set_split:Nno \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 } }
+ {
+ \int_incr:N \l__twmk_indris_int
+ \seq_pop_left:NN \l__twmk_indris_seq \l__twmk_indris_tl
+ \exp_args:No #3 \l__twmk_indris_tl
+ }
+ \__twmk_popseq:
+ \__twmk_popint:
+ }
+\ExplSyntaxOff
\newcommand*{\tw at mk@error}[2][Please consult the manual for more information.]{%
\PackageError{menukeys}{#2}{#1}%
}
@@ -68,16 +137,10 @@
Possible values are 'symbols' or 'text'.}%
}
\iftw at mk@hyperrefcolorlinks
- \Hy at AtBeginDocument{% (hyperref.sty, line 4790)
- \def\@pdfborder{0 0 0}% (hyperref.sty, line 4806...)
- \let\@pdfborderstyle\@empty
- \def\Hy at colorlink#1{%
- \begingroup
- \HyColor at UseColor#1%
- }%
- \def\Hy at endcolorlink{\endgroup}%
- \Hy at Info{Link coloring ON}%
- }
+ \tw at mk@warning{The option `hyperrefcolorlinks' is obsolete}
+ \@ifpackageloaded{hyperref}
+ {\hypersetup{colorlinks}}
+ {\PassOptionsToPackage{colorlinks}{hyperref}}
\fi
\newcommand*{\tw at make@color at theme}[8]{%
\definecolor{tw at color@theme@#1 at bg}{#2}{#3}%
@@ -593,71 +656,72 @@
\begingroup
\lccode`\,=1
\lowercase{\endgroup
- \robust at def*\tw at mk@test at input@sep#1{%
- \xifinsetTF{,\cpttrimspaces{#1},}{,bslash,backslash,directory,location,}%
- }%
+ \@ifdefinable\tw at mk@test at input@sep
+ {%
+ \protected\def\tw at mk@test at input@sep#1{%
+ \tw at mk@xifinsetTF
+ {,\tw at mk@trimspaces{#1},}{,bslash,backslash,directory,location,}%
+ }%
+ }%
}
-\NewDocumentCommand{\tw at define@menu at macro}{%
- m O{\tw at default@input at sep} m
-}{%
- \ifcsundef{tw at style@#3 at sep}{%
- \tw at mk@error{Can't define menu macro \string#1\space,\MessageBreak
- because the style '#3' is not available!}
+\newcommand\tw at define@menu at macro[4]{%
+ \ifcsundef{tw at style@#4 at sep}{%
+ \tw at mk@error{Can't define menu macro \string#2\space,\MessageBreak
+ because the style '#4' is not available!}
}{%
- \csdef{tw at parse@menu at list@\expandafter\@gobble\string#1}##1{%
- \iflastindris
- \ifnum\indrisnr=\@ne
+ \csdef{tw at parse@menu at list@\expandafter\@gobble\string#2}##1{%
+ \tw at mk@iflastindris
+ {%
+ \ifnum\tw at mk@indrisnr=\@ne
\def\CurrentMenuElement{##1}%
- \@nameuse{tw at style@#3 at single}%
+ \@nameuse{tw at style@#4 at single}%
\else
\def\CurrentMenuElement{##1}%
- \@nameuse{tw at style@#3 at sep}\@nameuse{tw at style@#3 at last}%
+ \@nameuse{tw at style@#4 at sep}\@nameuse{tw at style@#4 at last}%
\fi
- \else
- \ifnum\indrisnr=\@ne
+ }
+ {%
+ \ifnum\tw at mk@indrisnr=\@ne
\def\CurrentMenuElement{##1}%
- \@nameuse{tw at style@#3 at first}%
+ \@nameuse{tw at style@#4 at first}%
\else
\def\CurrentMenuElement{##1}%
- \@nameuse{tw at style@#3 at sep}\@nameuse{tw at style@#3 at mid}%
+ \@nameuse{tw at style@#4 at sep}\@nameuse{tw at style@#4 at mid}%
\fi
- \fi
+ }%
}%
- \expandafter\newcommand\csname\expandafter\@gobble\string#1\endcsname[2][#2]{%
+ #1 #2 { +O{#3} +m }{%
\leavevmode%
- {\def\tw at current@color at theme{\csname tw at style@#3 at color@theme\endcsname}%
- \@nameuse{tw at style@#3 at pre}%
+ {\def\tw at current@color at theme{\csname tw at style@#4 at color@theme\endcsname}%
+ \@nameuse{tw at style@#4 at pre}%
\tw at mk@test at input@sep{##1}{%
\edef\tw at menu@list{\detokenize{##2}}\edef\tw at mk@tempa{\@backslashchar}%
}{%
- \edef\tw at menu@list{\unexpanded{##2}}\edef\tw at mk@tempa{\cpttrimspaces{##1}}%
+ \edef\tw at menu@list{\unexpanded{##2}}\edef\tw at mk@tempa{\tw at mk@trimspaces{##1}}%
}%
- {\letcs{\tw at mk@tempb}{tw at parse@menu at list@\expandafter\@gobble\string#1}%
- \cptexpanded{\indrisloop*[\tw at mk@tempa]}\tw at menu@list\tw at mk@tempb}%
- \@nameuse{tw at style@#3 at post}}%
+ {\letcs{\tw at mk@tempb}{tw at parse@menu at list@\expandafter\@gobble\string#2}%
+ \tw at mk@expanded{\tw at mk@indrisloop{\tw at mk@tempa}}\tw at menu@list\tw at mk@tempb}%
+ \@nameuse{tw at style@#4 at post}}%
}%
}%
}
-\edef\cpt at parserlist{\cpt at parserlist\@backslashchar}
\NewDocumentCommand{\newmenumacro}{m O{\tw at default@input at sep} m}{%
\ifcsundef{\expandafter\@gobble\string#1}{%
- \tw at define@menu at macro{#1}[#2]{#3}%
- \expandafter\cptrobustify\csname\expandafter\@gobble\string#1\endcsname
- }{
+ \tw at define@menu at macro\NewDocumentCommand{#1}{#2}{#3}%
+ }{%
\tw at mk@error{Menu macro '\string#1' already defined!\MessageBreak
- Use \string\renewmenustyle\space instead.}
+ Use \string\renewmenustyle\space instead.}%
}%
}
\NewDocumentCommand{\renewmenumacro}{m O{\tw at default@input at sep} m}{%
- \cslet{\expandafter\@gobble\string#1}{\relax}%
- \tw at define@menu at macro{#1}[#2]{#3}%
+ \tw at define@menu at macro\RenewDocumentCommand{#1}{#2}{#3}%
}
\NewDocumentCommand{\providemenumacro}{m O{\tw at default@input at sep} m}{%
\ifcsundef{\expandafter\@gobble\string#1}{%
- \tw at define@menu at macro{#1}[#2]{#3}%
- }{
+ \tw at define@menu at macro\ProvideDocumentCommand{#1}{#2}{#3}%
+ }{%
\tw at mk@warning{Menu macro '\string#1' already defined!\MessageBreak
- Use \string\renewmenustyle\space to redefine it.}
+ Use \string\renewmenustyle\space to redefine it.}%
}%
}
\iftw at mk@definemenumacros
More information about the tex-live-commits
mailing list.