Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic \key wrapping for symbols #22

Open
tweh opened this issue Mar 8, 2013 · 1 comment
Open

Automatic \key wrapping for symbols #22

tweh opened this issue Mar 8, 2013 · 1 comment

Comments

@tweh
Copy link
Owner

tweh commented Mar 8, 2013

A symbol should automatically detect if it’s inside of a \key or not and add a \key around itself if it’s not jet inside of one.

(by Christophe)
I think that you can improve special keys. For example, I'm adding some calculator keys. I use the following method.

\makeatletter
% Calculator keys
    \newcounter{@CounterKeys}

    \newcommand*\ksquare{\ifnum\value{@CounterKeys}>0 ${}^2$  \else \keys{${}^2$} \fi}
    \newcommand*\kpower{\ifnum\value{@CounterKeys}>0 $x^y$ \else \keys{$x^y$} \fi}

% General methods
    \let\@oldKeys\keys

    \renewcommand\keys[1]{%
        \addtocounter{@CounterKeys}{1}%
        \@oldKeys{#1}%
        \addtocounter{@CounterKeys}{-1}%
    }
\makeother 

This allows then to use \ksquare or \keys{\ksquare} without problem.

@tweh
Copy link
Owner Author

tweh commented Mar 8, 2013

Ideas

  • all menu macros use a boolean \mk@inside@<macro name>
  • \ensuremenumacro{<macor name>}{<content macro>} makes sure that the content macro is always inside of the given menu macro
  • starred version of symbol name could suppress the wrapping to be able to typeset the “naked“ symbol where desired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant