Welcome to our community

Be a part of something great, join today!

Align Environment

dwsmith

Well-known member
Feb 1, 2012
1,673
So I want to use begin{align} end{align} but I want my equations to line up on the left not the right.

How can this be done?

\begin{align}
\frac{ds}{dt} = -k_1es + (k_{-1} - k_3)c_1 + k_{-3}c_2\\
\frac{dc_1}{dt} = k_1se - (k_{-1} + k_2 + k_3s)c_1 + (k_{-3} + k_4)c_2\\
\frac{dc_2}{dt} = k_3sc_1 - (k_{-3} + k_4)c_2\\
\frac{de}{dt} = -k_1se + (k_{-1} + k_2)c_1\\
\frac{dp}{dt} = k_2c_2 + k_4c_2
\end{align}
 

Ackbach

Indicium Physicus
Staff member
Jan 26, 2012
4,197
\begin{align}
\frac{ds}{dt} &= -k_1es + (k_{-1} - k_3)c_1 + k_{-3}c_2\\
\frac{dc_1}{dt} &= k_1se - (k_{-1} + k_2 + k_3s)c_1 + (k_{-3} + k_4)c_2\\
\frac{dc_2}{dt} &= k_3sc_1 - (k_{-3} + k_4)c_2\\
\frac{de}{dt} &= -k_1se + (k_{-1} + k_2)c_1\\
\frac{dp}{dt} &= k_2c_2 + k_4c_2
\end{align}

Insert ampersands. Incidentally, MathJax automatically parses this environment, so it's probably best not to put too much $\LaTeX$ into your post titles.
 

dwsmith

Well-known member
Feb 1, 2012
1,673
\begin{align}
\frac{ds}{dt} &= -k_1es + (k_{-1} - k_3)c_1 + k_{-3}c_2\\
\frac{dc_1}{dt} &= k_1se - (k_{-1} + k_2 + k_3s)c_1 + (k_{-3} + k_4)c_2\\
\frac{dc_2}{dt} &= k_3sc_1 - (k_{-3} + k_4)c_2\\
\frac{de}{dt} &= -k_1se + (k_{-1} + k_2)c_1\\
\frac{dp}{dt} &= k_2c_2 + k_4c_2
\end{align}

Insert ampersands. Incidentally, MathJax automatically parses this environment, so it's probably best not to put too much $\LaTeX$ into your post titles.
Is there anyway to make it flush? Lines 2 and 3 look ugly.
 

Ackbach

Indicium Physicus
Staff member
Jan 26, 2012
4,197
Is there anyway to make it flush? Lines 2 and 3 look ugly.
That's a matter of aesthetics. I prefer aligned equations to align on the equals sign. If you prefer to align on the left-hand sides of the derivatives, then put the ampersands on the far left like this:

\begin{align}
&\frac{ds}{dt} = -k_1es + (k_{-1} - k_3)c_1 + k_{-3}c_2\\
&\frac{dc_1}{dt} = k_1se - (k_{-1} + k_2 + k_3s)c_1 + (k_{-3} + k_4)c_2\\
&\frac{dc_2}{dt}= k_3sc_1 - (k_{-3} + k_4)c_2\\
&\frac{de}{dt} = -k_1se + (k_{-1} + k_2)c_1\\
&\frac{dp}{dt} = k_2c_2 + k_4c_2
\end{align}

I don't like that, but that's how you can do it if you do like it.
 

dwsmith

Well-known member
Feb 1, 2012
1,673
That's a matter of aesthetics. I prefer aligned equations to align on the equals sign. If you prefer to align on the left-hand sides of the derivatives, then put the ampersands on the far left like this:

\begin{align}
&\frac{ds}{dt} = -k_1es + (k_{-1} - k_3)c_1 + k_{-3}c_2\\
&\frac{dc_1}{dt} = k_1se - (k_{-1} + k_2 + k_3s)c_1 + (k_{-3} + k_4)c_2\\
&\frac{dc_2}{dt}= k_3sc_1 - (k_{-3} + k_4)c_2\\
&\frac{de}{dt} = -k_1se + (k_{-1} + k_2)c_1\\
&\frac{dp}{dt} = k_2c_2 + k_4c_2
\end{align}

I don't like that, but that's how you can do it if you do like it.
\begin{align}
&\frac{ds}{dt} & = & -k_1es + (k_{-1} - k_3)c_1 + k_{-3}c_2,\\
&\frac{dc_1}{dt} & = & k_1se - (k_{-1} + k_2 + k_3s)c_1 + (k_{-3} + k_4)c_2,\\
&\frac{dc_2}{dt} & = & k_3sc_1 - (k_{-3} + k_4)c_2,\\
&\frac{de}{dt} & = & -k_1se + (k_{-1} + k_2)c_1,\\
&\frac{dp}{dt} & = & k_2c_2 + k_4c_2
\end{align}

On my pdf document, the space between the derivatives and equal sign is about 2in but on the forum it is about a 1/2in. How can I get my pdf file to align like this?
 

Krizalid

Active member
Feb 9, 2012
118
Use eqnarray* environment.
 

Jester

Well-known member
MHB Math Helper
Jan 26, 2012
183
You can also use alignat but I don't know if this will work here.