-void MathMatrixInset::write(std::ostream & os, bool fragile) const
-{
- header_write(os);
-
- bool n = numberedType();
-
- for (unsigned int row = 0; row < nrows(); ++row) {
- for (unsigned int col = 0; col < ncols(); ++col) {
- cell(index(row, col)).write(os, fragile);
- os << eocString(col);
- }
- if (n) {
- if (!label_[row].empty())
- os << "\\label{" << label_[row] << "}";
- if (nonum_[row])
- os << "\\nonumber ";
- }
- os << eolString(row);
- }
-
- footer_write(os);
-}
-
-
-string MathMatrixInset::label(unsigned int row) const
-{
- return label_[row];
-}
-
-
-void MathMatrixInset::label(unsigned int row, string const & label)
-{
- label_[row] = label;
-}
-
-
-void MathMatrixInset::numbered(unsigned int row, bool num)
-{
- nonum_[row] = !num;
-}
-
-
-bool MathMatrixInset::numbered(unsigned int row) const
-{
- return !nonum_[row];
-}
-
-
-bool MathMatrixInset::ams() const
-{
- return true;
-}
-
-
-bool MathMatrixInset::display() const
-{
- return getType() != LM_OT_SIMPLE;
-}
-
-
-std::vector<string> const MathMatrixInset::getLabelList() const
-{
- std::vector<string> res;
- for (unsigned int row = 0; row < nrows(); ++row)
- if (!label_[row].empty() && nonum_[row] != 1)
- res.push_back(label_[row]);
- return res;
-}
-
-
-bool MathMatrixInset::numberedType() const
-{
- if (getType() == LM_OT_SIMPLE || getType() == LM_OT_XXALIGNAT)
- return false;
- for (unsigned int row = 0; row < nrows(); ++row)
- if (!nonum_[row])
- return true;
- return false;
-}
-
-
-void MathMatrixInset::validate(LaTeXFeatures & features) const
-{
- features.amsstyle = ams();
-
- // Validation is necessary only if not using AMS math.
- // To be safe, we will always run mathedvalidate.
- //if (features.amsstyle)
- // return;
-
- features.boldsymbol = true;
- //features.binom = true;
-
- MathNestInset::validate(features);
-}
-
-
-void MathMatrixInset::header_write(std::ostream & os) const
-{
- bool n = numberedType();
-
- switch (getType()) {
- case LM_OT_SIMPLE:
- os << '$';
- if (cell(0).empty())
- os << ' ';
- break;
-
- case LM_OT_EQUATION:
- if (n)
- os << "\\begin{equation" << star(n) << "}\n";
- else
- os << "\\[\n";
- break;
-
- case LM_OT_EQNARRAY:
- os << "\\begin{eqnarray" << star(n) << "}\n";
- break;
-
- case LM_OT_ALIGN:
- os << "\\begin{align" << star(n) << "}";
- break;
-
- case LM_OT_ALIGNAT:
- os << "\\begin{alignat" << star(n) << "}" << "{" << ncols()/2 << "}\n";
- break;
-
- case LM_OT_XALIGNAT:
- os << "\\begin{xalignat" << star(n) << "}" << "{" << ncols()/2 << "}\n";
- break;
-
- case LM_OT_XXALIGNAT:
- os << "\\begin{xxalignat}" << "{" << ncols()/2 << "}\n";
- break;
-
- case LM_OT_MULTLINE:
- os << "\\begin{multline}\n";
- break;
-
- case LM_OT_GATHER:
- os << "\\begin{gather}\n";
- break;
-
- default:
- os << "\\begin{unknown" << star(n) << "}";
- }
-}
-
-
-void MathMatrixInset::footer_write(std::ostream & os) const
-{
- bool n = numberedType();
-
- switch (getType()) {
- case LM_OT_SIMPLE:
- os << '$';
- break;
-
- case LM_OT_EQUATION:
- if (n)
- os << "\\end{equation" << star(n) << "}\n";
- else
- os << "\\]\n";
- break;
-
- case LM_OT_EQNARRAY:
- os << "\\end{eqnarray" << star(n) << "}\n";
- break;
-
- case LM_OT_ALIGN:
- os << "\\end{align" << star(n) << "}\n";
- break;
-
- case LM_OT_ALIGNAT:
- os << "\\end{alignat" << star(n) << "}\n";
- break;
-
- case LM_OT_XALIGNAT:
- os << "\\end{xalignat" << star(n) << "}\n";
- break;
-
- case LM_OT_XXALIGNAT:
- os << "\\end{xxalignat}\n";
- break;
-
- case LM_OT_MULTLINE:
- os << "\\end{multline}\n";
- break;
-
- case LM_OT_GATHER:
- os << "\\end{gather}\n";
- break;
-
- default:
- os << "\\end{unknown" << star(n) << "}";
- }
-}
-
-
-void MathMatrixInset::addRow(unsigned int row)
-{
- nonum_.insert(nonum_.begin() + row + 1, !numberedType());
- label_.insert(label_.begin() + row + 1, string());
- MathGridInset::addRow(row);
-}
-
-
-void MathMatrixInset::appendRow()
-{
- nonum_.push_back(!numberedType());
- label_.push_back(string());
- MathGridInset::appendRow();
-}
-
-
-void MathMatrixInset::delRow(unsigned int row)