mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
Parse optional arguments of aligned, gathered and alignedat
* src/mathed/InsetMathSplit.[Ch] (InsetMathSplit): Add valignment argument to constructor * src/mathed/InsetMathSplit.C (InsetMathSplit::write): write vertical alignment if needed * src/mathed/MathParser.C (Parser::parse1): parse optional arguments of aligned, gathered and alignedat git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15202 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5070d2f660
commit
8a9d0934e9
@ -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);
|
||||
|
@ -18,7 +18,7 @@
|
||||
class InsetMathSplit : public InsetMathGrid {
|
||||
public:
|
||||
///
|
||||
explicit InsetMathSplit(std::string const & name);
|
||||
explicit InsetMathSplit(std::string const & name, char valign = 'c');
|
||||
|
||||
///
|
||||
void draw(PainterInfo & pi, int x, int y) const;
|
||||
|
@ -54,6 +54,7 @@ following hack as starting point to write some macros:
|
||||
#include "InsetMathRef.h"
|
||||
#include "InsetMathRoot.h"
|
||||
#include "InsetMathScript.h"
|
||||
#include "InsetMathSplit.h"
|
||||
#include "InsetMathSqrt.h"
|
||||
#include "InsetMathTabular.h"
|
||||
#include "MathMacroTemplate.h"
|
||||
@ -1099,16 +1100,22 @@ void Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
||||
parse2(cell->back(), FLAG_END, InsetMath::TEXT_MODE, false);
|
||||
}
|
||||
|
||||
else if (name == "split" || name == "cases" ||
|
||||
name == "gathered" || name == "aligned") {
|
||||
else if (name == "split" || name == "cases") {
|
||||
cell->push_back(createInsetMath(name));
|
||||
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
|
||||
getArg('{', '}');
|
||||
cell->push_back(createInsetMath(name));
|
||||
cell->push_back(MathAtom(new InsetMathSplit(name, valign[0])));
|
||||
parse2(cell->back(), FLAG_END, mode, false);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user