git.iko.soy/typeable/pandoc
on master help sign in
LaTeX writer: Use \endhead after \toprule in headerless tables.

Closes #4207.

commit90296d7e96de6c8a36192c6eb12b4cc42b673d1e authorJohn MacFarlane <jgm@berkeley.edu> dateThu 28 Dec 2017, 08:53 (9 years ago) parent3c93ac5
2 files changed+5−4
src/Text/Pandoc/Writers/LaTeX.hs+3−4 test/tables.latex+2
src/Text/Pandoc/Writers/LaTeX.hs+3−4
@@ -699,10 +699,9 @@ blockToLaTeX (Table caption aligns widths heads rows) = do
699699 then return empty
700700 else ($$ text "\\endfirsthead") <$> toHeaders heads
701701 head' <- if all null heads
702− then return empty
702+ then return "\\toprule"
703703 -- avoid duplicate notes in head and firsthead:
704− else ($$ text "\\endhead") <$>
705− toHeaders (if isEmpty firsthead
704+ else toHeaders (if isEmpty firsthead
706705 then heads
707706 else walk removeNote heads)
708707 let capt = if isEmpty captionText
@@ -717,8 +716,8 @@ blockToLaTeX (Table caption aligns widths heads rows) = do
717716 -- the @{} removes extra space at beginning and end
718717 $$ capt
719718 $$ firsthead
720− $$ (if all null heads then "\\toprule" else empty)
721719 $$ head'
720+ $$ "\\endhead"
722721 $$ vcat rows'
723722 $$ "\\bottomrule"
724723 $$ "\\end{longtable}"
test/tables.latex+2
@@ -136,6 +136,7 @@ Table without column headers:
136136
137137\begin{longtable}[]{@{}rlcr@{}}
138138\toprule
139+\endhead
13914012 & 12 & 12 & 12\tabularnewline
140141123 & 123 & 123 & 123\tabularnewline
1411421 & 1 & 1 & 1\tabularnewline
@@ -146,6 +147,7 @@ Multiline table without column headers:
146147
147148\begin{longtable}[]{@{}clrl@{}}
148149\toprule
150+\endhead
149151\begin{minipage}[t]{0.13\columnwidth}\centering
150152First\strut
151153\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright