I'd like to typeset a document with a column of line numbers in the left margin. This is for proofing and discussion, so that we can accurately identify portions of text.

I'm aware of the lineno package (https://ctan.org/pkg/lineno) but I'm not convinced by the results -- it skips lines and sometimes whole paragraphs.

It would be nice if the line numbers in the margin line up with actual typeset lines of document text, but this is not vital; so long as the numbers are fairly close together, this should suffice for giving a sufficiently accurate idea of where to look.

I found an article about inserting a vertical line in the margin (https://latex.org/forum/viewtopic.php?t=23479) but that just inserts a vertical line, not a vertical line of numbers.

With apologies if I have missed something obvious, I would welcome advice, either in the form of a macro, or appropriate options to lineno, or pointers to another package.

Thank you.

  • 3
    Since lineno claims to do what you want, I feel like the appropriate action would be to create an example that shows lineno not doing what it claims to do.
    – Teepeemm
    Commented Jul 9 at 12:15
  • What @Teepeemm said if you want them aligned. If that doesn't matter, you can just overlay a column of numbers at shipout on every page (which should be faster provided you don't pull in something like tikz to do it). This would give the kind of output you get from online submissions where the software turns your paper into a version for review by just sticking a column of numbers on every page, regardless of whether there is anything there to number or not. Generally does the job.
    – cfr
    Commented Jul 9 at 14:23
  • @cfr Thank you, that's what I'm looking for. Do you have some code to do this?
    – Jim
    Commented Jul 11 at 10:27
  • Can you provide a minimal working example (MWE)? I would just save a stack of numbers in a box and use shipout/background or shipout/foreground hook to add them.
    – cfr
    Commented Jul 11 at 15:27


You must log in to answer this question.

Browse other questions tagged .