* Luca Carlon wrote, On 14/10/09 11:47:
Hi! Is it possible to insert references in program listings? I tried to do that
but the button apply is disabled. I tried even to copy and paste a reference but
the reference doesn't appear in the PDF. Is there any reason why this is not
possible?

Do you want to reference other parts of the document or other listings?

If you use newfangle:
http://repo.or.cz/w/newfangle.git

then you can create references between code blocks, or references within the document to a code block from the document, using the \chunkref{} command.

However you may want to consider using the lstset escapeinside option.

Newfangle uses:
  \lstset{escapeinside={=<}{>}}
You could put this in the document preamble directly:

You can then insert LaTeX like this:

=<\ref{myref}>

in the listing - sort of like an ERT for listings.

I used =< and > for the latex delimiters because =< is not valid in any language I know.

Sam

Reply via email to