* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author André Pönitz
+ * \author André Pönitz
*
* Full author contact details are available in file CREDITS.
*/
#include "InsetMathTabular.h"
#include "InsetMathUnderset.h"
#include "InsetMathUnknown.h"
+#include "InsetMathHull.h"
#include "InsetMathXArrow.h"
#include "InsetMathXYMatrix.h"
#include "MacroTable.h"
#include "MathSupport.h"
#include "insets/InsetCommand.h"
+#include "insets/InsetSpace.h"
#include "support/debug.h"
#include "support/docstream.h"
#include "frontends/FontLoader.h"
+#include "Encoding.h"
#include "LyX.h" // use_gui
+#include "OutputParams.h"
using namespace std;
using namespace lyx::support;
}
-bool isSpecialChar(docstring name)
+bool isSpecialChar(docstring const & name)
{
- if (name.size() != 1) {
- string const s = to_ascii(name);
- return s == "textasciicircum" || s == "mathcircumflex" ||
- s == "textasciitilde" || s == "textbackslash";
- } else {
- char_type const c = name.at(0);
- return c == '{' || c == '}' || c == '&' || c == '$' ||
- c == '#' || c == '%' || c == '_';
- }
+ if (name.size() != 1)
+ return name == "textasciicircum" || name == "mathcircumflex" ||
+ name == "textasciitilde" || name == "textbackslash";
+
+ char_type const c = name.at(0);
+ return c == '{' || c == '}' || c == '&' || c == '$' ||
+ c == '#' || c == '%' || c == '_' || c == ' ';
}
if (inset == "decoration")
return MathAtom(new InsetMathDecoration(l));
if (inset == "space")
- return MathAtom(new InsetMathSpace(l->name));
+ return MathAtom(new InsetMathSpace(to_ascii(l->name), ""));
if (inset == "dots")
return MathAtom(new InsetMathDots(l));
if (inset == "mbox")
return MathAtom(new InsetMathColor(true));
if (s == "textcolor")
return MathAtom(new InsetMathColor(false));
+ if (s == "cfrac")
+ return MathAtom(new InsetMathCFrac);
if (s == "dfrac")
return MathAtom(new InsetMathDFrac);
if (s == "tfrac")
if (isSpecialChar(s))
return MathAtom(new InsetMathSpecialChar(s));
+ if (s == "regexp")
+ return MathAtom(new InsetMathHull(hullRegexp));
+
return MathAtom(new MathMacro(s));
}
docstring name;
docstring body = split(str, name, ' ');
- if (name != "ref" )
+ if (name == "ref") {
+ InsetCommandParams icp(REF_CODE);
+ // FIXME UNICODE
+ InsetCommand::string2params("ref", to_utf8(str), icp);
+ mathed_parse_cell(ar, icp.getCommand());
+ } else if (name == "mathspace") {
+ InsetSpaceParams isp(true);
+ InsetSpace::string2params(to_utf8(str), isp);
+ InsetSpace is(isp);
+ odocstringstream os;
+ Encoding const * const ascii = encodings.fromLyXName("ascii");
+ OutputParams op(ascii);
+ is.latex(os, op);
+ mathed_parse_cell(ar, os.str());
+ if (ar.size() == 2) {
+ // remove "{}"
+ if (ar[1].nucleus()->asBraceInset())
+ ar.pop_back();
+ }
+ } else
return false;
- InsetCommandParams icp(REF_CODE);
- // FIXME UNICODE
- InsetCommand::string2params("ref", to_utf8(str), icp);
- mathed_parse_cell(ar, icp.getCommand());
if (ar.size() != 1)
return false;