# [Tex/LaTex] Ignoring alignment for certain lines in an alignat environment

alignmath-mode

I am having trouble typesetting an optimization problem, and would like to know how to ignore the alignment for a certain line in an alignat environment.

I've currently typeset the optimization problem as:

\begin{alignat}{4}
\centering
\min_{\lambda} \quad & \frac{1}{N} \sum_{i = 1}^N{\alpha_i} & + & C_0 \sum_{i = 1}^N{\beta_i} & + & C_1 \sum_{i = 1} ^N{\gamma_i} \\
s.t. \quad & -M\alpha + \epsilon & \leq & \lambda^T X y & \leq & M(1-\alpha) + \epsilon \\
& -\beta \bar{\lambda}  & \leq &  \lambda & \leq & \beta \bar{\lambda} \\
&-\gamma & \leq & \lambda & \leq & \gamma \\
& \lambda \in \mathbb{Z}^P & \quad & \alpha \in \{0,1\}^N  &\quad & \beta, \gamma \in \{0,1\}^P
\end{alignat}


However this runs into issues since the bottom line causes weird spacing.

I would appreciate any formulations that can make this mess legible in some way… That said, I think that I can get around this problem if I can just tell the alignat environment to ignore the last line, and also center the contents between each of the & signs.

I wouldn't try aligning the inequalities: the formulas are too different from each other. Here's a possibility:

\documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}
\begin{gather}
\min_{\lambda}
\,\frac{1}{N} \sum_{i=1}^N{\alpha_i} +
C_0 \sum_{i=1}^N{\beta_i} +
C_1 \sum_{i=1} ^N{\gamma_i}
\\
\begin{align}
&{-}M\alpha + \epsilon \leq \lambda^T X y \leq M(1-\alpha) + \epsilon \\[1ex]
&{-}\beta \bar{\lambda} \leq \lambda \leq \beta \bar{\lambda} \\[1ex]
&{-}\gamma \leq \lambda \leq \gamma \\[1ex]

It's necessary to use {-} because otherwise the minus sign would be detached from the symbol it refers to. 