How can I define a big plus operator that works like \bigcup?

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


One can easily make the “big plus” the same size as \sum:

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}

\makeatletter
\newcommand{\bigplus}{%
  \DOTSB\mathop{\mathpalette\mattos@bigplus\relax}\slimits@
}
\newcommand\mattos@bigplus[2]{%
  \vcenter{\hbox{%
    \sbox\z@{$#1\sum$}%
    \resizebox{!}{0.9\dimexpr\ht\z@+\dp\z@}{\raisebox{\depth}{$\m@th#1+$}}%
  }}%
  \vphantom{\sum}%
}
\makeatother

\begin{document}

\begin{center}% test bounding box
\setlength{\fboxsep}{0pt}
\fbox{$\displaystyle\sum$} \fbox{$\displaystyle\bigplus$}
\end{center}

\[
\sum_{i=1}^m\bigplus_{j=1}^n\dots\bigplus_{k=1}^p x_{ijk}
\]
\begin{center}% to test text style
$\sum_{i=1}^m\bigplus_{j=1}^n\dots\bigplus_{k=1}^p x_{ijk}$
\end{center}

\LARGE % test for sizes
\[
\sum_{i=1}^m\bigplus_{j=1}^n\dots\bigplus_{k=1}^p x_{ijk}
\]
\begin{center}% to test text style
$\sum_{i=1}^m\bigplus_{j=1}^n\dots\bigplus_{k=1}^p x_{ijk}$
\end{center}

\end{document}

enter image description here


You cannot copy LaTeX3 code into your preamble without taking appropriate preliminary actions. I’m showing below how the same idea could be implemented through LaTeX2e code. This solution also supports standard amsmath behavior with respect to dots and the [no]sumlimits option:

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{amsmath}

\makeatletter

\newcommand*\@bigplus[1]{\vcenter{\hbox{#1$\m@th +$}}}
\newcommand*\bigplus{%
    \DOTSB % omit this line if you are not using the amsmath package
    \mathop{%
        \mathchoice
            {\@bigplus \huge}%
            {\@bigplus \LARGE}%
            {\@bigplus {}}%
            {\@bigplus \footnotesize}%
    }%
    \slimits@ % omit this line if you are not using the amsmath package
}

\makeatother



\begin{document}

In-line: \( \bigplus_{i=3}^{6} f^2(i) \).
Displayed: \[ \bigplus_{i=3}^{6} f^2(i) \]
Behavior with dots:
\[
    \bigplus_{i_{1}=0}^{n_{1}}\dots\bigplus_{i_{k}=0}^{n_{k}}
        f(i_{1},\dots,i_{k})
\]

\end{document}

This is the output:

Output of the code


Addition

As @egreg has pointed out in his comment, the above answer—which, however, merely mimics what the mathtools package does for \bigtimes—is buggy. The correct solution is to use the mathabx package, which, contrary to what is stated in the question, does provide the \bigplus “large operator”. This solution uses characters drawn from fonts specifically designed for the purpose and, hence, does not depend on the extensions provided by the graphics/graphicx package; in particular, it works also with DVI output (for what this is worth).

If you don’t like the changes that the mathabx package applies to mathematical symbols in general, you can always load the appropriate fonts yourself and define only the commands you are interested in. The following example defines \bigplus as well as \bigtimes. Allow me a few remarks:

  • the code supports the features of the amsmath package concerning dots and “limits”, if that package is loaded;

  • contrary to what the mathabx package itself does, the mathx font family is defined in such a way to take advantage of the smaller font sizes installed in today’s distributions.

The latter contrivance permits to improve the output at sizes smaller than 10 points, making it look better than it does in solutions that use graphics scaling.

Here is the code:

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{amsmath} % comment out to see changes

\DeclareFontFamily{U}{mathx}{\hyphenchar\font45}
\DeclareFontShape{U}{mathx}{m}{n}{
    <5> <6> <7> <8> <9> <10> gen * mathx
    <10.95> mathx10
    <12> <14.4> <17.28> <20.74> <24.88> mathx12
}{}
\DeclareFontSubstitution{U}{mathx}{m}{n}
\DeclareSymbolFont{mathx}{U}{mathx}{m}{n}
\DeclareMathSymbol{\bigplus} {\mathop}{mathx}{"90}
\DeclareMathSymbol{\bigtimes}{\mathop}{mathx}{"91}

\makeatletter

\@ifpackageloaded{amsmath}{%
    \@ifundefined{coprod@}{}{
        \typeout{*** Applying amsmath patches to \protect\bigplus\space
                    and \protect\bigtimes. ***}
        \global\let\bigplus@\bigplus
        \gdef\bigplus{\DOTSB\bigplus@\slimits@}
        \global\let\bigtimes@\bigtimes
        \gdef\bigtimes{\DOTSB\bigtimes@\slimits@}
    }
}{}

\makeatother



\begin{document}

In-line: \( \bigplus_{i=3}^{6} f^2(i) \).
Displayed: \[ \bigplus_{i=3}^{6} f^2(i) \]
Behavior with dots:
\[
    \bigplus_{i_{1}=0}^{n_{1}}\dots\bigplus_{i_{k}=0}^{n_{k}}
        f(i_{1},\dots,i_{k})
\]

In-line: \( \bigtimes_{i=3}^{6} f^2(i) \).
Displayed: \[ \bigtimes_{i=3}^{6} f^2(i) \]
Behavior with dots:
\[
    \bigtimes_{i_{1}=0}^{n_{1}}\dots\bigtimes_{i_{k}=0}^{n_{k}}
        f(i_{1},\dots,i_{k})
\]

Now it works in footnotes too.\footnote{As this example shows.
In-line: \( \bigplus_{i=0}^{n} f(i) \), \( \bigtimes_{i=0}^{n} f(i) \).
Displayed: \[ \bigplus_{i=0}^{n} f(i) \ne \bigtimes_{i=0}^{n} f(i) \]
That's good!}

\LARGE
\verb|\LARGE| text.
In-line: \( \bigtimes_{i=3}^{6} f^2(i) \).
Displayed: \[ \bigtimes_{i=3}^{6} f^2(i) \]
Behavior with dots:
\[
    \bigtimes_{i_{1}=0}^{n_{1}}\dots\bigtimes_{i_{k}=0}^{n_{k}}
        f(i_{1},\dots,i_{k})
\]

\end{document}

And here is the output it yields:

Output of the second code sample