10

I have 2 parts (i) and (ii) that I am trying to write out, but I can't seem to get the (i) and (ii) it look nicely, i.e. itemised. I tried using the \begin{enumerate} command but it doesnt seem to work together with the align environment? How would I get the 2 parts to be itemised/look nicely? (regarding the (i) and (ii)).

\documentclass{report}
\usepackage{amsmath,amsthm,enumitem}% http://ctan.org/pkg/{amsmath,amsthm}
\theoremstyle{definition}
\newtheorem{defn}{Definition} % definition numbers are dependent on theorem numbers

\begin{document}
\begin{defn}
Let $x, y$ be some unknowns, we let:

\begin{align*}
(i) x^2 + y^2 &:= (x+y)(x-y) \\
    &:= (1+2)(3+4) \\
    &:= (3\times 7) \\
    &\phantom{:}= 21 \\
    &\phantom{:}= 42/2\\ \\
(ii) x^2 + y^2 &:= (x+y)(x-y) \\
    &:= (1+2)(3+4)(3+4)(3+4)(3+4) \\
    &:= (3\times 7)(3\times 7)(3\times 7) \\
    &\phantom{:}= 123456789 \\
    &\phantom{:}= 42/2
\end{align*}

\end{defn}

\end{document}
David Carlisle
  • 757,742
Gary
  • 2,033
  • Possible duplicate of http://tex.stackexchange.com/questions/27885/force-aligned-equation-all-the-way-to-the-left – egreg Mar 03 '12 at 18:19

2 Answers2

10

Use aligned for this with enumerate.

Below I have used the calc package and extended the case to show how to handle the situation where the left hand sides are not of the same width and you still desire to align all of the aligned elements. I have done this in two step just for readability, where you set \WidestLHS to be the widest left hand side in your entire list, and then apply the macro \FormatLHS to each of the left hand sides of the equations.

If all your left hand sides are of the same width, or you do not desire that the := be aligned across the list items, then you do not need to use these two macros.

enter image description here

Note:

  • The math is still wrong in the question and has been corrected here.

Code:

\documentclass{report}
\usepackage{amsmath,amsthm,enumitem}%
% http://ctan.org/pkg/{amsmath,amsthm}
\usepackage{calc}%

\theoremstyle{definition} \newtheorem{defn}{Definition} % definition numbers are dependent on theorem numbers

\begin{document} \begin{defn} Let $x, y$ be some unknowns, we let:

% Do this is two steps for readability \newcommand{\WidestLHS}{x^2 +2xy + y^2}% \newcommand{\FormatLHS}[1]{\makebox[\widthof{$\WidestLHS$}][r]{$#1$}}% \begin{enumerate}[label={(\roman*)}] \item $\begin{aligned}[t] \FormatLHS{x^2 - y^2} &:= (x+y)(x-y) \ &:= (1+2)(3+4) \ &:= (3\times 7) \ &\phantom{:}= 21 \ &\phantom{:}= 42/2 \end{aligned}$ \item $\begin{aligned}[t] \FormatLHS{x^2 - y^2} &:= (x+y)(x-y) \ &:= (1+2)(3+4)(3+4)(3+4)(3+4) \ &:= (3\times 7)(3\times 7)(3\times 7) \ &\phantom{:}= 123456789 \ &\phantom{:}= 42/2 \end{aligned}$ \item $\begin{aligned}[t] \FormatLHS{x^2 +2xy + y^2} &:= (x+y)^2 \end{aligned}$ \end{enumerate} \end{defn} \end{document}

Peter Grill
  • 223,288
  • Thanks Peter, need to study thosenew commands because I have not seen them before. Cheers. – Gary Mar 04 '12 at 16:41
7

Here is an option with left-aligned equation numbers (by passing the leqno option to amsmath's or the document class):

enter image description here

\documentclass{report}
\usepackage[leqno]{amsmath}% http://ctan.org/pkg/amsmath
\usepackage{amsthm}% http://ctan.org/pkg/amsthm
\theoremstyle{definition}
\newtheorem{defn}{Definition} % definition numbers are dependent on theorem numbers

\begin{document}
\begin{defn}
Let $x, y$ be some unknowns, we let:

\begin{align*}
x^2 - y^2 &:= (x+y)(x-y) \tag{\textit{i}} \label{eq:first} \\
    &:= (1+2)(3+4) \\
    &:= (5\times 6) \\
    &\phantom{:}= 30 \\
    &\phantom{:}= 60/2 \\ \\
x^2 - y^2 &:= (x+y)(x-y) \tag{\textit{ii}} \label{eq:second} \\
    &:= (1+2)(3+4)(5+6)(7+8)(9+0) \\
    &:= (1\times 2)(3\times 4)(5\times 6) \\
    &\phantom{:}= 123456789 \\
    &\phantom{:}= 42/2
\end{align*}
It is obvious that the mathematics in~\eqref{eq:first} and~\eqref{eq:second} is incorrect.
\end{defn}

\end{document}

\tag can be used to override the regular numbering and/or formatting.

Note that this will affect your equation numbering globally.

Moriambar
  • 11,466
Werner
  • 603,163