# How to align one equation with another multline equation

I have two equations: The first equation needs to be broken up over two lines (e.g., with multline) so that the rest of the equation is right aligned on the second line. I would like to have the second equation aligned with the first equation (i.e., their equal signs are aligned), but I can't seem to figure out how to align it and have the second part of the first equation be right justified.

Example 1:

\documentclass[letterpaper,12pt]{article}
\usepackage{amsmath}
\begin{document}
\begin{multline}
\frac{dB}{dt} \approx  - 0.092409  \left(  22.2674  e^{-0.092409 t}+77.7326 e^{-0.0258637 t}  \right)
\nonumber \\
-\left( 200 \frac{\ln{\frac{1}{2}}}{26.8} \right) \exp{\left(\dfrac{\ln{\frac{1}{2}}}{26.8}t \right)}
\nonumber \\
\approx 2.057708e^{-0.092409 t}+7.18319e^{-0.0258637 t}
\end{multline}
\end{document}


I put everything within multline environment, but the 2nd equation is not aligned with the first.

Example 2:

\documentclass[letterpaper,12pt]{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
\frac{dB}{dt} &\approx  - 0.092409  \left(  22.2674  e^{-0.092409 t}+77.7326 e^{-0.0258637 t}  \right)
\nonumber \\
-\left( 200 \frac{\ln{\frac{1}{2}}}{26.8} \right) \exp{\left(\dfrac{\ln{\frac{1}{2}}}{26.8}t \right)}
\nonumber \\
&\approx 2.057708e^{-0.092409 t}+7.18319e^{-0.0258637 t}
\end{align}
\end{document}


Here, I've put everything in an aligned environment. The first equation and second equation are aligned, but the second part of the first equation is left aligned/justified. I would like it right justified and the first and third line left justified/aligned.

• Are you sure you want the second line right justified? I did it using a \tag*{$\displaystyle ...$} and it looked awful. Usualy one \quad past the alignmient point will do. Apr 20, 2015 at 3:54
• @JohnKormylo: In terms of popular practice, what would be the best way to align these equations (assuming a right justified second line isn't aesthetically pleasing?). I just assumed that the second part of an equation should be right justified to distinguish it from a separate equation, but I would be happy to know what the proper convention is.
– WHY
Apr 20, 2015 at 20:46

How about condensing the equation with constants? I threw in a macro \diff{}{} for differentials (which should be written with upright d's as it's an operator). Btw, there could be better choices for constants.

\documentclass[letterpaper,12pt]{article}
\usepackage{amsmath}

\newcommand{\diff}[2]{\frac{\mathrm{d}#1}{\mathrm{d}#2}}

\begin{document}
$$\diff{B}{t} = a_1(b_1e^{c_1t}+b_2e^{-c_2t}) - \left(a_2\frac{\ln{\frac{1}{2}}}{b_3} \right) \exp \left(\frac{\ln{\frac{1}{2}}}{b_3}\right)$$
%
where the constants $a_i$, $b_i$, and $c_i$ are
%
\begin{align*}
a_1 &= -0.092409, && a_2 = 200,     && \\
b_1 &= 22.2674,   && b_2 = 77.7326,  && b_3 = 26.8, \\
c_1 &= -0.092409, && c_2 = -0.0258637, &&
\end{align*}
%
such that
%
$$\diff{B}{t} \approx 2.057708e^{-0.092409 t}+7.18319e^{-0.0258637 t}$$
\end{document}

• You can also use the commath package to get upright d's in math mode with \dif Apr 20, 2015 at 22:38
• Although you didn't answer my original question, you provided a better solution to my overall problem.
– WHY
Apr 23, 2015 at 22:00

I think this is what you are trying to achieve, but it doesn't look pretty.

This is based on egreg's solution from \hfill in math mode

\documentclass[letterpaper,12pt]{article}
\usepackage{amsmath}

% from https://tex.stackexchange.com/questions/83509/hfill-in-math-mode
\makeatletter
\newcommand{\specialcell}[1]{\ifmeasuring@#1\else\omit$\displaystyle#1$\ignorespaces\fi}
\makeatother

\begin{document}
\begin{align}
\begin{split}
\frac{dB}{dt} & \approx  - 0.092409  \left(  22.2674  e^{-0.092409 t}+77.7326 e^{-0.0258637 t}  \right)
\nonumber \\
& \specialcell{
\hfill -\left( 200 \frac{\ln{\frac{1}{2}}}{26.8} \right) \exp{\left(\dfrac{\ln{\frac{1}{2}}}{26.8} \right)}
}
\nonumber \\
& \approx 2.057708e^{-0.092409 t}+7.18319e^{-0.0258637 t}
\end{split}
\end{align}
\end{document}


A simple solution with an aligned environment inside align. I took the liberty to force smaller parentheses on the second line of the split formula.

\documentclass[l2pt]{article}
\usepackage{amsmath}

\begin{document}

\begin{align}
\frac{dB}{dt} & \approx\!\begin{aligned}[t] - 0.092409 \left( 22.2674 e^{-0.092409 t}+77.7326 e^{-0.0258637 t} \right)
\\[-1ex]
-\Bigl( 200 \frac{\ln{\frac{1}{2}}}{26.8} \Bigr) \exp{\Bigl(\dfrac{\ln{\frac{1}{2}}}{26.8}t \Bigr)}
\end{aligned}
\nonumber \\[1ex]
& \approx 2.057708e^{-0.092409 t}+7.18319e^{-0.0258637 t}
\end{align}

\end{document}


Try this

\documentclass[letterpaper,12pt]{article}

\usepackage{amsmath}

\begin{document}

\begin{align}
\frac{dB}{dt} &\approx  - 0.092409  \left(  22.2674  e^{-0.092409 t}+77.7326 e^{-0.0258637 t}  \right)
\nonumber \\
&\phantom{\approx\ }    -\left( 200 \frac{\ln{\frac{1}{2}}}{26.8} \right) \exp{\left(\dfrac{\ln{\frac{1}{2}}}{26.8}t \right)}
\nonumber \\
&\approx 2.057708e^{-0.092409 t}+7.18319e^{-0.0258637 t}
\end{align}
\end{document}


Use the multilined[t] environment from mathtools. First, load the package:

Math­tools pro­vides many use­ful tools for math­e­mat­i­cal type­set­ting. It is based on ams­math and fixes var­i­ous de­fi­cien­cies of ams­math and stan­dard LaTeX.

Analyzing the problem carefully, it is a split environment of aligned equations in which one of the equations is a multi-line equation, for it being too long and whose second part should be right justified (or right aligned, or \shoveright, or \MoveEqRight...).

You need a nested multline environment multilined[t] inside the split environment.

\documentclass[letterpaper,12pt]{article}
\usepackage{mathtools}
\begin{document}
$$\begin{split} \frac{dB}{dt} &\approx \begin{multlined}[t] - 0.092409 \left( 22.2674 e^{-0.092409 t}+77.7326 e^{-0.0258637 t} \right)\\ -\left( 200 \frac{\ln{\frac{1}{2}}}{26.8} \right) \exp{\left(\dfrac{\ln{\frac{1}{2}}}{26.8}t \right)} \end{multlined}\\ &\approx 2.057708e^{-0.092409 t}+7.18319e^{-0.0258637 t} \end{split}$$
\end{document}


The solution may seem obvious now, but I came across it after two hours of playing around with align, gather, multline, split, alginat, flalign and all its variants; just before I was about to contact Lars Mad­sen (main­tainer of the mathtools package) for an upgrade. It had to be something with an automated format, in pure LaTeX style, not through the use of \quad or \hspace or \vphantom or the like.

It is amazing how such a basic typesetting feature is so unknown. I mean, I couldn't find a solution in the whole Internet! It ought to be included in the the guides and tutorials. Multi-line equations are a day to day thing.

I knew there had to be more people demanding a solution to this, which I now share. It also proves how robust the coding of the mathtools package is, responding successfully to the workaround.

Enjoy!