9

In my work, I am trying to typeset the following system of equations.

\begin{equation*}
\begin{cases}
\pi_n  (i) = {n^2}/{\vol(G_n)} \cr
\pi_n (j) =  {n}/{\vol(G_n)} \cr
q^{(n)}_{ij} = {1}/{n^2 } \cr
q^{(n)}_{ji} = {1}/{n}
\end{cases}
\end{equation*}

However, I would like to align the equal signs. If I do this by adding ampersands (see below), too much space is added before the equal signs, which makes the system of equations look worse than before. Is there any other non-manual way to align the equations?

\begin{equation*}
\begin{cases}
\pi_n  (i) &= {n^2}/{\vol(G_n)} \cr
\pi_n (j) &=  {n}/{\vol(G_n)} \cr
q^{(n)}_{ij} &= {1}/{n^2 } \cr
q^{(n)}_{ji} &= {1}/{n}
\end{cases}
\end{equation*}

Example of the problem

  • You could replace the cases environment with \left\{ \begin{aligned} ... \end{aligned}\right. – Thruston Oct 13 '14 at 11:52
9

I think that you want to use \left\{...\right. around your equation. To be able to align your equations inside these you can use the split environment from the amsmath package.

EDIT

In the comments both above and below the consensus is that the aligned environment is superior to split in this situation. Perhaps I am missing it but I can't see the difference in this example, however, as people more knowledgeable than I are advocating using the aligned environment there must be cases where it does matter.

Here is a comparison of the two environments for this example:

enter image description here

This produces:

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator\vol{\text{vol}}
\begin{document}
\[\left\{
  \begin{aligned}
    \pi_n  (i) &= {n^2}/{\vol(G_n)} \cr
    \pi_n (j) &=  {n}/{\vol(G_n)} \cr
    q^{(n)}_{ij} &= {1}/{n^2 } \cr
    q^{(n)}_{ji} &= {1}/{n}
  \end{aligned}\right.\tag{\textbf{aligned}}
\]

\[\left\{
  \begin{split}
    \pi_n  (i) &= {n^2}/{\vol(G_n)} \cr
    \pi_n (j) &=  {n}/{\vol(G_n)} \cr
    q^{(n)}_{ij} &= {1}/{n^2 } \cr
    q^{(n)}_{ji} &= {1}/{n}
  \end{split}\right.\tag{\textbf{split}}
\]

\end{document}
  • 1
    I'd use aligned rather than split. – egreg Oct 13 '14 at 12:02
  • 1
    @egreg I've edited my answer to use both aligned and split. In this example I can't see the difference but I assume that in some cases it does matter. What is the advantage in general? – Andrew Oct 13 '14 at 12:14
  • 3
    aligned allows several column pairs, while split just one. – egreg Oct 13 '14 at 12:18
1

Stab with empheq:

\documentclass{article}
\usepackage{empheq}
\DeclareMathOperator\vol{\text{vol}}
\begin{document}
\begin{empheq}[left=\empheqlbrace]{align*}
\pi_n  (i)   &= {n^2}/{\vol(G_n)} \cr
\pi_n (j)    &=  {n}/{\vol(G_n)} \cr
q^{(n)}_{ij} &= {1}/{n^2 } \cr
q^{(n)}_{ji} &= {1}/{n}
\end{empheq}
\end{document}

enter image description here

  • Is this solution preferable to the solution above? – malin Oct 13 '14 at 13:58
  • @malin If you have more exploits of empheq, then yes. – user11232 Oct 13 '14 at 14:01
  • 1
    @malin also empheq allows you equation numbering of each line - something aligned won't do. – Morten Høgholm Nov 29 '16 at 1:55

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.