{listings} is a package that extends LaTeX's {verbatim} features. A variety of syntax highlighting options are available. For general questions about {verbatim} or {highlighting} use the respective tag. For the unrelated concept of list structures, use {lists} instead.

learn more… | top users | synonyms

1
vote
0answers
25 views

Change name of listings [duplicate]

Possible Duplicate: How to change the name of document elements like “Figure”, “Contents”, “Bibliography” etc.? I would change the name of listings but I don't know how to do. Instead to ...
6
votes
2answers
180 views

change code font using mcode package

I'm using mcode package to insert into my document matlab code. I would change the default font. what command I should use to get this font?
0
votes
0answers
72 views

Listings package with doublequote and german babel incompatibility [closed]

After adding the language ngerman to package babel in a large document I stumbled upon a strange error resulting from the parallel use of listings package: ! TeX capacity exceeded, sorry [grouping ...
2
votes
1answer
115 views

Creating a custom environment

I'm using the following syntax for my code snippets \begin{minipage}{\textwidth} \begin{lstlisting}[caption=<something>, label=<something>] The REST Endpoint URL is ...
7
votes
1answer
149 views

Label inside a code listing

Does anybody know how to use labels inside a code listing that it looks something similarly like this: I know that it's easier to use the line number but I prefer using some labels.
7
votes
1answer
297 views

How to center a lstlisting

I have the following problem. I want to center a listing, I tried this approach: How to center a listing? It works but when I try to set frame or numbers specifically for each listing I get errors. ...
2
votes
0answers
65 views

Enumerating listings in LaTeX breaks the list [closed]

Why is enumerating listings in LaTeX causing numbers in the list to be displayed in the wrong place? The following code prints the first and third list numbers in the correct place, but prints the ...
1
vote
2answers
131 views

Package listings doesn't work

I'm trying to understand how to use listings. In the preamble I have: \usepackage {listings} Inside my document I wrote: \begin{lstlisting} for i:=maxint to 0 do begin { nothing !} end; ...
7
votes
2answers
227 views

Listing with background color not line breaking correctly

I'm working on a project where I want to display an amino acid sequence. I want to let tex decide where to put the line breaks, but it doesn't seem to work in conjunction with highlighting certain ...
1
vote
1answer
130 views

Include a lstlistings keyword in lstlistings caption

I'm writing a small summary for my fellow students about VB in LaTeX. I have to cover the basic loops and found the \lstlistnigs package to be the best for writing colored code. I have already added ...
7
votes
1answer
181 views

Highlighting double backslash using listings with texcsstyle

I've got a question (it's in the title) about listings that I do not believe have been answered anywhere (either that or my Google-fu isn't that sufficient). Before I knew of texcsstyle's star option, ...
6
votes
1answer
222 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 ...
6
votes
1answer
47 views

`advise` Environment in listings package

I was reading the documentation for the latex listings package and there are advises in it which look like so: I had a quick look in the source code for the documentation and it turns out that ...
3
votes
0answers
67 views

define moretexcs (listings)

I want to define moretexcs lists outside of a lstdefinestyle macro because I want to load these definitions from a separate tex file. However inside lstset moretexcs is ignored: ...
7
votes
1answer
167 views

Insert Text between “List of XXX” Heading and Actual Listing

I would like to insert a small paragraph of text between the "List of Figures" heading and the actual list of figures, and also between "List of Listings" and the actual list of listings. I am using ...
1
vote
1answer
223 views

listings-package custom language use space as comment-delimiter

I'm creating a custom language definition with the LaTeX listings package that should render Java's Jar-Manifest files (key: value Pairs) so that one can easily distinguish key and value. My approach ...
6
votes
1answer
83 views

How to put stuff in the margin every first line with the listings package?

I am writting a book and I use the listings package to type some matlab code. I would like to highlight every code block with an arrow or whatever hanging in the margin at the first line. Moreover The ...
3
votes
0answers
149 views

algorithm2e-like vertical lines for loops in listings package [closed]

Is there any way to set vertical lines for loops in pseudo-algorithms written with listings package, in an algorithm2e style? As an example, see here: http://csweb.ucc.ie/~dongen/LAF/Algorithms.pdf ...
1
vote
2answers
199 views

lstinputlistings syntax highlighting

I am using package listings to import my Python source code into my LaTeX document. I use the command \lstinputlistings. I have a Python source like class MyClass(Yourclass): def __init__(self, ...
8
votes
2answers
1k views

How to highlight Python syntax in LaTeX Listings \lstinputlistings command

I am using package listings to import my Python source code into my LaTeX document. I use the command \lstinputlistings. I have a Python source like class MyClass(Yourclass): def __init__(self, ...
4
votes
1answer
94 views

How to I emphazise all words beginning with ` in an lstlisting

I use a preprocesser to process some code before my verilog compiler. All preprocesser words start with the ` character Example: `pp_if unfortunately its possible to define your own preprocessor ...
1
vote
1answer
145 views

Source Code using listings produce very large PDF

Taking a 2284 line source file (language=C) and embedding into a LaTeX document using \usepackage{listings} produces a PDF of around 150KB. The original source file is 78KB. By itself this is ...
4
votes
1answer
202 views

Set horizontal width on custom listings environment

I want to create a custom listings environment and want to set its width as something like 90% of textwidth, centred. Per an earlier question for algorithms, the first thing I tried was to embed the ...
5
votes
0answers
48 views

Review of algorithm-related packages? [duplicate]

Possible Duplicate: Print programs with its proper syntax Where can I find (if it exists) an updated review of the most relevant packages for handling with algorithms (pseudocode or code ...
3
votes
0answers
64 views

How to apply the star (*) to only a few of the literates in listings environment?

I have a problem with the definition of literate: \lstset{ numbers=left, numberstyle=\footnotesize, stepnumber=1, numbersep=12pt, frame=none, framesep=7pt, breaklines=true, ...
2
votes
2answers
115 views

Unindent code inserted with \lstinputlisting

Is it possible to unindent the code inserted using \lstinputlisting? In particular I'd like to be able to unindent by a fixed amount of whitespace. I have to write a relation on a OS scripting course ...
1
vote
0answers
72 views

Indenting listings in Auctex [closed]

I'm using the listings package to typeset some Python code. I don't seem to be able use the tab key in Auctex mode to indent my code within listings. I'm new to both Emacs and Auctex, but the only ...
3
votes
1answer
668 views

How to improve listings display of JSON files?

I was wondering if there is a good way for JSON files to be listed with the listings package. The only language definition I could come up with, is this: \lstdefinelanguage{json} { ...
4
votes
1answer
88 views

Getting incorrect underscores from macro in an lstlisting

I have a macro that I define as \newcommand{\versionPath}{5\textunderscore0\textunderscore7} to denote the word *5_0_7*, which I use in lstlisting's like this: \begin{lstlisting} ...
3
votes
1answer
81 views

how to better control the number display of listings?

I'm using the listings package for my sourcecodes, and among other things to control the display of those, I'm using \lstset, obviously. Now, When setting numberstyle, I've set them to ...
2
votes
1answer
188 views

LaTeX listing of command line syntax

I have a LaTeX document using the listings package for some bash scripts. I'd like to create a different styling for text that is meant to show the syntax of a command. For instance, I have the ...
5
votes
2answers
184 views

Comparing two versions of programming code with LaTeX

I'd like to compare two versions of program with vertical line between them. How can I do this with LaTeX?
4
votes
1answer
99 views

Improving the POV definition in the listings package

I'm attempting to create a language definition in the listings package that mimics exactly the syntax highlighting in POV-Ray 3.6 for Windows (http://www.povray.org/download/). Here is a screenshot ...
2
votes
1answer
65 views

Picture breaking listing

When putting long code using lstlisting on a page it breaks, which is fine. When placing a picture in a floating figure environment, it gets between the two parts of the listing, which obviously is ...
2
votes
1answer
69 views

How to prevent figures from floating 'into' listings

I have a problem with floats and listings. Sometimes it happens that a listing is split over two pages and when a figure is near the listing it happens that the listing starts on the first page, on ...
0
votes
0answers
150 views

Mysterious error with underscore + listings [closed]

Can someone explain why the following code fails with # latex test.tex This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012/Debian) restricted \write18 enabled. entering extended mode ...
3
votes
0answers
45 views

Highlighting keywords with spaces with the listings package [duplicate]

Possible Duplicate: How to emphasize within a listing two successive identifiers separated by a space? I am trying to highlight the following keywords with the listings package: over ...
5
votes
1answer
159 views

Listings package: coloring integers

I am using the Latex Listings package to include code in a document. I need to implemented syntax highlighting similar to what you see in a standard IDE. I've been able to assign colors to comments, ...
4
votes
2answers
267 views

Unicode characters changing order in listings (XeTeX)

I am trying to input code listings with unicode characters and everything seems to work (more or less) except some unicode characters being displayed out of order. For example instead of służąca ...
1
vote
1answer
100 views

How can I highlight text before a character with listing?

All is in the title. I would like to add a color to the text before a character with listing package. For example, I would like to add a color to text between the beginning of a line and : or =, in a ...
6
votes
1answer
235 views

lstlisting border bug when breaking lines

I have a certain bug regarding listings. I have used the \lstset command to configure my lstlisting environment. Somehow, when I have a line that is too long to fit into one row the listing breaks ...
2
votes
1answer
118 views

Define a macro for inserting a \begin \end listings block

Can you define a macro that would take a listings code as a parameter and insert it inside a \begin{lstlistings} \end{lstlistings} block? My idea is something like this: ...
3
votes
2answers
142 views

Sourcecode on the left, Nassi–Shneiderman on the right (float?)

I’d like to place a Nassi-Schneiderman diagram into my LaTeX document but also to have the source code for the shown algorithm beside it. Drawing the diagram worked just fine using the ...
1
vote
1answer
131 views

listings: How to increase space between backgroundcolor-box and code?

As you can see, the colored box created by backgroundcolor is quite tight. How can one increase the "padding", i.e., the space between the box and its content? This seems to be related, but I don't ...
6
votes
1answer
199 views

Unequal letter spacing in 'listings'

I am wondering why in the pdf of the example below the letters of the word "function" and the word "sum" seem to have different spacing. This somehow looks ugly. Apart from that, I am wondering if ...
10
votes
1answer
373 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
0answers
275 views

Advanced use of listings package [closed]

I am a PhD student in A.I. that is using the listings package to render its code snippets. I am trying to define a language environment for Drools - a quite famous Production Rules System - that is ...
5
votes
2answers
125 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 ...
2
votes
0answers
40 views

Aligning comments that break in several lines? [duplicate]

Possible Duplicate: How to align comments with lstlistings? I want to include Matlab code with long comments. The next MWE shows that it is achieved by using the listings package. However I ...
11
votes
1answer
188 views

Line numbering using listings package starts at random number

I'm using the listings package to include code directly from a file. In the first instance my code is numbered as I want it 1 at the 1st line, 11 at the 11th, ... However, the second block of code it ...

1 3 4 5 6 7 17