2

I am using the following code:

\documentclass{article}
\usepackage{cases}
\usepackage{amsmath,amsfonts}
\begin{document}

\begin{align*}
    \underset{\tau \in \mathbb{R}}{\min} \ \tau
\end{align*}
\begin{subnumcases}{\textrm{s.t.} \ \forall w \in {dom} f^*, \exists \lambda \in \mathbb{R}^q: }
    d^\top \lambda + w^\top b - f^*(w) \leq 0 \\
    D^\top \lambda \geq A^\top w \\
    \lambda \geq \mathbf{0}
\end{subnumcases}

\end{document}

To produce the following: enter image description here

I am happy with the result, but I don't feel like I am doing the correct thing. Both of the min term and s.t. term belong to the same optimization problem. When I define the minimization line with align* and the constraints with subnumcases, then there are problems like:

  1. A new page can start right after the 'min' part
  2. When I use label, ref, then it says Problem (3.2), but actually, the min tau line is not in Problem 3.2
  3. In similar but bigger problems, the alignment looks odd

Thus, I will be very happy to hear some suggestions!

  • True, this is a part from a big project so I couldn't copy-paste the relevant packages. Now I am fixing it. – independentvariable May 5 at 20:02
  • Fixed them all, now working on \DeclareMathOperator. Do you have any idea about how I can combine the align* term and subcases term? Thank you – independentvariable May 5 at 20:09
  • 1
    thanls for completing the example (although it doesn't allow anyone to comment on the \label issue which is presumably a problem in an earlier \begin{problem} leaking the \label information? – David Carlisle May 5 at 20:14
  • It is very hard to illustrate the label-ref issue for me because I need to give a full page where this problem will be separated due to the issue I mention etc. I will try to also give a convenient example of this. – independentvariable May 5 at 20:19
3

I'd probably just use cases but if you definitely want the subnumcases layout you could use a minipage to keep things together.

enter image description here

enter image description here

\documentclass{article}
\usepackage{mathtools,amsfonts,cases}
\DeclareMathOperator\dom{dom}
\begin{document}

using gather
\begin{gather*}
    \min_{\tau \in \mathbb{R}} \tau\\
\shortintertext{s.t.}
\forall w \in \dom f^*, \exists \lambda \in \mathbb{R}^q
\begin{cases}
    d^\top \lambda + w^\top b - f^*(w) \leq 0 \\
    D^\top \lambda \geq A^\top w \\
    \lambda \geq \mathbf{0}
\end{cases}
\end{gather*}


a\\a\\a\\a\\a\\a\\a\\a\\
a\\a\\a\\a\\a\\a\\a\\a\\
a\\a\\a\\a\\a\\a\\a\\a\\
a\\a\\a\\a\\a\\a\\a\\a\\
a\\a\\a

using [\\
\noindent\begin{minipage}{\textwidth}
\noindent\[
    \min_{\tau \in \mathbb{R}} \tau\\
\]
s.t.
\begin{subnumcases}
{\forall w \in \dom f^*, \exists \lambda \in \mathbb{R}^q}
    d^\top \lambda + w^\top b - f^*(w) \leq 0 \\
    D^\top \lambda \geq A^\top w \\
    \lambda \geq \mathbf{0}
\end{subnumcases}
\end{minipage}
\end{document}
3

I propose this variant layout, using the facilities of the optidef package, dedicated to the layout of optimisation problems:

\documentclass{article}
\usepackage{mathtools, amsfonts}
\usepackage[short]{optidef}
\usepackage{cleveref} 
\DeclareMathOperator{\dom}{dom}

\begin{document}

    \begin{mini!}
        {\mathclap{\tau\in\mathbb{R}}}{\tau \notag}
        {}{}
        \addConstraint{}{ d^\top \lambda + w^\top b - f^*(w) \leq 0\label{eqa}}
        \addConstraint{\forall w \in \dom f^*, \exists \lambda \in \mathbb{R}^q:\smash{\begin{cases}\\\\\\\end{cases}}\hspace*{-1em}}{D^\top \lambda \geq A^\top w \label{eqb}}
        \addConstraint{}{\lambda \geq \mathbf{0}\label{eqc}}
   \end{mini!}
We can see from \cref{eqa,eqb,eqc}

\end{document} 

enter image description here

  • That's very nice, but also hard :) I will look for the documentation of optidef! – independentvariable May 5 at 20:25
  • Also, do you think it is impossible to merge the align* and subnumcases parts of my code? – independentvariable May 5 at 20:25
  • 1
    I tried to use subnumcases as a ‘subenvironment’ once (somewhat like aligned), but wasn't able to do it (this doesn't prove it's impossible, though). – Bernard May 5 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.