# Positioning of equations (begin equation command)

This is a follow up from my previous question, Positioning of equations. I managed to get my equations alligned to the left, but in my latex document, I have also been using:

$$X^2 := x^2 - 123. \nonumber$$


I have alot of other equations that I want to be centered. For example, for all my equations wrapped around:



How would I center it? Thanks, my code is below.

\documentclass[11pt,a4paper]{report}
\usepackage[fleqn]{amsmath}
\setlength{\mathindent}{0pt}
\usepackage{amsfonts,amssymb,amsthm,epsfig,epstopdf,titling,url,array}

\theoremstyle{plain}
\newtheorem{thm}{Theorem}[chapter] % reset theorem numbering for each chapter
\newtheorem{lem}[thm]{Lemma}
\newtheorem{prop}[thm]{Proposition}
\newtheorem*{cor}{Corollary}

\theoremstyle{definition}
\newtheorem{defn}[thm]{Definition} % definition numbers are dependent on theorem numbers
\newtheorem{exmp}[thm]{Example} % same for example numbers
\newtheorem{conj}[thm]{Conjecture}

\theoremstyle{remark}
\newtheorem*{rem}{Remark}
\newtheorem*{note}{Note}

\title{My Thesis Title}
\author{My Name}
\date{\today}
\renewcommand\labelenumi{(\theenumi)}
\renewcommand\theenumi{\roman{enumi}}
\setlength{\parindent}{1em}

\begin{document}

\begin{exmp}
Here is an example.
\begin{align} \nonumber
(a+b)^3 &= (a+b)^2(a+b)\\ \nonumber
&=(a^2+2ab+b^2)(a+b)\\ \nonumber
&=(a^3+2a^2b+ab^2) + (a^2b+2ab^2+b^3)\\ \nonumber
&=a^3+3a^2b+3ab^2+b^3 \nonumber
\end{align}
\end{exmp}

\begin{exmp}
A simple equation:
$$X^2 := x^2 - 123. \nonumber$$
\end{exmp}
\end{document}

• Why should some equations go centered and other left aligned? – egreg Mar 31 '12 at 19:20

A more general solution is to load the nccmath package and wrap each equation you want flush-left in a fleqn environment:

\documentclass{article}
\usepackage{nccmath}
\begin{document}
\begin{fleqn}
\begin{align*}
a&=b\\
&=c
\end{align*}
\end{fleqn}
Which implies
$$a=c$$
But
\begin{fleqn}
$0\ne 5$
And
$2\ne 3$
\end{fleqn}
\end{document}


If nccmath causes problems, you could also define fleqn like this:

\makeatletter
\newenvironment*{fleqn}{
\@fleqntrue
\setlength\@mathmargin{0pt}%
\ignorespaces
}{%
\ignorespacesafterend
}
\makeatother


Instead of using the [fleqn] option which is a global option, leave the default centering behaviour but use flalign rather than align environment when you want flush left alignment.

• I was about to say the same thing. :-) – azetina Mar 31 '12 at 18:41
• How would I use the flalign command in my case? – Gary Mar 31 '12 at 18:48
• @Gary write \begin{flalign} and \end{flalign} instead of the usual align environments. flalign probably has a starred version as well. – jmc Mar 31 '12 at 19:08