From: André Pönitz Date: Tue, 4 Sep 2001 14:56:30 +0000 (+0000) Subject: some support for gather and multline (multline special display is missing...) X-Git-Tag: 1.6.10~20660 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=4735efe3fe370919948302a623964549bca5e9f0;p=features.git some support for gather and multline (multline special display is missing...) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2686 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 197f681edc..761ff0f42e 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,8 +1,10 @@ 2001-09-04 André Pönitz + * 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 \| diff --git a/src/mathed/math_defs.h b/src/mathed/math_defs.h index 9ae535b88d..51c6a7b28e 100644 --- a/src/mathed/math_defs.h +++ b/src/mathed/math_defs.h @@ -123,6 +123,8 @@ enum MathInsetTypes { LM_OT_XXALIGNAT, /// LM_OT_MULTLINE, + /// + LM_OT_GATHER, /// An array LM_OT_MATRIX, diff --git a/src/mathed/math_matrixinset.C b/src/mathed/math_matrixinset.C index 670c8ecd56..32f032b485 100644 --- a/src/mathed/math_matrixinset.C +++ b/src/mathed/math_matrixinset.C @@ -236,7 +236,7 @@ std::vector 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"; diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index 97f247bba4..1ae4622524 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -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; }