
Estou tentando personalizar \AtBeginEnvironment{figure}
a família de fontes e o tamanho da fonte usada nas figuras. No entanto, não parece ter nenhum efeito. Aqui está um exemplo mínimo:
\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}
Alguma idéia do que está acontecendo aqui?
EDITAR:
Esqueci de mencionar que estou usando memoir
. A solução encontrada em outroperguntafunciona para definir a família da fonte, mas não o tamanho.
Responder1
A classe memoir fornece seus próprios ganchos para carros alegóricos:
\setfloatadjustment{figure}{\sffamily\tiny}
Em geral, para invocar <code>
no início de cada <floatname>
, adicione o seguinte ao seu preâmbulo:
\setfloatadjustment{<floatname>}{<code>}
Responder2
Se você não estiver usando a memoir
classe, o seguinte deverá funcionar:
% Redefine figure environment so that all figures are centered and use tiny sans-serif font
\makeatletter
\let\figureorig\figure
\def\figure@i[#1]{\figureorig[#1]\centering\sffamily\tiny} % with optional argument
\def\figure@ii{\figureorig\centering\sffamily\tiny} % without optional argument
\def\figure{\@ifnextchar[\figure@i \figure@ii} % Redefine depending on presence of [
\makeatother
% Redefine table environment so that all tables are set in tiny sans-serif font
\makeatletter
\let\tableorig\table
\def\table@i[#1]{\tableorig[#1]\sffamily\tiny} % with optional argument
\def\table@ii{\tableorig\sffamily\tiny} % without optional argument
\def\table{\@ifnextchar[\table@i \table@ii} % Redefine depending on presence of [
\makeatother
A redefinição relativamente complicada resulta do fato de que os ambientes figure
e table
podem conter argumentos opcionais. Assim, a redefinição procura um colchete de abertura “[” para determinar se um argumento opcional é fornecido ou não.