I have post a question several weeks ago: Print programs with its proper syntax, and I choose to use tabbing package at the moment.

Now I really need to keep the tabbing and print a line number before each line. It will be great if this line number is automatically generated. Does anyone know how to do it?

I guess one fundamental approach is to define my own highlighting and tabbing rules based on the syntax of my language. (I have seen an example somewhere, but I could not find it anymore...) Could anyone help?

  • It would be helpful to compose a MWE including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. – Peter Grill Nov 19 '11 at 15:54
  • 1
    IMHO you made the wrong choice to use tabbing and now want automatic line number and syntax highlighting that other packages like algorithmicx and listings can perform by default. Why do you "really need to keep [..] tabbing"? – Werner Nov 19 '11 at 15:57
  • 1
    I'm with Werner. This sounds to me like the ideal use case for listings. – qubyte Nov 19 '11 at 16:33

There is a package ntabbing on CTAN which provides the ntabbing environment which numbers lines. It's not present on TeX Live, but it's simple to put it in the same directory as the main file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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