Question: For some of my style files, I would like to have a sans-serif typeface within my figures. I have code which seems to be working,

```
\makeatletter
\renewenvironment{figure}[1][\fps@figure]{
  \edef\@tempa{\noexpand\@float{figure}[#1]} 
  \@tempa
  \sf
}{
  \end@float
}
\renewenvironment{table}[1][\fps@table]{
  \edef\@tempa{\noexpand\@float{table}[#1]} 
  \@tempa
  \sf
}{
  \end@float
}
\makeatother

```

but surely there's a better way?

Answer: 
I would use

1. the [caption](http://www.ctan.org/tex-archive/help/Catalogue/entries/caption.html) package to control the font of (float) captions;
2. the [floatrow](http://www.ctan.org/tex-archive/help/Catalogue/entries/floatrow.html) package to control the font of other float content (i.e. tabular material).

---

```
\documentclass{article}

\usepackage[font=sf]{caption}
\usepackage[font=sf]{floatrow}

\begin{document}

\begin{table}
% \centering% Default for floatrow package
\begin{tabular}{cc} \hline
Author & Title \\ \hline
Knuth & The \TeX book \\
Lamport & \LaTeX \\ \hline
\end{tabular}
\caption{A table}
\end{table}

\begin{figure}
% \centering% Default for floatrow package
\rule{1cm}{1cm}
\caption{A figure}
\end{figure}

\end{document}

```
lockstep suggested to use the `floatrow` package. Since I wanted to do a bit more than just `\sf`, I thought I'd post my solution here.

```
\usepackage{floatrow}
\DeclareFloatFont{ben}{\somecommand\anothercommand}
\floatsetup[figure]{font=ben}
\floatsetup[table]{font=ben}

```