Re: [xsl] Hyphenation in XSL FO

Subject: Re: [xsl] Hyphenation in XSL FO
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 10 Jan 2001 12:36:44 GMT
> But how can it be done with so many exceptions to the rules? 

If the rules are sufficiently good then you don't need so many
exceptions. English (especially with UK as opposed to American
hyphenation rules) is probably the worst of the European languages
and even here the exception dictionaries used by TeX are fairly
manageable 10s or 100s of words not thousands. Other European languages
that have more regular hyphenation rules can get by with fewer
exceptional words.

> There are lots
> of words that should not be hyphenated; names on persons, streets and
> places, days, months and so forth.

If you need to turn off hyphenation based on semantic context then
clearly you'll need markup in the FO file. But you can turn off
hyphenation (hyphenate="false") on the surrounding element
(or on an fo:inline that just carries this attribute for a single word.)

> Acctually, there's even a need for not
> splitting two words sometimes
That's what &#160; is for isn't it?


> Sorry, I'm just a TeX (or acctually LaTeX) newbie, so I'm not familiar with
> the concept of patterns.

TeX doesn't (normally) use a dictionary of words to provide hyphenation
but rather uses a particular pattern matching algorithm based on
patterns of hyphenation for each language. You can then have a
dictionary of hyphenated words (again per language) for cases when the
general rules don't work.

Whether or not your document gets correctly hyphenated will depend on
the hyphenation method used by th eFO formatter, so if you need to
customise it, it makes sense to customise this for each formatter
rather than in the XSL FO file.
(If you are using xmltex (passivetex) to format xxx.fo then you can
stick the command
\hyphenation{this-word-hyphenates-here}
in a file xxx.cfg

(I was going to use Supercalifragilisticexpialidocious as an example,
but according to a search I did in google, TeX hyphenates that one
correctly without need for an exception...

> Unless you're working with very narrow columns, there is seldom a need for
> hyphenating words with less than, say, 6 characters,

You'd probably have to tolerate excesive white space stretching with
such a rule.

David


_____________________________________________________________________
This message has been checked for all known viruses by Star Internet delivered
through the MessageLabs Virus Control Centre. For further information visit
http://www.star.net.uk/stats.asp

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread