1

Imagine I have many expression of the form \phi_{i0}^A, \phi_{i1}^A, etc.

I want to create a macro such that ^A is appended automatically and I don't have to type it in, e.g. \phispecial_{i0} would produce the same result.

So far I've tried \DeclareMathOperator{\phispecial}*{\phi^A} but that produces misaligned results. Do I have to use \newcommand instead?

  • 1
    (1) welcome, (2) \newcommand\phiA{\phi^A} would be enough, no need to tell it to be an operator as it probably is not. – daleif Aug 5 '16 at 13:30
  • (1) thank you, (2) works like a charm :) – Aleksandar Bojchevski Aug 5 '16 at 13:31
  • Yes, \newcommand would be OK for that. – Bernard Aug 5 '16 at 13:32
2

Here there is no need for \DeclareMathOperator as this is probably not somethig that needs to behave like \log and friends. So

\newcommand\phiA{\phi^A}

is enough since A_b^c = A^c_b

0

Please define like below

\newcommand\phiA[1][A]{\phi^A}

and try

  • Why the optional argument? – egreg Aug 5 '16 at 14:17
  • Perhaps you mean \newcommand\phiA[1][A]{\phi^{#1}}, so as to possibly use the optional argument? – Steven B. Segletes Aug 5 '16 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.