How do I break a long equation over lines?

前端 未结 4 547
独厮守ぢ
独厮守ぢ 2021-02-01 04:11

I am trying to add an equation in a new line. The problem is that the equation is too long for the line, and I need to break it manually. Otherwise, it just overlaps to the righ

4条回答
  •  花落未央
    2021-02-01 04:29

    The breqn package is designed to split long equations automatically. It works very well in the majority of situations, but it's not as mature as the amsmath package. Here's how you'd write your example equation:

    \documentclass{article}
    \usepackage{breqn}
    \begin{document}
    \begin{dmath}
    f(n)-f(0) = A(n)-B(n)-C(n)-D(n)\cdot d-\left(A(0)-B(0)-C(0)-D(0)\cdot d\right)
              = A(n)-0-X-D(n)\cdot d-\left(0-0-0-0\right)
              = A(n)-X-D(n)\cdot d
    \end{dmath}
    \end{document}
    

    Note there is no markup for alignment or newlines, but the output looks essentially the same as if you used align.

提交回复
热议问题