+
+2001-11-07 André Pönitz <poenitz@gmx.net>
+
+ * math_extern.C: support for integrals, sums, e^x, and d/dx
+
2001-11-15 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* math_extern.C (extractNumber):
bool needEqnArray(string const & extra)
{
+ return false;
return extra == "dsolve";
}
}
+//
+// extract exp(...)
+//
+
+void extractExps(MathArray & ar)
+{
+ lyxerr << "\nExps from: " << ar << "\n";
+
+ for (MathArray::size_type i = 0; i + 1 < ar.size(); ++i) {
+ MathArray::iterator it = ar.begin() + i;
+
+ // is this 'e'?
+ MathCharInset const * p = (*it)->asCharInset();
+ if (!p || p->getChar() != 'e')
+ continue;
+
+ // we need an exponent but no subscript
+ MathScriptInset * sup = (*(it + 1))->asScriptInset();
+ if (!sup || sup->hasDown())
+ continue;
+
+ // create a proper exp-inset as replacement
+ MathExFuncInset * func = new MathExFuncInset("exp");
+ func->cell(0) = sup->cell(1);
+
+ // clean up
+ (*it).reset(func);
+ ar.erase(it + 1);
+ }
+ lyxerr << "\nExps to: " << ar << "\n";
+}
+
//
// search deliminiters
extractIntegrals(ar);
extractSums(ar);
extractDiff(ar);
+ extractExps(ar);
extractStrings(ar);
}
}
-void MathFuncInset::write(WriteStream & os) const
-{
- os << "\\" << name_.c_str() << ' ';
-}
-
-
-void MathFuncInset::normalize(NormalStream & os) const
-{
- os << "[func " << name_.c_str() << ']';
-}
-
-
void MathFuncInset::metrics(MathMetricsInfo const & mi) const
{
mi_ = mi;
void MathFuncInset::maplize(MapleStream & os) const
{
- os << name_.c_str();
+ os << ' ' << name_.c_str();
}
void MathFuncInset::octavize(OctaveStream & os) const
{
- os << name_.c_str();
+ os << ' ' << name_.c_str();
+}
+
+
+void MathFuncInset::normalize(NormalStream & os) const
+{
+ os << "[func " << name_.c_str() << ']';
+}
+
+
+void MathFuncInset::write(WriteStream & os) const
+{
+ os << "\\" << name_.c_str() << ' ';
}
}
-void MathStringInset::write(WriteStream & os) const
-{
- if (math_font_name(code_))
- os << '\\' << math_font_name(code_) << '{' << str_.c_str() << '}';
- else
- os << str_.c_str();
-}
-
-
void MathStringInset::normalize(NormalStream & os) const
{
os << "[string " << str_.c_str() << ' ' << "mathalpha" << "]";
void MathStringInset::maplize(MapleStream & os) const
{
if (code_ != LM_TC_VAR || str_.size() <= 1) {
- os << str_.c_str();
+ os << ' ' << str_.c_str() << ' ';
return;
}
void MathStringInset::octavize(OctaveStream & os) const
{
if (code_ != LM_TC_VAR || str_.size() <= 1) {
- os << str_.c_str();
+ os << ' ' << str_.c_str() << ' ';
return;
}
else
os << str_.c_str();
}
+
+
+void MathStringInset::write(WriteStream & os) const
+{
+ if (math_font_name(code_))
+ os << '\\' << math_font_name(code_) << '{' << str_.c_str() << '}';
+ else
+ os << str_.c_str();
+}