Take the 2-minute tour ×
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.

This question already has an answer here:

I am working on a C++ reference manual for myself and want good looking listing code blocks.

This stack overflow question was very helpful: LaTeX source code listing like in professional books

But for the life of me I can't find anywhere on the internet for information regarding how to remove the "Listing #" part of the listing captions.

Below is a screenshot of what I have:

enter image description here

I want to remove the front part of the listing caption but still have a caption because i want to say the filename.

share|improve this question

migrated from stackoverflow.com Aug 28 '11 at 20:09

This question came from our site for professional and enthusiast programmers.

marked as duplicate by Jubobs, Werner, Svend Tveskæg, Jesse, Guido Jan 26 at 2:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers 2

I can't answer it fully but the command you are looking for should be \captionsetup.

E.g.

\documentclass{report}

\usepackage{listings}
\usepackage{caption}
\captionsetup{labelformat=empty}
\begin{document}

\begin{lstlisting}[caption = A sample caption]
public void helloWorld(){...
\end{lstlistning}

\end{document}

This causes the caption (every caption, listing or not) not to have Listing # (or Figure #, for that matter).

You might want to look into the doc here http://ctan.org/tex-archive/macros/latex/contrib/caption/ to adapt it to you needs. Please post a solution

share|improve this answer

There is also the title option, it is like caption with no number or prefix.

share|improve this answer

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