4

I need to put a long expression under summation symbol in single row. For example like this $(i_1,\ldots,i_n)\in\mathcal{P}(\overline{1,n})$. How can I get a long summation symbol? Long but not tall. Minimal working example is

    \documentclass{article}
    \begin{document}
    \[\sum_{(i_1,\ldots,i_n)\in\mathcal{P}(\overline{1,n})}\]
    \end{document}

I want summation symbol have same length as string under it. Something like this

enter image description here

But, maybe, I ask something unusual and unapplicable.

  • 3
    Welcome to TeX.SX! Could you please turn your code fragment into a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – leandriis Jun 10 '18 at 14:32
  • 9
    I would absolutely avoid to use a symbol like the one you did in the question. – gvgramazio Jun 10 '18 at 18:45
  • 5
    Sorry, but I can't believe you really want that. – egreg Jun 10 '18 at 19:38
  • 4
    I don't understand the negative votes. – Manuel Jun 10 '18 at 19:59
  • 5
    While I think the desired output looks quite terrible and would strongly advise against it (have you ever seen this in a printed work?), I don't think that the three downvotes are deserved. Especially after the edits the question is clear in its intent and I don't think lack of research is a problem here. – moewe Jun 10 '18 at 21:05
12

Don't do this.

Not making it intelligent on purpose. But it could be made intelligent.

\documentclass{article}

\usepackage{adjustbox,expl3,etoolbox}

\letcs\replicate{prg_replicate:nn}

