2
votes
0answers
55 views

How can I apply different custom caption styles to different listings?

In the MWE below, is it possible to define different caption formats for the two listings? In the example the first listing should use a blue caption background (like it is now) while the second ...
1
vote
1answer
41 views

Optional caption in listings (for listoflistings)

I have some cites in my captions. But I do not want to appear them in the table of figures or listings. With figures I managed to display an different caption like this: \begin{figure} \centering ...
4
votes
1answer
62 views

Final linebreak in lstlisting, and linebreak in captions (with IEEEtran)

Using: lstlisting in two columns How to add line break to caption without using caption package ... I got to the following MWE: % \documentclass[12pt,a4paper]{article} ...
5
votes
1answer
121 views

Fixing vertical spacing after \captionof as a custom caption

I'm trying to get a single caption after two columns of code. For two columns, parcolumns is the only method I've found that allows a page break in the middle and is my current favorite. Using ...
4
votes
2answers
103 views

How can I reverse the caption numbering in listing

How can I make a reverse numbered caption with listings? So the package makes ''Listing 1.1'' style captions but I need it in form ''1.1 Listing'' .
4
votes
1answer
92 views

How to handle listings, fancyvrb, newfloat and caption?

I am planning a "small thesis" for university which will need to display lots of code (C, C++, gnuplot, LaTeX, ...) - thus I spent this evening reading about listings and fancyvrb. The latter I've ...
1
vote
0answers
20 views

Change language of caption in lstlisting [duplicate]

When I define a caption in lstlisting, LaTeX writes, for example, "Listing 1.1: ..." but I want to change the "Listing" to another language. How can I do this?
4
votes
1answer
96 views

How can I mimick the listing caption style for my custom “Listing (cont.)” caption?

I have the following LaTeX code which works fine: \documentclass[12pt,a4paper]{article} \usepackage[a5paper]{geometry}% just for the example \usepackage[utf8x]{inputenc} \usepackage{listings} ...
2
votes
1answer
95 views

Footnotemark in caption of listing causing problem

I have the following listing: \begin{lstlisting}[float=h,caption={Description\footnotemark.}, label={listing2}, keywordstyle=\color{blue}\bfseries, ndkeywordstyle=\color{black}\bfseries, ...
6
votes
1answer
97 views

Equal spacing for figures and listings

I want to include figures and listings in my document and I want them to have the same spacings to text and captions. \documentclass[a4paper,12pt,openany,parskip,oneside,ngerman,headsepline]{scrbook} ...
0
votes
0answers
99 views

multiple listing styles with hyperref and caption packages

This is a follow-up question to Multiple listings styles. The MWE from the accepted answer works fine. Unfortunately, when I add the hyperref package OR the caption package (or both of them), the ...
0
votes
1answer
226 views

Caption below lstinputlisting in multicols + redefining lstlisting caption format

I have 2 problems with caption for lstlisting. I can't get the caption of lstlisting to go below the list when it's in a multicols environment. Although I've added ...
2
votes
1answer
81 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} ...
3
votes
1answer
94 views

Caption package destroys center/varwidth

I have received a wonderful comment how to get listings centered: \documentclass[a4paper]{book} %\usepackage[hang,small,it,hypcap=true]{caption} % screw hypcap \usepackage[T1]{fontenc} ...
10
votes
1answer
229 views

How to force lstlisting caption names and numbers to always appear, even when captions are empty?

I noticed lstlisting environment seems to supress the caption name and number when no caption is specified. See the code below: \documentclass{article} \usepackage{listings} \lstset{language=C} ...
4
votes
1answer
183 views

Captioning an mdframed box without making unbreakable

I would like to a have a caption below my mdframed box (outside the border if possible) which sometimes span across multiple pages. I managed to create a caption several ways but the pagebreaks are ...
2
votes
1answer
130 views

Adding caption and counter to source code environment

