Patch for the latex export of doi links is attached to this mail.

Cheers,
Derek

On Fri, Apr 3, 2015 at 9:19 PM, Nicolas Goaziou <m...@nicolasgoaziou.fr>
wrote:

> Hello,
>
> Derek Feichtinger <dfe...@gmail.com> writes:
>
> > The current org latex export will export a link doi:10.xyz/abcd without
> > the protocol prefix as 10.xyz/abcd. Correctly, it should retain the
> > prefix.
> >
> > An easy fix is adding "doi" to the list of protocols that retain
> > the link type string in ox-latex.el, below.
> >
> > ################### ox-latex.el ###############
> > (defun org-latex-link (link desc info)
> >   "Transcode a LINK object from Org to LaTeX.
> >
> > DESC is the description part of the link, or the empty string.
> > INFO is a plist holding contextual information.  See
> > `org-export-data'."
> >   (let* ((type (org-element-property :type link))
> >  (raw-path (replace-regexp-in-string
> >     "%" "\\%" (org-element-property :path link) nil t))
> >  ;; Ensure DESC really exists, or set it to nil.
> >  (desc (and (not (string= desc "")) desc))
> >  (imagep (org-export-inline-image-p
> >   link org-latex-inline-image-rules))
> >  (path (cond
> >                 ;; ----- NEXT LINE CONTAINS THE FIX -------
> > ((member type '("http" "https" "ftp" "mailto" "doi"))
> >  (concat type ":" raw-path))
> > ((and (string= type "file") (file-name-absolute-p raw-path))
> >  (concat "file:" raw-path))
> > (t raw-path)))
> >  protocol)
> > #############
>
> Indeed. Thank you.
>
> Would you mind preparing a patch with "git format-patch" for correct
> attribution? See <http://orgmode.org/worg/org-contribute.html> for
> details.
>
> Regards,
>
> --
> Nicolas Goaziou
>
From b1e74964890f1b602d7c144cec8b83518a21ddd7 Mon Sep 17 00:00:00 2001
From: Derek Feichtinger <derek.feichtin...@psi.ch>
Date: Fri, 3 Apr 2015 22:11:15 +0200
Subject: [PATCH] fix for latex export of doi type links

* lisp/ox-latex.el: Add "doi" to the list of link types that retain
the protocol prefix in the exported link.

TINYCHANGE
---
 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 cfd1fdf..57962c1 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -2032,7 +2032,7 @@ INFO is a plist holding contextual information.  See
 	 (imagep (org-export-inline-image-p
 		  link (plist-get info :latex-inline-image-rules)))
 	 (path (cond
-		((member type '("http" "https" "ftp" "mailto"))
+		((member type '("http" "https" "ftp" "mailto" "doi"))
 		 (concat type ":" raw-path))
 		((and (string= type "file") (file-name-absolute-p raw-path))
 		 (concat "file:" raw-path))
-- 
1.9.2

Reply via email to