I would like to align 6 and 7 with equation 8 and 9. I wish to align this at the equals sign.

What I have now:

enter image description here

which I got using the code below:

    \begin{numcases}{O(t) =}
        \textbf{W}^T S(t), & $\text{if } S(t) \in Signal$; \\
        \textbf{0}, & \text{if } otherwise,

        CSM &= \pi_{1} (O(t)) \label{eq:pi1} \\[10pt]
        K &= \pi_{2} (O(t)) \label{eq:pi2} \

What I need:

enter image description here

  • Wouldn't it be more sensible to number the cases as, say, 6aand 6b.
    – Bernard
    Commented Feb 14, 2018 at 22:03
  • yeah @Bernard that would make sense also. But right now my problem lies in aligning the number cases and the two other equations 8 and 9.
    – cidi30bg
    Commented Feb 14, 2018 at 22:04
  • @obiigbe91 Do you really need separate number for the cases of zero and the other(?), or one number for the whole equation would be ok? Asking because the default for math and latex is to give one number to the whole equation... Since it is just the O(t)... Offtopic: "If otherwise" is bad English even for me.. that I am really bad in English ("otherwise" contains an if)
    – koleygr
    Commented Feb 14, 2018 at 22:10
  • @koleygr I would like them to be in separate numbers. But the numcases can be 6a and 6b like Bernard pointed out
    – cidi30bg
    Commented Feb 14, 2018 at 22:14

2 Answers 2


Here is just one option:

enter image description here



% https://tex.stackexchange.com/a/34412/5764
\NewDocumentCommand{\eqmathbox}{o O{c} m}{%




    \strut \\ \strut


\begin{numcases}{O(t) =}
  \mathbf{W}^T S(t), & if $S(t) \in \text{Signal}$; \\
         \mathbf{0}, & otherwise,
  CSM &= \pi_1 (O(t)) \\
    K &= \pi_2 (O(t))


  %\startsubequations % Start subequation numbering
    & \hphantom{\LBRACE}\eqmathbox[nc][l]{\mathbf{W}^T S(t), \quad} \text{if $S(t) \in \text{Signal}$;} \\
  \raisebox{.5\dimexpr\baselineskip+\jot}[0pt][0pt]{$O(t) ={}$} &
    \eqmathbox[nc][l]{\mathbf{0},} \text{otherwise,} \\
  %\stopsubequations % Stop sub-equation numbering
  CSM ={} & \pi_1 (O(t)) \\
    K ={} & \pi_2 (O(t))


The approach fakes a numcases environment by placing four regular equations in an align. The grouping of the first two is done by moving the left-hand side O(t) = and the left delimiter { into place (vertically upward) from the second equation.

Some box width calculations are automated using eqparbox for the different conditions.

Spacing between the left brace grouping and conditions and textual components can be changed, if needed.

...and if you want to sub-number the equations you can use the ConTeXt-esque approach of \startsubequations ... \stopsubequations:

enter image description here


I can get what you want with a horrible code, adjusting fake lengths:


O(t) &= {} \hspace*{-1.35cm}\makebox[0.3\linewidth]{\begin{subnumcases}{\hspace*{3.08cm}}
\textbf{W}^T S(t), & if $S(t) \in$ Signal; \\
\textbf{0}, & otherwise,
\end{subnumcases} }\notag
CSM &= \pi_{1} (O(t)) \label{eq:pi1}
K &= \pi_{2} (O(t)) \label{eq:pi2} \
\end{align}% \end{subequations}


enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .