5

Is there a convention for an average sum symbol, for instance \overline{\sum_{i \in I}} to mean \frac{1}{\#I} \sum_{i \in I}?

I can live with the overline option but it does not look good in inline mode as is.

How to typeset a sum symbol with a vertical bar across it?

EDIT: Following the answers given, let me add the requirement that the user should not be concerned whether the symbol is used in inline or display mode, and also stress that the vertical bar should be across the sum symbol (like the horizontal bar is across the integral sign in \fint).

2
  • Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – user31729
    Mar 24, 2014 at 15:44
  • 1
    The traditional symbol is $E$, called the expectation value, but sometimes people use angle brackets to denote average, like $\left<X\right>$. Mar 25, 2014 at 12:17

3 Answers 3

7

Here's an implementation with \ooalign:

\documentclass{article}
\usepackage{amsmath}

\newcommand{\avsum}{\mathop{\mathpalette\avsuminner\relax}\displaylimits}

\makeatletter
\newcommand\avsuminner[2]{%
  {\sbox0{$\m@th#1\sum$}%
   \vphantom{\usebox0}%
   \ooalign{%
     \hidewidth
     \smash{\vrule height\dimexpr\ht0+1pt\relax depth\dimexpr\dp0+1pt\relax}%
     \hidewidth\cr
     $\m@th#1\sum$\cr
   }%
  }%
}
\makeatother

\begin{document}
\[
\sum_{i=1}^{m} \avsum_{j=1}^{n} a_{ij}
\]
\[
\textstyle\sum_{i=1}^{m} \avsum_{j=1}^{n} a_{ij}
\]
\[
\scriptstyle\sum_{i=1}^{m} \avsum_{j=1}^{n} a_{ij}
\]
\[
\scriptscriptstyle\sum_{i=1}^{m} \avsum_{j=1}^{n} a_{ij}
\]
\end{document}

enter image description here

1
5

It is not clear from your question what height/thickness vertical bar you desire, but since this answer uses a rule, you can tune it to suit your needs. Superscripts in displaystyle are a little different, but might be OK.

Were you to use it often, one could opt to employ \DeclareMathOperator to save typing.

\documentclass{report}
\usepackage{stackengine}
\stackMath
\begin{document}

\centering $\mathop{\stackon[-2pt]{\sum}{\rule{.3pt}{1ex}}}_{i \in I}$

\[
\mathop{\stackon[-2pt]{\sum}{\rule{.3pt}{1ex}}}_{i \in I}
\]
\end{document}

enter image description here

Variations are trivial. For example, \[\mathop{\stackon[-2.7ex]{\sum}{\rule{.4pt}{3ex}}}_{i \in I}^2\] yields

enter image description here`


And since egreg offers a solution that scales with the mathstyle, here is my version that does the same:

\documentclass{report}
\usepackage{stackengine}
\usepackage{amsmath}
\def\asum{\mathop{\mathchoice%
  {\stackon[-3.8ex]{\displaystyle\sum}{\smash{\rule{.4pt}{4ex}}}}%
  {\stackon[-2.6ex]{\textstyle\sum}{\smash{\rule{.4pt}{2.9ex}}}}%
  {\stackon[-1.9ex]{\scriptstyle\sum}{\smash{\rule{.4pt}{2.2ex}}}}%
  {\stackon[-1.4ex]{\scriptscriptstyle\sum}{\smash{\rule{.4pt}{1.7ex}}}}%
}}
\stackMath
\begin{document}
\[\sum_{i=1}^m \asum_{j=1}^n a_{ij}\]
\[\textstyle \sum_{i=1}^m \asum_{j=1}^n a_{ij}\]
\[\scriptstyle\sum_{i=1}^m \asum_{j=1}^n a_{ij}\]
\[\scriptscriptstyle\sum_{i=1}^m \asum_{j=1}^n a_{ij}\]
\end{document}

enter image description here

3
  • please see the edit to the question
    – user66081
    Mar 24, 2014 at 15:59
  • @user66081 Please see revised answer. Is this more in line, or do you want the stroke to extend the complete length of the sum? Mar 24, 2014 at 16:02
  • yes; looks promising.
    – user66081
    Mar 24, 2014 at 16:08
1
\documentclass{report}
\usepackage{amsmath}
\begin{document}   
\[
  \sum\limits^{\vbox to 0pt{\hbox{\rule{.5pt}{1ex}}}}_{i \in I} 
\]

\[
  \sum\limits^{\vbox to 0pt{\hbox{\,\rule{.5pt}{2em}}}}_{i \in I} 
\]
\end{document}

enter image description here

You must log in to answer this question.

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