11

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…)

lockstep
  • 250,273
  • Have a look at the answer to this question: http://tex.stackexchange.com/questions/2319/center-flow-chart-horizontally – Stefan Kottwitz Nov 15 '10 at 00: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 00:49
  • 1
    @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 00:57
  • Try \makebox{$\displaystyle ... $}. – Aditya Nov 15 '10 at 01:11
  • @Peter: perhaps \makebox and \parbox nested with \[...\] would work, but I would try the \mathclap solution of Geoffrey. Since it's somehow different, it's concerning math mode specifically, I would not see it as a duplicate. – Stefan Kottwitz Nov 15 '10 at 02:20
  • 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
  • 2
    @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
  • (cont’d) I guess if I were in a setting where they were unacceptable, and if I had more time, I’d rewrite the text to isolate/group the instances of this, and then present each such group on a landscape-oriented page. But in a nutshell: yes, I agree it’s not good, but I do think it’s the best option available. – Peter LeFanu Lumsdaine Nov 15 '10 at 17:06

1 Answers1

11

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}