# listing caption with a break line

Is there an option to break line in an lstlisting's caption? For example:

\begin{lstlisting}[frame=single, caption=uppertext\\lowertext)]


I've tried with \\ and some other solutions, but any of them works.

You can set the caption using a tabular. However, also set the optional caption (for the \lstlistoflistings) without the line-breaking tabular:

\documentclass{article}

\usepackage{listings}

\begin{document}

\lstlistoflistings

\begin{lstlisting}[
frame = single,
caption = {[upper/lower text]%
\begin{tabular}[t]{@{}l@{}}
upper text \\
lower text \\[.5\normalbaselineskip]
\end{tabular}}
]
Hello world
\end{lstlisting}

\end{document}


Due to the frame, some vertical adjustment is needed (in the form of \\[.5\normalbaselineskip]).