是否有人知道如何将自定义标记放置在分页符处的解决方案lstlisting
?
我想要的是在分页符之前和之后放置一个剪刀图标,但我没有找到办法做到这一点......
提前感谢您的提示!
答案1
您可以使用该tcolorbox
包及其listings
库将任何奇特的东西添加到列表中:
\documentclass{article}
\usepackage{pifont,lipsum}
\usepackage[skins,breakable,listings]{tcolorbox}
\newtcblisting{scissors}{%
enhanced jigsaw,breakable,size=small,
colframe=black,colback=black!5!white,
listing only,
listing options={% put any lstlisting options here
aboveskip=0pt, belowskip=0pt,
columns=fullflexible, keepspaces=true,
breaklines=true, breakatwhitespace=true,
basicstyle=\ttfamily, nolol,
},
overlay first={
\node[black!50] (S) at (frame.south) {\LARGE\ding{34}};
\draw[dashed,black!50] (frame.south west) -- (S) -- (frame.south east);
},
overlay middle={
\node[black!50] (S) at (frame.south) {\LARGE\ding{34}};
\draw[dashed,black!50] (frame.south west) -- (S) -- (frame.south east);
\node[black!50] (S) at (frame.north) {\LARGE\ding{34}};
\draw[dashed,black!50] (frame.north west) -- (S) -- (frame.north east);
},
overlay last={
\node[black!50] (S) at (frame.north) {\LARGE\ding{34}};
\draw[dashed,black!50] (frame.north west) -- (S) -- (frame.north east);
},
}
\begin{document}
\lipsum[1-4]
\begin{scissors}
>>> ls()
ARP: ARP
BOOTP: BOOTP
BLA: BLA
BLUP: BLUP
BLA: BLA
BLUP: BLUP
BLA: BLA
BLUP: BLUP
BLA: BLA
BLUP: BLUP
BLA: BLA
BLUP: BLUP
\end{scissors}
\lipsum[5-6]
\end{document}