换行符 方程式 Tufte Latex

换行符 方程式 Tufte Latex

我希望 Latex 中带有 Tufte 类的方程式有 4 条独立的线:

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}

由于\\不是 Tufte 类中的有效命令,我该如何进行换行?我希望它们位于同一编号的等式中。

答案1

这不是由于tufte;该命令在类上独立\\执行任何操作。您想使用:equationsplit

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}

这样你的箭头就对齐了。我还提出了另外两种方法。

\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}

在此处输入图片描述

相关内容