From 368f6a53a87eb5997433ecd0f51e854c99360d28 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Tue, 3 Oct 2006 19:45:43 +0000 Subject: [PATCH] Support lgathered and rgathered math environments * src/mathed/InsetMathSplit.C (InsetMathSplit::validate): Only require amsmath for AMS stuff * src/mathed/MathFactory.C (createInsetMath): create InsetMathSplit if the latexkey is "split" * src/mathed/MathParser.C (Parser::parse1): remove "gathered" and "aligned", since these are now handled via lib/symbols (Parser::parse1): create InsetMathSplit if the latexkey is "split" * lib/symbols: Add aligned, gathered, lgathered and rgathered git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15224 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/symbols | 8 ++++++++ src/mathed/InsetMathSplit.C | 6 ++++-- src/mathed/MathFactory.C | 2 ++ src/mathed/MathParser.C | 18 ++++++++++++------ 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/lib/symbols b/lib/symbols index aab3533923..27648268f6 100644 --- a/lib/symbols +++ b/lib/symbols @@ -109,6 +109,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/InsetMathSplit.C b/src/mathed/InsetMathSplit.C index 606191e1fd..8921136b69 100644 --- a/src/mathed/InsetMathSplit.C +++ b/src/mathed/InsetMathSplit.C @@ -110,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); } diff --git a/src/mathed/MathFactory.C b/src/mathed/MathFactory.C index 6a3fb9d989..e9e40b4f49 100644 --- a/src/mathed/MathFactory.C +++ b/src/mathed/MathFactory.C @@ -275,6 +275,8 @@ MathAtom createInsetMath(string const & s) return MathAtom(new InsetMathFontOld(l)); if (inset == "matrix") return MathAtom(new InsetMathAMSArray(s)); + if (inset == "split") + return MathAtom(new InsetMathSplit(s)); if (inset == "big") // we can't create a InsetMathBig, since the argument // is missing. diff --git a/src/mathed/MathParser.C b/src/mathed/MathParser.C index f2196d2175..b8268eb72a 100644 --- a/src/mathed/MathParser.C +++ b/src/mathed/MathParser.C @@ -1105,12 +1105,6 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags, parse2(cell->back(), FLAG_END, mode, false); } - else if (name == "gathered" || name == "aligned") { - string const valign = parse_verbatim_option() + 'c'; - cell->push_back(MathAtom(new InsetMathSplit(name, valign[0]))); - parse2(cell->back(), FLAG_END, mode, false); - } - else if (name == "alignedat") { string const valign = parse_verbatim_option() + 'c'; // ignore this for a while @@ -1180,6 +1174,18 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags, if (l->inset == "matrix") { cell->push_back(createInsetMath(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 InsetMathSplit(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 InsetMathEnv(name))); + parse(cell->back().nucleus()->cell(0), FLAG_ITEM, mode); } }