# Too many blanks between summation symbol and its associated expression

I am actually new to latex, so this is very basic and ridiculous question. However, I cannot eliminate the blank between f(e) and the summation symbol. Besides, the equal sign is so far from the summation symbol. How can I solve these ?

Latex Code:

\sum_{e \, into \, node \, v} f(e) = \sum_{e \, out \, of \, node \, v} f(e)


• You are welcome to TeX.SE. For my opinion it is all to remake the code. What is your complete code where the preamble is? What packages do you use, etc. – Sebastiano May 30 '18 at 20:28
• You could try something like \sum_{\mathclap{\text{$e$ into node $v$}}} f(e) = \sum_{\mathclap{\text{$e$ into node $v$}}} f(e) with mathtools. But then you might end up with the text running into the summands or the equal sign. Edit OK, I just checked this and it looks absolutely terrible. – moewe May 30 '18 at 20:28
• never use math italic for words: e \, into \, node \, v the font is designed to make adjacent letters not look like a word but like a product of variables. – David Carlisle May 30 '18 at 20:30
• As I write these latex codes in os-x application "pages", most of packages and math functions do not exist unfortunately. – Goktug May 30 '18 at 20:39
• When using text I would vote for \textnormal rather than \text. – Manuel May 30 '18 at 23:07

You can use \smashoperator from mathtools (I don't recommend it) or split the subscript across two lines. Or, probably better, use suitable notation.

\documentclass{article}
\usepackage{mathtools}

\begin{document}

$\smashoperator[r]{\sum_{\text{e into node v}}} f(e) = \smashoperator[r]{\sum_{\text{e out of node v}}} f(e)$

$\sum_{\substack{\text{e into}\\\text{node v}}} f(e) = \sum_{\substack{\text{e out of}\\\text{node v}}} f(e)$

$\sum_{e\in v^{\leftarrow}} f(e) = \sum_{e\in v^{\rightarrow}} f(e)$

\end{document}


• "+1" sure. :-) Best best answer. – Sebastiano May 30 '18 at 21:04
• Is there any specific reason why you say smashoperator is not recommended? – JAD May 31 '18 at 6:31
• @JAD I mean, look at the output! ;-) – egreg May 31 '18 at 6:46

I was elaborating over my idea about visual formatting, when @Sebastiano’s use of \substack suggested a better alternative…

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly
% declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
\usepackage[utf8]{inputenc}      % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{mathtools}

\begin{document}

Some text before the equation.
\begin{align}
\sum_{\mathclap{\text{$e$ into node $v$}}} f(e)
\mspace{9mu}&=\mspace{9mu}
\sum_{\mathclap{\text{$e$ out of node $v$}}} f(e)
\\medskipamount] \sum_{\mathclap{\substack{\text{e into}\\\text{node v}}}} f(e) &= \sum_{\mathclap{\substack{\text{e out of}\\\text{node v}}}} f(e) \end{align} Some text after the equation. \end{document}  The output: • I want upvoted all. +1 :-) – Sebastiano May 30 '18 at 21:03 • This is what I was gonna do! +1 :) – Au101 May 30 '18 at 21:04 • @Au101: Yes, it's pretty obvious… But the most comprehensive answer is—as (almost) always—egreg’s (indeed, \smashoperator is the way to go here!). – GuM May 30 '18 at 21:11 Here's a solution that uses the \smashoperator macro of the mathtools package. Note that there's now no gap between the summation symbols and f(e). However, there's still a gap between the = symbol and the second summation symbol, to keep the longish material below the summation symbols from getting entangled. \documentclass{article} \usepackage{mathtools} % for '\smashoperator' macro \begin{document} \[ \smashoperator{\sum_{\text{r into node v}}} f(e) = \smashoperator[r]{\sum_{\text{e out of node v}}} f(e)
\end{document}

• Sure that is the best. +1. – Sebastiano May 30 '18 at 21:02

This could be one of many solutions but it is not the best.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\sum _{e \text{ into node }v} \hspace{-.5cm} f(e)=\sum _{e\,\, \text{out of node }v} \hspace{-.5cm} f(e)$

\end{document}