2
votes
1answer
44 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}
...
5
votes
1answer
75 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
149 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
223 views
+50
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 ...
8
votes
2answers
306 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
224 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 ...
10
votes
1answer
380 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
126 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 ...
8
votes
1answer
191 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
179 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
356 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
412 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
656 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 ...
3
votes
1answer
176 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
554 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 ...
6
votes
1answer
201 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
605 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
453 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 ...
6
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
663 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 ...
