瀏覽代碼

Make the latex export preprocessor rewrite #+INDEX to \index.

* lisp/org-latex.el (org-export-latex-preprocess): Replace index entries.
Robert P. Goldman 14 年之前
父節點
當前提交
bf7ce56a72
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      lisp/org-latex.el

+ 9 - 0
lisp/org-latex.el

@@ -2322,6 +2322,15 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
     (and (looking-at "[ \t]*ORG-VERSE-END.*")
 	 (org-replace-match-keep-properties "\\end{verse}" t t)))
 
+  ;; Convert #+INDEX to LaTeX \\index.
+  (goto-char (point-min))
+  (let ((case-fold-search t))
+    (while (re-search-forward
+	    "^[ \t]*#\\+index:[ \t]*\\([^ \t\r\n].*?\\)[ \t]*$"
+	    nil t)
+      (let ((entry (match-string 1)))
+	(replace-match (format "\\index{%s}" (match-string 1)) t t))))
+
   ;; Convert center
   (goto-char (point-min))
   (while (search-forward "ORG-CENTER-START" nil t)