# Adding line numbers to an IEEE Latex document

I would like to add line numbers to an IEEE paper style. I have tried using different approaches, however non was successful. For example, when using \usepackage[switch,columnwise]{lineno} there will be line numbers missing when I have equations.

I have produced a sample latex file, could anyone help how to add line numbers to this document.

Thanks

\documentclass[journal,onecolumn,12pt]{IEEEtran}
\usepackage{amsmath}
\usepackage[switch,columnwise]{lineno}
\begin{document}
\linenumbers
\title{\huge LINE NUMBER TEST}
\author{FIRST~LAST,~\IEEEmembership{Member}
\thanks{FIRST LAST, IS WITH INSTITUTE OF TEST (e-mail: TEST@TEST.COM).} }
\markboth{JOURNAL OF TEST}%
{Shell \MakeLowercase{\textit{et al.}}: Bare Demo of IEEEtran.cls for Journals}
\maketitle
\begin{abstract}
This is for testing the appearance of line number. This is for testing the appearance of line number.
\end{abstract}
\section{Introduction}
\IEEEPARstart{L}{line} number (LN) in draft paper is a good option to locate exactly where you want. It helps you to find specific information in short time. Line number in draft paper is a good option to locate exactly where you want. It helps you to find specific information in short time. Line number in draft paper is a good option to locate exactly where you want. It helps you to find specific information in short time.
\begin{align*}
z_{1}&=x_{1}+y_{1}\\
z_{2}&=x_{2}+y_{2}
\end{align*}
Line number in draft paper is a good option to locate exactly where you want. It helps you to find specific information in short time. Line number in draft paper is a good option to locate exactly where you want. It helps you to find specific information in short time.
\newpage
Line number in draft paper is a good option to locate exactly where you want. It helps you to find specific information in short time. Line number in draft paper is a good option to locate exactly where you want. It helps you to find specific information in short time.
\end{document}

• How related to IEEEtran is your question? I mean, are you able to add line number to document produced with other classes? Does the lineno package works in other cases? – Clément Nov 26 '15 at 1:54

By simply adding the option peereview or peerreviewca, you get something that might suits your needs. According to How to Use the IEEEtran LATEX Class (IEEEtran manual),

\documentclass[journal,onecolumn,12pt, peerreview]{IEEEtran}


produces :

A MWE would be:

\documentclass[peerreview]{IEEEtran} % The critical option here is peerreview
\usepackage{lineno} % To obtain line numbers
\usepackage{lipsum} % Just for the demo, you can safely remove it.
\begin{document}
\linenumbers % Lineno command, turn on line numbering.
\author{Thomas}
\maketitle
\lipsum[15]
$$23 = 12 + 11$$
\lipsum[17]
\end{document}


producing:

Otherwise, you could try a method to add the line numbers on a pdf file, rather than during compilation.

• But you can see that there are lines (sentences) between 6-7 without line numbers. – sky-light Nov 23 '15 at 20:10
• That's because of the \IEEEPARstart{L}{line} option. For the equations to be numbered, you should remove the * in the align environment. I know this is quite unsatisfactory, but that's all you can do with the peereview option. – Clément Nov 23 '15 at 22:13
• I don't have problem with the equation numbers. I know that if I remove the "*" the equation number will appear. My question is about line numbers. I would like every line in the page has its own number, starting from line 1 at the top of the page to the last line at the bottom of the page (nearly line 60). – sky-light Nov 25 '15 at 22:37
• @sky-light : Ok, I understand your question (but I'm not sure to understand that "line numbers missing when I have equations" in your initial question, then). My answer is: there is an option in the IEEEtran class that partially solves your problem. I don't have any other latex-solution, but knows a solution to modify the resulting pdf. Maybe someone will come out with a better solution. – Clément Nov 26 '15 at 1:52
• This does not work for me (anymore?). I don't see any line numbers using your solution... – Paul Paulsen Oct 8 '17 at 20:17

IEEE's peerreview option doesn't seem to work with two-column option. In which case, the lineno package would do the trick.

\documentclass[twocolumn, journal]{IEEEtran}

\usepackage[switch]{lineno}
...
...

\begin{document}
\linenumbers
...
...
\end{document}


The switch option prints the line numbers on the left margin of the left column, and on the right margin of the right column.

(Credits for Mico's post for the solution)