References in program listings

2009-10-14 Thread Luca Carlon
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?
Thanks!

Luca



Re: References in program listings

2009-10-14 Thread Sam Liddicott

* 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


Re: References in program listings

2009-10-14 Thread Luca Carlon
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!

Luca



Re: References in program listings

2009-10-14 Thread Sam Liddicott

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

  




References in program listings

2009-10-14 Thread Luca Carlon
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?
Thanks!

Luca



Re: References in program listings

2009-10-14 Thread Sam Liddicott

* 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


Re: References in program listings

2009-10-14 Thread Luca Carlon
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!

Luca



Re: References in program listings

2009-10-14 Thread Sam Liddicott

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

  




References in program listings

2009-10-14 Thread Luca Carlon
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?
Thanks!

Luca



Re: References in program listings

2009-10-14 Thread Sam Liddicott

* 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


Re: References in program listings

2009-10-14 Thread Luca Carlon
Sam Liddicott  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() I can compute...

So that I have a reference to an equation inside the listing.
Is this possible?
Thanks!

Luca



Re: References in program listings

2009-10-14 Thread Sam Liddicott

Luca Carlon wrote:

Sam Liddicott  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() 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