# Can't generate png with Error: Erroneous nesting of equation structures

i am trying to generate pdf file from latex document with formula below

\documentclass[border=2pt]{standalone}
\usepackage{amsmath}
\usepackage{varwidth}
\begin{document}
\begin{varwidth}{\linewidth}
-\frac{\sqrt{2{{x}^{2}}-5x+2}}{3}\le x<0 \Leftrightarrow \left\{ \begin{align} & x<0 ,\\ & -3x\le \sqrt{2{{x}^{2}}-5x+2} \end{align} \right. \Leftrightarrow \left\{ \begin{align} & x<0 ,\\ & 9{{x}^{2}}\le 2{{x}^{2}}-5x+2 \end{align} \right. \Leftrightarrow \left\{ \begin{align} & x<0 ,\\ & 7{{x}^{2}}+5x-2\le 0 \end{align} \right. \Leftrightarrow
\end{varwidth}
\end{document}


and got error message

! Package amsmath Error: Erroneous nesting of equation structures; (amsmath) trying to recover with aligned'.

See the amsmath package documentation for explanation. Type H for immediate help. ...

l.10 \end{align} \right. \Leftrightarrow \left{ \begin{align}

• Don't use align inside equation. Use aligned instead. – user11232 Oct 27 '15 at 15:56
• Or rather the starred variant. Having a varwidth environment is a bit useless, ase you are using standalone – Johannes_B Oct 27 '15 at 15:58

Don't use align inside equation. Use aligned instead. Also there is no need for varwidth. The standalone class provides that option itself.

\documentclass[border=5pt,varwidth]{standalone}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
-\frac{\sqrt{2{{x}^{2}}-5x+2}}{3}\le x<0 \Leftrightarrow \left\{ \begin{aligned}
&   x<0  ,\\
&   -3x\le \sqrt{2{{x}^{2}}-5x+2}
\end{aligned} \right. \Leftrightarrow \left\{ \begin{aligned}
&   x<0  ,\\
&   9{{x}^{2}}\le 2{{x}^{2}}-5x+2
\end{aligned} \right. \Leftrightarrow \left\{ \begin{aligned}
&   x<0  ,\\
&   7{{x}^{2}}+5x-2\le 0
\end{aligned} \right. \Leftrightarrow
\end{equation*}
\end{document}
`

• Harish, thank you for your answer. But i got this document from third side and cannot change content. Perhaps i can change but it means that i am must parse file before generate pdf. – Stanislav Sviridenko Oct 27 '15 at 19:14