是否可以为每个源代码行定义自定义数字,例如:
1 string title = "This is a Unicode π in the sky"
22 /*
23 Defined as $\pi=\lim_{n\to\infty}\frac{P_n}{d}$ where $P$ is the perimeter
24 of an $n$-sided regular polygon circumscribing a
25 circle of diameter $d$.
26 */
30-40 ...
162 const double pi = 3.1415926535
答案1
一个很好的解决方法是使用 minted 的 texcomments 选项:
\inputminted[texcomments]{python}{code/excerpt.py}
在您的代码中,只需添加一条注释:
# \setcounter{FancyVerbLine}{20}