if (lastcode_ == LM_TC_TEX) {
if (macroName().empty()) {
- if (strchr("#$%{}", c)) {
+ if (strchr("$%{}", c)) {
insert(new MathCharInset(c, LM_TC_TEX));
lastcode_ = LM_TC_VAR;
return;
}
insert(c, LM_TC_TEX);
- if (!isalpha(c)) {
+ if (!isalpha(c) && c != '#') {
macroModeClose();
lastcode_ = LM_TC_VAR;
}
} else {
- if (isalpha(c))
+ if ('1' <= c && c <= '9' && macroName() == "#") {
+ insert(c, LM_TC_TEX);
+ macroModeClose();
+ lastcode_ = LM_TC_VAR;
+ }
+ else if (isalpha(c))
insert(c, LM_TC_TEX);
else {
macroModeClose();
#include "math_kerninset.h"
#include "math_macro.h"
#include "math_macrotable.h"
+#include "math_macroarg.h"
#include "math_notinset.h"
#include "math_rootinset.h"
#include "math_spaceinset.h"
MathInset * createMathInset(string const & s)
{
//cerr << "creating inset with name: '" << s << "'\n";
+ if (s.size() == 2 && s[0] == '#' && s[1] >= '1' && s[1] <= '9')
+ return new MathMacroArgument(s[1] - '0');
+
latexkeys const * l = in_word_set(s);
if (l)
return createMathInset(l);
void writeNormal(std::ostream &) const;
///
void substitute(MathMacro const & macro);
+ ///
+ bool isActive() const { return false; }
private:
/// A number between 1 and 9