caption for table with header is not repeated on pagebreak in latex output
Hey there,
I noticed, that a long table is broken into pages, but the caption is not repeated if the table has a header. If not the caption is repeated. Two questions:
- Is this intended behavior?
- How do I force repetition of the caption for tables with headers?
min_example.zip attached. The template is the latest default from 7f97b04862ffbe2bb9efaa648eee284f7949d20d.
This markdown creates tables.pdf.
Best, Jonas
I didn't intend this. I assume this is just something longtable does. Maybe there's a longtable option that affects this? If so, we could consider including it. (And we should also consider which behavior is best.)
This will require Haskell code change. We need to repeat the caption text twice, once for first page and once for each later pages. Here is a diff against test case:
--- tables.orig.tex 2018-05-02 13:23:52.772533100 +0200
+++ tables.tex 2018-05-02 13:49:59.043398200 +0200
@@ -73,6 +73,8 @@ header\strut
\end{minipage}\tabularnewline
\midrule
\endfirsthead
+\caption[]{Very long table with caption and header. This one breaks
+without repeating the caption.}\tabularnewline
\toprule
\begin{minipage}[b]{0.21\columnwidth}\raggedright
table\strut
@@ -411,6 +413,10 @@ laborum.\strut
\caption{Very long table with caption but without header. This one
breaks with repeating the caption.}\tabularnewline
\toprule
+\endfirsthead
+\caption[]{Very long table with caption but without header. This one
+breaks with repeating the caption.}\tabularnewline
+\toprule
\endhead
\begin{minipage}[t]{0.21\columnwidth}\raggedright
Lorem\strut
@@ -735,4 +741,7 @@ laborum.\strut
\bottomrule
\end{longtable}
+\newpage
+\listoftables
+
\end{document}
There is also a secondary issue that tables show up multiple times in list of tables if the caption is not repeated like above with the [].
Here is an updated tables.md and rendered PDF created by patched Pandoc, for reference.
We agree, I think, that this should not depend on whether the table has a header. But which behavior do we want? Do we want the caption to repeat when the table is continued, or not? Is there some standard for this?
I assume that different publishers will have different guidelines regarding this. I believe APA does suggest the use of "continued . . ." captions for multi-page tables. For what it's worth, the thesis and dissertation syle guide at my university (The University of Texas at Austin) requires the table caption on each page (hence why I'm interested in seeing where this conversation goes).
@jgm commented on May 8, 2018, 6:39 PM GMT+2:
We agree, I think, that this should not depend on whether the table has a header. But which behavior do we want? Do we want the caption to repeat when the table is continued, or not? Is there some standard for this?
Can't we make the repetition optional then?
If it's optional, what determines it? We don't have attributes on tables.
Are there updates on this issue?
Using the etoolbox package, we can modify the output with the following in header-includes:
- \usepackage{etoolbox}
#
# add bottom rule to every page on long tables:
# --------------------------------------------------------------------------
- \appto{\endhead}{\specialrule{0pt}{0pt}{0pt}\bottomrule\endfoot}
#
# continue table caption on next page:
# --------------------------------------------------------------------------
- \appto{\endfirsthead}{\specialrule{0pt}{0pt}{0pt}\caption[]{(continued)} \\}
note: \bottomrule counts as table row, as do caption and header, therefore we may add \specialrule to keep odd and even rows numbering (important if you use the \rowcolors for "striped" tables).
I also added bottom rule on every page.
Using the markdown submitted by @MrApe - this is the result: newtables.pdf