Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am really new to LaTeX/beamer, and now I am coming into this question:

In MS powerpoint, when a textbox is filled it can automatically shrink the font size, instead of going over the page.

Is there a way that in beamer we can also do this?

share|improve this question
    
You can check this topic. Two of the answers may fit your needs: tex.stackexchange.com/questions/144299/… –  masu Nov 16 '13 at 23:04

3 Answers 3

up vote 4 down vote accepted

Use shrink=0 ... 100 in the frame option to shrink everything by n percent of a frame, as displayed below.

\documentclass{beamer}
\usepackage{lipsum}
\begin{document}
\begin{frame}[shrink=50]  % shrink 50 percent
\lipsum[2]
\end{frame}
\end{document}
share|improve this answer
    
The beamer documentation mentions (p 35, 62) "Never use a smaller font size to “fit more on a frame.” Never ever use the evil option shrink". One can't just choose any number up to 100... –  Werner Nov 17 '13 at 14:22
    
@Werner -- I read the passage. The user guide also mentions that don't use footnote and allowframebreaks etc, etc. My understanding of those are for typographic reason. However, on page 65, the manual does recommend starting from 5,10, gradually to use this option. Its design is meant for marginal case IMHO. –  Jesse Nov 17 '13 at 14:39

If you don't need to shrink the whole frame but just a box in it, you can use fitting library from tcolorbox package:

Next example is taken from tcolorbox manual adapted to beamer:

\documentclass{beamer}
\usepackage{tcolorbox}
\tcbuselibrary{fitting}
\usepackage{lipsum}

\tcbset{colframe=blue!50!black,colback=red!10!white,
boxsep=0pt,top=1mm,bottom=1mm,left=1mm,right=1mm,
nobeforeafter,width=\linewidth}

\begin{document}
\begin{frame}{Shrinking with \texttt{tcolorbox}}

\begin{columns}[totalwidth=\textwidth]
\begin{column}{.45\textwidth}
\tcboxfit[height=8cm]{\lipsum[1]}
\end{column}
\begin{column}{.45\textwidth}
\tcboxfit[height=4cm]{\lipsum[1]}\\
\tcboxfit[height=3cm]{\lipsum[1]}
\end{column}
\end{columns}

\end{frame}
\end{document}

enter image description here

share|improve this answer

beamer already loads graphicx which you can use to resize content:

enter image description here

\documentclass{beamer}% http://ctan.org/pkg/beamer
\let\Tiny\tiny% http://tex.stackexchange.com/q/58087/5764
\begin{document}
\begin{frame}
  This is some very long text that should span at least two lines on this frame.

  \resizebox{\linewidth}{!}{This is some very long text that should span at least two lines on this frame.}

  \resizebox{\linewidth}{!}{%
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur at aliquam massa. Pellentesque 
  habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut non elit a neque 
  ullamcorper vulputate. Cras faucibus porta tellus, nec vulputate nibh. Morbi ut orci et augue euismod 
  ornare non quis diam. Maecenas ac diam eget neque porttitor tempor et at tortor. Sed sit amet varius 
  tortor. Suspendisse potenti. Proin lacus odio, porta id nunc non, feugiat sagittis lorem. Vestibulum 
  non nibh purus. Duis leo magna, posuere sed viverra vel, scelerisque a ligula. Sed ullamcorper orci 
  eu justo ullamcorper tristique.%
  }

  \resizebox{\linewidth}{!}{Here is some text.}
\end{frame}
\end{document}

\resizebox{<width>}{<height>}{<stuff>} is used to fit <stuff> inside a box of width <width> (and/or height <height>). If either of these lengths are !, <stuff> is sized in a way that maintains the aspect ratio.

Note that this approach will always make <stuff> fit within \linewidth (either shrinking or enlarging).

share|improve this answer
    
Thank you so much @Werner! Both answers are really helpful, and I voted for Jesse's because I am currently dealing with multi-line itemized stuff, so hers happens more applicable. But I really appreciate your answer too and it is exactly as useful! –  Shawn Wang Nov 17 '13 at 7:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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