答案1
tcolorbox
已经有了这个。你基本上需要密钥hbox
。例如,
\documentclass{article}
\usepackage[skins,listings]{tcolorbox}
\usetikzlibrary{shadings}
\newtcblisting{mylisting}{%
listing only,enhanced,drop fuzzy shadow,hbox,
frame style={upper left=blue,upper right=red,lower left=yellow,lower right=green},
interior style={left color=blue!30,right color=cyan!30,middle
color=white,shading angle=10}}
\begin{document}
\begin{mylisting}
WRITE (*,(2I6,F10.4)) istart,istop,step
\end{mylisting}
\end{document}