9

I want to scale down an element in a slide so that it fits the width and/or height better. I'm willing to reduce the font size, use something like a scalebox/resizebox, or anything similar (not space squeezing though). The thing is, I want to avoid lower-level or "non-beamerish" commands, as well as avoiding choosing explicit font sizes; rather, I would like an acceptable default scaling.

What's the "beamer-idiomatic" way of doing this?

9
  • 1
    Could shrink and squeeze options suffice? They are in beamer manual, page 61, section 8.1.
    – Rmano
    Commented Jun 8, 2016 at 15:48
  • You explicitly mention fitting to "width". Does that mean that height need not be considered in the fit? Also, how do you want the "ideal" structure of the fix? E.g. Scale by this %, fit this specified width, or make [A] the same size as [B]. Commented Jun 8, 2016 at 16:23
  • 1
    Can you tell us, what such an "element" could be? I guess there is not "the right way" for all possible elements. Commented Jun 8, 2016 at 16:32
  • 1
    Can you add a MWE? meta.tex.stackexchange.com/q/228
    – m13r
    Commented Jan 19, 2017 at 18:20
  • 1
    @m13r: I might, when I'm back in the office in a week or so, but - I asked a general question. Suppose it's a table in a slide which has so much content it doesn't just fit.
    – einpoklum
    Commented Jan 19, 2017 at 19:44

2 Answers 2

12

To achieve a very similar goal I generally use the following:

\begin{frame}
\frametitle{Size changed}
\scalebox{0.8}{\begin{minipage}{1.20\textwidth}

... your content here ...

\end{minipage}}
\end{frame}

I do not know how to compute the combined values of the scale factor and of the minipage width, I generally try several values until it satisfies me.

For example, the following content:

\begin{itemize}
\item First item.
  \begin{itemize}
  \item First subitem.
    \begin{itemize}
    \item \lipsum[75]
    \item \lipsum[66]
    \item \lipsum[75]
    \end{itemize}
  \item Second subitem.
  \end{itemize}
\item Second item.
\item Third item.
\end{itemize}

gives:

enter image description here

and if you change the scale/minipage values to 0.6/1.6 you obtain:

enter image description here

For a centered table I use:

\begin{frame} {Scale Items}
\makebox[1.1\linewidth][c]{\scalebox{0.8}{\begin{minipage}{0.8\linewidth}
\begin{tabular}{l | c | c | c | c }
      & Column1 & Column2 & Column3 & Column4 \\
\hline \hline
Line1 & Value11 & Value12 & Value13 & Value14\\ 
Line2 & Value21 & Value22 & Value23 & Value24\\
Line3 & Value31 & Value32 & Value33 & Value34\\
Line4 & Value41 & Value42 & Value34 & Value44 
\end{tabular}
\end{minipage}}}
\end{frame}

which leads to:

enter image description here

and if you change \scalebox{0.8} to \scalebox{1.2} then you will have the following result:

enter image description here

0
2

For an approach that builds on Lgen's answer, I've defined a "shrink" environment that automatically computes the appropriate width (using the calc package). That removes the need for trial and error.

In the preamble I write

\usepackage{environ,calc}

\newlength{\envwidth}
\NewEnviron{shrink}[1]{
\setlength{\envwidth}{\linewidth/\real{#1}}
\scalebox{#1}{\begin{minipage}{\envwidth}\BODY\end{minipage}}
}

And then on the frame I can simply put something like

\begin{shrink}{.7}
    \begin{itemize}
        \item \lipsum[75]
        \item \lipsum[66]
    \end{itemize}
\end{shrink}

(To compile the example, you'd also have to add \usepackage{lipsum} in the preamble.)

Altogether:

\documentclass[]{beamer}
\usepackage{lipsum} % this is just for the sample text
\usepackage{environ,calc}

\newlength{\envwidth}
\NewEnviron{shrink}[1]{
\setlength{\envwidth}{\linewidth/\real{#1}}
\scalebox{#1}{\begin{minipage}{\envwidth}\BODY\end{minipage}}
}

\begin{document}
    \begin{frame}
    \begin{itemize}
        \item First item.
        \begin{itemize}
        \item First subitem.
        \medskip 
        
            \begin{shrink}{.7}
        \begin{itemize}
            \item \lipsum[75]
            \item \lipsum[66]
            \end{itemize}
        \end{shrink}
        
        \smallskip
        \item Second subitem.
      \end{itemize}
    \item Second item.
    \item Third item.
    \end{itemize}
    \end{frame}

\end{document}

(Admittedly, things got a little squeezed vertically for some reason when I applied the environment only to a part of the list, so I've corrected that with a \smallskip and a \medskip. There might be more elegant options for that, but I don't know how to treat them all globally.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .