1

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.

2
  • 3
    Welcome to TeX.SX! I'm not familiar with this class, but usually line breaks are not allowed in the equation environment. To add line breaks in display math, one rather uses other environments from amsmath, such as align or gather.
    – Vincent
    Mar 26, 2022 at 22:38
  • I think the Tufte classes should be compatible with amsmath.including also the multline environment. But I think this one might look best with \begin{equation}\begin{aligned} ...\end{aligned}\end{equation} with the & at the \leftarrows. See the amsmath documentation.
    – frabjous
    Mar 26, 2022 at 22:56

1 Answer 1

1

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

You must log in to answer this question.

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