# [Tex/LaTex] Reduce pseudocode font size (not global)

algorithmsbeamerfontsize

In this example I would like to reduce the pseudocode font size, but only for this slide while keeping the others in the default font size. How can I do that?

The simplest way would be to add \small, \footnotesize, \scriptsize, or \tiny immediately after the beginning of the algorithm environment. This changes the size of everything inside the environment (except for the caption), and nowhere else.

Edited to add: This will apparently leave the size of the line-numbers and of the caption unchanged. In order to change the size of the line-numbers for the algorithm, add the command \algsetup{linenosize=<size>} just inside the algorithm environment, where <size> is again something like \small, \footnotesize, etc. Note that the default is to have line-numbers somewhat smaller than the surrounding text: if you want the appearance to be somewhat similar to algorithms elsewhere in your document, you should also choose a smaller size for the line-numbers than the algorithm body.

I am not sure how best to modify the size of the caption, unfortunately.

Example document.

\documentclass{beamer}
\usepackage{algorithmic,algorithm2e,float}
\begin{document}
\begin{frame}[fragile]
\begin{algorithm}[H]
\algsetup{linenosize=\tiny}
\scriptsize
\begin{algorithmic}[1]
\FOR{this algorithm only}
\STATE all of the text in a smaller size of typeface
\ENDFOR
\medskip
\end{algorithmic}
\caption{an algorithm with smaller typeface}
\end{algorithm}

\bigskip

some text outside of the environment

\bigskip

\begin{algorithm}[H]
\begin{algorithmic}[1]
\FOR{all other algorithms}
\STATE everything normally unless otherwise modified
\ENDFOR
\medskip
\end{algorithmic}
\caption{an algorithm with normal typeface}
\end{algorithm}
\end{frame}
\end{document}


Result.