# Why doesn't font family change take effect when using AtBeginEnvironment{figure} together with memoir?

I'm trying to use \AtBeginEnvironment{figure} to customize the font family and font size used in figures. However, it doesn't seem to have any effect. Here is a minimal example:

\documentclass{memoir}
\usepackage{etoolbox}

\makeatletter
\AtBeginEnvironment{figure}{%
\def\@floatboxreset{\reset@font\sffamily\tiny\@setminipage}%
\patchcmd{\@xfloat}{\normalsize}{\selectfont}{}{}
}
\makeatother

\begin{document}

\begin{figure}
% \tiny % this works
test
\end{figure}

\end{document}


Any ideas on what's happening here?

EDIT: Forgot to mention that I'm using memoir. The solution found in another question works for setting the font family, but not the size.

-
There's a very similar question here: tex.stackexchange.com/questions/64514/… In that question \small is the command to add, but the solution should be the same. If this helps you, please let us know so that we can close this question as duplicate; otherwise, please tell why the solution doesn't apply to your case. –  egreg Apr 2 '13 at 15:42
@egreg: Ah, knew there would be someone who had had this problem before... Just couldn't find it. =) Well, it now sets the font family, but the size is not affected. Apparently memoir is doing something here... –  gablin Apr 2 '13 at 16:18
@gablin No idea what the underlying problem is, but memoir provides its own hooks for floats: \setfloatadjustment{figure}{\sffamily\tiny}. There is also \setfloatadjustment{table}{<code>}. –  Audrey Apr 2 '13 at 16:24
@Audrey: That did it! Can you please write it as an answer so I can accept it? –  gablin Apr 2 '13 at 16:25
@Audrey That's exactly what I found. Please, add an answer. –  egreg Apr 2 '13 at 16:25

\setfloatadjustment{figure}{\sffamily\tiny}

In general to invoke <code> at the beginning of every <floatname>, add the following to your preamble:
\setfloatadjustment{<floatname>}{<code>}