On 11/21/2008 4:53 PM, Hans Hagen wrote:
Mojca Miklavec wrote:
hack hack hack hack ....
I tried solutions with special patterns sveral times but the problem is in mixed languages, i.e. english text mixed with url-language; there are some limitations (in pdftex for instance the same codes are used fo rthe whole par (i.e. mixed languages are possible but with the same lccodes etc). Also, one needs to get rid of the -
Anyhow, there is another trick, one that Aditya might love ...
\bgroup
\gdef\lettercolon{:}
\catcode`\:=\active \catcode`\^=\active \catcode`\/=\active \catcode`\~=\active
\gdef\ForMojcaWhoLikesHacks#1% {\dontleavehmode \begingroup \mathcode`\:="8000 \mathcode`\^="8000 \mathcode`\/="8000 \mathcode`\~="8000 \def:{\nobreak \hbox{\lettercolon}\allowbreak}% \def^{\allowbreak\hbox{\letterhat }\nobreak}% \def/{\nobreak \hbox{\letterslash}\allowbreak}% \def~{\allowbreak\hbox{\lettertilde}\nobreak}% \everymath\emptytoks \mathsurround\zeropoint$\tttf#1$% \endgroup}
\egroup
\hsize 1mm \ForMojcaWhoLikesHacks{http://www.sil.org/silesr/}
Thanks, this is great. Looks like, as in improvement over \hyphenatedurl, it allows you to specify that you can break before a character, after, or both. I think I can even see how to use it in a document... though, would I have to undo the initial \catcode commands after the \egroup? Also, I don't see a way to prevent breaking between two slashes... unless you treat them as part of a separate hbox: \hbox{http://}\ForMojcaWhoLikesHacks{www.sil.org/silesr/} which is not a big problem. Thanks, Lars