4

I'm pretty new to Latex and I am working with a bunch of formulae. I'd like to give each of them different numbering and this is what I've got:

\begin{align}
\begin{split}
 &|\Theta_P| = {|P| \choose 2} \land P \not= \emptyset
\end{split} \\
\begin{split}
 & \forall D_n \in \Theta_P \\
 & \qquad \left(d_n,\delta_n\right) := D_n \\
 & \qquad\qquad |d_n| =2\\
 & \qquad\qquad d_n\in \mathcal{P}(P)\\
 & \qquad\qquad |\delta_n| = 2 \\
 & \qquad\qquad \bigcup \delta_n = P \setminus d_n \\
 & \qquad\qquad \bigcap \delta_n = \emptyset \\
  \end{split} \\
 \begin{split}
  & \forall D_n, D_m \in \Theta_P \\
 & \qquad \left(d_n,\delta_n\right):= D_n \\
  & \qquad \left(d_m,\delta_m\right):= D_m \\
 & \qquad\qquad d_n=d_m \iff D_n=D_m \\
\end{split} 
\end{align}

It is working good.

works

However, after some read-up I figured perhaps I should be using equation for my formulae instead of align. But when I changed align to equation above I run into this error:

Missing number, treated as zero

and it mentioned something about \relax \end{split} \\.

I tried removing the \\ between split blocks but it would make the 3 formulae aligned horizontally, which is not what I want.

Why am I running into this error and what should I do to use equation in this scenario?

  • In that case you shouldn't use equation I think. gather might be more appropriate than align though, you're not aligning the three splits. – Torbjørn T. Aug 29 '15 at 19:43
  • @TorbjørnT. Ohh, thanks for the suggestion. But should I try to keep my syntax as consistent as possible? I used equations most of the times since it helps to squeeze the symbols together. – Archy Will He 何魏奇 Aug 29 '15 at 19:48
  • The first split is redundant; you shouldn't have \\ before \end{split}. Also {|P|\choose 2} should be \binom{|P|}{2}. Note that equation is wrong and align is right. – egreg Aug 29 '15 at 20:18

2 Answers2

6

The equation environment is for single line (or single split) equations; in this case you do need align.

The first split is redundant and \\ before \end{split} should be omitted. Also \choose should not be used with amsmath and

\binom{|P|}{2}

is the correct syntax.

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{align}
 &|\Theta_P| = \binom{|P|}{2} \land P \not= \emptyset
\\
\begin{split}
 & \forall D_n \in \Theta_P \\
 & \qquad (d_n,\delta_n) := D_n \\
 & \qquad\qquad |d_n| =2\\
 & \qquad\qquad d_n\in \mathcal{P}(P)\\
 & \qquad\qquad |\delta_n| = 2 \\
 & \qquad\qquad \bigcup \delta_n = P \setminus d_n \\
 & \qquad\qquad \bigcap \delta_n = \emptyset
\end{split} \\
\begin{split}
 & \forall D_n, D_m \in \Theta_P \\
 & \qquad (d_n,\delta_n):= D_n \\
 & \qquad (d_m,\delta_m):= D_m \\
 & \qquad\qquad d_n=d_m \iff D_n=D_m
\end{split} 
\end{align}
\end{document}

I also removed the redundant \left\right pairs.

enter image description here

Torbjørn T.
  • 206,688
egreg
  • 1,121,712
3

I propose one of these variants.I replaced := with \coloneqq form mathtools to have a vertically centred colon w.r.t. the axis of the = sign:

\documentclass{article}

\usepackage{mathtools}

\begin{document}

\begin{alignat}{2}
  &\mathrlap{\lvert\Theta_P\rvert = \binom{\lvert P\rvert}{2} \land P \not= \emptyset}\\[1.5ex]
    & \forall D_n \in \Theta_P & \quad & \begin{aligned}[t] & (d_n,\delta_n) \mkern-2mu\coloneqq D_n \\
  & \lvert d_n\rvert =2\\
  & d_n \in \mathcal{P}(P)\\
  & \lvert\delta_n\rvert = 2\\
  &\bigcup \delta_n = P \setminus d_n \\
  & \bigcap \delta_n = \emptyset
  \end{aligned}\\[1.5ex]
    & \forall D_n, D_m \in \Theta_P & \quad & \begin{aligned}[t] & (d_n,\delta_n) \mkern-2mu\coloneqq D_n \\
  &(d_m,\delta_m) \coloneqq D_m\\
  & d_n= d_m \iff D_n=D_m
  \end{aligned}
\end{alignat}

\begin{alignat}{2}
  &\mathrlap{\lvert\Theta_P\rvert = \binom{\lvert P\rvert}{2} \land P \not= \emptyset}\\[1.5ex]
    & \forall D_n \in \Theta_P & \quad & \begin{aligned}[t] \renewcommand\arraystretch{1.25}\begin{array}[t]{|@{\hskip0.6em}l}
  (d_n,\delta_n) \mkern-2mu\coloneqq D_n \\
  \lvert d_n\rvert =2\\
  d_n \in \mathcal{P}(P)\\
  \lvert\delta_n\rvert = 2\\
  \bigcup \delta_n = P \setminus d_n \\
  \bigcap \delta_n = \emptyset
  \end{array}
  \end{aligned}\\[1.5ex]
    & \forall D_n, D_m \in \Theta_P & \quad & \begin{aligned}[t] \renewcommand\arraystretch{1.25}\begin{array}[t]{|@{\hskip0.6em}l}
  (d_n,\delta_n) \mkern-2mu\coloneqq D_n \\
  (d_m,\delta_m) \coloneqq D_m\\
  d_n= d_m \iff D_n=D_m
  \end{array}
  \end{aligned}
\end{alignat}

\end{document} 

enter image description here

Bernard
  • 271,350