程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Inserting Python code in latex

編輯:Python

cause

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 .

resolvent

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 !


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved