TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


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


The algorithms package ignores the caption package.

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

share|improve this question
up vote 6 down vote accepted

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:


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




\caption{Euclid's algorithm}\label{euclid}
\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$
\State \textbf{return} $b$\Comment{The gcd is b}


enter image description here

share|improve this answer
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

% <your algorithm here>

under those conditions. A large amount of leg-work is done by the package at the start of the algorithm environment in order to set things up since it has its own interface (using \; to denote line-ends, otherwise known as a horizontal space in math-mode outside the environment).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.