]> git.lyx.org Git - features.git/commitdiff
InsetTabular: make Slovak and Czech documents compilable, fixes http://bugzilla.lyx...
authorUwe Stöhr <uwestoehr@web.de>
Fri, 26 Sep 2008 21:24:59 +0000 (21:24 +0000)
committerUwe Stöhr <uwestoehr@web.de>
Fri, 26 Sep 2008 21:24:59 +0000 (21:24 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26581 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/InsetTabular.cpp
src/insets/InsetTabular.h

index 08c478ca08392e0e840d8068035517c2bed5fd44..b87aa84cf513a4b0918e1a540084aadae2e851fb 100644 (file)
@@ -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<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 @@ 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";
index 85abb9b0d85140dc4c4fbb0958f574de6062bcde..6134262e5e7d9b5f01036f35f5ee5c612d6ae074 100644 (file)
@@ -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;
        ///