我真的很喜欢可以添加到 AsciiDoc 源代码列表中的“标注”功能https://docs.asciidoctor.org/asciidoc/latest/verbatim/callouts/。我想知道是否有一个 LaTeX 包可以做同样的事情。我目前正在使用“minted”包来列出源代码,如果可能的话,我希望它与该包兼容。
谢谢
答案1
找到一种方法来解决这个问题,即按以下方式使用pifont
和包:color
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{minted}
\usepackage{pifont}
\usepackage{color}
\begin{document}
\begin{minted}[escapeinside=||]{python}
import numpy as np
def incmatrix(genl1,genl2):
m = len(genl1)
n = len(genl2)
M = None #to become the incidence matrix | \textcolor{black}{ \ding{182} } |
VT = np.zeros((n*m,1), int) #dummy variable
#compute the bitwise xor matrix
M1 = bitxormatrix(genl1)
M2 = np.triu(bitxormatrix(genl2),1)
for i in range(m-1):
for j in range(i+1, m):
[r,c] = np.where(M2 == M1[i,j])
for k in range(len(r)):
VT[(i)*n + r[k]] = 1;
VT[(i)*n + c[k]] = 1;
VT[(j)*n + r[k]] = 1;
VT[(j)*n + c[k]] = 1;
if M is None:
M = np.copy(VT)
else:
M = np.concatenate((M, VT), 1)
VT = np.zeros((n*m,1), int)
return M
\end{minted}
\ding{182} Here is have a comment
\end{document}