* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author André Pönitz
+ * \author André Pönitz
*
* Full author contact details are available in file CREDITS.
*/
#include "InsetMathBig.h"
+#include "Dimension.h"
+#include "LaTeXFeatures.h"
+
#include "MathSupport.h"
#include "MathStream.h"
#include "MetricsInfo.h"
{
// order: big Big bigg Bigg biggg Biggg
// 0 1 2 3 4 5
+ char_type const c = name_[name_.size() - 1];
+ int const base_size = (c == 'l' || c == 'm' || c == 'r') ? 4 : 3;
return name_[0] == 'B' ?
- 2 * (name_.size() - 4) + 1:
- 2 * (name_.size() - 4);
+ 2 * (name_.size() - base_size) + 1:
+ 2 * (name_.size() - base_size);
}
dim.wid = 6;
dim.asc = int(h + f * h);
dim.des = int(f * h);
- // Cache the inset dimension.
- setDimCache(mi, dim);
}
void InsetMathBig::write(WriteStream & os) const
{
+ MathEnsurer ensurer(os);
os << '\\' << name_ << delim_;
if (delim_[0] == '\\')
os.pendingSpace(true);
}
+void InsetMathBig::mathmlize(MathStream & os) const
+{
+ os << "<mo form='prefix' fence='true' stretchy='true' symmetric='true'>"
+ << convertDelimToXMLEscape(delim_)
+ << "</mo>";
+}
+
+
+void InsetMathBig::htmlize(HtmlStream & os) const
+{
+ std::string name;
+ switch (size()) {
+ case 0: case 1: name = "big"; break;
+ case 2: case 3: name = "bigg"; break;
+ case 4: case 5: name = "biggg"; break;
+ default: name = "big"; break;
+ }
+ os << MTag("span", "class='" + name + "symbol'")
+ << convertDelimToXMLEscape(delim_)
+ << ETag("span");
+}
+
+
void InsetMathBig::infoize2(odocstream & os) const
{
os << name_;
static char const * const delimiters[] = {
"(", ")", "\\{", "\\}", "\\lbrace", "\\rbrace", "[", "]",
"|", "/", "\\slash", "\\|", "\\vert", "\\Vert", "'",
- "\\\\", "\\backslash",
+ "<", ">", "\\\\", "\\backslash",
"\\langle", "\\lceil", "\\lfloor",
"\\rangle", "\\rceil", "\\rfloor",
"\\downarrow", "\\Downarrow",
}
+void InsetMathBig::validate(LaTeXFeatures & features) const
+{
+ if (features.runparams().math_flavor == OutputParams::MathAsHTML)
+ features.addCSSSnippet(
+ "span.bigsymbol{font-size: 150%;}\n"
+ "span.biggsymbol{font-size: 200%;}\n"
+ "span.bigggsymbol{font-size: 225%;}");
+}
+
+
} // namespace lyx