[Tex/LaTex] How to make a $\sigma$ the same size as an uppercase $\sum$ with a symbol or letter in the center of the hole of the $\sigma$

math-operators

I am a bit too new to figure out how to simultaneously make something that looks like this:

\sum_a^b

but instead is a lowercase \sigma that has been enlarged so that I can write a little letter inside it.

Essentially I want what's on the left in this image with the normal sigma summation sign to the right for reference as to the size of it.

enter image description here

Best Answer

The blackness of the symbol is not fully satisfying, but here's a possible solution:

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

\makeatletter
\newcommand{\sigmaop}[1]{\mathop{\mathpalette\@sigmaop{#1}}\slimits@}
\newcommand{\@sigmaop}[2]{%
  \vphantom{\sum}%
  \sbox\z@{$\m@th#1\sum$}%
  \dimen@=\ht\z@ \advance\dimen@\dp\z@
  \dimen\tw@=\wd\z@
  \ifx#1\displaystyle\dimen@=.9\dimen@\fi
  \ooalign{%
    \hidewidth
    $\vcenter{\hbox{$\m@th#1#2$\kern.3\dimen\tw@}%
     \ifx#1\scriptstyle\kern-.25ex\fi}$\hidewidth\cr
    $\vcenter{\hbox{%
      \resizebox{!}{\dimen@}{$\m@th\sigma$}%
    }\ifx#1\scriptstyle\kern-.25ex\fi}$\cr
  }%
}
\makeatother

\begin{document}
\[
\sigmaop{s}_{i=1}^n \sum_{i=1}^n
\textstyle \sigmaop{s}\limits_{i=1}^n \sum\limits_{i=1}^n
\scriptstyle \sigmaop{s}\limits_{i=1}^n \sum\limits_{i=1}^n
\]
\end{document}

enter image description here


Some possible refinements, in particular the inner symbol is slightly moved down and it is in script style when the symbol is used in text style.

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

\makeatletter
\newcommand{\sigmaop}[1]{\mathop{\mathpalette\@sigmaop{#1}}\slimits@}
\newcommand{\@sigmaop}[2]{%
  \vphantom{\sum}%
  \sbox\z@{$\m@th#1\sum$}%
  \dimen@=\ht\z@ \advance\dimen@\dp\z@
  \dimen\tw@=\wd\z@
  \ifx#1\displaystyle\dimen@=.9\dimen@\fi
  \ooalign{%
    \hidewidth
    $\vcenter{%
     \vspace{.1\dimen@}%
     \hbox{$\m@th\@demotestyle#1#2$\kern.3\dimen\tw@}%
     \ifx#1\scriptstyle\kern-.25ex\fi}$\hidewidth\cr
    $\vcenter{\hbox{%
      \resizebox{!}{\dimen@}{$\m@th\sigma$}%
    }\ifx#1\scriptstyle\kern-.25ex\fi}$\cr
  }%
}
\newcommand\@demotestyle[1]{%
  \ifx#1\displaystyle
  \else
    \ifx#1\textstyle
      \scriptstyle
    \else
      \scriptscriptstyle
    \fi
  \fi
}
\makeatother

\begin{document}
\[
\sigmaop{s}_{i=1}^n \sum_{i=1}^n
\textstyle \sigmaop{s}\limits_{i=1}^n \sum\limits_{i=1}^n
\scriptstyle \sigmaop{s}\limits_{i=1}^n \sum\limits_{i=1}^n
\]
\[
\sigmaop{t}_{i=1}^n \sum_{i=1}^n
\textstyle \sigmaop{t}\limits_{i=1}^n \sum\limits_{i=1}^n
\scriptstyle \sigmaop{t}\limits_{i=1}^n \sum\limits_{i=1}^n
\]
\[
\sigmaop{g}_{i=1}^n \sum_{i=1}^n
\textstyle \sigmaop{g}\limits_{i=1}^n \sum\limits_{i=1}^n
\scriptstyle \sigmaop{g}\limits_{i=1}^n \sum\limits_{i=1}^n
\]
\end{document}

enter image description here