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?


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.}

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

    \index{#1 in chapter \thechapter } % might use a separate index for that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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