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