11

I want to change the font size of particular frames, and when I use

\fontsize{<font size>}{<value for \baselineskip>}\selectfont

as suggested by this post, I found it does not change the font size inside nest lists. Is there a way to change those font size accordingly?

LWZ
  • 2,972

2 Answers2

9

Here's a \ChangeItemFont command allowing you to change the font for the three valid nesting levels in an itemize environment, defined in the beamer way; the syntax is

\ChangeItemFont{<font commands 1st level>}{<font commands 2nd level>}{<font commands 3rd level>}

The code and an example with some crazy font sizes in the first frame, just for illustration:

\documentclass{beamer}
\usepackage{lmodern}

\makeatletter
\newcommand\ChangeItemFont[3]{%
\renewcommand{\itemize}[1][]{%
  \beamer@ifempty{##1}{}{\def\beamer@defaultospec{#1}}%
  \ifnum \@itemdepth >2\relax\@toodeep\else
    \advance\@itemdepth\@ne
    \beamer@computepref\@itemdepth% sets \beameritemnestingprefix
    \usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
    \usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
    \usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
    \list
      {\usebeamertemplate{itemize \beameritemnestingprefix item}}
      {\def\makelabel####1{%
          {%
            \hss\llap{{%
                \usebeamerfont*{itemize \beameritemnestingprefix item}%
                \usebeamercolor[fg]{itemize \beameritemnestingprefix item}####1}}%
          }%
        }%
  \ifnum\@itemdepth=1\relax
    #1%
  \else
  \ifnum\@itemdepth=2\relax
    #2%
  \else
  \ifnum\@itemdepth=3\relax
    #3%
  \fi%
  \fi%
  \fi%
  }
  \fi%
  \beamer@cramped%
  \raggedright%
  \beamer@firstlineitemizeunskip%
}}
\makeatother

\begin{document}

\begin{frame}
\frametitle{Font size changed}
\ChangeItemFont{\fontsize{30}{36}\selectfont}{\scriptsize}{\LARGE}
\begin{itemize}
\item First item.
  \begin{itemize}
  \item First subitem.
    \begin{itemize}
    \item First subsubitem.
    \item Second subsubitem.
    \item Third subsubitem.
    \item Fourth subsubitem.
    \end{itemize}
  \item Second subitem.
  \end{itemize}
\item Second item.
\item Third item.
\end{itemize}
\end{frame}

\begin{frame}
\frametitle{Regular font size}
\begin{itemize}
\item First item.
  \begin{itemize}
  \item First subitem.
    \begin{itemize}
    \item First subsubitem.
    \item Second subsubitem.
    \item Third subsubitem.
    \item Fourth subsubitem.
    \end{itemize}
  \item Second subitem.
  \end{itemize}
\item Second item.
\item Third item.
\end{itemize}
\end{frame}

\end{document}

enter image description here

Gonzalo Medina
  • 505,128
  • This answer is close to what I want to do in a separate question but I just cannot understand what is going on...where in your command are you actually changing the font size?? – Micah Smith Mar 08 '16 at 20:37
  • @Gonzalo What about enumerate environment? It seems it is not working for that environment – Ruzayqat Nov 14 '16 at 22:42
1

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

Lgen
  • 231