TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

I am not very familiar with all latex details, but I'd like to use the listings package in a tufte-book document. However, the listings package places its captions above or below the listing and I couldn't find a way to adjust that in a way so that the caption is put to the page margin as with tufte-book's \marginnote etc.

Any idea how to solve that?

share|improve this question
i found a way with that tipp thank you – Peter Sommerlad Mar 6 '12 at 16:21
Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. – Jubobs Mar 1 '14 at 18:59
This does not work with labels for line number references, see "Use listings in tufte-book with captions in margin" – Michael Rudolf Dec 10 '15 at 17:04

It is best neither to mess with the listings or the tufte-book commands, as they are both difficult to modify. I would simply load the listing in a \begin{figure}...\end{figure} environment. If you want to have a different float for listings, you can use the float package.

This is a test
\caption{This is a test.}
share|improve this answer

Thanks to the above answer, this is what I use now:

    \index{#1 in chapter \thechapter } % might use a separate index for that.
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.