Avoid badbox with maths in the line

I would like to learn to avoid this annoying warnings:

Overfull \hbox (11.18448pt too wide) in paragraph at lines 6--7

The easiest document possible:

\documentclass[a4paper, 10pt]{article}

\begin{document}
That is to say, an inertial reference $P$ is like an affine reference $(p_0;v_0,v_1,v_2,v_3)$ such that $\{v_0,v_1,v_2,v_3\}$ is a positively oriented basis of $E$, vector $e_0$ is oriented to the future and...
\end{document}


gives me

If I add \break following to "reference", it still gives me the warning. So, how can I fix this warnings? (Indeed I have my documents full of them!, I just want to get rid of them)

• Take a look at this: tex.stackexchange.com/a/28819/117534. You can add the option draft to the documentclass, and you'll see black boxes where there are overfull box errors. Makes it easier to ''debug''.
– Troy
Apr 17, 2017 at 12:44

You could use \sloppy which gives more flexibility in stretching white space, but here it needs to stretch even more than \sloppy allows so you get warned of an under full box (and it looks pretty poor).

\sloppy
That is to say, an inertial reference $P$ is like an affine reference
$(p_0;v_0,v_1,v_2,v_3)$ such that $\{v_0,v_1,v_2,v_3\}$ is a positively
oriented basis of $E$, vector $e_0$ is oriented to the future and...


with warning

Underfull \hbox (badness 1888) in paragraph at lines 5--6
[]\OT1/cmr/m/n/10 That is to say, an in-er-tial ref-er-ence $\OML/cmm/m/it/10 P$ \OT1/cmr/m/n/10 is like an affine ref-er-ence


with such a short paragraph with large unbreakable units TeX will struggle so you may need to help it a bit, either accepting the above stretched version, or adding breaks by hand

eg without \sloppy but a forced break

That is to say, an inertial reference $P$ is like an affine reference
$(p_0;\break v_0,v_1,v_2,v_3)$ such that $\{v_0,v_1,v_2,v_3\}$ is a
positively oriented basis of $E$, vector $e_0$ is oriented to the future and...


• Why not add some \allowbreak 's? That might be less intrusive Apr 17, 2017 at 21:29
• @daleif if you are only doing it at the end, to force a manual line break, arguably it's no point just hinting. It would be different if you were to make a macro for (.. ; ....) that put a possible break point after every ; then you would just want to allow a break without forcing it. Apr 17, 2017 at 21:31
• I still always use allowbreak. A lot if texts get reused do having to remove those manual breaks after a margin change etc is annoying, thus I tend to always recommend the allowbreak option and let large decide. Then if the user later on changes stuff there is no harm done. Apr 17, 2017 at 21:35