]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathRoot.cpp
Add support for stmaryrd.sty (bug #8434)
[lyx.git] / src / mathed / InsetMathRoot.cpp
index 7ca7706ba0dfbadda57adea73824bd909404e2f4..38ffb18ff3cecb28134fd6537eab05bed40da1c4 100644 (file)
@@ -12,8 +12,9 @@
 #include <config.h>
 
 #include "InsetMathRoot.h"
+
+#include "LaTeXFeatures.h"
 #include "MathData.h"
-#include "MathExtern.h"
 #include "MathStream.h"
 #include "Cursor.h"
 
@@ -61,12 +62,12 @@ void InsetMathRoot::draw(PainterInfo & pi, int x, int y) const
        int xp[4];
        int yp[4];
        pi.pain.line(x + dim.width(), y - a + 1,
-                                                        x + w + 4, y - a + 1, Color_math);
+                               x + w + 4, y - a + 1, pi.base.font.color());
        xp[0] = x + w + 4;         yp[0] = y - a + 1;
        xp[1] = x + w;             yp[1] = y + d;
        xp[2] = x + w - 2;         yp[2] = y + (d - a)/2 + 2;
        xp[3] = x + w - 5;         yp[3] = y + (d - a)/2 + 4;
-       pi.pain.lines(xp, yp, 4, Color_math);
+       pi.pain.lines(xp, yp, 4, pi.base.font.color());
        drawMarkers(pi, x, y);
 }
 
@@ -113,14 +114,29 @@ void InsetMathRoot::octave(OctaveStream & os) const
 }
 
 
-docstring InsetMathRoot::mathmlize(MathStream & os) const
+void InsetMathRoot::mathmlize(MathStream & os) const
+{
+       os << MTag("mroot") << cell(1) << cell(0) << ETag("mroot");
+}
+
+
+void InsetMathRoot::htmlize(HtmlStream & os) const
 {
-       os << MTag("mroot");
-       docstring rv = lyx::mathmlize(cell(1), os);
-       rv += lyx::mathmlize(cell(0), os);
-       os << ETag("mroot");
-       return rv;
+       os << MTag("span", "class='root'")
+          << MTag("sup") << cell(0) << ETag("sup")
+          << from_ascii("&radic;") 
+          << MTag("span", "class='rootof'")    << cell(1) << ETag("span") 
+                << ETag("span");
 }
 
 
+void InsetMathRoot::validate(LaTeXFeatures & features) const
+{
+       if (features.runparams().math_flavor == OutputParams::MathAsHTML)
+               features.addCSSSnippet(
+                       "span.rootof{border-top: thin solid black;}\n"
+                       "span.root sup{font-size: 75%;}");
+       InsetMathNest::validate(features);
+}
+
 } // namespace lyx