I would like the range of x_1 and x_2 to be aligned at the bottom of \sum with smaller size, now the size is over big. I also tried \substack but this code even does not work.
\documentclass[a4paper,11pt]{article}
\usepackage{mathtools}%add-on and patches to amsmath
\usepackage{array}
\usepackage{blindtext}
\usepackage[T1]{fontenc}
\begin{document}
In your origninal example, you used inline math. There is a
difference in setting sums (and integrals, products etc) in
inline mode $\sum_{x=0}^{n}$ or display mode. The reason is
pretty simple, we do not want to disturb the spacing of lines.
$\displaystyle\sum_{x=0}^{n}$ I guess you can see by yourself
that there is a difference in size when using displaystyle and
limits but i need a little bit of text just to fill the lines.
$\sum\limits_{x=0}^{n}$ Ich glaube es zieht sich zu. The cat is
sleeping, the sky is cloudy and the coffee tastes like
\emph{smurf}. Is this enough text to fill a line? I gues so,
let's go on with some more mathematics.
\[\sum_{x=0}^{n}
\]
An array is nothing more than a table in math mode. Inside this
array, nothing is known of the limits, i.e. it never knows the
contents should be smaler. You can do that using
\verb!\scriptstyle!.
\[y=\sum _{\begin{array}{c}\scriptstyle 1<x_{1}<2\\
0<x_{2}<1 \end{array}} (x_{i})^{2}\]
As you can see, the command is limited to the line (not really,
it is limited to the cell. You could add it to every cell, typing
it 5 times if you have 5 rows, but this would not be in the sense
of a macro language. So, lets add it to every row:
\[y=\sum_{\begin{array}{>{\scriptstyle}c}1<x_{1}<2\\0<x_{2}<1
\end{array}} (x_{i})^{2}\]
Still looks pretty lame because the array inserts some vertical
space. Let's try out the substack you already mentioned.
\[y=\sum_{\substack{1<x_{1}<2\\0<x_{2}<1}} (x_{i})^{2}\]
If you want to, you can smash the whole thing
\[y=\smashoperator{\sum_{\substack{1<x_{1}<2\\0<x_{2}<1}}} (x_{i})^{2}\]
\clearpage
But now one question remains, how would this look like in the
running text? Pretty ugly i think
\blindtext
$y=\smashoperator{\sum\limits_{\substack{1<x_{1}<2\\0<x_{2}<1}}}
(x_{i})^{2}$
\blindtext
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.