From 9386b0c5848696f79ba5aa088ab778edb7b064d9 Mon Sep 17 00:00:00 2001 From: Aaron Ecay Date: Sun, 28 Sep 2014 00:03:50 -0400 Subject: [PATCH] [ox-latex] add \phantomsection where appropriate. * lisp/ox-latex.el (org-latex--wrap-label): Add \phantomsection. Without this, links will jump to the nearest sectioning command instead of to the exact spot of definition. --- lisp/ox-latex.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 08f7f1c7c..5dd79d3b4 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -1085,7 +1085,8 @@ This function shouldn't be used for floats. See `org-latex--caption/label-string'." (let ((label (org-element-property :name element))) (if (not (and (org-string-nw-p output) (org-string-nw-p label))) output - (concat (format "\\label{%s}\n" (org-export-solidify-link-text label)) + (concat (format "\\phantomsection\n\\label{%s}\n" + (org-export-solidify-link-text label)) output)))) (defun org-latex--text-markup (text markup info) -- 2.11.4.GIT