Procházet zdrojové kódy

ox-latex: Add \endfirsthead to longtable export

* lisp/ox-latex.el (org-latex-table-row): 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".
Thomas Dye před 12 roky
rodič
revize
3c4afa706d
1 změnil soubory, kde provedl 14 přidání a 1 odebrání
  1. 14 1
      lisp/ox-latex.el

+ 14 - 1
lisp/ox-latex.el

@@ -2621,13 +2621,26 @@ a communication channel."
 	     ((and (memq 'top borders) (memq 'above borders)) "\\hline\n"))
 	     ((and (memq 'top borders) (memq 'above borders)) "\\hline\n"))
        contents "\\\\\n"
        contents "\\\\\n"
        (cond
        (cond
-	;; Special case for long tables. Define header and footers.
+	;; Special case for long tables.  Define header and footers.
 	((and longtablep (org-export-table-row-ends-header-p table-row info))
 	((and longtablep (org-export-table-row-ends-header-p table-row info))
 	 (format "%s
 	 (format "%s
+\\endfirsthead
+\\multicolumn{%d}{l}{Continued from previous page} \\\\
+%s
+%s \\\\\n
+%s
 \\endhead
 \\endhead
 %s\\multicolumn{%d}{r}{Continued on next page} \\\\
 %s\\multicolumn{%d}{r}{Continued on next page} \\\\
 \\endfoot
 \\endfoot
 \\endlastfoot"
 \\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")
 		 (if booktabsp "\\midrule" "\\hline")
 		 (if booktabsp "\\midrule" "\\hline")
 		 ;; Number of columns.
 		 ;; Number of columns.