On Orgmode Links and LaTeX Footnotes
When you're using hyperlinks in Orgmode and export them to LaTeX/PDF, there aren't any visual clues that
those links actually exists. Unless you set colorlinks=true
in your hypersetup
. But even if you set
colorlinks=true
there is still a problem. When you print the PDF and keep it in black and white. Filters
come to the rescue.
(defvar org-export-latex-add-link-footnotes nil "If non-nil links will be added as footnotes if exported to latex.") (defun org-export-latex-link-footnote (text backend info) "Create a footnote in latex for each link. So when printed the information isn't lost." (when (and org-export-latex-add-link-footnotes (org-export-derived-backend-p backend 'latex) (string-match "\\\\href{\\(.*\\)}{\\(.*\\)}" text)) (when (some (lambda (type) (string-prefix-p type (match-string 1 text))) '("http" "https" "ftp" "mailto" "doi")) (format "%s \\footnote{\\url{%s}} " text (match-string 1 text))))) (add-to-list 'org-export-filter-link-functions #'org-export-latex-link-footnote)
What org-export-latex-link-footnote
does, is that it extracts the URL of a LaTeX \href
and appends it as a
\footnote
. So the URL isn't lost after the PDF has been printed. The footnote export process is only active if
org-export-latex-add-link-footnotes
is non-nil. I set this on a per document basis with #+BIND
.