Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Contrary to English, in German there are quite a few words containing a hyphen, e.g. "Arbeiter-Unfallversicherung" (workers' accident insurance). By default, (La)TeX will only break such words after the present hyphen and discard all other breakpoints. This behaviour will often result in overfull hboxes for German texts.

There are at least three ways to achieve proper hyphenation, two of which use shorthands of the babel package and none of which I consider really satisfactory:

  1. The "= shorthand: Arbeiter"=Unfallversicherung. This allows every (otherwise legal) breakpoint and therefore may produce correct but unfavourable hyphenation (e.g. Arbeiter-Un-fallversicherung). This seems to be a method of last resort, suited for documents to be created with (almost) no manual intervention.

  2. The \- command: Ar\-beiter-Unfall\-ver\-si\-che\-rung. By manually setting allowed breakpoints, one can avoid unfavourable ones shortly before or after a present hyphen (I use a minimum of four characters as a rule of thumb). As a downside, one has to look up the correct breakpoints of the respective words. Also, the body of a LaTeX document may become quite cluttered.

  3. The "- shorthand: Ar"-beiter-Unfall"-versicherung. This method (the one I'm currently using) also avoids unfavourable breakpoints and allows for a tidier document body. But one still has to look up the correct breakpoints.

To cut a long story short: Is there a way to automatically allow hyphenation of words already containing a hyphen, discarding breakpoints less than, say, four characters before or after the present hyphen?

share|improve this question
2  
Just a side note (I have no solution for the real problem): I would find “Arbeiterunfallversicherung” more natural looking in German. Duden even has the entry “Arbeiterunfallsversicherungsgesetz”, though in the section on adding hyphens it does concede that one could add a hyphen there. (The ÖWB doesn’t have a corresponding entry.) – Caramdir Sep 4 '10 at 7:48
Sometimes the hyphen in German words is sort of optional, sometimes it's mandatory, e.g. in "öffentlich-rechtlich" (public-law). – lockstep Sep 4 '10 at 13:01

3 Answers

up vote 12 down vote accepted

No. You could possibly use an external parsing script to apply one of those options to a text, but writing that will be a lot of work still, do manually adding commands is probably less work in practice.

Future update: LuaTeX has rudimentary support for some special hyphenation cases, and in a future version (spring 2011, most likelu) there will be core support for weighted hyphenation and multiple hyphenation passes.

share|improve this answer
Many thanks for your answer - I'm out of votes for today, but will upvote it tomorrow. Also, the present and future features of LuaTeX regarding hyphenation sound very interesting. – lockstep Sep 3 '10 at 19:16
2  
Any chances for updating your answer with regard to the current state of LuaTeX? – lockstep Apr 20 '12 at 15:42

You can set \lefthyphenmin=4 to ensure at least 4 characters after the explicit "= hyphen before any hyphens inserted by tex. (It really sets that there should be 4 characters after the beginning of any word, not only compound words with a "=.)

It's possible to make the change to \lefthyphenmin locally, but it is awkward. Tex only looks at the value of \lefthyphenmin at the beginning of paragraphs and at language changes, so you have to write something like: {\lefthyphenmin4\setlanguage\language ...}\setlanguage\language

share|improve this answer

This seems to be what the hyphenat package is for. From the manual:

TeX does not want to hyphenate a word that appears in the source already hyphenated, such as electromagnetic-endioscopy.
The \hyp command is like the other \...hyp commands, only it typesets a hyphen and allows full automatic hyphenation of the other words forming the compound word. It is used like electromagnetic\hyp{}endioscopy.

I'm not sure about your last criterion, though it seems that if TeX applies its normal hyphenating rules then this would be unlikely to happen anyway since (I think) that what happens is that the word after the \hyp{} is treated (as far as hyphenation is concerned) as a new word and I guess that not many words get hyphenated in the first (or last) few characters.

share|improve this answer
It sounds like this does the same as babel's "= shorthand? – Taco Hoekwater Sep 3 '10 at 18:58
The effect of the \hyp{} command seems to be similar to that of the "= babel shorthand. As far as I understand, the text before and the one after these commands are treated as separate words. Unfortunately (regarding to my question), words that may be hyphenated with only two characters separated from the rest are quite common in German. – lockstep Sep 3 '10 at 19:08
@lockstep: I wondered about that, but figured that if you knew about hyphenat then you'd've explained why it didn't work so thought it worth at least mentioning. – Andrew Stacey Sep 3 '10 at 19:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.