]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathSplit.C
This commit fixes a crash when accessing a math inset. This was due to an invalid...
[lyx.git] / src / mathed / InsetMathSplit.C
index b78c5708f332a15f2b343a83a79b537c49f0e5be..8921136b69e1644bf8407d0a43f1acc46b15d839 100644 (file)
@@ -30,10 +30,9 @@ using std::string;
 using std::auto_ptr;
 
 
-InsetMathSplit::InsetMathSplit(string const & name)
-       : InsetMathGrid(1, 1), name_(name)
+InsetMathSplit::InsetMathSplit(string const & name, char valign)
+       : InsetMathGrid(1, 1, valign, string()), name_(name)
 {
-       setDefaults();
 }
 
 
@@ -90,6 +89,8 @@ void InsetMathSplit::write(WriteStream & ws) const
        if (ws.fragile())
                ws << "\\protect";
        ws << "\\begin{" << name_ << '}';
+       if (name_ != "split" && valign() != 'c')
+               ws << '[' << valign() << ']';
        if (name_ == "alignedat")
                ws << '{' << static_cast<unsigned int>((ncols() + 1)/2) << '}';
        InsetMathGrid::write(ws);
@@ -109,6 +110,8 @@ void InsetMathSplit::infoize(std::ostream & os) const
 
 void InsetMathSplit::validate(LaTeXFeatures & features) const
 {
-       features.require("amsmath");
-       InsetMathNest::validate(features);
+       if (name_ == "split" || name_ == "gathered" || name_ == "aligned" ||
+           name_ == "alignedat")
+               features.require("amsmath");
+       InsetMathGrid::validate(features);
 }