This is basically an expanded version of part of Control command arguments . The original questioner there wants to redefine \href
so that all the links end up in foonotes (rather than in the main document) so my suggestion was the old \let\oldcmd=\cmd \def\cmd{reimplement \cmd in some fancy way}
trick. Turned out that that didn't solve the problem. But what broke this solution isn't really about the solution, it's about those @&*@%y$#@ characters in URLs and ... *sigh* ... footnotes.
Not being an expert on hyperref
, I appeal to the community to help. (And half an hour gazing at the documentation and source of hyperref
has not brought enlightenment either.) I've tried the solutions at Getting percent sign into an URL in a footnote and Is there a reliable footnote command? to no avail (though perhaps I'm doing them wrong ... sorry, incorrectly). Also, note that How display the href link in the footnote? is the wrong way around for this: the questioner wants the clickable link in the footnote.
Here's the URL that the questioner presented me with, embedded in a MWE:
\documentclass{article}
\usepackage{hyperref}
\begin{document}
Hello\footnote{\href{http://www.google.com/#sclient=psy&hl=en&site=&source=hp&q=numbers&aq=f&aqi=&aql=&oq=&pbx=1&fp=d5033c56880e0199}{b}} world.
\end{document}
This produces the error:
! Illegal parameter number in definition of \Hy@tempa.
<to be read again>
s
l.9 ...qi=&aql=&oq=&pbx=1&fp=d5033c56880e0199}{b}}
world.
which makes me think that it is the #
that is causing the problem.
\#
instead of#
. I’m not sure the benefits from your solution justify going the extra mile here: even in HTML (which was, after all, developed in close connection with the URL syntax), when you want to use such URLs you have to manually escape parts of them.