6

In general, I am letting LaTex do its own thing regarding document layout. I have set the margins and line-spacing according to my University's criteria, but otherwise the only thing I have messed with is the spacing within list environments. In particular, I don't have any kind of [htb] arguments when I place floats. I have found no need to mess with what LaTex does automatically, the output looks just fine now I have a long document with lots of text and lots of figures.

However, I have just come across an instance of a paragraph of text broken by the insertion of two pages of floats (comprising three figures). The problem is that the paragraph of text is broken in the middle of a word. I don't have a general problem with hyphenation either, but I do take exception to having a word start on page 1 and finish on page 4. I am in fact rather surprised that LaTex allows this to happen. Can anything be done to stop it?

  • 1
    You could try \brokenpenalty=10000 – morbusg May 21 '14 at 11:23
  • @morbusg thank you for your suggestion: it sounds like a good one. – FionaSmith May 21 '14 at 12:02
4

latex doesn't really allow it to happen, it just doesn't know it happened.

The way TeX works more or less is that paragraphs are broken into lines (and at this point you can control the desirability of hyphenation and white space stretching etc) and the resulting series of line boxes are placed into a vertical list along with other vertical material like displayed equations vertical space etc.

This is a conceptually infinite scroll and Tex may in fact get several pages worth of content onto this list (in particular if you write a single paragraph that takes more than a page then the entire paragraph is split into lines before any page breaking is considered).

At certain times TeX decides to try to output some pages, at which point it takes the current vertical list, any pending floats, the specified page head and foot, and tries to make up some pages. and at this point it doesn't look inside the line boxes (to see a trailing -).

So what to do:

As morbusg indicated in a comment when doing the line breaking TeX inserts penalities giving hints as to the desirability of page breaking at that point, and after a hyphenated word the penalty \brokenpenalty is added, if you increase this (10000 being the maximum) then you discourage a page break at that point, but unless there is flexibility elsewhere on the page this may leave the page short as the page break just happens the line above. What you can not do automatically is just adjust the linebreaking so that a hyphen is not needed at that point. In a sufficiently long paragraph that is usually possible, so your choices are to set a high \brokenpenalty but that applies to all page breaking, whether or not floats are inserted, and can lead to poor shprt or over-stretched pages, but can work automatically with a single setting, or to manually adjust the paragraph by putting the word in an \mbox{theword} so it doesn't hyphenate then with a bit of luck TeX will re-adjust the linebreaking for the whole paragraph in a way that does not require a hyphen on that line.

  • Thanks for that explanation, it really helps to understand how the underlying processing happens. I had already thought of \mbox but I don't really like this approach if it can be avoided: I am still changing the text and this page break will likely move anyway. \brokenpenalty sounds like a good option but if it might mess up the pagination generally, I will leave it for now until I know for sure whether I have this problem in the final document. – FionaSmith May 21 '14 at 12:02
  • @FionaSmith If you are still editing the text, leave the bad hyphenation until the final touch up of the document. Such problem is typically the last thing worry about. Focus on the content. – Sveinung May 21 '14 at 18:00
  • @Sveinung yes I agree entirely, that was exactly my plan. I was just surprised it happened in the first instance! – FionaSmith May 21 '14 at 19:34

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.