2

The code below generates the following figure:

enter image description here

Is there a way to align these two equations, like this:

enter image description here

i.e., align at the beginning of the bracket (not the at the equal signs!)

I have consulted several other questions, but they either did not have "cases", or they did not have equations labels. Thus the code will not work with labelled equations.

Does anyone know a catch-all method for aligning these types of equations? Thanks in advance!

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{graphicx}

\begin{document}
    \begin{equation}
    \label{eqn:equation1}
    \begin{cases}
    a &= b^2 + c^2\\
    y(t) & = a
    \end{cases}
    \end{equation}
    now, the second equation
    \begin{equation}
    \label{eqn:equation2}
    \begin{cases}
    b &= \sin(b^2) + c^2\\
    y(t) & = b
    \end{cases}
    \end{equation}
\end{document}

Update: Please also assume that the equations are tagged

\begin{document}
    \begin{equation}
    \tag*{eq 1}
    \label{eqn:equation1}
    \begin{cases}
    a &= b^2 + c^2\\
    y(t) & = a
    \end{cases}
    \end{equation}
    now, the second equation
    \begin{equation}
    \tag*{eq 2}
    \label{eqn:equation2}
    \begin{cases}
    b &= \sin(b^2) + c^2\\
    y(t) & = b
    \end{cases}
    \end{equation}
\end{document}
2
  • 1
    You could use \intertext, see here: tex.stackexchange.com/questions/29119/…, for example.
    – CarLaTeX
    Sep 13, 2017 at 5:32
  • The use of cases here doesn't really fit with the alignment of the equations within the brackets. The spacing is wrong between the LHS and RHS.
    – Werner
    Sep 13, 2017 at 20:04

2 Answers 2

3

You can use \intertext, from the amsmath package, inside an align environment:

enter image description here

This sort of example, I believe, is exactly why the \intertext command exits: it inserts a "normal" line of text between equations that have common alignment points.

Here's the full MWE:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{graphicx}

\begin{document}
    \begin{align}
    \tag*{eq 1}
    \label{eqn:equation1}
    &\begin{cases}
    a &= b^2 + c^2\\
    y(t) & = a
    \end{cases}
    \intertext{now, the second equation}
    \tag*{eq 2}
    \label{eqn:equation2}
    &\begin{cases}
    b &= \sin(b^2) + c^2\\
    y(t) & = b
    \end{cases}
    \end{align}
\end{document}
3
  • Oh, I see that @CarLaTeX has already suggested \intertext in the comments... +1
    – user30471
    Sep 13, 2017 at 7:51
  • 1
    Of course, the spacing around the relation = is incorrect here, since the space is provided as the separation between the case and it's domain, rather than the relation spacing.
    – Werner
    Sep 19, 2017 at 18:18
  • @Werner Yes I agree.
    – user30471
    Sep 20, 2017 at 18:39
2

You can set both using aligned, and add the largest right-hand side to the shorter construction (top) via a \phantom:

enter image description here

\documentclass{article}

\usepackage{mathtools}

\begin{document}

\begin{equation}
  \tag*{eq 1} \label{eqn:equation1}
  \left\{\begin{aligned}
    \mathrlap{a}\phantom{y(t)} &= b^2 + c^2 \\
                         y(t)  &= \mathrlap{a}
                                  \phantom{\sin(b^2) + c^2}
  \end{aligned}\right.
\end{equation}
now, the second equation
\begin{equation}
  \tag*{eq 2} \label{eqn:equation2}
  \left\{\begin{aligned}
    \mathrlap{b}\phantom{y(t)} &= \sin(b^2) + c^2 \\
                         y(t)  &= b
  \end{aligned}\right.
\end{equation}

\end{document}

Left-hand side adjustments follow a similar pattern of overlapping and \phantom placement to achieve a left-aligned look.

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.