8
votes
3answers
199 views

Listing background broken by \colorbox and \framebox

I am using listing environment (listings package) with the background parameter. I want to highlight some lines of code and I am using the \colorbox, \makebox and \framebox to achieve this. However, a ...
4
votes
1answer
149 views

Making Inline Code Printing Pretty

I have to include small code snippets like method and class names within continuous text. I do not want to display those snippets as complete seperated listings, they should be displayed inline, ...
1
vote
0answers
52 views

Dropping boxes on top of the listings environment [closed]

I was wondering if anyone knew a decent way to drop boxes of text on top of the listings environment. This would be most useful for a beamer presentation that I am currently writing. Ideally the text ...
2
votes
1answer
129 views

Handle % character in verbatim inside a grey box

I found this snippet on the internet which is used to produce a text area inside a greybox. \newcommand\greybox[1]{% \vskip\baselineskip% \par\noindent\colorbox{lightgray}{% ...
2
votes
2answers
490 views

How to preserve tabs and whitespaces in \parbox in latex

I am currently trying to insert a batch file programming code in my report. I am using the code listing. I am not able to preserve white spaces and tabs to format my code! I tried using \hspace but it ...
7
votes
1answer
300 views

defining a centered shadowboxed listings environment

I'm trying to define a environment for code listings wrapped in a shadowbox and centered in the line. Using this code, I can generate the kind of output that I want: ...
4
votes
1answer
379 views

listings caption gray box meaning of code

Some time ago I copied this code from Stackexchange to have a nice gray box at the top of my imported source code which I displayed with listings: \DeclareCaptionFont{white}{\color{white}} ...
4
votes
1answer
527 views

lstlisting in a box?

My problem is that I am trying to write a document with coloured sections for examples. Examples can contain code listings. Somehow I can't seem to combine a background colouring with a listing, or ...
3
votes
1answer
106 views

Globally set the justification in a framed box

I want to show the text from a Python Interpreter in a Windows console. This should be plain text (like you see in a command line terminal). I also want to show Python code snippets with highlighting. ...
4
votes
2answers
469 views

listings: framebox shows breaks in font

Using the listings package in LaTeX seems to put lines in the frame box. This happens for all frame box options and if I use a shadow box it is even more apparent... Is there any way I can stop this ...
1
vote
2answers
522 views

Latex escape interrupts frame of listing

I am (ab)using a framed listings environment include an enumeration environment (by escaping to latex). This compiles fine but in the resulting pdf the frame around the listing is interrupted. ...
5
votes
1answer
2k views

How to make a box containing LaTeX output?

I am writing a short introductory book on LaTeX and I would like to implement nice looking code example boxes. Using this answer: Source code listing with frame around code? I made the boxes with the ...
1
vote
3answers
735 views

add vdots to a listing without breaking the box

I have a problem when I try to add \vdots in an escaped string inside of a listing environment. The box is cut. How can I avoid the break of the box? The code is this: ...
4
votes
1answer
676 views

\fbox inside listings

I am trying to highlight a specific line inside a listing with listinline. The code I am currently using looks like this: \begin{lstlisting}[escapechar=!] class A { void m() { B b = ... ...
7
votes
1answer
2k views

How to define a new environment with a fancy box (tikz) around sample source-code (listings)?

This is what I want to do: \documentclass{beamer} \begin{document} \begin{frame}[fragile]{Frame 1} Some \structure{Python} code here: % I want to define a new "pythoncode" environment, so ...