When handling complex data or drawing complex images, it comes in handy to use a programming language that is more capable than TeX is. For this exact issue, the pythontex package was created. It allows the insertion of Python code directly into the LaTeX files. Upon document generation, the code is executed, and the results are inserted into the document.
This is my latex file.
\begin{pycode}
print(r'I can also write something in Python.')
\end{pycode}
Obviously, the syntax highlighting is wrong if this environment is used as language-latex highlights the LaTeX code syntax and not the Python one. However, it would be great if it was possible to detect such environments, deactivate the LaTeX code highlighting inside them, and switch to the installed Python highlighting. I have no clue if such a thing is at all feasible, but if so, it would be a great feature to have!
When handling complex data or drawing complex images, it comes in handy to use a programming language that is more capable than TeX is. For this exact issue, the
pythontexpackage was created. It allows the insertion of Python code directly into the LaTeX files. Upon document generation, the code is executed, and the results are inserted into the document.Obviously, the syntax highlighting is wrong if this environment is used as
language-latexhighlights the LaTeX code syntax and not the Python one. However, it would be great if it was possible to detect such environments, deactivate the LaTeX code highlighting inside them, and switch to the installed Python highlighting. I have no clue if such a thing is at all feasible, but if so, it would be a great feature to have!