]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetTabular.cpp
* InsetTabular.cpp: fix bug 6057: longtable captions must always be in a first header.
[lyx.git] / src / insets / InsetTabular.cpp
index 842f9cc1d414eb166985fdd9a93785f149850e5b..aa9ceb85a84cdff06c52a47f5d8d751f7d907272 100644 (file)
@@ -2132,7 +2132,7 @@ int Tabular::TeXLongtableHeaderFooter(odocstream & os,
 
        int ret = 0;
        // caption handling
-       // the caption must be output befrore the headers
+       // the caption must be output before the headers
        if (haveLTCaption()) {
                for (row_type i = 0; i < row_info.size(); ++i) {
                        if (row_info[i].caption) {
@@ -2307,7 +2307,13 @@ int Tabular::TeXRow(odocstream & os, row_type i,
                }
                ++cell;
        }
-       os << "\\tabularnewline";
+       if (row_info[i].caption && !endfirsthead.empty && !haveLTFirstHead())
+               // if no first header and no empty first header is used,
+               // the caption needs to be terminated by \endfirsthead
+               // (bug 6056)
+               os << "\\endfirsthead";
+       else
+               os << "\\tabularnewline";
        if (row_info[i].bottom_space_default) {
                if (use_booktabs)
                        os << "\\addlinespace";