Forum Bugs

No hyphenation on last line of page

wulfila
Hi,

Hyphenation seems to fail on the last line of a page. I prepared a sample file, containing four identical paragraphs; a line that is properly hyphenated in the middle of the page is not hyphenated at the end:

[It seems I can's post URL's on a first post; the sample files can be found at www dot wulfila dot be slash day]

I used these rules:

p {
   text-align: justify; 
   prince-hyphenate-patterns: url('hyphenation.en.dic'); 
   hyphens: auto; }


Did I miss something in the stylesheet?

Thanks,
Tom De Herdt

Tom De Herdt

mikeday
We intentionally avoid hyphenating the last word on a page, so this is a feature, not a bug. :)

The idea is that the reader doesn't have to turn forwards/back a page in order to read the first/last word on the page. Is this something that you would like control over?
wulfila
OK, I see. It makes sense. However, occasionally the word spacing on the last line gets very large. In a long document (400+ pages, written in Dutch, with lots of long words), I had about ten pages where spacing was unacceptable (4mm or more).

It can be fixed manually by rephrasing sentences, but this is not a very attractive option for large documents that may still be edited later on.

So if it is possible to control this with a simple CSS-switch, that would be wonderful. I'm not sure how e.g. LaTeX handles this (will check). Maybe the offending line should be moved to the next page (or one line up, depending on available space). That would be an "auto" override mode, next to a more basic mode where you simply allow hyphenating the last word...?

Anyway, thanks for the quick reply.

Tom

Tom De Herdt

wulfila
As far as I can tell, LaTeX (XeTeX) seems to avoid hyphenating the last line by moving it up or down.

On the other hand, I skimmed through Robert Bringhurst's Elements of Typographic Style (3rd edition, 2004) and found at least two instances of last-line hyphenation (p. 99, 215).

I'd say if Robert Bringhurst can do it, so may we (at least optionally). :)

Tom De Herdt

mikeday
Long words will put more stress on the paragraph breaking algorithm, particularly in languages like Dutch and German. Currently, LaTeX tries harder than we do to avoid awkward breaks, this is something that we are hoping to improve in Prince 7.0. In the meantime, it would make sense to add a property to control whether the last word on the page can be hyphenated, and I've added this to the roadmap.
wulfila
Great! Thanks. PrinceXML generates impressive output with very little code and fits our needs almost perfectly. It's good to know that a last minor obstacle will soon be gone.

Tom De Herdt

wulfila
One year after the original post, I'd like to express continued interest in a property that controls whether the last word on the page can be hyphenated.

- Problems are not limited to Dutch or German text. See for instance p. 2 and 5 of the Wikipedia article on the Soviet Union in the Prince sample documents. The space between the words on the last line is unacceptable for serious work and makes it practically impossible to use Prince whenever you need justified text on large documents.

- It could be more than just a fix awaiting TeX-like line-breaking and justification. Here is what Bringhurst, mentioned a previous post, has to say: "Style books sometimes insist that both parts of a hyphenated word must occur on the same page: in other words, that the last line on a page must never end with a hyphen. But turning the page is not, in itself, an interruption of the reading process. It is far more important to avoid breaking words in those locations where the reader is likely to be distracted by other information. That is, whenever a map, a chart, a photograph, a pull-quote, a sidebar or other interruption intervenes." [The Elements of Typographic Style, v3.1, p. 44]

I don't want to push my luck (and I'm not a programmer), but is it -- technically speaking -- hard to add such a property? If not, I'd like to 'vote' in favor of not pushing the item further down the roadmap. It seems about as important as being able to specify the length of the top border on the @footnotes area. Not important for informal documents or web printings, but still a condition sine qua non for 'traditional' publications.

We are looking at OpenType and ligatures soon, it would break my heart to see Prince's fine typography spoiled by huge gaps in the last line...

Tom De Herdt

mikeday
We may be able to accelerate this feature, as we are currently investigating better algorithms to improve line-breaking and justification quality. I can't promise it will be in Prince 7.0 though; perhaps 7.1? :)
wulfila
The promptness of your replies never ceases to amaze me. Thanks!

Tom De Herdt

mikeday
The new beta for Prince 7.0 includes a TeX-style justification algorithm, and will now hyphenate the last word of a column or page if it judges it more aesthetically pleasing to do so.
wulfila
Just ran a 600-pages document through Prince 7.0: justification/hyphenation has improved dramatically! The text looks much more balanced. And I couldn't find a single problem (compared to dozens of awkward page endings in the previous version). Congratulations, this is really an impressive release. Looking forward to try out the new features (OpenType etc.)

Tom De Herdt