diff --git a/lib/scripts/lyxpreview2bitmap.py b/lib/scripts/lyxpreview2bitmap.py index a7d76236fb..c2b94d4ed5 100755 --- a/lib/scripts/lyxpreview2bitmap.py +++ b/lib/scripts/lyxpreview2bitmap.py @@ -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") diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index 4e18b72420..0cfaad0dc0 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -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);