Browse Source

[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.
Aaron Ecay 10 năm trước cách đây
mục cha
commit
9386b0c584
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  1. 2 1
      lisp/ox-latex.el

+ 2 - 1
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)