math_streamstr.h \
math_stringinset.C \
math_stringinset.h \
+ math_substackinset.C \
+ math_substackinset.h \
math_support.C \
math_support.h \
math_symbolinset.C \
out = out.substr(6);
// parse output as matrix or single number
- MathAtom at(new MathArrayInset(out));
+ MathAtom at(new MathArrayInset("array", out));
MathArrayInset const * mat = at.nucleus()->asArrayInset();
MathArray res;
if (mat->ncols() == 1 && mat->nrows() == 1)
using std::getline;
-MathArrayInset::MathArrayInset(int m, int n)
- : MathGridInset(m, n)
+MathArrayInset::MathArrayInset(string const & name, int m, int n)
+ : MathGridInset(m, n), name_(name)
{}
-MathArrayInset::MathArrayInset(int m, int n, char valign, string const & halign)
- : MathGridInset(m, n, valign, halign)
+MathArrayInset::MathArrayInset(string const & name, int m, int n,
+ char valign, string const & halign)
+ : MathGridInset(m, n, valign, halign), name_(name)
{}
-MathArrayInset::MathArrayInset(char valign, string const & halign)
- : MathGridInset(valign, halign)
+MathArrayInset::MathArrayInset(string const & name, char valign,
+ string const & halign)
+ : MathGridInset(valign, halign), name_(name)
{}
-MathArrayInset::MathArrayInset(string const & str)
- : MathGridInset(1, 1)
+MathArrayInset::MathArrayInset(string const & name, string const & str)
+ : MathGridInset(1, 1), name_(name)
{
vector< vector<string> > dat;
istringstream is(str.c_str());
{
if (os.fragile())
os << "\\protect";
- os << "\\begin{array}";
+ os << "\\begin{" << name_ << "}";
if (v_align_ == 't' || v_align_ == 'b')
os << '[' << char(v_align_) << ']';
if (os.fragile())
os << "\\protect";
- os << "\\end{array}\n";
+ os << "\\end{" << name_ << "}\n";
}
void MathArrayInset::normalize(NormalStream & os) const
{
- os << "[array ";
+ os << "[" << name_ << " ";
MathGridInset::normalize(os);
os << "]";
}
class MathArrayInset : public MathGridInset {
public:
///
- MathArrayInset(int m, int n);
+ MathArrayInset(string const &, int m, int n);
///
- MathArrayInset(int m, int n, char valign, string const & halign);
+ MathArrayInset(string const &, int m, int n,
+ char valign, string const & halign);
///
- MathArrayInset(char valign, string const & halign);
+ MathArrayInset(string const &, char valign, string const & halign);
/// convienience constructor from whitespace/newline seperated data
- MathArrayInset(string const & str);
+ MathArrayInset(string const &, string const & str);
///
MathInset * clone() const;
///
void normalize(NormalStream &) const;
///
void maplize(MapleStream &) const;
+
+private:
+ ///
+ string name_;
};
#endif
m = std::max(1u, m);
n = std::max(1u, n);
v_align += 'c';
- niceInsert(MathAtom(new MathArrayInset(m, n, v_align[0], h_align)));
+ niceInsert(MathAtom(new MathArrayInset("array", m, n, v_align[0], h_align)));
return true;
}
#include <config.h>
#include "math_parser.h"
+#include "math_arrayinset.h"
#include "math_amsarrayinset.h"
#include "math_binominset.h"
#include "math_boxinset.h"
#include "math_specialcharinset.h"
#include "math_sqrtinset.h"
#include "math_stackrelinset.h"
+#include "math_substackinset.h"
#include "math_symbolinset.h"
#include "math_undersetinset.h"
#include "math_unknowninset.h"
if (s == "cases")
return MathAtom(new MathCasesInset);
+ if (s == "substack")
+ return MathAtom(new MathSubstackInset);
+
+ if (s == "subarray" || s == "array")
+ return MathAtom(new MathArrayInset(s, 1, 1));
+
if (s == "pmatrix" || s == "bmatrix" || s == "vmatrix" || s == "Vmatrix")
return MathAtom(new MathAMSArrayInset(s));
else if (t.cs() == "begin") {
string const name = getArg('{', '}');
- if (name == "array") {
+ if (name == "array" || name == "subarray") {
string const valign = getArg('[', ']') + 'c';
string const halign = getArg('{', '}');
- array.push_back(MathAtom(new MathArrayInset(valign[0], halign)));
+ array.push_back(MathAtom(new MathArrayInset(name, valign[0], halign)));
parse_lines(array.back(), false, false);
} else if (name == "split" || name == "cases") {
array.push_back(createMathInset(name));
return;
}
+ else if (t.cs() == "substack") {
+ array.push_back(createMathInset(t.cs()));
+ skipBegin();
+ parse_lines2(array.back(), true);
+ }
+
else if (t.cs() == "xymatrix") {
array.push_back(createMathInset(t.cs()));
skipBegin();
--- /dev/null
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "math_substackinset.h"
+#include "math_mathmlstream.h"
+#include "math_streamstr.h"
+
+
+MathSubstackInset::MathSubstackInset()
+ : MathGridInset(1, 1)
+{}
+
+
+MathInset * MathSubstackInset::clone() const
+{
+ return new MathSubstackInset(*this);
+}
+
+
+void MathSubstackInset::metrics(MathMetricsInfo const & st) const
+{
+ MathMetricsInfo mi = st;
+ if (mi.style == LM_ST_DISPLAY)
+ mi.style = LM_ST_TEXT;
+ MathGridInset::metrics(mi);
+}
+
+
+void MathSubstackInset::write(WriteStream & os) const
+{
+ os << "\\substack{";
+ MathGridInset::write(os);
+ os << "}\n";
+}
+
+
+void MathSubstackInset::normalize(NormalStream & os) const
+{
+ os << "[substack ";
+ MathGridInset::normalize(os);
+ os << "]";
+}
+
+
+void MathSubstackInset::maplize(MapleStream & os) const
+{
+ os << "substack(";
+ MathGridInset::maplize(os);
+ os << ")";
+}
--- /dev/null
+// -*- C++ -*-
+#ifndef MATH_SUBSTACK_H
+#define MATH_SUBSTACK_H
+
+#include "math_gridinset.h"
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+
+class MathSubstackInset : public MathGridInset {
+public:
+ ///
+ MathSubstackInset();
+ ///
+ MathInset * clone() const;
+ ///
+ void metrics(MathMetricsInfo const & st) const;
+ ///
+ MathSubstackInset const * asSubstackInset() const { return this; }
+
+ ///
+ void normalize();
+ ///
+ void write(WriteStream & os) const;
+ ///
+ void normalize(NormalStream &) const;
+ ///
+ void maplize(MapleStream &) const;
+};
+
+#endif