3

I can create a curly brace around a set of equations (aligned at two positions!) using aligned:

\begin{equation}
\left\{
\begin{aligned}[2]
    &\rho   &&= \frac{\e^{- \lambda_2 \H/k}}{\e^{1 + \lambda_1/k}}
    \\
    &\Tr{\rho} &&= 1 
    \\
    &\Tr{\rho \H} &&= \braket{E} 
\end{aligned}
\right.
\end{equation}

enter image description here

Or, I can create a set of equations where every line has a number, but no curly brace, using alignat:

\begin{alignat}{2}
    &\rho   &&= \frac{\e^{- \lambda_2 \H/k}}{\e^{1 + \lambda_1/k}}
    \\
    &\Tr{\rho} &&= 1 
    \\
    &\Tr{\rho \H} &&= \braket{E} 
\end{alignat}

enter image description here

How can I create a set of equations (still aligned at two positions) that all have numbers (like in the second example), and they also have a curly brace (like in the first example)??

  • It was pointed out to me that this question has a very neat duplicate here: tex.stackexchange.com/questions/31951/separate-labels-in-cases, however none of the answers there address the case when the equation is aligned at two positions. – stack-delay Mar 27 '18 at 14:43
  • I have in fact found an elegant solution inspired by an answer at the near duplicate, but it seems I cannot add my solution as long as the question is flagged as duplicate. If you think my reasons for why this is different is enough, you can un-flag it and I will add my solution. – stack-delay Mar 27 '18 at 14:56
  • tex.stackexchange.com/a/150695/82917 contains a solution, though the formulation of the question is different, so not an exact dupe. – campa Mar 27 '18 at 15:10
5

It was pointed out that there exist a near duplicate to the question. However none of the answers there specifically address the situation where we have equations (and not conditions), and here the equations should be aligned at several points.

I was able to create the following solution after reading the answers in the near duplicate, using the empheq package, in combination with alignat.

\begin{empheq}[left={\empheqlbrace}]{alignat=2}
    &\rho &&= \frac{\e^{- \lambda_2 \H/k}}{\e^{1 + \lambda_1/k}}
    \\
    &\Tr{\rho} &&= 1 
    \\
    &\Tr{\rho \H} &&= \braket{E} 
\end{empheq}

enter image description here

| improve this answer | |
1

It's easy enough to fake the alignment using box measurements - something made easy using eqparbox:

enter image description here

\documentclass{article}

\usepackage{amsmath,cases,eqparbox,xparse}

\newcommand{\faketerm}[1][1]{\rule{#1 em}{1ex}}
% https://tex.stackexchange.com/a/34412/5764
\makeatletter
\NewDocumentCommand{\eqmathbox}{o O{c} m}{%
  \IfValueTF{#1}
    {\def\eqmathbox@##1##2{\eqmakebox[#1][#2]{$##1##2$}}}
    {\def\eqmathbox@##1##2{\eqmakebox{$##1##2$}}}
  \mathpalette\eqmathbox@{#3}
}
\makeatother

\begin{document}

\begin{numcases}{}
  \eqmathbox[lhs][l]{\faketerm[4]} = \faketerm[5] \\
  \eqmathbox[lhs][l]{\faketerm[3]} = 1            \\
  \eqmathbox[lhs][l]{\faketerm   } = \faketerm[2]
\end{numcases}

\end{document}

If you don't have any "explanations", then you can \unskip the additional space used between them as a replacement for your alignment:

\documentclass{article}

\usepackage{amsmath,cases}

\newcommand{\faketerm}[1][1]{\rule{#1 em}{1ex}}

\begin{document}

\begin{numcases}{}
  \faketerm[4] &\unskip {} = \faketerm[5] \\
  \faketerm[3] &\unskip {} = 1            \\
  \faketerm    &\unskip {} = \faketerm[2]
\end{numcases}

\end{document}
| improve this answer | |

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.