+
+void MathMacroTemplate::draw(MathPainterInfo & pi, int x, int y) const
+{
+ int const w0 = xcell(0).width();
+ int const w1 = xcell(1).width();
+ xcell(0).draw(pi, x + 2, y + 1);
+ pi.pain.rectangle(x, y - ascent() + 1, w0 + 4, height(),
+ LColor::blue);
+ xcell(1).draw(pi, x + 8 + w0, y + 1);
+ pi.pain.rectangle(x + w0 + 6 , y - ascent() + 1, w1 + 4,
+ height(), LColor::blue);
+}
+
+
+void MathMacroTemplate::write(WriteStream & os) const
+{
+ if (os.latex()) {
+ os << "\n\\newcommand{\\" << name_.c_str() << '}';
+ if (numargs_ > 0)
+ os << '[' << numargs_ << ']';
+ os << '{' << cell(0) << "}\n";
+ } else {
+ // writing .lyx
+ os << "\n\\newcommand{\\" << name_.c_str() << '}';
+ if (numargs_ > 0)
+ os << '[' << numargs_ << ']';
+ os << '{' << cell(0) << '}';
+ // write special .tex export only if necessary
+ if (!cell(1).empty())
+ os << "\n{" << cell(1) << '}';
+ }
+}