From a01e6759a6a016fd4c684eaaa56544d8507c897f Mon Sep 17 00:00:00 2001 From: Rasmus Date: Wed, 15 Apr 2015 21:46:57 +0200 Subject: [PATCH 1/2] ox-latex: Wider user-label support * ox-latex.el (org-latex--label): Add user-labels for targets and radio-target. (org-latex--wrap-label, org-latex-link, org-latex-target) (org-latex-radio-target): Use org-latex--label. --- lisp/ox-latex.el | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 61d16b1..b22b0a7 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -1056,9 +1056,10 @@ return a unique label. Eventually, if FULL is non-nil, wrap label within \"\\label{}\"." (let* ((user-label (org-element-property - (if (memq (org-element-type element) '(headline inlinetask)) - :CUSTOM_ID - :name) + (case (org-element-type element) + ((headline inlinetask) :CUSTOM_ID) + ((target radio-target) :value) + (otherwise :name)) element)) (label (and (or user-label force) @@ -1176,7 +1177,7 @@ should not be used for floats. See (if (not (and (org-string-nw-p output) (org-element-property :name element))) output (concat (format "\\phantomsection\n\\label{%s}\n" - (org-export-get-reference element info)) + (org-latex--label element info)) output))) (defun org-latex--text-markup (text markup info) @@ -2088,7 +2089,7 @@ INFO is a plist holding contextual information. See (let ((destination (org-export-resolve-radio-link link info))) (if (not destination) desc (format "\\hyperref[%s]{%s}" - (org-export-get-reference destination info) + (org-latex--label destination info) desc)))) ;; Links pointing to a headline: Find destination and build ;; appropriate referencing command. @@ -2416,7 +2417,7 @@ holding contextual information." "Transcode a RADIO-TARGET object from Org to LaTeX. TEXT is the text of the target. INFO is a plist holding contextual information." - (format "\\label{%s}%s" (org-export-get-reference radio-target info) text)) + (format "\\label{%s}%s" (org-latex--label radio-target info) text)) ;;;; Section @@ -3029,7 +3030,7 @@ a communication channel." "Transcode a TARGET object from Org to LaTeX. CONTENTS is nil. INFO is a plist holding contextual information." - (format "\\label{%s}" (org-export-get-reference target info))) + (format "\\label{%s}" (org-latex--label target info))) ;;;; Timestamp -- 2.3.5