# [OS X TeX] Listings: \lstinputlisting and line number reference

Christian maillists at gmx.de
Sat Jul 18 13:41:57 EDT 2009

Am 18.07.2009 um 17:46 schrieb Ross Moore:

> Hello Christian,
>
> On 18/07/2009, at 10:49 AM, Christian wrote:
>
>>
>> Am 18.07.2009 um 15:47 schrieb Peter Dyballa:
>>
>>>
>>> Am 18.07.2009 um 14:06 schrieb Christian:
>>>
>>>> The log file says that "Reference lstbeamerclass' on page 14
>>>> undefined on input line 384."
>>>
>>>
>>> How does it work with LaTeX?
>>
>> What do you mean?
>
> I'd guess that he means using an ordinary LaTeX document-class,
> rather than with beamer.
>
> A possible reason for this is that with beamer you have the
> same material being typeset several times, for generating
> sequential page-builds. This raises the complication of "where
> does a hyperlink (for a cross-reference, say) actually point to?".
>
> So try getting your tables with cross-references working properly
> first without the extra problems that beamer might cause,
> then when that works fine, tackle the additional steps that may
> be needed to get what you want also with beamer.

I just tried to include some beamer code into  LaTeX document, no
typesetting of beamer code directly and using listings the same time.

Nevertheless, I figured out the problem. I needed to at

escapeinside={(*@}{@*)}

for escaping the labels from listings package, so that they could
actually used with \ref.

Anyway, thanks for the comments on the problem.

--
Christian

-It's better to be a pirate than to join the Navy.-

John Sculley and John A. Byrne, 1987

`