# [luatex] Kerning: when does it not work?

Paul Isambert zappathustra at free.fr
Fri May 6 11:50:57 CEST 2011

Le 06/05/2011 08:45, Heilmann, Till A. a écrit :
> On 05/05/2011 10:38 AM, Ulrike Fischer wrote:
>
>> I think you will get away with most problems with
>> \def\url{%
>>     \begingroup
>>     \catcode\%=12
>>     \URL
>>     }
>> \def\URL#1{%
>>     \setbox\urlbox=\hbox{%
>>     \directlua{%
>>     tex.sprint(-2,"\luatexluaescapestring{\unexpanded{#1}}")}}%
>> .....
>> You will still not be able to use a % in a footnote-url!
>
> With Ulrike's modifications, Paul's code works just fine for me (see
> below). No URLs in footnotes containing a % character so far in my
> document... Pheww!

If this should happen, you could replace the % by \% and then
postprocess the url (once typeset, before adding the penalties) to
remove the backslash. Not an ideal solution, given that you have to
modify the original urls (not to mention what happens with a real
sequences backslash + percent), but it would work.

tedious, so here's a redefinition of it so you can say

\def\endofbreakpoints{\endofbreakpoints}
}
\def\gobble#1{}%
\ifx#2\endofbreakpoints
\expandafter\gobble
\else
\directlua{url.breakpoints[\the\numexpr#2] = "#1"}%
\fi
{#1}%
}

So now the list of calls to \urladdbreakpoint at the end of your file
can be replaced with (spaces are optional):

\urladdbreakpoint{ . @ \\ / ; > ] ) , ' }{after}
\urladdbreakpoint{ ! _ ? + = }{both}

Best,
Paul