From 50829ce7891bd9cd5c654da346ae1981fe6339f7 Mon Sep 17 00:00:00 2001 From: Jacob Gerlach Date: Wed, 11 Mar 2015 09:15:46 -0400 Subject: [PATCH] ox-latex.el: Customize link export behavior * lisp/ox-latex.el (org-latex-prefer-section-references): Add new defcustom. (org-latex-link): Use customization when resolving links to headlines. TINYCHANGE --- lisp/ox-latex.el | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 6cec8a1..e1b2647 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -510,6 +510,17 @@ and resolve links into section references." :version "25.1" :package-version '(Org . "8.3")) +(defcustom org-latex-prefer-section-references nil + "Toggle use of link descriptions for generating section labels. + +When this variable is non-nil, Org will resolve links into +section references even when the link has a description." + + :group 'org-export-latex + :version "25.1" + :package-version '(Org . "8.3") + :type 'boolean) + ;;;; Footnotes (defcustom org-latex-footnote-separator "\\textsuperscript{,}\\," @@ -2075,14 +2086,15 @@ INFO is a plist holding contextual information. See ;; LINK points to a headline. If headlines are numbered ;; and the link has no description, display headline's ;; number. Otherwise, display description or headline's - ;; title. + ;; title depending on the value of + ;; org-latex-prefer-section-references (headline (let* ((custom-label (and (plist-get info :latex-custom-id-labels) (org-element-property :CUSTOM_ID destination))) (label (or custom-label (org-export-get-headline-id destination info)))) - (if (and (not desc) + (if (and (or (not desc) org-latex-prefer-section-references) (org-export-numbered-headline-p destination info)) (format "\\ref{%s}" label) (format "\\hyperref[%s]{%s}" label -- 1.9.1