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?

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}
  • 1
    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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.