#include <algorithm>
+#include "math_amsarrayinset.h"
#include "math_charinset.h"
#include "math_deliminset.h"
#include "math_diffinset.h"
MathScriptInset const * asScript(MathArray::const_iterator it)
{
+ if (!it->nucleus())
+ return 0;
if (it->nucleus()->asScriptInset())
return 0;
++it;
void extractMatrices(MathArray & ar)
{
//lyxerr << "\nMatrices from: " << ar << "\n";
+ // first pass for explicitly delimited stuff
for (MathArray::iterator it = ar.begin(); it != ar.end(); ++it) {
MathDelimInset * del = (*it)->asDelimInset();
if (!del)
continue;
MathInset * arr = singleItem(del->cell(0));
- if (!arr || !arr->asArrayInset())
+ if (!arr || !arr->asGridInset())
+ continue;
+ *it = MathAtom(new MathMatrixInset(*(arr->asGridInset())));
+ }
+
+ // second pass for AMS "pmatrix" etc
+ for (MathArray::iterator it = ar.begin(); it != ar.end(); ++it) {
+ MathAMSArrayInset * ams = (*it)->asAMSArrayInset();
+ if (!ams)
continue;
- *it = MathAtom(new MathMatrixInset(*(arr->asArrayInset())));
+ *it = MathAtom(new MathMatrixInset(*ams));
}
//lyxerr << "\nMatrices to: " << ar << "\n";
}
}
+bool extractNumber(MathArray const & ar, double & i)
+{
+ string s;
+ MathTextCodes c;
+ charSequence(ar.begin(), ar.end(), s, c);
+ istringstream is(s.c_str());
+ is >> i;
+ return is;
+}
+
+
bool testString(MathInset * p, const string & str)
{
string s;