If I set content into a box that is not wide enough (0pt in the MWE below), I get an overfull mesage displayed in the console. Can I obtain the maximum value reported in the messages

Overfull \hbox (XXXXX too wide)

after typsetting the contents into a \savebox?

Below, I am manually setting


and am looking for a way to get the actual value reported as XXXXX.

enter image description here





%% https://tex.stackexchange.com/questions/394778/align-in-varwidth-seems-to-ignore-fleqn-option

     \setlength{\OverfullSize}{77.16191pt}% <-- How to determine the max overfull \hbox?

    y &= mx + b \\
    F &=ma

    y &= mx + b \\
    F &=ma

Above box is overfull by: \printlength{\OverfullSize},

Above box is overfull by: \printlength{\OverfullSize}
  • 1
    similar to your last question. In classic tex you can't take the box apart (as the mathon.mathoff nodes do not have \unskip equivalents so the only way "from the outside" is to parse the log file. If you know it is an ams alignment and you change the code of align to record all the widths it sees in some global place then perhaps... So not necessarily impossible but not that easy. (luatex would be easier) – David Carlisle Oct 8 '17 at 20:08
  • @DavidCarlisle: If I can't easily get theactual value, is it possible to at least detect if an overfull \hbox did or did not occurr? within a \savebox{}. – Peter Grill Oct 8 '17 at 21:06
  • Short answer no. Longer answer tex is turing complete so if you are prepared to throw enough code at it, probably yes. (this question is I suspect harder than you think it should be:-) – David Carlisle Oct 8 '17 at 21:08

Your Answer

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

Browse other questions tagged or ask your own question.