You can use the \substack
command from the amsmath
package, like this:
\begin{equation}
d(\vec{x},\vec{y}) =
\sum_{\substack{Z_{xy}\in\vec{Z}_{xy}\\
\forall x\in\vec{x}\\
\forall y\in\vec{y}}}
f(Z_{xy})
\end{equation}
However, the result still doesn’t look good, because of the extra spacing around the sum symbol:
To fix this, you can use the \mathclap
command from the mathtools
package, like this:
\begin{equation}
d(\vec{x},\vec{y}) =
\sum_{\mathclap{\substack{Z_{xy}\in\vec{Z}_{xy}\\
\forall x\in\vec{x}\\
\forall y\in\vec{y}}}}
f(Z_{xy})
\end{equation}
But perhaps you might be happy using only \mathclap
, and not \substack
. The result looks good as long as the subscript is not too wide.
\begin{equation}
d(\vec{x},\vec{y}) =
\sum_{\mathclap{{Z_{xy}\in\vec{Z}_{xy},
\forall x\in\vec{x},
\forall y\in\vec{y}}}} f(Z_{xy})
\end{equation}
The mathtools
package also have several other useful commands for typesetting mathematics, including more commands for improving the display of subscripts and superscripts. I very much recommend taking a look at its documentation.
The typography as displayed by LaTeX
is the correct one. A comma needs to be placed at the baseline.
If you need to make any adjustments rather place the fraction within brackets. Agreed that the comma can be mistaken as a prime, but remember that mathematics is read in context, i.e., if no primes are used on the variables it is highly unlikely that a mathematically inclined reader will mix it up.
I have checked the above with a couple of books and always the comma is as shown by LaTeX.
\documentclass{article}
\usepackage{amsmath}
\usepackage{mathpazo} % To get Palatino
\linespread{1.05} % See question 31064
\usepackage[small, euler-digits]{eulervm} % and now Euler
\begin{document}
If the number of independent variable is~$n$, we must have
\[
p = - \frac{n-2}{2}, \quad \text{or} \quad -\left(\frac{n-2}{2} + 1\right), \quad -\left(\frac{n-2}{2} + 2\right),\quad \left(\frac{n-2}{2+a}\right), \quad \dots.
\]
\end{document}
Your suggestion of raising the comma can lead to other problems such as $(a,b)\frac{a}{b},
resulting in the commas not lining up.
Best Answer
If you're using the comma as decimal separator, then you should consider using the semi-colon for the interval separator, it will be more readable:
(Instead of typing
1{,}5
, you can also use theicomma
package as suggested by egreg or\num
as suggested by Werner.)