I was wondering if it is possible to refer to the lines of the code enclosed in lstlisting environment rather than just manually write a number of the line I want to describe. I have never met with this feature, is this available?


At page 53 in the manual you will find the section How to reference line numbers with the following example:

 for i:=maxint to 0 do begin
   { comment }(*@\label{comment}@*) 
Line \ref{comment} shows a comment.
| improve this answer | |

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.