Math & ScienceDouble Alignment in Equations

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
Bananskrue
Posts: 2
Joined: Tue Dec 13, 2011 7:23 pm

Double Alignment in Equations

Post by Bananskrue »

Hey all!

This is something that I've been pondering for a little while now. I know that if you have multiple equations you can align them to, per say the equal sign by using the \begin{align} environment.

I'm working with some very long formulas and it looks messy even when I do align them to the equal signs. Is there any way to align them so all the LHS's are aligned and also having the equal signs aligned? It's kind of hard to explain what I want but I hope you get the idea.

I tried doing something like

Code: Select all

\begin{align}
&LHS1 &&= RHS1 \\
&LHS2 &&= RHS2 
\end{align}
But my equation jumped out of the page for some reason when I did this.

I don't know if this may just be poor typesetting as well though, since I realize ideally all equations are supposed to be centered, but I have like five equations in a row where some of them take the entire width of the page and others only take half of it. I feel it would look better if they were centered both on the left side and on the equal sign (Although this would mean a large amount of spaces before the equal signs, feel free to contribute input on whether or not you think this would look better or worse).

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Double Alignment in Equations

Post by Stefan Kottwitz »

Hi Bananskrue,

welcome to the board!

You could use an alignat environment, such as

Code: Select all

\begin{alignat}{2}
  &LHS1 &&= RHS1 \\
  &LHS2 &&= RHS2
\end{alignat}
The mandatory argument is the number of alignment columns, here 2.

Stefan
LaTeX.org admin
Bananskrue
Posts: 2
Joined: Tue Dec 13, 2011 7:23 pm

Double Alignment in Equations

Post by Bananskrue »

Thank you for the welcome and thank you for the words of advice! I tried your suggestions and it did not work properly, but I found the source of the problem.

I forgot to mention how my equations are separated by a line of text. I'm not too familiar with the \begin{align} environment but what I'm doing right now is something like this:

Code: Select all

\begin{alignat} {3}
&LHS1 &&= RHS1 \\
\notag \mbox{blablabla} \\
&LHS2 &&= RHS2
\end{alignat}
By messing around a bit with my setup I found that it works exactly as expected until my text part reaches a certain amount of characters (but far less than one line) in which my equations shifts pretty radically to the right, so half of the equation disappears off the page. What gives?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Re: Double Alignment in Equations

Post by Stefan Kottwitz »

Instead of \mbox, use \text or \intextext, both of amsmath. \intertext is good for long text in a multiline math environment.

Stefan
LaTeX.org admin
Post Reply