On 10/8/2013 7:35 PM, Marco Patzer wrote:
On 2013–10–08 Hans Hagen wrote:
\hyphenateurl{} works only when setupalign[] is set to hyphenated.
Is there a way to hyphenate only URLs?
You need to provide a few more options to \setupalign:
Why?
\appendtoks\tttf\to\everyhyphenatedurl % maybe we need a proper setup
Isn't that what \url is for? It has a setup command and uses
\hyphenatedurl.
sure, but it forces one to use \url which is not always an option (if
there are thousands embedded in the text)
\setupalign[nothyphenated,stretch,tolerant]
This does not only change how URLs are typeset, but it also affects
the main text, which might not be desirable.
I got the impression that it concerned a whole document (we sometimes
have that demand, but normally those have no urls anyway)
[…]
I don't see a single hyphenated URL in your result. The OP failing
to provide a minimal example, let me provide my interpretation of
the problem:
This is more visible
\appendtoks\tttf\to\everyhyphenatedurl
\lefthyphenmin=100 \righthyphenmin=100
maybe this is s better definition of nohyphens:
\unexpanded\def\nohyphens
{\ifx\dohyphens\relax
\unexpanded\edef\dohyphens
{\lefthyphenmin\the\lefthyphenmin
\righthyphenmin\the\righthyphenmin
\relax}%
\fi
\lefthyphenmin\maxdimen
\righthyphenmin\maxdimen}
\useurl
[somelink]
[http://bits.blogs.nytimes.com/2010/03/05/a-former-book-designer-says-good-riddance-to-print/?hpw&_r=0]
\setupalign
[nothyphenated]
\starttext
\url [somelink]
\input knuth
\stoptext
I don't know how to start and stop hyphenation within a paragraph.
Allowing hyphenation for the entire paragraph is easy.
needs a bit it tinkering, maybe this is nicer:
\unprotect
\unexpanded\def\nohyphens
{\ifx\dohyphens\relax
\unexpanded\edef\dohyphens
{\hyphenminoffset\the\hyphenminoffset\relax
\lang_basics_synchronize_min_max}%
\fi
\hyphenminoffset\plusthousand
\lang_basics_synchronize_min_max}
\protect
as it syncs nicely with languages too (characters carry left and right
values so inline changes are possible)
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________