# Algorithms package ignores caption package

I'm using the algorithms package in my document to get a floating environment for algorithms to live in.

\usepackage{algorithm}


I'm using the caption package to make the captions on my figures smaller.

\usepackage[font=footnotesize,bf]{caption}


The algorithms package ignores the caption package.

Is there any way to make it respond to caption's options?

-

Use \captionsetup with algorithm option; since a comment suggest that you only want to have the label boldfaced and both label and text in \footnotesize size, it's enough to say:

\captionsetup[algorithm]{font=footnotesize}


since, by default, the label for algorithm captions is boldfaced.

\documentclass{article}
\usepackage{algorithm,algpseudocode}
\usepackage{caption}

\captionsetup[algorithm]{font=footnotesize}

\begin{document}

\begin{algorithm}
\caption{Euclid's algorithm}\label{euclid}
\begin{algorithmic}[1]
\Procedure{Euclid}{$a,b$}\Comment{The g.c.d. of a and b}
\State $r\gets a\bmod b$
\While{$r\not=0$}\Comment{We have the answer if r is 0}
\State $a\gets b$
\State $b\gets r$
\State $r\gets a\bmod b$
\EndWhile\label{euclidendwhile}
\State \textbf{return} $b$\Comment{The gcd is b}
\EndProcedure
\end{algorithmic}
\end{algorithm}

\end{document}


-
It may be useful to note that \floatname{algorithm}{\footnotesize Algorithm} controls the caption's label independent of its text. – Richard May 24 '12 at 0:10
@Richard: to control the label and the text separately, you can use the labelfont and textfont keys (or a combination of font and the other two). In your concrete example, it's enough to use \captionsetup[algorithm]{font={footnotesize}}, since by default the label will be boldfaced. – Gonzalo Medina May 24 '12 at 0:19
As an alternative to the solution above, one could redefine the caption style ruled. See caption package doc., section about interaction with the float package. – Axel Sommerfeldt May 24 '12 at 5:26

algorithm2e provides its own "do not float" [H] float specifier, setting the contents in a minipage if used this way. So one would have to use

\begin{algorithm}[H]