# Latex removing “Listing #” [duplicate]

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:

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

-

## migrated from stackoverflow.comAug 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, GuidoJan 26 at 2:17

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

-

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

-