2 * \file InsetMathMatrix.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
13 #include "InsetMathMatrix.h"
15 #include "MathStream.h"
20 InsetMathMatrix::InsetMathMatrix(InsetMathGrid const & p)
25 Inset * InsetMathMatrix::clone() const
27 return new InsetMathMatrix(*this);
31 void InsetMathMatrix::write(WriteStream & os) const
33 InsetMathGrid::write(os);
37 void InsetMathMatrix::normalize(NormalStream & os) const
39 InsetMathGrid::normalize(os);
43 void InsetMathMatrix::maple(MapleStream & os) const
45 os << "matrix(" << int(nrows()) << ',' << int(ncols()) << ",[";
46 for (idx_type idx = 0; idx < nargs(); ++idx) {
55 void InsetMathMatrix::maxima(MaximaStream & os) const
58 for (row_type row = 0; row < nrows(); ++row) {
62 for (col_type col = 0; col < ncols(); ++col) {
65 os << cell(index(row, col));
73 void InsetMathMatrix::mathematica(MathematicaStream & os) const
76 for (row_type row = 0; row < nrows(); ++row) {
80 for (col_type col = 0; col < ncols(); ++col) {
83 os << cell(index(row, col));
92 // We need more information here, so we can output the correct
93 // delimiters, which will not always be "[". To do this, we need
94 // to make some changes to InsetMathMatrix, adding a member to
95 // record the type of delimiter, and then make the extractMatrices
96 // routine in MathExtern give us this information.
97 void InsetMathMatrix::mathmlize(MathStream & os) const
99 os << "<mo form='prefix' fence='true' stretchy='true' symmetric='true' lspace='thinmathspace'>[</mo>";
100 os << MTag("mtable");
101 for (row_type row = 0; row < nrows(); ++row) {
103 for (col_type col = 0; col < ncols(); ++col)
104 os << MTag("mtd") << cell(index(row, col)) << ETag("mtd");
107 os << ETag("mtable");
108 os << "<mo form='postfix' fence='true' stretchy='true' symmetric='true' lspace='thinmathspace'>]</mo>";
112 void InsetMathMatrix::octave(OctaveStream & os) const
115 for (row_type row = 0; row < nrows(); ++row) {
119 for (col_type col = 0; col < ncols(); ++col)
120 os << cell(index(row, col)) << ' ';