Установите pylatex
pip install pylatex
elcharitas
pip install pylatex
pip install pylatex[matrices]