# lrbox with border in beamer

Can I have border around a \lrbox in beamer?

I have a minipage inside the lrbox.

I know I can use \fbox.

Update

Sorry for the confusion. I need a border around the block of data, it is inside a lrbox which is inside a resizebox. I need lrbox because I cannot use verbatim directly inside resizebox.

Here is my code:

\documentclass{beamer}

\begin{document}

\newsavebox\myint

\begin{lrbox}{\myint}
\begin{minipage}{0.8\textwidth}

\begin{verbatim}
class int(object)
|  int(x[, base]) -> integer
|
|  Convert a string or number to an integer, if possible.  A floating point
|  argument will be truncated towards zero (this does not include a string
|  representation of a floating point number!)  When converting a string, use
|  the optional base.  It is an error to supply a base when converting a
|  non-string.  If base is zero, the proper base is guessed based on the
|  string content.  If the argument is outside the integer range a
|  long object will be returned instead.
\end{verbatim}
\end{minipage}
\end{lrbox}

\begin{frame}[fragile]{Object}
\begin{center}
\resizebox{0.4\textwidth}{0.2\textheight}{\usebox\myint}
\end{center}
\end{frame}

\end{document}

-
Could you please provide a MWE? It is not so clear to me what you would like to do... –  ralfix Mar 1 '13 at 8:10
Please also check the manual of listings package. –  percusse Mar 1 '13 at 9:39

Not sure why you need a lrbox in beamer (perhaps you could explain what effect you are trying to achieve), but the following code could help you to get started:

\documentclass{beamer}
\newsavebox{\mybox}

\begin{document}
\begin{frame}
% First set the contents of the lrbox
\begin{lrbox}{\mybox}
\begin{minipage}{8em}
This is a test.
\begin{itemize}
\item Foo
\item Bar
\end{itemize}
\end{minipage}
\end{lrbox}

% Now typeset it inside a fbox
\fbox{\usebox\mybox}
\end{frame}
\end{document}


Result:

# Update

Since the purpose for the lrbox was to include verbatim code, I would recommend to use package fancyvrb or listings which can frame the code (among other things). In addition, your code has too long lines which forced you to rescale the box. I think it would be better to reduce the fontsize of the listing (fancyvrb can do this too), or to reduce the length of the lines. For example:

\documentclass{beamer}
\usepackage{fancyvrb}

\begin{document}
\begin{frame}[fragile]{Object}
\begin{center}
\begin{Verbatim}[frame=single, fontsize=\fontsize{7pt}{8pt}\selectfont]
class int(object)
|  int(x[, base]) -> integer
|
|  Convert a string or number to an integer, if possible.  A floating point
|  argument will be truncated towards zero (this does not include a string
|  representation of a floating point number!)  When converting a string, use
|  the optional base.  It is an error to supply a base when converting a
|  non-string.  If base is zero, the proper base is guessed based on the
|  string content.  If the argument is outside the integer range a
|  long object will be returned instead.
\end{Verbatim}
\end{center}
\end{frame}
\end{document}


Produces:

-
Thanks, I have updated my answer... –  ATOzTOA Mar 1 '13 at 9:10
@ATOzTOA And I've updated my answer. Using your original approach you could put a \fbox{} around the \resizebox but you will then discover that your listing overfulls that box, because you typeset it in minipage which is not wider enough (because your lines are longer than \textwidth). I think that fancyvrb is a better solution. –  JLDiaz Mar 1 '13 at 9:35
I need to animate one code block over another. –  ATOzTOA Mar 1 '13 at 11:49