2 * \file math_hullinset.C
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 "math_charinset.h"
14 #include "math_data.h"
15 #include "math_extern.h"
16 #include "math_hullinset.h"
17 #include "math_mathmlstream.h"
18 #include "math_streamstr.h"
19 #include "math_support.h"
21 #include "BufferView.h"
22 #include "CutAndPaste.h"
24 #include "LaTeXFeatures.h"
27 #include "dispatchresult.h"
28 #include "funcrequest.h"
32 #include "outputparams.h"
33 #include "textpainter.h"
36 #include "insets/render_preview.h"
38 #include "frontends/Alert.h"
40 #include "graphics/PreviewLoader.h"
42 #include "support/std_sstream.h"
44 #include <boost/bind.hpp>
46 using lyx::cap::grabAndEraseSelection;
53 using std::istringstream;
55 using std::ostringstream;
63 int getCols(string const & type)
65 if (type == "eqnarray")
69 if (type == "flalign")
71 if (type == "alignat")
73 if (type == "xalignat")
75 if (type == "xxalignat")
81 // returns position of first relation operator in the array
82 // used for "intelligent splitting"
83 size_t firstRelOp(MathArray const & ar)
85 for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it)
87 return it - ar.begin();
92 char const * star(bool numbered)
94 return numbered ? "" : "*";
98 int typecode(string const & s)
100 if (s == "none") return 0;
101 if (s == "simple") return 1;
102 if (s == "equation") return 2;
103 if (s == "eqnarray") return 3;
104 if (s == "align") return 4;
105 if (s == "alignat") return 5;
106 if (s == "xalignat") return 6;
107 if (s == "xxalignat") return 7;
108 if (s == "multline") return 8;
109 if (s == "gather") return 9;
110 if (s == "flalign") return 10;
111 lyxerr << "unknown hull type '" << s << "'" << endl;
115 bool smaller(string const & s, string const & t)
117 return typecode(s) < typecode(t);
121 } // end anon namespace
125 MathHullInset::MathHullInset()
126 : MathGridInset(1, 1), type_("none"), nonum_(1), label_(1),
127 preview_(new RenderPreview(this))
129 //lyxerr << "sizeof MathInset: " << sizeof(MathInset) << endl;
130 //lyxerr << "sizeof MetricsInfo: " << sizeof(MetricsInfo) << endl;
131 //lyxerr << "sizeof MathCharInset: " << sizeof(MathCharInset) << endl;
132 //lyxerr << "sizeof LyXFont: " << sizeof(LyXFont) << endl;
137 MathHullInset::MathHullInset(string const & type)
138 : MathGridInset(getCols(type), 1), type_(type), nonum_(1), label_(1),
139 preview_(new RenderPreview(this))
145 MathHullInset::MathHullInset(MathHullInset const & other)
146 : MathGridInset(other),
147 type_(other.type_), nonum_(other.nonum_), label_(other.label_),
148 preview_(new RenderPreview(this))
152 MathHullInset::~MathHullInset()
156 auto_ptr<InsetBase> MathHullInset::clone() const
158 return auto_ptr<InsetBase>(new MathHullInset(*this));
162 void MathHullInset::operator=(MathHullInset const & other)
166 *static_cast<MathGridInset*>(this) = MathGridInset(other);
168 nonum_ = other.nonum_;
169 label_ = other.label_;
170 preview_.reset(new RenderPreview(*other.preview_, this));
174 MathInset::mode_type MathHullInset::currentMode() const
177 return UNDECIDED_MODE;
178 // definitely math mode ...
183 bool MathHullInset::idxFirst(LCursor & cur) const
191 bool MathHullInset::idxLast(LCursor & cur) const
193 cur.idx() = nargs() - 1;
194 cur.pos() = cur.lastpos();
199 char MathHullInset::defaultColAlign(col_type col)
201 if (type_ == "eqnarray")
203 if (typecode(type_) >= typecode("align"))
204 return "rl"[col & 1];
209 int MathHullInset::defaultColSpace(col_type col)
211 if (type_ == "align" || type_ == "alignat")
213 if (type_ == "xalignat")
214 return (col & 1) ? 20 : 0;
215 if (type_ == "xxalignat" || type_ == "flalign")
216 return (col & 1) ? 40 : 0;
221 char const * MathHullInset::standardFont() const
224 return "lyxnochange";
229 void MathHullInset::metrics(MetricsInfo & mi, Dimension & dim) const
231 bool const use_preview = (!editing(mi.base.bv) &&
232 RenderPreview::activated() &&
233 preview_->previewReady());
236 preview_->metrics(mi, dim);
237 // insert a one pixel gap in front of the formula
245 FontSetChanger dummy1(mi.base, standardFont());
246 StyleChanger dummy2(mi.base, display() ? LM_ST_DISPLAY : LM_ST_TEXT);
248 // let the cells adjust themselves
249 MathGridInset::metrics(mi, dim);
256 if (numberedType()) {
257 FontSetChanger dummy(mi.base, "mathbf");
259 for (row_type row = 0; row < nrows(); ++row)
260 l = max(l, mathed_string_width(mi.base.font, nicelabel(row)));
266 // make it at least as high as the current font
269 math_font_max_dim(mi.base.font, asc, des);
270 dim.asc = max(dim.asc, asc);
271 dim.des = max(dim.des, des);
277 void MathHullInset::draw(PainterInfo & pi, int x, int y) const
279 // The previews are drawn only when we're not editing the inset.
280 bool const use_preview = (!editing(pi.base.bv) &&
281 RenderPreview::activated() &&
282 preview_->previewReady());
285 // one pixel gap in front
286 preview_->draw(pi, x + 1, y);
287 setPosCache(pi, x, y);
291 FontSetChanger dummy1(pi.base, standardFont());
292 StyleChanger dummy2(pi.base, display() ? LM_ST_DISPLAY : LM_ST_TEXT);
293 MathGridInset::draw(pi, x + 1, y);
295 if (numberedType()) {
296 int const xx = x + colinfo_.back().offset_ + colinfo_.back().width_ + 20;
297 for (row_type row = 0; row < nrows(); ++row) {
298 int const yy = y + rowinfo_[row].offset_;
299 FontSetChanger dummy(pi.base, "mathrm");
300 drawStr(pi, pi.base.font, xx, yy, nicelabel(row));
303 setPosCache(pi, x, y);
307 void MathHullInset::metricsT(TextMetricsInfo const & mi, Dimension & dim) const
310 MathGridInset::metricsT(mi, dim);
313 WriteStream wi(os, false, true);
315 dim.wid = os.str().size();
322 void MathHullInset::drawT(TextPainter & pain, int x, int y) const
325 MathGridInset::drawT(pain, x, y);
328 WriteStream wi(os, false, true);
330 pain.draw(x, y, os.str().c_str());
337 string const latex_string(MathHullInset const & inset)
340 WriteStream wi(ls, false, false);
348 void MathHullInset::addPreview(lyx::graphics::PreviewLoader & ploader) const
350 string const snippet = latex_string(*this);
351 preview_->addPreview(snippet, ploader);
355 void MathHullInset::notifyCursorLeaves(LCursor & cur)
357 if (!RenderPreview::activated())
360 Buffer const & buffer = cur.buffer();
361 string const snippet = latex_string(*this);
362 preview_->addPreview(snippet, buffer);
363 preview_->startLoading(buffer);
367 string MathHullInset::label(row_type row) const
369 row_type n = nrows();
370 BOOST_ASSERT(row < n);
375 void MathHullInset::label(row_type row, string const & label)
377 //lyxerr << "setting label '" << label << "' for row " << row << endl;
382 void MathHullInset::numbered(row_type row, bool num)
388 bool MathHullInset::numbered(row_type row) const
394 bool MathHullInset::ams() const
398 type_ == "flalign" ||
399 type_ == "multline" ||
401 type_ == "alignat" ||
402 type_ == "xalignat" ||
403 type_ == "xxalignat";
407 bool MathHullInset::display() const
409 return type_ != "simple" && type_ != "none";
413 void MathHullInset::getLabelList(Buffer const &, vector<string> & labels) const
415 for (row_type row = 0; row < nrows(); ++row)
416 if (!label_[row].empty() && nonum_[row] != 1)
417 labels.push_back(label_[row]);
421 bool MathHullInset::numberedType() const
425 if (type_ == "simple")
427 if (type_ == "xxalignat")
429 for (row_type row = 0; row < nrows(); ++row)
436 void MathHullInset::validate(LaTeXFeatures & features) const
439 features.require("amsmath");
442 // Validation is necessary only if not using AMS math.
443 // To be safe, we will always run mathedvalidate.
444 //if (features.amsstyle)
447 features.require("boldsymbol");
448 //features.binom = true;
450 MathGridInset::validate(features);
454 void MathHullInset::header_write(WriteStream & os) const
456 bool n = numberedType();
461 else if (type_ == "simple") {
467 else if (type_ == "equation") {
469 os << "\\begin{equation" << star(n) << "}\n";
474 else if (type_ == "eqnarray" || type_ == "align" || type_ == "flalign"
475 || type_ == "gather" || type_ == "multline")
476 os << "\\begin{" << type_ << star(n) << "}\n";
478 else if (type_ == "alignat" || type_ == "xalignat")
479 os << "\\begin{" << type_ << star(n) << '}'
480 << '{' << static_cast<unsigned int>((ncols() + 1)/2) << "}\n";
482 else if (type_ == "xxalignat")
483 os << "\\begin{" << type_ << '}'
484 << '{' << static_cast<unsigned int>((ncols() + 1)/2) << "}\n";
487 os << "\\begin{unknown" << star(n) << '}';
491 void MathHullInset::footer_write(WriteStream & os) const
493 bool n = numberedType();
498 else if (type_ == "simple")
501 else if (type_ == "equation")
503 os << "\\end{equation" << star(n) << "}\n";
507 else if (type_ == "eqnarray" || type_ == "align" || type_ == "flalign"
508 || type_ == "alignat" || type_ == "xalignat"
509 || type_ == "gather" || type_ == "multline")
510 os << "\\end{" << type_ << star(n) << "}\n";
512 else if (type_ == "xxalignat")
513 os << "\\end{" << type_ << "}\n";
516 os << "\\end{unknown" << star(n) << '}';
520 bool MathHullInset::colChangeOK() const
523 type_ == "align" || type_ == "flalign" ||type_ == "alignat" ||
524 type_ == "xalignat" || type_ == "xxalignat";
528 void MathHullInset::addRow(row_type row)
530 nonum_.insert(nonum_.begin() + row + 1, !numberedType());
531 label_.insert(label_.begin() + row + 1, string());
532 MathGridInset::addRow(row);
536 void MathHullInset::swapRow(row_type row)
540 if (row + 1 == nrows())
542 swap(nonum_[row], nonum_[row + 1]);
543 swap(label_[row], label_[row + 1]);
544 MathGridInset::swapRow(row);
548 void MathHullInset::delRow(row_type row)
552 MathGridInset::delRow(row);
553 nonum_.erase(nonum_.begin() + row);
554 label_.erase(label_.begin() + row);
558 void MathHullInset::addCol(col_type col)
561 MathGridInset::addCol(col);
563 lyxerr << "Can't change number of columns in '" << type_ << "'" << endl;
567 void MathHullInset::delCol(col_type col)
570 MathGridInset::delCol(col);
572 lyxerr << "Can't change number of columns in '" << type_ << "'" << endl;
576 string MathHullInset::nicelabel(row_type row) const
580 if (label_[row].empty())
581 return string("(#)");
582 return '(' + label_[row] + ')';
586 void MathHullInset::glueall()
589 for (idx_type i = 0; i < nargs(); ++i)
591 *this = MathHullInset("simple");
597 string const & MathHullInset::getType() const
603 void MathHullInset::setType(string const & type)
611 void MathHullInset::mutate(string const & newtype)
613 lyxerr << "mutating from '" << type_ << "' to '" << newtype << "'" << endl;
615 // we try to move along the chain
616 // none <-> simple <-> equation <-> eqnarray
618 if (newtype == "dump") {
622 else if (newtype == type_) {
626 else if (type_ == "none") {
632 else if (type_ == "simple") {
633 if (newtype == "none") {
642 else if (type_ == "equation") {
643 if (smaller(newtype, type_)) {
646 } else if (newtype == "eqnarray") {
647 MathGridInset::addCol(1);
648 MathGridInset::addCol(1);
650 // split it "nicely" on the firest relop
651 pos_type pos = firstRelOp(cell(0));
652 cell(1) = MathArray(cell(0).begin() + pos, cell(0).end());
653 cell(0).erase(pos, cell(0).size());
655 if (cell(1).size()) {
656 cell(2) = MathArray(cell(1).begin() + 1, cell(1).end());
657 cell(1).erase(1, cell(1).size());
661 } else if (newtype == "multline" || newtype == "gather") {
665 MathGridInset::addCol(1);
667 pos_type pos = firstRelOp(cell(0));
669 cell(0).erase(pos, cell(0).size());
670 cell(1).erase(0, pos);
676 else if (type_ == "eqnarray") {
677 if (smaller(newtype, type_)) {
678 // set correct (no)numbering
679 bool allnonum = true;
680 for (row_type row = 0; row < nrows(); ++row)
684 // set first non-empty label
686 for (row_type row = 0; row < nrows(); ++row) {
687 if (!label_[row].empty()) {
694 nonum_[0] = allnonum;
697 } else { // align & Co.
698 for (row_type row = 0; row < nrows(); ++row) {
699 idx_type c = 3 * row + 1;
700 cell(c).append(cell(c + 1));
702 MathGridInset::delCol(2);
708 else if (type_ == "align") {
709 if (smaller(newtype, type_)) {
710 MathGridInset::addCol(1);
718 else if (type_ == "multline") {
719 if (newtype == "gather" || newtype == "align" ||
720 newtype == "xalignat" || newtype == "xxalignat" || newtype == "flalign")
722 else if (newtype == "eqnarray") {
723 MathGridInset::addCol(1);
724 MathGridInset::addCol(1);
727 lyxerr << "mutation from '" << type_
728 << "' to '" << newtype << "' not implemented" << endl;
732 else if (type_ == "gather") {
733 if (newtype == "multline") {
736 lyxerr << "mutation from '" << type_
737 << "' to '" << newtype << "' not implemented" << endl;
742 lyxerr << "mutation from '" << type_
743 << "' to '" << newtype << "' not implemented" << endl;
748 string MathHullInset::eolString(row_type row, bool fragile) const
751 if (numberedType()) {
752 if (!label_[row].empty() && !nonum_[row])
753 res += "\\label{" + label_[row] + '}';
754 if (nonum_[row] && (type_ != "multline"))
755 res += "\\nonumber ";
757 return res + MathGridInset::eolString(row, fragile);
761 void MathHullInset::write(WriteStream & os) const
764 MathGridInset::write(os);
769 void MathHullInset::normalize(NormalStream & os) const
771 os << "[formula " << type_ << ' ';
772 MathGridInset::normalize(os);
777 void MathHullInset::mathmlize(MathMLStream & os) const
779 MathGridInset::mathmlize(os);
783 void MathHullInset::infoize(ostream & os) const
785 os << "Type: " << type_;
789 void MathHullInset::check() const
791 BOOST_ASSERT(nonum_.size() == nrows());
792 BOOST_ASSERT(label_.size() == nrows());
796 void MathHullInset::doExtern(LCursor & cur, FuncRequest & func)
800 istringstream iss(func.argument.c_str());
801 iss >> lang >> extra;
806 #warning temporarily disabled
807 //if (cur.selection()) {
810 // lyxerr << "use selection: " << ar << endl;
811 // insert(pipeThroughExtern(lang, extra, ar));
817 eq.push_back(MathAtom(new MathCharInset('=')));
819 // go to first item in line
820 cur.idx() -= cur.idx() % ncols();
823 if (getType() == "simple") {
824 size_type pos = cur.cell().find_last(eq);
826 if (cur.inMathed() && cur.selection()) {
827 asArray(grabAndEraseSelection(cur), ar);
828 } else if (pos == cur.cell().size()) {
830 lyxerr << "use whole cell: " << ar << endl;
832 ar = MathArray(cur.cell().begin() + pos + 1, cur.cell().end());
833 lyxerr << "use partial cell form pos: " << pos << endl;
835 cur.cell().append(eq);
836 cur.cell().append(pipeThroughExtern(lang, extra, ar));
837 cur.pos() = cur.lastpos();
841 if (getType() == "equation") {
842 lyxerr << "use equation inset" << endl;
844 MathArray & ar = cur.cell();
845 lyxerr << "use cell: " << ar << endl;
849 cur.cell() = pipeThroughExtern(lang, extra, ar);
850 // move to end of line
851 cur.pos() = cur.lastpos();
856 lyxerr << "use eqnarray" << endl;
857 cur.idx() += 2 - cur.idx() % ncols();
859 MathArray ar = cur.cell();
860 lyxerr << "use cell: " << ar << endl;
862 #warning temporarily disabled
869 cur.cell() = pipeThroughExtern(lang, extra, ar);
870 cur.pos() = cur.lastpos();
875 void MathHullInset::priv_dispatch(LCursor & cur, FuncRequest & cmd)
877 switch (cmd.action) {
879 case LFUN_FINISHED_LEFT:
880 case LFUN_FINISHED_RIGHT:
881 case LFUN_FINISHED_UP:
882 case LFUN_FINISHED_DOWN:
883 MathGridInset::priv_dispatch(cur, cmd);
884 notifyCursorLeaves(cur);
887 case LFUN_BREAKPARAGRAPH:
892 if (type_ == "simple" || type_ == "equation") {
893 recordUndoInset(cur);
896 cur.pos() = cur.lastpos();
899 MathGridInset::priv_dispatch(cur, cmd);
902 case LFUN_MATH_NUMBER:
903 //lyxerr << "toggling all numbers" << endl;
905 recordUndoInset(cur);
906 bool old = numberedType();
907 if (type_ == "multline")
908 numbered(nrows() - 1, !old);
910 for (row_type row = 0; row < nrows(); ++row)
912 cur.message(old ? _("No number") : _("Number"));
916 case LFUN_MATH_NONUMBER:
918 recordUndoInset(cur);
919 row_type r = (type_ == "multline") ? nrows() - 1 : cur.row();
920 bool old = numbered(r);
921 cur.message(old ? _("No number") : _("Number"));
926 case LFUN_INSERT_LABEL: {
927 recordUndoInset(cur);
928 row_type r = (type_ == "multline") ? nrows() - 1 : cur.row();
929 string old_label = label(r);
930 string new_label = cmd.argument;
932 if (new_label.empty()) {
933 string const default_label =
934 (lyxrc.label_init_length >= 0) ? "eq:" : "";
935 pair<bool, string> const res = old_label.empty()
936 ? Alert::askForText(_("Enter new label to insert:"), default_label)
937 : Alert::askForText(_("Enter label:"), old_label);
938 new_label = lyx::support::trim(res.second);
941 if (!new_label.empty())
947 case LFUN_MATH_EXTERN:
948 recordUndoInset(cur);
952 case LFUN_MATH_MUTATE: {
953 recordUndoInset(cur);
954 row_type row = cur.row();
955 col_type col = cur.col();
956 mutate(cmd.argument);
957 cur.idx() = row * ncols() + col;
958 if (cur.idx() > cur.lastidx()) {
959 cur.idx() = cur.lastidx();
960 cur.pos() = cur.lastpos();
962 if (cur.pos() > cur.lastpos())
963 cur.pos() = cur.lastpos();
964 //cur.dispatched(FINISHED);
968 case LFUN_MATH_DISPLAY: {
969 recordUndoInset(cur);
970 mutate(type_ == "simple" ? "equation" : "simple");
972 cur.pos() = cur.lastpos();
973 //cur.dispatched(FINISHED);
978 MathGridInset::priv_dispatch(cur, cmd);
984 bool MathHullInset::getStatus(LCursor & cur, FuncRequest const & cmd,
985 FuncStatus & flag) const
987 switch (cmd.action) {
989 case LFUN_MATH_NUMBER:
990 case LFUN_MATH_NONUMBER:
991 case LFUN_INSERT_LABEL:
992 case LFUN_MATH_EXTERN:
993 case LFUN_MATH_MUTATE:
994 case LFUN_MATH_DISPLAY:
998 return MathGridInset::getStatus(cur, cmd, flag);
1003 /////////////////////////////////////////////////////////////////////
1005 #include "math_arrayinset.h"
1006 #include "math_deliminset.h"
1007 #include "math_factory.h"
1008 #include "math_parser.h"
1009 #include "math_spaceinset.h"
1010 #include "ref_inset.h"
1012 #include "bufferview_funcs.h"
1013 #include "lyxtext.h"
1015 #include "frontends/LyXView.h"
1016 #include "frontends/Dialogs.h"
1018 #include "support/lstrings.h"
1019 #include "support/lyxlib.h"
1022 // simply scrap this function if you want
1023 void MathHullInset::mutateToText()
1026 // translate to latex
1028 latex(NULL, os, false, false);
1029 string str = os.str();
1032 LyXText * lt = view_->getLyXText();
1033 string::const_iterator cit = str.begin();
1034 string::const_iterator end = str.end();
1035 for (; cit != end; ++cit)
1036 view_->owner()->getIntl()->getTransManager().TranslateAndInsert(*cit, lt);
1039 //view_->owner()->dispatch(LFUN_ESCAPE);
1044 void MathHullInset::handleFont(LCursor & cur, string const & arg,
1045 string const & font)
1047 // this whole function is a hack and won't work for incremental font
1050 if (cur.inset().asMathInset()->name() == font)
1051 cur.handleFont(font);
1053 cur.handleNest(createMathInset(font));
1059 void MathHullInset::handleFont2(LCursor & cur, string const & arg)
1064 bv_funcs::string2font(arg, font, b);
1065 if (font.color() != LColor::inherit) {
1066 MathAtom at = createMathInset("color");
1067 asArray(lcolor.getGUIName(font.color()), at.nucleus()->cell(0));
1068 cur.handleNest(at, 1);
1073 void MathHullInset::edit(LCursor & cur, bool left)
1076 left ? idxFirst(cur) : idxLast(cur);
1080 string const MathHullInset::editMessage() const
1082 return _("Math editor mode");
1086 void MathHullInset::getCursorDim(int & asc, int & desc) const
1090 //math_font_max_dim(font_, asc, des);
1094 void MathHullInset::revealCodes(LCursor & cur) const
1096 if (!cur.inMathed())
1100 cur.message(os.str());
1102 // write something to the minibuffer
1103 // translate to latex
1107 string str = os.str();
1109 string::size_type pos = 0;
1111 for (string::iterator it = str.begin(); it != str.end(); ++it) {
1114 else if (*it == '\0') {
1116 pos = it - str.begin();
1122 res = res.substr(pos - 30);
1123 if (res.size() > 60)
1124 res = res.substr(0, 60);
1130 InsetBase::Code MathHullInset::lyxCode() const
1136 /////////////////////////////////////////////////////////////////////
1140 bool MathHullInset::searchForward(BufferView * bv, string const & str,
1143 #warning completely broken
1144 static MathHullInset * lastformula = 0;
1145 static CursorBase current = DocIterator(ibegin(nucleus()));
1146 static MathArray ar;
1147 static string laststr;
1149 if (lastformula != this || laststr != str) {
1150 //lyxerr << "reset lastformula to " << this << endl;
1153 current = ibegin(nucleus());
1155 mathed_parse_cell(ar, str);
1159 //lyxerr << "searching '" << str << "' in " << this << ar << endl;
1161 for (DocIterator it = current; it != iend(nucleus()); increment(it)) {
1162 CursorSlice & top = it.back();
1163 MathArray const & a = top.asMathInset()->cell(top.idx_);
1164 if (a.matchpart(ar, top.pos_)) {
1165 bv->cursor().setSelection(it, ar.size());
1167 top.pos_ += ar.size();
1173 //lyxerr << "not found!" << endl;
1180 void MathHullInset::write(Buffer const &, std::ostream & os) const
1182 WriteStream wi(os, false, false);
1188 void MathHullInset::read(Buffer const &, LyXLex & lex)
1191 mathed_parse_normal(at, lex);
1192 operator=(*at->asHullInset());
1196 int MathHullInset::plaintext(Buffer const &, ostream & os,
1197 OutputParams const &) const
1199 if (0 && display()) {
1203 TextPainter tpain(dim.width(), dim.height());
1204 drawT(tpain, 0, dim.ascent());
1206 // reset metrics cache to "real" values
1208 return tpain.textheight();
1210 WriteStream wi(os, false, true);
1211 wi << ' ' << cell(0) << ' ';
1217 int MathHullInset::linuxdoc(Buffer const & buf, ostream & os,
1218 OutputParams const & runparams) const
1220 return docbook(buf, os, runparams);
1224 int MathHullInset::docbook(Buffer const & buf, ostream & os,
1225 OutputParams const & runparams) const
1227 MathMLStream ms(os);
1228 ms << MTag("equation");
1231 int res = plaintext(buf, ms.os(), runparams);
1235 MathGridInset::mathmlize(ms);
1237 ms << ETag("equation");
1238 return ms.line() + res;