LyXPreventing margin overruns with formulas

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
CSMR
Posts: 44
Joined: Fri Oct 10, 2008 10:44 pm

Preventing margin overruns with formulas

Post by CSMR »

Last question! LyX is really great, these are the only problems I have at the moment.

Is there a way to force LaTeX to obey margins and page boundaries? I find it gets it right when there is just text, but often overruns margins and even pages if there are inline formulas. Even short inline formulas cause problems. Is this a bug in LaTeX?

Ideally, I would like it to obey margins whenever it is theoretically possible, which it always is in my documents.
Last edited by CSMR on Sun Oct 17, 2010 5:32 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

CSMR
Posts: 44
Joined: Fri Oct 10, 2008 10:44 pm

Re: Preventing margin overruns with formulas

Post by CSMR »

I'm also getting margin overruns in the Abstract without formulas, just regular text.
Is there a way to force LaTeX to obey margins? (Some cost that can be set to infinity?) Even the most basic wordprocessors have known for decades that margins should always be obeyed.
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Preventing margin overruns with formulas

Post by frabjous »

Try inserting the LaTeX code "\sloppy" at the beginning of the document.

I can't speak for LyX, LaTeX itself does it out of typographical fussiness. It's sort of its way of getting your attention. It reports a overall hbox when it does in the log files. It knows it could push the content down to the next line, but that would result in ugly large whitespace gaps, and it doesn't want to do that either. So it tells the typesetter to fix it manually.

These features are designed for when LaTeX is used for professional typesetting. In sloppy mode it doesn't do that, and margins are respected whenever possible.

But LyX is designed for a different kind of user, and it should know to handle this for you.

In displayed equations, things a bit different. It's been awhile since I've used LyX, but there should be a way of using a split, gather or multline environment instead of a normal equation to handle breaking. Maybe a regular LyX user can comment.
CSMR
Posts: 44
Joined: Fri Oct 10, 2008 10:44 pm

Re: Preventing margin overruns with formulas

Post by CSMR »

Great; that was a quick fix! With \sloppy in the preamble, everything is respecting margins now. It looks far from sloppy!
Thanks!
Post Reply