# How to force alignment of “cases” brackets in an enumerate environment?

I am using the enumitem and amsmath packages to give the recursive definition of the valuation function $\nu$ for classical first order logic. The way I have it set up, the brackets of the cases are not aligned (due to differences in length of the expressions preceding the cases brackets).

Here is the MWE:

\documentclass[12pt]{scrartcl}
\usepackage{enumitem}
\usepackage{amsmath,amssymb}

\begin{document}

\begin{enumerate}[noitemsep,label=\alph*)]

\item $\nu(A \wedge B) = \begin{cases} 1,&\text{if$\nu(A) = \nu(B) = 1$};\\ 0,&\text{otherwise.}\end{cases}$
\item $\nu(A \vee B) = \begin{cases} 1,&\text{if$\nu(A) = 1$or$\nu(B) = 1$};\\ 0,&\text{otherwise.}\end{cases}$
\item $\nu(A \rightarrow B) = \begin{cases} 1,&\text{if$\nu(A) = 0$or$\nu(B) = 1$};\\ 0,&\text{otherwise.}\end{cases}$
\item $\nu(A \leftrightarrow B) = \begin{cases} 1,&\text{if$\nu(A) = \nu(B)$};\\ 0,&\text{otherwise.}\end{cases}$
\item $\nu(\forall xA) = \begin{cases} 1,&\text{if for all$d \in D, \nu(A_x(c_d)) =1$;}\\ 0,&\text{otherwise.} \end{cases}$
\item $\nu(\exists xA) = \begin{cases} 1,&\text{if for some$d \in D, \nu(A_x(c_d)) =1$;}\\ 0,&\text{otherwise.} \end{cases}$
\end{enumerate}

\end{document}


I would like for the brackets to be aligned down the page, ideally without creating too much ugly spacing elsewhere.

• A question about formatting questions: how would I get my $\nu$ to display the greek letter as it does once you compile LaTeX code to a pdf? Relatedly, how do I insert a preview of my MWE? – Dennis Dec 30 '12 at 22:35
• We don't use MathJax here, so if you want a nu, copy-paste a nu using your system character map. Previews are inserted by preparing a picture on your local system then uploading it using the 'Insert Image' interface. – Joseph Wright Dec 30 '12 at 22:38
• This site doesn't render LaTeX code- it would cause a lot of problems, see meta.tex.stackexchange.com/questions/1272/… . You can post a preview by inserting a screenshot of your document see Badges for cleaning up – cmhughes Dec 30 '12 at 22:38

## 3 Answers

A trick from mathmode (In my version (2.47) it is in section 65.1 on page 113): save the longest left hand side in a box, and then output the left hand sides in a box of that length:

\documentclass[12pt]{scrartcl}
\usepackage{enumitem}
\usepackage{amsmath,amssymb}

\begin{document}
\newsavebox\lW
\sbox\lW{$\nu(A \leftrightarrow B)$}

\begin{enumerate}[noitemsep,label=\alph*)]

\item $\displaystyle\makebox[\wd\lW][r]{$\nu(A\wedge B)$} = \begin{cases} 1,&\text{if$\nu(A) = \nu(B) = 1$};\\ 0,&\text{otherwise.}\end{cases}$
\item $\displaystyle\makebox[\wd\lW][r]{$\nu(A \vee B)$} = \begin{cases} 1,&\text{if$\nu(A) = 1$or$\nu(B) = 1$};\\ 0,&\text{otherwise.}\end{cases}$
\item $\displaystyle\makebox[\wd\lW][r]{$\nu(A \rightarrow B)$} = \begin{cases} 1,&\text{if$\nu(A) = 0$or$\nu(B) = 1$};\\ 0,&\text{otherwise.}\end{cases}$
\item $\displaystyle\makebox[\wd\lW][r]{$\nu(A \leftrightarrow B)$} = \begin{cases} 1,&\text{if$\nu(A) = \nu(B)$};\\ 0,&\text{otherwise.}\end{cases}$
\item $\displaystyle\makebox[\wd\lW][r]{$\nu(\forall xA)$} = \begin{cases} 1,&\text{if for all$d \in D, \nu(A_x(c_d)) =1$;}\\ 0,&\text{otherwise.} \end{cases}$
\item $\displaystyle\makebox[\wd\lW][r]{$\nu(\exists xA)$} = \begin{cases} 1,&\text{if for some$d \in D, \nu(A_x(c_d)) =1$;}\\ 0,&\text{otherwise.} \end{cases}$
\end{enumerate}

\end{document}


Output • This suggestion fits better within my paper, thanks! – Dennis Dec 30 '12 at 23:09
• Also, if you don't mind, where in the MathMode pdf did you find this suggestion? I'd like to read it to understand what you have done a bit better. – Dennis Dec 30 '12 at 23:14
• @Dennis I updated the answer. – mafp Dec 30 '12 at 23:18

