# Wrap item with vertical margin

I have some cases where I will have an item in between two paragraphs. For example:

Alfa bravo:

\includegraphics{a.jpg}

charlie delta:

\begin{verbatim}
echo foxtrot
\end{verbatim}

golf hotel

the image gets no vertical space at all, the the code block does get some space, but I might want more. I can add some of these:

\bigbreak
\vspace{1cm}

but is a better option available? Something like one of these:

\includegraphics[margin=1cm]{a.jpg}

\begin[margin=1cm]{verbatim}
echo foxtrot
\end{verbatim}

To solve this, I used the tcolorbox package. The beforeafter skip option sets the top and bottom margin. The listing only option to the tcblisting element gives a similar result to verbatim.

This does add a background and border to these elements, but I actually like that. If someone dislikes that, I think it can be disabled in the settings.

\documentclass{article}
\usepackage[listings]{tcolorbox}
\tcbset{beforeafter skip=8mm}
\tcbset{listing only}
\begin{document}

Alfa

\begin{tcolorbox}
\includegraphics{a.jpg}
\end{tcolorbox}

Bravo

\begin{tcblisting}{}
Charlie
Delta
\end{tcblisting}

Echo

\end{document}

http://ctan.math.washington.edu/tex-archive/macros/latex/contrib/tcolorbox/tcolorbox.pdf

• I usually use much simpler environments: {center} or {flushleft} (depending on desired positioning) to give the standard separation for the document. – Donald Arseneau May 18 at 0:14
• @DonaldArseneau what do those have to do with vertial margins? – Steven Penny May 18 at 0:52
• They have vertical separation at top and bottom, \topsep + \parsep (yes at the bottom too). – Donald Arseneau May 18 at 4:08