3

I need to make an equation case with text following it. That text should be displayed in the middle of the two cases. This is my code:

 \begin{eqnarray}\label{eq13}
  a_k =
  \begin{cases}
  1 & \text{if $f_i$ has a value $v_k$}, \\
  0 & \text{otherwise}
  \end{cases}
  \text{$f_i$ is a non-binary feature, \\$k=1,...,n$}
 \end{eqnarray}

It wouldn't work, I want to begin a new line with $k=1,...,n$, since it sticks out of the page. I am using ACM format. How can I solve the problem?

3
\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{align}\label{eq13}
  a_k =
  \begin{cases}
  1 & \text{if $f_i$ has a value $v_k$}, \\
  0 & \text{otherwise}
  \end{cases}
  \text{\quad\parbox{0.4\linewidth}{$f_i$ is a non-binary feature,\\ $k=1,...,n$}}
 \end{align}

\end{document}

enter image description here

1

If you want begin a new line, simply write

%\begin{eqnarray}\label{eq13}
\begin{equation}\label{eq13} %what for eqnarray?
  a_k =
  \begin{cases}
  1 & \text{if $f_i$ has a value $v_k$}, \\
  0 & \text{otherwise}
  \end{cases}
  %\text{$f_i$ is a non-binary feature, \\$k=1,...,n$}
 %\end{eqnarray}
 \end{equation}
 $f_i$ is a non-binary feature, $k=1$, \ldots, $n$.
  • I mean I still want the text '$f_i$ is a non-binary feature, $k=1$, \ldots, $n$.' to be part of the equation. – daiyue May 4 '13 at 19:15
  • @daiyue So where should it be? Where should it begin? – Przemysław Scherwentke May 4 '13 at 19:21

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.