pylatexenc
Simple LaTeX parser providing latex-to-unicode and unicode-to-latex
...(Use the setup.py script directly if you have Python 3.7, poetry doesn't seem to work with old Python versions.) The pylatexenc.latexencode module provides a function unicode_to_latex() which converts a Unicode string into LaTeX text and escape sequences. It should recognize accented characters and most math symbols. A couple of switches allow you to alter how this function behaves.