diff options
author | Karl Berry <karl@freefriends.org> | 2016-04-18 21:51:12 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-04-18 21:51:12 +0000 |
commit | 64cac8b0408d6a7e0700efdd53dee0414f6c8bcb (patch) | |
tree | 185880e2359785cc00ed00672c8bd50a650abc4d /Master/texmf-dist/source/latex/menukeys | |
parent | 55b4e991da3e70208862ba32c31d2c7822541d28 (diff) |
menukeys (18apr16)
git-svn-id: svn://tug.org/texlive/trunk@40599 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/menukeys')
-rw-r--r-- | Master/texmf-dist/source/latex/menukeys/menukeys.dtx | 563 |
1 files changed, 345 insertions, 218 deletions
diff --git a/Master/texmf-dist/source/latex/menukeys/menukeys.dtx b/Master/texmf-dist/source/latex/menukeys/menukeys.dtx index abe7102d6d7..b30432b35b7 100644 --- a/Master/texmf-dist/source/latex/menukeys/menukeys.dtx +++ b/Master/texmf-dist/source/latex/menukeys/menukeys.dtx @@ -18,7 +18,7 @@ % \iffalse %<package>\NeedsTeXFormat{LaTeX2e}[2009/01/01] %<package>\ProvidesPackage{menukeys} -%<package> [2014/03/10 v1.3 a package to format menus paths and shortcuts] +%<package> [2016/04/18 v1.4 -- A package to format menus, paths and shortcuts] % %<*driver> \documentclass{ltxdoc} @@ -58,39 +58,56 @@ \newcommand*{\fnt}[1]{\texttt{#1}} \newcommand*{\opt}[1]{\texttt{#1}} \newcommand{\DO}[1]{% -\marginpar{\raggedleft\texttt{#1} \footnotesize(opt.)}% -\index{#1=\texttt{#1} (option)|usage}% -\index{Options:>\texttt{#1}|usage}% + \marginpar{\raggedleft\texttt{#1} \footnotesize(opt.)}% + \index{#1=\texttt{#1} (option)|usage}% + \index{Options:>\texttt{#1}|usage}% + \ignorespaces } -\newcommand{\DM}[1]{\DescribeMacro{#1}} -\newcommand{\DE}[1]{\DescribeEnv{#1}} +\newcommand{\DM}[1]{\DescribeMacro{#1}\ignorespaces} +\newcommand{\DE}[1]{\DescribeEnv{#1}\ignorespaces} \newcommand{\AST}{\meta{\texttt{*}}} \newcommand{\minisec}[1]{\par\medskip\noindent{\sffamily\bfseries#1}\quad} \newcommand{\example}{\minisec{Example}\xspace} \providemenumacro{\test}{roundedmenus} -\newcommand{\teststyle}[2]{{% - \renewmenumacro{\test}{#1}% - \par\vspace{\baselineskip} - \noindent\begin{minipage}{\textwidth} - Name: \texttt{#1}\index{#1=\texttt{#1} (style)|usage}% - \index{Styles:>\texttt{#1}|usage}\\[0.5\baselineskip] - \test{#2}\hfill\test{Single}\\[0.5\baselineskip] +\NewDocumentCommand{\teststyle}{ o m m m }{{% + \renewmenumacro{\test}{#2}% + \par\vspace{1.5\baselineskip plus 0.5\baselineskip minus 0.25\baselineskip} + \noindent + \fbox{\begin{minipage}{0.97\textwidth} + Name: \texttt{#2} + \index{#2=\texttt{#2} (style)|usage}% + \index{Styles:>\texttt{#2}|usage} + \par\vspace{0.5\baselineskip}% + \test{#3} + \par\vspace{0.5\baselineskip}% + \test{#4}% + \par\vspace{0.5\baselineskip}% This is some more or less blind text, to demonstrate how - the sequence looks in text. This is way \test{#2} the - style which name is \texttt{#1} prints the list. - \end{minipage} + the sequence looks in text. This \test{#3} is the result + of a style which name is \texttt{#2}. And again some + blind text without any sense.% + \IfValueT{#1}{{% + \par\vspace{0.5\baselineskip}% + \itshape\footnotesize#1\par + }}% + \end{minipage}}% }} \makeatletter -\newcommand{\colortest}[1]{% - \par\vspace{\baselineskip} +\newcommand{\colortest}[1]{{% + \par\vspace{\baselineskip}% + \setlength{\fboxsep}{0pt}% \noindent Name: \texttt{#1}\index{#1=\texttt{#1} (theme)|usage}% - \index{Color themes:>\texttt{#1}|usage}%\\[0.5\baselineskip] - \qquad\colorbox{tw@color@theme@#1@bg}{\strut Background}\qquad - \fcolorbox{tw@color@theme@#1@br}{white}{\strut Border \rule{1ex}{1ex}}\qquad - \textcolor{tw@color@theme@#1@txt}{\strut Text \rule{1ex}{1ex}} -} + \index{Color themes:>\texttt{#1}|usage} + \\[0.5\baselineskip] + Background: \fbox{\textcolor{tw@color@theme@#1@bg}{\rule[-0.4ex]{2.2ex}{2.2ex}}} + \quad Border: \fbox{\textcolor{tw@color@theme@#1@br}{\rule[-0.4ex]{2.2ex}{2.2ex}}} + \quad Text: \fbox{\textcolor{tw@color@theme@#1@txt}{\rule[-0.4ex]{2.2ex}{2.2ex}}} + \quad (A: \fbox{\textcolor{tw@color@theme@#1@a}{\rule[-0.4ex]{2.2ex}{2.2ex}}} + \quad B: \fbox{\textcolor{tw@color@theme@#1@b}{\rule[-0.4ex]{2.2ex}{2.2ex}}} + \quad C: \fbox{\textcolor{tw@color@theme@#1@c}{\rule[-0.4ex]{2.2ex}{2.2ex}}}\kern2pt) +}} \makeatother \MakeShortVerb{\|} @@ -178,8 +195,6 @@ %</driver> % \fi % -% \CheckSum{890} -% % \CharacterTable % {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 % 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 @@ -205,9 +220,12 @@ % the \texttt{ex} unit available} % \changes{v1.2a}{2013/09/10}{Replaced obsolete \cs{tikzsytle}} % \changes{v1.2a}{2013/09/10}{Added braces to the \cs{tikz} macro since the parser -% seems to crash with \pkg{babels} french option otherwise.} +% seems to crash with \pkg{babel}'s french option otherwise.} % \changes{v1.3}{2014/03/10}{Improved key symbols.} % \changes{v1.3}{2014/03/10}{Added \TikZ-styles for the key symbols.} +% \changes{v1.4}{2016/04/17}{The \texttt{path...} styles now use the text color +% of the selected color theme (fix issue \#16).} +% \changes{v1.4}{2016/04/18}{Extended color theme features.} % % \GetFileInfo{menukeys.sty} % @@ -275,8 +293,8 @@ % % \title{\Huge\MENU[,]{M,E,N,U,K,E,Y,S}} % \author{Tobias Weh\\ -% \normalsize\href{mailto:mail@tweh.de}{\texttt{mail@tweh.de}}\\ -% \normalsize\url{http://www.tobias-weh.de}\\ +% \normalsize\href{mailto:mail@tobiw.de}{\texttt{mail@tobiw.de}}\\ +% \normalsize\url{http://tobiw.de/en}\\ % \normalsize\url{http://github.com/tweh/menukeys}\\ % \normalsize\url{http://www.ctan.org/pkg/menukeys}\\ % \normalsize\filefolder{macros/latex/contrib/menukeys}} @@ -288,7 +306,7 @@ % \noindent % This package is build to format menu sequences, paths and keystrokes. % \par\medskip\noindent -% You're welcome to send me feedback, questions, bug reports and feature request. +% You're welcome to send me feedback, questions, bug reports and feature requests. % If you like to support this package -- especially improving or proofreading the % manual -- send me an e-mail, please. % \par\bigskip\noindent @@ -302,13 +320,13 @@ % The \menukeys package is mainly designed to parse and print % sequences of software menus, folders and files or keystrokes. % The most predefined styles use the power of \TikZ\footnote{See -% \url{http://www.ctan.org/pkg/pgf}.} to format the output +% \url{http://www.ctan.org/pkg/pgf}.} to format the output. % % For example if you want to tell the reader of a manual how to set the ruler % unit you may type % \begin{verbatim} % To set the unit of the rulers go to \menu{Extras > Settings > Rulers} -% and choose between millimetres, inches and pixels. The short cut +% and choose between millimeters, inches and pixels. The shortcut % to view the rulers is \keys{cmd + R}. Pressing these keys again % will hide the rulers. % @@ -320,7 +338,7 @@ % % \medskip % To set the unit of the rulers go to \menu{Extras > Settings > Rulers} -% and choose between millimetres, inches and pixels. The short cut +% and choose between millimeters, inches and pixels. The shortcut % to view the rulers is \keys{cmd + R}. Pressing these keys again % will hide the rulers. % @@ -350,15 +368,20 @@ % pdflatex menukeys.dtx % \end{verbatim} % -% \section{Package options}\label{options} +% \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} +% (even after \pkg{hyperref}\footnote{See \url{http://tex.stackexchange.com/q/237683/4918} +% and \url{https://github.com/tweh/menukeys/issues/41}.})! +% % These are the possible options: % \begin{description} % \item [definemenumacros:] Most of \menukeys' macros should not % conflict with other packages\footnote{If you find a conflict send an e-mail.} -% but the predefined menu macros should be short and easy to read +% but the predefined menu macros should be short and easy-to-read % commands, which means that |\menu{A,B,C}| is preferred against -% |\printmenusequence{A,B,C}|. For that it's not unlikely that these -% conflict with other packages. To prevent this you cant tell +% |\printmenusequence{A,B,C}|. For that it's not unlikely that they +% conflict with other packages. To prevent this you can tell % \menukeys to not define them by calling the option \DO{definemenumacros} % |definemenumacros=false|. The default value is |true|. % @@ -366,11 +389,11 @@ % for details. % \item [definekeys:] Equal to |definemenumacros| \DO{definekeys} for the key macros. % The default value is |true|. -% \item [mackeys:] This option \DO{mackeys} allows you to decide wether the mac keys +% \item [mackeys:] This option \DO{mackeys} allows you to decide whether the mac keys % are shown as text (|mackeys=text|) or symbols (|mackeys=symbols|). The default -% value is |symbols| +% 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 different. The default value is |mac|. +% some key macros to be rendered differently. The default value is |mac|. % \end{description} % % \section{Usage} @@ -388,7 +411,7 @@ % % The possible input separators are |/|, |=|, |*|, |+|, |,|, |;|, |:|, |-|, |>|, % |<| and |bslash| (to use |\| as separator). You can hide a separator from the -% parser by putting a part of the sequence in braces. Spaces around the seperator +% parser by putting a part of the sequence in braces. Spaces around the separator % will be ignored, i.e. |\keys{\ctrl+C}| equals |\keys{\ctrl + C}|. % \example |\menu[,]{Extras,Settings,{Units, rulers and origin}}| gives % \menu[,]{Extras,Settings,{Units, rulers and origin}} @@ -399,31 +422,64 @@ % created by the user. % \subsubsection{Predefined styles} % -% \teststyle{menus}{File,Extras,Preferences} -% \teststyle{roundedmenus}{File,Extras,Preferences} -% \teststyle{angularmenus}{File,Extras,Preferences} -% \teststyle{roundedkeys}{Ctrl,Alt,Q} -% \teststyle{shadowedroundedkeys}{Ctrl,Alt,Q} -% \teststyle{angularkeys}{Ctrl,Alt,Q} -% \teststyle{shadowedangularkeys}{Ctrl,Alt,Q} -% \teststyle{typewriterkeys}{Alt,Q} -% \teststyle{paths}{C:,User,Folder,MyFile.tex} -% \teststyle{pathswithfolder}{C:,User,Folder,MyFile.tex} -% \teststyle{pathswithblackfolder}{C:,User,Folder,MyFile.tex} +% \teststyle{menus}{File,Extras,Preferences}{Menu} +% \teststyle{roundedmenus}{File,Extras,Preferences}{Menu} +% \teststyle{angularmenus}{File,Extras,Preferences}{Menu} +% \teststyle[The color of + is taken from optional color B.] +% {roundedkeys}{Ctrl,Alt,Q}{S} +% \teststyle[The color of + is taken from optional color B.\\ +% The shadow color is taken from optional color C.] +% {shadowedroundedkeys}{Ctrl,Alt,Q}{S} +% \teststyle[The color of + is taken from optional color B.] +% {angularkeys}{Ctrl,Alt,Q}{S} +% \teststyle[The color of + is taken from optional color B.\\ +% The shadow color is taken from optional color C.] +% {shadowedangularkeys}{Ctrl,Alt,Q}{S} +% \teststyle[The color of + is taken from optional color B.] +% {typewriterkeys}{Alt,Q}{S} +% \teststyle[The sep color is taken from optional color C.] +% {paths}{C:,User,Folder,MyFile.tex}{MyFile.tex} +% \teststyle[% +% The folder draw color is taken from optional color B.\\ +% The folder fill color is taken from optional color A.\\ +% The sep color is taken from optional color C.% +% ] +% {pathswithfolder}{C:,User,Folder,MyFile.tex}{MyFile.tex} +% \teststyle[% +% The folder draw color is taken from optional color B.\\ +% The folder fill color is taken from optional color C.\\ +% The sep color is taken from optional color C.% +% ] +% {pathswithblackfolder}{C:,User,Folder,MyFile.tex}{MyFile.tex} % -% \bigskip -% The following three styles allow paths elements to be hyphened, but +% \bigskip\noindent +% The following three styles allow paths elements to be hyphenated, but % they insert only a line break without a hyphen dash. Note that they only -% work with |T1| and |OT1| encoding, at least I tested only these ones. -% \teststyle{hyphenatepaths}{C:,Database,User,ALongUserNameHere,% -% ALongerFolderNameAtThisPlace,MyFile.tex} -% \teststyle{hyphenatepathswithfolder}{C:,Database,User,ALongUserNameHere,% -% ALongerFolderNameAtThisPlace,MyFile.tex} -% \teststyle{hyphenatepathswithblackfolder}{C:,Database,User,ALongUserNameHere,% -% ALongerFolderNameAtThisPlace,MyFile.tex} +% work with |T1| and |OT1| encoding (at least I tested only these ones) +% and that this in some cases doesn't work very well. +% \teststyle[The sep color is taken from optional color C.] +% {hyphenatepaths}{C:,Database,User,ALongUserNameHere,% +% ALongerFolderNameAtThisPlace,MyFile.tex}{MyFile.tex} +% \teststyle[% +% The folder draw color is taken from optional color B.\\ +% The folder fill color is taken from optional color A.\\ +% The sep color is taken from optional color C.% +% ] +% {hyphenatepathswithfolder}{C:,Database,User,ALongUserNameHere,% +% ALongerFolderNameAtThisPlace,MyFile.tex}{MyFile.tex} +% \teststyle[% +% The folder draw color is taken from optional color B.\\ +% The folder fill color is taken from optional color C.\\ +% The sep color is taken from optional color C.% +% ] +% {hyphenatepathswithblackfolder}{C:,Database,User,ALongUserNameHere,% +% ALongerFolderNameAtThisPlace,MyFile.tex}{MyFile.tex} % +% \bigskip\pagebreak % \minisec{Hint} The folder is drawn with the command \DM{\drawtikzfolder} -% |\drawtikzfolder|\oarg{frontcolor} which is part of \menukeys. +% |\drawtikzfolder| which is part of \menukeys and has two optional arguments +% to change the color of the lines and the fill color of the front:\\ +% |\drawtikzfolder|\oarg{front fill}\oarg{draw} % % \subsubsection{Declaring styles} % The simplest way to define a new style is to use \DM{\newmenustylesimple} @@ -441,8 +497,8 @@ % \item [post] is the code which is executed after a menu macro. % \item [theme] is a color theme (see section~\ref{colors}). % \end{description} -% \example Let us consider we want a list that prints a frame around it's -% elements and seperates them by a star. We can use +% \example Let us consider we want a list that prints a frame around its +% elements and separates them by a star. We can use % \begin{verbatim} % \newmenustylesimple{mystyle}{draw}[$\ast$]{mycolors} % \end{verbatim} @@ -460,11 +516,11 @@ % \item [sep] is the code executed between the lists elements, e.g. some % space or a symbol. % \item [mid] is the style for all elements between the first and the -% last one. It has to be a \TikZ-sytle. +% last one. It has to be a \TikZ sytle. % \item [last] is the style for the last list element. -% It has to be a \TikZ-sytle. +% It has to be a \TikZ sytle. % \item [single] this style is used if the list contains only one element. -% It has to be a \TikZ-sytle. +% It has to be a \TikZ sytle. % \item [post] is the code which is executed after a menu macro. % \item [theme] is a color theme (see section~\ref{colors}). % \end{description} @@ -476,7 +532,7 @@ % {draw}{draw,red}{draw,dashed}[$\bullet$] % \end{verbatim} % -% If the \TikZ |node| system doesn't fit you needs there are the \textbf{starred versions}: +% If the \TikZ |node| system doesn't fit your needs there are the \textbf{starred versions}: % Use them and the arguments \meta{first}, % \meta{mid}, \meta{last}, \meta{single} can be any \LaTeX{} code. To access the % current list element use \DM{\CurrentMenuElement}|\CurrentMenuElement|. @@ -492,7 +548,7 @@ % section~\ref{colors} for details about possible elements). % % \subsubsection{Copying styles} -% To copy an existing style to a new style us \DM{\copymenustyle}|\copymenustyle|% +% To copy an existing style to a new style use \DM{\copymenustyle}|\copymenustyle|% % \marg{copy}\marg{original}. % \example To copy the definition of |mystyle| to |mycopy| use % \begin{verbatim} @@ -504,7 +560,7 @@ % an existing style. For the first case there is \DM{\changemenuelement} % |\changemenuelement|\AST\marg{name} \marg{element}\marg{definition}, where the starred % version works like the one of |\newmenustyle| does. -% \example to change the single element of |mystyle| frome dashed to solid use the +% \example To change the single element of |mystyle| from dashed to solid use the % following code. You may save the original style by copying it as described above. % \begin{verbatim} % \changemenuelement{mystyle}{single}{draw} @@ -517,22 +573,24 @@ % \end{verbatim} % % \DM{\renewmenustylesimple}\DM{\providemenustylesimple}\DM{\renewmenustyle}% -% \DM{\providemenustyle} The next level is redefing a style. This package provides +% \DM{\providemenustyle} The next level is redefining a style. This package provides % the following macros the work like their \LaTeX-paragons and have the same % arguments as the above described macros: |\renewmenustylesimple|, % |\providemenustylesimple|, |\renewmenustyle| and |\providemenustyle|. % % \subsection{Color themes}\label{colors}% -% To make the colors of a style became changeable without +% To make the colors of a style become changeable without % touching the style itself, \menukeys uses ``color themes''. Every color theme % must contain three color definitions that can be used to draw a |node| -% background, a |node| frame and a text color. +% background, a |node| frame and a text color, and additionally two optional +% colors used by some themes. % \subsubsection{Predefined themes} % There are two predefined color themes % \colortest{gray}\colortest{blacknwhite} % \subsubsection{Create a theme} % \DM{\newmenucolortheme}To create a new theme use |\newmenucolortheme|. It uses the -% following five arguments: |\newmenucolortheme|\marg{name}\marg{model}\marg{bg}\marg{br}\marg{txt} +% following arguments:\\ +% |\newmenucolortheme|\marg{name}\marg{model}\marg{bg}\marg{br}\marg{txt}\oarg{a}\oarg{b}\oarg{c} % \begin{description} % \item [name] is the name of the theme and must contain only letters. % \item [model] is the \pkg{xcolor} color model which is used to define a color, e.g. @@ -540,6 +598,9 @@ % \item [bg] is the color definition for the |node| background. % \item [br] is the color definition for the |node| border. % \item [txt] is the color definition for the |node|'s text. +% \item [a] is an optional additional color (by default same as bg). +% \item [b] is an optional additional color (by default same as br). +% \item [c] is an optional additional color (by default same as txt). % \end{description} % \example To create a theme called |mycolors| we can say % \begin{verbatim} @@ -565,7 +626,7 @@ % It works with the same arguments as |\newmenucolortheme|. % % \subsection{Menu macros}\label{menumacros}% -% The ``menu marcos'' take a list seperated by a special symbol to +% The ``menu marcos'' take a list separated by a special symbol to % print it with a menu style. % \subsubsection{Predefined menu macros} % See section~\ref{basics}. @@ -574,7 +635,7 @@ % \oarg{input sep}\marg{style}. % \begin{description} % \item [name] is a \LaTeX{} control sequence name. -% \item [input sep] is the default seperator used in the input list +% \item [input sep] is the default separator used in the input list % (see section~\ref{basics} for a list of valid separators). % % If you don't give it the package's default (|,|) is used. @@ -591,32 +652,29 @@ % % \DM{\providemenumacro}\DM{\renewmenumacro}There are also the two commands % |\providemenumacro| and |\renewmenumacro| which take the same arguments as -% |\newmenumacro| and word like their \LaTeX{} analogons. -% \example To change the default input seperator of |\menu| you must know +% |\newmenumacro| and work like the \LaTeX{} macros |\renewcommand| and |\providecommand|. +% \example To change the default input separator of |\menu| you must know % the default style (which is |menus|) and then you can say % \begin{verbatim} % \renewmenumacro{\menu}[,]{menus} % \end{verbatim} % % \subsection{Keys} -% \DM{\shift}\DM{\capslock}\DM{\tab}\DM{\esc}\DM{\ctrl}\DM{\alt} -% \DM{\AltGr}\DM{\cmd} % The \menukeys package comes with some macros to print % special keys in the sequences set with |\keys|. Depending on -% the given OS (see Section~\ref{options}) some macros behave +% the given OS (see section~\ref{options}) some macros behave % differently to be able to use a key even if it's undefined % via the \opt{os} option macros like |\|\meta{key}|mac| and % |\|\meta{key}|win| that will always give the right symbol. -% -% \DM{\return}\DM{\enter}\DM{\winmenu}\DM{\backspace}\DM{\del} -% \DM{\arrowkeyup}\DM{\arrowkeydown}\DM{\arrowkeyleft}\DM{\arrowkeyright} -% Here is a full list of available macros: -% -% \DM{\Space}\DM{\SPACE}\mbox{}\par -% \medskip\noindent{\small +% +% The full ist of key macros is shown in table~\ref{tab:keys}. +% +% \begin{table}[ht] +% \caption{Overview of all key macros.}\label{tab:keys} +% \small % \renewcommand{\arraystretch}{1.25} -% \begin{minipage}{0.45\textwidth} -% \begin{tabular}{lll} +% \begin{minipage}[t]{0.45\textwidth} +% \begin{tabular}[t]{lll} % \hline % \textbf{Macro} & \textbf{Mac} & \textbf{Win.} \\ % \hline @@ -624,25 +682,27 @@ % |\capslock| & \capslockmac & \capslockwin\\ % |\tab| & \tabmac & \tabwin\\ % |\esc| & esc / \escmac & \escwin\\ +% |\oldesc| & esc / \oldescmac & \oldescwin\\ % |\ctrl| & \ctrlmac & \ctrlwin{}\\ % |\Alt| & alt / \Altmac & \Altwin \\ % |\AltGr| & & \AltGr \\ % |\cmd| & cmd / \cmdmac & \\ -% |\Space| & & \\ +% |\Space| & [empty sp.] & [empty sp.] \\ % |\SPACE| & \spacename & \spacename \\ % |\return| & \returnmac & \returnwin \\ % |\enter| & \entermac & \enterwin \\ % \hline % \end{tabular} % \end{minipage}\hfill -% \begin{minipage}{0.45\textwidth} -% \begin{tabular}{lll} +% \begin{minipage}[t]{0.45\textwidth} +% \begin{tabular}[t]{lll} % \hline % \textbf{Macro} & \textbf{Mac} & \textbf{Win.} \\ % \hline % |\winmenu| & & \winmenuwin \\ % |\backspace| & \backspace & \backspace\\ % |\del| & Del. / \delmac & \delwin{}\\ +% |\backdel| & Del. / \backdelmac & \backdelwin{}\\ % |\arrowkey{^}| & \arrowkey{^} & \arrowkey{^} \\ % |\arrowkeyup| & \arrowkeyup & \arrowkeyup\\ % |\arrowkey{v}| & \arrowkey{v} & \arrowkey{v} \\ @@ -653,9 +713,10 @@ % |\arrowkeyleft| & \arrowkeyleft & \arrowkeyleft\\ % \hline % \end{tabular} -% \end{minipage}} -% -% \medskip\DM{\arrowkey} +% \end{minipage} +% \end{table} +% +% \DM{\arrowkey} % The macro |\arrowkey|\marg{direction} is a little special % since it takes the direction as a singe character |^|, |v| % (lower case v), |>| or |<|. @@ -665,11 +726,10 @@ % So you can change them with |\renewcommand|. % % The rendering of some Mac macros depend on the option \DO{mackeys}\opt{mackeys} -% The different versions are shown in the table above (left: |text|, -% right: |symbols|). +% The different versions are shown in the table (left: |text|, right: |symbols|). % % \bigskip\noindent -% I apologise that there are no commands for the windows key +% I apologize that there are no commands for the windows key % and the apple logo, but that would be a copyright infringement. % % \section{Known issues and bugs} @@ -689,9 +749,6 @@ % Hello World! % \end{document} % \end{verbatim} -% \item Since \menukeys uses \pkg{catoptions} it may causes some problems -% with orther packages becaus of \pkg{catoptions} option handling. -% I recommend to load \menukeys as a later package in your preamble. % \end{itemize} % If you find something to add to this list please send me an e-mail. % @@ -705,14 +762,14 @@ \RequirePackage{xstring} \RequirePackage{etoolbox} % \end{macrocode} -% Furthermore we need \TikZ and some of it's libraries, +% Furthermore we need \TikZ and some of its libraries, % \begin{macrocode} \RequirePackage{tikz} \usetikzlibrary{calc,shapes.symbols,shadows} % \end{macrocode} % the color package \pkg{xcolor} and \pkg{adjustbox} for the -% |typewriterkeys| sytle. -% \begin{macrocode} +% |typewriterkeys| style. +% \begin{macrocode} \RequirePackage{xcolor} \RequirePackage{adjustbox} % \end{macrocode} @@ -722,8 +779,8 @@ \RequirePackage{relsize} % \end{macrocode} % To define the list parsing commands and allow |\| as -% a seperator we load \pkg{catoptions} -% \begin{macrocode} +% a separator we load \pkg{catoptions} +% \begin{macrocode} \RequirePackage{catoptions}[2011/12/07] % \end{macrocode} % @@ -744,8 +801,8 @@ % \end{macrocode} % \end{macro}\end{macro}\end{macro} % \begin{macro}{\tw@mk@tempa}\begin{macro}{\tw@mk@tempb} -% Some commads for temporary use: -% \begin{macrocode} +% Some commands for temporary use: +% \begin{macrocode} \def\tw@mk@tempa{} \def\tw@mk@tempb{} % \end{macrocode} @@ -762,7 +819,7 @@ % % \subsection{Options} % First we declare and process the package options -% \begin{macrocode} +% \begin{macrocode} \RequirePackage{kvoptions} \SetupKeyvalOptions{ family=tw@mk, @@ -775,7 +832,7 @@ \ProcessKeyvalOptions{tw@mk}\relax % \end{macrocode} % Now we have to do some error treatment: -% \begin{macrocode} +% \begin{macrocode} \IfSubStr{.mac.win.}{.\tw@mk@os.}{}{% \tw@mk@error{Unknown value for option 'os'\MessageBreak Possible values are 'mac' or 'win'.}% @@ -791,31 +848,36 @@ % \begin{macro}{\tw@make@color@theme} % First we define an internal command to make a color theme % \begin{macrocode} -\newcommand*{\tw@make@color@theme}[5]{% +\newcommand*{\tw@make@color@theme}[8]{% \definecolor{tw@color@theme@#1@bg}{#2}{#3}% \definecolor{tw@color@theme@#1@br}{#2}{#4}% \definecolor{tw@color@theme@#1@txt}{#2}{#5}% + \definecolor{tw@color@theme@#1@a}{#2}{#6}% + \definecolor{tw@color@theme@#1@b}{#2}{#7}% + \definecolor{tw@color@theme@#1@c}{#2}{#8}% } % \end{macrocode} % \end{macro} % \subsubsection{User-level commands} -% \begin{macro}{\newmenucolortheme}\begin{macro}{\newmenucolortheme} +% \begin{macro}{\newmenucolortheme}\begin{macro}{\renewmenucolortheme} % After that we define the user-level commands: % \begin{macrocode} -\newcommand*{\newmenucolortheme}[5]{% +\NewDocumentCommand{\newmenucolortheme}{ m m m m m O{#3} O{#4} O{#5} }{% \@ifundefinedcolor{tw@color@theme@#1@bg}{% - \tw@make@color@theme{#1}{#2}{#3}{#4}{#5} + \tw@make@color@theme{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}% }{% \tw@mk@error{Color theme '#1' already defined!\MessageBreak - Use \string\renewmenucolortheme\space instead.} + Use \string\renewmenucolortheme\space instead.}% } } -\let\renewmenucolortheme\tw@make@color@theme +\NewDocumentCommand{\renewmenucolortheme}{ m m m m m O{#3} O{#4} O{#5} }{% + \tw@make@color@theme{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}% +} % \end{macrocode} % \end{macro}\end{macro} % \begin{macro}{\changemenucolor}\begin{macro}{\copymenucolortheme} -% Lastyle we define the changing and copying commands -% \begin{macrocode} +% Lastly we define the changing and copying commands +% \begin{macrocode} \newcommand*{\changemenucolor}[4]{% \IfSubStr{ bg br txt }{ #2 }{% \definecolor{tw@color@theme@#1@#2}{#3}{#4}% @@ -829,6 +891,9 @@ \colorlet{tw@color@theme@#1@bg}{tw@color@theme@#2@bg}% \colorlet{tw@color@theme@#1@br}{tw@color@theme@#2@br}% \colorlet{tw@color@theme@#1@txt}{tw@color@theme@#2@txt}% + \colorlet{tw@color@theme@#1@a}{tw@color@theme@#2@a}% + \colorlet{tw@color@theme@#1@b}{tw@color@theme@#2@b}% + \colorlet{tw@color@theme@#1@c}{tw@color@theme@#2@c}% }{% \tw@mk@error{Color theme '#1' already defined!\MessageBreak Use \string\renewmenucolortheme\space instead.} @@ -838,7 +903,7 @@ % \end{macro}\end{macro} % \begin{macro}{\changemenucolortheme} % To be able to change the color theme of a style we must define this: -% \begin{macrocode} +% \begin{macrocode} \newcommand{\changemenucolortheme}[2]{% \ifcsundef{tw@style@#1@pre}{% \tw@mk@error{Style '#1' undefined!\MessageBreak @@ -855,7 +920,7 @@ % \end{macro} % \begin{macro}{\usemenucolor} % To use a color of a theme we define |\usemenucolor| as following. -% \begin{macrocode} +% \begin{macrocode} \newcommand{\usemenucolor}[1]{% tw@color@theme@\tw@current@color@theme @#1% } @@ -863,9 +928,9 @@ % \end{macro} % \subsubsection{Predefined themes} % There are two predefined color themes -% \begin{macrocode} -\tw@make@color@theme{gray}{gray}{0.95}{0.3}{0} -\tw@make@color@theme{blacknwhite}{gray}{1}{0}{0} +% \begin{macrocode} +\newmenucolortheme{gray}{gray}{0.95}{0.3}{0}[0.95][0][0] +\newmenucolortheme{blacknwhite}{gray}{1}{0}{0}[1][0][0] % \end{macrocode} % \subsection{Styles} % The style generating commands will set some commands that are named @@ -874,7 +939,7 @@ % \begin{macro}{\tw@default@pre} % \begin{macro}{\tw@default@post} % Before we can define the internal -% declaring macro to use it later in the the user level commands, we have to set +% declaring macro to use it later in the user level commands, we have to set % some defaults for the optional arguments % \begin{macrocode} \newcommand{\tw@default@sep}{% @@ -888,7 +953,7 @@ % Now we can define the internal commands. % \begin{macro}{\tw@declare@style@simple} % Our first step is to define the simple command. -% \begin{macrocode} +% \begin{macrocode} \DeclareDocumentCommand{\tw@declare@style@simple}{% s m O{\tw@default@pre} m O{\tw@default@sep} O{\tw@default@post} m }{% @@ -922,7 +987,7 @@ % The next step is to create the extended command. This command must have % ten arguments (including the star) so we have to define a helping macro % to grab the last two macros. -% \begin{macrocode} +% \begin{macrocode} \DeclareDocumentCommand{\tw@declare@sytle@extra@args}{% O{\tw@default@post} m }{% @@ -961,12 +1026,12 @@ } % \end{macrocode} % \end{macro}\end{macro} -% \subsubsection{User-level commads} +% \subsubsection{User-level commands} % \begin{macro}{newmenustylesimple}\begin{macro}{renewmenustylesimple}% % \begin{macro}{providemenustylesimple}\begin{macro}{newmenustyle}\begin{macro}% % {renewmenustyle}\begin{macro}{providemenustyle} % It's time to define the user-level commands now: -% \begin{macrocode} +% \begin{macrocode} \NewDocumentCommand{\newmenustylesimple}{s m}{% \ifcsundef{tw@style@#2@pre}{% \IfBooleanTF{#1}{% @@ -1041,9 +1106,9 @@ % % \subsubsection{Copying and changing} % \begin{macro}{\copymenustyle} -% The last two steps in this part are to define a comand to copy +% The last two steps in this part are to define a command to copy % styles -% \begin{macrocode} +% \begin{macrocode} \newcommand*{\copymenustyle}[2]{% \ifcsundef{tw@style@#1@pre}{% \ifcsundef{tw@style@#2@pre}{% @@ -1080,7 +1145,7 @@ }{% \csdef{tw@style@#2@#3}{% \tikz[baseline=(tw@node.base)]{% - \node(tw@node)[#4]{\strut\CurrentMenuElement};}}% + \node(tw@node)[#4]{\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}}% }% }% }{\tw@mk@error{No element '#3'. Possible values are\MessageBreak @@ -1105,7 +1170,7 @@ % Now we can define the styles. To keep the most settings of % a style together we make additional \TikZ-styles instead of setting % everything directly to the |node|s. -% \begin{macrocode} +% \begin{macrocode} \tikzset{tw@menus@base/.style={% tw@set@tikz@colors, rounded corners=0.15ex, @@ -1122,19 +1187,19 @@ \tw@declare@style*{menus}{% \tikz[baseline={($(tw@node.base)+(0,-0.2ex)$)}]{% \node(tw@node)[tw@menus@base,signal to=east]% - {\strut\CurrentMenuElement};}% + {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}% }[\hspace{-0.2em}\hspace{0em plus 0.1em minus 0.05em}]% {% \tikz[baseline={($(tw@node.base)+(0,-0.2ex)$)}]{% \node(tw@node)[tw@menus@base,signal from=west,signal to=east]% - {\strut\CurrentMenuElement};}% + {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}% }{% \tikz[baseline={($(tw@node.base)+(0,-0.2ex)$)}]{% \node(tw@node)[tw@menus@base,signal from=west,]% - {\strut\CurrentMenuElement};}% + {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}% }{% \tikz[baseline={($(tw@node.base)+(0,-0.2ex)$)}]{% - \node(tw@node)[tw@menus@base]{\strut\CurrentMenuElement};}% + \node(tw@node)[tw@menus@base]{\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}% }{gray} \tikzset{tw@roundedmenus@base/.style={% @@ -1153,19 +1218,19 @@ \tw@declare@style*{roundedmenus}{% \tikz[baseline={($(tw@node.base)+(0,-0.2ex)$)}]{% \node(tw@node)[tw@roundedmenus@base,signal to=east]% - {\strut\CurrentMenuElement};}% + {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}% }[\hspace{-0.2em}\hspace{0em plus 0.1em minus 0.05em}]% {% \tikz[baseline={($(tw@node.base)+(0,-0.2ex)$)}]{% \node(tw@node)[tw@roundedmenus@base,signal from=west,signal to=east]% - {\strut\CurrentMenuElement};}% + {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}% }{% \tikz[baseline={($(tw@node.base)+(0,-0.2ex)$)}]{% \node(tw@node)[tw@roundedmenus@base,signal from=west,]% - {\strut\CurrentMenuElement};}% + {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}% }{% \tikz[baseline={($(tw@node.base)+(0,-0.2ex)$)}]{% - \node(tw@node)[tw@roundedmenus@base]{\strut\CurrentMenuElement};}% + \node(tw@node)[tw@roundedmenus@base]{\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}% }{gray} \tikzset{tw@angularmenus@base/.style={% @@ -1183,19 +1248,19 @@ \tw@declare@style*{angularmenus}{% \tikz[baseline={($(tw@node.base)+(0,-0.2ex)$)}]{% \node(tw@node)[tw@angularmenus@base,signal to=east]% - {\strut\CurrentMenuElement};}% + {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}% }[\hspace{-0.2em}\hspace{0em plus 0.1em minus 0.05em}]% {% \tikz[baseline={($(tw@node.base)+(0,-0.2ex)$)}]{% \node(tw@node)[tw@angularmenus@base,signal from=west,signal to=east]% - {\strut\CurrentMenuElement};}% + {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}% }{% \tikz[baseline={($(tw@node.base)+(0,-0.2ex)$)}]{% \node(tw@node)[tw@angularmenus@base,signal from=west,]% - {\strut\CurrentMenuElement};}% + {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}% }{% \tikz[baseline={($(tw@node.base)+(0,-0.2ex)$)}]{% - \node(tw@node)[tw@angularmenus@base]{\strut\CurrentMenuElement};}% + \node(tw@node)[tw@angularmenus@base]{\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}% }{gray} \tikzset{tw@roundedkeys@base/.style={% @@ -1210,10 +1275,11 @@ }} \tw@declare@style@simple*{roundedkeys}{% \tikz[baseline={($(tw@node.base)+(0,-0.2ex)$)}]{% - \node(tw@node)[tw@roundedkeys@base]{\strut\CurrentMenuElement};}% + \node(tw@node)[tw@roundedkeys@base]% + {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}% }[% \hspace{0.1em plus 0.1em minus 0.05em}% - \raisebox{0.25ex}{\sffamily\relsize{-2}+}% + \textcolor{\usemenucolor{b}}{\raisebox{0.25ex}{\sffamily\relsize{-2}+}}% \hspace{0.1em plus 0.1em minus 0.05em}% ]{gray} @@ -1228,15 +1294,17 @@ font=\relsize{-1}\sffamily, general shadow={% shadow xshift=.2ex, shadow yshift=-.15ex, - fill=black, + fill=\usemenucolor{c}, }, }} \tw@declare@style@simple*{shadowedroundedkeys}{% \tikz[baseline={($(tw@node.base)+(0,-0.2ex)$)}]{% - \node(tw@node)[tw@shadowedroundedkeys@base]{\strut\CurrentMenuElement};}% + \node(tw@node)[tw@shadowedroundedkeys@base]% + {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};% + }% }[% \hspace{0.2ex}\hspace{0.1em plus 0.1em minus 0.05em}% - \raisebox{0.25ex}{\sffamily\relsize{-2}+}% + \textcolor{\usemenucolor{b}}{\raisebox{0.25ex}{\sffamily\relsize{-2}+}}% \hspace{0.1em plus 0.1em minus 0.05em}% ][\hspace{0.2ex}]{gray} @@ -1251,10 +1319,11 @@ }} \tw@declare@style@simple*{angularkeys}{% \tikz[baseline={($(tw@node.base)+(0,-0.2ex)$)}]{% - \node(tw@node)[tw@angularkeys@base]{\strut\CurrentMenuElement};}% + \node(tw@node)[tw@angularkeys@base]% + {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}% }[% \hspace{0.1em plus 0.1em minus 0.05em}% - \raisebox{0.25ex}{\sffamily\relsize{-2}+}% + \textcolor{\usemenucolor{b}}{\raisebox{0.25ex}{\sffamily\relsize{-2}+}}% \hspace{0.1em plus 0.1em minus 0.05em}% ]{gray} @@ -1268,15 +1337,16 @@ font=\relsize{-1}\sffamily, general shadow={% shadow xshift=.2ex, shadow yshift=-.15ex, - fill=black, + fill=\usemenucolor{c}, }, }} \tw@declare@style@simple*{shadowedangularkeys}{% \tikz[baseline={($(tw@node.base)+(0,-0.2ex)$)}]{% - \node(tw@node)[tw@shadowedangularkeys@base]{\strut\CurrentMenuElement};}% + \node(tw@node)[tw@shadowedangularkeys@base]% + {\strut\color{\usemenucolor{txt}}\CurrentMenuElement};}% }[% \hspace{0.2ex}\hspace{0.1em plus 0.1em minus 0.05em}% - \raisebox{0.25ex}{\sffamily\relsize{-2}+}% + \textcolor{\usemenucolor{b}}{\raisebox{0.25ex}{\sffamily\relsize{-2}+}}% \hspace{0.1em plus 0.1em minus 0.05em}% ][\hspace{0.2ex}]{gray} @@ -1294,21 +1364,22 @@ \begin{tikzpicture}[baseline={($(tw@node.south)+(0,0.8ex)$)}]% \node(tw@node)[% tw@typewriterkeys@base, inner sep=1.25pt, line width=0.6pt% - ]{\tw@typewriterkeys@curr@elem}; - \node[tw@typewriterkeys@base]{\tw@typewriterkeys@curr@elem}; + ]{\color{\usemenucolor{txt}}\tw@typewriterkeys@curr@elem}; + \node[tw@typewriterkeys@base]% + {\color{\usemenucolor{txt}}\tw@typewriterkeys@curr@elem}; \end{tikzpicture}% }[% \hspace{0.2ex}\hspace{0.1em plus 0.1em minus 0.05em}% - \raisebox{0.25ex}{\sffamily\relsize{-2}+}% + \textcolor{\usemenucolor{b}}{\raisebox{0.25ex}{\sffamily\relsize{-2}+}}% \hspace{0.1em plus 0.1em minus 0.05em}% ]{blacknwhite} \tw@declare@style@simple*{paths}{% - {\ttfamily\CurrentMenuElement}% + {\ttfamily\color{\usemenucolor{txt}}\CurrentMenuElement}% }[% \hspace{0.2em plus 0.1em}% \raisebox{0.08ex}{% - \tikz{\fill[\usemenucolor{txt}] (0,0) -- (0.5ex,0.5ex)% + \tikz{\fill[\usemenucolor{c}] (0,0) -- (0.5ex,0.5ex)% -- (0,1ex) -- cycle;}% }% \hspace{0.2em plus 0.1em}% @@ -1332,46 +1403,47 @@ }% }% \hyphenchar\font=\value{tw@hyphen@char@num}\relax + \color{\usemenucolor{txt}}% \CurrentMenuElement}% }[% \hspace{0.2em plus 0.1em}% \raisebox{0.08ex}{% - \tikz{\fill[\usemenucolor{txt}] (0,0) -- (0.5ex,0.5ex)% + \tikz{\fill[\usemenucolor{c}] (0,0) -- (0.5ex,0.5ex)% -- (0,1ex) -- cycle;}% }% \hspace{0.2em plus 0.1em}% ]{blacknwhite} -\newcommand*{\drawtikzfolder}[1][white]{% +\NewDocumentCommand{\drawtikzfolder}{O{white} O{black}}{% \begin{tikzpicture}[rounded corners=0.02ex,scale=0.7] - \draw (0,0) -- (1em,0) -- (1em,1.5ex) -- (0.5em,1.5ex) -- % + \draw [#2] (0,0) -- (1em,0) -- (1em,1.5ex) -- (0.5em,1.5ex) -- % (0.4em,1.7ex) -- (0.1em,1.7ex) -- (0,1.5ex) -- cycle; - \draw [fill=#1] (0,0) -- (1em,0) -- (0.85em,1.15ex) -- % + \draw [#2,fill=#1] (0,0) -- (1em,0) -- (0.85em,1.15ex) -- % ++(-1em,0) -- cycle; \end{tikzpicture}% } \copymenustyle{pathswithfolder}{paths} \changemenuelement{pathswithfolder}{pre}{% - \textcolor{\usemenucolor{txt}}{\drawtikzfolder}% + \drawtikzfolder[\usemenucolor{a}][\usemenucolor{b}]% \hspace{0.2em plus 0.1em}% } \copymenustyle{pathswithblackfolder}{paths} \changemenuelement{pathswithblackfolder}{pre}{% - \textcolor{\usemenucolor{txt}}{\drawtikzfolder[\usemenucolor{txt}]}% + \drawtikzfolder[\usemenucolor{c}][\usemenucolor{b}]% \hspace{0.2em plus 0.1em}% } \copymenustyle{hyphenatepathswithfolder}{hyphenatepaths} \changemenuelement{hyphenatepathswithfolder}{pre}{% - \textcolor{\usemenucolor{txt}}{\drawtikzfolder}% + \drawtikzfolder[\usemenucolor{a}][\usemenucolor{b}]% \hspace{0.2em plus 0.1em}% } \copymenustyle{hyphenatepathswithblackfolder}{hyphenatepaths} \changemenuelement{hyphenatepathswithblackfolder}{pre}{% - \textcolor{\usemenucolor{txt}}{\drawtikzfolder[\usemenucolor{txt}]}% + \drawtikzfolder[\usemenucolor{c}][\usemenucolor{b}]% \hspace{0.2em plus 0.1em}% } % \end{macrocode} @@ -1379,8 +1451,8 @@ % \subsection{Menu macros} % \subsubsection{Internal commands} % \begin{macro}{\tw@default@input@sep} -% First we define our default input seperator -% \begin{macrocode} +% First we define our default input separator +% \begin{macrocode} \edef\tw@default@input@sep{,} % \end{macrocode} % \end{macro} @@ -1390,14 +1462,15 @@ % \end{macrocode} % \end{macro} % \begin{macro}{\tw@define@menu@macro} -% \changes{v1.1a}{2013/05/28}{Fixed minor bug, that causes a warning about robustifying (issu \#23), by deleting the line to make the command robust.} +% \changes{v1.1a}{2013/05/28}{Fixed minor bug, that causes a warning about robustifying (issue \#23), +% by deleting the line to make the command robust.} % \changes{v1.2}{2013/07/23}{Replaced \cs{edef} by \cs{protected@edef}} % \changes{v1.2c}{2013/07/23}{Replaced \cs{protected@edef} by \cs{def}} % \changes{v1.2}{2013/07/23}{Addded \cs{leavevmode}} % 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! -% \begin{macrocode} +% \begin{macrocode} \begingroup \lccode`\,=1 \lowercase{\endgroup @@ -1488,7 +1561,8 @@ \iftw@mk@definemenumacros % \end{macrocode} % \begin{macro}{\menu}\begin{macro}{\directory}% -% \changes{v1.1}{2012/02/27}{Renamed \cmd{\path} to \cmd{\directory} becuase it crashes with \pkg{biblatex}} +% \changes{v1.1}{2012/02/27}{Renamed \cmd{\path} to \cmd{\directory} because it +% crashes with \pkg{biblatex}} % \begin{macro}{\keys} % And then we define three basic macros. % \begin{macrocode} @@ -1497,25 +1571,25 @@ \newmenumacro{\keys}[+]{roundedkeys} % \end{macrocode} % \end{macro}\end{macro}\end{macro} -% Lastly we close the |definemacros| if statment: -% \begin{macrocode} +% Lastly we close the |definemacros| if statement: +% \begin{macrocode} \fi % \end{macrocode} % % \subsection{Keys} % Before we define anything we check if the user allows it: -% \begin{macrocode} +% \begin{macrocode} \iftw@mk@definekeys % \end{macrocode} % % Before define the key macros we create some macros that save some typing by -% condensing the similarities between the key marcros. +% condensing the similarities between the key macros. % \begin{macro}{\tw@make@key@box} % The first of these macros helps us building save boxes % to store the |{tikzpicture}|, that will draw the key later. % This is necessary because otherwise the picture will inherit % the style of the key sequence |node|. -% \begin{macrocode} +% \begin{macrocode} \NewDocumentCommand{\tw@make@key@box}{m m}{% % \expandafter\newbox\csname tw@mk@box@#1\endcsname % \expandafter\sbox\csname tw@mk@box@#1\endcsname{% @@ -1531,10 +1605,10 @@ % \begin{macro}{\tw@make@key@macro} % The next macro defines the user level command by accessing a % macro like |tw@mk@|\meta{key} or |tw@mk@|\meta{key}|@|\meta{os}, -% if the apperance differs between Mac and Windows. -% To use this macro we assume that the |tw@mk@|\meta{key} commads +% if the appearance differs between Mac and Windows. +% To use this macro we assume that the |tw@mk@|\meta{key} commands % are defined. -% \begin{macrocode} +% \begin{macrocode} \NewDocumentCommand{\tw@make@key@macro}{s m}{% \IfBooleanTF{#1}{% \expandafter\providecommand\csname\expandafter\@gobble\string#2\endcsname{% @@ -1563,9 +1637,9 @@ % \end{macrocode} % \end{macro} % \begin{macro}{\tw@define@mackey} -% The last helping macro is |\tw@define@mackey|. We use it to exequte +% The last helping macro is |\tw@define@mackey|. We use it to execute % code depending on the |mackeys| option. -% \begin{macrocode} +% \begin{macrocode} \newcommand*{\tw@define@mackey}[2]{% \IfStrEq{text}{\tw@mk@mackeys}{#1}{% \IfStrEq{symbols}{\tw@mk@mackeys}{#2}{}% @@ -1575,7 +1649,7 @@ % \end{macro} % % Next thing to do is to set up some \TikZ-styles. -% \begin{macrocode} +% \begin{macrocode} \tikzset{ menukeys key symbol/.style={ rounded corners=0pt, @@ -1586,14 +1660,11 @@ } % \end{macrocode} % -% \begin{macro}{\shift}\begin{macro}{\capslock}\begin{macro}{\tab} -% \begin{macro}{\esc}\begin{macro}{\ctrl}\begin{macro}{\alt} -% \begin{macro}{\AltGr}\begin{macro}{\cmd}\begin{macro}{\Space} -% \begin{macro}{\return}\begin{macro}{\enter}\begin{macro}{\winmenu} -% \begin{macro}{\backspace}\begin{macro}{\del} % Now we ar prepared to generate the key macros. I will be nearly the same % way for all keys. Step one is to build a |tw@mk@|\meta{key} macro -% \begin{macrocode} +% and then we define the user-level command |\|\meta{key} +% \begin{macro}{\shift} +% \begin{macrocode} \normalsize \tw@make@key@box{shift}{% \begin{tikzpicture}[yshift=-0.1ex,menukeys key symbol] @@ -1602,15 +1673,17 @@ (0.3ex,1.2ex) -- cycle; \end{tikzpicture}% } -% \end{macrocode} -% and then we define the user-level command |\|\meta{key} -% \begin{macrocode} \tw@make@key@macro{\shift} % \end{macrocode} -% It's a little more complicated if the apperance should differ depending -% on the OS. The first step again is to define |tw@mk@|\meta{key}|@mac| -% and |tw@mk@|\meta{key}|@win|: -% \begin{macrocode} +% \end{macro} +% It's a little more complicated if the appearance should differ depending on the +% OS: The first step again is to define |tw@mk@|\meta{key}|@mac| and +% |tw@mk@|\meta{key}|@win|. And then use the starred version +% |\tw@make@key@macro*| which creates |\|\meta{key} that depends on the |os| +% option, |\|\meta{key}|mac| and |\|\meta{key}|win|, that are not affected by +% |os|. +% \begin{macro}{\capslock} +% \begin{macrocode} \tw@make@key@box{capslock@mac}{% \begin{tikzpicture}[yshift=-0.1ex,menukeys key symbol] \draw (0.3ex,0.7ex) -- (1.1ex,0.7ex) -- (1.1ex,1.2ex) -- % @@ -1626,14 +1699,11 @@ (0.3ex,1.2ex) -- cycle; \end{tikzpicture}% } -% \end{macrocode} -% And then use the starred version |\tw@make@key@macro*| which creates -% |\|\meta{key} that depends on the |os| option, |\|\meta{key}|mac| -% and |\|\meta{key}|win|, that are not affected by |os|. -% \begin{macrocode} \tw@make@key@macro*{\capslock} % \end{macrocode} +% \end{macro} % Here are the other macros: +% \begin{macro}{\tab} % \begin{macrocode} \tw@make@key@box{tab@mac}{% \begin{tikzpicture}[yshift=0.6ex,menukeys key symbol] @@ -1650,25 +1720,48 @@ \end{tikzpicture}% } \tw@make@key@macro*{\tab} - +% \end{macrocode} +% \end{macro} +% \begin{macro}{\esc}\begin{macro}{\oldesc} +% \changes{v1.4}{2016/04/17}{Fixed direction of \cs{escmac}; added \cs{oldesc}} +% \begin{macrocode} \def\tw@mk@esc@win{Esc} \tw@define@mackey{% \def\tw@mk@esc@mac{esc} }{% \tw@make@key@box{esc@mac}{% \begin{tikzpicture}[yshift=-0.1ex,menukeys key symbol] + \draw [->] (0.5ex,0.5ex) -- ++(135:1.1ex); + \draw (0.5ex,0.5ex) ++(105:0.6ex) arc (105:-195:0.6ex); + \end{tikzpicture}% + }% +} +\tw@make@key@macro*{\esc} +\def\tw@mk@oldesc@win{Esc} +\tw@define@mackey{% + \def\tw@mk@oldesc@mac{esc} +}{% + \tw@make@key@box{oldesc@mac}{% + \begin{tikzpicture}[yshift=-0.1ex,menukeys key symbol] \draw [->] (0.5ex,0.5ex) -- ++(45:1.1ex); \draw (0.5ex,0.5ex) ++(15:0.6ex) arc (15:-285:0.6ex); \end{tikzpicture}% }% } -\tw@make@key@macro*{\esc} - +\tw@make@key@macro*{\oldesc} +% \end{macrocode} +% \end{macro}\end{macro} +% \begin{macro}{\ctrl} +% \begin{macrocode} \providecommand\ctrlname{Ctrl} \def\tw@mk@ctrl@win{\ctrlname} \def\tw@mk@ctrl@mac{ctrl} \tw@make@key@macro*{\ctrl} - +% \end{macrocode} +% \end{macro} +% \begin{macro}{\Alt} +% \begin{macro}{\AltGr} +% \begin{macrocode} \def\tw@mk@Alt@win{Alt} \tw@define@mackey{% \def\tw@mk@Alt@mac{alt}% @@ -1681,9 +1774,11 @@ }% } \tw@make@key@macro*{\Alt} - \providecommand*{\AltGr}{Alt\,Gr} - +% \end{macrocode} +% \end{macro}\end{macro} +% \begin{macro}{\cmd} +% \begin{macrocode} \def\tw@mk@cmd@win{% \tw@mk@warning{'\string\cmd' only for Mac!}% } @@ -1700,11 +1795,17 @@ }% } \tw@make@key@macro*{\cmd} - +% \end{macrocode} +% \end{macro} +% \begin{macro}{\Space}\begin{macro}{\SPACE} +% \begin{macrocode} \providecommand*{\Space}{\expandonce{\rule{3em}{0pt}}} \newcommand{\spacename}{Space} \providecommand*{\SPACE}{\expandonce{\rule{2em}{0pt}\spacename\rule{2em}{0pt}}} - +% \end{macrocode} +% \end{macro}\end{macro} +% \begin{macro}{\return} +% \begin{macrocode} \tw@make@key@box{return@mac}{% \begin{tikzpicture}[yshift=0.25ex,menukeys key symbol] \draw [->, rounded corners=0.2ex] (1.25ex,1ex) -| % @@ -1717,7 +1818,10 @@ \end{tikzpicture}% } \tw@make@key@macro*{\return} - +% \end{macrocode} +% \end{macro} +% \begin{macro}{\enter} +% \begin{macrocode} \def\tw@mk@enter@win{Enter} \tw@make@key@box{enter@mac}{% \begin{tikzpicture}[menukeys key symbol] @@ -1726,7 +1830,10 @@ \end{tikzpicture}% } \tw@make@key@macro*{\enter} - +% \end{macrocode} +% \end{macro} +% \begin{macro}{\winmenu} +% \begin{macrocode} \def\tw@mk@winmenu@mac{% \tw@mk@warning{'\string\winmenu' only for Windows!}% } @@ -1739,14 +1846,21 @@ \end{tikzpicture}% } \tw@make@key@macro*{\winmenu} - +% \end{macrocode} +% \end{macro} +% \begin{macro}{\backspace} +% \begin{macrocode} \tw@make@key@box{backspace}{% \begin{tikzpicture}[yshift=0.65ex,menukeys key symbol] \draw [<-,menukeys thick] (0,0) -- (1.35em,0); \end{tikzpicture}% } \tw@make@key@macro{\backspace} - +% \end{macrocode} +% \end{macro} +% \begin{macro}{\del}\begin{macro}{\backdel} +% \changes{v1.4}{2016/04/17}{Added \cs{backdel}} +% \begin{macrocode} \providecommand{\delname}{Del.} \def\tw@mk@del@win{\delname} \tw@define@mackey{% @@ -1762,14 +1876,27 @@ }% } \tw@make@key@macro*{\del} +\def\tw@mk@backdel@win{\delname} +\tw@define@mackey{% + \def\tw@mk@backdel@mac{\delname}% +}{% + \tw@make@key@box{backdel@mac}{% + \begin{tikzpicture}[yshift=0.2ex,menukeys key symbol] + \draw (2ex,0) -- (0.5ex,0) -- (0,0.5ex) --% + (0.5ex,1ex) -- (2ex,1ex) -- cycle; + \draw (1ex,0.2ex) -- (1.6ex,0.8ex); + \draw (1ex,0.8ex) -- (1.6ex,0.2ex); + \end{tikzpicture}% + }% +} +\tw@make@key@macro*{\backdel} % \end{macrocode} -% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro} -% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro} +% \end{macro}\end{macro} % % \begin{macro}{\arrowkeyup}\begin{macro}{\arrowkeydown} % \begin{macro}{\arrowkeyleft}\begin{macro}{\arrowkeyright} % Lastly we define the arrow macros: -% \begin{macrocode} +% \begin{macrocode} \tw@make@key@box{arrowkeyup}{% \begin{tikzpicture}[yshift=-0.2ex,menukeys key symbol] \draw [->] (0,0) -- (0,0.8em); @@ -1801,7 +1928,7 @@ % \end{macro}\end{macro}\end{macro}\end{macro} % \begin{macro}{\arrowkey} % And the |\arrowkey| macro that get's it's direction as argument. -% \begin{macrocode} +% \begin{macrocode} \newcommand{\arrowkey}[1]{% \IfStrEq{^}{#1}{\arrowkeyup}{% \IfStrEq{v}{#1}{\arrowkeydown}{% @@ -1817,7 +1944,7 @@ % \end{macrocode} % \end{macro} % Close the |\iftw@mk@definekeys| -% \begin{macrocode} +% \begin{macrocode} \fi % \end{macrocode} % |