Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
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
1  
@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

1 Answer 1

up vote 5 down vote accepted

The memoir class provides its own hooks for floats:

\setfloatadjustment{figure}{\sffamily\tiny}

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

\setfloatadjustment{<floatname>}{<code>}
share|improve this answer

Your Answer

 
discard

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.