]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_symbolinset.C
Fix reading of math macros
[lyx.git] / src / mathed / math_symbolinset.C
index 36f6fcf88ccafe98f5ebe4a3e1f534e4cad184c5..71fc0ecf16eb562f77a2e426d3a758af8533562d 100644 (file)
@@ -1,6 +1,5 @@
-
 #ifdef __GNUG__
-#pragma implementation 
+#pragma implementation
 #endif
 
 #include <config.h>
@@ -48,6 +47,7 @@ void MathSymbolInset::metrics(MathMetricsInfo & mi) const
        //      << "' drawn as: '" << sym_->draw
        //      << "'\n";
 
+       int const em = mathed_char_width(mi.base.font, 'M');
        MathFontSetChanger dummy(mi.base, sym_->inset.c_str());
        mathed_string_dim(mi.base.font, sym_->draw, dim_);
        // correct height for broken cmex and wasy font
@@ -57,15 +57,10 @@ void MathSymbolInset::metrics(MathMetricsInfo & mi) const
                dim_.d -= h_;
        }
        // seperate things a bit
-       int em = mathed_char_width(mi.base.font, 'M');
-       if (name() == "not")
-               // \not is a special case. 
-               // It must have 0 width to align properly with the next symbol.
-               dim_.w = 0;
-       else if (isRelOp())
+       if (isRelOp())
                dim_.w += static_cast<int>(0.5*em+0.5);
        else
-               dim_.w += static_cast<int>(0.15*em+0.5);
+               dim_.w += static_cast<int>(0.1667*em+0.5);
 
        scriptable_ = false;
        if (mi.base.style == LM_ST_DISPLAY)
@@ -80,13 +75,11 @@ void MathSymbolInset::draw(MathPainterInfo & pi, int x, int y) const
        //      << "' in font: '" << sym_->inset
        //      << "' drawn as: '" << sym_->draw
        //      << "'\n";
-       int em = mathed_char_width(pi.base.font, 'M');
-       // Here we don't need a special case for \not, as it needs the same
-       // increase in x as the next symbol.
+       int const em = mathed_char_width(pi.base.font, 'M');
        if (isRelOp())
                x += static_cast<int>(0.25*em+0.5);
        else
-               x += static_cast<int>(0.075*em+0.5);
+               x += static_cast<int>(0.0833*em+0.5);
 
        MathFontSetChanger dummy(pi.base, sym_->inset.c_str());
        drawStr(pi, pi.base.font, x, y - h_, sym_->draw);
@@ -123,7 +116,7 @@ void MathSymbolInset::validate(LaTeXFeatures & features) const
 
 void MathSymbolInset::normalize(NormalStream & os) const
 {
-       os << "[symbol " << name() << "]";
+       os << "[symbol " << name() << ']';
 }
 
 
@@ -137,6 +130,17 @@ void MathSymbolInset::maplize(MapleStream & os) const
                os << name();
 }
 
+void MathSymbolInset::maximize(MaximaStream & os) const
+{
+       if (name() == "cdot")
+               os << '*';
+       else if (name() == "infty")
+               os << "INF";
+       else
+               os << name();
+}
+
+
 void MathSymbolInset::mathematicize(MathematicaStream & os) const
 {
        if ( name() == "pi")    { os << "Pi"; return;}