emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: tsd@tsdye.com (Thomas S. Dye)
To: Org-mode <emacs-orgmode@gnu.org>
Subject: [PATCH] Add \endifrsthead to longtable export
Date: Sat, 26 Oct 2013 14:07:01 -1000	[thread overview]
Message-ID: <m1y55fd1ay.fsf@tsdye.com> (raw)

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

             reply	other threads:[~2013-10-27  0:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-27  0:07 Thomas S. Dye [this message]
2013-10-27  8:01 ` [PATCH] Add \endifrsthead to longtable export Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1y55fd1ay.fsf@tsdye.com \
    --to=tsd@tsdye.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).