# center /verbatim text in /figure

I'm trying to center a the content of a figure that has verbatim text in it, but the verbatim text is always right-aligned:

\begin{figure}
\centering
\begin{verbatim}
some
text
here
\end{verbatim}
\caption{I wish this were centered}
\end{figure}

-
Welcome to TeX.sx! A verbatim environment is always typeset on full length. You may want to look at the fancyvrb package and its BVerbatim environment. – egreg Feb 14 at 9:49
Thanks @egreg! I will check that out. – cam Feb 14 at 12:45
@cam Don't forget to select the answer if it worked for you. Points for having their answer selected helps motivate people to continue to answer questions. If it didn't work, perhaps you can provide additional details, or submit your own answer if you came up with another solution. – sh1ftst0rm 2 days ago

The verbatimbox package also does this. Here's your example done that way:

\documentclass{article}
\usepackage{verbatimbox}
\begin{document}

\begin{verbbox}
some
text
here
\end{verbbox}
\begin{figure}
\centering
\theverbbox
\caption{I wish this were centered}
\end{figure}
\end{document}

-