MHB Left-Aligning Equations in \texttt{align} Environment

  • Thread starter Thread starter Dustinsfl
  • Start date Start date
AI Thread Summary
To left-align equations in the align environment, ampersands should be placed at the start of each line. This allows the equations to align on the left-hand side rather than at the equals sign. Some users prefer this aesthetic, while others find it less visually appealing. The discussion also mentions that the spacing between the derivatives and the equal sign can vary between different formats, such as PDFs and forum displays. For consistent formatting, using the eqnarray* or alignat environments may be recommended.
Dustinsfl
Messages
2,217
Reaction score
5
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}
 
Physics news on Phys.org
\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.
 
Ackbach said:
\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.
 
dwsmith said:
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.
 
Ackbach said:
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?
 
Use eqnarray* environment.
 
You can also use alignat but I don't know if this will work here.
 

Similar threads

Back
Top