Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question already has an answer here:

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.

[1]: http://www.ctan.org

share|improve this question

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

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
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

1 Answer 1

up vote 1 down vote accepted

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}
share|improve this answer
    
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
1  
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
1  
Fixed. I have updated the answer and will now stop fiddling. –  Andy Clifton May 22 '13 at 3:09
1  
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

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