Line break Equation Tufte Latex

equationslinetufte

I want my equation in Latex with Tufte class to have 4 separate lines:

The bias- and latent factor terms are updated in the following way:
\begin{equation}
    b_{u} \leftarrow b_{u}+\gamma(e_{ui}-\lambda b_{u}) %Line break here
    b_{i} \leftarrow b_{i}+\gamma(e_{ui}-\lambda b_{i}) %Line break here
    p_{u} \leftarrow p_{u}+\gamma(e_{ui}\cdot q_{i}-\lambda p_{u})%Line break here
    p_{i} \leftarrow p_{i}+\gamma(e_{ui}\cdot p_{u}-\lambda q_{i}) 
\end{equation}

Since \\ is not a working command in Tufte class, how can I make the line break? I want them to be in the same numbered equation.

Best Answer

It's not due to tufte; the command \\ does nothing in equation independently on the class. You want to use split:

The bias- and latent factor terms are updated in the following way:
\begin{equation}
  \begin{split}
    b_{u} &\leftarrow b_{u}+\gamma(e_{ui}-\lambda b_{u}) \\
    b_{i} &\leftarrow b_{i}+\gamma(e_{ui}-\lambda b_{i}) \\
    p_{u} &\leftarrow p_{u}+\gamma(e_{ui}\cdot q_{i}-\lambda p_{u}) \\
    p_{i} &\leftarrow p_{i}+\gamma(e_{ui}\cdot p_{u}-\lambda q_{i}) 
  \end{split}
\end{equation}

so your arrows are aligned. I also propose two other methods.

\documentclass{tufte-book}
\usepackage{amsmath}

\begin{document}

The bias- and latent factor terms are updated in the following way:
\begin{equation}
  \begin{split}
    b_{u} &\leftarrow b_{u}+\gamma(e_{ui}-\lambda b_{u}) \\
    b_{i} &\leftarrow b_{i}+\gamma(e_{ui}-\lambda b_{i}) \\
    p_{u} &\leftarrow p_{u}+\gamma(e_{ui}\cdot q_{i}-\lambda p_{u}) \\
    p_{i} &\leftarrow p_{i}+\gamma(e_{ui}\cdot p_{u}-\lambda q_{i}) 
  \end{split}
\end{equation}
An alternative alignment doesn't look as good
\begin{equation}
  \begin{split}
    &b_{u} \leftarrow b_{u}+\gamma(e_{ui}-\lambda b_{u}) \\
    &b_{i} \leftarrow b_{i}+\gamma(e_{ui}-\lambda b_{i}) \\
    &p_{u} \leftarrow p_{u}+\gamma(e_{ui}\cdot q_{i}-\lambda p_{u}) \\
    &p_{i} \leftarrow p_{i}+\gamma(e_{ui}\cdot p_{u}-\lambda q_{i})
  \end{split}
\end{equation}
But we can do in a different way
\begin{equation}
  \begin{alignedat}{2}
    &b_{u} &&\leftarrow b_{u}+\gamma(e_{ui}-\lambda b_{u}) \\
    &b_{i} &&\leftarrow b_{i}+\gamma(e_{ui}-\lambda b_{i}) \\
    &p_{u} &&\leftarrow p_{u}+\gamma(e_{ui}\cdot q_{i}-\lambda p_{u}) \\
    &p_{i} &&\leftarrow p_{i}+\gamma(e_{ui}\cdot p_{u}-\lambda q_{i})
  \end{alignedat}
\end{equation}

\end{document}

enter image description here