Created
January 20, 2016 15:00
-
-
Save BrechtDeMan/cb16ad6208a5e565951c to your computer and use it in GitHub Desktop.
Clickable hyperlink in footnote
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\usepackage{hyperref} | |
% Make clickable footnote | |
\newcommand{\hyperfootnote}[1][]{\def\ArgI{{#1}}\hyperfootnoteRelay} | |
% relay to new command to make extra optional command possible | |
\newcommand\hyperfootnoteRelay[2][]{\href{#1#2}{\ArgI}\footnote{\href{#1#2}{#2}}} | |
% the first optional argument is now in \ArgI, the second is in #1 | |
% Takes at most 3 parameters (see http://www.tex.ac.uk/FAQ-twooptarg.html for info on multiple optional parameters) | |
% If first parameter isn't given, it's value is '' (empty string in text before footnote reference) | |
% If second parameter isn't given, it's value is '' (string before visible URL, e.g. 'http://') | |
% Makes a clickable footnote (alternatively: \url{}) with optional reference in the text as well | |
% Use 1: \hyperfootnote{www.mywebsite.com}: creates a footnote consisting of a clickable URL | |
% Use 2: \hyperfootnote[My website]{www.mywebsite.com}: creates a clickable piece of text in the text ('My website') | |
% plus a footnote consisting of a clickable URL | |
% | |
% Note: requires the hyperref package. | |
% Note: using xspace package to add/absorb spaces when necessary (e.g. to avoid a space between the footnote number | |
% and a punctuation mark) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment