From: Uwe Stöhr Date: Fri, 26 Sep 2008 21:24:59 +0000 (+0000) Subject: InsetTabular: make Slovak and Czech documents compilable, fixes http://bugzilla.lyx... X-Git-Tag: 1.6.10~3305 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=a7722811f76813fde2b44c3f7f380638ba412221;p=features.git InsetTabular: make Slovak and Czech documents compilable, fixes http://bugzilla.lyx.org/show_bug.cgi?id=5290, thanks to Heiko Obderdiek for the hint how to fix this git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26581 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 08c478ca08..b87aa84cf5 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -1810,7 +1810,7 @@ bool Tabular::isPartOfMultiColumn(row_type row, col_type column) const } -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 @@ int Tabular::TeXTopHLine(odocstream & os, row_type row) const } 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::TeXTopHLine(odocstream & os, row_type row) const } -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 @@ int Tabular::TeXBottomHLine(odocstream & os, row_type row) const } 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 @@ int Tabular::TeXRow(odocstream & os, row_type i, OutputParams const & runparams) const { idx_type cell = cellIndex(i, 0); - int ret = TeXTopHLine(os, i); + shared_ptr 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 @@ int Tabular::TeXRow(odocstream & os, row_type i, } 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"; diff --git a/src/insets/InsetTabular.h b/src/insets/InsetTabular.h index 85abb9b0d8..6134262e5e 100644 --- a/src/insets/InsetTabular.h +++ b/src/insets/InsetTabular.h @@ -588,9 +588,9 @@ public: /// // 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; ///