aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorAlbert Krewinkel <[email protected]>2022-09-21 10:40:41 +0200
committerAlbert Krewinkel <[email protected]>2022-09-21 10:51:04 +0200
commit47d09df6a583587c5d8aadd4b3fc7c009957b219 (patch)
tree9af1e893150fff47c4e3cc92554a49f7ea8a469c /src/Text
parent47a7cdecb970f7cd87019e8def8ccd2496d32677 (diff)
LaTeX writer: clarify why `\endfirsthead` is used for tables
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX/Table.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX/Table.hs b/src/Text/Pandoc/Writers/LaTeX/Table.hs
index 4fbebd1be..aca408d5d 100644
--- a/src/Text/Pandoc/Writers/LaTeX/Table.hs
+++ b/src/Text/Pandoc/Writers/LaTeX/Table.hs
@@ -49,9 +49,14 @@ tableToLaTeX inlnsToLaTeX blksToLaTeX tbl = do
let removeNote (Note _) = Span ("", [], []) []
removeNote x = x
let colCount = ColumnCount $ length specs
+ -- The first head is not repeated on the following pages. If we were to just
+ -- use a single head, without a separate first head, then the caption would be
+ -- repeated on all pages that contain a part of the table. We avoid this by
+ -- making the caption part of the first head. The downside is that we must
+ -- duplicate the header rows for this.
firsthead <- if isEmpty capt || isEmptyHead thead
then return empty
- else ($$ text "\\endfirsthead") <$>
+ else (\firstrows -> capt $$ firstrows $$ "\\endfirsthead") <$>
headToLaTeX blksToLaTeX colCount thead
head' <- if isEmptyHead thead
then return "\\toprule()"
@@ -68,7 +73,6 @@ tableToLaTeX inlnsToLaTeX blksToLaTeX tbl = do
$ "\\begin{longtable}[]" <>
braces ("@{}" <> colDescriptors tbl <> "@{}")
-- the @{} removes extra space at beginning and end
- $$ capt
$$ firsthead
$$ head'
$$ "\\endhead"