Aligning two fractions in the split environment

I have two equations:

    $$\begin{split} d_1 & =\frac{aaaaaaaaaa}{b}\\ d_2 & =\frac{aaaaaa}{b} \end{split}$$


I want the fraction lines to have equal lengths in the two cases. How can I make it happen?

-

If I understand correctly your intent, you can use \phantoms:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

$$\begin{split} d_1 & =\frac{aaaaaaaaaa}{b}\\ d_2 & =\frac{aaaaaa\phantom{aaaa}}{b} \\ d_3 & =\frac{\phantom{aa}aaaaaa\phantom{aa}}{b} \end{split}$$

\end{document}


Of course, you can measure the longest string, and then use this as the width of a box containing the other expression:

\documentclass{article}
\usepackage{amsmath}

\newlength\mylen

\begin{document}

\settowidth\mylen{$aaaaaaaaaa$}

$$\begin{split} d_1 & =\frac{aaaaaaaaaa}{b}\\ d_2 & =\frac{\makebox[\mylen][c]{aaaaaa}}{b} \\ \end{split}$$

\end{document}


As egreg comments, one can also use \mathmakebox from mathtools:

\documentclass{article}
\usepackage{mathtools}

\newlength\mylen

\begin{document}

\settowidth\mylen{$aaaaaaaaaa$}

$$\begin{split} d_1 & =\frac{aaaaaaaaaa}{b} \\ d_2 & =\frac{\mathmakebox[\mylen][c]{aaaaaa}}{b} \\ \end{split}$$

\end{document}

-
Brilliant. thanks. –  Shb Aug 29 '13 at 1:36
See also \mathmakebox from mathtools. –  egreg Aug 29 '13 at 9:35
@egreg thanks for the suggestion; I've incorporated it to my answer. –  Gonzalo Medina Aug 29 '13 at 13:04