I have a source code listing with minted environment. How can I make a counter/caption to be shown as follows. I also need to make \tableofsourcecode to enlist all the source code references. The ...
3
votes
1answer
144 views

How to have center title in listings when you have subcaption (workaournd conflict between listing caption and subcaption class)?

I want to use listings package (\usepackage{listings}) to show a matlab code in a paper (using elsarticle class) but the title is not aligned in center below the code. This happened after I added ...
2
votes
1answer
651 views

Change caption style of listings package without “caption” package

Is there a way to change style of a caption in listings without the caption package (make it smaller and non-bold)? I am using \lstnewenvironment to create my own customized environment and then use ...
3
votes
1answer
221 views

Problems customizing listings captions

I'm trying to "decorate" source code with listings, but I'm getting some warnings and bad boxes when I compile my document. However the document compiles and looks like I want. I noticed the warning ...
6
votes
3answers
414 views

Hang caption in lstlisting

If I use the following command \usepackage[skip=20pt,hang]{caption} when a caption is very long it hangs in figures and tables, however, if the caption is of a lstlisting environment it doesn't. ...
5
votes
2answers
166 views

`listings` and `sidecap` - Side captions for listings

I am using the package sidecap for captions which appear left or right of a picture/table, like so: \documentclass[a4paper,twoside,11pt,openright]{scrbook} \usepackage{graphicx} ...
1
vote
1answer
88 views

How to set identifier “Listing 1” in listing in bold

I use figures and listings in a document. By default, the identifier "Figure 1" is set in bold, while "Listing 1" is normal. For consistent looks I would like to have either everythin bold or normal. ...
1
vote
0answers
21 views

How to use \lstinline inside figure environment's caption argument [duplicate]

Here is the code that I have (I have removed parts which I think are not relevant): \documentclass[12pt]{article} \usepackage{listings} % Python style for highlighting ...
2
votes
2answers
252 views

Code listing spanning multiple pages with captions at top

Is it possible to span a lstlisting environment or lstlistinginput on multiple pages, such that the caption is repeated on each page (the listing counter stays the same), as well as being able to ...
3
votes
1answer
2k views

Styling a lstlisting caption using caption package

I'd like to style a caption in a specific way, but I can't seem to figure out the proper settings to do so. First off, I'd like to change the label from "Listing" to "Algorithm" when I use ...
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}} ...
5
votes
1answer
264 views

Multiple listings styles

In using the listings package, how can I have a distinct \lstlistingname value for each type of listing. Lets say my document has C++, R and Pseudo listings, and I would like the \lstlistingname ...
5
votes
1answer
178 views

Wider caption for listing using multicol

I am using the multicol and listings packages. I would like to have the caption spread across the entire listing for multi-column listings. Here is a MWE of what I am attempting, however the output ...
4
votes
1answer
198 views

Command to insert filename in caption of a listing

I would like to have a command to insert listings that contain the filename in the caption. This works well as long as there is no "_" etc. in the filename. I also tried the suggestion from a ...
2
votes
1answer
112 views

Getting lbr frame lines in a listing up to the caption box above it

I have a document similar to this: \documentclass[twoside,11pt,titlepage,a4paper]{report} %unterscheidung zwischen gerade und ungerade seite, 11pkt, kp, kp \usepackage[T1]{fontenc} %inputcodierung ...
11
votes
2answers
590 views

Center caption in listing

I want to put the caption of my listing in the center but I can't do that. Do you have any idea how I could achieve this? The code: \documentclass{report} \usepackage{color} \usepackage{xcolor} ...
4
votes
1answer
140 views

Caption for a listing

I have captions on each of my listings. Each caption is prefaced with "Listing # [text]" where # is the number of the listing. Each caption is centered over my listing. How can I modify the options of ...
2
votes
0answers
215 views

Page break before caption in lstlisting [closed]