\newcommand*\longsum[1][1]{%
  \mathop{\textnormal{%
    \clipbox{0pt 0pt {.5\width} 0pt}{$\displaystyle\sum$}%
    \replicate{#1}{\clipbox{{.5\width} 0pt {.4\width} 0pt}{$\displaystyle\sum$}}%
    \clipbox{{.6\width} 0pt 0pt 0pt}{$\displaystyle\sum$}}}%
}

\begin{document}

\[
  \longsum[31]_{(i_1,\ldots,i_n)\in\mathcal{P}(\overline{1,n})}
\]

\end{document}

longsum

Here you use \longsum_{like always} but it has an optional argument which repeats a part of the sum to be longer. In your particular case \longsum[31]_{..} seems to do.


Oh, or may be what you want is to reduce space around the \sum symbol? You can do that automatically with \smashoperator, see How to extend the text under summation symbol without making extra space, or manually for middle grounds with \kern-1em \sum_{long expression} \kern-1em (adjust -1em to the size you want).

  • 4
    technical: ok (+1), aesthetic: awfull ... – Zarko Jun 10 '18 at 20:26
  • 2
    Nice, but it seems like the space is not optimally used - maybe the expression can be put inside of the sum? – Marijn Jun 10 '18 at 20:46
  • 1
    @Manuel the summation symbol now sort of looks like an empty frame, so the (i_1, etc. could go in the middle next to the >shaped part of the sigma - it wasn't a fully serious suggestion :) – Marijn Jun 10 '18 at 21:04
  • 4
    +1. Good luck on getting a paper that contains this symbol accepted in any journal that exceeds even a minimal quality threshold and whose editors don't want to become the laughingstock of the entire academic community... – Mico Jun 10 '18 at 21:16
  • 1
    @Mico I actually don't dislike the symbol itself, but in the same vein as what Marijn says, it should be its own notation, not using it for \sum. – Manuel Jun 10 '18 at 21:47
13

Instead of having one fairly long line below the summation symbol, you may want to insert a line break. This can be done with the help of the \substack macro of the amsmath package.

enter image description here

Observe that it isn't really necessary to surround i_1,\dots,i_n with round parentheses.

\documentclass{article}
\usepackage{amsmath} % for "\substack" macro
%% decicated macro "\Pset" -- note the extra spacing around "\overline{...}`
\newcommand\Pset{\mathcal{P}(\mkern1.5mu \overline{1,n} \mkern1.5mu)}

\begin{document}
\[
\sum_{\substack{i_1,\dots,i_n\\ \in\,\Pset}}
\]
\end{document}
  • I think it is unacceptable. – Alex E. Jun 10 '18 at 16:47
  • 4
    @AlexE. - do please state what is unacceptable. – Mico Jun 10 '18 at 16:56
  • Line break before set membership symbol. – Alex E. Jun 10 '18 at 17:50
  • 1
    Anyway \substack is a very sensible idea here, so +1. – moewe Jun 10 '18 at 21:19
  • 1
    Interesting, I'm so used to $(x_1,\dots,x_n)\in X$ being a single element of $X$ and $x_1,\dots,x_n\in X$ being n elements that I did not seriously think that notation could be that different in at least this context. How would you distinguish between picking one vector $x$ with coordinates $x_1,\dots,x_n$ from $\mathbb{R}^n$ and picking n vectors $x_1,\dots,x_n$ from $\mathbb{R}^n$? Purely by other notational conventions, like lower-case letters are always scalar and can't be vectors or using different positions for the index? – moewe Jun 11 '18 at 7:24
5

Are you looking for something like this?

example

\documentclass{article}
\begin{document}
\[\sum_{(i_1,\ldots,i_n)\in\mathcal{P}(\overline{1,n})}\]
\end{document}

Or this?

example_2

\documentclass{article}
\begin{document}
\(\sum_{(i_1,\ldots,i_n)\in\mathcal{P}(\overline{1,n})}\)
\end{document}

Edit

I'm wondering... Are you bothered by the length of the subscript because of the white space between the sum and the next variable? Because if this is the case, then the command \mathclap from mathtools allow to overlap the subscript to the sum symbol. The difference with respect to the original is shown in the following image.

example_mathclap

And this is the code to reproduce it:

\documentclass[convert]{article}
\usepackage{mathtools}
\begin{document}
\[\sum_{i_1,\ldots,i_n\in\mathcal{P}(\overline{1,n})}x_i\]
\[\sum_{\mathclap{i_1,\ldots,i_n\in\mathcal{P}(\overline{1,n})}}x_i\]
\end{document}
  • The first one . – Alex E. Jun 10 '18 at 17:43
  • 1
    The use that code, maybe without the parenthesis. But, and I say this in your interests, don't go for stretched summation symbols or something like that. Another way could be to rewrite the expression to make it shorter or to use a different font-size. – gvgramazio Jun 10 '18 at 18:50
4

In case you want to stretch the summation symbol horizontally, you can use the \hstretch command from the scalerel package. You can measure the width of the summation symbol and the subscript using \settowidth and use pgf to calculate the scaling factor that needs to be supplied to \hstretch. Note that the widths are not fully consistent with the actual width of the symbol so you have to adjust the factor (by 0.6 in the example below). The summation itself is displayed using \underset from the amsmath package.

MWE:

\documentclass{article}
\usepackage{scalerel}
\usepackage{pgf}
\usepackage{amsmath}
\begin{document}

\def\mysubscript{(i_1,\ldots,i_n)\in\mathcal{P}(\overline{1,n})}

\newlength\mylen
\settowidth\mylen{${}_\mysubscript$}

\newlength\mysumlen
\settowidth\mysumlen{$\sum$}

\pgfmathsetmacro\scalefactor{\mylen / \mysumlen * 0.6}

\noindent width of subscript: \the\mylen\\
width of sum: \the\mysumlen\\
scale factor: \scalefactor\\


\[\underset{\mysubscript}{\hstretch{\scalefactor}{\sum}}\]

\end{document}

Result:

enter image description here

Note that the result is aesthetically rather questionable and I would advise against using it in any situation whatsoever.

  • 6
    It's even worse than I feared! :P – Au101 Jun 10 '18 at 17:53
  • Yes, I want to stretch, but not all summation symbol, I want to stretch only top and bottom bar of it. – Alex E. Jun 10 '18 at 18:04
  • 2
    @AlexE. That's ... not really how it works since the summation symbol is a character in a font. You could redraw the whole symbol using something like TikZ but it'd still be really ugly and out of proportion – Au101 Jun 10 '18 at 18:28
  • 5
    +1 -- for reminding readers (just in case they needed a reminder...) that the old saying that "the customer is always right" isn't always correct. – Mico Jun 10 '18 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.