Luca Carlon wrote:
Sam Liddicott <s...@...> writes:
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
mmh... no, I don't think this is what I'm trying to do. I would like to insert
inside a listing a reference to other parts of the document, a Chapter for
instance, or an equation. For examples, in a C listing I could have:
// According to Equation(<reference>) I can compute...
So that I have a reference to an equation inside the listing.
Is this possible?
Thanks!
Yes, I just told you how:
Put this in your document pre-amble
\lstset{escapeinside={=<}{>}}
Then in your listing put:
=<\ref{myref}>
where myref is your reference.
The =<...> behaves like ERT but for listings.
Sam
Luca