|
@@ -381,6 +381,9 @@ will be exported to LaTeX as:
|
|
This is section \\ref{sec:foo}.
|
|
This is section \\ref{sec:foo}.
|
|
And this is still section \\ref{sec:foo}.
|
|
And this is still section \\ref{sec:foo}.
|
|
|
|
|
|
|
|
+A non-default value of `org-latex-reference-command' will change the
|
|
|
|
+command (\\ref by default) used to create label references.
|
|
|
|
+
|
|
Note, however, that setting this variable introduces a limitation
|
|
Note, however, that setting this variable introduces a limitation
|
|
on the possible values for CUSTOM_ID and NAME. When this
|
|
on the possible values for CUSTOM_ID and NAME. When this
|
|
variable is non-nil, Org passes their value to \\label unchanged.
|
|
variable is non-nil, Org passes their value to \\label unchanged.
|
|
@@ -400,6 +403,18 @@ references."
|
|
:version "26.1"
|
|
:version "26.1"
|
|
:package-version '(Org . "8.3"))
|
|
:package-version '(Org . "8.3"))
|
|
|
|
|
|
|
|
+(defcustom org-latex-reference-command "\\ref{%s}"
|
|
|
|
+ "Format string that takes a reference to produce a LaTeX reference command.
|
|
|
|
+
|
|
|
|
+The reference is a label such as sec:intro. A format string of \"\\ref{%s}\"
|
|
|
|
+produces numbered references and will always work. It may be desirable to make
|
|
|
|
+use of a package such as hyperref or cleveref and then change the format string
|
|
|
|
+to \"\\autoref{%s}\" or \"\\cref{%s}\" for example."
|
|
|
|
+ :group 'org-export-latex
|
|
|
|
+ :type 'string
|
|
|
|
+ :version "28.1"
|
|
|
|
+ :package-version '(Org . "9.5"))
|
|
|
|
+
|
|
;;;; Preamble
|
|
;;;; Preamble
|
|
|
|
|
|
(defcustom org-latex-default-class "article"
|
|
(defcustom org-latex-default-class "article"
|
|
@@ -2606,7 +2621,7 @@ INFO is a plist holding contextual information. See
|
|
(let ((label (org-latex--label destination info t)))
|
|
(let ((label (org-latex--label destination info t)))
|
|
(if (and (not desc)
|
|
(if (and (not desc)
|
|
(org-export-numbered-headline-p destination info))
|
|
(org-export-numbered-headline-p destination info))
|
|
- (format "\\ref{%s}" label)
|
|
|
|
|
|
+ (format org-latex-reference-command label)
|
|
(format "\\hyperref[%s]{%s}" label
|
|
(format "\\hyperref[%s]{%s}" label
|
|
(or desc
|
|
(or desc
|
|
(org-export-data
|
|
(org-export-data
|
|
@@ -2614,7 +2629,7 @@ INFO is a plist holding contextual information. See
|
|
;; Fuzzy link points to a target. Do as above.
|
|
;; Fuzzy link points to a target. Do as above.
|
|
(otherwise
|
|
(otherwise
|
|
(let ((ref (org-latex--label destination info t)))
|
|
(let ((ref (org-latex--label destination info t)))
|
|
- (if (not desc) (format "\\ref{%s}" ref)
|
|
|
|
|
|
+ (if (not desc) (format org-latex-reference-command ref)
|
|
(format "\\hyperref[%s]{%s}" ref desc)))))))
|
|
(format "\\hyperref[%s]{%s}" ref desc)))))))
|
|
;; Coderef: replace link with the reference name or the
|
|
;; Coderef: replace link with the reference name or the
|
|
;; equivalent line number.
|
|
;; equivalent line number.
|