# Complicated cases expression

I am trying to insert this expression in my Latex file:

When I start entering :

\begin(cases)


I got an error saying “ unrecognizable environment “

I tried this ( nested arrays) :

MA_{c_1,c_2}(i,j)=\left\{\begin{array}{lr}
Max(i,j), &\text{if min(i,j)=0}\\
Min & {\begin {array} {lr}
\end{array}
\end{array}


When I start the nested array , document review disappeared.

I need help “coding” this expression in Latex .

I am using Texstudio as a Latex editor.

• Used editor is not relevant to your problem. Please show us what you try so far. – Zarko Nov 16 '19 at 2:09
• I searched online i found this command (\begin(cases)) , but this command is not available in Latex ..l – Paulo Nov 16 '19 at 2:11
• of course, it is :-) . Of course, t should not be enclosed in parenthesis. – Zarko Nov 16 '19 at 2:22
• Are the lower brackets really cases, or is it just the minimum of three different expressions? In the latter case I would typeset the formula in a way that this gets reflected. – user194703 Nov 16 '19 at 3:01

## 2 Answers

\documentclass[margin=3mm, varwidth]{standalone}
\usepackage{mathtools}% for cases*, also load amsmath

\begin{document}
$$\setlength\arraycolsep{1pt} xxx = \begin{cases*} \max(t,f) & if \min(t,f) = 0 \\ \min\left\{\begin{array}{rl} xxx & + 1 \\ xxx & + 1 \\ xxx xxx & + 1 \\ \end{array}\right. & otherwise \end{cases*}$$
\end{document}


• Thanks a lot . You saved a lot! – Paulo Nov 17 '19 at 2:42

Your text is very hard to read (which is why most likely some characters are misrepresented below). Yet I could not make sense of having \min in front of cases. So I am wondering if the lower part, i.e. the second case, is the minimum of a list. If so, maybe the following is more appropriate.

\documentclass{article}
\usepackage{mathtools}
\begin{document}
$$MA_{C_0f_0}(i,j)= \begin{dcases} \max(i,j) & \text{if}~\min(i,j)=0\;,\\ \begin{array}{@{}r@{}l@{}l@{}} \min\bigl\{ &MA_{C_0f_0}(i-1,j)+1,\\ &MA_{C_0f_0}(i,j-1)+1,\\ &MA_{C_0f_0}(i-1,j-1)+1\bigr\}\\ \end{array}& \text{otherwise}\;. \end{dcases}$$
\end{document}