{line-numbering} is about numbering the text lines of documents or parts of them. Popular packages are `lineno` and {ledmac}.

learn more… | top users | synonyms

61
votes
3answers
2k 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, ...
42
votes
8answers
10k views

Add page and line numbers to a pdf

Is there any quick script to add page and line numbers to each page of a pdf document? 1) I often enough get articles in pdf to review, with no page number. I end up writing them by hand to refer to ...
20
votes
1answer
915 views

How to make text copy in PDF previewers ignore lineno line numbers?

I'm using lineno for a document. I have it configured to put line numbers in the margins of the document. I generate PDF using pdflatex. Here's the problem: when people copy a region of text in a ...
16
votes
5answers
951 views

How to create a lined page with line numbers?

I'd like to create a page in my LaTeX document that just consists of lines. It should look like this: Additionally, I want the lines numbered. I have no idea where to start. Are there any hints?
16
votes
1answer
5k views

Show the number of lines in margin

How to show the number of lines in a short passage like that: (EVEN PAGE STYLE) margin ...
16
votes
1answer
8k views

Adding line numbers to latex and respecting equations

It's often convenient to add line numbers to a page automatically and the lineno package generally does the trick. But I've had two problems with it It doesn't seem to align the line numbers with ...
15
votes
1answer
12k views

How to put a line number every line of algorithmic

I am looking for a way to have a number for every line in algorithmic: \documentclass{article} \usepackage{algorithm} \usepackage{algorithmic} \begin{document} \begin{algorithm} ...
12
votes
3answers
3k views

Lineno for 2 column

How to add line number to a 2 column document where the line number must appear on the left for the left column and on the right for the right column. The lineno package does not seem to provide this ...
12
votes
1answer
2k views

How to number all lines in a draft?

I want to have a draft of a document I am writing, with the line numbers aside. I looked at some options like lineno, but this way it skips some lines. Is there a simple workaround or another package ...
11
votes
1answer
430 views

Using listings: “zebra effects” AND line numbers

I just made a code listing with a "zebra effect", just like here: Creating a zebra effect using listings But afterwards, the line numbers at the left side of the listing don't appear any more. This ...
11
votes
1answer
583 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 ...
10
votes
1answer
935 views

How to count number of lines in PDF document?

I'm using the lineno package to print line numbers (each page starts with number one) in the draft of my document: \usepackage[switch*, pagewise]{lineno} Is there a way to read out the number of ...
10
votes
2answers
2k views

Number every line of pages

When editing documents it is convenient to have all the lines on a page numbered (on the left margin) so that the reviewer can refer to them in his report. How can I achieve this with LaTeX?
9
votes
3answers
2k views

Why doesn't lineno number a paragraph when it is followed by an “align” equation environment without a space?

lineno skips the line numbering in this case: \documentclass[12pt]{article} \usepackage{amsmath} \usepackage{lineno} \linenumbers \begin{document} Lorem ipsum dolor sit amet, consectetur adipiscing ...
9
votes
2answers
320 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 ...
9
votes
2answers
2k views

Lineno - numbering abstract's lines.

The package lineno.sty is not numbering my abstract's lines. Any suggestions? Thanks. \documentclass[a4paper,12pt]{amsart} \usepackage{indentfirst} \usepackage{hyperref} \usepackage{showkeys} ...
9
votes
1answer
3k views

Algorithm spanning more than one page

I have an algorithm which is too long to fit on one page. Someone suggested splitting the algortithm manually and then altering the second algorithm's line numbers to follow on the first. I know ...
9
votes
1answer
2k views

Why doesn't lineno number a paragraph when it is followed by an indented equation?

While searching for the source of missing line numbers, I realized that paragraphs followed immediately by an equation have no line number, but this is fixed when a space is included, e.g. the ...
9
votes
2answers
147 views

Environment for ancient Greek poem with comments

I want to write an ancient Greek poem and I am having problems in setting the right environmental parameters. My major difficulty is to make an effective use of footnotes. Instead of using a ...
9
votes
1answer
5k views

How to add unnumbered lines in an algorithm?

I am typesetting algorithms with the algorithm package, and I would like to add unnumbered lines in them. Is there a way to create a \State* command, the same way there is an equation* environment? ...
8
votes
1answer
112 views

Lineno splitting the document into hundreds of pages

I was trying to get all the lines numbered in my document, as explained in this question: Show the number of lines in margin However, when I added the lines: \usepackage{lineno} \linenumbers to ...
8
votes
1answer
3k views

How can I start the line numbering of my listing by an arbitrary number?

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 ...
7
votes
2answers
151 views

highlight line numbers in listings

