# Trouble with align* environment

I have no idea what the following code is giving me an error; I

Package amsmath Error: Erroneous nesting of equation structures;


Could you please enlighten me as to where the mistake is? Thank you very much.

MWE

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}

\begin{document}
\begin{align*} d(a, b) &\le d_0(a, b)\\ \iff \dfrac{y}{1+y} &\le y\\ \iff y &\le y+y^2\\ \iff 0 &\le y^2 \end{align*}
\end{document}

• Erroneous nesting of equation structures did tell you that you had something extra. Sep 30 '19 at 0:58
• Independently of not having to be used with an amsmath environment, it should not be used with LaTeX. When you have a numberless displayed equation, use $...$ instead. Sep 30 '19 at 0:58
• @CasperYC I'll try to remember that.
– Ovi
Sep 30 '19 at 1:00
• @Bernard Yeah I have to read that thread with the benefits of \ [ \ ] over 
– Ovi
Sep 30 '19 at 1:01

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}

\begin{document}

\begin{align*}
d(a, b)             & \le d_0(a, b)\\
\iff \dfrac{y}{1+y} & \le y\\
\iff y              & \le y+y^2\\
\iff 0              & \le y^2
\end{align*}

\end{document}


You don't really need the  for this environment.

• Thank you!!! Ahhh I hate all these little rules that are never explicitly said anywhere.
– Ovi
Sep 30 '19 at 0:55
• I got used to it now. I was like the same. Had to try different variations. Sep 30 '19 at 0:58
• @Ovi These are not obscur weird rules ;) As explained in the mathtools package documentation, there are two versions of environments for mathematics: inner and outer. align is an outer environment, so it is not meant to be nested. The inner version is aligned, which can be used inside equation, for instance. One obvious reason for such a structure is that outer environments can number your equations, be labeled, and so on. I hope that this short explanation will help you. Sep 30 '19 at 7:26