# Insert footnotes with \href [duplicate]

This seems like a very common practice, but an hour of researching the question has gotten me nowhere. Is it not possible to insert the URI for the call to \href (#1) as a footnote?

I've tried defining a new command like so:

\newcommand{\fref}[2]{\href{#1}{#2}\footnote{\url{#1}}}


but the footnotetext is never produced.

A minimal example, if there must be one:

\documentclass{article}
\usepackage{hyperref}

\begin{document}
Hi!  \href{http://www.ctan.org}{CTAN} is a pretty cool place.
\end{document}


Desired output:

Hi! CTAN[1] is a pretty cool place.

-

## marked as duplicate by Sean Allred, Werner, Thorsten, Xavier, T. VerronMay 22 '13 at 5:32

Try Using a normal footnote with '\protect' before the URL? – Andy Clifton May 22 '13 at 2:19
@LostBrit \renewcommand{\href}[2]{\oldhref{#1}{#2}\footnote{\protect\url{#1}}} doesn't work. Thanks for the idea, though.\ – Sean Allred May 22 '13 at 2:35
Your MWE would work perfectly if you replaced \href by \fref :) – Xavier May 22 '13 at 5:13
I swear it hadn't before. I must have inadvertently re-written hyperref. That's the most obvious solution to this conundrum. (My brain a splode this week.) – Sean Allred May 22 '13 at 11:26

This is a different way of asking the same question that is raised in How display the href link in the footnote?.

The solution that is posted there, does almost exactly what you need. For completeness:

\documentclass{article}
\usepackage{hyperref}
\newcommand\fnurl[2]{%
\href{#2}{#1}\footnote{\url{#2}}%
}
\begin{document}
hello \fnurl{CTAN}{http://www.ctan.org}
\end{document}

-
There doesn't appear to be any actual linking going on (save between footnotemark and footnotetext)---I'm not really sure why; the call to \href should (by my understanding) have done the job. This works wonderfully for documents to be distributed by print only, but doesn't incorporate the advantage of on-line viewing. – Sean Allred May 22 '13 at 2:51
well, there is - but only the 1 in the footnote. Give me a minute... – Andy Clifton May 22 '13 at 2:55
:-) Thanks for your time – Sean Allred May 22 '13 at 2:59
Fixed. I have updated the answer and will now stop fiddling. – Andy Clifton May 22 '13 at 3:09
I could have sworn I went through all ... 40134 questions... one by one. Thanks for finding the single one I miss! I'll vote to close this as a duplicate so the original can get more love. (Although, future generations should note that there is no problem in reversing the argument order as I initially (and silently) suspected. \let\oldhref\href\renewcommand{\href}[2]{\oldhref{#1}{#2}\footnote{\url{#1}}} is a drop-in replacement.) – Sean Allred May 22 '13 at 3:14