mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-13 17:20:55 +00:00
Parse optional arguments of aligned, gathered and alignedat
* src/mathed/math_splitinset.[Ch] (MathSplitInset): Add valignment argument to constructor * src/mathed/math_splitinset.C (MathSplitInset::write): write vertical alignment if needed * src/mathed/math_parser.C (Parser::parse1): parse optional arguments of aligned, gathered and alignedat git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_4_X@15225 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a3e2b19761
commit
006106094d
@ -54,6 +54,7 @@ following hack as starting point to write some macros:
|
||||
#include "math_parinset.h"
|
||||
#include "math_rootinset.h"
|
||||
#include "math_scriptinset.h"
|
||||
#include "math_splitinset.h"
|
||||
#include "math_sqrtinset.h"
|
||||
#include "math_support.h"
|
||||
#include "math_tabularinset.h"
|
||||
@ -1097,16 +1098,22 @@ void Parser::parse1(MathGridInset & grid, unsigned flags,
|
||||
parse2(cell->back(), FLAG_END, MathInset::TEXT_MODE, false);
|
||||
}
|
||||
|
||||
else if (name == "split" || name == "cases" ||
|
||||
name == "gathered" || name == "aligned") {
|
||||
else if (name == "split" || name == "cases") {
|
||||
cell->push_back(createMathInset(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 MathSplitInset(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(createMathInset(name));
|
||||
cell->push_back(MathAtom(new MathSplitInset(name, valign[0])));
|
||||
parse2(cell->back(), FLAG_END, mode, false);
|
||||
}
|
||||
|
||||
|
@ -29,10 +29,9 @@ using std::string;
|
||||
using std::auto_ptr;
|
||||
|
||||
|
||||
MathSplitInset::MathSplitInset(string const & name)
|
||||
: MathGridInset(1, 1), name_(name)
|
||||
MathSplitInset::MathSplitInset(string const & name, char valign)
|
||||
: MathGridInset(1, 1, valign, string()), name_(name)
|
||||
{
|
||||
setDefaults();
|
||||
}
|
||||
|
||||
|
||||
@ -89,6 +88,8 @@ void MathSplitInset::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) << '}';
|
||||
MathGridInset::write(ws);
|
||||
|
@ -18,7 +18,7 @@
|
||||
class MathSplitInset : public MathGridInset {
|
||||
public:
|
||||
///
|
||||
explicit MathSplitInset(std::string const & name);
|
||||
explicit MathSplitInset(std::string const & name, char valign = 'c');
|
||||
|
||||
///
|
||||
void draw(PainterInfo & pi, int x, int y) const;
|
||||
|
@ -33,6 +33,8 @@ What's new
|
||||
|
||||
* Document Input/Output
|
||||
|
||||
- Parse the optional argument of the AMS math environments aligned, gathered
|
||||
and alignedat.
|
||||
|
||||
* User Interface:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user