The fraction \frac{num}{den} are usually rendered by centering the numerator and the denominator.
Unfortunately, I find the result in the following MWE quite ugly:
\documentclass{article}
\begin{document}
If $r\neq 1$, then
\[
\sum_{k=0}^nr^k = \frac{1-r^{n+1}}{1-r}
\]
\end{document}
Indeed, the $r^{n+1}$ part is too big. I wish that the two - signs of a fraction of the form \frac{a-b}{c-d} to be vertically aligned (whatever the size of a,b,c and d) at the center of the fraction, in order to show the symmetry of the formula.
How can I get such a result?
Note: if it matters for the answer, I would like the alignment to work also for inline maths mode.
\displaystyle
isn't a command, it's a switch, like{\bfseries foo}
In its role as a switch it will almost never need braces, but if it did need them, they would have to be like{\displaystyle }
. That's the general rule for switches anyway, although I'm not sure\displaystyle
would be very happy with you if you tried to scope it like this, I haven't tried. Unrelated point 2,\[ ... \]
enters display math mode by definition, so\displaystyle
is completely redundant\frac{}{}
in text mode so no solution can possibly be applicable there.