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
This commit is contained in:
André Pönitz 2001-11-13 16:27:06 +00:00
parent ebcc9580c9
commit f3c27aa1f5
6 changed files with 127 additions and 2 deletions

View File

@ -39,6 +39,8 @@ libmathed_la_SOURCES = \
math_defs.h \ math_defs.h \
math_deliminset.C \ math_deliminset.C \
math_deliminset.h \ math_deliminset.h \
math_diffinset.C \
math_diffinset.h \
math_diminset.C \ math_diminset.C \
math_diminset.h \ math_diminset.h \
math_dotsinset.C \ math_dotsinset.C \

View File

@ -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";
}

View File

@ -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

View File

@ -1,8 +1,8 @@
#include "math_exintinset.h" #include "math_exintinset.h"
#include "math_support.h" #include "math_support.h"
#include "debug.h"
#include "math_mathmlstream.h" #include "math_mathmlstream.h"
#include "math_symbolinset.h" #include "math_symbolinset.h"
#include "debug.h"
MathExIntInset::MathExIntInset(string const & name) MathExIntInset::MathExIntInset(string const & name)

View 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) void extractStructure(MathArray & ar)
{ {
extractMatrices(ar); extractMatrices(ar);
@ -410,6 +424,7 @@ void extractStructure(MathArray & ar)
extractFunctions(ar); extractFunctions(ar);
extractIntegrals(ar); extractIntegrals(ar);
extractSums(ar); extractSums(ar);
extractDiff(ar);
extractStrings(ar); extractStrings(ar);
} }

View File

@ -62,7 +62,7 @@ void MathFracInset::normalize(NormalStream & os) const
void MathFracInset::maplize(MapleStream & os) const void MathFracInset::maplize(MapleStream & os) const
{ {
os << '(' << cell(0) << '/' << cell(1) << ')'; os << '(' << cell(0) << ")/(" << cell(1) << ')';
} }