How do I type a modular addition symbol or an XOR symbol the same way as a summation symbol in MathJax? It's for indicating use of the operation over a sequence of numbers.
2 Answers
$\bigoplus\limits_{i=0}^n x_i$
$\bigoplus\limits_{i=0}^n x_i$
$\operatorname{\boxplus}\limits_{i=0}^n x_i$
$\operatorname{\boxplus}\limits_{i=0}^n x_i$
-
1$\begingroup$ Nice! I did not knew
\limits
. I use$$\bigoplus_{i=0}^n x_i$$
for$$\bigoplus_{i=0}^n x_i$$or, when inline,$\displaystyle\bigoplus_{i=0}^n x_i$
for $\displaystyle\bigoplus_{i=0}^n x_i$ rather than$\bigoplus_{i=0}^n x_i$
for $\bigoplus_{i=0}^n x_i$.$$$$I find no way to force displaystyle for\operatorname{\boxplus}
: for some reason, even$$\displaystyle\operatorname{\boxplus}\limits_{i=0}^n x_i$$
gives$$\displaystyle\operatorname{\boxplus}\limits_{i=0}^n x_i$$But I'm getting verbose these days, even in comments! $\endgroup$– fgrieu ModCommented Sep 13, 2017 at 8:33
Use \operatorname*{...}
if you want to be able to use limits with it (and have it change with display versus text styles automatically.
You might also want to enlarge the size of the symbol using something like \huge\boxplus
. Then you may also want to center the symbol on the math axis (like other big operators), via \vcenter{...}
. So something like
$$\operatorname*{\vcenter{\huge\boxplus}}_{i=0}^n x_i$$
produces $$\operatorname*{\vcenter{\huge\boxplus}}_{i=0}^n x_i$$ and that may be what you are looking for.
If you are going to use it a lot, you could use
$\DeclareMathOperator*{\bigboxplus}{\vcenter{\Large\boxplus}}$
so that then \bigboxplus
can be used as you would \bigoplus
. The difference would be that the size will not change between display and text styles as standard big operators do. If you want that, this is one way (where I've picked the sizes to match as closely as I can the corresponding sizes of \bigoplus
).
$\DeclareMathOperator*{\bigboxplus}{\vcenter{\mathchoice{\huge\boxplus}{\Large\boxplus}{\Large\boxplus}{\Large\boxplus}}}$
to get
$$ \DeclareMathOperator*{\bigboxplus}{\vcenter{\mathchoice{\huge\boxplus}{\Large\boxplus}{\Large\boxplus}{\Large\boxplus}}} \bigboxplus_{i=0}^n x_i \quad \textstyle \bigboxplus_{i=0}^n x_i \quad \scriptstyle \bigboxplus_{i=0}^n x_i \quad \scriptscriptstyle \bigboxplus_{i=0}^n x_i $$
$$ \bigoplus_{i=0}^n x_i \quad \textstyle \bigoplus_{i=0}^n x_i \quad \scriptstyle \bigoplus_{i=0}^n x_i \quad \scriptscriptstyle \bigoplus_{i=0}^n x_i $$
Hope that suits your needs.
-
$\begingroup$ Anyway to get the operator aligned to the left instead of the center? Removing
\vcenter
makes the bounds appear to the right of the operator. $\endgroup$– MelabCommented Sep 25, 2017 at 16:06 -
$\begingroup$ I don't understand what you are asking for. The
\vcenter
is for vertical centering, as in $$\operatorname*{\vcenter{\huge\boxplus}}_{i=0}^n x_i\qquad\hbox{versus}\qquad \operatorname*{\huge\boxplus}_{i=0}^n x_i$$ but you seem to be talking about horizontal centering. The\vcenter
does not affect the placement of the limits; that has to do with whether the operator is used in display or text (in-line) math. $\endgroup$ Commented Sep 25, 2017 at 19:30 -
$\begingroup$ If I use a single dollar sign for a delimiter, then the boxed plus is shifted to the left of the minimum and maximum. $\endgroup$– MelabCommented Feb 8, 2018 at 7:27
-
$\begingroup$ That is correct, and is how it is shown in the last examples in the post itself. In in-line math (single dollars), limits are shown to the right of the base: e.g., $\sum_{n=0}^\infty$. Limits only appear above and below in display mode (double dollars, or when
\displaystyle
is used: e.g., $\displaystyle\sum_{n=0}^\infty$. The\DeclareMathOperator*
macro makes operators that work in the same way. $\endgroup$ Commented Feb 8, 2018 at 10:06