I would like to define the command A\!\!_B\!C in a math mode as a macros, and I am using the following:


Unfortunately I get an error that there are {} missing. Any hint is appreciated.

Is there any possibility to get a Mathematica-like syntax with only one argument, splitting it a the comma?

  • 2
    At least it should be \newcommand{\cmp}{...} with a backslash.
    – egreg
    Commented Mar 20, 2014 at 13:36
  • I don't get any error once I add @egreg's backslash...
    – cslstr
    Commented Mar 20, 2014 at 13:37
  • 2
    You might also want to use _{#2} in case #2 has more than one character. Commented Mar 20, 2014 at 13:39
  • @egreg: I had that in code, didn't copy properly here. Could you clarify how shall I call \cmp then in the body?
    – SBF
    Commented Mar 20, 2014 at 13:49
  • @Ilya Can you make a simple example of what gives you an error?
    – egreg
    Commented Mar 20, 2014 at 13:53

2 Answers 2


For example:


$a = \cmp{A,B,C}$

But I don't understand, why do you need the ugly clump of letters.

  • I've been asking myself the same question. But look at how old the queston is, i bet we will never here the answer.
    – Johannes_B
    Commented Jan 25, 2015 at 16:15

With your original command you have to remember to give it three arguments.

With package xparse you can split one argument at a given symbol (here the comma) and hence stick with the syntax you know from Mathematica.

The output looks a little bit odd though, but this is a different matter.

\NewDocumentCommand{\cmpA}{  >{\SplitArgument{2}{,}} m}
{\cmp#1}%<- feeding the three arguments to the original command

\[ \cmp{A}{B}{C} \]
\[ \cmpA{A,B,C} \]
  • @egreg I changed it for the sake of generity. I thought about it as well (it is also above in the comments), but decided against it as there is some kind of logic behind that thing (at least i hope so).
    – Johannes_B
    Commented Jan 25, 2015 at 16:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .