]> git.lyx.org Git - features.git/commitdiff
*** empty log message ***
authorAndré Pönitz <poenitz@gmx.net>
Thu, 15 Nov 2001 15:14:27 +0000 (15:14 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Thu, 15 Nov 2001 15:14:27 +0000 (15:14 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3033 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/ChangeLog
src/mathed/formula.C
src/mathed/math_extern.C
src/mathed/math_funcinset.C
src/mathed/math_stringinset.C

index c02865ed518c2da2587a17915913c360e5db5cb9..dabc4ff5be86de054167ff148a50f5f27844df59 100644 (file)
@@ -1,3 +1,8 @@
+
+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): 
index a4441609b2bc5b406b0232a005a14351829c0247..0ef83f5d8bcae1a16079529236b37d486583ac4d 100644 (file)
@@ -505,6 +505,7 @@ InsetFormula::localDispatch(BufferView * bv, kb_action action,
 
 bool needEqnArray(string const & extra)
 {
+       return false;
        return extra == "dsolve";
 }
 
index ae162c54356a8b98a0032664261b0925a35ccf3f..ff48405a759a6c1f085654645991dd54f1d8e8f7 100644 (file)
@@ -293,6 +293,38 @@ void splitScripts(MathArray & ar)
 }
 
 
+//
+// 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
@@ -669,6 +701,7 @@ void extractStructure(MathArray & ar)
        extractIntegrals(ar);
        extractSums(ar);
        extractDiff(ar);
+       extractExps(ar);
        extractStrings(ar);
 }
 
index c2bf78c27795c98b54a77a8e2418bf4cd6ca4e3d..b8cf2d182985e6dc2c40ee4d198a0336f9904816 100644 (file)
@@ -36,18 +36,6 @@ void MathFuncInset::setName(string const & n)
 }
 
 
-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;
@@ -63,7 +51,7 @@ void MathFuncInset::draw(Painter & pain, int x, int y) const
 
 void MathFuncInset::maplize(MapleStream & os) const
 {
-       os << name_.c_str();
+       os << ' ' << name_.c_str();
 }
 
 
@@ -75,5 +63,17 @@ void MathFuncInset::mathmlize(MathMLStream & os) const
 
 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() << ' ';
 }
index 6a41af3cd96b3dd3493004a32a2f514e702acc7f..901a5135841a6ff95d49e55341f5b1fea045a5b4 100644 (file)
@@ -59,15 +59,6 @@ void MathStringInset::draw(Painter & pain, int x, int y) const
 }
 
 
-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" << "]";
@@ -77,7 +68,7 @@ void MathStringInset::normalize(NormalStream & os) const
 void MathStringInset::maplize(MapleStream & os) const
 {
        if (code_ != LM_TC_VAR || str_.size() <= 1) {
-               os << str_.c_str();
+               os << ' ' << str_.c_str() << ' ';
                return;
        }       
 
@@ -91,7 +82,7 @@ void MathStringInset::maplize(MapleStream & os) const
 void MathStringInset::octavize(OctaveStream & os) const
 {
        if (code_ != LM_TC_VAR || str_.size() <= 1) {
-               os << str_.c_str();
+               os << ' ' << str_.c_str() << ' ';
                return;
        }       
 
@@ -113,3 +104,12 @@ void MathStringInset::mathmlize(MathMLStream & os) const
        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();
+}