diff --git a/src/OutputParams.cpp b/src/OutputParams.cpp index 2fe1b6c056..e8caf4b812 100644 --- a/src/OutputParams.cpp +++ b/src/OutputParams.cpp @@ -23,7 +23,7 @@ OutputParams::OutputParams(Encoding const * enc) local_font(0), encoding(enc), free_spacing(false), use_babel(false), use_japanese(false), linelen(0), depth(0), exportdata(new ExportData), - inComment(false), + inComment(false), inTableCell(false), inDeletedInset(0), changeOfDeletedInset(Change::UNCHANGED), par_begin(0), par_end(0), dryrun(false), verbatim(false) diff --git a/src/OutputParams.h b/src/OutputParams.h index ae2e13d962..f873134c9d 100644 --- a/src/OutputParams.h +++ b/src/OutputParams.h @@ -125,6 +125,9 @@ public: */ bool inComment; + /// Whether we are in a table cell + bool inTableCell; + /** Whether we are inside an inset that is logically deleted. * A value > 0 indicates a deleted inset. */ diff --git a/src/insets/InsetNewline.cpp b/src/insets/InsetNewline.cpp index 62be1d3ca8..52558f94ac 100644 --- a/src/insets/InsetNewline.cpp +++ b/src/insets/InsetNewline.cpp @@ -140,11 +140,14 @@ ColorCode InsetNewline::ColorName() const } -int InsetNewline::latex(odocstream & os, OutputParams const &) const +int InsetNewline::latex(odocstream & os, OutputParams const & op) const { switch (params_.kind) { case InsetNewlineParams::NEWLINE: - os << "\\\\\n"; + if (op.inTableCell) + os << "\\newline\n"; + else + os << "\\\\\n"; break; case InsetNewlineParams::LINEBREAK: os << "\\linebreak{}\n"; diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index ac51e1c023..d74052b4db 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -2724,6 +2724,13 @@ bool InsetTableCell::allowParagraphCustomization(idx_type) const return isFixedWidth; } +int InsetTableCell::latex(odocstream & od, OutputParams const & rp) const +{ + OutputParams newrp = rp; + newrp.inTableCell = true; + return InsetText::latex(od, newrp); +} + bool InsetTableCell::getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus & status) const { diff --git a/src/insets/InsetTabular.h b/src/insets/InsetTabular.h index 66862d68f1..77fa122a06 100644 --- a/src/insets/InsetTabular.h +++ b/src/insets/InsetTabular.h @@ -637,6 +637,8 @@ public: /// InsetCode lyxCode() const { return CELL_CODE; } /// + int latex(odocstream &, OutputParams const &) const; + /// Inset * clone() { return new InsetTableCell(*this); } /// bool getStatus(Cursor & cur, FuncRequest const & cmd,