7

I would like to know how I can obtain the 'modulo two sum' sign (unicode 2A0A i.e., the letter sigma with a circle in its middle).

enter image description here

I know I can obtain it by using the unicode-math package. But does anybody know an alternative method to obtain it? For information, I use TexMaker. Thanks for answering me. Best regards.

percusse
  • 157,807
Robert
  • 73

3 Answers3

5

Here's an alternative that uses TikZ. With the amsmath and tikz packages loaded, put the following in your preamble

\newcommand\constructosum[3]{%
    \begin{tikzpicture}[baseline=(char.base), inner sep=0, outer sep=0]
        \draw (#1,0) circle (#2); 
        \node (char) at (0,0) {$#3\sum$}; % Want to define a second symbol for inline...
    \end{tikzpicture}%
}

\newcommand{\modtwosum}{\mathop{\mathchoice
        {\constructosum{-0.3ex}{0.1}{\displaystyle}}
        {\constructosum{-0.3ex}{0.06}{\textstyle}}
        {\constructosum{-0.2ex}{0.04}{\scriptstyle}}
        {\constructosum{-0.15ex}{0.03}{\scriptscriptstyle}}
    }\displaylimits
}

This defines four operators corresponding to display style math environments, inline math, script size math and script script size math in that order. Each has a coordinate for the loop which may be adjusted, and a size for the loop. For example the display style version has

\constructosum{-0.3ex}{0.1}{\displaystyle}

which places the loop at -0.3ex (moves it horizontally backwards a bit) with a radius of 0.1cm. To use it, simply use the new operator \modtwosum inside any math environment. e.g.

\[
G=\modtwosum_a^b H
\]

A demo of this operator in each of the four situations that may occur:

enter image description here

Thanks goes to egreg for pointing out that I could reduce the original version of this with a helper \newcommand to contain the TikZ code.

qubyte
  • 17,299
  • That's OK. When using the displaymath mode (and not the math mode), the letters and the circle appear at their right places in the 2nd solution. For the first, even in displaymath, the circle is slightly moved to the right with regard to its expected position. Thanks a lot. – Robert Mar 01 '12 at 14:44
  • What you mean? displaymath is math mode. You'll have to define a second symbol for inline math though, but this will be just a variation on the above. – qubyte Mar 01 '12 at 14:58
  • displamath : \begin{displaymath} ... \end{displaymath} and math : $ ... $ – Robert Mar 01 '12 at 15:01
  • My code will work in all equation environments except $...$ style inlines. These include the usual \[...\], equation, align etc. – qubyte Mar 01 '12 at 15:05
  • Please note that $...$ is usually referred to as inline math, not simply math. Display style math is naturally assumed unless otherwise stated. Secondly, it is normal for the a and b to appear to the right of the sum symbol in inline math, in order to save vertical space (try $G=\sum_a^b$ and you see the same behaviour). – qubyte Mar 01 '12 at 15:37
  • I've copied that! Thanks a lot for your expertise and your help. Same thing to you diabonas. – Robert Mar 01 '12 at 16:33
  • @Robert: I've reduced it down to a final version that makes it easier to tweak. – qubyte Mar 01 '12 at 16:40
  • @Robert: No problem. Just remember to upvote the answers that helped and to accept an answer when you've settled on a one that works for you. :) – qubyte Mar 01 '12 at 16:43
  • 2
    @MarkS.Everitt I wouldn't use \DeclareMathOperator*, but \mathop and \displaylimits. The macro is intended for defining "text" operators, rather than symbols, and does many things which are useless here. – egreg Mar 01 '12 at 23:51
  • You're right. Is displaylimits needed though? I just modified my code and it doesn't seem necessary. – qubyte Mar 01 '12 at 23:57
  • @MarkS.Everitt It's actually the default, but it's clearer to add it, IMO, so that it's evident what the wanted action is. – egreg Mar 02 '12 at 00:06
  • @egreg: A very good point! – qubyte Mar 02 '12 at 00:12
5

The fdsymbol package provides this symbol as \osum or \modtwosum:

\documentclass{article}
\usepackage{fdsymbol}
\begin{document}
$\modtwosum$
\end{document}

Result:

the \modtwosum symbol as provided by fdsymbol

However, this changes the math font of your whole document. If that's not what you want, you can just import this single symbol without loading fdsymbol:

\documentclass{article}
\usepackage{amsmath}
\DeclareFontFamily{U}{FdSymbolE}{}
\DeclareFontShape{U}{FdSymbolE}{m}{n}{
    <-7.1> s * [1.0] FdSymbolE-Book
    <7.1-> s * [1.0] FdSymbolE-Book
}{}
\DeclareFontShape{U}{FdSymbolE}{b}{n}{
    <-7.1> s * [1.0] FdSymbolE-Medium
    <7.1-> s * [1.0] FdSymbolE-Medium
}{}
\DeclareSymbolFont{fdlargesymbols}{U}{FdSymbolE}{m}{n}
\SetSymbolFont{fdlargesymbols}{bold}{U}{FdSymbolE}{b}{n}
\DeclareMathSymbol{\tosum}{\mathop}{fdlargesymbols}{"3A}
\DeclareMathSymbol{\dosum}{\mathop}{fdlargesymbols}{"3B}
\makeatletter
\def\modtwosum{\DOTSB\tosum\slimits@}
\makeatother
\begin{document}
$\modtwosum$
\end{document}
diabonas
  • 25,784
  • 2
    Doesn't this package completely change the mathematics typeface though? – qubyte Mar 01 '12 at 14:55
  • A compilation error appears at line 1548 in the release I use: "\vec is already defined"... – Robert Mar 01 '12 at 15:21
  • 3
    @MarkS.Everitt You're right, it does replace the whole math alphabet. See my updated answer on how to import only this very symbol, without affecting the rest. – diabonas Mar 01 '12 at 15:39
  • @Robert Most likely one the packages you use is not compatible with fdsymbol (e. g. amssymb). In this case, try my updated solution which doesn't rely on loading fdsymbol to avoid such conflicts. – diabonas Mar 01 '12 at 15:41
1

If you find no other alternative, then perhaps this will work. You'll need to use the mathtools package. Use the following declaration in your preamble:

\DeclareMathOperator*{\osum}{\mathrlap{\hspace{1ex}\circ}{\sum}}

Now you can use the new \osum operator, and it'll behave like the usual \sum operator with respect to subscripts and superscripts.

G=\osum_a^b H

enter image description here

qubyte
  • 17,299