]> git.lyx.org Git - features.git/commitdiff
some support for gather and multline (multline special display is missing...)
authorAndré Pönitz <poenitz@gmx.net>
Tue, 4 Sep 2001 14:56:30 +0000 (14:56 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Tue, 4 Sep 2001 14:56:30 +0000 (14:56 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2686 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/ChangeLog
src/mathed/math_defs.h
src/mathed/math_matrixinset.C
src/mathed/math_parser.C

index 197f681edc6b3ab66019fc7b52e414d581dc9df2..761ff0f42e02200dcf19ee100c627ae8be1963d8 100644 (file)
@@ -1,8 +1,10 @@
 
 2001-09-04  André Pönitz  <poenitz@gmx.net>
 
+       * math_defs.h:
        * math_parser.C:
-         math_matrixinset.C: some support for [x][x]alignat environments
+       * math_matrixinset.C: some support for the AMS 'alignat', 'xalignat',
+           'xxalignt', 'gather' and 'multiline' environments
 
        * math_cursor.C: fix handling of | and \|
        
index 9ae535b88dc0828912907a778e3fe3490f419ef0..51c6a7b28e232a5df4b83446b0de0868d0b1adff 100644 (file)
@@ -123,6 +123,8 @@ enum MathInsetTypes  {
        LM_OT_XXALIGNAT,
        ///
        LM_OT_MULTLINE,
+       ///
+       LM_OT_GATHER,
        /// An array
        LM_OT_MATRIX,
 
index 670c8ecd566ac0bc96fafc6456c15e0769b81be0..32f032b485e4af0597331ab79875b23b244dcbc4 100644 (file)
@@ -236,7 +236,7 @@ std::vector<string> const MathMatrixInset::getLabelList() const
 
 bool MathMatrixInset::numberedType() const
 {
-       if (getType() == LM_OT_SIMPLE)
+       if (getType() == LM_OT_SIMPLE || getType() == LM_OT_XXALIGNAT)
                return false;
        for (int row = 0; row < nrows(); ++row)
                if (!nonum_[row])
@@ -299,6 +299,14 @@ void MathMatrixInset::header_write(std::ostream & os) const
                        os << "\\begin{xxalignat}" << "{" << ncols()/2 << "}\n";
                        break;
 
+               case LM_OT_MULTLINE:
+                       os << "\\begin{multline}\n";
+                       break;
+
+               case LM_OT_GATHER:
+                       os << "\\begin{gather}\n";
+                       break;
+
                default:
                        os << "\\begin{unknown" << star(n) << "}";
        }
@@ -341,6 +349,14 @@ void MathMatrixInset::footer_write(std::ostream & os) const
                        os << "\\end{xxalignat}\n";
                        break;
 
+               case LM_OT_MULTLINE:
+                       os << "\\end{multline}\n";
+                       break;
+
+               case LM_OT_GATHER:
+                       os << "\\end{gather}\n";
+                       break;
+
                default:
                        os << "\\end{unknown" << star(n) << "}";
        }
@@ -445,6 +461,8 @@ namespace {
                        return LM_OT_XXALIGNAT;
                if (s == "multline")
                        return LM_OT_MULTLINE;
+               if (s == "gather")
+                       return LM_OT_GATHER;
                return LM_OT_SIMPLE;
        }       
 }
@@ -611,6 +629,28 @@ void MathMatrixInset::mutate(MathInsetTypes newtype)
                        }
                        break;
 
+               case LM_OT_MULTLINE:
+                       switch (newtype) {
+                               case LM_OT_GATHER:
+                                       setType(LM_OT_GATHER);
+                                       break;
+                               default:
+                                       lyxerr << "mutation from '" << getType()
+                                               << "' to '" << newtype << "' not implemented\n";
+                                       break;
+                       }
+
+               case LM_OT_GATHER:
+                       switch (newtype) {
+                               case LM_OT_MULTLINE:
+                                       setType(LM_OT_MULTLINE);
+                                       break;
+                               default:
+                                       lyxerr << "mutation from '" << getType()
+                                               << "' to '" << newtype << "' not implemented\n";
+                                       break;
+                       }
+
                default:
                        lyxerr << "mutation from '" << getType()
                                << "' to '" << newtype << "' not implemented\n";
index 97f247bba43d8970d75bbf61aa9e58cf79eaa912..1ae46225249283e139ff75540ed582bfd97324e8 100644 (file)
@@ -616,6 +616,18 @@ MathMatrixInset * Parser::parse_normal()
                return p;
        }
 
+       if (name == "multline" || name == "multline*") {
+               MathMatrixInset * p = new MathMatrixInset(LM_OT_MULTLINE);
+               parse_lines(p, !stared(name), true);
+               return p;
+       }
+
+       if (name == "gather" || name == "gather*") {
+               MathMatrixInset * p = new MathMatrixInset(LM_OT_GATHER);
+               parse_lines(p, !stared(name), true);
+               return p;
+       }
+
        lyxerr[Debug::MATHED] << "1: unknown math environment: " << name << "\n";
        return 0;
 }