Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Number each line of text in rmarkdown PDF

I am writing a document that is being knit into a pdf and I need each line to be numbered so that reviewers can refer back to particular sentences. I have found some reading on numbering code chunks, but how about just text?

like image 600
Nazer Avatar asked May 19 '17 15:05

Nazer


1 Answers

Add the lineno package to the header. Here is an example .Rmd file

---
title: "Line Number Example"
header-includes:
   - \usepackage{lineno}
   - \linenumbers
output:
   pdf_document
---

There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.  


There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.  
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.
There is a lot of text that goes here.  There is a lot of text that goes here.  

And the result looks like this: enter image description here

like image 84
Peter Avatar answered Nov 14 '22 05:11

Peter