# algpseudocode font size

I want to change the default font size of the algorithm in algpseudocode environment to small. This is because my algorithm is lengthy and i have page limitations. Please help

-

## 1 Answer

Package algorithmicx provides hooks for use before and after the pseudocode: \ALG@beginalgorithmic and \ALG@endalgorithmic. You can redefine them to suit your needs:

\documentclass{article}

\usepackage{algpseudocode}

\makeatletter
\renewcommand{\ALG@beginalgorithmic}{\small}
\makeatother

\begin{document}

\begin{algorithmic}[1]
\State $x \gets 42$
\end{algorithmic}

\end{document}


Note that other algorithmicx layouts may redefine the commands. Also note that this doesn't affect line number size, which is controlled by \alglinenumber.

-