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.\]

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

enter image description here

enter image description here

  • 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.




\frametitle{A test}

\begin{block}{Membership functions Trapezoidal - Low}
\forall u \in R,\quad
\mu_L(u) =
\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$



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

enter image description here


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.

enter image description here

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.