# Hyphenation of words connected with a double/triple dash

I can't hyphenate the words

Cam•bri•an--Or•do•vi•cian

because they are connected with an endash. The same probably happens when using the emdash.

I tried this

 \defineshorthand{"=}{\penalty1000-\hskip0pt}
\hyphenation{Cambrian"="=Ordovician}


But I obviously don't understand this shorthand thingy.

-
the 0pt skip makes a space so Tex sees this as two words and hyphenates each separately, you can't put the compound in \hyphenation or define rules for the compound that differ from the two separate words –  David Carlisle Feb 21 '13 at 21:54

\defineshorthand{"|}{\penalty1000--\hskip0pt} would work in Cambrian"|Ordovician, but as David says, not in \hyphenation; you have to use the shorthand every time you typeset such a word.

As well, you might actually want to say the following, depending on the typographical traditions of your language:

\defineshorthand{"|}{\penalty1000\discretionary{--}{}{--}\penalty10000\hskip0pt}


The command \discretionary takes 3 arguments and it typesets #3 if no linebreak occurs at that place, and it typesets #1<end-of-line>#2 if linebreak occurs at that place.

Complete example showing the different break variants:

\documentclass{article}

\pagestyle{empty}

\usepackage[ngerman,english]{babel}
\useshorthands{"}
\defineshorthand{"|}{\penalty1000\discretionary{--}{}{--}\penalty10000\hskip0pt}

\begin{document}

\begin{tabular}{p{4cm}p{3.5cm}p{3cm}}
Hellohello Cambrian"|Ordovician World text text text text text text text
&
Hellohello Cambrian"|Ordovician World text text text text text text text
&
Hellohello Cambrian"|Ordovician World text text text text text text text
\end{tabular}

\end{document}

-
thank you. I tried that, and it does hyphenate the word, but also it prints the shorthand: Cambrian”|Or- dovician I'm using LuaLaTeX and the fontspec and xunicode packages. –  Paglia Orba Feb 22 '13 at 7:19
It should print the hyphen in the place of break of course! –  yo' Feb 22 '13 at 7:35
that's what I meant, it actually prints the "| instead of the endash.. –  Paglia Orba Feb 22 '13 at 8:16
@PagliaOrba This complete example should help you I hope. –  yo' Feb 22 '13 at 11:01