3

In my presentation I put \tikzpicture, cases or \array in \figure, I am wondering if it is possible to resize the whole picture including caption with a factor. It seems that \resizebox{<horizontal size>}{<vertical size>}{...} does not work here...

Could anyone help? Thank you very much!

2

I recommend to avoid using figure environments in beamer, because usually the figures are not intended to float in presentations, and they don't do it as Herbert commented. It can avoid confusion with floats in standard LaTeX. If you just use figure because you need captions, you could do it with the \captionof command of the caption package instead.

Here's an example, where a minipage of a small size .3\textwidth is used together with a caption, and enlarged by \resizebox to \textwidth, the whole box including the caption is scaled.

\documentclass{beamer}
\usepackage{caption}
\begin{document}
\begin{frame}
\resizebox{\textwidth}{!}{%
\begin{minipage}{.3\textwidth}
\centering
 $\begin{array}{c}
    \sum\limits_{i=1}^{\infty} x_i
  \end{array}$
\captionof{figure}{Test figure}
\end{minipage}}
\end{frame}
\end{document}

resized figure with caption in beamer frame

It would cause an error if figure with \caption would be used here instead of minipage. Note, by using the caption package you can benefit from further features of this great package.

  • inside beamer the figure is not a floating object – user2478 Aug 29 '11 at 16:32
3
\documentclass{beamer}
\usepackage{varwidth}
\newsavebox\IBox
\newenvironment{resizefig}[1][\textwidth]
 {\gdef\figWidth{#1}%
  \begin{lrbox}{\IBox}
  \varwidth{\textwidth}
  \figure\centering}
 {\endfigure\endvarwidth\end{lrbox}%
   \resizebox{\figWidth}{!}{\usebox\IBox}}

\begin{document}

\begin{frame}{foo}{bar}
\begin{resizefig}[0.8\textwidth]
 $\begin{array}{c}
    \sum\limits_{i=1}^{\infty} x_i
  \end{array}$
\caption{Test figure}
\end{resizefig}
\end{frame}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.