4
votes
1answer
68 views

Distorted caption in listings

The following code produces strange results. Everything looks fine, if I don't include the subfig package or don't use the xleftmargin parameter. It also works if I use captionpos=t. Is there a ...
2
votes
1answer
96 views

Listings float with sublistings

I want to have 2 listings side-by-side in a float environment with its own name (i.e. Listing 1 instead of Figure 1) and counter (so that I can have a separate listoflistings besides listoffigures). I ...
3
votes
1answer
168 views

Code listing in subfigure using lstlisting

I am trying to use the subfigure package of LaTeX to display a piece of SQL code. The purpose is similar to Code listing in subfigure, but I'd like syntax highlighting using lstlisting environment ...
2
votes
1answer
105 views

Multiple listings in one box with sub captions and using listings counter

I am using separate counters for (graphics) figures and listings. I am using the caption and subcaption packages. I construct sub-figures using subfigure: \begin{figure} ...
4
votes
1answer
272 views

Placing listing and figure side by side in memoir

I am writing a document using the memoir class where I want to place listings (with the listings package) and figures side by side. My first approach was to save the listing in a box and use subbottom ...
3
votes
2answers
396 views

Subfigure with lstlisting: what am I doing wrong?

It keeps telling me: \begin{document} ended by \end{figure}, but I do not understand why. I tried to follow the guidelines for the subfigure package. Here is my MWE: ...
6
votes
1answer
305 views

How to share a counter for a subfloat

I am trying to make a listing float containing 3 subfloats. I have managed to to make the actual float by combining the answers from question1 and question2. Now I only need to make mylisting use the ...
2
votes
2answers
475 views

LaTeX Source Code Listing Horizontally In Figure With Subfloats

I'm trying to embed a couple of listings \begin{lstlisting} >>> from sympy import Integral, latex >>> from sympy.abc import x >>> latex(x**2) x^{2} \end{lstlisting} ...
4
votes
2answers
2k views

How can I put lstlisting block into subfloat block?

I'm trying to compile my document but it's exploding. I've narrowed it down to this section: \begin{figure}[h] \caption{These are my awesome code snippets} \subfloat[This code runs every cycle.]{ ...
5
votes
1answer
961 views

Code listing in subfigure

I am trying to use the subfigure package of LaTeX to display a code listing. Here was my first attempt: \begin{figure} \subfigure[Standard approach]{ {\footnotesize \begin{verbatim} var caps = new ...
3
votes
1answer
5k views

Size of lstlisting in subfig

For a paper, I have to present two code snippets that do the same thing to compare them. I started having them in two different figures, but now, I'm trying to have them side by side, and that's ...
5
votes
1answer
3k views

Using listings and subfigure together

I am writing a document in which code listings and diagrams appear side-by-side frequently. I am using the listings package for the code and \includegraphics for the diagrams. I want to put them both ...