2

One of my equations, which is not particularly long, happened to be in the end of a line. LaTeX put it in such a way that it uglily flows over the end of the line. Is there an automatic way to fix it, without manually breaking the formula?

\documentclass{article}
\pdfpagewidth=8.5truein
\pdfpageheight=11truein
\begin{document}
text text text text text text text text text text text text text text  $Prop(Any\, shape,\, n,\, all\, shapes)=\frac{1}{n}$. text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text 
\end{document}
  • 2
    Usually adding \allowbreak at an appropriate point is the way to go, or rewording the sentence. Otherwise this is expression could be put as an unnumbered display. – Andrew Swann Oct 31 '14 at 11:21

1 Answers1

3

Here are the options you have

  • rewording the sentence
  • adding \allowbreak at appropriate points in the formula, e.g. P(x,\allowbreak y,\allowbreak z) = q
  • displaying the equation without a number: standard LaTeX \begin{displaymath}...\end{displaymath}, or with the amsmath package use \begin{equation*}...\end{equation*}
  • using the package microtype to give more flexibility to spacing in the paragraph
  • increasing \emergencystretch for the paraagraph: {\emergencystretch=1.5em .... \par}
  • setting the paragraph as sloppy: \begin{sloppypar}...\end{sloppypar}

Which option is best depends on the surrounding text, but the last two measures should be avoided if possible.

For allowing breaks at commas in inline formulae see Allowing line break at ',' in inline math mode?

Andrew Swann
  • 95,762