+ if (rotate != 0) {
+ if (is_long_tabular)
+ os << "\\begin{landscape}\n";
+ else
+ os << "\\begin{turn}{" << convert<string>(rotate) << "}\n";
+ }
+
+ // The bidi package (loaded by polyglossia with XeTeX) swaps the column
+ // order for RTL (#9686). Thus we use this list.
+ bool const bidi_rtl =
+ runparams.local_font->isRightToLeft()
+ && runparams.useBidiPackage();
+ list<col_type> columns;
+ list<col_type> logical_columns;
+ for (col_type cl = 0; cl < ncols(); ++cl) {
+ if (!buffer().params().output_changes && column_info[cl].change.deleted())
+ continue;
+ if (bidi_rtl)
+ columns.push_front(cl);
+ else
+ columns.push_back(cl);
+ // for some calculations, we need the logical (non-swapped)
+ // columns also in bidi.
+ logical_columns.push_back(cl);
+ }
+
+ // If we use \cline or \cmidrule, we need to locally de-activate
+ // the - character when using languages that activate it (e.g., Czech, Slovak).
+ bool deactivate_chars = false;
+ if ((runparams.use_babel || runparams.use_polyglossia)
+ && contains(runparams.active_chars, '-')) {
+ bool have_clines = false;
+ // Check if we use \cline or \cmidrule
+ for (row_type row = 0; row < nrows(); ++row) {
+ col_type bset = 0, tset = 0;
+ for (auto const & c : columns) {
+ idx_type const idx = cellIndex(row, c);
+ if (bottomLineTrim(idx).first || bottomLineTrim(idx).second
+ || topLineTrim(idx).first || topLineTrim(idx).second) {
+ have_clines = true;
+ break;
+ }
+ if (bottomLine(cellIndex(row, c)))
+ ++bset;
+ if (topLine(cellIndex(row, c)))
+ ++tset;
+ }
+ if ((bset > 0 && bset < ncols()) || (tset > 0 && tset < ncols())) {
+ have_clines = true;
+ break;
+ }
+ }
+ if (have_clines) {
+ deactivate_chars = true;
+ os << "\\begingroup\n"
+ << "\\catcode`\\-=12\n";
+ }
+ }