浏览代码

LaTeX export: Fix problem with internal links

Carsten Dominik 16 年之前
父节点
当前提交
ddf013644a
共有 2 个文件被更改,包括 7 次插入1 次删除
  1. 1 0
      lisp/ChangeLog
  2. 6 1
      lisp/org-latex.el

+ 1 - 0
lisp/ChangeLog

@@ -2,6 +2,7 @@
 
 	* org-latex.el (org-export-latex-quotation-marks): Fix export of
 	quotation makrs in parenthesis.
+	(org-remove-initial-hash): New function.
 
 	* org-table.el (org-table-get-remote-range): Find #+TBLNAME also
 	when indented.

+ 6 - 1
lisp/org-latex.el

@@ -1517,10 +1517,15 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
 				     (org-solidify-link-text raw-path) desc)))
 	     ((not type)
 	      (insert (format "\\hyperref[%s]{%s}"
-			      (org-solidify-link-text raw-path) desc)))
+			      (org-remove-initial-hash
+			       (org-solidify-link-text raw-path)) desc)))
 	     (path (insert (format "\\href{%s}{%s}" path desc)))
 	     (t (insert "\\texttt{" desc "}")))))))
 
+(defun org-remove-initial-hash (s)
+  (if (string-match "\\`#" s)
+      (substring s 1)
+    s))
 (defvar org-latex-entities)   ; defined below
 (defvar org-latex-entities-regexp)   ; defined below
 (defvar org-latex-entities-exceptions)   ; defined below