[texhax] special hyphenation

Uwe Lück uwe.lueck at web.de
Fri Jun 20 13:46:53 CEST 2008


At 11:31 20.06.08, Natércia Fernandes wrote:

>I would like to known if there is a way to "protect" the symbol hiphen in
>words that have it themselves. That is:
>
>In portuguese words having a hiphen are very common.
>When I write a LaTeX document in portuguese I type things like
>viram-nas
>empenharam-se.
>
>There are 2 different problems when these words have to be broken over two
>lines (hyphenated):
>1. LaTeX always breaks them in the "-" they have, even if the result would be
>very different if such symbol was absent.

Can you give an example? What would you prefer? ... apart from below?

>2. In portuguese the hyphenation is possible also at the place where the "-"
>is, but in this case the next line should begin with another hyphen (rule
>that LaTeX doesn't follow if I type the words simply as above).
>For example, the word "empenharam-se" can be hyphenated according to
>portuguese rules like this:
>
>em-                                        1st line
>penharam-se                          2nd line
>
>or
>
>empe-
>nharam-se
>
>or
>empenha-
>ram-se
>
>or (and the problem is here)
>empenharam-
>-se                                        (note the hyphen at the beginning
>of this second line)
>
>
>How can I tell LaTeX that:
>1. the "-" is nost employed in the sense of "hyphenate here"?
>2. if it hyphenates at a "-" then it should insert another "-" at the
>beginning of the second line?

1. Have you tried the babel package (LaTeX distribution) and its Portuges 
module?
[It seems to me that it doesn't support your 2nd desirement]

2. In general, \mbox{-} would produce a visible hyphen at which
no line-break will occur. My problem is here, that it is not clear
to me whether you want a break here or not. I guess you mean:
     a. a break at an explicit hyphen should not be preferred
         to other possible breaks -- indeed, usual TeX suppresses
         other breaks in words containing an explicit hyphen
     b. a break at an explicit hyphen should work differently
         than other breaks.

german.sty provides features in this direction ... and there is
the \discretionary command of TeX, TeXbook p. 95.

On 2a. above: TeX's idea to suppress other breaks has its merits
-- another break than at the explicit hyphen may be confusing.
With german.sty, I use "- to allow a different break in such a case,
but I care that the different break is two syllables away from the
explicit hyphen.

So I SUGGEST two things:

Concerning BOTH: I suggest to redefine \= (originally an accent)
to produce the explicit hyphen with the special breaking feature.

The SIMPLE thing allows unrestricted hyphenation at
different places of the word:

\makeatletter
\renewcommand*{\=}{%
   \penalty\@M\discretionary{-}{-}{-}\hskip\z at skip}
\makeatother

The SOPHISTICATED thing suppresses hyphenation at
different places than explicit hyphen, but you can use
\- to override this suppression. \- is redefined, originally
it allows hyphenation suppressing other hyphenations
of the word. The new definition works like "- from german.sty:

\makeatletter
\renewcommand*{\-}{%
   \penalty\@M\discretionary{-}{}{}\penalty\@M\hskip\z at skip}
\renewcommand*{\=}{\discretionary{-}{-}{-}}
\makeatother

... well, I hope so. Please tell if it doesn't work as suggested.

Uwe.



More information about the texhax mailing list