I am copying large formulas from a sympy session into Texmaker. These are along the lines of :
\documentclass[]{article}
\usepackage{amsmath}
\begin{document}
$$X''(x) = \left(- 2 C_{1} \sqrt{\lambda} \sin{\left (\sqrt{\lambda} x \right )} -
C_{1} \lambda \cos{\left (\sqrt{\lambda} x \right )} +
C_{1} \cos{\left (\sqrt{\lambda} x \right )} +
2 C_{2} \sqrt{\lambda} \cos{\left (\sqrt{\lambda} x \right )} -
C_{2} \lambda \sin{\left (\sqrt{\lambda} x \right )} +
C_{2} \sin{\left (\sqrt{\lambda} x \right )}\right) e^{x}$$
\end{document}
Needless to say they overflow the page and this is not what I want. I want to see the whole formula beginning to end. I tried to break it up using the environment suggested by a previous question but this did no good:
\begin{equation*}
\begin{split}
X''(x) = \left(- 2 C_{1} \sqrt{\lambda} \sin{\left (\sqrt{\lambda} x \right )} -
C_{1} \lambda \cos{\left (\sqrt{\lambda} x \right )} \\
+ C_{1} \cos{\left (\sqrt{\lambda} x \right )} + 2 C_{2} \sqrt{\lambda} \cos{\left (\sqrt{\lambda} x \right )} - \\
C_{2} \lambda \sin{\left (\sqrt{\lambda} x \right )} + C_{2} \sin{\left (\sqrt{\lambda} x \right )}\right) e^{x}\
\end{split}
\end{equation*}
The above threw about 20 errors on the line with \end{split}. This is strange because the following:
\begin{equation*}
\begin{split}
F = a+b+c- \\ & d+e+f+d- \\
e+f+g \
\end{split}
\end{equation*}
Worked just fine. Somebody please help with this. I have been searching for a solution about 2 hours now with no success. A real pain....






\documentclass{...}, the required\usepackage's,\begin{document}, and\end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – dexteritas Aug 01 '17 at 16:33\leftand\right. that's the usual source of (la)tex complaints. remember that the number of\lefts must equal the number of\rights in each "cell" of an equation subdivided by&and\\. once that's okay, nasty messages become much less frequent. – barbara beeton Aug 01 '17 at 16:48