I'm using minted
package to import some code and also kind of images using ASCII art. I've wrapped the \inputminted
with \figure
with a caption and all works fine.
The only thing I can't accomplish is centering the ASCII art figure. I've tried:
\begin{figure}[ht]
\begin{center}
\inputminted[fontsize=\scriptsize]{text}{./samples/styles.txt}
\end{center}
\caption{Example programming styles}
\end{figure}
Best Answer
Pygmentize outputs a file that contains
\begin{Verbatim}
and\end{Verbatim}
and changing this is out of the question. But we can exploitfancyvrb
's features:I have used the LaTeX file itself for the example: the
Verbatim
environment is “recustomed” to useBVerbatim
instead. Doing this in thefigure
environment ensures the environment will revert to its previous meaning after\end{figure}
.