
¿Existe una opción para romper la línea en lstlisting
el título de un? Por ejemplo:
\begin{lstlisting}[frame=single, caption=uppertext\\lowertext)]
Probé con \\
algunas otras soluciones, pero cualquiera de ellas funciona.
Respuesta1
Puede configurarlo caption
usando un archivo tabular
. Sin embargo, también establezca elopcionaltítulo (para el \lstlistoflistings
)sinel salto de línea 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}
Debido a frame
, se necesita algún ajuste vertical (en forma de \\[.5\normalbaselineskip]
).