Tagged Questions
1
vote
1answer
33 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}}
...
3
votes
1answer
68 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 ...
3
votes
1answer
35 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
68 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
56 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
202 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
74 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 ...
1
vote
0answers
141 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
79 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 ...
0
votes
0answers
95 views
Stylized Caption with Listings [closed]
I'm currently trying to give my listings nice captions, so I decided to use something like this :
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{%
...
1
vote
0answers
59 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
285 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
261 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
390 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, ...
4
votes
1answer
317 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
643 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
339 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
153 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
257 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
2k 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
393 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
303 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
249 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
1k 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
185 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 ...
1
vote
1answer
1k views
Listing of a file with underscores in its name/path
I am writing a report with LaTeX and I need to list some source code. One of the files has some underscores in its path/name. When compiling the following line :
...
4
votes
1answer
661 views
How to change “Listing 1. Caption” to “Figure 1. Caption”?
I have a listing like so:
\lstset{language=Python,caption={Caption}}
\begin{lstlisting}
some Python code goes here
\end{lstlisting}
In the PDF this appears as Listing 1. Caption. How can I make it ...
8
votes
1answer
789 views
Remove “Listing #” caption prefix
I am working on a C++ reference manual for myself and want good looking listing code blocks.
This stack overflow question was very helpful: LaTeX source code listing like in professional books
But ...
6
votes
3answers
769 views
“Listing #” below listings without a caption
When not specifying a caption for a lstlisting nothing is shown below the listing while "Listing #: mycaption" is displayed as soon as I specify a caption.
However, I'd like "Listing #" to be ...
5
votes
1answer
250 views
Listings and continuation captions
In my document (KOMA script article) I use the listings package for code listings and the caption package for additional control over captions.
My problem is that some listings flow over multiple ...
11
votes
1answer
8k views
Listings caption
I'm using the listings package with this \begin command:
\begin{lstlisting}[caption=blabla, label=amb]
This yields a nice code listing with a caption like "Listing 1.1 blabla". Is there a way to ...