Aloha all,

Previously, export of LaTeX longtables that spanned a page break
generated a caption on each page, resulting in multiple entries in the
table of contents.

The attached patch for ox-latex.el implements the \endfirsthead command
so the caption only appears once, at the top of the table. Subsequent
pages of the table start with "Continued from previous page".

All the best,
Tom

>From 1e205d7e2a5913580934ddee5285cc8ab0ff6f35 Mon Sep 17 00:00:00 2001
From: Thomas Dye <[email protected]>
Date: Sat, 26 Oct 2013 13:52:05 -1000
Subject: [PATCH] Add \endfirsthead to longtable export

---
 lisp/ox-latex.el | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index aa1a36c..6426d55 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -2624,11 +2624,24 @@ a communication channel."
 	;; Special case for long tables. Define header and footers.
 	((and longtablep (org-export-table-row-ends-header-p table-row info))
 	 (format "%s
+\\endfirsthead
+\\multicolumn{%d}{l}{Continued from previous page} \\\\
+%s
+%s \\\\\n
+%s
 \\endhead
 %s\\multicolumn{%d}{r}{Continued on next page} \\\\
 \\endfoot
 \\endlastfoot"
 		 (if booktabsp "\\midrule" "\\hline")
+		 (cdr (org-export-table-dimensions
+		       (org-export-get-parent-table table-row) info))
+		 (cond ((and booktabsp (memq 'top borders)) "\\toprule\n")
+		       ((and (memq 'top borders)
+			     (memq 'above borders)) "\\hline\n")
+		       (t ""))
+		 contents
+		 (if booktabsp "\\midrule" "\\hline")
 		 (if booktabsp "\\midrule" "\\hline")
 		 ;; Number of columns.
 		 (cdr (org-export-table-dimensions
-- 
1.8.3.3

-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com

Reply via email to