0

I have a code block using minted and mdframed and a caption afterwards.

\begin{mdframed}
\begin{minted}[tabsize=4]{c++}
    some code
\end{minted}
\end{mdframed}
\begingroup\captionof{listing}{some caption\label{lst:label}}\endgroup

The caption however is too far away from the code. I tried adding negative vertical space right after the frame, however it doesn't work correctly. Up to \vspace{-4em} nothing happens, but with \vspace{-5em}, the caption is moved right into the code block.

How can I move the caption that it is positioned right after the code block?

1 Answer 1

1

I figured it out, thanks to this question.

When I use \unskip after the frame, the caption will be positioned right after it. \vspace also works now, but is not needed anymore, at least for my case.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .