TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

can someone show an example how to obtain line numbers in the alltt environment in figures, possibly using the lineno package?

I've tried:

def insert(k, v)
  // ... pseudocode
\caption{Basic operations I}

but that, or using the linenumbers environment, doesn't do anything. The code above doesn't work even if the alltt environment is removed - there are no line numbers if the text is within a figure.

Is there any way to obtain line numbering in figures?

Thank you.

share|improve this question
up vote 5 down vote accepted

Figured it out - one should use the \internallinenumbers directive, like this:

def insert(k, v)
  // ...
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.