[Tex/LaTex] Lineno \internallinenumbers – how to make a line number label within a figure

cross-referencingfloatsline-numbering

This concerns the "lineno" package. The \linelabel directive works within the ordinary linenumbers environment. How to create a line number label within a internallinenumbers environment to be able to reference a line number? I need this to be able to refer to a line in the pseudocode in a figure.

Or, alternatively – is there an environment like figure in which the ordinary linenumbers and \linelabel work?

Best Answer

The package fancyvrb provides a line numbering facility (on p. 15 of its documentation is an example for labeling a line number for reference).

More powerful for displaying code is the listings package, which comes with an extensive documentation. It provides line numbering and labeling; its environments can go into a floating environment.