+ ms << ETag("mtable");
+}
+
+
+// FIXME XHTML
+// We need to do something about alignment here.
+void InsetMathGrid::htmlize(HtmlStream & os, string attrib) const
+{
+ bool const havetable = nrows() > 1 || ncols() > 1;
+ if (!havetable) {
+ os << cell(index(0, 0));
+ return;
+ }
+ os << MTag("table", attrib);
+ for (row_type row = 0; row < nrows(); ++row) {
+ os << MTag("tr");
+ for (col_type col = 0; col < ncols(); ++col) {
+ idx_type const i = index(row, col);
+ if (cellinfo_[i].multi != CELL_PART_OF_MULTICOLUMN) {
+ col_type const cellcols = ncellcols(i);
+ ostringstream attr;
+ if (cellcols > 1)
+ attr << "colspan='" << cellcols << '\'';
+ os << MTag("td", attr.str());
+ os << cell(index(row, col));
+ os << ETag("td");
+ }
+ }
+ os << ETag("tr");
+ }
+ os << ETag("table");
+}
+
+
+void InsetMathGrid::htmlize(HtmlStream & os) const
+{
+ htmlize(os, "class='mathtable'");
+}
+
+
+void InsetMathGrid::validate(LaTeXFeatures & features) const
+{
+ if (features.runparams().math_flavor == OutputParams::MathAsHTML
+ && (nrows() > 1 || ncols() > 1)) {
+ // CSS taken from InsetMathCases
+ features.addCSSSnippet(
+ "table.mathtable{display: inline-block; text-align: center; border: none;"
+ "border-left: thin solid black; vertical-align: middle; padding-left: 0.5ex;}\n"
+ "table.mathtable td {text-align: left; border: none;}");
+ }
+ InsetMathNest::validate(features);