# Aligning Equations in LaTeX

I was trying to align the following equations but alas. Could someone guide?

\begin{flalign}
x \in A \cap (B \cup C)
& \Rightarrow (x \in A) \lambda \Big( (x \in B)\vee(x \in C) \Big) & \\
& \Rightarrow \Big( (x \in A) \lambda (x \in B) \Big) \vee \Big( (x \in A) \lambda (x \in C) \Big) & \\
& \Rightarrow (x \in A \cap B) \lambda ( x \in A \cap C) & \\
& \Rightarrow x \in (A \cap B) \cup (A \cap C)
\end{flalign}


to look like

a => b
=> c
=> d
=> e


Here's the preamble that I used:

\documentclass[oneside]{book}

\title{Basic Typesetting of Mathematics}
\usepackage[fleqn]{amsmath}
\setlength{\mathindent}{0pt}


I am using Texmaker and it's not recognising \begin{flalign*} or \end{flalign*}. Gives weird compilation errors. Any ideas?

-

## migrated from programmers.stackexchange.comFeb 21 '14 at 9:53

This question came from our site for professional programmers interested in conceptual questions about software development.

## 3 Answers

Your code is compiling just fine.

I've made the parentheses a bit smaller and used the left/right versions of them to get better horizontal spacing. Also, there were unnecessary ampersands.

Version 1:

\documentclass[oneside]{book}

\usepackage[fleqn]{amsmath}
\setlength\mathindent{0pt}

\begin{document}

\begin{flalign}
x \in A \cap (B \cup C)
&\Rightarrow (x \in A) \lambda \bigl((x \in B) \vee (x \in C)\bigr)\\
&\Rightarrow \bigl((x \in A) \lambda (x \in B)\bigr) \vee \bigl((x \in A) \lambda (x \in C)\bigr)\\
&\Rightarrow (x \in A \cap B) \lambda (x \in A \cap C)\\
&\Rightarrow x \in (A \cap B) \cup (A \cap C)
\end{flalign}

\end{document}


Version 2: Using daleif's suggestion from the comment to this answer, you get

\documentclass[oneside]{book}

\usepackage[fleqn]{amsmath}
\setlength\mathindent{0pt}

\newcommand*\implic{\quad\Rightarrow\quad}

\begin{document}

\begin{flalign}
x \in A \cap (B \cup C)
&\implic  (x \in A) \lambda \bigl((x \in B) \vee (x \in C)\bigr)\\
&\implic \bigl((x \in A) \lambda (x \in B)\bigr) \vee \bigl((x \in A) \lambda (x \in C)\bigr)\\
&\implic (x \in A \cap B) \lambda (x \in A \cap C)\\
&\implic x \in (A \cap B) \cup (A \cap C)
\end{flalign}

\end{document}


-

This code works. I removed big brackets to have the same space between equations

\documentclass[oneside]{book}
\usepackage[fleqn]{amsmath}
\setlength{\mathindent}{0pt}
\begin{document}
\begin{flalign}
x \in A \cap (B \cup C)
& \Rightarrow (x \in A) \lambda \left( (x \in B)\vee(x \in C) \right) & \\
& \Rightarrow \left( (x \in A) \lambda (x \in B) \right) \vee \left( (x \in A)\lambda (x \in C) \right) & \\
& \Rightarrow (x \in A \cap B) \lambda ( x \in A \cap C) & \\
& \Rightarrow x \in (A \cap B) \cup (A \cap C)
\end{flalign}
\end{document}


-
Thank you !! ++1 – Abi Feb 21 '14 at 10:44
@Abi: the best way to thank others is not saying +1, but rather upvoting the answers and accepting the best one; have a look to TeX.SX tour. – Claudio Fiandrino Feb 21 '14 at 12:39
Oh @ClaudioFiandrino I had less reputation :P here so wanted to thank anyways regardless of that.. But now I did.. Thank you again :* – Abi Feb 22 '14 at 20:01

This code works for me:

\documentclass[oneside]{book}
\usepackage[fleqn]{amsmath}
\setlength{\mathindent}{0pt}
\begin{document}
\begin{flalign}
x \in A \cap (B \cup C)
& \Rightarrow (x \in A) \lambda \Big( (x \in B)\vee(x \in C) \Big) & \\
& \Rightarrow \Big( (x \in A) \lambda (x \in B) \Big) \vee \Big( (x \in A)\lambda (x \in C) \Big) & \\
& \Rightarrow (x \in A \cap B) \lambda ( x \in A \cap C) & \\
& \Rightarrow x \in (A \cap B) \cup (A \cap C)
\end{flalign}
\end{document}

-
Thank you !! It works perfectly the way I wanted :) +++1 – Abi Feb 21 '14 at 10:45
Might look better if you added extra space around the \Rightarrow, I usually use \Rightarrowx as a short for \quad\Rightarrow\quad – daleif Feb 21 '14 at 11:00