Debian Codegraph @

texmf-dist/source/latex/menukeys/menukeys.dtx

raw
1 % \iffalse meta-comment
2 %
3 %% File: menukeys.dtx Copyright (c) Tobias Weh
4 %%
5 %% This file may be distributed and/or modified under the conditions of the
6 %% LaTeX Project Public License (LPPL), either version 1.3c of this
7 %% license or (at your option) any later version. The latest version
8 %% of this license is in the file
9 %%
10 %% https://www.latex-project.org/lppl.txt
11 %%
12 %<pkg>\NeedsTeXFormat{LaTeX2e}[2009/01/01]
13 %<rbk>\providecommand\DeclareRelease[3]{}
14 %<rbk>\providecommand\DeclareCurrentRelease[2]{}
15 %<rbk>\DeclareRelease{v1.6.1}{2020-12-19}{menukeys-2020-12-19.sty}
16 %<rbk>\DeclareCurrentRelease{v1.6.3}{2026-05-14}
17 %<pkg>\ProvidesPackage{menukeys}
18 %<cur> [2026/05/14 v1.6.3 -- A package to format menus, paths and shortcuts]
19 %<161> [2020/12/19 v1.6.1 -- A package to format menus, paths and shortcuts]
20 %
21 %<*driver>
22 \documentclass{ltxdoc}
23
24 \usepackage[T1]{fontenc}
25 \usepackage{lmodern}
26 \usepackage[english]{babel}
27 \usepackage{menukeys}
28 \usepackage{xspace}
29 \usepackage[hang]{footmisc}
30 \usepackage{dblfnote}
31 \setlength{\footnotemargin}{1em}
32 \usepackage{xcolor}
33 \definecolor{darkred}{HTML}{770011}
34 \definecolor{darkblue}{HTML}{003b8b}
35 \PassOptionsToPackage{%
36 linkcolor=darkblue,
37 urlcolor=darkred,
38 bookmarksopen=true,
39 bookmarksdepth=10,
40 pdftitle={The menukeys package},
41 pdfsubject={%
42 Format menu sequences, paths and keystrokes from lists.%
43 },
44 pdfauthor={%
45 Tobias Weh ([email protected]), Jonathan P. Spratte
46 ([email protected])%
47 },
48 pdfkeywords={The menukeys package, LaTeX}
49 }{hyperref}
50 \PassOptionsToPackage{hyphens}{url}
51 \usepackage{hypdoc}
52
53
54 \renewcommand{\usage}[1]{\textbf{#1}}
55 \renewcommand{\main}[1]{\textit{#1}}
56
57 \newcommand{\menukeys}{\texttt{menukeys}\xspace}
58 \newcommand{\TikZ}{Ti\textit{k}Z\xspace}
59
60 \newcommand*{\pkg}[1]{\texttt{#1}}
61 \newcommand*{\env}[1]{\texttt{#1}}
62 \newcommand*{\fnt}[1]{\texttt{#1}}
63 \newcommand*{\opt}[1]{\texttt{#1}}
64 \newcommand{\DO}[1]{%
65 \marginpar{\raggedleft\texttt{#1} \footnotesize(opt.)}%
66 \index{#1=\texttt{#1} (option)|usage}%
67 \index{Options:>\texttt{#1}|usage}%
68 \ignorespaces
69 }
70 \newcommand{\DM}[1]{\DescribeMacro{#1}\ignorespaces}
71 \newcommand{\DE}[1]{\DescribeEnv{#1}\ignorespaces}
72 \newcommand{\AST}{\meta{\texttt{*}}}
73
74 \newcommand{\minisec}[1]{\par\medskip\noindent{\sffamily\bfseries#1}\quad}
75 \newcommand{\example}{\minisec{Example}\xspace}
76
77 \ExpandArgs{c}\newif{iffirstteststyle}
78 \global\firstteststyletrue
79 \colorlet{keywordcolor}{green!45!black}
80 \newcommand\keyword[1]{\textcolor{keywordcolor}{\string#1}}
81 \newcommand\braced[1]
82 {%
83 \allowbreak
84 \textcolor{keywordcolor}{\{}%
85 \detokenize{#1}%
86 \textcolor{keywordcolor}{\}}%
87 }
88
89 \providemenumacro{\test}{roundedmenus}
90 \NewDocumentCommand{\teststyle}{ o m m m }{{%
91 \renewmenumacro{\test}{#2}%
92 \par\vspace{1.5\baselineskip plus 0.5\baselineskip minus 0.25\baselineskip}
93 \noindent
94 \fbox{\begin{minipage}{\dimexpr\textwidth-2\fboxsep-2\fboxrule\relax}
95 \begin{minipage}[t]{0.45\linewidth}
96 Name: \texttt{#2}
97 \index{#2=\texttt{#2} (style)|usage}%
98 \index{Styles:>\texttt{#2}|usage}
99 \par\vspace{0.5\baselineskip}%
100 \test{#3}
101 \par\vspace{0.5\baselineskip}%
102 \test{#4}%
103 \end{minipage}\hfill
104 \begin{minipage}[t]{0.53\linewidth}
105 \ttfamily\footnotesize
106 \hangindent1em
107 \textbf{%
108 \color{keywordcolor}%
109 \iffirstteststyle
110 \string\newmenumacro
111 \else
112 \string\renewmenumacro
113 \fi
114 }%
115 \keyword{\test}\braced{#2}\par
116 \hangindent1em
117 \keyword{\test}\braced{#3}\par
118 \hangindent1em
119 \keyword{\test}\braced{#4}
120 \end{minipage}
121 \par\vspace{0.5\baselineskip}%
122 This is some more or less blind text, to demonstrate how
123 the sequence looks in text. This \test{#3} is the result
124 of a style which name is \texttt{#2}. And again some
125 blind text without any sense.%
126 \IfValueT{#1}{{%
127 \par\vspace{0.5\baselineskip}%
128 \itshape\footnotesize#1\par
129 }}%
130 \end{minipage}}%
131 \global\firstteststylefalse
132 }}
133 \makeatletter
134 \newcommand{\colortest}[1]{{%
135 \par\vspace{\baselineskip}%
136 \setlength{\fboxsep}{0pt}%
137 \noindent Name: \texttt{#1}\index{#1=\texttt{#1} (theme)|usage}%
138 \index{Color themes:>\texttt{#1}|usage}
139 \\[0.5\baselineskip]
140 Background: \fbox{\textcolor{tw@color@theme@#1@bg}{\rule[-0.4ex]{2.2ex}{2.2ex}}}
141 \quad Border: \fbox{\textcolor{tw@color@theme@#1@br}{\rule[-0.4ex]{2.2ex}{2.2ex}}}
142 \quad Text: \fbox{\textcolor{tw@color@theme@#1@txt}{\rule[-0.4ex]{2.2ex}{2.2ex}}}
143 \quad (A: \fbox{\textcolor{tw@color@theme@#1@a}{\rule[-0.4ex]{2.2ex}{2.2ex}}}
144 \quad B: \fbox{\textcolor{tw@color@theme@#1@b}{\rule[-0.4ex]{2.2ex}{2.2ex}}}
145 \quad C: \fbox{\textcolor{tw@color@theme@#1@c}{\rule[-0.4ex]{2.2ex}{2.2ex}}}\kern2pt)
146 }}
147 \makeatother
148
149 \MakeShortVerb{\|}
150
151 \setcounter{tocdepth}{3}
152
153 \makeatletter
154 \def\SpecialMainEnvIndex#1{\@bsphack\special@index{%
155 #1\actualchar
156 {\string\ttfamily\space#1}
157 (env)%
158 \encapchar main}%
159 \special@index{Environments:\levelchar#1\actualchar{%
160 \string\ttfamily\space#1}\encapchar
161 main}\@esphack}
162 \def\SpecialUsageIndex#1{\@bsphack
163 {\let\special@index\index\SpecialIndex@{#1}{\encapchar usage}}%
164 \@esphack}
165 \def\SpecialEnvIndex#1{\@bsphack
166 \index{#1\actualchar{\protect\ttfamily#1}
167 (env)\encapchar usage}%
168 \index{Environments:\levelchar#1\actualchar{\protect\ttfamily#1}\encapchar
169 usage}\@esphack}
170 \makeatother
171
172 \addto\captionsenglish{%
173 \def\indexname{Macro index}
174 \def\glossaryname{Change history}
175 }
176 \IndexPrologue{
177 \section{Macro index}
178 Numbers written in bold face refer to the page where the corresponding entry is described;
179 italic numbers refer to the code line of the definition; numbers in roman refer to the code
180 lines where the entry is used.
181 }
182 \GlossaryPrologue{
183 \section{Change history}\label{version}%
184 }
185
186 \setcounter{IndexColumns}{2}
187
188 \makeatletter
189 \tikzset{tw@menusbig@base/.style={%
190 tw@set@tikz@colors,
191 rounded corners=0.15ex,
192 inner sep=0pt,
193 inner xsep=2pt,
194 text height=2.1ex,
195 text depth=0.6ex,
196 minimum width=1.5em,
197 font=\Huge\bfseries\sffamily,
198 signal,
199 signal to=nowhere,
200 signal pointer angle=110,
201 ultra thick,
202 }}
203 \tw@declare@style*{menusbig}{%
204 \tikz[baseline={($([email protected])+(0,-0.2ex)$)}]{%
205 \node(tw@node)[tw@menusbig@base,signal to=east]%
206 {\strut\CurrentMenuElement};}%
207 }[\hspace{-0.2em}\hspace{0em plus 0.1em minus 0.05em}]%
208 {%
209 \tikz[baseline={($([email protected])+(0,-0.2ex)$)}]{%
210 \node(tw@node)[tw@menusbig@base,signal from=west,signal to=east]%
211 {\strut\CurrentMenuElement};}%
212 }{%
213 \tikz[baseline={($([email protected])+(0,-0.2ex)$)}]{%
214 \node(tw@node)[tw@menusbig@base,signal from=west,]%
215 {\strut\CurrentMenuElement};}%
216 }{%
217 \tikz[baseline={($([email protected])+(0,-0.2ex)$)}]{%
218 \node(tw@node)[tw@menusbig@base]{\strut\CurrentMenuElement};}%
219 }{blacknwhite}
220 \newmenumacro{\filefolder}[/]{pathswithblackfolder}
221 \newmenumacro{\MENU}[,]{menusbig}
222 \newcommand\email[1]{\href{mailto:#1}{\texttt{#1}}}
223 \makeatother
224
225 \EnableCrossrefs
226 \CodelineIndex
227 \RecordChanges
228
229 \begin{document}
230 \DocInput{menukeys.dtx}
231 \end{document}
232 %</driver>
233 % \fi
234 %
235 % \CharacterTable
236 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
237 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
238 % Digits \0\1\2\3\4\5\6\7\8\9
239 % Exclamation \! Double quote \" Hash (number) \#
240 % Dollar \$ Percent \% Ampersand \&
241 % Acute accent \' Left paren \( Right paren \)
242 % Asterisk \* Plus \+ Comma \,
243 % Minus \- Point \. Solidus \/
244 % Colon \: Semicolon \; Less than \<
245 % Equals \= Greater than \> Question mark \?
246 % Commercial at \@ Left bracket \[ Backslash \\
247 % Right bracket \] Circumflex \^ Underscore \_
248 % Grave accent \` Left brace \{ Vertical bar \|
249 % Right brace \} Tilde \~}
250 %
251 % \changes{v1.0}{2012/02/23}{Initial version}
252 % \changes{v1.1}{2012/02/26}{Improved manual}
253 % \changes{v1.2}{2013/07/23}{Tidy up version and date}
254 % \changes{v1.2}{2013/07/23}{Fixed GitHub issues \#9, \#10, \#11, \#13, \#17, \#24 and \#26}
255 % \changes{v1.2}{2013/07/23}{Added \cs{SPACE} and \cs{spacename}}
256 % \changes{v1.2}{2013/07/23}{Added \cs{normalsize} before symbol definitions to make
257 % the \texttt{ex} unit available}
258 % \changes{v1.2a}{2013/09/10}{Replaced obsolete \cs{tikzstyle}}
259 % \changes{v1.2a}{2013/09/10}{Added braces to the \cs{tikz} macro since the parser
260 % seems to crash with \pkg{babel}'s french option otherwise.}
261 % \changes{v1.3}{2014/03/10}{Improved key symbols.}
262 % \changes{v1.3}{2014/03/10}{Added \TikZ-styles for the key symbols.}
263 % \changes{v1.4}{2016/04/17}{The \texttt{path...} styles now use the text color
264 % of the selected color theme (fix issue \#16).}
265 % \changes{v1.4}{2016/04/18}{Extended color theme features.}
266 %
267 % \GetFileInfo{menukeys.sty}
268 %
269 % \DoNotIndex{\?,\_,\.,\@M,\@@input,\@Alph,\@alph,\@addtoreset,\@arabic}
270 % \DoNotIndex{\@badmath,\@centercr,\@cite}
271 % \DoNotIndex{\@dotsep,\@empty,\@float,\@gobble,\@gobbletwo,\@ignoretrue}
272 % \DoNotIndex{\@input,\@ixpt,\@m,\@minus,\@mkboth}
273 % \DoNotIndex{\@ne,\@nil,\@nomath,\@plus,\roman,\@set@topoint}
274 % \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb}
275 % \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt}
276 % \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt}
277 % \DoNotIndex{\@xxpt,\@xxvpt,\\,\,,\addpenalty,\addtolength,\addvspace}
278 % \DoNotIndex{\advance,\ast,\begin,\begingroup,\bfseries,\bgroup,\box}
279 % \DoNotIndex{\bullet}
280 % \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption}
281 % \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass}
282 % \DoNotIndex{\DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist}
283 % \DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup}
284 % \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter}
285 % \DoNotIndex{\fbox}
286 % \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef}
287 % \DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule}
288 % \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi}
289 % \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi}
290 % \DoNotIndex{\input}
291 % \DoNotIndex{\jobname,\kern,\leavevmode,\let,\leftmark}
292 % \DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark,\markboth,\markright}
293 % \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment}
294 % \DoNotIndex{\NeedsTeXFormat,\newdimen}
295 % \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number}
296 % \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@}
297 % \DoNotIndex{\pagestyle,\par,\paragraph,\paragraphmark,\parfillskip}
298 % \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions}
299 % \DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright}
300 % \DoNotIndex{\refstepcounter,\relax,\renewcommand}
301 % \DoNotIndex{\rightmargin,\rightmark,\rightskip,\rlap,\rmfamily}
302 % \DoNotIndex{\secdef,\selectfont,\setbox,\setcounter,\setlength}
303 % \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space}
304 % \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase}
305 % \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt}
306 % \DoNotIndex{\viipt,\vipt,\vskip,\vspace}
307 % \DoNotIndex{\wd,\xiipt,\year,\z@}
308 % \expandafter\DoNotIndex{\,}
309 % \DoNotIndex{\next,\unexpanded,\@backslashchar,
310 % \@ifundefinedcolor,\@nameuse,\detokenize,
311 % \cslet,\csname,\edef,\endcsname,
312 % \NewDocumentCommand}
313 % \DoNotIndex{\@afterheading,\@afterindentfalse,\@ifpackageloaded,\ ,
314 % \appto,\AtBeginDocument,\AtEndPreamble,\baselineskip,\BODY,
315 % \centering,\contentspage,\CurrentOption,\dots,\endquote,\fill,\filright,
316 % \tiny,\footnotesize,\Huge,\ifstrempty,\ifstrequal,\itshape,\Large,\large,\LARGE,
317 % \makebox,\MessageBreak,\NewEnviron,\newif,\normalfont,\normalsize,
318 % \pbox,\preto,\quote,\RequirePackage,\rule,\setstretch,
319 % \SetupKeyvalOptions,\sffamily,\singlespacing,\textbf,\textit,\textwidth,
320 % \thecontentslabel,\thecontentspage,\titlecontents,\xspace}
321 % \DoNotIndex{\0,\1,\2,\3,\4,\5,\6,\7,\8,\9,0,1,2,3,4,5,6,7,8,9}
322 % \DoNotIndex{\lccode,\listof,\lowercase,\PackageWarningNoLine,\PackageError,
323 % \PackageWarning,\renewenvironment,\romannumeral,\string,\strut}
324 % \DoNotIndex{\csdef,\cslet\csletcs,\letcs,\DeclareDocumentCommand,\ifcsundef,
325 % \RenewDocumentCommand,\ProvideDocumentCommand,\NewDocumentCommand,\hspace,
326 % \IfBooleanTF,\IfSubStr}
327 % \DoNotIndex{\tikz,\node,\draw,\definecolor,\colorlet,\usetikzlibrary,
328 % \texttt,\textcolor,\raisebox,\maxsizebox,\small,\ttfamily,\DeclareBoolOption}
329 % \DoNotIndex{\value,\usebox,\sbox,\providecommand,\ProcessKeyvalOptions,\newbox,
330 % \IfStrEq,\hyphenchar,\expandonce,\encodingdefault,\DeclareStringOption}
331 %
332 % \title{\Huge\MENU[,]{M,E,N,U,K,E,Y,S}}
333 % \author{^^A
334 % Tobias Weh\\
335 % {\normalsize\email{[email protected]}}\\
336 % {\normalsize\url{https://tobiw.de/en}}\\[\medskipamount]
337 % ^^A
338 % Jonathan P.\@ Spratte\\
339 % {\normalsize\email{[email protected]}}\\[\medskipamount]
340 % ^^A
341 % \normalsize\url{https://github.com/tweh/menukeys}\\
342 % \normalsize\url{https://www.ctan.org/pkg/menukeys}\\
343 % \normalsize\filefolder{macros/latex/contrib/menukeys}}
344 % \date{\filedate{} --- \fileversion}
345 % \thispagestyle{empty}
346 % \maketitle
347 %
348 % \begin{abstract}
349 % \noindent
350 % This package is build to format menu sequences, paths and keystrokes.
351 % \par\medskip\noindent
352 % You're welcome to send me feedback, questions, bug reports and feature requests.
353 % If you like to support this package -- especially improving or proofreading the
354 % manual -- send me an e-mail, please.
355 % \par\bigskip\noindent
356 % \emph{Many thanks to Ahmed Musa, who provided the original list parsing
357 % code at \url{https://tex.stackexchange.com/a/44989/4918}.}
358 % \par
359 % \end{abstract}
360 %
361 % \newpage\tableofcontents\newpage
362 %
363 % \section{Introduction}\label{intro}
364 % The \menukeys package is mainly designed to parse and print
365 % sequences of software menus, folders and files, or keystrokes.
366 % Most predefined styles use the power of \TikZ\footnote{See
367 % \url{https://www.ctan.org/pkg/pgf}.} to format the output.
368 %
369 % For example if you want to tell the reader of a manual how to set the ruler
370 % unit you may type
371 % \begin{verbatim}
372 % To set the unit of the rulers go to \menu{Extras > Settings > Rulers}
373 % and choose between millimeters, inches and pixels. The shortcut
374 % to view the rulers is \keys{cmd + R}. Pressing these keys again
375 % will hide the rulers.
376 %
377 % The standard path for saving your document is \directory{Macintosh HD/
378 % Users/Your Name/Documents} but you can change it at \menu{Extras >
379 % Settings > Saving} by clicking \menu{Change save path}.
380 % \end{verbatim}
381 % and get this:
382 %
383 % \medskip
384 % To set the unit of the rulers go to \menu{Extras > Settings > Rulers}
385 % and choose between millimeters, inches and pixels. The shortcut
386 % to view the rulers is \keys{cmd + R}. Pressing these keys again
387 % will hide the rulers.
388 %
389 % The standard path for saving your document is \directory{Macintosh HD/
390 % Users/Your Name/Documents} but you can change it at \menu{Extras >
391 % Settings > Saving} by clicking \menu{Change save path}.
392 %
393 % \bigskip\noindent
394 % The package is loaded as usual via
395 % \begin{verbatim}
396 % \usepackage{menukeys}
397 % \end{verbatim}
398 %
399 % \section{Installation}
400 % To install \menukeys manually run
401 % \begin{verbatim}
402 % latex menukeys.ins
403 % \end{verbatim}
404 % and copy |menukeys.sty| to a path where \LaTeX{} can find it.
405 %
406 % To typeset this manual run
407 % \begin{verbatim}
408 % pdflatex menukeys.dtx
409 % makeindex -s gglo.ist -o menukeys.gls menukeys.glo
410 % makeindex -s gind.ist -o menukeys.ind menukeys.idx
411 % pdflatex menukeys.dtx
412 % pdflatex menukeys.dtx
413 % \end{verbatim}
414 %
415 % \section{Package loading and options}\label{options}
416 % \changes{v1.6}{2020/10/27}{Load order no longer important}
417 % Since \menukeys used to use \pkg{catoptions}, which does some heavy changes on key-value
418 % options, it \textbf{was} recommended to load \menukeys as the last package
419 % (even after \pkg{hyperref}\footnote{See \url{https://tex.stackexchange.com/q/237683/4918}
420 % and \url{https://github.com/tweh/menukeys/issues/41}.}).
421 % \textbf{This is no longer the case!}
422 %
423 % These are the possible options:
424 % \begin{description}
425 % \item [definemenumacros:] Most of \menukeys' macros should not
426 % conflict with other packages\footnote{If you find a conflict send an e-mail.}
427 % but the predefined menu macros should be short and easy-to-read
428 % commands, which means that |\menu{A,B,C}| is preferred against
429 % |\printmenusequence{A,B,C}|. For that it's not unlikely that they
430 % conflict with other packages. To prevent this you can tell
431 % \menukeys to not define them by calling the option \DO{definemenumacros}
432 % |definemenumacros=false|. The default value is |true|.
433 %
434 % If you do so you have to define your own menu macros, see section~\ref{menumacros}
435 % for details.
436 % \item [definekeys:] Equal to |definemenumacros| \DO{definekeys} for the key macros.
437 % The default value is |true|.
438 % \item [mackeys:] This option \DO{mackeys} allows you to decide whether the mac keys
439 % are shown as text (|mackeys=text|) or symbols (|mackeys=symbols|). The default
440 % value is |symbols|.
441 % \item [os:] You can specify the OS \DO{os} by saying |os=mac| or |os=win|. This will cause
442 % some key macros to be rendered differently. The default value is |mac|.
443 % \item [hyperrefcolorlinks:] \emph{Obsolete}
444 % (see sec.~\ref{sec:issues} and~\ref{sec:hyperref-colorlinks}).
445 % \end{description}
446 %
447 % \section{Usage}
448 % \subsection{Basics}\label{basics}
449 % \menukeys comes with three ``menu macros'' that parse and print lists. We have
450 % \DM{\menu}|\menu|\marg{menu sequence}, with |>| as default input list separator,
451 % \DM{\directory}|\directory|\marg{path and files} with |/| as default separator and
452 % \DM{\keys}|\keys|\marg{keystrokes} with |+| as default separator. You've seen
453 % examples for all of them in section~\ref{intro}.
454 %
455 % These macros have also an optional argument to set the input list separator.
456 % E.g. if you want to put in your menus with |,| instead of |>| you can say
457 % |\menu[,]|\marg{menu sequence}.\footnote{If you want to change the input separator
458 % globally it's recommended to renew the menu macro as described in section~\ref{menumacros}.}
459 %
460 % The possible input separators are |/|, |=|, |*|, |+|, |,|, |;|, |:|, |-|, |>|,
461 % |<| and |bslash| (to use |\| as separator). You can hide a separator from the
462 % parser by putting a part of the sequence in braces. Spaces around the separator
463 % will be ignored, i.e. |\keys{\ctrl+C}| equals |\keys{\ctrl + C}|.
464 % \example |\menu[,]{Extras,Settings,{Units, rulers and origin}}| gives
465 % \menu[,]{Extras,Settings,{Units, rulers and origin}}
466 %
467 % \subsection{Styles}
468 % \menukeys defines several ``styles'' that determine the output format
469 % of a menu macro. There are some predefined styles and others can be
470 % created by the user.
471 %
472 % Both pre-defined and custom styles may be applied using the command
473 % |\renewmenumacro|\marg{macro}\oarg{input sep}\marg{style}. For further
474 % information on defining and using macro styles, refer to section~\ref{menumacros}.
475 % For example, the ``shadowed angular'' keys style may be applied using the command
476 % |\renewmenumacro|\hspace{0pt}|{\keys}|\hspace{0pt}|{shadowedangularkeys}|.
477 % \subsubsection{Predefined styles}
478 %
479 % \teststyle[This is the default style for \texttt{\string\menu}.]
480 % {menus}{File,Extras,Preferences}{Menu}
481 % \teststyle{roundedmenus}{File,Extras,Preferences}{Menu}
482 % \teststyle{angularmenus}{File,Extras,Preferences}{Menu}
483 % \teststyle[The color of + is taken from optional color B.\\
484 % This is the default style for \texttt{\string\keys}.]
485 % {roundedkeys}{Ctrl,Alt,Q}{S}
486 % \teststyle[The color of + is taken from optional color B.\\
487 % The shadow color is taken from optional color C.]
488 % {shadowedroundedkeys}{Ctrl,Alt,Q}{S}
489 % \teststyle[The color of + is taken from optional color B.]
490 % {angularkeys}{Ctrl,Alt,Q}{S}
491 % \teststyle[The color of + is taken from optional color B.\\
492 % The shadow color is taken from optional color C.]
493 % {shadowedangularkeys}{Ctrl,Alt,Q}{S}
494 % \teststyle[The color of + is taken from optional color B.]
495 % {typewriterkeys}{Alt,Q}{S}
496 % \teststyle[The sep color is taken from optional color C.\\
497 % This is the default style for \texttt{\string\directory}.]
498 % {paths}{C:,User,Folder,MyFile.tex}{MyFile.tex}
499 % \teststyle[%
500 % The folder draw color is taken from optional color B.\\
501 % The folder fill color is taken from optional color A.\\
502 % The sep color is taken from optional color C.%
503 % ]
504 % {pathswithfolder}{C:,User,Folder,MyFile.tex}{MyFile.tex}
505 % \teststyle[%
506 % The folder draw color is taken from optional color B.\\
507 % The folder fill color is taken from optional color C.\\
508 % The sep color is taken from optional color C.%
509 % ]
510 % {pathswithblackfolder}{C:,User,Folder,MyFile.tex}{MyFile.tex}
511 %
512 % \bigskip\noindent
513 % The following three styles allow paths elements to be hyphenated, but
514 % they insert only a line break without a hyphen dash. Note that they only
515 % work with |T1| and |OT1| encoding (at least I tested only these ones)
516 % and that this in some cases doesn't work very well.
517 % \teststyle[The sep color is taken from optional color C.]
518 % {hyphenatepaths}{C:,Database,User,ALongUserNameHere,%
519 % ALongerFolderNameAtThisPlace,MyFile.tex}{MyFile.tex}
520 % \teststyle[%
521 % The folder draw color is taken from optional color B.\\
522 % The folder fill color is taken from optional color A.\\
523 % The sep color is taken from optional color C.%
524 % ]
525 % {hyphenatepathswithfolder}{C:,Database,User,ALongUserNameHere,%
526 % ALongerFolderNameAtThisPlace,MyFile.tex}{MyFile.tex}
527 % \teststyle[%
528 % The folder draw color is taken from optional color B.\\
529 % The folder fill color is taken from optional color C.\\
530 % The sep color is taken from optional color C.%
531 % ]
532 % {hyphenatepathswithblackfolder}{C:,Database,User,ALongUserNameHere,%
533 % ALongerFolderNameAtThisPlace,MyFile.tex}{MyFile.tex}
534 %
535 % \bigskip\pagebreak
536 % \minisec{Hint} The folder is drawn with the command \DM{\drawtikzfolder}
537 % |\drawtikzfolder| which is part of \menukeys and has two optional arguments
538 % to change the color of the lines and the fill color of the front:\\
539 % |\drawtikzfolder|\oarg{front fill}\oarg{draw}
540 %
541 % \subsubsection{Declaring styles}
542 % The simplest way to define a new style is to use \DM{\newmenustylesimple}
543 % |\newmenustylesimple|. It has six arguments: |\newmenustylesimple|\AST%
544 % \marg{name}\oarg{pre}\marg{style}\oarg{sep}\oarg{post}\linebreak \marg{theme}
545 % \begin{description}
546 % \item [name] is the name of the new style. It must follow the
547 % specifications of \TeX{} control sequences, which means it must
548 % contain only letters and no numbers.
549 % \item [pre] is the code which is executed before a menu macro.
550 % \item [style] is the style for the first list element. It has to be
551 % a \TikZ-style which is applied to a |node|, e.g. |draw,blue|.
552 % \item [sep] is the code executed between the lists elements, e.g. some
553 % space or a symbol.
554 % \item [post] is the code which is executed after a menu macro.
555 % \item [theme] is a color theme (see section~\ref{colors}).
556 % \end{description}
557 % \example Let us consider we want a list that prints a frame around its
558 % elements and separates them by a star. We can use
559 % \begin{verbatim}
560 % \newmenustylesimple{mystyle}{draw}[$\ast$]{mycolors}
561 % \end{verbatim}
562 %
563 % The more advanced command is \DM{\newmenustyle}|\newmenustyle|. It has
564 % nine arguments: |\newmenustyle|\AST\marg{name}\oarg{pre}\marg{first}%
565 % \oarg{sep}\marg{mid}\marg{last}\marg{single}\newline\oarg{post}\marg{theme}
566 % \begin{description}
567 % \item [name] is the name of the new style. It must follow the
568 % specifications of \TeX{} control sequences, which means it must
569 % contain only letters and no numbers.
570 % \item [pre] is the code which is executed before a menu macro.
571 % \item [first] is the style for the first list element. It has to be
572 % a \TikZ-style which is applied to a |node|, e.g. |draw,blue|.
573 % \item [sep] is the code executed between the lists elements, e.g. some
574 % space or a symbol.
575 % \item [mid] is the style for all elements between the first and the
576 % last one. It has to be a \TikZ style.
577 % \item [last] is the style for the last list element.
578 % It has to be a \TikZ style.
579 % \item [single] this style is used if the list contains only one element.
580 % It has to be a \TikZ style.
581 % \item [post] is the code which is executed after a menu macro.
582 % \item [theme] is a color theme (see section~\ref{colors}).
583 % \end{description}
584 % \example We can extend the previous example and desire that the first and
585 % the last element became red, and a single element should have a dashed frame. Furthermore
586 % the menu sequence should be preceded and followed by a bullet point:
587 % \begin{verbatim}
588 % \newmenustyle{mystyle}[$\bullet$]{draw,red}[$\ast$]%
589 % {draw}{draw,red}{draw,dashed}[$\bullet$]
590 % \end{verbatim}
591 %
592 % If the \TikZ |node| system doesn't fit your needs there are the \textbf{starred versions}:
593 % Use them and the arguments \meta{first},
594 % \meta{mid}, \meta{last}, \meta{single} can be any \LaTeX{} code. To access the
595 % current list element use \DM{\CurrentMenuElement}|\CurrentMenuElement|.
596 % \example consider that we want all menu elements simple be fat and not
597 % drawn with a \TikZ |node|. The separator should be the star again:
598 % \begin{verbatim}
599 % \newmenustylesimple*{mystyle}{\textbf{\CurrentMenuElement}}[$\ast$]
600 % \end{verbatim}
601 %
602 % If you want to make your own style you must take care of using the color
603 % theme. \DM{\usemenucolor} To access a color of the currently applied
604 % theme while defining a style use |\usemenucolor|\marg{element} (See
605 % section~\ref{colors} for details about possible elements).
606 %
607 % \subsubsection{Copying styles}
608 % To copy an existing style to a new style use \DM{\copymenustyle}|\copymenustyle|%
609 % \marg{copy}\marg{original}.
610 % \example To copy the definition of |mystyle| to |mycopy| use
611 % \begin{verbatim}
612 % \copymenustyle{mycopy}{mystyle}
613 % \end{verbatim}
614 %
615 % \subsubsection{Changing styles}
616 % The simplest change we can imagine is to change a single element or the color theme of
617 % an existing style. For the first case there is \DM{\changemenuelement}
618 % |\changemenuelement|\AST\marg{name} \marg{element}\marg{definition}, where the starred
619 % version works like the one of |\newmenustyle| does.
620 % \example To change the single element of |mystyle| from dashed to solid use the
621 % following code. You may save the original style by copying it as described above.
622 % \begin{verbatim}
623 % \changemenuelement{mystyle}{single}{draw}
624 % \end{verbatim}
625 % \DM{\changemenucolortheme}To satisfy the second case use |\changemenucolortheme|%
626 % \marg{name}\marg{color theme}.
627 % \example To change the color theme of |mystyle| to |myothercolors| call
628 % \begin{verbatim}
629 % \changemenucolortheme{mystyle}{myothercolors}
630 % \end{verbatim}
631 %
632 % \DM{\renewmenustylesimple}\DM{\providemenustylesimple}\DM{\renewmenustyle}%
633 % \DM{\providemenustyle} The next level is redefining a style. This package provides
634 % the following macros the work like their \LaTeX-paragons and have the same
635 % arguments as the above described macros: |\renewmenustylesimple|,
636 % |\providemenustylesimple|, |\renewmenustyle| and |\providemenustyle|.
637 %
638 % \subsection{Color themes}\label{colors}%
639 % To make the colors of a style become changeable without
640 % touching the style itself, \menukeys uses ``color themes''. Every color theme
641 % must contain three color definitions that can be used to draw a |node|
642 % background, a |node| frame and a text color, and additionally two optional
643 % colors used by some themes.
644 % \subsubsection{Predefined themes}
645 % There are two predefined color themes
646 % \colortest{gray}\colortest{blacknwhite}
647 % \subsubsection{Create a theme}
648 % \DM{\newmenucolortheme}To create a new theme use |\newmenucolortheme|. It uses the
649 % following arguments:\\
650 % |\newmenucolortheme|\marg{name}\marg{model}\marg{bg}\marg{br}\marg{txt}\oarg{a}\oarg{b}\oarg{c}
651 % \begin{description}
652 % \item [name] is the name of the theme and must contain only letters.
653 % \item [model] is the \pkg{xcolor} color model which is used to define a color, e.g.
654 % |named|, |rgb|, |cmyk|, \dots
655 % \item [bg] is the color definition for the |node| background.
656 % \item [br] is the color definition for the |node| border.
657 % \item [txt] is the color definition for the |node|'s text.
658 % \item [a] is an optional additional color (by default same as bg).
659 % \item [b] is an optional additional color (by default same as br).
660 % \item [c] is an optional additional color (by default same as txt).
661 % \end{description}
662 % \example To create a theme called |mycolors| we can say
663 % \begin{verbatim}
664 % \newmenucolortheme{mycolors}{named}{red}{green}{blue}
665 % \end{verbatim}
666 % \subsubsection{Copy a theme}
667 % \DM{\copymenucolortheme}To copy the definitions of one theme to another,
668 % use |\copymenucolortheme| \marg{copy}\marg{original}.
669 % \example To copy the colors of |mycolors| to |copycolors| type
670 % \begin{verbatim}
671 % \copymenucolortheme{copycolors}{mycolors}
672 % \end{verbatim}
673 % \subsubsection{Change a theme}
674 % \DM{\changemenucolor} If you want to change the color of a theme's element
675 % use |\changemenucolor|\marg{name} \marg{element}\marg{model}\marg{color definition},
676 % where name is the theme's name and \meta{element} is |bg|, |br|, or |txt|.
677 % \example Let's change the text color of |mycolors|:
678 % \begin{verbatim}
679 % \changemenucolor{mycolors}{txt}{named}{gray}
680 % \end{verbatim}
681 %
682 % \DM{\renewmenucolortheme}To redefine a complete theme use |\renewmenucolortheme|.
683 % It works with the same arguments as |\newmenucolortheme|.
684 %
685 % \subsection{Menu macros}\label{menumacros}%
686 % The ``menu marcos'' take a list separated by a special symbol to
687 % print it with a menu style.
688 % \subsubsection{Predefined menu macros}
689 % See section~\ref{basics}.
690 % \subsubsection{Defining or changing menu macros}
691 % \DM{\newmenumacro}To define a new menu macro call |\newmenumacro|\marg{macro}%
692 % \oarg{input sep}\marg{style}.
693 % \begin{description}
694 % \item [name] is a \LaTeX{} control sequence name.
695 % \item [input sep] is the default separator used in the input list
696 % (see section~\ref{basics} for a list of valid separators).
697 %
698 % If you don't give it the package's default (|,|) is used.
699 % \item [style] is a menu style.
700 % \end{description}
701 % This wil give you a macro like |\|\meta{macro}\oarg{input sep}\marg{list}
702 % \example Assuming you need a command to format Windows paths, you can
703 % define it with
704 % \begin{verbatim}
705 % \newmenumacro{\winpath}[bslash]{mystyle}
706 % \end{verbatim}
707 % and then use it as e.g. |\winpath{C:\System\Deep\Deeper\YourFile.txt}|.
708 % Note that |mystyle| must be defined before you call |\newmenumacro|.
709 %
710 % \DM{\providemenumacro}\DM{\renewmenumacro}There are also the two commands
711 % |\providemenumacro| and |\renewmenumacro| which take the same arguments as
712 % |\newmenumacro| and work like the \LaTeX{} macros |\renewcommand| and |\providecommand|.
713 % \example To change the default input separator of |\menu| you must know
714 % the default style (which is |menus|) and then you can say
715 % \begin{verbatim}
716 % \renewmenumacro{\menu}[,]{menus}
717 % \end{verbatim}
718 %
719 % \subsection{Keys}
720 % The \menukeys package comes with some macros to print
721 % special keys in the sequences set with |\keys|. Depending on
722 % the given OS (see section~\ref{options}) some macros behave
723 % differently to be able to use a key even if it's undefined
724 % via the \opt{os} option macros like |\|\meta{key}|mac| and
725 % |\|\meta{key}|win| that will always give the right symbol.
726 %
727 % The full ist of key macros is shown in table~\ref{tab:keys}.
728 %
729 % \begin{table}[ht]
730 % \caption{Overview of all key macros.}\label{tab:keys}
731 % \small
732 % \renewcommand{\arraystretch}{1.25}
733 % \begin{minipage}[t]{0.45\textwidth}
734 % \begin{tabular}[t]{lll}
735 % \hline
736 % \textbf{Macro} & \textbf{Mac} & \textbf{Win.} \\
737 % \hline
738 % |\shift| & \shift & \shift\\
739 % |\capslock| & \capslockmac & \capslockwin\\
740 % |\tab| & \tabmac & \tabwin\\
741 % |\esc| & esc / \escmac & \escwin\\
742 % |\oldesc| & esc / \oldescmac & \oldescwin\\
743 % |\ctrl| & \ctrlmac & \ctrlwin{}\\
744 % |\Alt| & alt / \Altmac & \Altwin \\
745 % |\AltGr| & & \AltGr \\
746 % |\cmd| & cmd / \cmdmac & \\
747 % |\Space| & [empty sp.] & [empty sp.] \\
748 % |\SPACE| & \spacename & \spacename \\
749 % |\return| & \returnmac & \returnwin \\
750 % |\enter| & \entermac & \enterwin \\
751 % \hline
752 % \end{tabular}
753 % \end{minipage}\hfill
754 % \begin{minipage}[t]{0.45\textwidth}
755 % \begin{tabular}[t]{lll}
756 % \hline
757 % \textbf{Macro} & \textbf{Mac} & \textbf{Win.} \\
758 % \hline
759 % |\winmenu| & & \winmenuwin \\
760 % |\backspace| & \backspace & \backspace\\
761 % |\del| & Del. / \delmac & \delwin{}\\
762 % |\backdel| & Del. / \backdelmac & \backdelwin{}\\
763 % |\arrowkey{^}| & \arrowkey{^} & \arrowkey{^} \\
764 % |\arrowkeyup| & \arrowkeyup & \arrowkeyup\\
765 % |\arrowkey{v}| & \arrowkey{v} & \arrowkey{v} \\
766 % |\arrowkeydown| & \arrowkeydown & \arrowkeydown\\
767 % |\arrowkey{>}| & \arrowkey{>} & \arrowkey{>} \\
768 % |\arrowkeyright| & \arrowkeyright & \arrowkeyright\\
769 % |\arrowkey{<}| & \arrowkey{<} & \arrowkey{<} \\
770 % |\arrowkeyleft| & \arrowkeyleft & \arrowkeyleft\\
771 % \hline
772 % \end{tabular}
773 % \end{minipage}
774 % \end{table}
775 %
776 % \DM{\arrowkey}
777 % The macro |\arrowkey|\marg{direction} is a little special
778 % since it takes the direction as a singe character |^|, |v|
779 % (lower case v), |>| or |<|.
780 %
781 % \DM{\ctrlname}\DM{\delname}\DM{\spacename}The texts for |\ctrl|,
782 % |\del| and |\SPACE| are saved in |\ctrlname|, |\delname|, |\spacename| respectively.
783 % So you can change them with |\renewcommand|.
784 %
785 % The rendering of some Mac macros depend on the option \DO{mackeys}\opt{mackeys}
786 % The different versions are shown in the table (left: |text|, right: |symbols|).
787 %
788 % \bigskip\noindent
789 % I apologize that there are no commands for the windows key
790 % and the apple logo, but that would be a copyright infringement.
791 %
792 % \section{Known issues and bugs}\label{sec:issues}
793 % \begin{itemize}
794 % \item If you use the \pkg{inputenc} package \menukeys must be
795 % loaded after it. Otherwise some key macros get corrupted.
796 % \item \changes{v1.1}{2012/02/26}{Load \pkg{xcolor} before \menukeys.}
797 % \menukeys must be loaded after \pkg{xcolor}, if you load
798 % the latter with options. Otherwise you'll get an option clash.
799 % Since \menukeys loads \pkg{xcolor} internally you may pass
800 % options as global options via |\documentclass| or directly to it via
801 % |\PassOptionsToPackage|.
802 % \example Set \pkg{xcolor} to |cmyk| model:
803 % \begin{verbatim}
804 % \documentclass{article}
805 % \PassOptionsToPackage{cmyk}{xcolor}
806 % \usepackage{menukeys}
807 % \begin{document}
808 % Hello World!
809 % \end{document}
810 % \end{verbatim}
811 % \end{itemize}
812 %
813 % If you find something to add to this list please send me an e-mail or report a
814 % bug on GitHub (\url{https://github.com/tweh/menukeys}).
815 %
816 % \StopEventually{\clearpage\PrintChanges\clearpage\PrintIndex}
817 %
818 % \section{Implementation}
819 % \begin{macrocode}
820 %<*pkg>
821 % \end{macrocode}
822 % \subsection{Required packages}
823 % \changes{v1.6}{2020/10/27}{Don't load \pkg{catoptions}}
824 % Load the required packages
825 % \begin{macrocode}
826 \RequirePackage{xparse}
827 \RequirePackage{xstring}
828 \RequirePackage{etoolbox}
829 % \end{macrocode}
830 % Furthermore we need \TikZ and some of its libraries,
831 % \begin{macrocode}
832 \RequirePackage{tikz}
833 \usetikzlibrary{calc,shapes.symbols,shadows}
834 % \end{macrocode}
835 % the color package \pkg{xcolor} and \pkg{adjustbox} for the
836 % |typewriterkeys| style.
837 % \begin{macrocode}
838 \RequirePackage{xcolor}
839 \RequirePackage{adjustbox}
840 % \end{macrocode}
841 % Load \pkg{relsize} to be able to change the font size
842 % relative to the surrounding text.
843 % \begin{macrocode}
844 \RequirePackage{relsize}
845 % \end{macrocode}
846 % To define the list parsing commands and allow |\| as
847 % a separator we used to load \pkg{catoptions}. Instead we now use some
848 % \pkg{expl3} functions to replace the macros we required from \pkg{catoptions}.
849 %
850 % The first few of these functions are more or less direct equivalents. A bit of
851 % attention has to be paid for |\tw@mk@xifinsetTF| as it requires the arguments
852 % to get swapped.
853 % \begin{macrocode}
854 \ExplSyntaxOn
855 \cs_new_eq:NN \tw@mk@trimspaces \tl_trim_spaces:n
856 \cs_new_eq:NN \tw@mk@exp@Nnno \exp_args:Nnno
857 \cs_new_eq:NN \tw@mk@string \cs_to_str:N
858 \prg_generate_conditional_variant:Nnn \tl_if_in:nn { xx } { TF }
859 \cs_new:Npn \tw@mk@xifinsetTF #1 #2
860 {
861 \tl_if_in:xxTF {#2} {#1}
862 }
863 % \end{macrocode}
864 % The replacement for |\indrisloop| will not set the conditional
865 % |\iflastindris|, instead we can check whether the sequence is empty to see
866 % whether this is the last element. This test will not use a TeX-like
867 % |\iflastindris...\else...\fi| construct but instead two branches.
868 % \begin{macrocode}
869 \cs_new:Npn \tw@mk@iflastindris
870 {
871 \seq_if_empty:NTF \l__twmk_indris_seq
872 }
873 % \end{macrocode}
874 % Replacing |\indrisloop| is a bit more work as it requires us to push some
875 % values to a stack (to allow nested usage, this may not be necessary for
876 % \pkg{menukeys}, but it is part of the original |\indrisloop| so we should
877 % play nice here). First we'll need a few variables.
878 % \begin{macrocode}
879 \seq_new:N \l__twmk_indris_seq
880 \int_new:N \l__twmk_indris_int
881 \tl_new:N \l__twmk_indris_tl
882 \cs_new_eq:NN \tw@mk@indrisnr \l__twmk_indris_int
883 \seq_new:N \l__twmk_indris_seqstack_seq
884 \seq_new:N \l__twmk_indris_intstack_seq
885 % \end{macrocode}
886 % Our stack will use another sequence in which the definitions of the parent
887 % call will be stored for the sequence and the integer. The other variables put
888 % on a stack by |\indrisloop| aren't required. The synopsis of
889 % |\tw@mk@indrisloop| will be different to the one provided by \pkg{catoptions}.
890 % The delimiter will be a mandatory argument (not in brackets), and there is no
891 % starred version.
892 % \begin{macrocode}
893 \cs_new_protected:Npn \__twmk_pushseq:
894 {
895 \seq_push:No \l__twmk_indris_seqstack_seq \l__twmk_indris_seq
896 }
897 \cs_new_protected:Npn \__twmk_pushint:
898 {
899 \seq_push:NV \l__twmk_indris_intstack_seq \l__twmk_indris_int
900 }
901 \cs_new_protected:Npn \__twmk_popseq:
902 {
903 \seq_if_empty:NTF \l__twmk_indris_seqstack_seq
904 { \seq_clear:N \l__twmk_indris_seq }
905 { \seq_pop:NN \l__twmk_indris_seqstack_seq \l__twmk_indris_seq }
906 }
907 \cs_new_protected:Npn \__twmk_popint:
908 {
909 \seq_if_empty:NTF \l__twmk_indris_intstack_seq
910 { \int_zero:N \l__twmk_indris_int }
911 {
912 \group_begin:
913 \seq_pop:NN \l__twmk_indris_intstack_seq \l__twmk_indris_tl
914 \exp_args:NNNo
915 \group_end:
916 \int_set:Nn \l__twmk_indris_int \l__twmk_indris_tl
917 }
918 }
919 % \end{macrocode}
920 % The real loop works by first splitting the input into a sequence according to
921 % the delimiter in |#1|. Then this sequence is stepped through, but instead of
922 % using |\seq_map:NN| we'll have to pop the sequence into a local variable so
923 % that our test for the last element works. The parameter |#2| has to be
924 % expanded once as it is handed in as a token storing the real argument in later
925 % use.
926 % \begin{macrocode}
927 \cs_generate_variant:Nn \seq_set_split:Nnn { Noo }
928 \cs_new_protected:Npn \tw@mk@indrisloop #1 #2 #3
929 {
930 \__twmk_pushseq:
931 \__twmk_pushint:
932 \seq_set_split:Noo \l__twmk_indris_seq {#1} {#2}
933 \int_zero:N \l__twmk_indris_int
934 \bool_do_while:nn { \bool_not_p:n { \seq_if_empty_p:N \l__twmk_indris_seq } }
935 {
936 \int_incr:N \l__twmk_indris_int
937 \seq_pop_left:NN \l__twmk_indris_seq \l__twmk_indris_tl
938 \exp_args:No #3 \l__twmk_indris_tl
939 }
940 \__twmk_popseq:
941 \__twmk_popint:
942 }
943 \ExplSyntaxOff
944 % \end{macrocode}
945 %
946 % \subsection{Helper macros}
947 % \begin{macro}{\tw@mk@error}\begin{macro}{\tw@mk@warning}
948 % \begin{macro}{\tw@mk@warning@noline}
949 % Define macros to call |\PackageError| and warnings
950 % \begin{macrocode}
951 \newcommand*{\tw@mk@error}[2][Please consult the manual for more information.]{%
952 \PackageError{menukeys}{#2}{#1}%
953 }
954 \newcommand*{\tw@mk@warning}[1]{%
955 \PackageWarning{menukeys}{#1}%
956 }
957 \newcommand*{\tw@mk@warning@noline}[1]{%
958 \PackageWarningNoLine{menukeys}{#1}%
959 }
960 % \end{macrocode}
961 % \end{macro}\end{macro}\end{macro}
962 % \begin{macro}{\tw@mk@tempa}\begin{macro}{\tw@mk@tempb}
963 % Some commands for temporary use:
964 % \begin{macrocode}
965 \def\tw@mk@tempa{}
966 \def\tw@mk@tempb{}
967 % \end{macrocode}
968 % \end{macro}\end{macro}
969 % \begin{macro}{\tw@mk@gobble@args}
970 % Define a command to gobble arguments.
971 % \begin{macrocode}
972 \DeclareDocumentCommand{\tw@mk@gobble@args}{m}{%
973 \RenewDocumentCommand{\tw@mk@tempa}{#1}{}%
974 \tw@mk@tempa%
975 }
976 % \end{macrocode}
977 % \end{macro}
978 %
979 % \subsection{Options}
980 % First we declare and process the package options
981 % \begin{macrocode}
982 \RequirePackage{kvoptions}
983 \SetupKeyvalOptions{
984 family=tw@mk,
985 prefix=tw@mk@
986 }
987 \DeclareBoolOption[true]{definemenumacros}
988 \DeclareBoolOption[true]{definekeys}
989 \DeclareBoolOption[false]{hyperrefcolorlinks}
990 \DeclareStringOption[mac]{os}
991 \DeclareStringOption[symbols]{mackeys}
992 \ProcessKeyvalOptions{tw@mk}\relax
993 % \end{macrocode}
994 % Now we have to do some error treatment:
995 % \begin{macrocode}
996 \IfSubStr{.mac.win.}{.\tw@mk@os.}{}{%
997 \tw@mk@error{Unknown value for option 'os'\MessageBreak
998 Possible values are 'mac' or 'win'.}%
999 }
1000 \IfSubStr{.symbols.text.}{.\tw@mk@mackeys.}{}{%
1001 \tw@mk@error{Unknown value for option 'mackeys'\MessageBreak
1002 Possible values are 'symbols' or 'text'.}%
1003 }
1004 % \end{macrocode}
1005 %
1006 % \subsection{Workarounds}
1007 % Some workarounds to ``solve'' some incompatibilities:
1008 % \subsubsection{\pkg{hyperref}'s \opt{colorlinks} option}\label{sec:hyperref-colorlinks}
1009 % \changes{v1.6}{2020/10/27}{\opt{hyperrefcolorlinks} obsolete}
1010 % \changes{v1.5}{2016/08/08}{New option \opt{hyperrefcolorlinks}}
1011 % There used to be an issue with using the \opt{colorlinks} option of
1012 % \pkg{hyperref} due to \pkg{catoptions} being loaded. Since \pkg{catoptions}
1013 % isn't required any more, this workaround isn't necessary. For backwards
1014 % compatibility the \opt{hyperrefcolorlinks} option is still evaluated and just
1015 % uses |\hypersetup| or |\PassOptionsToPackage| depending on whether
1016 % \pkg{hyperref} is already loaded.
1017 % \begin{macrocode}
1018 \iftw@mk@hyperrefcolorlinks
1019 \tw@mk@warning{The option `hyperrefcolorlinks' is obsolete}
1020 \@ifpackageloaded{hyperref}
1021 {\hypersetup{colorlinks}}
1022 {\PassOptionsToPackage{colorlinks}{hyperref}}
1023 \fi
1024 % \end{macrocode}
1025 %
1026 % \subsection{Color themes}
1027 % \subsubsection{Internal commands}
1028 % \begin{macro}{\tw@make@color@theme}
1029 % First we define an internal command to make a color theme
1030 % \begin{macrocode}
1031 \newcommand*{\tw@make@color@theme}[8]{%
1032 \definecolor{tw@color@theme@#1@bg}{#2}{#3}%
1033 \definecolor{tw@color@theme@#1@br}{#2}{#4}%
1034 \definecolor{tw@color@theme@#1@txt}{#2}{#5}%
1035 \definecolor{tw@color@theme@#1@a}{#2}{#6}%
1036 \definecolor{tw@color@theme@#1@b}{#2}{#7}%
1037 \definecolor{tw@color@theme@#1@c}{#2}{#8}%
1038 }
1039 % \end{macrocode}
1040 % \end{macro}
1041 % \subsubsection{User-level commands}
1042 % \begin{macro}{\newmenucolortheme}\begin{macro}{\renewmenucolortheme}
1043 % After that we define the user-level commands:
1044 % \begin{macrocode}
1045 \NewDocumentCommand{\newmenucolortheme}{ m m m m m O{#3} O{#4} O{#5} }{%
1046 \@ifundefinedcolor{tw@color@theme@#1@bg}{%
1047 \tw@make@color@theme{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}%
1048 }{%
1049 \tw@mk@error{Color theme '#1' already defined!\MessageBreak
1050 Use \string\renewmenucolortheme\space instead.}%
1051 }
1052 }
1053 \NewDocumentCommand{\renewmenucolortheme}{ m m m m m O{#3} O{#4} O{#5} }{%
1054 \tw@make@color@theme{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}%
1055 }
1056 % \end{macrocode}
1057 % \end{macro}\end{macro}
1058 % \begin{macro}{\changemenucolor}\begin{macro}{\copymenucolortheme}
1059 % Lastly we define the changing and copying commands
1060 % \begin{macrocode}
1061 \newcommand*{\changemenucolor}[4]{%
1062 \IfSubStr{ bg br txt }{ #2 }{%
1063 \definecolor{tw@color@theme@#1@#2}{#3}{#4}%
1064 }{%
1065 \tw@mk@error{No such color element ('#2')!\MessageBreak
1066 Possible values are bg, br and txt.}
1067 }%
1068 }
1069 \newcommand*{\copymenucolortheme}[2]{%
1070 \@ifundefinedcolor{tw@color@theme@#1@bg}{%
1071 \colorlet{tw@color@theme@#1@bg}{tw@color@theme@#2@bg}%
1072 \colorlet{tw@color@theme@#1@br}{tw@color@theme@#2@br}%
1073 \colorlet{tw@color@theme@#1@txt}{tw@color@theme@#2@txt}%
1074 \colorlet{tw@color@theme@#1@a}{tw@color@theme@#2@a}%
1075 \colorlet{tw@color@theme@#1@b}{tw@color@theme@#2@b}%
1076 \colorlet{tw@color@theme@#1@c}{tw@color@theme@#2@c}%
1077 }{%
1078 \tw@mk@error{Color theme '#1' already defined!\MessageBreak
1079 Use \string\renewmenucolortheme\space instead.}
1080 }
1081 }
1082 % \end{macrocode}
1083 % \end{macro}\end{macro}
1084 % \begin{macro}{\changemenucolortheme}
1085 % To be able to change the color theme of a style we must define this:
1086 % \begin{macrocode}
1087 \newcommand{\changemenucolortheme}[2]{%
1088 \ifcsundef{tw@style@#1@pre}{%
1089 \tw@mk@error{Style '#1' undefined!\MessageBreak
1090 Maybe you misspelled it?}%
1091 }{%
1092 \@ifundefinedcolor{tw@color@theme@#2@bg}{%
1093 \tw@mk@error{Color theme '#2' is not defined!}%
1094 }{%
1095 \csdef{tw@style@#1@color@theme}{#2}%
1096 }%
1097 }%
1098 }
1099 % \end{macrocode}
1100 % \end{macro}
1101 % \begin{macro}{\usemenucolor}
1102 % To use a color of a theme we define |\usemenucolor| as following.
1103 % \begin{macrocode}
1104 \newcommand{\usemenucolor}[1]{%
1105 tw@color@theme@\tw@current@color@theme @#1%
1106 }
1107 % \end{macrocode}
1108 % \end{macro}
1109 % \subsubsection{Predefined themes}
1110 % There are two predefined color themes
1111 % \begin{macrocode}
1112 \newmenucolortheme{gray}{gray}{0.95}{0.3}{0}[0.95][0][0]
1113 \newmenucolortheme{blacknwhite}{gray}{1}{0}{0}[1][0][0]
1114 % \end{macrocode}
1115 % \subsection{Styles}
1116 % The style generating commands will set some commands that are named
1117 % like |\tw@style@|\meta{name}|@|\meta{element}.
1118 % \begin{macro}{\tw@default@sep}
1119 % \begin{macro}{\tw@default@pre}
1120 % \begin{macro}{\tw@default@post}
1121 % Before we can define the internal
1122 % declaring macro to use it later in the user level commands, we have to set
1123 % some defaults for the optional arguments
1124 % \begin{macrocode}
1125 \newcommand{\tw@default@sep}{%
1126 \hspace{0.2em plus 0.1em minus 0.5em}%
1127 }
1128 \newcommand{\tw@default@pre}{}
1129 \newcommand{\tw@default@post}{}
1130 % \end{macrocode}
1131 % \end{macro}\end{macro}\end{macro}
1132 % \subsubsection{Internal commands}
1133 % Now we can define the internal commands.
1134 % \begin{macro}{\tw@declare@style@simple}
1135 % Our first step is to define the simple command.
1136 % \begin{macrocode}
1137 \DeclareDocumentCommand{\tw@declare@style@simple}{%
1138 s m O{\tw@default@pre} m O{\tw@default@sep} O{\tw@default@post} m
1139 }{%
1140 \csdef{tw@style@#2@color@theme}{#7}%
1141 \csdef{tw@style@#2@pre}{#3}%
1142 \csdef{tw@style@#2@sep}{#5}%
1143 \csdef{tw@style@#2@post}{#6}%
1144 \IfBooleanTF{#1}{%
1145 \csdef{tw@style@#2@single}{#4}%
1146 \csdef{tw@style@#2@first}{#4}%
1147 \csdef{tw@style@#2@mid}{#4}%
1148 \csdef{tw@style@#2@last}{#4}%
1149 }{%
1150 \csdef{tw@style@#2@single}{%
1151 \tikz[baseline=([email protected])]{%
1152 \node(tw@node)[#4]{\strut\CurrentMenuElement};}}%
1153 \csdef{tw@style@#2@first}{%
1154 \tikz[baseline=([email protected])]{%
1155 \node(tw@node)[#4]{\strut\CurrentMenuElement};}}%
1156 \csdef{tw@style@#2@mid}{%
1157 \tikz[baseline=([email protected])]{%
1158 \node(tw@node)[#4]{\strut\CurrentMenuElement};}}%
1159 \csdef{tw@style@#2@last}{%
1160 \tikz[baseline=([email protected])]{%
1161 \node(tw@node)[#4]{\strut\CurrentMenuElement};}}%
1162 }%
1163 }
1164 % \end{macrocode}
1165 % \end{macro}
1166 % \begin{macro}{\tw@declare@style}\begin{macro}{\tw@declare@style@extra@args}
1167 % The next step is to create the extended command. This command must have
1168 % ten arguments (including the star) so we have to define a helping macro
1169 % to grab the last two macros.
1170 % \begin{macrocode}
1171 \DeclareDocumentCommand{\tw@declare@style@extra@args}{%
1172 O{\tw@default@post} m
1173 }{%
1174 \csdef{tw@style@\tw@current@style @post}{#1}%
1175 \csdef{tw@style@\tw@current@style @color@theme}{#2}%
1176 }
1177 % \end{macrocode}
1178 % Now we can define |\tw@declare@style|:
1179 % \begin{macrocode}
1180 \DeclareDocumentCommand{\tw@declare@style}{%
1181 s m O{\tw@default@pre} m O{\tw@default@sep} m m m
1182 }{%
1183 \def\tw@current@style{#2}
1184 \csdef{tw@style@#2@pre}{#3}%
1185 \csdef{tw@style@#2@sep}{#5}%
1186 \IfBooleanTF{#1}{%
1187 \csdef{tw@style@#2@single}{#8}%
1188 \csdef{tw@style@#2@first}{#4}%
1189 \csdef{tw@style@#2@mid}{#6}%
1190 \csdef{tw@style@#2@last}{#7}%
1191 }{%
1192 \csdef{tw@style@#2@single}{%
1193 \tikz[baseline=([email protected])]{%
1194 \node(tw@node)[#8]{\strut\CurrentMenuElement};}}%
1195 \csdef{tw@style@#2@first}{%
1196 \tikz[baseline=([email protected])]{%
1197 \node(tw@node)[#4]{\strut\CurrentMenuElement};}}%
1198 \csdef{tw@style@#2@mid}{%
1199 \tikz[baseline=([email protected])]{%
1200 \node(tw@node)[#6]{\strut\CurrentMenuElement};}}%
1201 \csdef{tw@style@#2@last}{%
1202 \tikz[baseline=([email protected])]{%
1203 \node(tw@node)[#7]{\strut\CurrentMenuElement};}}%
1204 }%
1205 \tw@declare@style@extra@args%
1206 }
1207 % \end{macrocode}
1208 % \end{macro}\end{macro}
1209 % \subsubsection{User-level commands}
1210 % \begin{macro}{newmenustylesimple}\begin{macro}{renewmenustylesimple}%
1211 % \begin{macro}{providemenustylesimple}\begin{macro}{newmenustyle}\begin{macro}%
1212 % {renewmenustyle}\begin{macro}{providemenustyle}
1213 % It's time to define the user-level commands now:
1214 % \begin{macrocode}
1215 \NewDocumentCommand{\newmenustylesimple}{s m}{%
1216 \ifcsundef{tw@style@#2@pre}{%
1217 \IfBooleanTF{#1}{%
1218 \tw@declare@style@simple*{#2}%
1219 }{%
1220 \tw@declare@style@simple{#2}%
1221 }%
1222 }{%
1223 \tw@mk@error{Style '#2' already defined!\MessageBreak
1224 Use \string\renewmenustylesimple\space instead.}%
1225 \tw@mk@gobble@args{o m o o m}%
1226 }%
1227 }
1228 \NewDocumentCommand{\renewmenustylesimple}{s m}{%
1229 \IfBooleanTF{#1}{%
1230 \tw@declare@style@simple*{#2}%
1231 }{%
1232 \tw@declare@style@simple{#2}%
1233 }%
1234 }
1235 \NewDocumentCommand{\providemenustylesimple}{s m}{%
1236 \ifcsundef{tw@style@#2@pre}{%
1237 \IfBooleanTF{#1}{%
1238 \tw@declare@style@simple*{#2}%
1239 }{%
1240 \tw@declare@style@simple{#2}%
1241 }%
1242 }{%
1243 \tw@mk@warning{Trying to provide style '#2' failed,\MessageBreak
1244 because it's already defined.\MessageBreak
1245 You may use \string\renewmenustylesimple\space instead.}%
1246 \tw@mk@gobble@args{o m o o m}%
1247 }%
1248 }
1249
1250 \NewDocumentCommand{\newmenustyle}{s m}{%
1251 \ifcsundef{tw@style@#2@pre}{%
1252 \IfBooleanTF{#1}{%
1253 \tw@declare@style*{#2}%
1254 }{%
1255 \tw@declare@style{#2}%
1256 }%
1257 }{%
1258 \tw@mk@error{Style '#2' already defined!\MessageBreak
1259 Use \string\renewmenustyle\space instead.}%
1260 \tw@mk@gobble@args{o m o m m m o m}%
1261 }%
1262 }
1263 \NewDocumentCommand{\renewmenustyle}{s m}{%
1264 \IfBooleanTF{#1}{%
1265 \tw@declare@style*{#2}%
1266 }{%
1267 \tw@declare@style{#2}%
1268 }%
1269 }
1270 \NewDocumentCommand{\providemenustyle}{s m}{%
1271 \ifcsundef{tw@style@#2@pre}{%
1272 \IfBooleanTF{#1}{%
1273 \tw@declare@style*{#2}%
1274 }{%
1275 \tw@declare@style{#2}%
1276 }%
1277 }{%
1278 \tw@mk@warning{Trying to provide style #2 failed,\MessageBreak
1279 because it's already defined.\MessageBreak
1280 You may use \string\renewmenustyle\space instead.}%
1281 \tw@mk@gobble@args{o m o m m m o m}%
1282 }%
1283 }
1284 % \end{macrocode}
1285 % \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
1286 %
1287 % \subsubsection{Copying and changing}
1288 % \begin{macro}{\copymenustyle}
1289 % The last two steps in this part are to define a command to copy
1290 % styles
1291 % \begin{macrocode}
1292 \newcommand*{\copymenustyle}[2]{%
1293 \ifcsundef{tw@style@#1@pre}{%
1294 \ifcsundef{tw@style@#2@pre}{%
1295 \tw@mk@error{Can't copy not existing style ('#2')!}%
1296 }{%
1297 \csletcs{tw@style@#1@pre}{tw@style@#2@pre}%
1298 \csletcs{tw@style@#1@post}{tw@style@#2@post}%
1299 \csletcs{tw@style@#1@sep}{tw@style@#2@sep}%
1300 \csletcs{tw@style@#1@single}{tw@style@#2@single}%
1301 \csletcs{tw@style@#1@first}{tw@style@#2@first}%
1302 \csletcs{tw@style@#1@mid}{tw@style@#2@mid}%
1303 \csletcs{tw@style@#1@last}{tw@style@#2@last}%
1304 \csletcs{tw@style@#1@color@theme}{tw@style@#2@color@theme}
1305 }%
1306 }{%
1307 \tw@mk@error{Style '#1' already exists!}%
1308 }%
1309 }
1310 % \end{macrocode}
1311 % \end{macro}
1312 % \begin{macro}{\changemenuelement}
1313 % and one to change a single element of a style.
1314 % \begin{macrocode}
1315 \NewDocumentCommand{\changemenuelement}{s m m m}{%
1316 \ifcsundef{tw@style@#2@pre}{%
1317 \tw@mk@error{Style '#2' undefined.}%
1318 }{%
1319 \IfSubStr{ single first middle last pre post sep }{ #3 }{%
1320 \IfBooleanTF{#1}{%
1321 \csdef{tw@style@#2@#3}{#4}%
1322 }{%
1323 \IfSubStr{ pre post sep }{ #3 }{%
1324 \csdef{tw@style@#2@#3}{#4}%
1325 }{%
1326 \csdef{tw@style@#2@#3}{%
1327 \tikz[baseline=([email protected])]{%
1328 \node(tw@node)[#4]{\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}}%
1329 }%
1330 }%
1331 }{\tw@mk@error{No element '#3'. Possible values are\MessageBreak
1332 single, first, middle, last, pre, post or sep.}}%
1333 }%
1334 }
1335 % \end{macrocode}
1336 % \end{macro}
1337 % \subsubsection{Predefined styles}
1338 % We define several styles for menu sequences, paths and keystrokes.
1339 % \begin{macro}{tw@set@tikz@colors}
1340 % First we define a \TikZ-style to apply the color theme to a node
1341 % easily
1342 % \begin{macrocode}
1343 \tikzset{tw@set@tikz@colors/.style={%
1344 draw=\usemenucolor{br},
1345 fill=\usemenucolor{bg},
1346 text=\usemenucolor{txt},
1347 }}
1348 % \end{macrocode}
1349 % \end{macro}
1350 % Now we can define the styles. To keep the most settings of
1351 % a style together we make additional \TikZ-styles instead of setting
1352 % everything directly to the |node|s.
1353 % \begin{macrocode}
1354 \tikzset{tw@menus@base/.style={%
1355 tw@set@tikz@colors,
1356 rounded corners=0.15ex,
1357 inner sep=0pt,
1358 inner xsep=2pt,
1359 text height=1.825ex,
1360 text depth=0.7ex,
1361 minimum width=1.5em,
1362 font=\relsize{-1}\sffamily,
1363 signal,
1364 signal to=nowhere,
1365 signal pointer angle=110,
1366 }}
1367 \tw@declare@style*{menus}{%
1368 \tikz[baseline={($([email protected])+(0,-0.2ex)$)}]{%
1369 \node(tw@node)[tw@menus@base,signal to=east]%
1370 {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}%
1371 }[\hspace{-0.2em}\hspace{0em plus 0.1em minus 0.05em}]%
1372 {%
1373 \tikz[baseline={($([email protected])+(0,-0.2ex)$)}]{%
1374 \node(tw@node)[tw@menus@base,signal from=west,signal to=east]%
1375 {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}%
1376 }{%
1377 \tikz[baseline={($([email protected])+(0,-0.2ex)$)}]{%
1378 \node(tw@node)[tw@menus@base,signal from=west,]%
1379 {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}%
1380 }{%
1381 \tikz[baseline={($([email protected])+(0,-0.2ex)$)}]{%
1382 \node(tw@node)[tw@menus@base]{\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}%
1383 }{gray}
1384
1385 \tikzset{tw@roundedmenus@base/.style={%
1386 tw@set@tikz@colors,
1387 rounded corners=0.3ex,
1388 inner sep=0pt,
1389 inner xsep=2pt,
1390 text height=1.825ex,
1391 text depth=0.7ex,
1392 minimum width=1.5em,
1393 font=\relsize{-1}\sffamily,
1394 signal,
1395 signal to=nowhere,
1396 signal pointer angle=110,
1397 }}
1398 \tw@declare@style*{roundedmenus}{%
1399 \tikz[baseline={($([email protected])+(0,-0.2ex)$)}]{%
1400 \node(tw@node)[tw@roundedmenus@base,signal to=east]%
1401 {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}%
1402 }[\hspace{-0.2em}\hspace{0em plus 0.1em minus 0.05em}]%
1403 {%
1404 \tikz[baseline={($([email protected])+(0,-0.2ex)$)}]{%
1405 \node(tw@node)[tw@roundedmenus@base,signal from=west,signal to=east]%
1406 {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}%
1407 }{%
1408 \tikz[baseline={($([email protected])+(0,-0.2ex)$)}]{%
1409 \node(tw@node)[tw@roundedmenus@base,signal from=west,]%
1410 {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}%
1411 }{%
1412 \tikz[baseline={($([email protected])+(0,-0.2ex)$)}]{%
1413 \node(tw@node)[tw@roundedmenus@base]{\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}%
1414 }{gray}
1415
1416 \tikzset{tw@angularmenus@base/.style={%
1417 tw@set@tikz@colors,
1418 inner sep=0pt,
1419 inner xsep=2pt,
1420 text height=1.825ex,
1421 text depth=0.7ex,
1422 minimum width=1.5em,
1423 font=\relsize{-1}\sffamily,
1424 signal,
1425 signal to=nowhere,
1426 signal pointer angle=110,
1427 }}
1428 \tw@declare@style*{angularmenus}{%
1429 \tikz[baseline={($([email protected])+(0,-0.2ex)$)}]{%
1430 \node(tw@node)[tw@angularmenus@base,signal to=east]%
1431 {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}%
1432 }[\hspace{-0.2em}\hspace{0em plus 0.1em minus 0.05em}]%
1433 {%
1434 \tikz[baseline={($([email protected])+(0,-0.2ex)$)}]{%
1435 \node(tw@node)[tw@angularmenus@base,signal from=west,signal to=east]%
1436 {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}%
1437 }{%
1438 \tikz[baseline={($([email protected])+(0,-0.2ex)$)}]{%
1439 \node(tw@node)[tw@angularmenus@base,signal from=west,]%
1440 {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}%
1441 }{%
1442 \tikz[baseline={($([email protected])+(0,-0.2ex)$)}]{%
1443 \node(tw@node)[tw@angularmenus@base]{\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}%
1444 }{gray}
1445
1446 \tikzset{tw@roundedkeys@base/.style={%
1447 tw@set@tikz@colors,
1448 rounded corners=0.3ex,
1449 inner sep=0pt,
1450 inner xsep=2pt,
1451 text height=1.825ex,
1452 text depth=0.7ex,
1453 minimum width=1.5em,
1454 font=\relsize{-1}\sffamily,
1455 }}
1456 \tw@declare@style@simple*{roundedkeys}{%
1457 \tikz[baseline={($([email protected])+(0,-0.2ex)$)}]{%
1458 \node(tw@node)[tw@roundedkeys@base]%
1459 {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}%
1460 }[%
1461 \hspace{0.1em plus 0.1em minus 0.05em}%
1462 \textcolor{\usemenucolor{b}}{\raisebox{0.25ex}{\sffamily\relsize{-2}+}}%
1463 \hspace{0.1em plus 0.1em minus 0.05em}%
1464 ]{gray}
1465
1466 \tikzset{tw@shadowedroundedkeys@base/.style={%
1467 tw@set@tikz@colors,
1468 rounded corners=0.3ex,
1469 inner sep=0pt,
1470 inner xsep=2pt,
1471 text height=1.825ex,
1472 text depth=0.7ex,
1473 minimum width=1.5em,
1474 font=\relsize{-1}\sffamily,
1475 general shadow={%
1476 shadow xshift=.2ex, shadow yshift=-.15ex,
1477 fill=\usemenucolor{c},
1478 },
1479 }}
1480 \tw@declare@style@simple*{shadowedroundedkeys}{%
1481 \tikz[baseline={($([email protected])+(0,-0.2ex)$)}]{%
1482 \node(tw@node)[tw@shadowedroundedkeys@base]%
1483 {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};%
1484 }%
1485 }[%
1486 \hspace{0.2ex}\hspace{0.1em plus 0.1em minus 0.05em}%
1487 \textcolor{\usemenucolor{b}}{\raisebox{0.25ex}{\sffamily\relsize{-2}+}}%
1488 \hspace{0.1em plus 0.1em minus 0.05em}%
1489 % \end{macrocode}
1490 % \changes{v1.6.2}{2022/07/01}{changed \cs{hspace} to \cs{kern}}
1491 % \begin{macrocode}
1492 %</pkg>
1493 %<cur>][\kern0.2ex\relax]{gray}
1494 %<161>][\hspace{0.2ex}]{gray}
1495 %<*pkg>
1496 % \end{macrocode}
1497 % \begin{macrocode}
1498
1499 \tikzset{tw@angularkeys@base/.style={%
1500 tw@set@tikz@colors,
1501 inner sep=0pt,
1502 inner xsep=2pt,
1503 text height=1.825ex,
1504 text depth=0.7ex,
1505 minimum width=1.5em,
1506 font=\relsize{-1}\sffamily,
1507 }}
1508 \tw@declare@style@simple*{angularkeys}{%
1509 \tikz[baseline={($([email protected])+(0,-0.2ex)$)}]{%
1510 \node(tw@node)[tw@angularkeys@base]%
1511 {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}%
1512 }[%
1513 \hspace{0.1em plus 0.1em minus 0.05em}%
1514 \textcolor{\usemenucolor{b}}{\raisebox{0.25ex}{\sffamily\relsize{-2}+}}%
1515 \hspace{0.1em plus 0.1em minus 0.05em}%
1516 ]{gray}
1517
1518 \tikzset{tw@shadowedangularkeys@base/.style={%
1519 tw@set@tikz@colors,
1520 inner sep=0pt,
1521 inner xsep=2pt,
1522 text height=1.825ex,
1523 text depth=0.7ex,
1524 minimum width=1.5em,
1525 font=\relsize{-1}\sffamily,
1526 general shadow={%
1527 shadow xshift=.2ex, shadow yshift=-.15ex,
1528 fill=\usemenucolor{c},
1529 },
1530 }}
1531 \tw@declare@style@simple*{shadowedangularkeys}{%
1532 \tikz[baseline={($([email protected])+(0,-0.2ex)$)}]{%
1533 \node(tw@node)[tw@shadowedangularkeys@base]%
1534 {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}%
1535 }[%
1536 \hspace{0.2ex}\hspace{0.1em plus 0.1em minus 0.05em}%
1537 \textcolor{\usemenucolor{b}}{\raisebox{0.25ex}{\sffamily\relsize{-2}+}}%
1538 \hspace{0.1em plus 0.1em minus 0.05em}%
1539 % \end{macrocode}
1540 % \changes{v1.6.2}{2022/07/01}{changed \cs{hspace} to \cs{kern}}
1541 % \begin{macrocode}
1542 %</pkg>
1543 %<cur>][\kern0.2ex\relax]{gray}
1544 %<161>][\hspace{0.2ex}]{gray}
1545 %<*pkg>
1546 % \end{macrocode}
1547 % \begin{macrocode}
1548
1549 \tikzset{tw@typewriterkeys@base/.style={%
1550 tw@set@tikz@colors,
1551 shape=circle,
1552 minimum size=2ex,
1553 inner sep=0.5pt, outer sep=1pt,
1554 font=\ttfamily\relsize{-1},
1555 }}
1556 \tw@declare@style@simple*{typewriterkeys}{%
1557 \def\tw@typewriterkeys@curr@elem{%
1558 \maxsizebox*{2ex}{2ex}{\CurrentMenuElement}%
1559 }%
1560 \begin{tikzpicture}[baseline={($([email protected])+(0,0.8ex)$)}]%
1561 \node(tw@node)[%
1562 tw@typewriterkeys@base, inner sep=1.25pt, line width=0.6pt%
1563 ]{\color{\usemenucolor{txt}}\tw@typewriterkeys@curr@elem};
1564 \node[tw@typewriterkeys@base]%
1565 {\color{\usemenucolor{txt}}\tw@typewriterkeys@curr@elem};
1566 \end{tikzpicture}%
1567 }[%
1568 \hspace{0.2ex}\hspace{0.1em plus 0.1em minus 0.05em}%
1569 \textcolor{\usemenucolor{b}}{\raisebox{0.25ex}{\sffamily\relsize{-2}+}}%
1570 \hspace{0.1em plus 0.1em minus 0.05em}%
1571 ]{blacknwhite}
1572
1573 \tw@declare@style@simple*{paths}{%
1574 {\ttfamily\color{\usemenucolor{txt}}\CurrentMenuElement}%
1575 }[%
1576 \hspace{0.2em plus 0.1em}%
1577 \raisebox{0.08ex}{%
1578 \tikz{\fill[\usemenucolor{c}] (0,0) -- (0.5ex,0.5ex)%
1579 -- (0,1ex) -- cycle;}%
1580 }%
1581 \hspace{0.2em plus 0.1em}%
1582 ]{blacknwhite}
1583
1584 \newcounter{tw@hyphen@char@num}
1585 \newif\if@tw@hyphenatepaths@warnig
1586 \@tw@hyphenatepaths@warnigtrue
1587 \tw@declare@style@simple*{hyphenatepaths}{%
1588 {\ttfamily
1589 \IfStrEq{T1}{\encodingdefault}{%
1590 \setcounter{tw@hyphen@char@num}{23}%
1591 }{%
1592 \IfStrEq{OT1}{\encodingdefault}{%
1593 \setcounter{tw@hyphen@char@num}{255}%
1594 }{%
1595 \if@tw@hyphenatepaths@warnig%
1596 \tw@mk@warning{The hyphenatepaths styles will probably only\MessageBreak
1597 work with T1 or OT1 encoding.}%
1598 \fi\global\@tw@hyphenatepaths@warnigfalse%
1599 }%
1600 }%
1601 \hyphenchar\font=\value{tw@hyphen@char@num}\relax
1602 \color{\usemenucolor{txt}}%
1603 \CurrentMenuElement}%
1604 }[%
1605 \hspace{0.2em plus 0.1em}%
1606 \raisebox{0.08ex}{%
1607 \tikz{\fill[\usemenucolor{c}] (0,0) -- (0.5ex,0.5ex)%
1608 -- (0,1ex) -- cycle;}%
1609 }%
1610 \hspace{0.2em plus 0.1em}%
1611 ]{blacknwhite}
1612
1613 \NewDocumentCommand{\drawtikzfolder}{O{white} O{black}}{%
1614 \begin{tikzpicture}[rounded corners=0.02ex,scale=0.7]
1615 \draw [#2] (0,0) -- (1em,0) -- (1em,1.5ex) -- (0.5em,1.5ex) -- %
1616 (0.4em,1.7ex) -- (0.1em,1.7ex) -- (0,1.5ex) -- cycle;
1617 \draw [#2,fill=#1] (0,0) -- (1em,0) -- (0.85em,1.15ex) -- %
1618 ++(-1em,0) -- cycle;
1619 \end{tikzpicture}%
1620 }
1621
1622 \copymenustyle{pathswithfolder}{paths}
1623 \changemenuelement{pathswithfolder}{pre}{%
1624 \drawtikzfolder[\usemenucolor{a}][\usemenucolor{b}]%
1625 \hspace{0.2em plus 0.1em}%
1626 }
1627
1628 \copymenustyle{pathswithblackfolder}{paths}
1629 \changemenuelement{pathswithblackfolder}{pre}{%
1630 \drawtikzfolder[\usemenucolor{c}][\usemenucolor{b}]%
1631 \hspace{0.2em plus 0.1em}%
1632 }
1633
1634 \copymenustyle{hyphenatepathswithfolder}{hyphenatepaths}
1635 \changemenuelement{hyphenatepathswithfolder}{pre}{%
1636 \drawtikzfolder[\usemenucolor{a}][\usemenucolor{b}]%
1637 \hspace{0.2em plus 0.1em}%
1638 }
1639
1640 \copymenustyle{hyphenatepathswithblackfolder}{hyphenatepaths}
1641 \changemenuelement{hyphenatepathswithblackfolder}{pre}{%
1642 \drawtikzfolder[\usemenucolor{c}][\usemenucolor{b}]%
1643 \hspace{0.2em plus 0.1em}%
1644 }
1645 % \end{macrocode}
1646 %
1647 % \subsection{Menu macros}
1648 % \subsubsection{Internal commands}
1649 % \begin{macro}{\tw@default@input@sep}
1650 % First we define our default input separator
1651 % \begin{macrocode}
1652 \def\tw@default@input@sep{,}
1653 % \end{macrocode}
1654 % \end{macro}
1655 % \begin{macro}{\CurrentMenuElement} and the |\CurrentMenuElement| dummy
1656 % \begin{macrocode}
1657 \def\CurrentMenuElement{}
1658 % \end{macrocode}
1659 % \end{macro}
1660 % \begin{macro}{\tw@define@menu@macro}
1661 % \changes{v1.6.1}{2020/12/19}{Handles default input separator.}
1662 % \begin{macro}{\tw@define@menu@macro@}
1663 % \changes{v1.1a}{2013/05/28}{Fixed minor bug, that causes a warning about robustifying (issue \#23),
1664 % by deleting the line to make the command robust.}
1665 % \changes{v1.2}{2013/07/23}{Replaced \cs{edef} by \cs{protected@edef}}
1666 % \changes{v1.2c}{2013/07/23}{Replaced \cs{protected@edef} by \cs{def}}
1667 % \changes{v1.2}{2013/07/23}{Added \cs{leavevmode}}
1668 % \changes{v1.6}{2020/10/27}{Don't use \cs{NewDocumentCommand}}
1669 % \changes{v1.6.1}{2020/12/19}{Renamed from \cs{tw@define@menu@macro}}
1670 % \changes{v1.6.1}{2020/12/19}{No x-type expansion on the separator to call the
1671 % loop}
1672 % Then we set up the internal command to create new menu macros.
1673 % The list parsing code was essentially provided by Ahmed Musa at
1674 % \url{https://tex.stackexchange.com/a/44989/4918}. Jonathan P.\@ Spratte
1675 % made some major changes to make \pkg{menukeys} work without \pkg{catoptions}
1676 % and reimplemented the parsing code using \LaTeX3. Thank you both very much!
1677 % \begin{macrocode}
1678 \begingroup
1679 \lccode`\,=1
1680 \lowercase{\endgroup
1681 \@ifdefinable\tw@mk@test@input@sep
1682 {%
1683 \protected\def\tw@mk@test@input@sep#1{%
1684 \tw@mk@xifinsetTF
1685 {,\tw@mk@trimspaces{#1},}{,bslash,backslash,directory,location,}%
1686 }%
1687 }%
1688 }
1689 \newcommand\tw@define@menu@macro[3]
1690 {%
1691 \IfNoValueTF{#3}
1692 {\tw@mk@exp@Nnno\tw@define@menu@macro@{#1}{#2}\tw@default@input@sep}
1693 {\tw@define@menu@macro@{#1}{#2}{#3}}%
1694 }
1695 \newcommand\tw@define@menu@macro@[4]
1696 {%
1697 \ifcsundef{tw@style@#4@sep}
1698 {%
1699 \tw@mk@error
1700 {%
1701 Can't define menu macro \string#2\space,\MessageBreak
1702 because the style '#4' is not available!%
1703 }%
1704 }
1705 {%
1706 \csdef{tw@parse@menu@list@\tw@mk@string#2}##1%
1707 {%
1708 \def\CurrentMenuElement{##1}%
1709 \tw@mk@iflastindris
1710 {%
1711 \ifnum\tw@mk@indrisnr=\@ne
1712 \@nameuse{tw@style@#4@single}%
1713 \else
1714 \@nameuse{tw@style@#4@sep}%
1715 \@nameuse{tw@style@#4@last}%
1716 \fi
1717 }
1718 {%
1719 \ifnum\tw@mk@indrisnr=\@ne
1720 \@nameuse{tw@style@#4@first}%
1721 \else
1722 \@nameuse{tw@style@#4@sep}%
1723 \@nameuse{tw@style@#4@mid}%
1724 \fi
1725 }%
1726 }%
1727 #1#2{+O{#3}+m}%
1728 {%
1729 \leavevmode
1730 \begingroup
1731 \def\tw@current@color@theme
1732 {\csname tw@style@#4@color@theme\endcsname}%
1733 \@nameuse{tw@style@#4@pre}%
1734 \tw@mk@test@input@sep{##1}
1735 {%
1736 \edef\tw@menu@list{\detokenize{##2}}%
1737 \edef\tw@mk@tempa{\@backslashchar}%
1738 }
1739 {%
1740 \edef\tw@menu@list{\unexpanded{##2}}%
1741 \edef\tw@mk@tempa{\tw@mk@trimspaces{##1}}%
1742 }%
1743 \begingroup
1744 \letcs{\tw@mk@tempb}{tw@parse@menu@list@\tw@mk@string#2}%
1745 \tw@mk@indrisloop\tw@mk@tempa\tw@menu@list\tw@mk@tempb
1746 \endgroup
1747 \@nameuse{tw@style@#4@post}%
1748 \endgroup
1749 }%
1750 }%
1751 }
1752 % \end{macrocode}
1753 % \end{macro}
1754 % \end{macro}
1755 % \subsubsection{User-level commands}
1756 % \begin{macro}{\newmenumacro}
1757 % \changes{v1.1a}{2013/05/28}{Added a line to make a new macro robust.}
1758 % \changes{v1.6}{2020/10/27}{use \cs{NewDocumentCommand}}
1759 % \changes{v1.6.1}{2020/12/19}{default handled by \cs{tw@define@menu@macro}}
1760 % \begin{macro}{\renewmenumacro}
1761 % \changes{v1.6}{2020/10/27}{use \cs{RenewDocumentCommand}}
1762 % \changes{v1.6.1}{2020/12/19}{default handled by \cs{tw@define@menu@macro}}
1763 % \begin{macro}{\providemenumacro}
1764 % \changes{v1.6}{2020/10/27}{use \cs{ProvideDocumentCommand}}
1765 % \changes{v1.6.1}{2020/12/19}{default handled by \cs{tw@define@menu@macro}}
1766 % Now it's time to build the user-level commands
1767 % \begin{macrocode}
1768 \NewDocumentCommand{\newmenumacro}{m o m}{%
1769 \ifcsundef{\tw@mk@string#1}{%
1770 \tw@define@menu@macro\NewDocumentCommand{#1}{#2}{#3}%
1771 }{%
1772 \tw@mk@error{Menu macro '\string#1' already defined!\MessageBreak
1773 Use \string\renewmenustyle\space instead.}%
1774 }%
1775 }
1776 \NewDocumentCommand{\renewmenumacro}{m o m}{%
1777 \tw@define@menu@macro\RenewDocumentCommand{#1}{#2}{#3}%
1778 }
1779 \NewDocumentCommand{\providemenumacro}{m o m}{%
1780 \ifcsundef{\tw@mk@string#1}{%
1781 \tw@define@menu@macro\ProvideDocumentCommand{#1}{#2}{#3}%
1782 }{%
1783 \tw@mk@warning{Menu macro '\string#1' already defined!\MessageBreak
1784 Use \string\renewmenustyle\space to redefine it.}%
1785 }%
1786 }
1787 % \end{macrocode}
1788 % \end{macro}\end{macro}\end{macro}
1789 %
1790 % \subsubsection{Predefined menu macros}
1791 % Now we got all tools to predefine some menu macros. To be sure that
1792 % these commands won't conflict with other packages we introduced the
1793 % option |definemacros|. Here we have to check it:
1794 % \begin{macrocode}
1795 \iftw@mk@definemenumacros
1796 % \end{macrocode}
1797 % \begin{macro}{\menu}\begin{macro}{\directory}%
1798 % \changes{v1.1}{2012/02/27}{Renamed \cmd{\path} to \cmd{\directory} because it
1799 % crashes with \pkg{biblatex}}
1800 % \begin{macro}{\keys}
1801 % And then we define three basic macros.
1802 % \begin{macrocode}
1803 \newmenumacro{\menu}[>]{menus}
1804 \newmenumacro{\directory}[/]{paths}
1805 \newmenumacro{\keys}[+]{roundedkeys}
1806 % \end{macrocode}
1807 % \end{macro}\end{macro}\end{macro}
1808 % Lastly we close the |definemacros| if statement:
1809 % \begin{macrocode}
1810 \fi
1811 % \end{macrocode}
1812 %
1813 % \subsection{Keys}
1814 % Before we define anything we check if the user allows it:
1815 % \begin{macrocode}
1816 \iftw@mk@definekeys
1817 % \end{macrocode}
1818 %
1819 % Before define the key macros we create some macros that save some typing by
1820 % condensing the similarities between the key macros.
1821 % \begin{macro}{\tw@make@key@box}
1822 % The first of these macros helps us building save boxes
1823 % to store the |{tikzpicture}|, that will draw the key later.
1824 % This is necessary because otherwise the picture will inherit
1825 % the style of the key sequence |node|.
1826 % \begin{macrocode}
1827 \NewDocumentCommand{\tw@make@key@box}{m m}{%
1828 % \expandafter\newbox\csname tw@mk@box@#1\endcsname
1829 % \expandafter\sbox\csname tw@mk@box@#1\endcsname{%
1830 % #2%
1831 % }%
1832 \csdef{tw@mk@#1}{%
1833 % \expandafter\usebox\csname tw@mk@box@#1\endcsname%
1834 #2%
1835 }%
1836 }
1837 % \end{macrocode}
1838 % \end{macro}
1839 % \begin{macro}{\tw@make@key@macro}
1840 % The next macro defines the user level command by accessing a
1841 % macro like |tw@mk@|\meta{key} or |tw@mk@|\meta{key}|@|\meta{os},
1842 % if the appearance differs between Mac and Windows.
1843 % To use this macro we assume that the |tw@mk@|\meta{key} commands
1844 % are defined.
1845 % \begin{macrocode}
1846 \NewDocumentCommand{\tw@make@key@macro}{s m}{%
1847 \IfBooleanTF{#1}{%
1848 \expandafter\providecommand\csname\tw@mk@string#2\endcsname{%
1849 \expandonce{\maxsizebox{!}{1.8ex}{%
1850 \@nameuse{tw@mk@\tw@mk@string#2@\tw@mk@os}}%
1851 }%
1852 }%
1853 \expandafter\providecommand\csname\tw@mk@string#2mac\endcsname{%
1854 \expandonce{\maxsizebox{!}{1.8ex}{%
1855 \@nameuse{tw@mk@\tw@mk@string#2@mac}}%
1856 }%
1857 }%
1858 \expandafter\providecommand\csname\tw@mk@string#2win\endcsname{%
1859 \expandonce{\maxsizebox{!}{1.8ex}{%
1860 \@nameuse{tw@mk@\tw@mk@string#2@win}}%
1861 }%
1862 }%
1863 }{%
1864 \expandafter\providecommand\csname\tw@mk@string#2\endcsname{%
1865 \expandonce{\maxsizebox{!}{1.8ex}{%
1866 \@nameuse{tw@mk@\tw@mk@string#2}}%
1867 }%
1868 }%
1869 }%
1870 }
1871 % \end{macrocode}
1872 % \end{macro}
1873 % \begin{macro}{\tw@define@mackey}
1874 % The last helping macro is |\tw@define@mackey|. We use it to execute
1875 % code depending on the |mackeys| option.
1876 % \begin{macrocode}
1877 \newcommand*{\tw@define@mackey}[2]{%
1878 \IfStrEq{text}{\tw@mk@mackeys}{#1}{%
1879 \IfStrEq{symbols}{\tw@mk@mackeys}{#2}{}%
1880 }%
1881 }
1882 % \end{macrocode}
1883 % \end{macro}
1884 %
1885 % Next thing to do is to set up some \TikZ-styles.
1886 % \begin{macrocode}
1887 \tikzset{
1888 menukeys key symbol/.style={
1889 rounded corners=0pt,
1890 line width=0.1ex,
1891 baseline={(0,0)},
1892 },
1893 menukeys thick/.style={line width=0.25ex},
1894 }
1895 % \end{macrocode}
1896 %
1897 % Now we ar prepared to generate the key macros. I will be nearly the same
1898 % way for all keys. Step one is to build a |tw@mk@|\meta{key} macro
1899 % and then we define the user-level command |\|\meta{key}
1900 % \begin{macro}{\shift}
1901 % \begin{macrocode}
1902 \normalsize
1903 \tw@make@key@box{shift}{%
1904 \begin{tikzpicture}[yshift=-0.1ex,menukeys key symbol]
1905 \draw (0.3ex,0) -- (1.1ex,0) -- (1.1ex,1.2ex) -- %
1906 (1.5ex,1.2ex) -- (0.7ex,1.9ex) -- (-0.1ex,1.2ex) -- %
1907 (0.3ex,1.2ex) -- cycle;
1908 \end{tikzpicture}%
1909 }
1910 \tw@make@key@macro{\shift}
1911 % \end{macrocode}
1912 % \end{macro}
1913 % It's a little more complicated if the appearance should differ depending on the
1914 % OS: The first step again is to define |tw@mk@|\meta{key}|@mac| and
1915 % |tw@mk@|\meta{key}|@win|. And then use the starred version
1916 % |\tw@make@key@macro*| which creates |\|\meta{key} that depends on the |os|
1917 % option, |\|\meta{key}|mac| and |\|\meta{key}|win|, that are not affected by
1918 % |os|.
1919 % \begin{macro}{\capslock}
1920 % \begin{macrocode}
1921 \tw@make@key@box{capslock@mac}{%
1922 \begin{tikzpicture}[yshift=-0.1ex,menukeys key symbol]
1923 \draw (0.3ex,0.7ex) -- (1.1ex,0.7ex) -- (1.1ex,1.2ex) -- %
1924 (1.5ex,1.2ex) -- (0.7ex,1.9ex) -- (-0.1ex,1.2ex) -- %
1925 (0.3ex,1.2ex) -- cycle;
1926 \draw (0.3ex,0) rectangle (1.1ex,0.4ex);
1927 \end{tikzpicture}%
1928 }
1929 \tw@make@key@box{capslock@win}{%
1930 \begin{tikzpicture}[yscale=-1,yshift=-1.8ex,menukeys key symbol]
1931 \draw (0.3ex,0) -- (1.1ex,0) -- (1.1ex,1.2ex) -- %
1932 (1.5ex,1.2ex) -- (0.7ex,1.9ex) -- (-0.1ex,1.2ex) -- %
1933 (0.3ex,1.2ex) -- cycle;
1934 \end{tikzpicture}%
1935 }
1936 \tw@make@key@macro*{\capslock}
1937 % \end{macrocode}
1938 % \end{macro}
1939 % Here are the other macros:
1940 % \begin{macro}{\tab}
1941 % \begin{macrocode}
1942 \tw@make@key@box{tab@mac}{%
1943 \begin{tikzpicture}[yshift=0.6ex,menukeys key symbol]
1944 \draw [->] (0,0) -- (1em,0);
1945 \draw (1em,-0.35ex) -- (1em,0.35ex);
1946 \end{tikzpicture}%
1947 }
1948 \tw@make@key@box{tab@win}{%
1949 \begin{tikzpicture}[yshift=0.1ex,menukeys key symbol]
1950 \draw [->] (0.2em,0) -- (1.2em,0);
1951 \draw (1.2em,-0.35ex) -- (1.2em,0.35ex);
1952 \draw [<-] (0,1ex) -- (1em,1ex);
1953 \draw (0,0.65ex) -- (0,1.35ex);
1954 \end{tikzpicture}%
1955 }
1956 \tw@make@key@macro*{\tab}
1957 % \end{macrocode}
1958 % \end{macro}
1959 % \begin{macro}{\esc}\begin{macro}{\oldesc}
1960 % \changes{v1.4}{2016/04/17}{Fixed direction of \cs{escmac}; added \cs{oldesc}}
1961 % \begin{macrocode}
1962 \def\tw@mk@esc@win{Esc}
1963 \tw@define@mackey{%
1964 \def\tw@mk@esc@mac{esc}
1965 }{%
1966 \tw@make@key@box{esc@mac}{%
1967 \begin{tikzpicture}[yshift=-0.1ex,menukeys key symbol]
1968 \draw [->] (0.5ex,0.5ex) -- ++(135:1.1ex);
1969 \draw (0.5ex,0.5ex) ++(105:0.6ex) arc (105:-195:0.6ex);
1970 \end{tikzpicture}%
1971 }%
1972 }
1973 \tw@make@key@macro*{\esc}
1974 \def\tw@mk@oldesc@win{Esc}
1975 \tw@define@mackey{%
1976 \def\tw@mk@oldesc@mac{esc}
1977 }{%
1978 \tw@make@key@box{oldesc@mac}{%
1979 \begin{tikzpicture}[yshift=-0.1ex,menukeys key symbol]
1980 \draw [->] (0.5ex,0.5ex) -- ++(45:1.1ex);
1981 \draw (0.5ex,0.5ex) ++(15:0.6ex) arc (15:-285:0.6ex);
1982 \end{tikzpicture}%
1983 }%
1984 }
1985 \tw@make@key@macro*{\oldesc}
1986 % \end{macrocode}
1987 % \end{macro}\end{macro}
1988 % \begin{macro}{\ctrl}
1989 % \begin{macrocode}
1990 \providecommand\ctrlname{Ctrl}
1991 \def\tw@mk@ctrl@win{\ctrlname}
1992 \def\tw@mk@ctrl@mac{ctrl}
1993 \tw@make@key@macro*{\ctrl}
1994 % \end{macrocode}
1995 % \end{macro}
1996 % \begin{macro}{\Alt}
1997 % \begin{macro}{\AltGr}
1998 % \begin{macrocode}
1999 \def\tw@mk@Alt@win{Alt}
2000 \tw@define@mackey{%
2001 \def\tw@mk@Alt@mac{alt}%
2002 }{%
2003 \tw@make@key@box{Alt@mac}{%
2004 \begin{tikzpicture}[yshift=-0.1ex,menukeys key symbol]
2005 \draw (0,1ex) -- (0.5ex,1ex) -- (1ex,0.3ex) -- (1.8ex,0.3ex);
2006 \draw (0.8ex,1ex) -- (1.8ex,1ex);
2007 \end{tikzpicture}%
2008 }%
2009 }
2010 \tw@make@key@macro*{\Alt}
2011 \providecommand*{\AltGr}{Alt\,Gr}
2012 % \end{macrocode}
2013 % \end{macro}\end{macro}
2014 % \begin{macro}{\cmd}
2015 % \begin{macrocode}
2016 \def\tw@mk@cmd@win{%
2017 \tw@mk@warning{'\string\cmd' only for Mac!}%
2018 }
2019 \tw@define@mackey{%
2020 \def\tw@mk@cmd@mac{cmd}%
2021 }{%
2022 \tw@make@key@box{cmd@mac}{%
2023 \begin{tikzpicture}[yshift=-0.15ex,menukeys key symbol]
2024 \draw (0.5ex,0.7ex) -- (0.5ex,1.25ex) arc (0:270:0.25ex) -- %
2025 (1.25ex,1ex) arc (-90:180:0.25ex) -- (1ex,0.25ex) %
2026 arc (-180:90:0.25ex) -- (0.25ex,0.5ex) arc (90:360:0.25ex) %
2027 -- cycle;
2028 \end{tikzpicture}%
2029 }%
2030 }
2031 \tw@make@key@macro*{\cmd}
2032 % \end{macrocode}
2033 % \end{macro}
2034 % \begin{macro}{\Space}\begin{macro}{\SPACE}
2035 % \begin{macrocode}
2036 \providecommand*{\Space}{\expandonce{\rule{3em}{0pt}}}
2037 \newcommand{\spacename}{Space}
2038 \providecommand*{\SPACE}{\expandonce{\rule{2em}{0pt}\spacename\rule{2em}{0pt}}}
2039 % \end{macrocode}
2040 % \end{macro}\end{macro}
2041 % \begin{macro}{\return}
2042 % \begin{macrocode}
2043 \tw@make@key@box{return@mac}{%
2044 \begin{tikzpicture}[yshift=0.25ex,menukeys key symbol]
2045 \draw [->, rounded corners=0.2ex] (1.25ex,1ex) -| %
2046 (2ex,0) -- (0,0);
2047 \end{tikzpicture}%
2048 }
2049 \tw@make@key@box{return@win}{%
2050 \begin{tikzpicture}[menukeys key symbol]
2051 \draw [->] (1ex,1.25ex) |- (0,0);
2052 \end{tikzpicture}%
2053 }
2054 \tw@make@key@macro*{\return}
2055 % \end{macrocode}
2056 % \end{macro}
2057 % \begin{macro}{\enter}
2058 % \begin{macrocode}
2059 \def\tw@mk@enter@win{Enter}
2060 \tw@make@key@box{enter@mac}{%
2061 \begin{tikzpicture}[menukeys key symbol]
2062 \draw (0,0) -- (0.5ex,0.5ex) -- (1ex,0);
2063 \draw (0,0.55ex) -- (1ex,0.55ex);
2064 \end{tikzpicture}%
2065 }
2066 \tw@make@key@macro*{\enter}
2067 % \end{macrocode}
2068 % \end{macro}
2069 % \begin{macro}{\winmenu}
2070 % \begin{macrocode}
2071 \def\tw@mk@winmenu@mac{%
2072 \tw@mk@warning{'\string\winmenu' only for Windows!}%
2073 }
2074 \tw@make@key@box{winmenu@win}{%
2075 \begin{tikzpicture}[yshift=-0.2ex,menukeys key symbol]
2076 \draw (0,0) rectangle (1.5ex,1.8ex);
2077 \draw (0.25ex,1.4ex) -- ++(1ex,0);
2078 \draw (0.25ex,1ex) -- ++(1ex,0);
2079 \draw (0.25ex,0.6ex) -- ++(1ex,0);
2080 \end{tikzpicture}%
2081 }
2082 \tw@make@key@macro*{\winmenu}
2083 % \end{macrocode}
2084 % \end{macro}
2085 % \begin{macro}{\backspace}
2086 % \begin{macrocode}
2087 \tw@make@key@box{backspace}{%
2088 \begin{tikzpicture}[yshift=0.65ex,menukeys key symbol]
2089 \draw [<-,menukeys thick] (0,0) -- (1.35em,0);
2090 \end{tikzpicture}%
2091 }
2092 \tw@make@key@macro{\backspace}
2093 % \end{macrocode}
2094 % \end{macro}
2095 % \begin{macro}{\del}\begin{macro}{\backdel}
2096 % \changes{v1.4}{2016/04/17}{Added \cs{backdel}}
2097 % \begin{macrocode}
2098 \providecommand{\delname}{Del.}
2099 \def\tw@mk@del@win{\delname}
2100 \tw@define@mackey{%
2101 \def\tw@mk@del@mac{\delname}%
2102 }{%
2103 \tw@make@key@box{del@mac}{%
2104 \begin{tikzpicture}[yshift=0.2ex,menukeys key symbol]
2105 \draw (0,0) -- (1.5ex,0) -- (2ex,0.5ex) --%
2106 (1.5ex,1ex) -- (0,1ex) -- cycle;
2107 \draw (0.5ex,0.2ex) -- (1.1ex,0.8ex);
2108 \draw (0.5ex,0.8ex) -- (1.1ex,0.2ex);
2109 \end{tikzpicture}%
2110 }%
2111 }
2112 \tw@make@key@macro*{\del}
2113 \def\tw@mk@backdel@win{\delname}
2114 \tw@define@mackey{%
2115 \def\tw@mk@backdel@mac{\delname}%
2116 }{%
2117 \tw@make@key@box{backdel@mac}{%
2118 \begin{tikzpicture}[yshift=0.2ex,menukeys key symbol]
2119 \draw (2ex,0) -- (0.5ex,0) -- (0,0.5ex) --%
2120 (0.5ex,1ex) -- (2ex,1ex) -- cycle;
2121 \draw (1ex,0.2ex) -- (1.6ex,0.8ex);
2122 \draw (1ex,0.8ex) -- (1.6ex,0.2ex);
2123 \end{tikzpicture}%
2124 }%
2125 }
2126 \tw@make@key@macro*{\backdel}
2127 % \end{macrocode}
2128 % \end{macro}\end{macro}
2129 %
2130 % \begin{macro}{\arrowkeyup}\begin{macro}{\arrowkeydown}
2131 % \begin{macro}{\arrowkeyleft}\begin{macro}{\arrowkeyright}
2132 % Lastly we define the arrow macros:
2133 % \begin{macrocode}
2134 \tw@make@key@box{arrowkeyup}{%
2135 \begin{tikzpicture}[yshift=-0.2ex,menukeys key symbol]
2136 \draw [->] (0,0) -- (0,0.8em);
2137 \end{tikzpicture}%
2138 }
2139 \tw@make@key@macro{\arrowkeyup}
2140
2141 \tw@make@key@box{arrowkeydown}{%
2142 \begin{tikzpicture}[yshift=0.7em,menukeys key symbol]
2143 \draw [->] (0,0) -- (0,-0.8em);
2144 \end{tikzpicture}%
2145 }
2146 \tw@make@key@macro{\arrowkeydown}
2147
2148 \tw@make@key@box{arrowkeyright}{%
2149 \begin{tikzpicture}[yshift=0.5ex,menukeys key symbol]
2150 \draw [->] (0,0) -- (0.8em,0);
2151 \end{tikzpicture}%
2152 }
2153 \tw@make@key@macro{\arrowkeyright}
2154
2155 \tw@make@key@box{arrowkeyleft}{%
2156 \begin{tikzpicture}[yshift=0.5ex,menukeys key symbol]
2157 \draw [->] (0,0) -- (-0.8em,0);
2158 \end{tikzpicture}%
2159 }
2160 \tw@make@key@macro{\arrowkeyleft}
2161 % \end{macrocode}
2162 % \end{macro}\end{macro}\end{macro}\end{macro}
2163 % \begin{macro}{\arrowkey}
2164 % And the |\arrowkey| macro that get's it's direction as argument.
2165 % \begin{macrocode}
2166 \newcommand{\arrowkey}[1]{%
2167 \IfStrEq{^}{#1}{\arrowkeyup}{%
2168 \IfStrEq{v}{#1}{\arrowkeydown}{%
2169 \IfStrEq{<}{#1}{\arrowkeyleft}{%
2170 \IfStrEq{>}{#1}{\arrowkeyright}{%
2171 \tw@mk@error{Wrong value '#1' for \string\arrowkey\MessageBreak
2172 Possible values are '^', 'v', '<' or '>'}%
2173 }%
2174 }%
2175 }%
2176 }%
2177 }
2178 % \end{macrocode}
2179 % \end{macro}
2180 % Close the |\iftw@mk@definekeys|
2181 % \begin{macrocode}
2182 \fi
2183 % \end{macrocode}
2184 %
2185 % \begin{macrocode}
2186 %</pkg>
2187 % \end{macrocode}
2188 %
2189 % \Finale
2190 \endinput