org.extex.unit.tex.hyphen
Class Hyphenation

java.lang.Object
  extended by org.extex.interpreter.type.AbstractCode
      extended by org.extex.unit.tex.hyphen.AbstractHyphenationCode
          extended by org.extex.unit.tex.hyphen.HyphenationPrimitive
              extended by org.extex.unit.tex.hyphen.Hyphenation
All Implemented Interfaces:
java.io.Serializable, Code

public class Hyphenation
extends HyphenationPrimitive

This class provides an implementation for the primitive \hyphenation.

The Primitive \hyphenation

The primitive \hyphenation can be used to add hyphenation exceptions to the current language. The argument is a list of white-space separated words enclosed in braces. The hyphenation points are indicated by including a hyphen character (-) at the appropriate places.

When paragraph breaking needs to insert additional break points these hyphenation points are translated into discretionaries. The exceptions specified with the primitive \hyphenation have precedence before the hyphenation points found with the help of hyphenation patterns.

One example which make use of this precedence is the hyphenation exception without any hyphen characters. This can be used to suppress any hyphenation in a single word.

Extension

In addition to the behavior of the original TeX definition this implementation can be used to insert words with hyphens as well. To specify the places where a hyphen occurs literally you just have to include two hyphens in the hyphenation list.

Syntax

    ⟨hyphenation⟩
     → \hyphenation {⟨words⟩}
     
    ⟨words⟩
     → 
      |  ⟨word⟩
      |  ⟨word⟩ ⟨spaces⟩ ⟨words⟩  

Examples

   \hyphenation{as-so-ciate as-so-ciates}  
   \hyphenation{Groß--Ger-au}  

Version:
$Revision: 4770 $
Author:
Gerd Neugebauer, Michael Niedermair
See Also:
Serialized Form

Field Summary
protected static long serialVersionUID
          The constant serialVersionUID contains the id for serialization.
 
Constructor Summary
Hyphenation(CodeToken token)
          Creates a new object.
 
Method Summary
protected  UnicodeCharList collectWord(Context context, TokenSource source, Token token)
          Collect all characters that make up a word.
 
Methods inherited from class org.extex.unit.tex.hyphen.HyphenationPrimitive
execute, isWordConstituent
 
Methods inherited from class org.extex.unit.tex.hyphen.AbstractHyphenationCode
getHyphenationTable
 
Methods inherited from class org.extex.interpreter.type.AbstractCode
getLocalizer, getName, getToken, isIf, isOuter, readResolve, toString, toText, toText
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

protected static final long serialVersionUID
The constant serialVersionUID contains the id for serialization.

See Also:
Constant Field Values
Constructor Detail

Hyphenation

public Hyphenation(CodeToken token)
Creates a new object.

Parameters:
token - the initial token for the primitive
Method Detail

collectWord

protected UnicodeCharList collectWord(Context context,
                                      TokenSource source,
                                      Token token)
                               throws CatcodeException,
                                      HelpingException
Collect all characters that make up a word.

Overrides:
collectWord in class HyphenationPrimitive
Parameters:
context - the interpreter context
source - the source for new tokens
token - the first token already read
Returns:
the first character not included into the word
Throws:
CatcodeException - in case of an exception in token creation
HelpingException - in case of an error