emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Multi-line headers with longtable
@ 2022-05-13 22:29 Brett Presnell
  0 siblings, 0 replies; only message in thread
From: Brett Presnell @ 2022-05-13 22:29 UTC (permalink / raw)
  To: emacs-orgmode

Sorry I sent this twice.  Forgot that I was subscribed from my
member.fsf.org email address.

I have come upon a problem with export of multi-line table headers in
long (multi-page) tables.  I can't imagine that this hasn't come up
before, but I wasn't able to google up any other reports, so ...

As a simple example (using \pagebreak to reduce the number of rows
required to illustrate the problem), exporting the org table

#+attr_latex: :environment longtable
| First        | Second |
| Column       | Column |
| a            |      1 |
| b            |      2 |
| \pagebreak c |      3 |
| d            |      4 |

to LaTeX yields

First & Second\\
Column & Column\\
\multicolumn{2}{l}{Continued from previous page} \\

Column & Column \\

\hline\multicolumn{2}{r}{Continued on next page} \\
a & 1\\
b & 2\\
\pagebreak c & 3\\
d & 4\\

Notice that only the "firsthead" has the multi-line table header; on the
2nd page the columns will both have the one-line header "Column" when
I/we want the full column headers on every page.

This is using org version 9.5.3 and GNU Emacs 29.0.50 (snapshot).

I think that the problem occurs in the handling of the header in
org-latex-table-row.  The 2nd row ends the header, so in the excerpted
code below it is output as =contents=, i.e., it gets inserted for the
4th %s.  Of course this means that the previous lines of the header are

	;; Special case for long tables.  Define header and footers.
	((and longtablep (org-export-table-row-ends-header-p table-row info))
	 (let ((columns (cdr (org-export-table-dimensions
			      (org-export-get-parent-table table-row) info))))
	   (format "%s
\\multicolumn{%d}{l}{%s} \\\\
%s \\\\\n
%s\\multicolumn{%d}{r}{%s} \\\\
		   (if booktabsp "\\midrule" "\\hline")
		   (org-latex--translate "Continued from previous page" info)
		    ((not (org-export-table-row-starts-header-p table-row info))
		    (booktabsp "\\toprule\n")
		    (t "\\hline\n"))
		   (if booktabsp "\\midrule" "\\hline")
		   (if booktabsp "\\midrule" "\\hline")
		   (org-latex--translate "Continued on next page" info))))
	;; When BOOKTABS are activated enforce bottom rule even when
	;; no hline was specifically marked.
	((and booktabsp (not (org-export-get-next-element table-row info)))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-13 22:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-13 22:29 Multi-line headers with longtable Brett Presnell

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


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