Open zhanghaiyu0511 opened 1 year ago
with open("data/tes.tex") as tex_file: latex = tex_file.read() l2t_context_db = latexwalker.get_default_latex_context_db()
l2t_context_db.set_unknown_macro_spec(MacroSpec("newcommand", NCArgsParser("newcommand"))) output = LatexNodes2Text().latex_to_text(latex, latex_context=l2t_context_db) print(output)
Could you provide more context please? As far as I remember, the NCArgsParser from latexpp is not designed to be used outside of latexpp. It also needs to be rewritten because of some design issues.
with open("data/tes.tex") as tex_file: latex = tex_file.read() l2t_context_db = latexwalker.get_default_latex_context_db()
l2t_context_db.set_unknown_macro_spec(MacroSpec("newcommand", NCArgsParser("newcommand"))) output = LatexNodes2Text().latex_to_text(latex, latex_context=l2t_context_db) print(output)