void validate(LaTeXFeatures & features) const;
///
InsetCode lyxCode() const { return MATH_AMSARRAY_CODE; }
-private:
- virtual Inset * clone() const;
///
char const * name_left() const;
///
char const * name_right() const;
+private:
+ virtual Inset * clone() const;
///
docstring name_;
};
namespace lyx {
-InsetMathMatrix::InsetMathMatrix(InsetMathGrid const & p)
- : InsetMathGrid(p)
+InsetMathMatrix::InsetMathMatrix(InsetMathGrid const & p,
+ docstring const & left, docstring const & right)
+ : InsetMathGrid(p), left_(left), right_(right)
{}
}
-// FIXME XHTML
-// We need more information here, so we can output the correct
-// delimiters, which will not always be "[". To do this, we need
-// to make some changes to InsetMathMatrix, adding a member to
-// record the type of delimiter, and then make the extractMatrices
-// routine in MathExtern give us this information.
void InsetMathMatrix::mathmlize(MathStream & os) const
{
- os << "<mo form='prefix' fence='true' stretchy='true' symmetric='true' lspace='thinmathspace'>[</mo>";
+ os << "<mo form='prefix' fence='true' stretchy='true' symmetric='true' lspace='thinmathspace'>"
+ << left_ << "</mo>";
os << MTag("mtable");
for (row_type row = 0; row < nrows(); ++row) {
os << MTag("mtr");
os << ETag("mtr");
}
os << ETag("mtable");
- os << "<mo form='postfix' fence='true' stretchy='true' symmetric='true' lspace='thinmathspace'>]</mo>";
+ os << "<mo form='postfix' fence='true' stretchy='true' symmetric='true' lspace='thinmathspace'>"
+ << right_ << "</mo>";
}
#define MATH_MATRIXINSET_H
#include "InsetMathGrid.h"
+#include "support/strfwd.h"
namespace lyx {
class InsetMathMatrix : public InsetMathGrid {
public:
///
- explicit InsetMathMatrix(InsetMathGrid const &);
- ///
- explicit InsetMathMatrix(Buffer * buf, docstring const & str);
+ explicit InsetMathMatrix(InsetMathGrid const &,
+ docstring const & left, docstring const & right);
/// identifies MatrixInsets
InsetMathMatrix const * asMatrixInset() const { return this; }
private:
virtual Inset * clone() const;
+ ///
+ docstring left_;
+ ///
+ docstring right_;
};
#include "MathExtern.h"
+#include "InsetMathAMSArray.h"
#include "InsetMathArray.h"
#include "InsetMathChar.h"
#include "InsetMathDelim.h"
//lyxerr << "\nMatrices from: " << ar << endl;
// first pass for explicitly delimited stuff
for (size_t i = 0; i < ar.size(); ++i) {
- if (!ar[i]->asDelimInset())
+ InsetMathDelim const * const inset = ar[i]->asDelimInset();
+ if (!inset)
continue;
- MathData const & arr = ar[i]->asDelimInset()->cell(0);
+ MathData const & arr = inset->cell(0);
if (arr.size() != 1)
continue;
if (!arr.front()->asGridInset())
continue;
- ar[i] = MathAtom(new InsetMathMatrix(*(arr.front()->asGridInset())));
+ ar[i] = MathAtom(new InsetMathMatrix(*(arr.front()->asGridInset()),
+ inset->left_, inset->right_));
}
// second pass for AMS "pmatrix" etc
- for (size_t i = 0; i < ar.size(); ++i)
- if (ar[i]->asAMSArrayInset())
- ar[i] = MathAtom(new InsetMathMatrix(*(ar[i]->asGridInset())));
+ for (size_t i = 0; i < ar.size(); ++i) {
+ InsetMathAMSArray const * const inset = ar[i]->asAMSArrayInset();
+ if (inset) {
+ string left = inset->name_left();
+ if (left == "Vert")
+ left = "[";
+ string right = inset->name_right();
+ if (right == "Vert")
+ right = "]";
+ ar[i] = MathAtom(new InsetMathMatrix(*inset, from_ascii(left), from_ascii(right)));
+ }
+ }
//lyxerr << "\nMatrices to: " << ar << endl;
}