11

In Latex, in math mode, if I want to express summation over a range I can use the following expression \sum_{from}^{to}. I can do the same for the product.

What is the name of the symbol that does this for XOR or concatenation?

If I do:

\oplus_{i=0}^7

I don't get the i=0 and 7 parts below and above the symbol, respectively, but to the right instead, like this:

bulkxor

With summation (\sum_{i=0}^7), that is not the case - they appear below and below in the output:

bulksum

How can I make XOR, or concatenation (II) larger and with indices below and above the symbol?

3 Answers 3

19

You want to use \bigoplus instead of \oplus.

I've never seen concatenation done that way. Addition and XOR are commutative operations so it makes sense to sum over a set (or take the exclusive OR of a set). Concatenation is not like that. I think I would explicitly write out the concatenation. That said, you can use \bigparallel from the stmaryrd package.

\documentclass{article}
\usepackage{amsmath}
\usepackage{stmaryrd}
\newcommand*\concat{\mathbin{\|}}
\begin{document}
\[x_1\concat x_2\concat\dotsb\concat x_n\]
\[\bigparallel_{i=1}^n x_i\]
\end{document}

enter image description here

4
  • I saw these guys using concatenation summation: schneier.com/skein.pdf, pages 17,18.
    – axel22
    Commented Jun 14, 2011 at 9:25
  • @axel22: Interesting. I'd never seen that before. Let me update my answer.
    – TH.
    Commented Jun 14, 2011 at 9:34
  • 2
    I don’t see why the non-commutativity of the concatenation should disqualify it for this notation. In functional programming, a reduction of character strings via concatenation is a well-defined operation, and defined in the same way as a sum. We’re not talking about sets here, we’re talking about (well-ordered) sequences. Commented Jun 14, 2011 at 12:19
  • 2
    @Konrad: Fair enough. One might write $\sum_{x\in S}x$. A similar expression would be meaningless for concatenation. That's all I was saying. In this case, you're right that there's a canonical well order imposed by the indexing.
    – TH.
    Commented Jun 14, 2011 at 12:39
4

The usual way to get a larger \oplus symbol that takes limits above and below in display math mode is with \bigoplus. However this symbol might appear too big; a not-so-large symbol can be obtained by

\newcommand{\bigxor}{\mathop{\mathchoice
  {\textstyle\bigoplus}{\textstyle\bigoplus}
  {\scriptstyle\bigoplus}{\scriptscriptstyle\bigoplus}}}

For a concatenation big symbol one can do a similar thing:

\newcommand{\bigconc}{\mathop{\mathpalette\bigconcinn\relax}}
\newcommand{\bigconcinn}[2]{%
  \vcenter{\hbox{$\bigconcchoose#1\bigconcsize|\mkern1mu\bigconcsize|$}}}
\newcommand{\bigconcchoose}[1]{\def\bigconcsize{}%
  \ifx#1\displaystyle
    \let\bigconcsize\Big
  \else
    \ifx#1\textstyle
      \let\bigconcsize\big
    \fi
  \fi#1}

Now \bigconc will behave like \sum:

\[ \bigconc_{i=0}^{3} X_{i} \]
3

You can use the \DeclareMathOperator* command that defines operator with super/subscripts above/below itself:

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator*{\OPLUS}{\oplus}
\begin{document}
\[ \OPLUS^a_b \]
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .