I am trying to typeset a multiple line optimization problem in LaTeX.
I have had a lot of difficulty using the align
and alignat
environments to get things to align properly.
I recently managed to find a solution that can get proper alignment by using an array
environment inside of an align
environment. A sample of this code looks like
\documentclass{article}
\usepackage{amsmath,array}
\begin{document}
\begin{align}
\centering
\begin{array}{>{\displaystyle}l>{\displaystyle}c>{\displaystyle\hspace{0.5cm}}l}
\min_{\bm{\alpha},\bm{\beta},\bm{\gamma},\lambdab} & \frac{1}{N}\sum_{i=1}^{N}\alpha_i + C_0\sum_{j=1}^{P}\beta_j + C_1\sum_{j=1}^{P}{\gamma_j} & \\
\textrm{s.t.} & & \\
& -M\alpha_i + \varepsilon \leq y_i \mathbf{x}_i^T \lambdab \leq M(1-\alpha_i) + \varepsilon & i= 1\ldots N \\
& -M\alpha_i + \varepsilon \leq y_i \mathbf{x}_i^T \lambdab \leq M(1-\alpha_i) + \varepsilon & i= 1\ldots N
\end{array}
\end{align}
\end{document}
\documentclass{article}
My issue here is that I cannot number each of the rows inside the array environment. I am wondering if anyone knows a way to number / label these rows?
I realize that there have been several solutions that have been posted here, but in many cases the fix seems involve defining my own numbering system within the equations. I would rather try to avoid this since I am using numbering throughout the remainder of the paper, and I think that this would produce a conflict (I could be wrong).
If not, I would be happy with any solution that can generically produce this type of alignment (i.e. 3 columns, 1 left centered; 1 middle centered; 1 left centered).
\documentclass{...}
and ending with\end{document}
. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to help you. Help them help you: remove that one hurdle between you and a solution to your problem. – jub0bs Nov 7 '13 at 19:05