[Tex/LaTex] How to define a big plus operator that works like \bigcup

math-modemath-operatorsmathtools

I want to define a "\bigplus" operator that is a big + symbol that changes size according to environment and has limits, just like \bigcup works. I've read about defining a "\bigtimes" (How can I get a big cross to denote a generalized cartesian product?) but the answer doesn't help me since in package mathabx there's no "\bigplus" command and the package changes many symbols. I found the package mathtools, which has the command \bigtimes, but also no "\bigplus". I found in its source code the command

\def\MH_bigtimes_scaler:N #1{%
  \vcenter{\hbox{#1$\m@th\mkern-2mu\times\mkern-2mu$}}}
\def\MH_bigtimes_inner: {
  \mathchoice{\MH_bigtimes_scaler:N \huge}         % display style
             {\MH_bigtimes_scaler:N \LARGE}        % text style
             {\MH_bigtimes_scaler:N {}}            % script style
             {\MH_bigtimes_scaler:N \footnotesize} % script script style
}
\def\MH_csym_bigtimes: {\mathop{\MH_bigtimes_inner:}\displaylimits}
\AtBeginDocument{
  \providecommand\bigtimes{\MH_csym_bigtimes:}
}

and tried to copy it, changing \times for + or plus when necessary, and then pasted it in my preamble, but it does not work. If I copy it under the code itself it works, but I don't want to change the code, obviously. I'm looking for a way to define operator commands in general from symbols I already have, like +, since that would help me a lot.

Best Answer

A rip-off of my answer at How are big operators defined?. Two completely separate macros are provided (\foo and \barr), depending on whether one wishes the \displaystyle version to grow bigger or stay the same size as \textstyle.

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator*{\foo}{\scalerel*{+}{\sum}}
\DeclareMathOperator*{\barr}{\scalerel*{+}{\textstyle\sum}}
\usepackage{scalerel}

\begin{document}
\[
\foo_{i=3}^{6}(f^2(i))
\]

This is inline: \(\foo_{i=3}^{6}(f^2(i)) \)

\[
\barr_{i=3}^{6}(f^2(i))
\]

This is inline: \(\barr_{i=3}^{6}(f^2(i)) \)
\end{document} 

enter image description here

Related Question