Estoy usando subtítulos con párrafos en bloque. Una vez que se ha mostrado un título, no hay espacios entre párrafos. ¿Alguien puede ayudar?
\documentclass[a4paper,10pt]{article}
\usepackage{parskip}
\usepackage{lipsum}
\usepackage[skip=-5pt, font=scriptsize]{caption}
\usepackage{listings}
\usepackage{color}
\usepackage{float}
\newfloat{Snippet}{th}{snippets}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\lstset{frame=tb,
language=Python,
basicstyle={\scriptsize\ttfamily},
numbers=none,
numberstyle=\color{gray},
keywordstyle=\color{blue},
commentstyle=\color{dkgreen},
stringstyle=\color{mauve},
tabsize=4
}
\begin{document}
\begin{lstlisting}
primary_colours = ["red", "blue", "yellow"]
\end{lstlisting}
\lipsum[2]
\lipsum[2]
\begin{lstlisting}
primary_colours = ["red", "blue", "yellow"]
\end{lstlisting}
\captionof{Snippet}{\texttt{primary\_colours}}
\lipsum[2]
\lipsum[2]
\end{document}
Respuesta1
Quizás puedas usar la opción caption
y captionpos
para el lstlisting
medio ambiente:
\documentclass[a4paper,10pt]{article}
\usepackage{parskip}
\usepackage{lipsum}
\usepackage[skip=-5pt, font=scriptsize]{caption}
\usepackage{listings}
\usepackage{color}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\lstset{frame=tb,
language=Python,
basicstyle={\scriptsize\ttfamily},
numbers=none,
numberstyle=\color{gray},
keywordstyle=\color{blue},
commentstyle=\color{dkgreen},
stringstyle=\color{mauve},
tabsize=4
}
\renewcommand\lstlistingname{Snippet}
\begin{document}
\begin{lstlisting}
primary_colours = ["red", "blue", "yellow"]
\end{lstlisting}
\lipsum[2]
\lipsum[2]
\begin{lstlisting}[caption={\texttt{primary\_colours}},captionpos=b]
primary_colours = ["red", "blue", "yellow"]
\end{lstlisting}
\lipsum[2]
\lipsum[2]
\end{document}