I would like to define a new command like the following. The latex when compiling should emit I_{wr} when given without arguments, or the optional arguments should come as a subscript.


So If I give $\myCommand{2}$, then it would emit the text as I_{wr}2. The 2 does not come in the subscript form. Could anyone please tell me how to do this correctly?

Thank You

1 Answer 1


It's already correct except for the usage:


The argument is an optional argument that uses square brackets:


Full example:



  \myCommand[2] = 2 * \myCommand


You must log in to answer this question.

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