10

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?

8

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

  • 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 8 '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

  • Maybe you would like to have a look at tex.stackexchange.com/q/313736/36296 I think, your solution might also work there. – user36296 Apr 24 '17 at 12:59
  • @samcarter Thanks for your comment; do you think I should copy the proposed answer to the question mentioned in your comment or just make a link (I am not used to the habits in tex.stackexchange) ? – Lgen Apr 24 '17 at 13:04
  • As the other question is a bit more general, maybe you could add a table or block to your code and post an "extended" version for the other question? That's what I would probably do. – user36296 Apr 24 '17 at 13:10
  • And welcome to TeX.Stackexchange! – user36296 Apr 24 '17 at 13:11
  • 1
    @samcarter I posted an enriched solution proposal for the other question (with a centered table & scale factor). Thanks for your welcome & help. – Lgen Apr 24 '17 at 15:05

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.