# ConTeXt: Too much hyphenation

I am trying to control the amount of automatic hyphenation in my document. But all the options I specify don't seem to have any effect. The following MWE shows two paragraphs with six hyphenated words. This happens through out the rest of the document. Any suggestions are welcome.

Also, I would like to disable hyphenation completely in the margin text. `align=flushleft` still gives hyphenated words. In latex, `\hyphenpenalty=10000` completely disables hyphenation.

Is there a similar option in `context`?

MWE

``````\setupbodyfont[modern,11pt]
\setuplayout[width=12cm]
\setuptolerance[horizontal,stretch]
\definefontfeature [default] [default] [expansion=quality]
\setupalign [hz]
\starttext
Various Monte Carlo methods are the most popular tool for propagating
uncertainty during robust design and optimisation. Theoretically, Monte Carlo
methods can generate arbitrarily accurate estimates of mean and variance.
However, the convergence is slow and many engineering scenarios do not justify
the computational expense demanded by the nonlinear Monte Carlo
methods.

The proposed Inexpensive Monte Carlo (IMC) method is a cost efficient
alternative to the nonlinear Monte Carlo method under certain assumptions.
Judicious use of IMC method can greatly speed-up uncertainty propagation for
robust design algorithms. This chapter outlines motivation behind the proposed
IMC method. Probable application areas are identified along with a survey
of various alternative methods available presently.
The basic formulation of IMC method is presented. The
implementation details and the effectiveness of the methods are explored using a
simple algebraic model problem. The limitations of the IMC method are also
demonstrated in a clear fashion using the model problem. Finally, the last
section compares performance of the proposed IMC methods with the more
traditional moment methods for the model problem.
\stoptext
``````
-
`\hyphenpenalty10000` works in ConTeXt as well. The native ConTeXt way to suppress hyphenation is `\setupalign[nothyphenated]`. – Marco Jan 14 '13 at 20:36
@Marco Thanks. I forgot that `\hyphenpenalty1000` comes from `tex`. I checked, this works, though a bit ugly in the main text. How would I use `\setupalign` only for margins? – devendra Jan 14 '13 at 20:46
@Marco I am using `\margintext`. – devendra Jan 14 '13 at 20:47
– Dave Jarvis Sep 26 '13 at 6:19

``````[...]
\setupalign [hz]
\lefthyphenmin=4
\starttext
[...]
``````

-
Thanks. This is definitely an improvement. – devendra Jan 14 '13 at 21:32
The ConTeXt interface for `lefthyphenmin` is `\setuplanguage[en][lefthyphenmin=4]`, see ConTeXt wiki - setuplanguage. – Marco Jan 14 '13 at 22:51
that is only needed if you want language specific setting. It is the same as for LaTeX with setting it whith or without babel – Herbert Jan 15 '13 at 17:29

You can use `\hyphenpenalty1000` in ConTeXt as well. However, the native ConTeXt way to suppress hyphenation is to use

``````\setupalign [nothyphenated]
``````

To suppress hyphenation only for `\margintext` you use the command `\setupmargindata`

``````\setupmargindata
[margintext]
[align=nothyphenated]
``````

To apply several keys to `align` separate them with a comma and surround with braces:

``````\setupmargindata
[margintext]
[align={nothyphenated, flushright}]
``````
-

As Herbert said, you can try to change the value of `lefthyphenmin`. If you are using a multi-lingual document, you can change the value of `lefthyphenmin` for each language.

``````\setuplanguage[en][lefthyphenmin=4]
\setuplanguage[de][lefthyphenmin=3]
``````

ConTeXt also defines two macros: `\lesshypens` and `\morehyphens`, which respectively increase and decrease the value of both `lefthyphenmin` and `righthyphenmin`.

-