Fix a couple of issues with macros and previews

* Fix typo causing to only account for the first char of a macro name
* Also check for macros as arguments of other macros
This commit is contained in:
Enrico Forestieri 2015-06-20 01:44:22 +02:00
parent 46aed6d2b9
commit 98a5072a58
2 changed files with 5 additions and 1 deletions

View File

@ -160,7 +160,7 @@ def extract_metrics_info(dvipng_stdout):
def fix_latex_file(latex_file, pdf_output):
documentclass_re = re.compile("(\\\\documentclass\[)(1[012]pt,?)(.+)")
def_re = re.compile(r"(\\newcommandx|\\global\\long\\def)(\\[a-zA-Z])(.+)")
def_re = re.compile(r"(\\newcommandx|\\global\\long\\def)(\\[a-zA-Z]+)(.+)")
usepackage_re = re.compile("\\\\usepackage")
userpreamble_re = re.compile("User specified LaTeX commands")
enduserpreamble_re = re.compile("\\\\makeatother")

View File

@ -647,6 +647,10 @@ void InsetMathHull::usedMacros(MathData const & md, DocIterator const & pos,
if (macros.find(name) == end)
continue;
macros.erase(name);
// Look for macros in the arguments of this macro.
for (idx_type idx = 0; idx < mi->nargs(); ++idx)
usedMacros(mi->cell(idx), pos, macros, defs);
// Look for macros in the definition of this macro.
MathData ar(pos.buffer());
MacroData const * data =
pos.buffer()->getMacro(name, pos, true);