Skip to content

Latest commit

 

History

History
13 lines (9 loc) · 390 Bytes

README.md

File metadata and controls

13 lines (9 loc) · 390 Bytes

Removes all user-defined macros -- \newcommand or \def -- in latex_source.tex and substitutes back in their raw definition. Helpful for pre-processing LaTeX source before training NLP models.

pip install expand-latex-macros
import expand_latex_macros

latex_source = open("path/to/latex_source.tex").read()
expand_latex_macros.expand_latex_macros(latex_source)