# How to put the caption below the listing?

When I use a simple caption, tex puts it above the listing

\begin{lstlisting}[caption={My Caption}]
\end{lstlisting}


If I use \captionof, caption goes below the listing, but paragraph for next line doesn't work.

\begin{lstlisting}
Listing example
\end{lstlisting}
\captionof{lstlisting}{My caption}

Next line, Next line, Next line, Next line.


As you see, there is not a paragraph.

• listings has an option to change the position of the caption. Look in the documentation, sec 5.7 Captions. – Ulrike Fischer Apr 10 '16 at 12:20
• Can you send me the link? – Rostislav Shtanko Apr 10 '16 at 12:24
• Use texdoc listings, or search in the doc-folder of your texsystem. – Ulrike Fischer Apr 10 '16 at 12:30
• I'm voting to close this question as off-topic because the topic could be solved by comments (and the O.P. was able to find it too) – user31729 Apr 20 '16 at 21:52
• @ChristianHupfer how is this off-topic? self answering questions is absolutely encouraged, and this is a valid question. Only problem is that the answer is edited in instead of being posted as answer... – TheFlow0360 Jul 5 '17 at 12:58

## 1 Answer

[Answer from OP, originally edited into question]

I found a solution.

\begin{lstlisting}[caption={My Caption},captionpos=b]