* Licence details can be found in the file COPYING.
*
* \author Alejandro Aguilar Sierra
- * \author André Pönitz
+ * \author André Pönitz
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "InsetMathRoot.h"
+
+#include "LaTeXFeatures.h"
#include "MathData.h"
#include "MathStream.h"
#include "Cursor.h"
namespace lyx {
-InsetMathRoot::InsetMathRoot()
- : InsetMathNest(2)
+InsetMathRoot::InsetMathRoot(Buffer * buf)
+ : InsetMathNest(buf, 2)
{}
dim.des = max(dim0.descent() - 5, dim1.descent()) + 2;
dim.wid = dim0.width() + dim1.width() + 10;
metricsMarkers(dim);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
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);
}
void InsetMathRoot::write(WriteStream & os) const
{
+ MathEnsurer ensurer(os);
os << "\\sqrt[" << cell(0) << "]{" << cell(1) << '}';
}
}
+void InsetMathRoot::htmlize(HtmlStream & os) const
+{
+ os << MTag("span", "class='root'")
+ << MTag("sup") << cell(0) << ETag("sup")
+ << from_ascii("√")
+ << MTag("span", "class='rootof'") << cell(1) << ETag("span")
+ << ETag("span");
+}
+
+
+void InsetMathRoot::validate(LaTeXFeatures & features) const
+{
+ if (features.runparams().math_flavor == OutputParams::MathAsHTML)
+ features.addPreambleSnippet("<style type=\"text/css\">\n"
+ "span.rootof{border-top: thin solid black;}\n"
+ "span.root sup{font-size: 75%;}\n"
+ "</style>");
+ InsetMathNest::validate(features);
+}
+
} // namespace lyx