瀏覽代碼

Respect [TABLE-OF-CONTENTS] also for LaTeX export

Reported by Yuva.
Carsten Dominik 16 年之前
父節點
當前提交
22d5daa11a
共有 2 個文件被更改,包括 14 次插入0 次删除
  1. 3 0
      lisp/ChangeLog
  2. 11 0
      lisp/org-latex.el

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2009-06-04  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-latex.el (org-export-as-latex): Relocate the table of
+	contents.
+
 	* org.el (org-ctrl-c-ctrl-c): Update clock lines.
 
 	* org-agenda.el (org-run-agenda-series): Scope global options also

+ 11 - 0
lisp/org-latex.el

@@ -584,6 +584,17 @@ when PUB-DIR is set, use this as the publishing directory."
 
     ;; finalization
     (unless body-only (insert "\n\\end{document}"))
+
+    ;; Relocate the table of contents
+    (goto-char (point-min))
+    (when (re-search-forward "\\[TABLE-OF-CONTENTS\\]" nil t)
+      (goto-char (point-min))
+      (while (re-search-forward "\\\\tableofcontents\\>[ \t]*\n?" nil t)
+	(replace-match ""))
+      (goto-char (point-min))
+      (and (re-search-forward "\\[TABLE-OF-CONTENTS\\]" nil t)
+	   (replace-match "\\tableofcontents" t t)))
+
     (or to-buffer (save-buffer))
     (goto-char (point-min))
     (or (org-export-push-to-kill-ring "LaTeX")