I'm currently writing a tutorial for some software, and I'd like to refer to the shortcuts used in this program. These shortcuts should be notable, i.e. displayed in a different color or font style.
Basically what I'm trying to do is create a new command, with only one argument -- a string of words, separated by some delimiter (comma). Each word (or segment, since in this case words would be substrings like Ctrl, Shift, Enter or just S, O) should be displayed in the notable style (let's say \textbf{}), and between each two words there should be a + (or some other symbol) using the regular font style. Note that this isn't necessarily the same delimiter used in the argument (the comma)!
In pseudo code:
\newcommand{\shortcut}[1]{
For every word in the argument #1:
- Display in notable font style
- Add + in regular font style (except for last word)
}
So \shortcut{Ctrl,Shift,Z} should result in \textbf{Ctrl}+\textbf{Shift}+\textbf{Z}.
Any recommendations for packages to use, or can this be done using relatively simple LaTeX?



@tempswaflag is just a predefined boolean flag? And@tempswatrueand@tempswafalseset the value to respectively true and false? – Ailurus Jun 14 '12 at 21:50\if@tempswais a "scratch conditional" defined by the LaTeX kernel for tasks like this, where its value (true or false) is needed for a short job; one should always set it to true or false before starting the job, as its value can be any. – egreg Jun 14 '12 at 22:04\newcommand{}without linebreaks. Apparently I have to add a%after theifstatement in your code, but why? – Ailurus Jun 14 '12 at 22:25%was missing. The end of line became part of the definition (and is converted to a space), so it was added at each call of the macro. The "new style" method doesn't suffer of this problem because all spaces and end-of-lines are ignored between\ExplSyntaxOnand\ExplSyntaxOff. – egreg Jun 14 '12 at 22:30