]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_arrayinset.C
Fix reading of math macros
[lyx.git] / src / mathed / math_arrayinset.C
index d785b4cede6cb2707d87007380641cd5d78c058f..6bddbe3be5429fd80c0ba2b69616250726649ce1 100644 (file)
@@ -7,6 +7,7 @@
 #include "math_arrayinset.h"
 #include "math_parser.h"
 #include "math_mathmlstream.h"
+#include "math_metricsinfo.h"
 #include "math_streamstr.h"
 #include "Lsstream.h"
 
@@ -67,10 +68,15 @@ MathInset * MathArrayInset::clone() const
 
 void MathArrayInset::metrics(MathMetricsInfo & mi) const
 {
-       MathMetricsInfo m = mi;
-       if (m.base.style == LM_ST_DISPLAY)
-               m.base.style = LM_ST_TEXT;
-       MathGridInset::metrics(m);
+       MathArrayChanger dummy(mi.base);
+       MathGridInset::metrics(mi);
+}
+
+
+void MathArrayInset::draw(MathPainterInfo & pi, int x, int y) const
+{
+       MathArrayChanger dummy(pi.base);
+       MathGridInset::draw(pi, x, y);
 }
 
 
@@ -78,7 +84,7 @@ void MathArrayInset::write(WriteStream & os) const
 {
        if (os.fragile())
                os << "\\protect";
-       os << "\\begin{" << name_ << "}";
+       os << "\\begin{" << name_ << '}';
 
        if (v_align_ == 't' || v_align_ == 'b')
                os << '[' << char(v_align_) << ']';
@@ -88,15 +94,17 @@ void MathArrayInset::write(WriteStream & os) const
 
        if (os.fragile())
                os << "\\protect";
-       os << "\\end{" << name_ << "}\n";
+       os << "\\end{" << name_ << '}';
+       // adding a \n here is bad if the array is the last item
+       // in an \eqnarray...
 }
 
 
 void MathArrayInset::normalize(NormalStream & os) const
 {
-       os << "[" << name_ << " ";
+       os << '[' << name_ << ' ';
        MathGridInset::normalize(os);
-       os << "]";
+       os << ']';
 }
 
 
@@ -104,5 +112,5 @@ void MathArrayInset::maplize(MapleStream & os) const
 {
        os << "array(";
        MathGridInset::maplize(os);
-       os << ")";
+       os << ')';
 }