# Latex: words don't align inside big bracket

This is the code I used:

$\textbf{Z}=\left\{ \begin{array}{cc} 0 & \textrm{\textrm{if values are not inflated }}\\ 1 & \textrm{if values are inflated } \end{array}\right.$ }


and this result pops up:

as you may see, the 'if' on the second line is not in line with the 'if' in the first line. Can anyone please advise me on what to do? Thank you:)

• Recheck the code you provided. It does not match your picture. – Christoph90 Apr 17 '18 at 11:21
• Why do you have two \textrm commands in the first case? – Ian Thompson Apr 17 '18 at 11:22
• Welcome to TeX.SX! The code you posted works fine for me. You probably have something else that is causing this. Please post a minimal working example (MWE) that illustrates your problem. Off-topic: you probably don't need the nested \textrm{\textrm{if }}. – Phelype Oleinik Apr 17 '18 at 11:22
• sorry! I put in the wrong code. The code that I first put does work but the code I just put in now (which has more words) gives me a bit of a problem. Sorry about that! – Clarke Apr 17 '18 at 11:23
• @Clarke \begin{array}{cc} creates two centered columns. You probably want the second column left-aligned: \begin{array}{cl}. Or even better, use the cases environment of amsmath as Christoph90 showed in his answer, the spacing will be much better. – Phelype Oleinik Apr 17 '18 at 11:29

For a simpler typing, I suggest loading mathtools, which extends amsmath, and use it cases* (with a star) environment: the second column is in text mode:

\documentclass{article}
\usepackage{mathtools}

\begin{document}

$\mathbf{Z}= \begin{cases*} 0 & if values are not inflated \\ 1 & if values are inflated \end{cases*}$

\end{document}

• Absolutely! Sorry for the now fixed typo, and thanks for pointing it! – Bernard Apr 17 '18 at 11:42

You can fix your code by specifying the second column of the align environment as left-aligned:

\documentclass{article}

\begin{document}
$\mathbf{Z}= \left\lbrace\begin{array}{cl} 0 & \textrm{if values are not inflated}\\ 1 & \textrm{if values are inflated} \end{array} \right.$
\end{document}


However, I'd suggest you do these things using the cases environment from amsmath:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
$\mathbf{Z}= \begin{cases} 0 & \textrm{if values are not inflated}\\ 1 & \textrm{if values are inflated} \end{cases}$
\end{document}


• Thank you so much for all the comments! They were all really helpful and I managed to fix it!!! :) – Clarke Apr 17 '18 at 12:12

You can use amsmath cases instead:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\begin{cases} 0 & \textrm{if values are not inflated}\\ 1 & \textrm{if values are inflated} \end{cases}$
\end{document}