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: 
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}

```
To use a sans serif font in an individual table, use `\sffamily` inside the table environment.

```
\documentclass{article}
\begin{document}
\begin{table}
    \sffamily
    \begin{tabular} {| c | c | c |}
    \hline
    sans serif & inside table & :) \\
    \hline
    \end{tabular}
\end{table}
\noindent Default text outside table
\end{document}

```

[![enter image description here](https://i.stack.imgur.com/w1qXp.png)](https://i.stack.imgur.com/w1qXp.png)