# How do I make customized $\sum$ operator?

How can I create the following symbols?

\circlearrowleft or \circlearrowright centered in \sum operator.

EDITED:

So,

In \usepackage{esint} package, \ointclockwise and \ointctrclockwise; how to add closed \circlearrowleft or closed \circlearrowright? Will have we use tikz?

Are there like \clockwise and \ctrclockwise commands?

• I'm not sure I can find closed circle arrow, sorry. MnSymbols has “less open” ones. Oct 30, 2015 at 17:35
• Ok. I saw. I'll try it. Oct 30, 2015 at 17:38
• I added a TikZ version (maybe it can be improved). Oct 31, 2015 at 0:16

Here's a possibility. Only text and display style, I hope you don't need them in subscripts, superscripts or small fractions.

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

\makeatletter
\newcommand*{\sumcirclearrowleft}{%
\DOTSB
\mathop{
\mathchoice
{\rlap{\kern.25em\rotatebox[origin=c]{-90}{$\circlearrowleft$}}{\sum}}
{\vcenter{\rlap{\kern.2em\rotatebox[origin=c]{-90}{$\scriptscriptstyle\circlearrowleft$}}}{\sum}}
{\sum}{\sum}
}\slimits@
}

\newcommand*{\sumcirclearrowright}{%
\DOTSB
\mathop{
\mathchoice
{\rlap{\kern.25em\rotatebox[origin=c]{90}{$\circlearrowright$}}{\sum}}
{\vcenter{\rlap{\kern.2em\rotatebox[origin=c]{90}{$\scriptscriptstyle\circlearrowright$}}}{\sum}}
{\sum}{\sum}
}\slimits@
}
\makeatother

\begin{document}

$\sumcirclearrowleft\displaystyle\sumcirclearrowleft$

$\sumcirclearrowright\displaystyle\sumcirclearrowright$

$\sumcirclearrowleft_{i=1}^n \displaystyle\sumcirclearrowleft_{i=1}^n$

\end{document}


## Alternative version with closed circles

I found a TikZ version (still working only in text and display style), with Qrrbrbirlbel's code in https://tex.stackexchange.com/a/95263/4427 (modified).

\documentclass{article}
\usepackage{amsmath,amssymb,tikz}
\usetikzlibrary{arrows.meta,bending}

\makeatletter
\tikzset{
/qrr/circle arrow/.cd,
start angle/.initial={},
delta angle/.initial={},
end angle/.initial={},
arrows/.estore in=\qrr@ca@arrow,
arrows=-
}
\pgfdeclareshape{circle arrow}{
\inheritsavedanchors[from=circle] \inheritanchorborder[from=circle]
\inheritanchor[from=circle]{north}      \inheritanchor[from=circle]{north west}
\inheritanchor[from=circle]{north east} \inheritanchor[from=circle]{center}
\inheritanchor[from=circle]{west}       \inheritanchor[from=circle]{east}
\inheritanchor[from=circle]{mid}        \inheritanchor[from=circle]{mid west}
\inheritanchor[from=circle]{mid east}   \inheritanchor[from=circle]{base}
\inheritanchor[from=circle]{base west}  \inheritanchor[from=circle]{base east}
\inheritanchor[from=circle]{south}      \inheritanchor[from=circle]{south west}
\inheritanchor[from=circle]{south east}
\backgroundpath{
\pgfkeysgetvalue{/qrr/circle arrow/start angle}\qrr@ca@s
\pgfkeysgetvalue{/qrr/circle arrow/end angle}\qrr@ca@e
\pgfkeysgetvalue{/qrr/circle arrow/delta angle}\qrr@ca@d
\ifx\qrr@ca@s\pgfutil@empty%
\pgfmathsetmacro\qrr@ca@s{\qrr@ca@e-\qrr@ca@d}%
\else
\ifx\qrr@ca@e\pgfutil@empty%
\pgfmathsetmacro\qrr@ca@e{\qrr@ca@s+\qrr@ca@d}%
\fi%
\fi
\pgfkeys{/tikz/arrows/.expand once=\qrr@ca@arrow}%
}
}
\tikzset{% the first two styles are internal, they do not work alone!
turn left/.style={
/tikz/shape=circle arrow,
/qrr/circle arrow/arrows={->[flex']},
/qrr/circle arrow/delta angle=370
},
turn right/.style={
/tikz/shape=circle arrow,
/qrr/circle arrow/arrows={<[flex']-},
/qrr/circle arrow/delta angle=370},
turn left east/.style  = {/tikz/turn left,  /qrr/circle arrow/start angle=20},
turn right west/.style = {/tikz/turn right, /qrr/circle arrow/start angle=160},
}

\newcommand*{\sumcirclearrowleft}{%
\DOTSB
\mathop{\mathpalette\sumcirclearrow@{left east}}
\slimits@
}
\newcommand*{\sumcirclearrowright}{%
\DOTSB
\mathop{\mathpalette\sumcirclearrow@{right west}}
\slimits@
}
\newcommand{\sumcirclearrow@}[2]{%
\sbox\z@{$\m@th#1\sum$}%
\dimen@=.14\wd\z@
\makecirclearrow@{#2}
{\sum}%
}

\newcommand{\makecirclearrow@}[1]{%
\rlap{\kern\dimen@$\m@th\vcenter{\hbox{% \begin{tikzpicture}[ >={Classical TikZ Rightarrow[width=2pt]}, ] \node[draw,inner sep=\dimen@,turn #1] {}; \end{tikzpicture}% }}$}%
}

\makeatother

\begin{document}

$\sumcirclearrowleft\displaystyle\sumcirclearrowleft$

$\sumcirclearrowright\displaystyle\sumcirclearrowright$

$\sumcirclearrowleft_{i=1}^n \displaystyle\sumcirclearrowleft_{i=1}^n$

\end{document}


• It's working for me. @egreg. Oct 30, 2015 at 0:07

An alternative that works in all math styles...

REVISED SOLUTION (closed circle-arrow)

This is something of a stretch, and so I leave my original solution below. The OP wanted the circle-arrow part of the result to be a closed (not open) circle. Ideally, one could locate such a glyph and substitute its use for the other. However, no such glyph could be located. I was able to make one by superposition, but only in \displaystyle, so I had to use additional tricks to scale it for the relevant math style. As such, I do not consider this approach ideal.

\documentclass{scrartcl}
\usepackage{stackengine,scalerel,graphicx,amssymb,amsmath,wasysym}
\newsavebox\closedcircleleft
\newsavebox\closedcircleright
\savestack\closedcircleleft{\stackinset{c}{}{c}{}{$\Circle$}{$\circlearrowleft$}}
\savestack\closedcircleright{\stackinset{c}{}{c}{}{$\Circle$}{$\circlearrowright$}}
\DeclareMathOperator*{\sumcirclearrowleft}{%
\ThisStyle{\mathop{\ensurestackMath{\stackinset{c}{-1.5\LMpt}{c}{}{%
\rotatebox[origin=lb]{-90}{$\SavedStyle\scalerel*{\closedcircleleft}{% i}$}}{\SavedStyle\sum}}}}}
\DeclareMathOperator*{\sumcirclearrowright}{%
\ThisStyle{\mathop{\ensurestackMath{\stackinset{c}{-1.5\LMpt}{c}{}{%
\rotatebox[origin=lb]{90}{$\SavedStyle\scalerel*{\closedcircleright}{% i}$}}{\SavedStyle\sum}}}}}
\begin{document}
$\displaystyle\sumcirclearrowleft_i^n \textstyle\sumcirclearrowleft_i^n \scriptstyle\sumcirclearrowleft_i^n \scriptscriptstyle\sumcirclearrowleft_i^n$
\medskip

$\displaystyle\sumcirclearrowright_i^n \textstyle\sumcirclearrowright_i^n \scriptstyle\sumcirclearrowright_i^n \scriptscriptstyle\sumcirclearrowright_i^n$
\end{document}


ORIGINAL SOLUTION (open circle-arrow)

\documentclass{scrartcl}
\usepackage{stackengine,scalerel,graphicx,amssymb,amsmath}
\DeclareMathOperator*{\sumcirclearrowleft}{%
\ThisStyle{\mathop{\ensurestackMath{\stackinset{c}{-1.7\LMpt}{c}{.4pt}{%
\rotatebox[origin=lb]{-90}{$\SavedStyle\circlearrowleft$}}{\SavedStyle\sum}}}}}
\DeclareMathOperator*{\sumcirclearrowright}{%
\ThisStyle{\mathop{\ensurestackMath{\stackinset{c}{-1.7\LMpt}{c}{.1pt}{%
\rotatebox[origin=lb]{90}{$\SavedStyle\circlearrowright$}}{\SavedStyle\sum}}}}}
\begin{document}

$\displaystyle\sumcirclearrowleft_i^n \textstyle\sumcirclearrowleft_i^n \scriptstyle\sumcirclearrowleft_i^n \scriptscriptstyle\sumcirclearrowleft_i^n$
\medskip

$\displaystyle\sumcirclearrowright_i^n \textstyle\sumcirclearrowright_i^n \scriptstyle\sumcirclearrowright_i^n \scriptscriptstyle\sumcirclearrowright_i^n$

\end{document}


If one prefers smaller circle-arrows,

\documentclass{scrartcl}
\usepackage{stackengine,scalerel,graphicx,amssymb,amsmath}
\DeclareMathOperator*{\sumcirclearrowleft}{%
\ThisStyle{\mathop{\ensurestackMath{\stackinset{c}{-1.5\LMpt}{c}%
{\dimexpr.9pt-.3\LMpt}{%
\rotatebox[origin=lb]{-90}{$\SavedStyle_\circlearrowleft$}}{\SavedStyle\sum}}}}}
\DeclareMathOperator*{\sumcirclearrowright}{%
\ThisStyle{\mathop{\ensurestackMath{\stackinset{c}{-1.5\LMpt}{c}{.2pt}{%
\rotatebox[origin=lb]{90}{$\SavedStyle_\circlearrowright$}}{\SavedStyle\sum}}}}}
\begin{document}

$\displaystyle\sumcirclearrowleft_i^n \textstyle\sumcirclearrowleft_i^n \scriptstyle\sumcirclearrowleft_i^n \scriptscriptstyle\sumcirclearrowleft_i^n$
\medskip

$\displaystyle\sumcirclearrowright_i^n \textstyle\sumcirclearrowright_i^n \scriptstyle\sumcirclearrowright_i^n \scriptscriptstyle\sumcirclearrowright_i^n$

\end{document}


• It's working, Please see edited my question. Oct 30, 2015 at 17:33
• @Özgür Please see my revision. Not ideal, but it may suffice. Oct 30, 2015 at 22:54