The paper that the teacher asks to hand in suddenly needs to add code in the appendix , How can I use LaTeX Templates can only be highlighted Matlab Code for , But when I wrote my paper, most of the code used Python Written Give me a real name roast here Matlab The data processing function of is so stretched , I don't know why it was used as the first language of data mining class , Can't , There is only one way to make LaTeX It can highlight Python Code .
stay Latex Insert Python Code , Need a third-party macro package python-latex-highlighting, Download it and put pythonhighlight.sty
Put it in and tex File in the same directory .
After the tex Document introduction area references
\usepackage{graphicx}
\usepackage{pythonhighlight}
Then you can insert... In the body python Code
\begin{python}
import numpy as np
import pandas as pd
print('why use Matlab?')
\end{python}
The effect is as follows
perfect !