emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [patch] Add footnote when exporting links in LaTeX
@ 2015-09-16 22:15 Lars Tveito
  2015-09-16 22:36 ` Rasmus
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Tveito @ 2015-09-16 22:15 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 291 bytes --]

Hi!

When exporting to LaTeX, links are exported using \href. These are
completely invisible if the document is printed out. I consider this a
problem.

I think a good solution is to add a footnote with the link, in addition
to the \href. I've added a patch with this (tiny) change.

- Lars

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-footnote-when-adding-a-link-in-ox-latex.patch --]
[-- Type: text/x-patch, Size: 1041 bytes --]

From 61871bbb04c437cfb48c0a0b77575a96d2fe9eaf Mon Sep 17 00:00:00 2001
From: Lars Tveito <larstvei@ifi.uio.no>
Date: Wed, 16 Sep 2015 23:57:49 +0200
Subject: [PATCH] Add footnote when adding a link in ox-latex

Links in LaTeX-documents are also added in verbatim as a footnote, so it
is visible on paper.
---
 lisp/ox-latex.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index ddbbd33..09a7c15 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -2344,7 +2344,7 @@ INFO is a plist holding contextual information.  See
       (format (org-export-get-coderef-format path desc)
 	      (org-export-resolve-coderef path info)))
      ;; External link with a description part.
-     ((and path desc) (format "\\href{%s}{%s}" path desc))
+     ((and path desc) (format "\\href{%s}{%s}\\footnote{%s}" path desc path))
      ;; External link without a description part.
      (path (format "\\url{%s}" path))
      ;; No path, only description.  Try to do something useful.
-- 
2.4.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] Add footnote when exporting links in LaTeX
  2015-09-16 22:15 [patch] Add footnote when exporting links in LaTeX Lars Tveito
@ 2015-09-16 22:36 ` Rasmus
  2015-09-17  9:31   ` Eric S Fraga
  0 siblings, 1 reply; 3+ messages in thread
From: Rasmus @ 2015-09-16 22:36 UTC (permalink / raw)
  To: emacs-orgmode

Hej Lars,

Thanks for your patch.

Lars Tveito <larstvei@ifi.uio.no> writes:

> When exporting to LaTeX, links are exported using \href. These are
> completely invisible if the document is printed out. I consider this a
> problem.

It's easy enough to fix in latex.  Here's a not quite trivial solution
I've used for letters.

    \documentclass{scrartcl}
    \usepackage{url}
    \usepackage{hyperref}
    \usepackage[para,flushmargin]{footmisc}
    \makeatletter
    \Urlmuskip = 0mu plus 1mu
    \renewcommand\@makefntext[1]{%
      \hspace*{-2em}
      \parindent 0em
      \noindent
      \hb@xt@ 2.65em{\hss %  There's the option of putting \hss before
        \bfseries{\@thefnmark}. }%       or after \@thefnmark, aligning the footnote
      #1}%                  marks to the right or to the left, respectively
    \addtokomafont{footnotelabel}{\bfseries}
    \def\myurl#1{\setbox0\vbox{\hsize.5\maxdimen
    \url{#1}\par
    \setbox0\lastbox
    \global\setbox1\hbox{\unhbox0\unskip\unskip\unpenalty}}\unhbox1}
    \let\ohref\href
    \newcommand\fnurl[2]{\ohref{#2}{#1}\footnote{\myurl{#2}}}
    \renewcommand{\href}[2]{\fnurl{#2}{#1}}
    \makeatother
    \begin{document}
    foo \href{http://orgmode.org}{bar}
    \end{document}

> I think a good solution is to add a footnote with the link, in addition
> to the \href. I've added a patch with this (tiny) change.

We shouldn't hardcode this behavior.

Rasmus

-- 
Send from my Emacs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] Add footnote when exporting links in LaTeX
  2015-09-16 22:36 ` Rasmus
@ 2015-09-17  9:31   ` Eric S Fraga
  0 siblings, 0 replies; 3+ messages in thread
From: Eric S Fraga @ 2015-09-17  9:31 UTC (permalink / raw)
  To: emacs-orgmode

On Thursday, 17 Sep 2015 at 00:36, Rasmus wrote:
> Lars Tveito <larstvei@ifi.uio.no> writes:
>> When exporting to LaTeX, links are exported using \href. These are
>> completely invisible if the document is printed out. I consider this a
>> problem.

[...]

>> I think a good solution is to add a footnote with the link, in addition
>> to the \href. I've added a patch with this (tiny) change.
>
> We shouldn't hardcode this behavior.

Indeed we should not!  I use LaTeX (beamer) to create slides which have
links I can click on during lectures.  I would hate having footnotes for
all of these...

However, I can see the validity of Lars's use case so it would be nice
to have an option for this.  My approach is to put the link in a
footnote directly and not in the text if it's a document I intend to
print...

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3.1-234-g8c85c9

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-17  9:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-16 22:15 [patch] Add footnote when exporting links in LaTeX Lars Tveito
2015-09-16 22:36 ` Rasmus
2015-09-17  9:31   ` Eric S Fraga

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).