3

I would love to be able to give a minted figure a title on top, and more details at the bottom, as the incorrect pseudocode below encapsulates - Is that possible?

\begin{figure}[thp]
  \caption{title HERE}
  \inputminted{X}{Y}
  \captiondetails{bottom details HERE}
  \label{Z}
\end{figure}

This partially related Q only explains how to MOVE captions to the top. Yet, I want to have text above and below it.

Domi
  • 161

1 Answers1

2

If you use figure (but I don't recommend it), the caption will be typeset where you put it.

It would make more sense to use listing instead. In any case, you can add whatever text you want in the environment.

\documentclass{article}

\usepackage{caption} \usepackage[newfloat]{minted} \captionsetup[listing]{position=top}

\begin{document}

\begin{listing}

\caption{A \LaTeX file}\label{Z}

\inputminted{latex}{\jobname.tex}

The code above is the source code for this example.

\end{listing}

\end{document}

enter image description here

You might want to apply some special formatting to the text, so as to better distinguish it from the context.

\documentclass{article}

\usepackage{caption} \usepackage[newfloat]{minted} \captionsetup[listing]{position=top}

\usepackage{lipsum}

\begin{document}

\lipsum[1][1-3]

\begin{listing}[htp]

\caption{A \LaTeX\ file}\label{Z}

\inputminted{latex}{\jobname.tex}

\begin{quote}\footnotesize The code above is the source code for this example. The code above is the source code for this example. The code above is the source code for this example. \end{quote}

\end{listing}

\lipsum[2][1-3]

\end{document}

enter image description here

egreg
  • 1,121,712