- if (yylval.i == LM_OT_MATRIX) {
- char ar[120];
- char ar2[8];
- ar[0] = ar2[0] = '\0';
- char rg = LexGetArg(0);
- if (rg == ']') {
- strcpy(ar2, yytext.data());
- rg = LexGetArg('{');
- }
- strcpy(ar, yytext.data());
- int const nc = parse_align(ar, ar2);
- MathParInset * mm = new MathMatrixInset(nc, 0);
- mm->SetAlign(ar2[0], ar);
- data.insertInset(mm, LM_TC_ACTIVE_INSET);
- MathedArray dat;
- mathed_parse(dat, FLAG_END, &mm);
- } else if (is_eqn_type(yylval.i)) {
- if (plevel!= 0) {
- mathPrintError("Misplaced environment");
- break;
- }
- if (!mt) {
- mathPrintError("0 paragraph.");
- panic = true;
- }
-
- mathed_env = static_cast<MathedInsetTypes>(yylval.i);
- if (mathed_env != LM_OT_MIN) {
- size = LM_ST_DISPLAY;
- if (is_multiline(mathed_env)) {
- int cols = 1;
- if (is_multicolumn(mathed_env)) {
- if (mathed_env != LM_OT_ALIGNAT &&
- mathed_env != LM_OT_ALIGNATN &&
- yyis->good()) {
- char c;
- yyis->get(c);
- if (c != '%')
- lyxerr << "Math parse error: unexpected '"
- << c << "'" << endl;
- }
- LexGetArg('{');
- cols = strToInt(string(yytext.data()));
- }
- mt = create_multiline(mathed_env, cols);
- if (mtx) *mtx = mt;
- flags |= FLAG_END;
-// data.Insert(' ', LM_TC_TAB);
-// data.Insert(' ', LM_TC_TAB);
-// data.Reset();
- }
- mt->SetStyle(size);
- mt->SetType(mathed_env);
- crow = mt->getRowSt().data_;
- }
-
- lyxerr[Debug::MATHED] << "MATH BEGIN[" << mathed_env << "]" << endl;
- } else {
-// lyxerr << "MATHCRO[" << yytext << "]";
- MathMacro * p =
- MathMacroTable::mathMTable.createMacro(yytext.data());
- if (p) {
- data.insertInset(p, p->getTCode());
- p->setArgumentIdx(0);
- //mathed_parse(p->GetData(), FLAG_END, reinterpret_cast<MathParInset**>(&p));
- MathedArray dat;
- mathed_parse(dat, FLAG_END, reinterpret_cast<MathParInset**>(&p));
-// for (int i = 0; p->setArgumentIdx(i); ++i)
-// p->SetData(mathed_parse(FLAG_BRACE|FLAG_BRACE_LAST));
- } else
- mathPrintError("Unrecognized environment");
- }
+ {
+ int i = yylval.i;
+ MathInsetTypes typ = latex_mathenv[i].typ;
+
+ if (typ == LM_OT_MATRIX) {
+ string valign = lexArg('[') + 'c';
+ string halign = lexArg('{');
+ //lyxerr << "valign: '" << valign << "'\n";
+ //lyxerr << "halign: '" << halign << "'\n";
+ MathArrayInset * m = new MathArrayInset(halign.size(), 1);
+ m->valign(valign[0]);
+ m->halign(halign);
+
+ mathed_parse_lines(m, halign.size(), latex_mathenv[i].numbered, false);
+ array.push_back(m);
+ //lyxerr << "read matrix " << *m << "\n";
+ break;
+ } else
+ lyxerr[Debug::MATHED] << "unknow math inset " << typ << "\n";