11

I have two equations:

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

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

1 Answer 1

13

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

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation}
\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{equation}

\end{document}

enter image description here

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{equation}
\begin{split} 
    d_1 & =\frac{aaaaaaaaaa}{b}\\
    d_2 & =\frac{\makebox[\mylen][c]{$aaaaaa$}}{b} \\
\end{split} 
\end{equation}

\end{document}

enter image description here

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

\documentclass{article}
\usepackage{mathtools}

\newlength\mylen

\begin{document}

\settowidth\mylen{$aaaaaaaaaa$}

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

\end{document}
2
  • 1
    See also \mathmakebox from mathtools.
    – egreg
    Aug 29, 2013 at 9:35
  • @egreg thanks for the suggestion; I've incorporated it to my answer. Aug 29, 2013 at 13:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .