2

i want generate equals to next image

enter image description here

but the sum is generate bad

\begin{equation}
     \label{eq:aqui-le-mostramos-como-hacerle-la-llave-grande}
     f(x) = \left\{
           \begin{array}{ll}
              1  & \mathrm{si\ }  \sum_{i=1}^{n} W\textsubscript{i}*X\textsubscript{i}+ W\textsubscript{0} \geq 0 \\
              0  & \mathrm{si\ }  \sum_{i=1}^{n} W\textsubscript{i}*X\textsubscript{i}+ W\textsubscript{k,0} < 0 \\
           \end{array}
         \right.
   \end{equation}

the result is

enter image description here

3 Answers 3

4

I am assuming that you want the index ranges to be displayed below and above the summation symbol.

\documentclass{article}                                                                                                                                                                       

\usepackage{mathtools}                                                                                                                                                                        

\begin{document}                                                                                                                                                                              

\begin{equation}                                                                                                                                                                              
\label{eq:aqui-le-mostramos-como-hacerle-la-llave-grande}                                                                                                                                     
 f(x) =                                                                                                                                                                                       
    \begin{cases}                                                                                                                                                                             
       1  & \displaystyle\mathrm{si\ }  \sum_{i=1}^{n} W_i * X_i + W_0 \geq 0 \\                                                                                                              
       0  & \displaystyle\mathrm{si\ }  \sum_{i=1}^{n} W_i * X_i + W_{k,0} < 0 \\                                                                                                               
    \end{cases}                                                                                                                                                                               
\end{equation}                                                                                                                                                                                

\end{document}

enter image description here

It is not clear why you are using textsubscript.

3
  • OP's using \textsubscript to make the subscript look like text. To make the MWE compile you can define \newcommand{\textsubscript}[1]{_{\text{#1}}}. The output looks different. Commented Jun 21, 2018 at 1:19
  • I get that :-) But, the index in mathit and the subscript in text looks odd. Hence my observation.
    – mas
    Commented Jun 21, 2018 at 12:38
  • Ooh, indeed :) I overlooked that Commented Jun 21, 2018 at 13:33
11

with the package mathtools you can use dcases environment.

\documentclass[spanish]{article}
\usepackage{babel}
\usepackage{mathtools}
\begin{document}

\begin{equation}
\label{eq:aqui-le-mostramos-como-hacerle-la-llave-grande}
 f(x) =
    \begin{dcases}
       1  & \text{si } \sum_{i=1}^{n} W_i * X_i + W_0     \geq 0 \\
       0  & \text{si }\sum_{i=1}^{n} W_i * X_i + W_{k,0} <    0
    \end{dcases}
\end{equation}

\end{document}

Note: variables in indices is usually written in italic shape.

enter image description here

edit: considered egreg comment. now "si" is consider that means "if" (and not math operator as i did in the first answer version).

5
  • 1
    “Si” is most likely “if” (the OP is from Spain).
    – egreg
    Commented Jun 21, 2018 at 6:47
  • @egreg, this make sense. i'm not familiar with Spanish language. corrected.
    – Zarko
    Commented Jun 21, 2018 at 6:53
  • @Zarko Is theree difference between dcases and cases? Commented Jun 21, 2018 at 7:01
  • 1
    @minhthien_2016, yes, it is: dcase put its contents in \displaystyle mode (d in dcases indicate display) meanwhile cases not. it is defined in the package mathtools (which is an extension of \amsmath).
    – Zarko
    Commented Jun 21, 2018 at 7:07
  • @Zarko Thank you for explain. I have just tried. Commented Jun 21, 2018 at 7:08
2

use \limits as shown below

\begin{array}{ll}
              1  &   \mathrm{si\ } \sum \limits_{i=1}^{n} W\textsubscript{i}*X\textsubscript{i}+ W\textsubscript{0} \geq 0 \\ \\
              0  & \mathrm{si\ }  \sum \limits_{i=1}^{n} W\textsubscript{i}*X\textsubscript{i}+ W\textsubscript{k,0} < 0 \\
\end{array}

sumsym

1
  • 1
    Note that when you use \limits, you don't change the glyph for \sum (it stays in textstyle), which can sometime be useful (although in that case, I find the sum too small).
    – Luris
    Commented Jun 21, 2018 at 11:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .