Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LyX - breaking long formula lines

Tags:

How can I break long formulas in LyX into two (or more) lines? I know how to write several lines of equations in one "math box" but I'm looking for a solution to break lines even in the middle of a parenthesis.

I'm using LyX 1.6.4 and currently, when the formula is too big, it doesn't do anything (it just doesn't print the last segment of it, which is "beyond" the page).

Is this possible in LyX?

like image 340
Amir Rachum Avatar asked May 25 '10 13:05

Amir Rachum


People also ask

How do you fix long equations in latex?

Displaying long equationsInsert a double backslash to set a point for the equation to be broken. The first part will be aligned to the left and the second part will be displayed in the next line and aligned to the right.

How do you insert a formula in LyX?

LyX | LGT (4/5) — Math editor. To insert math use the menu Insert→Math→Inline Formula (shortcut Ctrl+m). This inserts a small blue box which will contain the formula. Note that the math toolbar pops up automatically if the cursor is in a math box.


2 Answers

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.

like image 162
Charles Stewart Avatar answered Nov 26 '22 12:11

Charles Stewart


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*}} 
like image 38
Compholio Avatar answered Nov 26 '22 11:11

Compholio