From 411024615c2450e2ed722cc21f42db5c4ab354b8 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Tue, 3 Oct 2006 20:11:00 +0000 Subject: [PATCH] Support lgathered and rgathered math environments * src/mathed/math_splitinset.C (MathSplitInset::validate): Only require amsmath for AMS stuff * src/mathed/math_factory.C (createMathInset): create MathSplitInset if the latexkey is "split" * src/mathed/math_parser.C (Parser::parse1): create MathSplitInset if the latexkey is "split" * lib/symbols: Add aligned, gathered, lgathered and rgathered git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_4_X@15227 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/symbols | 8 ++++++++ src/mathed/math_factory.C | 2 ++ src/mathed/math_parser.C | 12 ++++++++++++ src/mathed/math_splitinset.C | 6 ++++-- status.14x | 2 ++ 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/lib/symbols b/lib/symbols index a812911158..65a6958dc0 100644 --- a/lib/symbols +++ b/lib/symbols @@ -87,6 +87,14 @@ smallmatrix matrix none vmatrix matrix none CD matrix none +# split environments with optional valign argument. +# the others (split and alignedat) are hardcoded. +aligned split none +gathered split none +# from Morten H\o gholm's mathtools.sty: +lgathered split none +rgathered split none + # references pageref ref none prettyref ref none diff --git a/src/mathed/math_factory.C b/src/mathed/math_factory.C index f3c5faf381..024d54cf04 100644 --- a/src/mathed/math_factory.C +++ b/src/mathed/math_factory.C @@ -276,6 +276,8 @@ MathAtom createMathInset(string const & s) return MathAtom(new MathFontOldInset(l)); if (inset == "matrix") return MathAtom(new MathAMSArrayInset(s)); + if (inset == "split") + return MathAtom(new MathSplitInset(s)); return MathAtom(new MathSymbolInset(l)); } diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index 65b4f661ec..4d01de5f85 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -1178,6 +1178,18 @@ void Parser::parse1(MathGridInset & grid, unsigned flags, if (l->inset == "matrix") { cell->push_back(createMathInset(name)); parse2(cell->back(), FLAG_END, mode, false); + } else if (l->inset == "split") { + string const valign = parse_verbatim_option() + 'c'; + cell->push_back(MathAtom(new MathSplitInset(name, valign[0]))); + parse2(cell->back(), FLAG_END, mode, false); + } else { + dump(); + lyxerr << "found math environment `" << name + << "' in symbols file with unsupported inset `" + << l->inset << "'." << endl; + // create generic environment inset + cell->push_back(MathAtom(new MathEnvInset(name))); + parse(cell->back().nucleus()->cell(0), FLAG_ITEM, mode); } } diff --git a/src/mathed/math_splitinset.C b/src/mathed/math_splitinset.C index 44938c79df..4f9005b774 100644 --- a/src/mathed/math_splitinset.C +++ b/src/mathed/math_splitinset.C @@ -109,6 +109,8 @@ void MathSplitInset::infoize(std::ostream & os) const void MathSplitInset::validate(LaTeXFeatures & features) const { - features.require("amsmath"); - MathNestInset::validate(features); + if (name_ == "split" || name_ == "gathered" || name_ == "aligned" || + name_ == "alignedat") + features.require("amsmath"); + MathGridInset::validate(features); } diff --git a/status.14x b/status.14x index 0fe422c492..d88d2ff636 100644 --- a/status.14x +++ b/status.14x @@ -36,6 +36,8 @@ What's new - Parse the optional argument of the AMS math environments aligned, gathered and alignedat. +- Support lgathered and rgathered math environments. + * User Interface: - Fix a crash that occured on exit if the clipboard was not empty (only on