9

I have an overfull hbox which I've decided to live with. Actually, several.

However, since they're in \[\], it would look better if they could remain centered, i.e. overflowing the margins equally on both sides, rather than just overflowing to the right. Is it possible to ask LaTeX to do this? (I'm using pdflatex and the amsbook class, fwiw.)

(Yes, I know overfull hboxes make Donald Knuth cry! But I've considered other options—splitting up these lines of maths, scaling them down a little, changing the document margins, etc—and this seems to me the least worst compromise; so please don't flame me too hard for doing this…)

  • Have a look at the answer to this question: tex.stackexchange.com/questions/2319/… – Stefan Kottwitz Nov 15 '10 at 0:27
  • @Stefan: Ah, thankyou! In light of that, I guess my question can probably be closed as a duplicate? – Peter LeFanu Lumsdaine Nov 15 '10 at 0:49
  • @Stefan: actually, I'm not quite able to get that answer working, I’m afraid. Unless I’m doing something silly, \[...\] doesn't seem to work inside the \makebox{...}, nor vice versa, and using \makebox{$...$} instead changes a lot of other things (obviously). – Peter LeFanu Lumsdaine Nov 15 '10 at 0:57
  • 2
    @Peter: I don't want to flame you too hard, but normally you really shouldn't keep overfull hboxes (unless they're only very slightly overfull). Also changing margins or scaling down is not an option. Splitting is not the only possible solution, but the easiest. Maybe you could post a minimal example of one or two of your overfull displays; I'm sure you'd get useful suggestions what to do about it. – Hendrik Vogt Nov 15 '10 at 12:58
  • 1
    @Hendrik: I know it’s bad, but for reasons to do with the mathematical content and notation, I’d really rather avoid splitting it. (Unfortunately to explain a minimal counterexample would need at least about 20 pages of background :-) ) Mentally, I attach a fairly high penalty score to overfull hboxes, and a higher one for margin changes or scaling, but a higher one still to splitting this particular content; and under my current settings (working to a tight deadline, and not for eg a commercially published journal or book) the medium-high penalty scores are acceptable. – Peter LeFanu Lumsdaine Nov 15 '10 at 17:00
9

Use \mathclap from the mathtools package:

\documentclass{amsbook}
\usepackage[margin=2in]{geometry}
\usepackage{mathtools}
\usepackage{lipsum}

\begin{document}
\lipsum[1]
\[\mathclap{%
  f(x) = \int\frac{\sin x}{x}\,\mathrm{d}x%
       = \int\frac{\sin x}{x}\,\mathrm{d}x%
       = \int\frac{\sin x}{x}\,\mathrm{d}x%
       = \int\frac{\sin x}{x}\,\mathrm{d}x%
       = \int\frac{\sin x}{x}\,\mathrm{d}x%
       = \int\frac{\sin x}{x}\,\mathrm{d}x%
}\]
\lipsum[2]
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.