Forum Bugs

Hyphenation of overlong words

yet
See attached prince.pdf file, page 1.

Some words are not correctly hyphenated and overlap the right border.

https://github.com/zopyx/css-paged-media-tutorial/tree/master/in-progress/lesson-hyphenation-long-words
  1. prince.pdf27.5 kB
pjrm
This arises because Prince currently completely avoids hyphenating words within a hyphenated phrase: e.g. "sea-of- / ficers" isn't a good hyphenation, even though "of- / ficers" is perfectly acceptable.

However, as the example shows, it isn't the right thing with very long words. I recently came across such an example myself, in some chemistry text, where some different software avoided hyphenating the second word of “β-sesquiphellandrene”.

The compromise suggested by the style guide of the Oxford University Press (Hart's Rules) is to allow hyphenating words in the phrase, but no closer than 6 letters from the closest in-text hyphen, so still forbidding hyphenating as either
             Kraftfahrzeug-Haft-
 pflichtversicherung

or as
                  Kraftfahr-
 zeug-Haftpflichtversicherung

but allowing hyphenating as either
          Kraftfahrzeug-Haftpflicht-
 versicherung

or as
                    Kraft-
 fahrzeug-Haftpflichtversicherung


Said style guide is of course intended primarily for english text; does Duden offer a comparable suggestion, or what's your own view as to where to draw the line for where to allow and disallow hyphenating words in a hyphenated phrase in German text ?

I'll have a look at how hard it would be to impement the Hart's Rules suggestion.
yet
In this case the hyphenation rules must not have a higher priority over overlapping the next with the border.
I am not a linguist but performing a break within the two parts of a long combined term is not a problem in German (and perhaps not in other languages).
pjrm
I've changed Prince so that future versions will treat words in hyphenated phrases just like any other words, making it match web-browser behaviour, and fixing either overflow or very short lines when the hyphenated phrase contains a very long word (as in your example). Thank you for reporting the problem.

As for whether Prince for Books should even try to avoid breaking a word near an in-text hyphen in German: First of all, it's not so much a linguistic hard rule so much as a typographic principle of making some attempt to avoid having readers misread the partial word as a full word. German is somewhat helped (compared to present-day English) by its use of capital letters for nouns, as in the phrases in the example document; though you might be able to construct an example comparable to the aforementioned "sea-of- / ficers" example by using a verb whose first few letters form a word, perhaps "zu" or "ein". In any case, Prince for Books will for the moment make the same change as normal Prince, treating words in a hyphenated phrase just like any other word.
mikeday
This hyphenation change is now available in latest builds.
butter
Which css properties do I use to avoid line break in words like "year-to-year" and "2016-17". I'm using Prince version 11. Thanks.
  1. Screen Shot 2016-12-09 at 11.51.43 AM.png22.7 kB
    bad breaks
pjrm
In order to strictly prevent line wrapping at a *particular* hyphen, one can either:
  • change the hyphen character to U+2011 non-breaking hyphen (year‑to‑year, 2016‑17; or character entity ‑); or
  • apply white-space:nowrap to the word or phrase that you want not to be split over lines. nobr is the traditional tag name to use to do this, and Prince and some browsers include a nobr { white-space: nowrap } ruleset in their default user-agent stylesheet.
It appears that there is no CSS property that forbids breaks at hyphen characters (while allowing breaking at spaces) throughout a paragraph.
butter
Thanks.
pjrm
I've had another look at this, because it seems to me that Prince ought to avoid breaking 2016-17 by default. What's particularly surprising is that in the screen shot, it breaks *before* the hyphen. If you post the html for that test case, then I'll look into what's happening there, and whether there's a better solution for that case.