LyX - breaking long formula lines

Yes, but you have to do it by hand.

Check out:

  1. How can I have linebreaks in my long LaTeX equations?
  2. Latex Multiline Equations

Lyx has an "Insert -> Math -> AMS multline environment" control, or you can use the solutions recommended above by entering Latex directly using the Insert Latex control.

Note on breqn

Michael Downes has done some extraordinary Tex coding with this package, but it is not robust enough for general use - it is mostly incompatible with Amsmath, for instance, breaks in hard-to-understand ways, and makes some demonstrably unsound linebreaks in formulae.

Automatic line-breaking in display formulae was listed as one of the top open research problems in Tex.


You might want to try the breqn package. It provides automatic line breaking for big formulas. This way there is no need for manually fixing your delimiters or choosing the break points. Of course, this is no actual LyX functionality but it does exactly what you want.


If you include \usepackage{breqn} in the LyX "LaTeX Preamble" (plus the following code) then the standard "equation" environment (Displayed Formula) will automatically break like you want.

% Add support for automatic equation breaking
\gdef\wrap@breqn@environ#1#2{
    \expandafter\let\csname breqn@oldbegin@#1\expandafter\endcsname\csname #1\endcsname
    \expandafter\let\csname breqn@oldend@#1\expandafter\endcsname\csname end#1\endcsname
    \expandafter\gdef\csname breqn@begin@#1\endcsname{%
        \expandafter\let\csname #1\expandafter\endcsname\csname breqn@oldbegin@#1\endcsname%
        \begin{#2}%
    }
    \expandafter\gdef\csname breqn@end@#1\endcsname{%
        \expandafter\let\csname end#1\expandafter\endcsname\csname breqn@oldend@#1\endcsname%
        \end{#2}%
        \expandafter\let\csname #1\expandafter\endcsname\csname breqn@begin@#1\endcsname%
        \expandafter\let\csname end#1\expandafter\endcsname\csname breqn@end@#1\endcsname%
    }
    \expandafter\let\csname #1\expandafter\endcsname\csname breqn@begin@#1\endcsname
    \expandafter\let\csname end#1\expandafter\endcsname\csname breqn@end@#1\endcsname
}
\wrap@breqn@environ{equation}{dmath}
\wrap@breqn@environ{equation*}{dmath*}

Added 2016-12-08:

If you wish to override the default (unnumbered) LyX equation environment then also add the following:

\DeclareRobustCommand\[{\begin{equation*}}
\DeclareRobustCommand\]{\end{equation*}}

Tags:

Latex

Lyx