in my document I have to type expressions that contain letters with superscripts, enclosed between parentheses, such as

a^{(k,i)}, b^{(k,i)}, \gamma^{(k,i)}

and after a while it became really annoying for me to type those parentheses '(' and ')' each time.

I defined new variables

\newcommand{\ca}[2]{a^{(#1, #2)}}
\newcommand{\cb}[2]{b^{(#1, #2)}}
\newcommand{\cgamma}[2]{\gamma^{(#1, #2)}}

and used \ca k i or \cgamma k i. This really made it way easier for me to type equations, however it lacks flexibility. First, I have to define a new variable for each letter. Also, if I want to use subscripts and type \c_3{k,i}, then it is broken.

My question is, what is the right way to achieve this functionality ?

EDIT : After searching on the internet for a while, I found a solution



\newcommand{\doublesupscr}[1]{\expandafter\newcommand\csname c\removeabs{#1}\endcsname[2]{#1^{(##1, ##2)}}}

\newcommand{\singlesupscr}[1]{\expandafter\newcommand\csname c\removeabs{#1}\endcsname[1]{#1^{(##1)}}}

\forcsvlist{\singlesupscr}{\eta, \gamma}

    \ca k i, \cb k i, \cc k i, \ceta i, \cgamma i

which creates the following output output of code

However, I would like to type something like \ca_3 k i and still get the correct output. Is there a way for newcommand to ignore the subscript as an argument ?

  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. Apr 8, 2020 at 13:30
  • 2
    $\ca ki_3$ will work to get a subscript 3. Apr 8, 2020 at 15:48

1 Answer 1


Possibly something like this?


\NewDocumentCommand{\pv}{m e{_} m}{%




enter image description here

You must log in to answer this question.

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