1

My code doesn't work:

\begin{align*}
  &f(x)&=\begin{cases}
    \begin{alignedat}{3}
      -1, & \quad & -\pi & < x && < 0   \\
      1, & \quad &    0 & < x && < \pi
    \end{alignedat}
  \end{cases}\\
  &f(x+2\pi)&=f(x)
\end{align*}

I want to generate this:

enter image description here

minseong
  • 487

2 Answers2

1

Use another alignedat. But words are clearer than symbols.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\section{How you want it}

\begin{equation*}
\begin{alignedat}{2}
& f(x) && =
\begin{cases}
\begin{alignedat}{2}
-1, & \quad & -\pi & < x < 0   \\
 1, & \quad &    0 & < x < \pi
\end{alignedat}
\end{cases}
\\[1ex]
& f(x+2\pi) &&= f(x)
\end{alignedat}
\end{equation*}

\section{How I'd do it}

Let $f$ be the function defined over the reals, except at 
integral multiples of $\pi$, given by
\begin{equation*}
f(x) =
\begin{cases}
\begin{alignedat}{2}
-1, & \quad & -\pi & < x < 0   \\
 1, & \quad &    0 & < x < \pi
\end{alignedat}
\end{cases}
\end{equation*}
and extended by $2\pi$~periodicity.

\end{document}

enter image description here

Alternatively, center: the two equals signs are not really related to each other and the white space in the top line is awful.

\begin{equation*}
\begin{gathered}
f(x)=
\begin{cases}
\begin{alignedat}{2}
-1, & \quad & -\pi & < x < 0   \\
 1, & \quad &    0 & < x < \pi
\end{alignedat}
\end{cases}
\\[1ex]
f(x+2\pi) = f(x)
\end{gathered}
\end{equation*}

enter image description here

egreg
  • 1,121,712
  • Nice! Thanks for all the helping tips, I find the worded explanation more elegant and will use that now. Honestly I'm extremely inexperienced at this, thanks for taking the time to answer my question so thoroughly :) – minseong Sep 21 '17 at 13:33
0

Maybe you should just consider your equations in one column as follows:

\begin{align*}
  &f(x)=\begin{cases}
    \begin{alignedat}{3}
      -1, & \quad & -\pi & < x && < 0   \\
      1, & \quad &    0 & < x && < \pi
    \end{alignedat}
  \end{cases}\\
  &f(x+2\pi)=f(x)
\end{align*}

enter image description here