对齐嵌套案例

对齐嵌套案例

代码

\documentclass[a4paper,twoside,12pt]{book}
\usepackage{amstext}
\usepackage[utf8]{inputenc}
\usepackage{cases}
\usepackage{amsmath}

\begin{document}
\begin{subnumcases}{}\label{eq:regola_scelta_reject}
    \begin{aligned}
    objective   &: \qquad \min \quad \sum_{j=1}^{H}x_jw_j\\
    subject to  &: \qquad \displaystyle\sum_{j=1}^{H}x_jw_j \geq W_L\\
    \end{aligned} \label{eq:regola_scelta_reject_1}\\
    \begin{aligned}
    objective   &: \qquad \min \quad \sum_{j=1}^{H}x_jw_j \vee H_{e} \geq 2 \\  
    subject to  &: \qquad \displaystyle\sum_{j=1}^{H}x_jw_j < W_L\\
    \end{aligned} \label{eq:regola_scelta_reject_2}\\
\end{subnumcases}
\end{document}

我做错了什么?这就是我想要实现的目标:

例子

答案1

在此处输入图片描述

\documentclass[a4paper,twoside,12pt]{book}
\usepackage{amstext}
\usepackage[utf8]{inputenc}


\usepackage{amsmath}
\usepackage{cases}

\begin{document}
\begin{subnumcases}{}\label{eq:regola_scelta_reject}
    \mbox{objective:}&$\displaystyle \qquad \min\sum_{j=1}^{H}x_jw_j$\\
    \mbox{subject to:}  &$\displaystyle \qquad \sum_{j=1}^{H}x_jw_j \geq W_L$\\[12pt]
     \xdef\theparentequation{\the\numexpr\theparentequation+1}%
     \setcounter{equation}{1}%
      \mbox{objective:}&$\displaystyle \qquad \min \sum_{j=1}^{H}x_jw_j \vee H_{e} \geq 2$ \\  
    \mbox{subject to:}  &$\displaystyle \qquad \sum_{j=1}^{H}x_jw_j < W_L$ \label{eq:regola_scelta_reject_2}
\end{subnumcases}
\end{document}

答案2

如果我理解得没错的话,这个代码可能适合你的需求。你需要使用th 选项empheq的包(加载amsmathoverload来获得更简单的代码:

        \documentclass[a4paper]{article}
        \usepackage[utf8]{inputenc}
        \usepackage{mathtools}
        \usepackage[overload]{empheq}

        \begin{document}

        \begin{align}[left = (R)\enspace\empheqlbrace]%\label{eq:regola_scelta_reject}\smash[t]\smash[b]
         &  \begin{alignedat}{2}\label{eq:regola_scelta_reject_1}
          &  \text{objective: } & &  \min \sum_{j=1}^{H} x_j w_j\\
           & \text{subject to: } &\qquad   & \sum_{j=1}^{\smash H} x_j w_j \geq W_L\\
         \end{alignedat}\\]
            &   \begin{alignedat}{2} \label{eq:regola_scelta_reject_2}
          &  \text{objective: } & &  \min  \sum_{j=1}^{H}x_jw_j \vee H_{e} \geq 2 \\
           & \text{subject to: } & \qquad  & \sum_{j=1}^{\smash H} x_jw_j < W_L
         \end{alignedat}\
        \end{align}

        \end{document}

结果是: 在此处输入图片描述

请注意,您不能为对齐外部环境添加标签用于内部对齐环境。我为外部对齐模拟了一个标签 ((R))。

相关内容