phfaist / pylatexenc

Simple LaTeX parser providing latex-to-unicode and unicode-to-latex conversion
https://pylatexenc.readthedocs.io
MIT License
283 stars 35 forks source link

Any ideas to skip specific element in LatexWalker? #94

Closed liyucheng09 closed 1 year ago

liyucheng09 commented 1 year ago

I found LatexNodes2Text alway renders error encountering "href" Macro.

The href is not necessary for my project, so I wonder whether it's feasible to let LatexWalker skip this element while parsing the latex_code?

Also, it will be really helpful if we can control LatexWalker to skip specific elements such as "figure" and "table".

I checked the document and found something about latex_context_db, but I have no idea whether they are relevent.

phfaist commented 1 year ago

You can use custom definitions for macros and environments - see doc here: https://pylatexenc.readthedocs.io/en/latest/latex2text/#custom-latex-conversion-rules-a-simple-template