LaTeX does allow inline maths to break over lines by default, but there are a number of restrictions. Specifically, in your case, using \left...\right
puts everything inside a non-breakable math group, so the first step is to replace them with either just plain \langle...\rangle
or perhaps \bigl\langle...\bigr\rangle
.
However, this still isn't enough to permit linebreaking; usually that's still only allowed after relations or operators, not punctuation such as the comma. (I think this is what's going on anyway; I haven't stopped to look this up.) So you want indicate where allowable line breaks may occur by writing \linebreak[1]
after each comma.
Depending how often you have to do this, it may be preferable to write a command to wrap your "tuples" into a nice command. In order to write this in your source:
$ \mytuple{ source\_location, R/W, trip\_counter, occurrence,
killed\upshape (explained in the later) } $
here's a definition of \mytuple
that takes all of the above into account:
\makeatletter
\newcommand\mytuple[1]{%
\@tempcnta=0
\bigl\langle
\@for\@ii:=#1\do{%
\@insertbreakingcomma
\textit{\@ii}
}%
\bigr\rangle
}
\def\@insertbreakingcomma{%
\ifnum \@tempcnta = 0 \else\,,\ \linebreak[1] \fi
\advance\@tempcnta\@ne
}
\makeatother
I prefer to insert the listings as a child document, so the code is grabbed directly from a file that you can further edit and keep updated (you avoid to duplicate an information and maintenance is a lot easier).
To do this in Lyx:
Insert->File->Child document
Then in the window that will appear change the type to program listing and configure it as you need, for example you could want to enter the parameter language=Python (you can type a ? to view all the parameters).
A set of parameters I usually use is:
breaklines=true //--> breaks lines to margin
captionpos=b //--> caption at the bottom of the listing (default is "t")
frame=tb //--> frame at the top and at the bottom of the listing
language=Python //--> syntax highlighting for python
Best Answer
Yes, but you have to do it by hand.
Check out:
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.