2

I am using the following environment to align optimization problem statements from Typesetting an optimisation problem

\documentclass{report}
\usepackage{amsmath}

\newcommand{\norm}[1]{\lVert#1\rVert_2}

\begin{document}

    \begin{subequations}
        \begin{alignat}{2}
        &\!\min_{x}        &\qquad& \norm{f(x)}^2\label{eq:optProb}\\
        &\text{subject to} &      & \alpha + (\beta*\gamma)\geq 0,\label{eq:constraint1}\\
        &                  &      & \beta \geq 0.\label{eq:constraint2}
        \end{alignat}
    \end{subequations}

\end{document}

How can I additionally align the "condition" at the \geq sign such that it looks like this:

enter image description here

Manuel Schmidt
  • 3,537
  • 1
  • 19
  • 33

2 Answers2

5

I suggest using the optidef package instead, which is done for the layout of optimisation problems, and has several variants:

\documentclass{report}
\usepackage{amsmath, optidef}

\newcommand{\norm}[1]{\lVert#1\rVert_2}

\begin{document}

\begin{mini!}
  {x}{ \norm{f(x)}^2 \label{eq:optProb}}{}{}
\addConstraint{\alpha + (\beta*\gamma)}{ \geq 0,\label{eq:constraint1}}
\addConstraint{\beta}{\geq 0.\label{eq:constraint2}}
\end{mini!}

\end{document} 

enter image description here

Bernard
  • 271,350
2

I changed the alignat parameter and added some &

\documentclass{report}
\usepackage{amsmath}

\newcommand{\norm}[1]{\lVert#1\rVert_2}

\begin{document}

    \begin{subequations}
        \begin{alignat}{3}
        &\!\min_{x}        &\qquad& \norm{f(x)}^2           & \label{eq:optProb}\\
        &\text{subject to} &      & \alpha + (\beta*\gamma) & \geq 0,\label{eq:constraint1}\\
        &                  &      & \beta                   &\geq 0.\label{eq:constraint2}
        \end{alignat}
    \end{subequations}

    % edit
    \begin{subequations}
        \begin{alignat}{3}
        &\!\min_{x}        &\qquad&& \norm{f(x)}^2           & \label{eq:optProb}\\
        &\text{subject to} &      && \alpha + (\beta*\gamma) & \geq 0,\label{eq:constraint1}\\
        &                  &      && \beta                   &\geq 0.\label{eq:constraint2}
        \end{alignat}
    \end{subequations}

\end{document}

See, for instance, this post for details.

NBur
  • 4,326
  • 10
  • 27