I have the following settings for a lstlisting: \lstset{ language=XML, numbers=left, numberstyle=\tiny\color{gray}, stepnumber=1, numbersep=5pt, ...
1
vote
1answer
101 views

Order of `float` and `caption` packages in preamble

I am using float and caption packages in my document, and also packages like tabularx, listings, algorithm... that (as far as I know) define floating elements or elements that have captions ...
1
vote
0answers
61 views

How to setup the caption and listings package to insert code? [duplicate]

Possible Duplicate: Caption parbox 6.0 pt too wide I used caption and listings package in my .tex file as below: \documentclass{article} \usepackage{listings} \usepackage{xcolor} \lstset{ ...
5
votes
1answer
2k views

How to change listing caption?

I have some listings that contain pseudo-code of algorithms. And I use this: \lstset{caption={Descriptive Caption Text},label=DescriptiveLabel} to add captions to them. My problem is that the ...
3
votes
2answers
579 views

Listings package with caption legend in spanish

I'm using the listings package and would like to translate the caption text displayed to Spanish, so instead of Listing 1: Dummy label it will display Listado 1: Dummy label. This is my code: ...
4
votes
1answer
674 views

How to center listings caption?

I would like to know how to center the listings gerenated caption in LaTeX. It always go to the left of the code. The rest of the captions (tables) are OK. \documentclass[11pt,a4paper,oneside, ...
6
votes
1answer
704 views

Adjusting Vertical Spacing between a listing and its Caption

I am very new to LaTeX. I am inserting a listing as follows: \lstinputlisting[float=hk, caption=My Caption comes here, captionpos=b, ...
1
vote
1answer
2k views

How to customize the caption format for \lstinputlisting

I know how to customize the caption format of lstlisting environment. But how to do this if I used the \lstinputlisting command to import code? My document contain below snippet. \begin{framed} ...
5
votes
1answer
909 views

cite in caption of listings

I am trying to cite a paper in the caption of listings. I have the following code: \begin{lstlisting}[caption=Example of something (Adapted from \cite{abc})] example \end{lstlisting} But this is ...
4
votes
1answer
257 views

listings caption is distorted

I used listing for listing the codes like: \documentclass[prodmode,acmtecs]{acmsmall} % Package to generate and customize Algorithm as per ACM style \usepackage[ruled]{algorithm2e} ...
6
votes
3answers
389 views

Invisible listing captions

Short version: how can I make a listing's caption show up in the List of Listings but not in the body of the document where the listing is? I'm writing a university report, and many of my subsections ...
3
votes
1answer
4k views

\usepackage{caption} breaks references to tables

I'm formatting the listings captions as follows: \usepackage{caption} \DeclareCaptionFont{white}{\color{white}} \DeclareCaptionFormat{listing}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}} ...
2
votes
1answer
460 views

captionof{lstlisting} Listingsnumber not in caption shown

Hi there having another problem. In the following Minimal Example a listing with captionof doesnt show the Listings Number in the Caption :( \documentclass[ 11pt, % Schriftgröße DIV10, ...
7
votes
2answers
366 views

combining listings and tufte-book, listings caption on tufte's margin

I am not very familiar with all latex details, but I'd like to use the listings package in a tufte-book document. However, the listings package places its captions above or below the listing and I ...
3
votes
1answer
339 views

Sync listings caption numbers and add all to List of Listings

I want to create a list of all listings. Listings itself allows to add captions and list them in a list using \lstlistoflistings, but they can not float. If I set up such a floating environment using ...
4
votes
1answer
3k views

Define a new caption in a listing environment

I want to have different listings with different types of captions, consider that I've got the following: \documentclass{article} \usepackage{listings} \usepackage{color} \usepackage{caption} ...
1
vote
1answer
444 views

how do I remove “Listing 1” from my lstlistings code?

This is my latex code: \documentclass[12pt]{article} \usepackage{listings} \begin{document} \begin{lstlisting}[caption=Figure 3] Source | SS df MS Number of obs ...