
¿Cómo puedo generar una lista de listados de código fuente como una lista de figuras?
Aquí hay un ejemplo de listados de código fuente:
\lstset{
numbers=left,
stepnumber=1,
numbersep=5pt,
numberstyle=\small\color{black},
basicstyle=\ttfamily\small,
keywordstyle=\color{black},
commentstyle=\color{black},
stringstyle=\color{black},
frame=single,
backgroundcolor=\color{lightgray},
caption=Code coté serveur avec Express}
\begin{lstlisting}[firstnumber=1, framerule=0pt] % Start your code-block
%Code ...
\end{lstlisting}
Respuesta1
\lstlistoflistings
imprime una lista de listados:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{xcolor}
\usepackage{listings}
\usepackage[french]{babel}
\addto\captionsfrench{%
\renewcommand*{\lstlistlistingname}{Liste des sources}%
\renewcommand*{\lstlistingname}{Source}%
}
\begin{document}
\lstlistoflistings
\lstset{
numbers=left,
stepnumber=1,
numbersep=5pt,
numberstyle=\small\color{black},
basicstyle=\ttfamily\small,
keywordstyle=\color{black},
commentstyle=\color{black},
stringstyle=\color{black},
frame=single,
backgroundcolor=\color{lightgray},
caption=Code coté serveur avec Express}
\begin{lstlisting}[firstnumber=1, framerule=0pt] % Start your code-block
%Code ...
\end{lstlisting}
\end{document}
Otras lecturas:documentación del paquetelistings
, sección "4.9 Subtítulos".