3

I need to add line number in the latex {revtex4-1} generated pdf file. I am using the userpakage \usepackage{lineno} and \linenumbers after \begin{document}. It's showing the line number but very close to the text file.

I want the line number in the extreme left of the page. Can someone please help.

  • Welcome to TeX - LaTeX! Can you add a complete minimal document showing the problem. – Andrew Swann May 3 '18 at 9:52
  • You can try something like \setlength\linenumbersep{1cm} to adjust the space between the line numbers and the text. – Andrew Swann May 3 '18 at 9:55
2

Change \linenumbersep to be 1in plus \oddsidemargin, but then subtract the width of the box reserved for the numbers, that is, \linenumberwidth.

\documentclass{revtex4-1}

\usepackage{lineno}

\usepackage{lipsum}

\linenumbers

\AtBeginDocument{%
  \setlength{\linenumbersep}{\dimexpr\oddsidemargin+1in-\linenumberwidth\relax}%
}

\begin{document}

\lipsum[1-20]

\end{document}

enter image description here

  • Thanks a lot egreg. It's really work the exact way I wanted. Thanks again. – Shubhankar May 4 '18 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.