2001-06-25 00:06:33 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "math_scriptinset.h"
|
2001-11-08 12:15:12 +00:00
|
|
|
#include "math_support.h"
|
2001-11-27 13:57:49 +00:00
|
|
|
#include "math_symbolinset.h"
|
2001-11-08 12:06:56 +00:00
|
|
|
#include "math_mathmlstream.h"
|
|
|
|
#include "support/LAssert.h"
|
2001-11-27 13:57:49 +00:00
|
|
|
#include "debug.h"
|
2001-10-24 16:10:38 +00:00
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
|
2002-02-16 15:59:55 +00:00
|
|
|
using std::max;
|
|
|
|
|
|
|
|
|
2001-10-12 12:02:49 +00:00
|
|
|
MathScriptInset::MathScriptInset()
|
|
|
|
: MathNestInset(2), limits_(0)
|
|
|
|
{
|
|
|
|
script_[0] = false;
|
|
|
|
script_[1] = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-09-11 10:58:17 +00:00
|
|
|
MathScriptInset::MathScriptInset(bool up)
|
2001-10-12 12:02:49 +00:00
|
|
|
: MathNestInset(2), limits_(0)
|
|
|
|
{
|
|
|
|
script_[0] = !up;
|
|
|
|
script_[1] = up;
|
|
|
|
}
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
|
2001-06-28 10:25:20 +00:00
|
|
|
MathInset * MathScriptInset::clone() const
|
2001-06-25 00:06:33 +00:00
|
|
|
{
|
2001-09-11 10:58:17 +00:00
|
|
|
return new MathScriptInset(*this);
|
2001-07-26 06:46:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-09-24 16:25:06 +00:00
|
|
|
MathScriptInset const * MathScriptInset::asScriptInset() const
|
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2001-10-12 12:02:49 +00:00
|
|
|
|
|
|
|
MathScriptInset * MathScriptInset::asScriptInset()
|
2001-07-26 06:46:50 +00:00
|
|
|
{
|
2001-10-12 12:02:49 +00:00
|
|
|
return this;
|
2001-07-26 06:46:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-10-12 12:02:49 +00:00
|
|
|
MathXArray const & MathScriptInset::up() const
|
2001-07-26 06:46:50 +00:00
|
|
|
{
|
2001-10-12 12:02:49 +00:00
|
|
|
return xcell(1);
|
2001-07-26 06:46:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-10-12 12:02:49 +00:00
|
|
|
MathXArray const & MathScriptInset::down() const
|
|
|
|
{
|
|
|
|
return xcell(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MathXArray & MathScriptInset::up()
|
|
|
|
{
|
|
|
|
return xcell(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MathXArray & MathScriptInset::down()
|
2001-09-11 10:58:17 +00:00
|
|
|
{
|
2001-10-12 12:02:49 +00:00
|
|
|
return xcell(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathScriptInset::ensure(bool up)
|
|
|
|
{
|
|
|
|
script_[up] = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int MathScriptInset::dy0(MathInset const * nuc) const
|
|
|
|
{
|
|
|
|
int nd = ndes(nuc);
|
|
|
|
if (!hasDown())
|
|
|
|
return nd;
|
|
|
|
int des = down().ascent();
|
|
|
|
if (hasLimits(nuc))
|
|
|
|
des += nd + 2;
|
2002-03-21 17:42:56 +00:00
|
|
|
else
|
2002-02-16 15:59:55 +00:00
|
|
|
des = max(des, nd);
|
2001-10-12 12:02:49 +00:00
|
|
|
return des;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int MathScriptInset::dy1(MathInset const * nuc) const
|
|
|
|
{
|
|
|
|
int na = nasc(nuc);
|
|
|
|
if (!hasUp())
|
|
|
|
return na;
|
|
|
|
int asc = up().descent();
|
|
|
|
if (hasLimits(nuc))
|
|
|
|
asc += na + 2;
|
2002-03-21 17:42:56 +00:00
|
|
|
else
|
2002-02-16 15:59:55 +00:00
|
|
|
asc = max(asc, na);
|
2002-03-19 16:55:58 +00:00
|
|
|
asc = max(asc, mathed_char_ascent(font_, 'I'));
|
2001-10-12 12:02:49 +00:00
|
|
|
return asc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int MathScriptInset::dx0(MathInset const * nuc) const
|
|
|
|
{
|
|
|
|
lyx::Assert(hasDown());
|
2002-01-08 11:03:34 +00:00
|
|
|
return hasLimits(nuc) ? (width2(nuc) - down().width()) / 2 : nwid(nuc);
|
2001-10-12 12:02:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int MathScriptInset::dx1(MathInset const * nuc) const
|
|
|
|
{
|
|
|
|
lyx::Assert(hasUp());
|
2002-01-08 11:03:34 +00:00
|
|
|
return hasLimits(nuc) ? (width2(nuc) - up().width()) / 2 : nwid(nuc);
|
2001-10-12 12:02:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int MathScriptInset::dxx(MathInset const * nuc) const
|
|
|
|
{
|
|
|
|
//lyx::Assert(nuc());
|
2002-01-08 11:03:34 +00:00
|
|
|
return hasLimits(nuc) ? (width2(nuc) - nwid(nuc)) / 2 : 0;
|
2001-10-12 12:02:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-01-08 11:03:34 +00:00
|
|
|
int MathScriptInset::ascent2(MathInset const * nuc) const
|
2001-10-12 12:02:49 +00:00
|
|
|
{
|
|
|
|
return dy1(nuc) + (hasUp() ? up().ascent() : 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-01-08 11:03:34 +00:00
|
|
|
int MathScriptInset::descent2(MathInset const * nuc) const
|
2001-10-12 12:02:49 +00:00
|
|
|
{
|
|
|
|
return dy0(nuc) + (hasDown() ? down().descent() : 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-01-08 11:03:34 +00:00
|
|
|
int MathScriptInset::width2(MathInset const * nuc) const
|
2001-10-12 12:02:49 +00:00
|
|
|
{
|
|
|
|
int wid = 0;
|
|
|
|
if (hasLimits(nuc)) {
|
|
|
|
wid = nwid(nuc);
|
|
|
|
if (hasUp())
|
2002-02-16 15:59:55 +00:00
|
|
|
wid = max(wid, up().width());
|
2001-10-12 12:02:49 +00:00
|
|
|
if (hasDown())
|
2002-02-16 15:59:55 +00:00
|
|
|
wid = max(wid, down().width());
|
2001-10-12 12:02:49 +00:00
|
|
|
} else {
|
|
|
|
if (hasUp())
|
2002-02-16 15:59:55 +00:00
|
|
|
wid = max(wid, up().width());
|
2001-10-12 12:02:49 +00:00
|
|
|
if (hasDown())
|
2002-02-16 15:59:55 +00:00
|
|
|
wid = max(wid, down().width());
|
2001-10-12 12:02:49 +00:00
|
|
|
wid += nwid(nuc);
|
|
|
|
}
|
|
|
|
return wid;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int MathScriptInset::nwid(MathInset const * nuc) const
|
|
|
|
{
|
2002-03-19 16:55:58 +00:00
|
|
|
return nuc ? nuc->width() : mathed_char_width(font_, '.');
|
2001-10-12 12:02:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int MathScriptInset::nasc(MathInset const * nuc) const
|
|
|
|
{
|
2002-03-19 16:55:58 +00:00
|
|
|
return nuc ? nuc->ascent() : mathed_char_ascent(font_, 'I');
|
2001-10-12 12:02:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int MathScriptInset::ndes(MathInset const * nuc) const
|
|
|
|
{
|
2002-03-19 16:55:58 +00:00
|
|
|
return nuc ? nuc->descent() : mathed_char_descent(font_, 'I');
|
2001-10-12 12:02:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-05-30 07:09:54 +00:00
|
|
|
void MathScriptInset::metrics(MathMetricsInfo & mi) const
|
2002-03-21 17:42:56 +00:00
|
|
|
{
|
2001-10-22 15:37:49 +00:00
|
|
|
metrics(0, mi);
|
2001-10-12 12:02:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-05-30 07:09:54 +00:00
|
|
|
void MathScriptInset::metrics(MathInset const * nuc, MathMetricsInfo & mi) const
|
2002-03-21 17:42:56 +00:00
|
|
|
{
|
2001-10-12 12:02:49 +00:00
|
|
|
if (nuc)
|
2001-10-22 15:37:49 +00:00
|
|
|
nuc->metrics(mi);
|
2002-06-18 15:44:30 +00:00
|
|
|
MathNestInset::metrics(mi);
|
|
|
|
MathScriptChanger dummy(mi.base);
|
2002-01-08 11:03:34 +00:00
|
|
|
ascent_ = ascent2(nuc);
|
|
|
|
descent_ = descent2(nuc);
|
|
|
|
width_ = width2(nuc);
|
2001-10-12 12:02:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-05-30 07:09:54 +00:00
|
|
|
void MathScriptInset::draw(MathPainterInfo & pi, int x, int y) const
|
2002-03-21 17:42:56 +00:00
|
|
|
{
|
2002-03-21 06:57:13 +00:00
|
|
|
//lyxerr << "unexpected call to MathScriptInset::draw()\n";
|
2002-05-30 07:09:54 +00:00
|
|
|
draw(0, pi, x, y);
|
2002-03-21 06:57:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-06-18 15:44:30 +00:00
|
|
|
void MathScriptInset::draw(MathInset const * nuc, MathPainterInfo & pi,
|
|
|
|
int x, int y) const
|
|
|
|
{
|
|
|
|
if (nuc)
|
|
|
|
nuc->draw(pi, x + dxx(nuc), y);
|
|
|
|
else if (editing())
|
|
|
|
drawStr(pi, font_, x + dxx(nuc), y, ".");
|
|
|
|
|
|
|
|
MathScriptChanger dummy(pi.base);
|
|
|
|
if (hasUp())
|
|
|
|
up().draw(pi, x + dx1(nuc), y - dy1(nuc));
|
|
|
|
if (hasDown())
|
|
|
|
down().draw(pi, x + dx0(nuc), y + dy0(nuc));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-21 06:57:13 +00:00
|
|
|
void MathScriptInset::metricsT(TextMetricsInfo const & mi) const
|
2002-03-21 17:42:56 +00:00
|
|
|
{
|
2002-03-21 06:57:13 +00:00
|
|
|
metricsT(0, mi);
|
2002-03-18 11:45:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-21 06:57:13 +00:00
|
|
|
void MathScriptInset::metricsT(MathInset const * nuc,
|
2002-03-18 11:45:53 +00:00
|
|
|
TextMetricsInfo const & mi) const
|
2002-03-21 17:42:56 +00:00
|
|
|
{
|
2002-03-19 16:55:58 +00:00
|
|
|
if (hasUp())
|
2002-03-21 06:57:13 +00:00
|
|
|
up().metricsT(mi);
|
2002-03-19 16:55:58 +00:00
|
|
|
if (hasDown())
|
2002-03-21 06:57:13 +00:00
|
|
|
down().metricsT(mi);
|
2002-03-18 11:45:53 +00:00
|
|
|
if (nuc)
|
2002-03-21 06:57:13 +00:00
|
|
|
nuc->metricsT(mi);
|
2002-03-18 11:45:53 +00:00
|
|
|
//ascent_ = ascent2(nuc);
|
|
|
|
//descent_ = descent2(nuc);
|
|
|
|
//width_ = width2(nuc);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-21 06:57:13 +00:00
|
|
|
void MathScriptInset::drawT(TextPainter & pain, int x, int y) const
|
2002-03-21 17:42:56 +00:00
|
|
|
{
|
2002-03-18 11:45:53 +00:00
|
|
|
//lyxerr << "unexpected call to MathScriptInset::draw()\n";
|
2002-03-21 06:57:13 +00:00
|
|
|
drawT(0, pain, x, y);
|
2002-03-18 11:45:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-21 06:57:13 +00:00
|
|
|
void MathScriptInset::drawT(MathInset const * nuc, TextPainter & pain,
|
2002-03-18 11:45:53 +00:00
|
|
|
int x, int y) const
|
2002-03-21 17:42:56 +00:00
|
|
|
{
|
2002-03-18 11:45:53 +00:00
|
|
|
if (nuc)
|
2002-03-21 06:57:13 +00:00
|
|
|
nuc->drawT(pain, x + dxx(nuc), y);
|
2002-03-18 11:45:53 +00:00
|
|
|
if (hasUp())
|
2002-03-21 06:57:13 +00:00
|
|
|
up().drawT(pain, x + dx1(nuc), y - dy1(nuc));
|
2002-03-18 11:45:53 +00:00
|
|
|
if (hasDown())
|
2002-03-21 06:57:13 +00:00
|
|
|
down().drawT(pain, x + dx0(nuc), y + dy0(nuc));
|
2002-03-18 11:45:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-10-12 12:02:49 +00:00
|
|
|
|
|
|
|
bool MathScriptInset::hasLimits(MathInset const * nuc) const
|
|
|
|
{
|
2002-07-08 13:03:37 +00:00
|
|
|
// obvious cases
|
2001-11-27 13:57:49 +00:00
|
|
|
if (limits_ == 1)
|
|
|
|
return true;
|
|
|
|
if (limits_ == -1)
|
|
|
|
return false;
|
|
|
|
|
2002-03-21 17:42:56 +00:00
|
|
|
// we can only display limits if the nucleus wants some
|
2001-11-27 13:57:49 +00:00
|
|
|
if (!nuc)
|
|
|
|
return false;
|
|
|
|
if (!nuc->isScriptable())
|
|
|
|
return false;
|
2002-03-21 17:42:56 +00:00
|
|
|
|
2001-11-27 13:57:49 +00:00
|
|
|
// per default \int has limits beside the \int even in displayed formulas
|
|
|
|
if (nuc->asSymbolInset())
|
|
|
|
if (nuc->asSymbolInset()->name().find("int") != string::npos)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// assume "real" limits for everything else
|
|
|
|
return true;
|
2001-10-12 12:02:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathScriptInset::removeEmptyScripts()
|
|
|
|
{
|
|
|
|
for (int i = 0; i <= 1; ++i)
|
2002-03-18 11:45:53 +00:00
|
|
|
if (script_[i] && cell(i).size() == 0) {
|
|
|
|
cell(i).clear();
|
2001-10-12 12:02:49 +00:00
|
|
|
script_[i] = false;
|
2002-03-18 11:45:53 +00:00
|
|
|
}
|
2001-10-12 12:02:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MathScriptInset::removeScript(bool up)
|
|
|
|
{
|
|
|
|
cell(up).clear();
|
|
|
|
script_[up] = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MathScriptInset::has(bool up) const
|
|
|
|
{
|
|
|
|
return script_[up];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-01 11:57:26 +00:00
|
|
|
bool MathScriptInset::empty() const
|
|
|
|
{
|
|
|
|
return !script_[0] && !script_[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-10-12 12:02:49 +00:00
|
|
|
bool MathScriptInset::hasUp() const
|
|
|
|
{
|
|
|
|
return script_[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MathScriptInset::hasDown() const
|
|
|
|
{
|
|
|
|
return script_[0];
|
2001-07-26 06:46:50 +00:00
|
|
|
}
|
2001-10-12 15:38:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
bool MathScriptInset::idxRight(MathInset::idx_type &,
|
|
|
|
MathInset::pos_type &) const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool MathScriptInset::idxLeft(MathInset::idx_type &,
|
|
|
|
MathInset::pos_type &) const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-09 08:35:57 +00:00
|
|
|
void MathScriptInset::write(WriteStream & os) const
|
2002-03-21 17:42:56 +00:00
|
|
|
{
|
2001-11-08 12:06:56 +00:00
|
|
|
//lyxerr << "unexpected call to MathScriptInset::write()\n";
|
2001-11-20 16:05:17 +00:00
|
|
|
write2(0, os);
|
2001-11-08 12:06:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-20 16:05:17 +00:00
|
|
|
void MathScriptInset::write2(MathInset const * nuc, WriteStream & os) const
|
2001-11-07 08:51:35 +00:00
|
|
|
{
|
2001-11-08 12:06:56 +00:00
|
|
|
if (nuc) {
|
2001-11-07 17:30:26 +00:00
|
|
|
os << nuc;
|
2001-11-08 12:06:56 +00:00
|
|
|
if (nuc->takesLimits()) {
|
|
|
|
if (limits_ == -1)
|
|
|
|
os << "\\nolimits ";
|
|
|
|
if (limits_ == 1)
|
|
|
|
os << "\\limits ";
|
|
|
|
}
|
2001-11-13 14:45:08 +00:00
|
|
|
} else
|
2001-12-03 16:24:50 +00:00
|
|
|
if (os.firstitem())
|
2002-04-25 15:37:10 +00:00
|
|
|
lyxerr[Debug::MATHED] << "suppressing {} when writing\n";
|
2001-11-13 14:45:08 +00:00
|
|
|
else
|
|
|
|
os << "{}";
|
2001-11-08 12:06:56 +00:00
|
|
|
|
2001-11-07 08:51:35 +00:00
|
|
|
if (hasDown() && down().data_.size())
|
2001-11-08 12:06:56 +00:00
|
|
|
os << "_{" << down().data_ << '}';
|
|
|
|
|
2001-11-07 08:51:35 +00:00
|
|
|
if (hasUp() && up().data_.size())
|
2001-11-08 12:06:56 +00:00
|
|
|
os << "^{" << up().data_ << '}';
|
2001-11-07 08:51:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-09 08:35:57 +00:00
|
|
|
void MathScriptInset::normalize(NormalStream & os) const
|
2002-03-21 17:42:56 +00:00
|
|
|
{
|
2001-11-09 08:35:57 +00:00
|
|
|
//lyxerr << "unexpected call to MathScriptInset::normalize()\n";
|
2001-11-20 16:05:17 +00:00
|
|
|
normalize2(0, os);
|
2001-11-08 12:06:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-20 16:05:17 +00:00
|
|
|
void MathScriptInset::normalize2(MathInset const * nuc, NormalStream & os) const
|
2001-11-08 12:06:56 +00:00
|
|
|
{
|
|
|
|
bool d = hasDown() && down().data_.size();
|
|
|
|
bool u = hasUp() && up().data_.size();
|
|
|
|
|
2002-03-21 17:42:56 +00:00
|
|
|
if (u)
|
2001-11-08 12:06:56 +00:00
|
|
|
os << "[sup ";
|
|
|
|
if (d)
|
|
|
|
os << "[sub ";
|
2002-03-21 17:42:56 +00:00
|
|
|
|
2001-11-08 12:06:56 +00:00
|
|
|
if (nuc)
|
|
|
|
os << nuc << ' ';
|
|
|
|
else
|
|
|
|
os << "[par]";
|
|
|
|
|
|
|
|
if (d)
|
|
|
|
os << down().data_ << ']';
|
2002-03-21 17:42:56 +00:00
|
|
|
if (u)
|
2001-11-08 12:06:56 +00:00
|
|
|
os << up().data_ << ']';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-20 16:05:17 +00:00
|
|
|
void MathScriptInset::maplize2(MathInset const * nuc, MapleStream & os) const
|
2001-11-07 08:51:35 +00:00
|
|
|
{
|
2001-11-07 17:30:26 +00:00
|
|
|
if (nuc)
|
|
|
|
os << nuc;
|
|
|
|
if (hasDown() && down().data_.size())
|
|
|
|
os << '[' << down().data_ << ']';
|
|
|
|
if (hasUp() && up().data_.size())
|
|
|
|
os << "^(" << up().data_ << ')';
|
2001-11-07 08:51:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-07-01 11:17:14 +00:00
|
|
|
void MathScriptInset::mathematicize2(MathInset const * nuc, MathematicaStream & os) const
|
|
|
|
{
|
|
|
|
bool d = hasDown() && down().data_.size();
|
|
|
|
bool u = hasUp() && up().data_.size();
|
|
|
|
|
|
|
|
if (nuc)
|
|
|
|
if (d) //subscript only if nuc !
|
|
|
|
os << "Subscript[" << nuc;
|
|
|
|
else
|
|
|
|
os << nuc;
|
|
|
|
if (u)
|
|
|
|
os << "^(" << up().data_ << ")";
|
|
|
|
|
|
|
|
if (nuc)
|
|
|
|
if (d)
|
|
|
|
os << "," << down().data_ << "]";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-11-20 16:05:17 +00:00
|
|
|
void MathScriptInset::mathmlize2(MathInset const * nuc, MathMLStream & os) const
|
2001-11-07 08:51:35 +00:00
|
|
|
{
|
2001-11-07 17:30:26 +00:00
|
|
|
bool d = hasDown() && down().data_.size();
|
|
|
|
bool u = hasUp() && up().data_.size();
|
|
|
|
|
2001-11-08 12:06:56 +00:00
|
|
|
if (u && d)
|
|
|
|
os << MTag("msubsup");
|
|
|
|
else if (u)
|
|
|
|
os << MTag("msup");
|
|
|
|
else if (d)
|
|
|
|
os << MTag("msub");
|
2001-11-07 17:30:26 +00:00
|
|
|
|
2001-11-07 08:51:35 +00:00
|
|
|
if (nuc)
|
2001-11-07 17:30:26 +00:00
|
|
|
os << nuc;
|
|
|
|
else
|
|
|
|
os << "<mrow/>";
|
|
|
|
|
2001-11-08 12:06:56 +00:00
|
|
|
if (u && d)
|
|
|
|
os << down().data_ << up().data_ << ETag("msubsup");
|
|
|
|
else if (u)
|
|
|
|
os << up().data_ << ETag("msup");
|
|
|
|
else if (d)
|
|
|
|
os << down().data_ << ETag("msub");
|
|
|
|
}
|
|
|
|
|
2001-11-07 17:30:26 +00:00
|
|
|
|
2001-11-20 16:05:17 +00:00
|
|
|
void MathScriptInset::octavize2(MathInset const * nuc, OctaveStream & os) const
|
2001-11-08 12:06:56 +00:00
|
|
|
{
|
|
|
|
if (nuc)
|
|
|
|
os << nuc;
|
|
|
|
if (hasDown() && down().data_.size())
|
|
|
|
os << '[' << down().data_ << ']';
|
|
|
|
if (hasUp() && up().data_.size())
|
|
|
|
os << "^(" << up().data_ << ')';
|
2001-11-07 08:51:35 +00:00
|
|
|
}
|
2002-07-08 13:03:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
void MathScriptInset::infoize(std::ostream & os) const
|
|
|
|
{
|
|
|
|
if (limits_)
|
|
|
|
os << (limits_ == 1 ? "Displayed limits " : "Inlined limits ");
|
|
|
|
}
|