12
votes
1answer
172 views

How to make figure and listing share their counter

I'm using the "listings" package to write pieces of code (XML, RDF, Java, etc) and I want them to have the same counter of the Figure environment. For example, Listing 1: blablabla Listing 2: ...
1
vote
2answers
179 views

Listings numbering doesn't restart

I have problem with listing numbering from this topic. Numbering isn't restarted, it just continues. \AtBeginDocument{% \renewcommand{\thelstlisting}{% \ifnum\value{subsection}=0 ...
3
votes
2answers
363 views

Numbering of listings

I would like to numerate listings according to sections. If the listing is in subsection then it should have subsection numbers. This example is very good and I'm using it for some other numbering, ...
11
votes
1answer
956 views

listings package: no numbering in case the code has only one line

I have a custom style in lstlisting with numbers on the left and the number step is set every line. I would want to know how the listings could appear without number in case the listing has only one ...
1
vote
1answer
140 views

linerange in listinput firstnumber conflicts with stepnumber

If I create a code include as follows: \lstinputlisting[linerange=39-46, firstnumber=39]{./Matlab/script.m} And set the stepnumber to 5 in the lstset: \lstset{...,stepnumber = 5, ...} Line 40, ...
5
votes
1answer
138 views

Change listing number separator

I am working with the listings package and trying to change the separator from the default period to a hyphen. However, I cannot seem to figure out how to. I tried the code snippet below, but it ...
6
votes
2answers
355 views

How to make “sub-level” numbering for listings, similar to subcaption?

I think what I'm trying to do may be complicated, so if not all of it is possible then that's OK. I'm using the listings package and I've done something similar to Custom numbering of listings ...
5
votes
1answer
298 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 ...
4
votes
1answer
3k views

listings caption number

I'm using the listings package with this \begin command: \begin{lstlisting}[ language=Python, caption={Simple Python Program}, ] This yields a nice code listing with a caption like "Listing 1 ...
2
votes
1answer
558 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 ...
7
votes
1answer
1k 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 ...
2
votes
1answer
582 views

Changing Listing and Figure caption system in Platex

I'm working with platex (the Japanese latex compiler) and I'm trying to change the caption system for Listings and Figures. For both I would like the numbering to be based on section so if its a ...
3
votes
1answer
821 views

Custom numbering of listings

I have a number of listings in my document, numbered 1, 2, 3 and so on. I need a table with three listings (say, three different variants of the same algorithm), that will be numbered as 2a, 2b, 2c. ...
3
votes
1answer
542 views

How to change the formating of the title of a “Listing” from roman to arabic?

I recently stepped out of my comfort bounds and decided to add some Code snippets to my paper. I was able to get everything working fine and looking good, except the actual title. Everything else in ...
10
votes
2answers
2k views

Listings: different counters for different listing environments

How do I create two lstlisting environments that each have its own counter? If I use for example \lstnewenvironment{algorithm}[2]{ \renewcommand\lstlistingname{Algorithm} \lstset{ ... } } ...