Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
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
add comment

3 Answers

up vote 14 down vote accepted

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}
share|improve this answer
1  
The line numbers appear on the right of the left column in this answer. –  Sony Nov 12 '11 at 1:04
1  
For numbering of lines on a per-column basis, add the columnwise option to lineno. –  Werner Nov 13 '11 at 21:16
1  
@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
add comment

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}

enter image description here

share|improve this answer
1  
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
add comment

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

\usepackage[switch,columnwise]{lineno}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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