# Re: [NTG-context] modifying URL wrapping rules

On 11/21/2008 12:01 PM, Lars Huttar wrote:
>
> So as far as we know, nobody has successfully used
> \sethyphenatedurlbefore/after/etc. to tune the url-breaking mechanism.
> Has anybody else on the list done this?
>
> If not, maybe the mkii implementation has never worked for that
> purpose... it's possible, since urls are breaking after hyphens when
> lang-url.mkii says to break before hyphens.
>
> If this is the case (\sethyphenatedbefore/after in mkii is broken), then
> rather than awaiting a fix for the soon-obsolete mkii implementation,
> maybe I can do a workaround. I need help with the tex details though,
> please, as I am still very much a tex newbie...
>
> We are generating our tex document, so verbosity is not a problem, but
> irregularity would be.
> Rather than inserting \break in various places manually, which would
> have to be redone often, I could automatically insert \discretionary or
> \allowbreak before/after the appropriate characters in the tex document.
> Would that work?
> How would I suppress hyphenation at other points -- \dontleavehmode or
> something like that?


OK... I have a working workaround... close your eyes, because it's ugly.

I just put \hbox{} around the sections that we don't want broken, and
\discretionary{}{}{} in the places we will allow a break:

\hbox{http://}\discretionary{}{}{}\hbox{www}\discretionary{}{}{}\hbox{.sil}\discretionary{}{}{}\hbox{.org/}\discretionary{}{}{}\hbox{silesr/}...

One of our URLs goes from 89 to 391 characters!  :-p

Maybe posting this awful kluge to the list will motivate someone who
knows TeX better to post a more elegant solution. :-)

Ugly as it is, it does allow me to control exactly where I want to allow
a break and where I don't. So I'll go with that for now, in order to

I'm sure someone could write a TeX macro to do the above algorithmically
instead of brute-force specifying every possible break point explicitly.

But that's what \hyphenatedurl is supposed to be, and it doesn't seem to
be working for me.

Regards,
Lars

___________________________________________________________________________________