# How to create my own math operator with limits?

How can i write my own math operator with limits? I want it to look like: \sum\limits_{e=1}^{m} but with a capital A (if possible bigger than the normal text) instead of the sum. Thanks for the help!

-

## migrated from stackoverflow.comJul 18 '11 at 20:57

This question came from our site for professional and enthusiast programmers.

Thanks for all the answers! really quick, really precise!! –  user6776 Jul 19 '11 at 8:35

Use \mathop to turn A into a "math operator", and then use \limits to do sum-style limits:

 $$\mathop{A}\limits_{e=1}^{m}$$


Do you really want A, or do you want \bigwedge?

-

Use the \DeclareMathOperator* command provided by the amsmath package. Example:

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator*{\Aop}{A}
\begin{document}
$\Aop^a_b$
\end{document}

-
\newcommand{\opA}{\mathop{\vphantom{\sum}\mathchoice
{\vcenter{\hbox{\huge A}}}
{\vcenter{\hbox{\Large A}}}{\mathrm{A}}{\mathrm{A}}}\displaylimits}


In this way the "A" will be as large as the \sum symbol.

-
\documentclass{article}
\usepackage{amsmath}
\def\Aop{\operatornamewithlimits{%
\mathchoice{\vcenter{\hbox{\huge A}}}
{\vcenter{\hbox{\Large A}}}
{\mathrm{A}}
{\mathrm{A}}}}
\begin{document}

$\Aop^a_b \sum_a^b$

$\Aop^a_b \sum_a^b$

\end{document}


-

egreg's answer is fine but works poorly for existing mathematical symbols. I recommend the following:

\newcommand{\operator}[1]{\mathop{\vphantom{\sum}\mathchoice
{\vcenter{\hbox{\huge $#1$}}}
{\vcenter{\hbox{\Large $#1$}}}{#1}{#1}}\displaylimits}


To define an operator 'A', you can now type

\newcommand{\opA}{\operator{\mathrm{A}}}


But you can also define an operator Theta:

\newcommand{\opTheta}{\operator{\Theta}}


Just remember that in the argument you pass to \operator, you are in math mode.

-