# Displaying fractions nicely

I'd like the following to look nicer:

$\frac{1 - \left(\frac{r-3}{r-1} \right)^{k-(p+q)+1}}{1 - \left(\frac{r-3}{r-1} \right)}$


As of now, the horizontal line is way too long.

-
Welcome to TeX.SX. A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button ({}) or hit Ctrl+K. –  Claudio Fiandrino Mar 6 '14 at 12:16
There is the \dfrac command, but I can't remember in which package it can be found. –  Christian Hupfer Mar 6 '14 at 12:26
@ChristianH. amsmath. –  Gonzalo Medina Mar 6 '14 at 12:30
If the horizontal line does not include the exponent, then I'd be unsure whether the exponent applies to the whole fraction. –  MvG Mar 6 '14 at 17:53

You can use the command \mathrlap from the mathtools package.

MWE:

\documentclass{article}

\usepackage{mathtools}

\begin{document}

Displaystyle version

$\dfrac{1 - \left(\dfrac{r-3}{r-1} \right)^{\mathrlap{k-(p+q)+1}}}{1 - \left(\dfrac{r-3}{r-1} \right)}$

\bigskip

Here is the inline version $\frac{1 - \left(\frac{r-3}{r-1} \right)^{\mathrlap{k-(p+q)+1}}}{1 - \left(\frac{r-3}{r-1} \right)}$

\end{document}


-

You could certainly use a trick like this:

${\frac{1 - \left(\frac{r-3}{r-1} \right)}{1 - \left(\frac{r-3}{r-1} \right)}}^{\mbox{\tiny$k-(p+q)+1$}}$

-
+1, but you can tweak it even better by adding \!\! at the beginning of the tiny mbox, as ^{\mbox{\tiny $\!\!k-(p+q)+1$}} –  Steven B. Segletes Mar 6 '14 at 13:15