]> git.lyx.org Git - features.git/commitdiff
Longtable: only output the caption contents in a caption row.
authorJuergen Spitzmueller <spitz@lyx.org>
Mon, 20 Nov 2017 09:59:09 +0000 (10:59 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 20 Nov 2017 18:51:32 +0000 (19:51 +0100)
Fixes: #10791
(cherry picked from commit 538b38f78c76a56bec7e6cec0314d8f4e0f1e415)

src/insets/InsetTabular.cpp

index a49c5bf77d94b48e7cf5a0426be53058b4ca722c..94eed7893eb231315f16bf8016733f56a4ff41fa 100644 (file)
@@ -33,6 +33,7 @@
 #include "DispatchResult.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
+#include "InsetIterator.h"
 #include "InsetList.h"
 #include "Language.h"
 #include "LaTeXFeatures.h"
@@ -2652,6 +2653,17 @@ void Tabular::TeXRow(otexstream & os, row_type row,
                                tail.setMacrocontextPositionRecursive(dit);
                                tail.latex(os, newrp);
                        }
+               } else if (ltCaption(row)) {
+                       // Inside longtable caption rows, we must only output the caption inset
+                       // with its content and omit anything outside of that (see #10791)
+                       InsetIterator it = inset_iterator_begin(*const_cast<InsetTableCell *>(inset));
+                       InsetIterator i_end = inset_iterator_end(*const_cast<InsetTableCell *>(inset));
+                       for (; it != i_end; ++it) {
+                               if (it->lyxCode() != CAPTION_CODE)
+                                       continue;
+                               it->latex(os, runparams);
+                               break;
+                       }
                } else if (!isPartOfMultiRow(row, c)) {
                        if (!runparams.nice)
                                os.texrow().start(par.id(), 0);