0

There are many previous questions on the topic of “how do I keep over-wide content centered?”: for displayed math, figures, equations. Their answers (mostly using \mathclap) are well-suited to the use-case of centering individual over-wide content that you have specifically decided to tolerate in a document.

I would like to do the same thing — centering over-wide equation* environments — but for a different use-case: the document is still in preparation, and I intend to fix the over-wide equations later, but while preparing the document, I’d like to keep them centered for readability. So my extra desiderata are:

  1. do not suppress the overfull hbox warnings (I still want to find/fix these wide equations later)

  2. apply globally to all equation* environments (presumably by patching the environment definition)

The solutions with mathclap put the equation content in a zero-width box, so have the effect of suppressing warnings. Some of the other solutions retain the warnings, but work by hand-coding a suitable box around the wide content, and I can’t figure out how to patch them into the environment definition. (Also, some of these alter the vertical spacing of the equation, which I’d like to avoid if possible.)

In other words, I’d like to change the behaviour from “over-wide equations spill into the right margin” to “over-wide equations spill equally into both margins”, without changing anything else, as far as possible.

Possibly-relevant note: I’m using amsmath.

  • You might try using the adjustwidth environment from changepage and remove it later. – Bernard May 02 '20 at 19:03
  • equation* is a thin wrapper around the primitive $$ display math and the behaviour of overfull boxes to overflow on the right is deep in the tex primitive and not something you can control from tex macros, so while it is no doubt possible you would have to extensively re-implement a lot of the math layout logic, and probably be incompatible with existing macros, so it might be more trouble than worth just for debugging drafts. – David Carlisle May 02 '20 at 19:27
  • @DavidCarlisle: Yes, getting to that point was where I gave up on figuring it out myself and came here. I was hoping someone might have already figured out a way to change the overflow behaviour, which could then be reused here. – Peter LeFanu Lumsdaine May 03 '20 at 07:36
  • @PeterLeFanuLumsdaine you can not change the overflow behaviour if a box overflows it will overflow on the right, so what you would have to do is measure things hide the width so it centers and then re-set the expression in a box register to generate the overfull box warning, then throw away that box register. – David Carlisle May 03 '20 at 09:50

0 Answers0