From: André Pönitz Date: Tue, 13 Nov 2001 16:27:06 +0000 (+0000) Subject: add paranthesis around numerator and denominator when exporting fractions X-Git-Tag: 1.6.10~20341 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=f3c27aa1f54fe551abe59ffe41a8505181e600d4;p=features.git add paranthesis around numerator and denominator when exporting fractions new inset for derivatives git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3024 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/mathed/Makefile.am b/src/mathed/Makefile.am index f8988ad326..bdc3367f2e 100644 --- a/src/mathed/Makefile.am +++ b/src/mathed/Makefile.am @@ -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 index 0000000000..c05620e98a --- /dev/null +++ b/src/mathed/math_diffinset.C @@ -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 index 0000000000..3957a8f21d --- /dev/null +++ b/src/mathed/math_diffinset.h @@ -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 diff --git a/src/mathed/math_exintinset.C b/src/mathed/math_exintinset.C index 7bb6e89904..b49f2246c5 100644 --- a/src/mathed/math_exintinset.C +++ b/src/mathed/math_exintinset.C @@ -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) diff --git a/src/mathed/math_extern.C b/src/mathed/math_extern.C index cfdc432cbd..a34b045612 100644 --- a/src/mathed/math_extern.C +++ b/src/mathed/math_extern.C @@ -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); } diff --git a/src/mathed/math_fracinset.C b/src/mathed/math_fracinset.C index f5c90d775c..bd08250864 100644 --- a/src/mathed/math_fracinset.C +++ b/src/mathed/math_fracinset.C @@ -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) << ')'; }