I'm working with a particularly hairy minimization problem that I would like to split into at least three lines. Here's some sample code so you can follow me.
\documentclass{article}
\usepackage[long]{optidef}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\begin{split}
&\min_{\mathbf{\widetilde H}^\ast, \mathbf{L}^\ast, \delta^\ast,\gamma^\ast } \\ &{\left[ \sum\nolimits_{(i,t) \in \mathcal{O}} \frac{1}{|\mathcal{O}|}(Y_{it} -L_{it}-\sum_{p=1}^{P} \sum_{q=1}^{Q}X_{ip}H_{pq}Z_{qt}-\gamma_{i} - \delta_{i} - V_{it}\beta)^2\right]}
\end{split}
\end{equation}
\end{document}
So, what we have here is a decent start. And perhaps I'd accept it, if it were the end of the equation. The full equation is
&\min_{\mathbf{\widetilde H}^\ast, \mathbf{L}^\ast, \delta^\ast,\gamma^\ast } \\ &{\left[ \sum\nolimits_{(i,t) \in \mathcal{O}}
\frac{1}
{|\mathcal{O}|}(Y_{it} -L_{it}-\sum_{p=1}^{P} \sum_{q=1}^{Q}X_{ip}H_{pq}Z_{qt}
-\gamma_{i} - \delta_{i} - V_{it}\beta)^2
+ \lambda_{L}\|\mathbf{L}\|_{\ast}+ \lambda_{H}\|\mathbf{H}\|_{1,e} \right]}
\end{split}
\end{equation}
The code still compiles, but it still looks awkward. What if I wanted to split it into three lines? Or, what about 5? My next attempt was
&\min_{\mathbf{\widetilde H}^\ast, \mathbf{L}^\ast, \delta^\ast,\gamma^\ast } \\ &{\left[ \sum\nolimits_{(i,t) \in \mathcal{O}} \frac{1}{|\mathcal{O}|} \\ &(Y_{it} -L_{it}-\sum_{p=1}^{P} \sum_{q=1}^{Q}X_{ip}H_{pq}Z_{qt}-\gamma_{i} - \delta_{i} - V_{it}\beta)^2+ \lambda_{L}\|\mathbf{L}\|_{\ast}+ \lambda_{H}\|\mathbf{H}\|_{1,e} \right]}
but when I try this, I get ! Missing } inserted. <inserted text> }
What am I missing here? I've tried nesting split and optidef, as well as optidef and multline, but I haven't been able to split this into more than two lines. I know there must be a simple solution to this, but I'm new to LaTex and have never needed to split before. Thanks so much!.
\\
You have not said what errors you got, perhaps the issue is the spurious{....}
that you have around the terms after&
which will prevent any line breaking?