]> git.lyx.org Git - features.git/commitdiff
add paranthesis around numerator and denominator when exporting fractions
authorAndré Pönitz <poenitz@gmx.net>
Tue, 13 Nov 2001 16:27:06 +0000 (16:27 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Tue, 13 Nov 2001 16:27:06 +0000 (16:27 +0000)
new inset for derivatives

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3024 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/Makefile.am
src/mathed/math_diffinset.C [new file with mode: 0644]
src/mathed/math_diffinset.h [new file with mode: 0644]
src/mathed/math_exintinset.C
src/mathed/math_extern.C
src/mathed/math_fracinset.C

index f8988ad326b83b0558f9bd0e2a48ceeb62494ffb..bdc3367f2ea92ee09b902ed2d68f6b9cb575d20b 100644 (file)
@@ -39,6 +39,8 @@ libmathed_la_SOURCES = \
        math_defs.h \
        math_deliminset.C \
        math_deliminset.h \
+       math_diffinset.C \
+       math_diffinset.h \
        math_diminset.C \
        math_diminset.h \
        math_dotsinset.C \
diff --git a/src/mathed/math_diffinset.C b/src/mathed/math_diffinset.C
new file mode 100644 (file)
index 0000000..c05620e
--- /dev/null
@@ -0,0 +1,75 @@
+#include "math_diffinset.h"
+#include "math_support.h"
+#include "math_mathmlstream.h"
+#include "math_symbolinset.h"
+#include "debug.h"
+
+
+MathDiffInset::MathDiffInset()
+       : MathNestInset(1)
+{}
+
+
+MathInset * MathDiffInset::clone() const
+{
+       return new MathDiffInset(*this);
+}
+
+
+void MathDiffInset::addDer(MathArray const & der)
+{
+       cells_.push_back(MathXArray());
+       cells_.back().data_ = der;
+}
+
+
+void MathDiffInset::normalize(NormalStream & os) const
+{
+       os << "[diff";
+       for (idx_type idx = 0; idx < nargs(); ++idx)
+               os << ' ' << cell(idx);
+       os << ']';
+}
+
+
+void MathDiffInset::metrics(MathMetricsInfo const &) const
+{
+       lyxerr << "should not happen\n";
+}
+
+
+void MathDiffInset::draw(Painter &, int, int) const
+{  
+       lyxerr << "should not happen\n";
+}
+
+
+void MathDiffInset::maplize(MapleStream & os) const
+{
+       os << "diff(";
+       for (idx_type idx = 0; idx < nargs(); ++idx) {
+               if (idx != 0)
+                       os << ',';
+               os << cell(idx);
+       }
+       os << ')';
+}
+
+
+void MathDiffInset::mathmlize(MathMLStream & os) const
+{
+       os << "diff(";
+       for (idx_type idx = 0; idx < nargs(); ++idx) {
+               if (idx != 0)
+                       os << ',';
+               os << cell(idx);
+       }
+       os << ')';
+}
+
+
+void MathDiffInset::write(WriteStream &) const
+{
+       lyxerr << "should not happen\n";
+}
+
diff --git a/src/mathed/math_diffinset.h b/src/mathed/math_diffinset.h
new file mode 100644 (file)
index 0000000..3957a8f
--- /dev/null
@@ -0,0 +1,33 @@
+// -*- C++ -*-
+#ifndef MATH_DIFFINSET_H
+#define MATH_DIFFINSET_H
+
+// d f(x)/dx in one block
+// for interfacing external programs
+
+#include "math_nestinset.h"
+
+class MathDiffInset : public MathNestInset {
+public:
+       ///
+       explicit MathDiffInset();
+       ///
+       MathInset * clone() const;
+       ///
+       void addDer(MathArray const & der);
+       ///
+       void metrics(MathMetricsInfo const & st) const;
+       ///
+       void draw(Painter &, int x, int y) const;
+
+       ///
+       void normalize(NormalStream &) const;
+       ///
+       void maplize(MapleStream &) const;
+       ///
+       void mathmlize(MathMLStream &) const;
+       ///
+       void write(WriteStream & os) const;
+};
+
+#endif
index 7bb6e8990472435a2a2b83b291d882a961882ca1..b49f2246c585f20328e122b33cf450ea3c04c22d 100644 (file)
@@ -1,8 +1,8 @@
 #include "math_exintinset.h"
 #include "math_support.h"
-#include "debug.h"
 #include "math_mathmlstream.h"
 #include "math_symbolinset.h"
+#include "debug.h"
 
 
 MathExIntInset::MathExIntInset(string const & name)
index cfdc432cbd027cc547d6b0fbb613bb4694f652c6..a34b045612489bc0d6283ab6102560dc9ecedd2d 100644 (file)
@@ -403,6 +403,20 @@ void extractSums(MathArray & ar)
 }
 
 
+//
+// search differential stuff
+//
+
+void extractDiff(MathArray & ar)
+{
+       lyxerr << "\nDiffs from: " << ar << "\n";
+       lyxerr << "\nDiffs to: " << ar << "\n";
+}
+
+//
+// combine searches
+//
+
 void extractStructure(MathArray & ar)
 {
        extractMatrices(ar);
@@ -410,6 +424,7 @@ void extractStructure(MathArray & ar)
        extractFunctions(ar);
        extractIntegrals(ar);
        extractSums(ar);
+       extractDiff(ar);
        extractStrings(ar);
 }
 
index f5c90d775cf8ca08cbcd0d1df8ed36feb4d07190..bd082508647139534105e7fa90e449093a67867f 100644 (file)
@@ -62,7 +62,7 @@ void MathFracInset::normalize(NormalStream & os) const
 
 void MathFracInset::maplize(MapleStream & os) const
 {
-       os << '(' << cell(0) << '/' << cell(1) << ')';
+       os << '(' << cell(0) << ")/(" << cell(1) << ')';
 }