Tagged Questions
5
votes
1answer
58 views
Listings line numbers that match the linerange specification
This is a follow-up question to First line number in lstinputlisting environment. Consider the MWE:
\documentclass{article}
%\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
...
3
votes
2answers
135 views
Continue line numbers in listings package?
I have been using the listings package to present my source code in LaTeX. However, I can't get the line numbers to continue between two separate user-defined listings that have been given the same ...
7
votes
2answers
179 views
How can I use line numbers with leading zeros?
I use the listings package for source-code and have read all documentation. However, it appears that leading zeros for line numbers are not implemented as standard option yet. How can I redefine the ...
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 ...
11
votes
1answer
194 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 ...
3
votes
2answers
313 views
Listings line numbers and figure
I'm using listings to typeset some C inside a figure environment next to a diagram, and I have the numbers on the left. My problem is in two-column mode the line numbers appear in what should be the ...
5
votes
1answer
93 views
Is it possible to change the font of line numbers in a code listing?
Using LyX I can add line numbers to my code listing. However, these are in the document (serif/Roman) font and look strange next to code blocks (Typewriter font). Is it possible to change the font of ...
6
votes
2answers
187 views
How do I prevent conflicts between accsupp and hyperref?
This question is related to the answer to the question Is there a LaTeX trick to prevent a PDF viewer from copying the line number?
Unless you turn hyperref off, the following MWE
...
47
votes
3answers
984 views
Is there a LaTeX trick to prevent a PDF viewer from copying the line number?
A PDF output is obtained by compiling the following code.
\documentclass{article}
\usepackage{xcolor}
\usepackage{listings}
\lstset
{
language={[LaTeX]TeX},
numbers=left,
...
5
votes
1answer
297 views
Shared line counter with \lstinputlisting
Using the listings package, you can name your listings to make them share a line counter:
On the other hand you can use firstnumber=auto and name your listings.
Listings with identical names ...
4
votes
1answer
496 views
Custom line numbers in lstlisting environment
I am using the lstlisting environment to display code and it works great, however for my current application I need something like:
line 1;
3.1: line 2;
line 3;
3.1.5: line 4;
...
3
votes
1answer
388 views
Suppress line numbering for specific lines in listings package
I would like to suppress the line numbering for specific lines in listings package by identifying the specific lines using some kind of command.
6
votes
2answers
861 views
Suppress line numbering for empty lines in listings package
The listings package quite nicely formats my pseudo code listings. Is there a way that one can specify that line numbering should be suppressed for empty lines?
2
votes
2answers
232 views
Wrong numbering of lines in lstlistings when using escaped commands
I'm using the listings package to format some Java code in my document.
I want it to number lines (1 number every 5 lines), and I need to highlight some keywords inside the code with the following ...
5
votes
1answer
811 views
In listings, how to show referenced linenumbers instead of standard ascending linenumbers
I'm just writing on my master thesis and have a (specific) problem with lstlisting package in LaTeX.
I'm referring to the Random.class-file in Java and only want to print some specific line-ranges, ...
5
votes
1answer
940 views
Listing with line numbers inside a table
I typeset a lot of listings (using the listings package) inside (array-based) tabular environments. This works like a charm, however, breaks when I pass the numbers= option to the listing:
...
5
votes
1answer
2k views
How can I force listings line numbers
This is what I want:
15 <servlet>
16 <servlet-name>udpListener</servlet-name>
17 <servlet-class>oli.servlet.UdpServlet</servlet-class>
18 <!-- UDP Port fuer ...
3
votes
2answers
782 views
Changing side of line numbering in two columns documents
I'm trying to type some report and I have a small problem with the twocolums document class and the line numbering in listings.
The document is on two columns :
...
1
vote
1answer
385 views
line numbering of minipages
I can't manage to add linenumbers left of the boxes. Can anybody help me?
\documentclass{article}
\begin{document}
\fbox{\fbox{
\begin{minipage}{0.8\linewidth}
\textbf{def} mapper (key, value):
...
6
votes
1answer
2k views
First line number in lstinputlisting environment
I use the following code to display line 23-45 of sort.cpp:
\lstinputlisting[language=C++,linerange=23-45]{sort.cpp}
However, the line numbering starts with 1 while I want it start at 23. I found ...
