string s;
MathTextCodes c;
charSequence(ar.begin(), ar.end(), s, c);
- std::istringstream is(s);
+ std::istringstream is(s.c_str());
is >> i;
return is;
}
}
+//
+// 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
string s;
if (!extractString((*it).nucleus(), s))
return false;
- std::istringstream is(s);
+ std::istringstream is(s.c_str());
is >> i;
return is;
}
// collect function, let jt point behind last used item
MathArray::iterator jt = it + 1;
- int n = 1;
+ //int n = 1;
MathArray & numer = f->cell(0);
if (numer.size() > 1 && numer.at(1)->asScriptInset()) {
// this is something like d^n f(x) / d... or d^n / d...
// FIXME
- n = 1;
+ //n = 1;
if (numer.size() > 2)
diff->cell(0) = MathArray(numer.begin() + 2, numer.end());
else
// things like d.../dx^n
int mult = 1;
if (extractNumber(script->up().data_, mult)) {
- lyxerr << "mult: " << mult << endl;
+ lyxerr << "mult: " << mult << std::endl;
for (int i = 0; i < mult; ++i)
diff->addDer(MathArray(dt + 1, st));
}
lyxerr << "\nDiffs to: " << ar << "\n";
}
+
+
//
// combine searches
//
extractIntegrals(ar);
extractSums(ar);
extractDiff(ar);
+ extractExps(ar);
extractStrings(ar);
}
MathArray ar = dat;
extractStrings(ar);
for (MathArray::const_iterator it = ar.begin(); it != ar.end(); ++it) {
- wi.firstitem = (it == ar.begin());
+ wi.firstitem() = (it == ar.begin());
MathInset const * p = it->nucleus();
if (it + 1 != ar.end()) {
if (MathScriptInset const * q = asScript(it)) {
- q->write(p, wi);
+ q->write2(p, wi);
++it;
continue;
}
MathInset const * p = it->nucleus();
if (it + 1 != ar.end()) {
if (MathScriptInset const * q = asScript(it)) {
- q->octavize(p, os);
+ q->octavize2(p, os);
++it;
continue;
}
MathInset const * p = it->nucleus();
if (it + 1 != ar.end()) {
if (MathScriptInset const * q = asScript(it)) {
- q->maplize(p, os);
+ q->maplize2(p, os);
++it;
continue;
}
MathInset const * p = it->nucleus();
if (it + 1 != ar.end()) {
if (MathScriptInset const * q = asScript(it)) {
- q->mathmlize(p, os);
+ q->mathmlize2(p, os);
++it;
continue;
}