TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing a dtx file containing several source files. Is there a way to reset the line counter when commenting the code of a different file?

My dtx file looks something like this:

% .... comments and code of file 1
% .... comments and code of file 2 ... etc.

and I would like the line numbers of the code of file2 to start with 1 again.

share|improve this question
up vote 3 down vote accepted

The doc package uses the CodelineNo counter so \setcounter{CodelineNo}{0} probably does what you need.

share|improve this answer
perfect, thank you! – Jonathan Mar 22 '12 at 11:33

Your Answer


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.