I would use an AMS alignment rather than an enumerated list. \documentclass[12pt]{scrartcl}
\usepackage{enumitem}
\usepackage{amsmath,amssymb}

\begin{document}

\begin{tagsleft@true}
\renewcommand\theequation{\alph{equation}}
\begin{flalign}
\nu(A
\wedge B) &= \begin{cases}
1,&\text{if $\nu(A) = \nu(B) = 1$};\\
0,&\text{otherwise.}\end{cases}\\
\nu(A \vee B) &= \begin{cases}
1,&\text{if $\nu(A) = 1$ or $\nu(B) = 1$};\\
0,&\text{otherwise.}\end{cases}\\
\nu(A \rightarrow B) &= \begin{cases}
1,&\text{if $\nu(A) = 0$ or $\nu(B) = 1$};\\
0,&\text{otherwise.}\end{cases}\\
\nu(A \leftrightarrow B) &= \begin{cases}
1,&\text{if $\nu(A) = \nu(B)$};\\
0,&\text{otherwise.}\end{cases}\\
\nu(\forall xA) &= \begin{cases}
1,&\text{if for all $d \in D, \nu(A_x(c_d)) =1$;}\\
0,&\text{otherwise.}
\end{cases}\\
\nu(\exists xA) &= \begin{cases}
1,&\text{if for some $d \in D, \nu(A_x(c_d)) =1$;}\\
0,&\text{otherwise.}
\end{cases}
\end{flalign}
\end{tagsleft@true}

\end{document}

• Great suggestion, wasn't aware of this environment. Thanks! – Dennis Dec 30 '12 at 23:02

Another approach, that works like amsmath’s align environment, only with an \item.

### Packages

• listliketab
• mathtools for the cases* environment (no need for \text)

### Macros

• \storestyleofextra[<options>]{<environ>} is like \storestyleof just with an optional argument <options> that is given to the environment <environ>.
• \nextnum/redefinition of \item that produces the enumeration

### Environment

• alignerate mimics a left-aligned align environment, with an \item.

### Disadvantage

Sadly, \storestyleof/\storystyleofextra and \storeliststyle{} do not save the enumeration style. Though a \alph*) can easily be mimiced as can seen in the \nextnum macro.

It is probably also easy to implement an optional argument for alignerate that works like label=\alph*), the xstring package does come to mind …

## Code

\documentclass[12pt]{scrartcl}
\usepackage{enumitem}
\usepackage{mathtools,amssymb}
\usepackage{listliketab}
\newcounter{listliketablabel}
\newcommand*{\nextnum}{\addtocounter{listliketablabel}{1}\thelistliketablabel)}
\makeatletter
\newcommand*{\storestyleofextra}[]{%
\begin{lrbox}{\llt@list@box}
\noindent
\begin{minipage}{\linewidth}
\begin{#2}[#1]
\item[] \storeliststyle{}
\end{#2}
\end{minipage}
\end{lrbox}\ignorespacesafterend
}
\makeatother
\storestyleofextra[noitemsep,label=\alph*)]{enumerate}
\newenvironment{alignerate}{%
\begin{listliketab}
\setcounter{listliketablabel}{0}\renewcommand*{\thelistliketablabel}{\alph{listliketablabel}}
\renewcommand*{\item}{\nextnum &}
\begin{tabular}{L>{$$}r<{$$}@{}>{$${}}l<{$$}R}
}{
\end{tabular}
\end{listliketab}
}
\begin{document}
\begin{alignerate}
\item \nu(A \wedge B) & = \begin{cases*} 1, & if $\nu(A) = \nu(B) = 1$; \\
0, & otherwise.                \end{cases*}               \\
\item \nu(A \vee B)   & = \begin{cases*} 1, & if $\nu(A) = 1$ or $\nu(B) = 1$; \\
0, & otherwise.                       \end{cases*}        \\
\item \nu(A \rightarrow B) & = \begin{cases*} 1, & if $\nu(A) = 0$ or $\nu(B) = 1$; \\
0, & otherwise.                       \end{cases*}   \\
\item \nu(A \leftrightarrow B) & = \begin{cases*} 1, & if $\nu(A) = \nu(B)$; \\
0, & otherwise.            \end{cases*}          \\
\item \nu(\forall xA) & = \begin{cases*} 1, & if for all $d \in D, \nu(A_x(c_d)) =1$; \\
0, & otherwise.                              \end{cases*} \\
\item \nu(\exists xA) & = \begin{cases*} 1, & if for some $d \in D, \nu(A_x(c_d)) =1$; \\
0, & otherwise.                               \end{cases*}
\end{alignerate}
\end{document}


## Output 