# 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 option.

-
This is one of the things that's HARD - if not impossible - in LaTeX, while it probably just works in ConTeXt. –  Martin Schröder Jun 10 '11 at 6:54

Use the switch option for the lineno package.

\documentclass[twocolumn]{article}
\usepackage[switch]{lineno}
\usepackage{lipsum} %Creates example text
\begin{document}
\linenumbers
\lipsum[1-20]
\end{document}

-
The line numbers appear on the right of the left column in this answer. –  Sony Nov 12 '11 at 1:04
For numbering of lines on a per-column basis, add the columnwise option to lineno. –  Werner Nov 13 '11 at 21:16
@Sony --- Not so on my machine. Make sure you compile twice so that the warning about line number reference goes away. –  Ian Thompson Nov 22 '11 at 16:14

The following is a partial solution.

\documentclass{article}
\usepackage{multicol}
\usepackage{lineno}
\usepackage{lipsum}
\begin{document}
\begin{multicols}{2}
\linenumbers
\lipsum[1-1]
\columnbreak
\rightlinenumbers
\lipsum[1-1]
\end{multicols}
\end{document}


-
Using lineno with the switch option, you need to compile at least twice. Your solution works in a different context just as well. –  Werner Nov 13 '11 at 21:15

Simply add [columnwise] in the options of the package:

\usepackage[switch,columnwise]{lineno}

-