I would like to highlight the line numbers of the lines I refer to with lstlistings. I use escape characters to define labels in my Listing to which I refer later in my document (e.g. see Line X of ...
7
votes
2answers
346 views

Change from old style numbers to lining numbers in lineno's linenumbers environment

I am using old style numbers in my document, but I prefer lining numbers in my line numbering environments (lineno's \linenumbers environment). How can I enforce this (without changing to another ...
7
votes
1answer
471 views

Problem with package lineno

I'm using package lineno for proofreading of my documents. So I usually have something like the following MWE: \documentclass{article} \usepackage{blindtext} \usepackage{ifthen} % to use ...
7
votes
1answer
810 views

mdframed with tikz method: putting line numbers outside of frame

I want to number the lines in a mdframed environment with the line numbers appearing on the left of the frame, outside of it. \documentclass{article} \usepackage[framemethod=latex]{mdframed} ...
7
votes
1answer
2k 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: ...
7
votes
2answers
399 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 ...
7
votes
1answer
302 views

Shipout line like Shipout page

In lineno package guide, I found: Attaching line numbers after TeX has broken the paragraph into lines is already quite a difficult job for TeX. Why? Because TeX does not normally give you any ...
7
votes
1answer
821 views

Line length in fancyvrb

What I'm doing: Typsetting source code using pygments. What is happening: the code typsets fine, but because pygments puts the code into a Verbatim environment, some of the lines are far too long. ...
7
votes
1answer
1k views

LaTeX minted package: numbering lines does not work [closed]

I'm having a problem with the minted package. When I try to add line numbering to the minted command, I get the following error: ! Package keyval Error: stepnumber undefined. See the keyval package ...
6
votes
2answers
2k 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?
6
votes
1answer
159 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
901 views

How to see the Steps number in an algorithm

In below algorithm I have used the package \usepackage[linesnumbered,ruled,vlined]{algorithm2e} 1) How do I see steps number after step 2? 2) Is there any command apart from ...
6
votes
1answer
138 views

loading lineno changes spacing in document

I loaded lineno to number the lines on my resume for critique by a professor. Doing so changed the spacing after the headers. I would like to number the lines and retain the original formatting, if ...
6
votes
1answer
243 views

How to introduce line numbers on specified lines

I'm trying to introduce line numbers in a hymn on specific lines. I'm using the lineno package but I'm having no luck with it. Ideally I'd like a macro that I can use to say place line number here. ...
6
votes
1answer
193 views

Disabling line numbers in section headers

I'm using the lineno package to number lines in a document. By default, lineno attempts to number everything, including section headers. I would like disable line numbering on section headers, ...
6
votes
1answer
273 views

Line numbering in ConTeXt outside of verbatim

Basically, I would like a way to number the lines in a block of text, without resorting to verbatim mode. I have tried \definetyping[code][numbering=line,style=\tf] \startcode[step=5] Thus, I came ...
6
votes
1answer
1k views

Line numbering in algorithmic

I want to change the first number of the line numbering in my algorithm, but how is it done? This is my example: \documentclass[12pt]{beamer} \usepackage{amsmath, amsfonts, amssymb, amsthm} ...
6
votes
1answer
579 views

verselinenumbersleft with twocolumn

Situation: a poem in the verse environment of the verse package, while the entire page is set with the twocolumn option. Line numbering is enabled via \poemlines{1} and set to the left by ...
6
votes
2answers
141 views

Exclude line numbers from margin width

I am using the lineno package to add linenumbers on my twosided document. However, I have a restriction to leave a margin of 2.5cm inner and 4cm outer margin. This has to be completely free space. ...
6
votes
1answer
4k 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 ...
6
votes
1answer
851 views

Line numbers in pseudocode in figures - using lineno in figures

can someone show an example how to obtain line numbers in the alltt environment in figures, possibly using the lineno package? I've tried: \begin{figure}[h] \begin{alltt} {\linenumbers def insert(k, ...
6
votes
1answer
411 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 ...
6
votes
1answer
2k 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, ...
6
votes
1answer
50 views

Actual line numbers for listings: firstnumber=\inputlineno is off by one

I would like to have the actual line numbers next to my code listings but if I use firstnumber=\inputlineno, this gets evaluated one line too early: \documentclass{article} \usepackage{listings} ...
6
votes
1answer
4k views

How to adjust line numbers of algorithm2e package?

When using line numbers in the algorithm2e package, the line numbers are placed left of the text block, not directly below the text. See page 5 of the algorithm2e manual. Is it possible to place them ...
5
votes
2answers
67 views

eledmac package: \pausenumbering and \resumenumbering

I'm using the eledmac package to typeset a rather large work of theology. For simplicity and the sake of a MWE, I'm just using the two stanza poem below. Intended outcome: Between sections that are ...
5
votes
1answer
96 views

Line numbers on different margins in two-sided document

I'm using the lineno package to print line numbers in my two-sided document, but they are always printed in the left margin. \documentclass[twoside]{book} \usepackage{lineno} \usepackage{lipsum} ...
5
votes
1answer
243 views

Eledmac line numbering out of margin at top of column (memoir)

I'm using eledmac to typeset a document with two columns in memoir. The first line number at the top of the right column continues to be placed to the left of the column, as it was with the left ...