3
votes
1answer
85 views

Problem with mdframed, lstlisting and subfig

I'm trying to understand why the following code does not compile. \documentclass[12pt]{article} \usepackage[svgnames]{xcolor} \usepackage{filecontents} \usepackage{tikz} ...
6
votes
1answer
99 views

Aligning and centering a lstlisting with two columns on a page

Consider the following code taken from here to produce a fancy listing : % PACKAGES \documentclass[11pt,a4paper]{book} \usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry} ...
6
votes
1answer
143 views

Listing with two columns in a single fancy frame

I am playing a little with lstlistings and I wonder whether such a thing would be achievable for all my listings: How to achieve this kind of things? Note : I am searching for a solution I can ...
2
votes
1answer
78 views

Getting error while using top, and right braces in a listing

I am showing right and top braces, whereas while attempting to add overbraces using a new function called 'AddNoteOver', I am getting this error: "Package tikz Error: + or - expected ...
5
votes
2answers
377 views

Displaying C++ source code with TikZ

I’m trying to have some C++ source code displayed in a TikZ environment (I'm using TikZ to have several copies of the same text on a single page, so that when it is printed I can cut the sheet into ...
6
votes
1answer
231 views

How can I put a curly brace inside a listing to group code lines?

I am using the listing package. Is it possible to use curly braces to group some lines in the listing so as to be able to put an explanation to the right? I'm trying to use the code given in Peter ...
9
votes
1answer
203 views

Problems at page boundaries trying to highlight `\lstinline`

I was trying the code given in Colored background in inline listings, which is actually the same than in How to redefine \lstinline to automatically highlight or draw frames around all inline code ...
4
votes
1answer
177 views

lstlistings in defined Tikz box

I have created a box using \newcommand, based on TikZ named "mybox". The equation easily insertable in it. But I want to insert a \lstlisting environment in it. But it doesn't work. How can I do it? ...
2
votes
1answer
147 views

resizebox fails for tikzpicture when used in conjunction with listing package

Here is the example that fails \documentclass{standalone} \usepackage{tikz} \usepackage{float} \usepackage{listings} \usepackage{color} \usepackage{textcomp} \usetikzlibrary{shapes,positioning} ...
7
votes
1answer
498 views

tikz inside lstlisting inside tikz

Here is the minimum working example: \documentclass{article} \usepackage{tikz} \usepackage{float} \usepackage{listings} \usepackage{color} \usepackage{textcomp} \usetikzlibrary{shapes,positioning} ...
8
votes
2answers
546 views

Combining `tikzpicture` and `lstlisting`

I'm working on a custom lstlisting environment, in which I use TikZ to add a frame and a title. Because of the widespread curly braces of node I cannot use newenvironment, so I have to resort to ...
6
votes
1answer
517 views

Strange error when combining Beamer, Animate, Tikz and Listings

I'm working on some slides where I show how code is actually executed in Java. Therefore I'm working with the animate package to generate animations. Without going into details, I've written a macro ...
9
votes
2answers
665 views

Macros for code annotations

I'm wondering if there are some macros for annotating listings as below easily. They are primarily used in books from Manning. Solution For anyone who's interested, this is my macro I finally got: ...
6
votes
1answer
326 views

Aligning TikZ graphic vertically to neighbor in multicol

For my documentation of a blocks world problem in Prolog, I'd like to show the example code (using the listing package) next to the real world equivalent, which I made using TikZ. For this I used the ...
12
votes
1answer
938 views

Automatic background coloring in listings using tikzmark

I am authoring Beamer presentations that feature numerous code listings, and I am required to highlight portions of code with semi-transparent balloons. Yet I've come up with a solution that uses a ...
5
votes
2answers
181 views

Highlighting code introduces extra space

I am trying to highlight portions of code inside a listings environment. However, using tikz introduces some extra spaces that I do not understand and would like to ask how I can rid of them. Here is ...
15
votes
1answer
371 views

Is there a listings configuration for TikZ as used in PGF/TikZ manual?

I want to create a tutorial how to use TikZ now. Is there a listings configuration for TikZ as used in PGF/TikZ manual? For example, I want to make \ as an integral part of tikz in \tikz, relevant ...
2
votes
1answer
273 views

How to use listings inside pgfplots captions?

I need to add a (general) listings code in a plot caption. For some reason listings (inline) doesn't interact well with \addlegendentry, what can I do to make the same code work outside and inside an ...
5
votes
2answers
583 views

Position tikz pictures at left margin of a listing code block

I'm trying to finish my attempt at having good looking unlimited line annotations for the listing environments, using tikz. The original problem was that indentation caused shifts in the positioning, ...
6
votes
3answers
720 views

Different background colors for lstinline

In the following code, I've decided to use the code from Colored background in inline listings so as to redefine \verb to have the possibility to use colors for the text and the background of the ...
5
votes
1answer
1k views

Remove top and bottom margins around listings

When using the lstlisting environment, or similar ones from the listings package, there are paragraph-like margins above and below the actual text. This makes sense in a paper, but gets in the way if ...
4
votes
1answer
226 views

Multiple listings using range markers and PGF's \foreach

I've been trying to include multiple code snippets from a unique source file by using listings's range markers (named lines) and PGF's \foreach macro: \foreach \x in {1,2,...,8} { ...
6
votes
1answer
890 views

How to redefine \lstinline to automatically highlight or draw frames around all inline code snippets?

How to redefine \lstinline to automatically highlight or draw frames around all inline code snippets? E.g. using \bh and \eh commands from Highlight text in code listing while also keeping syntax ...
7
votes
2answers
303 views

How to emphasize within a listing two successive identifiers separated by a space?

I have this pgfplots code that I want to put in a lstlisting environment: \pgfplotsset{ every axis x label/.append style = { font = \small }, every axis y label/.append style = { ...
4
votes
1answer
814 views

Framing two-column listings with a tikz node : “missing \item” error ?

I'm trying to use this answer to put my lstlistings environments inside a tikz node. So I want to define a new listings environment, with \lstnewenvironment. My final goal, to be precise, is to ...
3
votes
1answer
597 views

Listings for Tikz code?

I am trying to quote (not compile!) LaTeX code (including TikZ code) within a LaTeX document. The verbatim package works, but it doesn't wrap text and doesn't look very nice. So I am trying to use ...
8
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 ...
1
vote
2answers
824 views

Define a new environment to combine tikzpicture and lstlisting

I would like to define a new environment to combine the tikzpicture environment from package pgf/tikz and the lstlisting environment from package listings. The result would be to first produce the ...