This seems to work for me. Thoughts?

rh

Index: insets/InsetTabular.h
===================================================================
--- insets/InsetTabular.h	(revision 26347)
+++ insets/InsetTabular.h	(working copy)
@@ -637,6 +637,8 @@
 	///
 	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,
Index: insets/InsetTabular.cpp
===================================================================
--- insets/InsetTabular.cpp	(revision 26347)
+++ insets/InsetTabular.cpp	(working copy)
@@ -2724,6 +2724,13 @@
 	return isFixedWidth;
 }
 
+int InsetTableCell::latex(odocstream & od, OutputParams const & op) const
+{
+	OutputParams newop = op;
+	newop.inTableCell = true;
+	return InsetText::latex(od, newop);
+}
+
 bool InsetTableCell::getStatus(Cursor & cur, FuncRequest const & cmd,
 	FuncStatus & status) const
 {
Index: insets/InsetNewline.cpp
===================================================================
--- insets/InsetNewline.cpp	(revision 26347)
+++ insets/InsetNewline.cpp	(working copy)
@@ -140,11 +140,14 @@
 }
 
 
-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";
Index: OutputParams.h
===================================================================
--- OutputParams.h	(revision 26347)
+++ OutputParams.h	(working copy)
@@ -125,6 +125,9 @@
 	 */
 	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.
          */
Index: OutputParams.cpp
===================================================================
--- OutputParams.cpp	(revision 26347)
+++ OutputParams.cpp	(working copy)
@@ -23,7 +23,7 @@
 	  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)

Reply via email to