# Split line if too long

I am sure that this has been answered here many times, but I can't find a duplicate.

My question is what to do with lines that are "too long", i.e. that overflow into the margin. I think the problem has to do with the way LaTeX handles splitting and I seem to remember that there is something that one can insert on a line that turns out too long so that it will be split only if needed. It is something like \allowsplitline.

\documentclass[oneside,oldfontcommands]{memoir}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\begin{document}
\noindent That is we have that $F_A(\pi_A) = F_A(\pi_{A},B)$ is blablabla if and only if $F_A(\pi_{A, B})(7) = \lambda_{\pi_A}(\varpi_A) =\lambda_{\pi}(\varpi_A) = 11$. Text Text Text TextTextText TextTextTextTextTextText   TextTextText
\end{document}

-
In what context are your lines too long? Can you provide a minimal working example (MWE)? – Werner Oct 1 '13 at 22:59
@Werner: It is part of a long document and I don't seem to be able to take out the part that is causing the problem. I will try some more. There basically is some text and some math and somehow it all comes together so that part of the math runs over the line – Thomas Oct 1 '13 at 23:11
Ahhh, note that math content can only break at certain locations. For example, take a look at How to achieve line break in simple $formula$-mode. Issuing \allowbreak at breakable locations might help. – Werner Oct 1 '13 at 23:15
@Werner: That is it. I was thinking it had to be \allowlinebreak but it was even more obvious. – Thomas Oct 1 '13 at 23:22

Insert \allowbreak where needed, or even better, reword the sentence - the breakpoints (after relations and binary operators) are there for a reason.

From TeX by Topic (p 207):

23.9 Line breaking in math formulas

In-line formulas can be broken after relations and binary operators. The respective penalties are the \relpenalty and the \binoppenalty. However, TeX will only break after such symbols if they are not enclosed in braces. Other breakpoints can be created with \allowbreak, which is an abbreviation for \penalty0.

Unlike in horizontal or vertical mode where putting two penalties in a row is equivalent to just placing the smallest one, in math mode a penalty placed at a break point – that is, after a relation or binary operator – will effectively replace the old penalty by the new one.

If you add \showoutput to your MWE, you can see TeX printing the insertion of the penalty after the operator = but nowhere else (the output below is for that $F_A(\pi_A) = F_A(\pi_{A},B)$ is):

....\OT1/cmr/m/n/10 t
....\OT1/cmr/m/n/10 h
....\OT1/cmr/m/n/10 a
....\OT1/cmr/m/n/10 t
....\glue 3.33333 plus 1.66666 minus 1.11111
....\mathon
....\OML/cmm/m/it/10 F
....\hbox(4.78334+0.0)x6.51392, shifted 1.49998
.....\OML/cmm/m/it/7 A
....\OT1/cmr/m/n/10 (
....\OML/cmm/m/it/10 ^^Y
....\hbox(4.78334+0.0)x6.51392, shifted 1.49998
.....\OML/cmm/m/it/7 A
....\OT1/cmr/m/n/10 )
....\glue(\thickmuskip) 2.77771 plus 2.77771
....\OT1/cmr/m/n/10 =
....\penalty 500
....\glue(\thickmuskip) 2.77771 plus 2.77771
....\OML/cmm/m/it/10 F
....\hbox(4.78334+0.0)x6.51392, shifted 1.49998
.....\OML/cmm/m/it/7 A
....\OT1/cmr/m/n/10 (
....\OML/cmm/m/it/10 ^^Y
....\hbox(4.78334+0.0)x6.51392, shifted 1.49998
.....\OML/cmm/m/it/7 A
....\OML/cmm/m/it/10 ;
....\glue(\thinmuskip) 1.66663
....\OML/cmm/m/it/10 B
....\kern0.50172
....\OT1/cmr/m/n/10 )
....\mathoff
....\glue 3.33333 plus 1.66666 minus 1.11111
....\OT1/cmr/m/n/10 i
....\OT1/cmr/m/n/10 s

-