I use \url which does not require to escape characters in an URL to make
them acceptable for latex (specifically LuaLaTex). However when the same
reference is included in a footnote, characters (especially _ and %
seem to required escaping. Am I missing somehting?
Here a MWE:
\documentclass[]{article}
\usepackage{url}
\begin{document}
Phoenizisch \url{https://de.wikipedia.org/wiki/Unicodeblock_Ph%C3%B6nizisch}
and more text
with the same ref in a footnote%
\footnote{some text with the same url
\url{{https://de.wikipedia.org/wiki/Unicodeblock_Ph%C3%B6nizisch}}
and a closing text.}%
. After the footnote
\end{document}
which does not compile with the error
File ended while scanning use of \@footnotetext.
It does, of course, compile and produce output as expected if the offending
url in the footnote is removed. Note that the same url in the body is
processed correctly. I assume that there is an interaction between \footnote and \url.
What is the best solution or workaround?


\protect\urlotherwise see the manual for the url package, the url command is fragile (afair) – daleif Jun 14 '19 at 18:06\urlchanges the category-code-régime (beneath other things it changes the category codes of_and%) and "hopes" for its argument to be read from the .tex-input-file and tokenized under that changed category-code-régime. But the\url-command is cheated out of this hope in case of\url{...}being part of the argument of a\footnote-command because in this case things already got tokenized under normal/unchanged category-code-régime when the argument of the\footnote-command got read from the .tex-input-file and tokenized. – Ulrich Diez Jun 14 '19 at 19:13