On 2013–10–08 Hans Hagen wrote:
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)
Valid point.
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
You URLs still don't hyphenate. Maybe we're misunderstanding each
other here.
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}
[…]
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)
That looks good. The OP should test it on his document.
However, it has the implication that URLs are always hyphenated, as
far as I can tell. But it is in fact a practical solution which is
certainly what the user wants in almost all of the cases. I never
had a document where URLs protruding into the margin was desired.
Marco
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / 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
___________________________________________________________________________________
--
École Supérieure d'Art et Design, www.esad-gv.fr — 25 rue Lesdiguières, 38 000 •Grenoble ; Tél. +33 (0)4 76 86 61 30, Fax +33 (0)4 76 85 28 18, Mél. grenoble@ esad-gv.fr — Place des Beaux-Arts, CS 40 074, 26 903 •Valence cedex 9 ; Tél. +33 (0)4 75 79 24 00, Fax +33 (0)4 75 79 24 40, Mél. valence@ esad-gv.fr •Inge Linder-Gaillard, responsable des études et de la recherche, Tél. +33 (0)4 76 86 61 34, Mob. +33 (0)6 98 08 43 86, Mél. inge.linder-gaillard@esad-gv.fr