$\DeclareMathOperator{\A}{\vcenter{\LARGE\mathrm A}}\DeclareMathOperator*{\varA}{\vcenter{\mathchoice{\LARGE\text{A}}{\Large\text{A}}{\Large\text{A}}{\large\text{A}}}}\DeclareMathOperator*{\varvarA}{\vphantom{\sum}\vcenter{\mathchoice{\LARGE\text{A}}{\Large\text{A}}{\Large\text{A}}{\large\text{A}}}}$Basically @DavideCervone's answer has solved the aligning issue, but I would like to add a few more words on some other aspects of defining a new operator.
The definition \DeclareMathOperator{\A}{\vcenter{\LARGE\mathrm A}}
works fine in display style, but not so in text style: \sum\limits_{k = 1}^n
and \A\limits_{k = 1}^n
render as $\sum\limits_{k = 1}^n$ and $\A\limits_{k = 1}^n$, respectively (Note that the sizes mismatch and \limits
fails).
To make \limits
work, \DeclareMathOperator*
should be used in place of \DeclareMathOperator
. And to make the size match, \mathchoice
should be used in the definition:
\DeclareMathOperator*{\varA}{\vcenter{\mathchoice{%
\LARGE\text{A}}{%
\Large\text{A}}{%
\Large\text{A}}{%
\large\text{A}}}}
Test: Display: $\displaystyle \sum\limits_{k = 1}^n \quad \varA\limits_{k = 1}^n$, text: $\sum\limits_{k = 1}^n \quad \varA\limits_{k = 1}^n$, script: $\scriptstyle \sum\limits_{k = 1}^n \quad \varA\limits_{k = 1}^n$, scriptscript: $\scriptscriptstyle \sum\limits_{k = 1}^n \quad \varA\limits_{k = 1}^n$.
In order to further align the upper and lower limits of self-defined operators with \sum
, here is a way:
\DeclareMathOperator*{\varvarA}{%
\vphantom{\sum}\vcenter{\mathchoice{%
\LARGE\text{A}}{%
\Large\text{A}}{%
\Large\text{A}}{%
\large\text{A}}}}
Test: Display: $\displaystyle \sum\limits_{k = 1}^n \quad \varvarA\limits_{k = 1}^n$, text: $\sum\limits_{k = 1}^n \quad \varvarA\limits_{k = 1}^n$, script: $\scriptstyle \sum\limits_{k = 1}^n \quad \varvarA\limits_{k = 1}^n$, scriptscript: $\scriptscriptstyle \sum\limits_{k = 1}^n \quad \varvarA\limits_{k = 1}^n$.