math_support.h \
math_symbolinset.C \
math_symbolinset.h \
+ math_tabularinset.C \
+ math_tabularinset.h \
math_textinset.C \
math_textinset.h \
math_unknowninset.C \
#include "math_stackrelinset.h"
#include "math_substackinset.h"
#include "math_symbolinset.h"
+#include "math_tabularinset.h"
#include "math_undersetinset.h"
#include "math_unknowninset.h"
#include "math_xarrowinset.h"
return MathAtom(new MathSqrtInset);
if (s == "root")
return MathAtom(new MathRootInset);
+ if (s == "tabular")
+ return MathAtom(new MathTabularInset(s, 1, 1));
if (s == "stackrel")
return MathAtom(new MathStackrelInset);
if (s == "binom" || s == "choose")
#include "math_sqrtinset.h"
#include "math_stringinset.h"
#include "math_support.h"
+#include "math_tabularinset.h"
#include "math_xyarrowinset.h"
//#include "insets/insetref.h"
parse2(cell->back(), FLAG_END, mode, false);
}
+ if (name == "tabular") {
+ string const valign = parse_verbatim_option() + 'c';
+ string const halign = parse_verbatim_item();
+ cell->push_back(MathAtom(new MathTabularInset(name, valign[0], halign)));
+ parse2(cell->back(), FLAG_END, mode, false);
+ }
+
else if (name == "split" || name == "cases" ||
name == "gathered" || name == "aligned") {
cell->push_back(createMathInset(name));
--- /dev/null
+#include <config.h>
+
+
+#include "math_tabularinset.h"
+#include "math_parser.h"
+#include "math_mathmlstream.h"
+#include "math_metricsinfo.h"
+#include "math_streamstr.h"
+#include "Lsstream.h"
+
+#include <iterator>
+
+using std::vector;
+using std::istringstream;
+using std::getline;
+using std::istream_iterator;
+
+
+MathTabularInset::MathTabularInset(string const & name, int m, int n)
+ : MathGridInset(m, n), name_(name)
+{}
+
+
+MathTabularInset::MathTabularInset(string const & name, int m, int n,
+ char valign, string const & halign)
+ : MathGridInset(m, n, valign, halign), name_(name)
+{}
+
+
+MathTabularInset::MathTabularInset(string const & name, char valign,
+ string const & halign)
+ : MathGridInset(valign, halign), name_(name)
+{}
+
+
+MathInset * MathTabularInset::clone() const
+{
+ return new MathTabularInset(*this);
+}
+
+
+void MathTabularInset::metrics(MathMetricsInfo & mi) const
+{
+ MathFontSetChanger dummy(mi.base, "textnormal");
+ MathGridInset::metrics(mi);
+}
+
+
+void MathTabularInset::draw(MathPainterInfo & pi, int x, int y) const
+{
+ MathFontSetChanger dummy(pi.base, "textnormal");
+ MathGridInset::draw(pi, x, y);
+}
+
+
+void MathTabularInset::write(WriteStream & os) const
+{
+ if (os.fragile())
+ os << "\\protect";
+ os << "\\begin{" << name_ << '}';
+
+ if (v_align_ == 't' || v_align_ == 'b')
+ os << '[' << char(v_align_) << ']';
+ os << '{' << halign() << "}\n";
+
+ MathGridInset::write(os);
+
+ if (os.fragile())
+ os << "\\protect";
+ os << "\\end{" << name_ << '}';
+ // adding a \n here is bad if the tabular is the last item
+ // in an \eqnarray...
+}
+
+
+void MathTabularInset::normalize(NormalStream & os) const
+{
+ os << '[' << name_ << ' ';
+ MathGridInset::normalize(os);
+ os << ']';
+}
+
+
+void MathTabularInset::maple(MapleStream & os) const
+{
+ os << "array(";
+ MathGridInset::maple(os);
+ os << ')';
+}
--- /dev/null
+// -*- C++ -*-
+#ifndef MATH_TABULARINSET_H
+#define MATH_TABULARINSET_H
+
+#include "math_gridinset.h"
+
+
+/**
+ * Inset for things like \begin{tabular}...\end{tabular}
+ *
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS
+ */
+
+class MathTabularInset : public MathGridInset {
+public:
+ ///
+ MathTabularInset(string const &, int m, int n);
+ ///
+ MathTabularInset(string const &, int m, int n,
+ char valign, string const & halign);
+ ///
+ MathTabularInset(string const &, char valign, string const & halign);
+ ///
+ MathInset * clone() const;
+ ///
+ void metrics(MathMetricsInfo & mi) const;
+ ///
+ void draw(MathPainterInfo & pi, int x, int y) const;
+ ///
+ MathTabularInset * asTabularInset() { return this; }
+ ///
+ MathTabularInset const * asTabularInset() const { return this; }
+
+ ///
+ void write(WriteStream & os) const;
+ ///
+ void normalize(NormalStream &) const;
+ ///
+ void maple(MapleStream &) const;
+
+private:
+ ///
+ string name_;
+};
+
+#endif