# Close align brackets

I was trying to close this bracket:

\frac{}{}\theta=2\pi k + \begin{cases}\arctan\left ( \frac{n}{x} \right ) & \text{ if } x> 0 \\ \frac{\pi }{2} & \text{ if } x=0 \\ \arctan\left ( \frac{n}{x} \right )+\pi & \text{ if } x< 0 \end{cases}\


(I don't know how to write Latex in here, go to https://latex.codecogs.com/eqneditor/editor.php)

\documentclass{article}

\usepackage{amsmath}

\begin{document}

$\frac{}{}\theta=2\pi k + \begin{cases}\arctan\left ( \frac{n}{x} \right ) & \text{ if } x> 0 \\ \frac{\pi }{2} & \text{ if } x=0 \\ \arctan\left ( \frac{n}{x} \right )+\pi & \text{ if } x< 0 \end{cases}$
\end{document}


I tried using Bmatrix intead of cases but now the elements aren't aligned:

\frac{}{}\theta=2\pi k + \begin{Bmatrix}\arctan\left ( \frac{n}{x} \right ) & \text{ if } x> 0 \\ \frac{\pi }{2} & \text{ if } x=0 \\ \arctan\left ( \frac{n}{x} \right )+\pi & \text{ if } x< 0 \end{Bmatrix}

• please always post complete documents not just fragments. What is the intention of\frac{}{} a fraction with no values? May 23 at 17:16
• I added your example. What do you want to change? May 23 at 17:21

You can use alignedat. The only slight complication is that a thin space would be added in front of “arctan”, but it's easy to remove it.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\theta=2\pi k + \left\{ \begin{alignedat}{2} &\! \arctan \frac{n}{x} &\qquad& \text{if x>0} \\ & \frac{\pi}{2} & & \text{if x=0} \\ &\! \arctan \frac{n}{x} +\pi & & \text{if x<0} \end{alignedat} \right\}

\end{document}


However, I'd go with cases and not add the closing brace.

• Upvoted, mainly for the last sentence. May 24 at 7:54

I works if you use the Bmatrix* environment from mathtools, which takes an optional argument for the alignment (the same in each column):

    \documentclass{article}
\usepackage{mathtools}

\begin{document}

$\frac{}{}\theta=2\pi k + \begin{Bmatrix*}[l]\arctan\left ( \frac{n}{x} \right ) & \text{ if } x> 0 \\ \frac{\pi }{2} & \text{ if } x=0 \\ \arctan\left ( \frac{n}{x} \right )+\pi & \text{ if } x< 0 \end{Bmatrix*}$%

\end{document}