0

I am trying to make some alignment with cases inside an align environment.

\documentclass[preview]{standalone}
\usepackage{amsmath}
\begin{document}
\begin{align*}
&F(x) = xy &\quad hello world \\
&F(x) =
\begin{cases}
x(n),       &\quad foo \\
x(n-1)      &\quad bar 
\end{cases}
\end{align*}
\end{document}

I get this result: enter image description here

I want the hello world, foo and bar to be aligned.

2
  • 1
    1st: remove empty lines inside align environment.
    – Sigur
    Apr 7, 2022 at 14:12
  • The alignment point inside cases is internal to cases. The corresponding alignment point in align must be to right of the the entire cases environment. Apr 7, 2022 at 17:14

3 Answers 3

2

Here is my suggestion using cases and align(ed).

enter image description here

\documentclass{report}
\usepackage{amsmath}

\begin{document}
\begin{align*}
F(x) &= xy    && \text{hello world} \\
F(x) &= \begin{cases} 
x(n)\\
x(n-1)
\end{cases} && 
\begin{aligned}
&\text{foo}\\
&\text{bar}
\end{aligned}
\end{align*}
\end{document}
0

Like this?

enter image description here

With array˙and multirow packages:

\documentclass[border=3.141592, preview]{standalone}
\usepackage{array, multirow}

\begin{document}
\[\setlength\arraycolsep{2pt}
\begin{array}{rl@{}l@{\qquad}l}
F(x) =  & xy    &           &   hello world \\[1ex]
\multirow{2}{*}{$F(x) = $}
        & \multirow{2}{*}{$\biggl\{$}
                & x(n)      &   foo \\
        &       & x(n-1)    &   bar
\end{array}
\]
\end{document}
0

Using alignat*, you have full control on the spacing between alignment columns:

    \documentclass[preview]{standalone}
    \usepackage{amsmath}

    \begin{document}

    \begin{alignat*}{2}
     F(x) & = xy & & hello world \\
    F(x) & =
    \begin{cases}
    x(n), \\
    x(n-1)
    \end{cases}
    &\quad &\begin{array}{@{}l}foo\\[0.5ex] bar\end{array}
    \end{alignat*}

    \end{document} 

enter image description here

You must log in to answer this question.

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