So say I have the following paragraph


xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx $\hat{\sigma}_w(kn)$ Here are some other random words in order to show where the margins should be. I'll switch to lorem ipsum now. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque in diam ipsum. Vestibulum pretium orci eu dui dictum suscipit. Proin suscipit consectetur risus in placerat. Donec id interdum diam. Donec eleifend non justo in fermentum. Nullam varius feugiat ipsum, in fringilla magna vehicula consequat. Pellentesque ut arcu bibendum, pulvinar neque semper, tincidunt eros. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aliquam erat volutpat. Proin eget placerat ipsum. Proin pharetra velit turpis, a condimentum dui scelerisque quis. Vestibulum consequat libero vel odio auctor mattis. Quisque ipsum nulla, sagittis at sagittis eget, convallis a odio. Suspendisse potenti.

When looking at this document in a PDF we see the following:

Bad Margins

How do I fix this so that the margins are enforced? It seems like latex should be pushing the equation down to the next line, but for some reason it's not. It's a super small equation so it really doesn't make sense to create a whole new line for something that tiny. I can't seem to find any parameters that force this to squeeze into its current line (which currently can't happen since I'm using just xxxxx...xxxx, but technically my actual code has words in front of it so it 'could' squeeze if it wanted) and/or fall to the next line.

I've already tried writing the equation like this:


(added {}) but that didn't seem to change anything. I can't seem to find anything in the documentation that would fix this issue. Anyone have thoughts?


margins are never “enforced”, but if you write something that can't fit in the printing area, you get a warning (“overful \hbox”).

the optimum solution is to rewrite so the problem doesn't occur in the first place. in default of that, put \linebreak[4] before your bit of maths; the line will now be under-full (with an appropriate warning), but that’s as good as you are going to get.

  • That's exciting. I've gone ahead and used the linebreak method whenever I couldn't change the text before. Thanks. – Aram Papazian Aug 15 '14 at 6:14

The point here is that LaTeX is in trouble because it won't stretch the spaces before the equation in a non-exaggerated way (I can't explain what it "exaggerated" to LaTeX) that sends the equation down, so it keeps the equation up and gives you an Overfull \hbox warning. One way to solve this is to force the linebreak, thus generating the opposite warning (Underfull \hbox). Another way is wrapping the rest of the line in a \hbox to <length>, which overrides the normal definition of "exaggerated" and forces more stretching of spaces, filling the whole line with what is before the equation and therefore sending the equation down. In that case, the <length> would be \linewidth - \parindent, since it's a whole line at the start of a paragraph. Naturally the case presented in the MWE wouldn't allow this as there are no spaces. Alternately you can include the equation in the \hbox to, but I'm not sure if the spaces will be squeezed this way. So what I suggest is:

\advance\foo -\parindent
\hbox to \foo{rest of the line} $equation$

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.