如何使行代码编号不可复制且为白色(或任何其他颜色)?
% arara: pdflatex: {shell: 1}
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{listings}
\usepackage{minted}
\usepackage{xcolor}
\usepackage{tcolorbox}
\tcbuselibrary{listings, minted, skins}
\tcbset{listing engine=minted}
\newtcblisting{javalst}{listing only, minted language=java, minted style=paraiso-dark,
colback=bg, enhanced, frame hidden, minted options={numbersep=2.5mm, fontfamily=fdm, linenos,
fontsize=\footnotesize, tabsize=2, breaklines, autogobble},
overlay={%
\begin{tcbclipinterior}
\fill[bg] (frame.south west) rectangle ([xshift=4mm]frame.north west);
\end{tcbclipinterior}
}}
\definecolor{inline}{RGB}{187,57,82}
\definecolor{bg}{RGB}{22,43,58}
\setminted[java]{bgcolor=bg, fontfamily=fdm, fontsize=\footnotesize}
\begin{document}
\begin{javalst}
public class ClassName {
public static void main(String[] args) {
System.out.println(args);
}
}
\end{javalst}
\end{document}
答案1
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{listings}
\usepackage{minted}
\usepackage{xcolor}
\usepackage{tcolorbox}
\tcbuselibrary{listings, minted, skins}
\tcbset{listing engine=minted}
\renewcommand{\theFancyVerbLine}{\textcolor[rgb]{1,1,1}{\texttt\footnotesize\arabic{FancyVerbLine}}}%<--- just add this line
\newtcblisting{javalst}{
listing only,
minted language=java,
minted style=paraiso-dark,
colback=bg,
enhanced,
frame hidden,
minted options={
fontsize=\footnotesize,
tabsize=2,
breaklines,
autogobble,
linenos,
numbersep=5pt,
fontsize=\small,
},
overlay={\begin{tcbclipinterior}\fill[bg](frame.south west)rectangle([xshift=5mm]frame.north west);\end{tcbclipinterior}}
}
\definecolor{inline}{RGB}{187,57,82}
\definecolor{bg}{RGB}{22,43,58}
\setminted[java]{bgcolor=bg, fontfamily=fdm, fontsize=\footnotesize}
\begin{document}
\begin{javalst}
public class ClassName {
public static void main(String[] args) {
System.out.println(args);
}
}
\end{javalst}
\end{document}