5 #include "math_arrayinset.h"
6 #include "math_parser.h"
7 #include "support/LOstream.h"
11 MathArrayInset::MathArrayInset(int m, int n)
16 MathArrayInset::MathArrayInset(int m, int n, char valign, string const & halign)
17 : MathGridInset(m, n, valign, halign)
21 MathArrayInset::MathArrayInset(string const & str)
24 vector< vector<string> > dat;
25 istringstream is(str);
29 istringstream ls(line);
30 typedef std::istream_iterator<string> iter;
31 vector<string> v = vector<string>(iter(ls), iter());
36 for (row_type row = 1; row < dat.size(); ++row)
38 for (col_type col = 1; col < dat[0].size(); ++col)
40 for (row_type row = 0; row < dat.size(); ++row)
41 for (col_type col = 0; col < dat[row].size(); ++col)
42 mathed_parse_cell(cell(index(row, col)), dat[row][col]);
46 MathInset * MathArrayInset::clone() const
48 return new MathArrayInset(*this);
52 void MathArrayInset::write(MathWriteInfo & os) const
56 os << "\\begin{array}";
58 if (v_align_ == 't' || v_align_ == 'b')
59 os << '[' << char(v_align_) << ']';
62 for (col_type col = 0; col < ncols(); ++col)
63 os << colinfo_[col].align_;
66 MathGridInset::write(os);
70 os << "\\end{array}\n";
74 void MathArrayInset::writeNormal(std::ostream & os) const
77 MathGridInset::writeNormal(os);
82 void MathArrayInset::metrics(MathMetricsInfo const & st) const
84 MathMetricsInfo mi = st;
85 if (mi.style == LM_ST_DISPLAY)
86 mi.style = LM_ST_TEXT;
87 MathGridInset::metrics(mi);