0

I found a lots of questions asking how to add a superscript to a variable defined with a superscript but none for how to do it the other way around.

My macro is \newcommand{\trsp}[1]{#1^T} and I want to apply it to e.g. \trsp{M^{-1}}.

How do I avoid a Double Superscript error ?

2
  • the simplest way is to define \trsp as {#1}^T but that has some consequences on spacing in all cases. So alternative is to explicitly test or have a separate command for teh transposed inverse Jun 7, 2021 at 7:46
  • If you want something automatic, have a look at this answer.
    – NBur
    Jun 8, 2021 at 7:29

1 Answer 1

1

Use \def\trsp#1{{#1}^T}. The key is to use {#1} instead #1 in the body of the macro. You can use \newcommand too, if you are using LaTeX.

You must log in to answer this question.

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