Loop code for repeated sums

To use it in math mode you could simply use a \foreach outside a tikzpicture. This would require the pgffor package (only if you're not using Tikz already):

enter image description here

\documentclass[]{article}

\usepackage{mathtools}
\usepackage{pgffor}

\newcommand{\repsum}[3]{%
    \foreach \i in {1,...,#1}{
        \ifnum\i>1
            + #2_{\i} #3_{\i}
        \else
            #2_{\i} #3_{\i}
        \fi
    }
}

\begin{document}
    \begin{equation*}
        \mathbf{F}\bullet\mathbf{u} = \repsum{9}{F}{u}
    \end{equation*}
\end{document}

You can use xparse:

\documentclass{article}
\usepackage{amsmath}
\usepackage{xparse}

\ExplSyntaxOn
\NewDocumentCommand{\repsum}{O{3}mmm}
 {% #1 = optional number of starting summands
  % #2 = final number
  % #3 = first symbol
  % #4 = second symbol
  \int_step_inline:nn { #1 } { #3\sb{##1}#4\sb{##1} + }
  \dotsb
  \int_step_inline:nnn { #2 - 1} { #2 } { + #3\sb{##1}#4\sb{##1} }
 }
\ExplSyntaxOff  

\begin{document}

First test: $\repsum{9}{F}{u}$

Second test: $\repsum[2]{6}{F}{u}$

The CUF Refined theory expands the summation as
\begin{equation}
u=\repsum{9}{F}{u}=F_\tau u_\tau
\end{equation}
where the last expression exploits the Einstein notation. 

\end{document}

The idea is to make a cycle from 1 to 3 (or the number specified in the optional argument), printing the summands with their subscripts followed by +; then print the dots and + followed by the summands from #2-1 (#2 is the final number of summands) to #2.

With this implementation, you are responsible for ensuring no overlap. So you can do \repsum[1]{4}{F}{u}, but with less than four summands it won't work.

enter image description here

A different version that automatically skips the dots if they're not needed.

\documentclass{article}
\usepackage{amsmath}
\usepackage{xparse}

\ExplSyntaxOn
\NewDocumentCommand{\repsum}{O{3}mmm}
 {% #1 = optional number of starting summands
  % #2 = final number
  % #3 = first symbol
  % #4 = second symbol
  \int_compare:nTF { #2 - #1 < 3 }
   {% no dots necessary
     #3\sb{1}#4\sb{1}
     \int_step_inline:nnn { 2 } { #2 } { + #3\sb{##1}#4\sb{##1} }
   }
   {
    \int_step_inline:nn { #1 } { #3\sb{##1}#4\sb{##1} + }
    \dotsb
    \int_step_inline:nnn { #2 - 1} { #2 } { + #3\sb{##1}#4\sb{##1} }
   }
 }
\ExplSyntaxOff  

\begin{document}

First test: $\repsum{9}{F}{u}$

Second test: $\repsum[2]{6}{F}{u}$

Third test: $\repsum{5}{F}{u}$

Fourth test: $\repsum{3}{F}{u}$

Fifth test: $\repsum{2}{F}{u}$

Sixth test: $\repsum{1}{F}{u}$

The CUF Refined theory expands the summation as
\begin{equation}
u=\repsum{9}{F}{u}=F_\tau u_\tau
\end{equation}
where the last expression exploits the Einstein notation. 

\end{document}

enter image description here


Maybe this?

\documentclass{article}
\usepackage{tikz}
\newcommand{\cussum}[1]{
    \begin{tikzpicture}[baseline=-.1cm]
        \foreach \x in {1,2,...,#1}
        {
            \ifnum\x<#1
                \node at (\x,0) {$F_{\x}u_{\x}+$};
            \fi
            \ifnum\x=#1
                \node at (\x-.1,0) {$F_{\x}u_{\x}$};
            \fi
        }
    \end{tikzpicture}
}
\begin{document}
    \cussum{9} Minimal Working Examples are nice, aren't they \ldots
\end{document}

Here is the output:

Screenshot