
Existe uma opção para quebrar linha na lstlisting
legenda de um? Por exemplo:
\begin{lstlisting}[frame=single, caption=uppertext\\lowertext)]
Eu tentei com \\
algumas outras soluções, mas qualquer uma delas funciona.
Responder1
Você pode definir caption
usando um arquivo tabular
. No entanto, defina também oopcionallegenda (para o \lstlistoflistings
)sema quebra de linha 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}
Devido ao frame
, é necessário algum ajuste vertical (na forma de \\[.5\normalbaselineskip]
).