如何在我的长LaTeX方程中使用换行符?

时间:2010-05-18 18:54:37

标签: latex

我的等式很长。如何让它继续下一行而不是离开页面?

13 个答案:

答案 0 :(得分:119)

如果您的等式不适合单行,那么multline环境可能就是您所需要的:

\begin{multline}
first part of the equation \\
= second part of the equation
\end{multline}

如果您还需要与第一部分进行一些对齐,可以使用split

\begin{equation}
\begin{split}
first part &= second part #1 \\
           &= second part #2
\end{split}
\end{equation}

两种环境都需要amsmath包。

答案 1 :(得分:10)

如果没有将数学环境配置为剪辑,您可以按照以下顺序强制使用两个反斜杠的新行:

Bla Bla \\ Bla Bla in another line

这个问题是你需要确定一条线可能在哪里结束并强制在那里总是有一个换行符。使用方程而不是文本,我更喜欢这种手动方式。

您还可以使用\\*来阻止新页面启动。

答案 2 :(得分:5)

有几种方法可以解决这个问题。首先,也许是最好的,就是重新设计你的方程式,以便它不会那么长;如果那么久,它可能是不可读的。

如果必须如此,请查看AMS Short Math Guide以了解处理方法。 (在第二页)

就个人而言,我会使用对齐环境,以便精确控制断裂和对齐。 e.g。

\begin{align*}
   x&+y+\dots+\dots+x_100000000\\
   &+x_100000001+\dots+\dots
\end{align*}

这将排列每行的第一个加号......但显然,您可以在任何地方设置对齐。

答案 3 :(得分:4)

我想我通常使用eqnarray或其他东西。它可以让你说

\begin{eqnarray*}
    x &=& blah blah blah \\ 
      & & more blah blah blah \\
      & & even more blah blah
\end{eqnarray*}

它将由&对齐。 & ...正如pkaeding所提到的,它很难读,但是当你得到一个那么长的方程式时,无论如何都会很难读出......(*使它没有方程式编号,IIRC )

答案 4 :(得分:2)

multline最好用。相反,您也可以使用dmathsplit

以下是一个例子:

\begin{multline}
  {\text {\bf \emph {T(u)}}} ={  \alpha *}{\frac{\sum_{i=1}^{\text{\bf \emph {I(u)}}}{{\text{\bf \emph {S(u,i)}}}* {\text {\bf \emph {Cr(P(u,i))}}} * {\text {\bf \emph {TF(u,i)}}}}}{\text {\bf \emph {I(u)}}}}  \\
   +{  \beta *}{\frac{\sum_{i=1}^{\text{\bf \emph {$I_h$(u)}}}{{\text{\bf \emph {S(u,i)}}}* {\text {\bf \emph {Cr(P(u,i))}}} * {\text {\bf \emph {TF(u,i)}}}}}{\text {\bf \emph {$I_h$(u)}}}}
\end{multline}

答案 5 :(得分:2)

使用eqnarray\nonumber

示例:

\begin{eqnarray}
    sample = R(s,\pi(s),s') + \gamma V^{\pi} (s') \nonumber \\
    \label{eq:temporal-difference}
     V^{\pi}_{k+1}(s) = (1-\alpha)V^{\pi}(s) - \alpha[sample]
\end{eqnarray}

答案 6 :(得分:2)

我使用了\begin{equation} \begin{matrix} line_1 \\ line_2 \\ line_3 \end{matrix} \end{equation}

{{1}}

答案 7 :(得分:2)

如果是内联方程,则使用\allowbreak。像这样使用它:

$x_1,x_2,x_3,\allowbreak x_4,x_5$.

只有在必要时,乳胶才会在这个地方打破方程式。

答案 8 :(得分:1)

使用mathtools包时,这对我有用。

\documentclass{article}
\usepackage{mathtools}
\begin{document}
    \begin{equation}
        \begin{multlined}
            first term \\
            second term                 
        \end{multlined}
    \end{equation}
\end{document}

答案 9 :(得分:1)

此处尚未提及,另一种选择是环境aligned,同样来自软件包amsmath

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation}
  \begin{aligned}
    A & = B + C\\
      & = D + E + F\\
      & = G
  \end{aligned}
\end{equation}

\end{document}

答案 10 :(得分:0)

为了解决这个问题,我在公式环境中使用了这样的数组环境:

\begin{equation}
    \begin{array}{r c l}
       first Term&=&Second Term\\
                 &=&Third Term
    \end{array}
\end{equation}

答案 11 :(得分:0)

这里有简单答案

\begin{equation}
\begin{split}

equation \\
here

\end{split}
\end{equation}

答案 12 :(得分:0)

你不需要任何额外的包来做到这一点:

\begin{equation}
  \begin{gathered}
     first formula\\
     second formula
  \end{gathered}
\end{equation}