5 #include "math_arrayinset.h"
6 #include "math_parser.h"
7 #include "support/LOstream.h"
13 MathArrayInset::MathArrayInset(int m, int n)
18 MathArrayInset::MathArrayInset(int m, int n, char valign, string const & halign)
19 : MathGridInset(m, n, valign, halign)
23 MathArrayInset::MathArrayInset(string const & str)
26 vector< vector<string> > dat;
27 istringstream is(str);
31 istringstream ls(line);
32 typedef std::istream_iterator<string> iter;
33 vector<string> v = vector<string>(iter(ls), iter());
38 for (row_type row = 1; row < dat.size(); ++row)
40 for (col_type col = 1; col < dat[0].size(); ++col)
42 for (row_type row = 0; row < dat.size(); ++row)
43 for (col_type col = 0; col < dat[row].size(); ++col)
44 mathed_parse_cell(cell(index(row, col)), dat[row][col]);
48 MathInset * MathArrayInset::clone() const
50 return new MathArrayInset(*this);
54 void MathArrayInset::write(MathWriteInfo & os) const
58 os << "\\begin{array}";
60 if (v_align_ == 't' || v_align_ == 'b')
61 os << '[' << char(v_align_) << ']';
64 for (col_type col = 0; col < ncols(); ++col)
65 os << colinfo_[col].align_;
68 MathGridInset::write(os);
72 os << "\\end{array}\n";
76 void MathArrayInset::writeNormal(std::ostream & os) const
79 MathGridInset::writeNormal(os);
84 void MathArrayInset::metrics(MathMetricsInfo const & st) const
86 MathMetricsInfo mi = st;
87 if (mi.style == LM_ST_DISPLAY)
88 mi.style = LM_ST_TEXT;
89 MathGridInset::metrics(mi);