LM_OT_MAX
};
-
-///
-enum MathSymbolTypes {
- ///
- LMB_NONE = 0,
- ///
- LMB_RELATION,
- ///
- LMB_OPERATOR
-};
-
#endif
void MathExIntInset::mathmlize(MathMLStream & os) const
{
- //os << name_.c_str() << '(' << cell(0) << ')';
+ if (hasScripts())
+ scripts_->asScriptInset()->mathmlize(int_.nucleus(), os);
+ else
+ int_->mathmlize(os);
+ os << core_ << "<mo> ⁢ </mo>"
+ << MTag("mrow") << "<mo> ⅆ </mo>"
+ << diff_ << ETag("mrow");
}
MathArray::iterator jt =
endNestSearch(it, ar.end(), intSymbolTest, differentialTest);
+ // something sensible found?
+ if (jt == ar.end())
+ continue;
+
// create a proper inset as replacement
MathExIntInset * p = new MathExIntInset;
}
-void MathGridInset::write(WriteStream & os) const
-{
- for (row_type row = 0; row < nrows(); ++row) {
- for (col_type col = 0; col < ncols(); ++col)
- os << cell(index(row, col)) << eocString(col).c_str();
- os << eolString(row).c_str();
- }
-}
-
-
-void MathGridInset::normalize(NormalStream & os) const
-{
- os << "[grid ";
- for (row_type row = 0; row < nrows(); ++row) {
- os << "[row ";
- for (col_type col = 0; col < ncols(); ++col)
- os << "[cell " << cell(index(row, col)) << ']';
- os << ']';
- }
- os << ']';
-}
-
-
string MathGridInset::eolString(row_type row) const
{
if (row + 1 == nrows())
return res;
}
+
+
+void MathGridInset::normalize(NormalStream & os) const
+{
+ os << "[grid ";
+ for (row_type row = 0; row < nrows(); ++row) {
+ os << "[row ";
+ for (col_type col = 0; col < ncols(); ++col)
+ os << "[cell " << cell(index(row, col)) << ']';
+ os << ']';
+ }
+ os << ']';
+}
+
+
+void MathGridInset::mathmlize(MathMLStream & os) const
+{
+ os << MTag("mtable");
+ for (row_type row = 0; row < nrows(); ++row) {
+ os << MTag("mtr");
+ for (col_type col = 0; col < ncols(); ++col)
+ os << cell(index(row, col));
+ os << ETag("mtr");
+ }
+ os << ETag("mtable");
+}
+
+
+void MathGridInset::write(WriteStream & os) const
+{
+ for (row_type row = 0; row < nrows(); ++row) {
+ for (col_type col = 0; col < ncols(); ++col)
+ os << cell(index(row, col)) << eocString(col).c_str();
+ os << eolString(row).c_str();
+ }
+}
+
+
void write(WriteStream & os) const;
///
void normalize(NormalStream &) const;
-/*
///
- void maplize(MapleStream &) const;
+ //void maplize(MapleStream &) const;
///
void mathmlize(MathMLStream &) const;
///
- void octavize(OctaveStream &) const;
-*/
+ //void octavize(OctaveStream &) const;
protected:
/// returns proper 'end of line' code for LaTeX
}
-MathSymbolTypes symbolType(const string & type)
-{
- if (type == "mathrel")
- return LMB_RELATION;
- if (type == "mathbin")
- return LMB_OPERATOR;
- return LMB_NONE;
-}
-
-
void readSymbols(string const & filename)
{
LyXLex lex(0, 0);
if (lex.next())
tmp.id = lex.getInteger();
if (lex.next())
- tmp.type = symbolType(lex.getString());
+ tmp.type = lex.getString();
if (theWordList.find(tmp.name) != theWordList.end())
lyxerr << "readSymbols: token " << tmp.name
<< " already exists.\n";
tmp.name = p->name;
tmp.token = p->token;
tmp.id = p->id;
- tmp.type = LMB_NONE;
tmp.latex_font_id = 0;
theWordList[p->name] = tmp;
}
}
-void MathHullInset::mathmlize(MathMLStream & os) const
-{
- MathGridInset::mathmlize(os);
-}
-
-
string MathHullInset::label(row_type row) const
{
return label_[row];
}
+void MathHullInset::mathmlize(MathMLStream & os) const
+{
+ MathGridInset::mathmlize(os);
+}
+
+
///
MathInset * clone() const;
///
- void write(WriteStream & os) const;
- ///
- void normalize(NormalStream &) const;
- ///
void metrics(MathMetricsInfo const & st) const;
///
void draw(Painter &, int x, int y) const;
///
MathInsetTypes getType() const;
///
+ void write(WriteStream & os) const;
+ ///
void mathmlize(MathMLStream &) const;
+ ///
+ void normalize(NormalStream &) const;
private:
///
MathMLStream::MathMLStream(std::ostream & os)
- : os_(os), tab_(0), line_(0)
+ : os_(os), tab_(0), line_(0), lastchar_(0)
{}
int tab_;
///
int line_;
+ ///
+ char lastchar_;
};
void MathMatrixInset::mathmlize(MathMLStream & os) const
{
- os << MTag("mtable");
- for (row_type row = 0; row < nrows(); ++row) {
- os << MTag("mtr");
- for (col_type col = 0; col < ncols(); ++col)
- os << cell(index(row, col));
- os << ETag("mtr");
- }
- os << ETag("mtable");
+ MathGridInset::mathmlize(os);
}
///
unsigned char latex_font_id;
///
- MathSymbolTypes type;
+ string type;
};
void MathStringInset::mathmlize(MathMLStream & os) const
{
if (code_ == LM_TC_VAR)
- os << "<mi>" << str_.c_str() << "</mi>";
+ os << "<mi> " << str_.c_str() << " </mi>";
else if (code_ == LM_TC_CONST)
- os << "<mn>" << str_.c_str() << "</mn>";
+ os << "<mn> " << str_.c_str() << " </mn>";
else if (code_ == LM_TC_RM || code_ == LM_TC_TEXTRM)
- os << "<mtext>" << str_.c_str() << "</mtext>";
+ os << "<mtext> " << str_.c_str() << " </mtext>";
else
os << str_.c_str();
}
#include "math_symbolinset.h"
-#include "math_parser.h"
#include "math_mathmlstream.h"
#include "math_support.h"
+#include "math_parser.h"
#include "debug.h"
bool MathSymbolInset::isRelOp() const
{
- return sym_->type == LMB_RELATION;
+ return sym_->type == "mathrel";
}
}
+char const * MathMLtype(string const & s)
+{
+ if (s == "mathop")
+ return "mo";
+ return "mi";
+}
+
+
void MathSymbolInset::mathmlize(MathMLStream & os) const
{
- os << name().c_str();
+ char const * type = MathMLtype(sym_->type);
+ os << '<' << type << "> " << name().c_str() << " </" << type << '>';
}