0

I want to reference the web-reference to the wiki https://en.wikipedia.org/wiki/Pokémon_Go.

If I paste it into a footnote

\footnote{https://en.wikipedia.org/wiki/Pok%C3%A9mon_Go}

I get File ended while scanning use of \@footnotetext.; if I add \url as adviced in How to use a link as footnote that has special characters inside? or escape the special characters I get:

\documentclass{article}
\usepackage{url}
\begin{document}
    
some text
\footnote{\url{https://en.wikipedia.org/wiki/Pok%C3%A9mon_Go}}
                % the conversion is automatically done when pasting (in texstudio at least)
\footnote{https://en.wikipedia.org/wiki/Pok\%C3\%A9mon\_Go}
\footnote{another footnote}

\end{document}

which results in references which look ok, but do not work (and are not clickable):enter image description here

If I add \usepackage{hyperref} and combining all options I found, neither produces a clickable reference. What would be a working solution?

\documentclass{article}
%\usepackage{url}
\usepackage{hyperref}
\begin{document}
    
some text
%\footnote{\url{https://en.wikipedia.org/wiki/Pok%C3%A9mon_Go}}
                % the conversion is automatically done when pasting (in texstudio at least)
                % scanning fails
\footnote{https://en.wikipedia.org/wiki/Pok\%C3\%A9mon\_Go}
            % prints incorrect and non-clickable ref
\footnote{https://en.wikipedia.org/wiki/Pokémon\_Go}
            % prints correct but not clickable ref 
\footnote{\url{https://en.wikipedia.org/wiki/Pokémon\_Go}}
            % produces weird output
\footnote{another footnote}

\end{document}

The output is:

enter image description here

5
  • 1
    Have a look at the suggestions discussed in tex.stackexchange.com/q/12230/35864, tex.stackexchange.com/q/42413/35864 and tex.stackexchange.com/q/12855/35864
    – moewe
    Nov 28 '20 at 19:15
  • % is the comment character so you have commented out the rest of that line. Nov 28 '20 at 22:15
  • @moewe - what is the explanation for the weird output?
    – user855443
    Nov 29 '20 at 10:25
  • 1
    I don't think I can walk you through all the details, but with pdfLaTeX é isn't actually a simple letter like e. It is a combination of macro calls that typesets 'é'. In the context of the \url macro, this macro combination doesn't manage to typeset an 'é' as expected (because \url does a lot of tricky stuff behind the scenes) and instead generates the output you see. You get the output you probably want to see if you compile your document with LuaLaTeX or XeLaTeX, which support UTF-8 natively and not via macro tricks.
    – moewe
    Nov 29 '20 at 10:33
  • Thanks a lot of the explanation (which is at a perfect level of detail for me - congratulations!). I have switched to LuaLaTeX and it worked. - Do you want to answer the question?
    – user855443
    Nov 29 '20 at 10:37
1

The usage table at the beginning of the url package documentation says:

\url{ }   The argument must not contain unbalanced braces.
      If used in the argument to another command, the \url
      argument cannot contain any “%”, “#”, or “^^”, or end
      with “\”.

\url| |    . . .

\xyz   for the defined-url “\xyz”; such a command can be
      used anywhere, no matter what characters it contains.

Section 2 (page 2) explains how to make a defined-url. In your case the definition would be

\urldef\pokebowl\url{https://en.wikipedia.org/wiki/Pok%C3%A9mon_Go}

to be followed by

\footnote{\pokebowl}

About clickable references, url.sty alone does not make clickable references. If they work when clicked, it is being done by the pdf viewer. You should use package hyperref for clickable links. (I'm ignoring obscure other possibilities.)

Finally, that footnote could be done better with different versions for the link and the text using \href, such as

\footnote{\href{https://en.wikipedia.org/wiki/Pok\%C3\%A9mon_Go}
   {https://en.wikipedia.org/wiki/Pokémon\_Go}}

or

\footnote{\href{https://en.wikipedia.org/wiki/Pok\%C3\%A9mon_Go}
  {Wikipedia: ``Pokémon Go,'' as of 2020/11/29.}}
1
  • Actually, there is no restriction on the “#” character when \url is used inside a command argument. That restriction was removed in 2002, but apparently not removed from the documentation. Nov 30 '20 at 9:37
0

The advice and explanation given by @moewe leads to a simple solution: use XeLaTeX or LuaLaTeX; the problems seem to be artefacts of pdfLaTeX.

I switched to LuaLaTeX and got the desired clickable references in my document.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.