The following patch fixes
http://bugzilla.lyx.org/show_bug.cgi?id=5290

I'll put this in later today when nobody shouts.

regards Uwe
Index: InsetTabular.cpp
===================================================================
--- InsetTabular.cpp	(revision 26578)
+++ InsetTabular.cpp	(working copy)
@@ -1810,7 +1810,7 @@
 }
 
 
-int Tabular::TeXTopHLine(odocstream & os, row_type row) const
+int Tabular::TeXTopHLine(odocstream & os, row_type row, string const lang) const
 {
 	// we only output complete row lines and the 1st row here, the rest
 	// is done in Tabular::TeXBottomHLine(...)
@@ -1839,7 +1839,14 @@
 	} else if (row == 0) {
 		for (col_type c = 0; c < ncols; ++c) {
 			if (topline[c]) {
-				os << (use_booktabs ? "\\cmidrule{" : "\\cline{") << c + 1 << '-';
+				//babel makes the "-" character an active one, so we have to suppress this here
+				//see http://groups.google.com/group/comp.text.tex/browse_thread/thread/af769424a4a0f289#
+				if (lang == "slovak" || lang == "czech")
+					os << (use_booktabs ? "\\expandafter\\cmidrule\\expandafter{\\expandafter" :
+					                      "\\expandafter\\cline\\expandafter{\\expandafter")
+										  << c + 1 << "\\string-";
+				else
+					os << (use_booktabs ? "\\cmidrule{" : "\\cline{") << c + 1 << '-';
 				// get to last column of line span
 				while (c < ncols && topline[c])
 					++c;
@@ -1852,7 +1859,7 @@
 }
 
 
-int Tabular::TeXBottomHLine(odocstream & os, row_type row) const
+int Tabular::TeXBottomHLine(odocstream & os, row_type row, string const lang) const
 {
 	// we output bottomlines of row r and the toplines of row r+1
 	// if the latter do not span the whole tabular
@@ -1889,8 +1896,14 @@
 	} else {
 		for (col_type c = 0; c < ncols; ++c) {
 			if (bottomline[c]) {
-				os << (use_booktabs ? "\\cmidrule{" : "\\cline{")
-				   << c + 1 << '-';
+				//babel makes the "-" character an active one, so we have to suppress this here
+				//see http://groups.google.com/group/comp.text.tex/browse_thread/thread/af769424a4a0f289#
+				if (lang == "slovak" || lang == "czech")
+					os << (use_booktabs ? "\\expandafter\\cmidrule\\expandafter{\\expandafter" :
+					                      "\\expandafter\\cline\\expandafter{\\expandafter")
+										  << c + 1 << "\\string-";
+				else
+					os << (use_booktabs ? "\\cmidrule{" : "\\cline{") << c + 1 << '-';
 				// get to last column of line span
 				while (c < ncols && bottomline[c])
 					++c;
@@ -2153,7 +2166,13 @@
 		       OutputParams const & runparams) const
 {
 	idx_type cell = cellIndex(i, 0);
-	int ret = TeXTopHLine(os, i);
+	shared_ptr<InsetTableCell> inset = cellInset(cell);
+	Paragraph const & par = inset->paragraphs().front();
+	string const lang =	par.getParLanguage(buffer().params())->lang();
+
+	//output the top line
+	int ret = TeXTopHLine(os, i, lang);
+
 	if (row_info[i].top_space_default) {
 		if (use_booktabs)
 			os << "\\addlinespace\n";
@@ -2228,7 +2247,10 @@
 	}
 	os << '\n';
 	++ret;
-	ret += TeXBottomHLine(os, i);
+
+	//output the bottom line
+	ret += TeXBottomHLine(os, i, lang);
+
 	if (row_info[i].interline_space_default) {
 		if (use_booktabs)
 			os << "\\addlinespace\n";
Index: InsetTabular.h
===================================================================
--- InsetTabular.h	(revision 26578)
+++ InsetTabular.h	(working copy)
@@ -588,9 +588,9 @@
 	///
 	// helper function for Latex returns number of newlines
 	///
-	int TeXTopHLine(odocstream &, row_type row) const;
+	int TeXTopHLine(odocstream &, row_type row, std::string const lang) const;
 	///
-	int TeXBottomHLine(odocstream &, row_type row) const;
+	int TeXBottomHLine(odocstream &, row_type row, std::string const lang) const;
 	///
 	int TeXCellPreamble(odocstream &, idx_type cell, bool & ismulticol) const;
 	///

Reply via email to