[texhax] Preserving dash when hyphenating compound words

Uwe Lueck uwe.lueck at web.de
Thu Aug 19 17:51:39 CEST 2010


Aleksandar Zec <zealeksanman at gmail.com>, 31.07.2010 12:13:15:
>------------------------------------------------------
>\documentclass{article}
>\usepackage{hyphenat}
>\begin{document}
>\noindent\fbox{%
>\begin{minipage}{2cm}%
>straw\hyp{}chopper\\
>\hspace*{1.1cm}straw\hyp{}chopper
>\end{minipage}%
>}
>\end{document}
>------------------------------------------------------
>
>According to the hyphenation rules I have to follow (examples are in
>English for the sake of simplicity), the first line is hyphenated
>correctly. However, in the second case, it should look like this:
>
>straw-
>-chopper
>
>(the original dash is preserved at the beginning of next line). How
>should one achieve this?

A shame that this hasn't been answered before.

\hyp or that macro it calls according to the hyphenat documentation might be redefined (about as follows) or you use some \dhyp or so instead of \hyp with

    \newcommand{\dhyp}{\discretionary{-}{-}{-}}

(not tested, sorry; if it works, why use hyphenat?) cf. TeXbook on \discretionary.

HTH -- Uwe.


More information about the texhax mailing list