3

I'm getting a bad box in the following (I can see in the PDF that the expression is shooting past the right edge of page contents):

\item If $\dfrac{a}{b} = \dfrac{c}{d} = \dfrac{e}{f} = \ldots$, then each of these ratios    
is equal to $\left( \dfrac {pa^n + qc^n + re^n + \ldots}{pb^n + qd^n + rf^n + \ldots} 
right)^{\frac{1}{n}}$, where $p$, $q$, $r \ldots$ are any quantities whatsoever.

Is there an automatic setting that will shift the expressions to the next line? Or perhaps there's a better solution?

ankush981
  • 217
  • A self-contained an minimal example would be helpful. But perhaps the answers to this question already solve the problem. – Thorsten Donig Jul 27 '13 at 08:41
  • 1
    Don't use \dfrac in text mode, prefer the slahed form. A big fraction such as the one in the middle should probably be displayed. Use \dotsb instead of \ldots in the big fraction (after +) and ,\dotsc in the last occurrence. – egreg Jul 27 '13 at 08:42
  • @egreg, but using only \frac makes the font smaller, which I don't want. Plus it doesn't solve the bad box problem. – ankush981 Jul 27 '13 at 08:44
  • 1
    Use $a/b$, not $\frac{a}{b}$ inline. But the bad break is due to the big fraction that shouldn't be inline. If the original is bad, why trying to replicate it? – egreg Jul 27 '13 at 08:51
  • @egreg The original is a book from which I'm making notes. I was just wondering id there's a way to automatically insert a line break in case of a bad box. – ankush981 Jul 27 '13 at 08:56
  • @dotslash You could add \sloppy or set \emergencystretch; however this wouldn't help in improving quality, and probably they'd do worse. – egreg Jul 27 '13 at 09:04
  • Yeah ... I guess I'll have to live with this. – ankush981 Jul 27 '13 at 09:09

2 Answers2

7

I'd recommend you use display math for the fraction:

enter image description here

Notes:

  • As per egreg's suggestion I have used \dotsb and \dotsc.

Code:

\documentclass{article}
\usepackage{mathtools,showframe}

\begin{document} \begin{itemize} \item If $\dfrac{a}{b} = \dfrac{c}{d} = \dfrac{e}{f} = \dotsb$, then each of these ratios
is equal to [\left( \dfrac {pa^n + qc^n + re^n + \dotsb}{pb^n + qd^n + rf^n + \dotsb} \right)^{\frac{1}{n}}, ] where $p$, $q$, $r \dotsc$ are any quantities whatsoever. \end{itemize} \end{document}

Peter Grill
  • 223,288
4

You can use the \sloppy in front the expression to force a break, but that doesn't make it look any better:

enter image description here

That said, you can also add \phantom{$\dfrac{a}{b}$} at the end to force a "normal" looking vertical spacing, the full code reads:

\item If $\dfrac{a}{b} = \dfrac{c}{d} = \dfrac{e}{f} = \ldots$, then each of theseratios is equal to \sloppy\(\left( \dfrac {pa^n + qc^n + re^n + \ldots}{pb^n + qd^n + rf^n + \ldots}\right)^{\frac{1}{n}}\), where $p$, $q$, $r \ldots$ are any quantities whatsoever.\phantom{$\dfrac{a}{b}$}

and the result:

enter image description here

Still, I would suggest you to use display style for the big expression, as Peter Grill did.

Francis
  • 6,183
  • 2
    As I predicted, the result is a disaster. ;-) – egreg Jul 27 '13 at 09:05
  • I would think it is better to use \frac instead of \dfrac in this case. – Peter Grill Jul 27 '13 at 09:07
  • Use \frac would make the space around fraction looks really weird as we used \sloppy... may be a/b would be slightly better. – Francis Jul 27 '13 at 09:13
  • 1
    @Francis Keep in mind that \sloppy is a declaration that will be in force from that point on. Either add \fussy or use grouping (and \par before the closing brace). – egreg Jul 27 '13 at 09:24