首先導入相應的宏包:
listings
具體代碼如下:
\lstinputlisting[lastline=18,
language=Python,
frame=single,
caption=First ten lines of some Python code,
label=python]
{tf3.py}
解讀: 插入的程式預言是python, 插入内容為與tex檔案同一問價夾下的tf3.py檔案,顯示效果如下:
latex slide完整模闆:
https://download.csdn.net/download/qq_28531269/16140993