我目前正在編寫一份報告,其中我必須在不同頁面的尾註中包含許多程式碼。手動進行每個參考似乎不必要地乏味。我找到了一種插入 python 程式碼並使其看起來不錯的方法,但它創建了一個環境,所以我無法找到將其放入尾註的方法。
以下是用於插入 python 的程式碼:
\usepackage{tcolorbox,listings}
\usepackage{fullpage}
\usepackage{color}
\definecolor{darkWhite}{rgb}{0.94,0.94,0.94}
\lstset{
backgroundcolor=\color{darkWhite},
breakatwhitespace=false,
breaklines=true,
captionpos=b,
commentstyle=\color{cyan},
deletekeywords={...},
escapeinside={\%*}{*)},
extendedchars=true,
keepspaces=true,
keywordstyle=\color{orange},
language=Python,
morekeywords={*,plot,append,...},
showspaces=false,
showstringspaces=false,
showtabs=false,
stepnumber=1,
stringstyle=\color{red},
tabsize=4,
title=\lstname,}
\lstdefinestyle{frameStyle}{
basicstyle=\footnotesize,
numbers=left,
numbersep=20pt,
numberstyle=\tiny\color{black}}
\tcbuselibrary{listings,skins,breakable}
\newtcblisting{customFrame}{
arc=0mm,
top=0mm,
bottom=0mm,
left=3mm,
right=0mm,
width=\textwidth,
listing only,
listing options={style=frameStyle},
breakable}
\usepackage{floatrow}
\usepackage{setspace}
\usepackage{float}
這是我想要創建的一個最小範例(之前有上面的程式碼\begin{document}
):
\documentclass[12pt,a4paper]{report}
\usepackage{enotez}
\begin{document}
Using this method \endnote{} we get...
\pagebreak
\printendnotes
\begin{customFrame}
for i in range(10):
print(i)
\end{customFrame}
\end{document}
提前致謝 !