Resolve macros in LaTeX files before detecting entities
- Dominant language
- Python
- Stars
- 428
- Forks
- 58
- PR merge metrics
- No merged PRs in 30d
Description
cc @dykang @kyleclo
To aid in definition and symbol detection, macros should be expanded in LaTeX files before they are processed.
I haven't had much luck so far finding a tool yet for expanding macros. Options seem to include:
* `de-macro`: a command line utility that will expand commands defined with \newcommand (though not \def)
* This script (https://tex.stackexchange.com/a/11236/198728) (also only works for \newcommand, I think)
* A home-brewed solution
(source: This TeXExchange question: https://tex.stackexchange.com/questions/3174/latex-macro-expander)
For the home-brewed solution, there are a couple of options.
1. if `\tracingmacros=1` is set at the beginning of a LaTeX file, then LaTeX will output expansions for each of the macros called. During compilation, it might possible to do a first compilation pass to get the macro expansions, and then replace the macros with their expansions before the next pass.
2. support a subset of macros (e.g., those with very simple expansion patterns), and write our own scanner that finds these macros and expands them in the files. I expect this might be the 80 / 20 solution (e.g., the one where we only have to spend 20% of the work to get 80% of the payoff).
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.