Is it possible to print Line Number in emacs to the Latex pdf for lines that I prefer?

If it is easy, I want to use those numbers with M-g M-g (goto-line command)

Edit: To make the question more clear, lets say

L56: Some text....
L57: Some text....
L58: \printLineNumberOfEmacsIntoPDF
L59: \begin{equation}
L60:     Some Equation
L61: \end{equation}

I am looking for a command like this such that it will print 'Line 58' into the pdf created by Latex.

  • Please specify whether you are looking for a strictly LaTeX answer, or whether you want Emacs to assist with that aspect. If the latter, please specify whether you are using the AUCTeX library or other method to process the file. In addition, please let us know whether you have already searched for and tried out strictly LaTeX solutions; and, if so, why aren't those solutions satisfactory? Also, what is M-g M-g bound to; e.g., the function name? [Type: C-h C-k M-g M-g] Finally, how about providing a minimal working example for us to block and copy, with some before/after expectations – lawlist Jan 16 at 7:51
  • I edited my question, hopefully, it is more clear now. I believe I am not using AUCTeX as I do not know it. I have also posted this question here. What I meant by M-g M-g is the goto-line command. – Atbey Jan 16 at 8:02
  • Take a look at sec. 2.6 of mirrors.ctan.org/macros/latex/contrib/listings/listings.pdf – Arch Stanton Jan 16 at 9:48
  • Let me link the answer here. – Atbey Jan 16 at 19:56

Your Answer

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

Browse other questions tagged or ask your own question.