5

Does anyone knows a solution about how to make place custom markers at pagebreaks into lstlistings ?

enter image description here

What I want is to put a cissors icon before and after the pagebreak but I didn't find a way to do this...

Thanks by advance for tips!

Ruben
  • 13,448
bast0s
  • 51
  • 2
    Welcome to TeX.SX! Nice first question—you can make it even better by providing a complete, simple example that generates a listing crossing a page boundary. This way, would-be answerers can focus on the solution to your question rather than setting up this situation. – Paul Gessler Dec 29 '14 at 16:52
  • 2
    This thread might be helpful. – karlkoeller Dec 29 '14 at 17:35

1 Answers1

7

You can use the tcolorbox package with its listings library to add any fancy things to a listing:

\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}

enter image description here