]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_macrotemplate.C
make \newcommand{\bb}[1]{\mathbf{#1}} work for read/write/display.
[lyx.git] / src / mathed / math_macrotemplate.C
index 2e9c9d2ef10bc5963d307e9a6a477134067ea308..3fe31bc7b7477df0fb072a87e6973c080ebf6d9b 100644 (file)
@@ -3,6 +3,7 @@
 #endif
 
 #include "math_macrotemplate.h"
+#include "math_mathmlstream.h"
 #include "Painter.h"
 #include "debug.h"
 
@@ -15,10 +16,9 @@ MathMacroTemplate::MathMacroTemplate()
 MathMacroTemplate::MathMacroTemplate(string const & nm, int numargs)
        : MathNestInset(1), numargs_(numargs), name_(nm)
 {
-       if (numargs_ > 9) {
+       if (numargs_ > 9)
                lyxerr << "MathMacroTemplate::MathMacroTemplate: wrong # of arguments: "
                        << numargs_ << std::endl;
-       }
 }
 
 
@@ -47,15 +47,6 @@ string const & MathMacroTemplate::name() const
 }
 
 
-void MathMacroTemplate::write(MathWriteInfo & os) const
-{
-       os << "\n\\newcommand{\\" << name_ << '}';
-       if (numargs_ > 0)
-               os << '[' << numargs_ << ']';
-       os << '{' << cell(0) << "}\n";
-}
-
-
 void MathMacroTemplate::metrics(MathMetricsInfo const & mi) const
 {
        xcell(0).metrics(mi);
@@ -70,3 +61,12 @@ void MathMacroTemplate::draw(Painter & pain, int x, int y) const
        xcell(0).draw(pain, x + 2, y + 1);
        pain.rectangle(x, y - ascent(), width(), height(), LColor::blue);
 }
+
+
+void MathMacroTemplate::write(WriteStream & os) const
+{
+       os << "\n\\newcommand{\\" << name_.c_str() << '}';
+       if (numargs_ > 0)
+               os << '[' << numargs_ << ']';
+       os << '{' << cell(0) << "}\n";
+}