How can I have linebreaks in my long LaTeX equations?

后端 未结 11 594
广开言路
广开言路 2020-12-22 20:28

My equation is very long. How do I get it to continue on the next line rather than go off the page?

相关标签:
11条回答
  • 2020-12-22 21:05

    SIMPLE ANSWER HERE

    \begin{equation}
    \begin{split}
    
    equation \\
    here
    
    \end{split}
    \end{equation}
    
    0 讨论(0)
  • 2020-12-22 21:09

    I used the \begin{matrix}

    \begin{equation}
    \begin{matrix}
        line_1 \\ 
        line_2 \\ 
        line_3
    \end{matrix}
    \end{equation}
    
    0 讨论(0)
  • 2020-12-22 21:10

    Use eqnarray and \nonumber

    example:

    \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}
    
    0 讨论(0)
  • 2020-12-22 21:13

    If your equation does not fit on a single line, then the multline environment probably is what you need:

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

    If you also need some alignment respect to the first part, you can use split:

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

    Both environments require the amsmath package.

    See also aligned as pointed out in an answer below.

    0 讨论(0)
  • 2020-12-22 21:13

    Not yet mentioned here, another choice is environment aligned, again from package amsmath:

    \documentclass{article}
    \usepackage{amsmath}
    
    \begin{document}
    
    \begin{equation}
      \begin{aligned}
        A & = B + C\\
          & = D + E + F\\
          & = G
      \end{aligned}
    \end{equation}
    
    \end{document}
    

    This outputs:

    0 讨论(0)
提交回复
热议问题