emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Add \endifrsthead to longtable export
@ 2013-10-27  0:07 Thomas S. Dye
  2013-10-27  8:01 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas S. Dye @ 2013-10-27  0:07 UTC (permalink / raw)
  To: Org-mode

[-- Attachment #1: Type: text/plain, Size: 392 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch for ox-latex.el --]
[-- Type: text/x-patch, Size: 1250 bytes --]

From 1e205d7e2a5913580934ddee5285cc8ab0ff6f35 Mon Sep 17 00:00:00 2001
From: Thomas Dye <tsd@tsdye.com>
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


[-- Attachment #3: Type: text/plain, Size: 146 bytes --]


-- 
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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Add \endifrsthead to longtable export
  2013-10-27  0:07 [PATCH] Add \endifrsthead to longtable export Thomas S. Dye
@ 2013-10-27  8:01 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2013-10-27  8:01 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org-mode

Hello,

tsd@tsdye.com (Thomas S. Dye) writes:

> 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".

Applied. Thank you.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-27  8:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-27  0:07 [PATCH] Add \endifrsthead to longtable export Thomas S. Dye
2013-10-27  8:01 ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).