# Math equation display issues

I write this math equation in mathtype first, and then convert it into latex code:

\begin{block}{Membership functions Trapezoidal - Low}
$\forall u \in R,{\rm{ }}{\mu _L}(u) = \left\{ {\begin{array}{*{20}{c}}{1{\rm{ if }}0 \le u \le 0,2}\\{\frac{{0,3 - u}}{{0,1}}{\rm{ if }}0,2 < u < 0,3}\\{0{\rm{ if u}} \ge 0,3}\end{array}} \right.$
\end{block}


However, as you can see, the display is not the same. So how can I fix this issues? Thanks

• welcome to tex.sx. the main problem i see is that there are no spaces around the "if" in the output. input spaces are essentially ignored in (la)tex, so have either to be entered explicitly, or entered in a "text" mode. (the latex code provided by the converter is not really very good, but you haven't said what converter was used, so i'll let it go at that.) probably the easiest way to salvage this is to add a "slash space" (\  ) before and after each "if", within the scope of the braced {\rm\ if\ }. – barbara beeton Nov 27 '18 at 3:11
• The \rm command has been deprecated for well over 20 years. – egreg Nov 27 '18 at 7:54

Don't use MathType to write equations: the code it generates is awful and, in some cases, plainly wrong.

For instance, the command \rm has been deprecated for well over twenty years.

Here's a suggestion with a two-column array: the first column is center aligned and in \displaystyle; the second column is left aligned and in text mode.

\documentclass{beamer}
\usepackage{mathtools,array}

\usetheme{Warsaw}

\begin{document}

\begin{frame}
\frametitle{A test}

\begin{block}{Membership functions Trapezoidal - Low}
$\forall u \in R,\quad \mu_L(u) = \begin{cases} \begin{array}{@{} >{\displaystyle}c >{}l<{} @{}} 1 & if 0 \le u \le 0{,}2 \\[1ex] \frac{0{,}3 - u}{0,1} & if 0{,}2 < u < 0{,}3 \\[2ex] 0 & if u \ge 0{,}3 \end{array} \end{cases}$
\end{block}

\end{frame}

\end{document}


Note how to avoid the unwanted space after the comma in numbers.

You can change the array function to have three entries. For example the following code:

$$\forall u \in R,{\rm{ }}{\mu _L}(u) = \left\{ \begin{array}{lll}1&\;\;{\rm{ if }}&\;\;0 \le u \le 0,2\\ \frac{0,3 - u}{0,1}&\;\;{\rm{ if }}&\;\;0,2 < u < 0,3\\0&\;\;\rm{ if } &\;\;u\ge 0,3\end{array} \right.$$


• Thank you. Change array function is really useful. – Dai Tran Nov 27 '18 at 5:20