# Changing the font for equation numbering

I know that I can change the font for the equation numbers by redefining the `\theequation` command by, say,

``````\renewcommand{\theequation}{{\sffamily\arabic{equation}}}
``````

I am wondering if there's a better way of doing this. The reason I ask is because if I include the section number to the equation numbers using the following amsmath command

``````\numberwithin{equation}{section}
``````

then this will nullify the previous redefinition. Of course an obvious solution for this is to just use

``````\renewcommand{\theequation}{{\sffamily\thesection.\arabic{equation}}}
``````

but I am curious if there's another way.

You could use the `\pretocmd` command of the `etoolbox` package to insert code at the beginning of `\theequation` (and leave the rest of its definition unchanged).
``````\usepackage{etoolbox}
(The code snipped must be placed after using `\numberwithin` and the like.)