I'm trying to set the font size smaller in the legends for all of my figures and tables. The way I was trying to do this was using \AtBeginEnvironment but that doesn't seem to do anything at all. This is a minimal example of what is failing:
\documentclass[a4paper, 12pt]{report}
\usepackage{etoolbox}
\usepackage{relsize}
\AtBeginEnvironment{figure}{\smaller}
\begin{document}
\begin{figure}
\caption{whatever}
Text
\end{figure}
Outside text
\end{document}
Now that should, I think, make 'Text' appear smaller than 'Outside text' exactly as it would if you put the \smaller inside the figure environment. But it doesn't. I tried using the floatrow package instead but it messes up the ordering of the figure caption and the legend text and \captionsetup will only alter the caption itself not the legend text.
Any help? Why does \AtBeginEnvironment not work?

However, while that works perfectly in the minimal test environment, it fails to work in my real document. Do you know if any packages would interfere with it?
– Jack Aidley Jul 24 '12 at 12:31setspacemesses with the float setup functions so that\@floatboxresetnever gets called.By altering your suggestion so that instead of redefining
– Jack Aidley Jul 24 '12 at 12:54\@floatboxresetit does\apptocmd{\@xfloat}{\small}{}{}I was able to get it to work.tableenvironment). – egreg Jul 24 '12 at 13:00apptocmdin theAtBeginEnvironmentto avoid cross-contamination and just duplicated for thetableenvironment. – Jack Aidley Jul 24 '12 at 13:27setspaceshould be doing in the first place. – egreg Jul 24 '12 at 13:40