4

I have an equation as below, I want text1 and text2, text3 are aligned as well.

\begin{equation}
\begin{aligned}
    A &= B \quad \text{text1}\\
    C &=
    \begin{cases}
      1 &        \text{text2} \\
      0 &        \text{text3}
    \end{cases} &
\end{aligned}
\end{equation}
7

You need to insert the same spacing as for the cases (only the first column), and correct for a "null delimiter" on the right:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\begin{align*}
  A &= \makebox[0pt][l]{$B$} 
    \hphantom{\begin{cases} 1\\0\end{cases}}\kern-\nulldelimiterspace
    \text{text1} \\
  C &=
    \begin{cases}
      1 & \text{text2} \\
      0 & \text{text3}
    \end{cases}
\end{align*}
\end{document}

The element B is inserted with a zero-width right overlap (equivalent to \rlap) to not interfere with the placement of text1.

1

enter image description here

An alternative where array environment with @{quad} alignment and {... \right is used.

\documentclass[]{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\begin{aligned}
    A &= B \quad\quad  \text{text1}\\
    C &=
\left \{
    \begin{array}{r@{\quad}l}
      1 &        \text{text2} \\
      0 &        \text{text3}
    \end{array} \right . &
\end{aligned}
\end{equation}
\end{document}

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.