I've been searching around but I can't find any info for adding an image background for my code listing using the listings
package. Is there a way to do this?
[Tex/LaTex] Background images for code listings
backgroundsgraphicslistings
backgroundsgraphicslistings
I've been searching around but I can't find any info for adding an image background for my code listing using the listings
package. Is there a way to do this?
Best Answer
As PolGab says, there is always a
tikz
way. Here is one that uses the infamous\tikzmark
to mark the begin and end of the listing, and then adds an image clipped to the size of the listing:Note:
This does require two runs. First one to determine the locations, and the second to do the drawing.
The
\tikzmark
is from Adding a large brace next to a body of text.Issues:
This however has some serious issues:
A blank line is required before the listing (surprising result otherwise).
Not sure why the fudge facts were required, but they end up aligning the frame to pretty close to where the
fram=tb
option would have drawn the horizontal lines.Code: