Difference between revisions of "Hyphenation"

From Wiki
Jump to navigation Jump to search
Line 9: Line 9:
 
To allow breaking at hyphens, slashes, etc., write {{cmd|setbreakpoints|[compound]}} at the start of your document.
 
To allow breaking at hyphens, slashes, etc., write {{cmd|setbreakpoints|[compound]}} at the start of your document.
  
=== Specify a manual breakpoint globally ===
+
=== Specify how to break a word ===
 
Write {{cmd|hyphenation|{po-ly-syl-lab-ic}|}} at the start of your document. (This will not be remembered across documents.)
 
Write {{cmd|hyphenation|{po-ly-syl-lab-ic}|}} at the start of your document. (This will not be remembered across documents.)
  
=== Specify a manual breakpoint locally ===
 
 
Use the {{cmd|-}} command. {{code|poly\-syllabic}}.
 
Use the {{cmd|-}} command. {{code|poly\-syllabic}}.
  
 
=== Prevent hyphenation locally ===  
 
=== Prevent hyphenation locally ===  
FIXME.
+
There are two ways to prevent a word from being hyphenated: the traditional {{tex|hbox}} and the more natural command {{cmd|nothyphenated}}.
 +
<texcode>
 +
\hbox{myfragileword}            % old-fashioned
 +
\nothyphenated{myfragileword}  % MkIV, since 2013-04-21
 +
</texcode>
  
 
=== Tune the auto-hyphenation algorithm ===  
 
=== Tune the auto-hyphenation algorithm ===  

Revision as of 11:12, 21 April 2013

For hyphens in compound words, see Compound words.

When a word extends beyond the end of a line, it can be broken in the middle and written on two lines, with a hyphen to indicate the breakoff. This is called hyphenation. ConTeXt has a great many facilities for dealing with hyphenation, both automatically and manually; they are gathered on this page.

Change the hyphenation language

Use \language[de]. NB: this will also alter the marks used for \quotation, etc.

Allow breaking at existing hyphens

To allow breaking at hyphens, slashes, etc., write \setbreakpoints[compound] at the start of your document.

Specify how to break a word

Write \hyphenation{po-ly-syl-lab-ic} at the start of your document. (This will not be remembered across documents.)

Use the \- command. poly\-syllabic.

Prevent hyphenation locally

There are two ways to prevent a word from being hyphenated: the traditional \hbox and the more natural command \nothyphenated.

\hbox{myfragileword}            % old-fashioned
\nothyphenated{myfragileword}   % MkIV, since 2013-04-21

Tune the auto-hyphenation algorithm

Use the \setupalign parameters concerning justification and hyphenation.

Penalize consecutive hyphens

To penalize hyphens on consecutive lines, set \doublehyphendemerits. Its default value is 10000; to double that, write \doublehyphendemerits=20000.

Mark hyphenated lines for review

See the article on reviewing hyphenation.