Customizing equation numbers produced by \ref
September 15, 2006
Mark Senn

How can I customize equation numbers produced by \ref?

Thanks to Rahul Bharadwaj for the question.

All of the following commands go in the preamble---that means between the \documentclass and \begin{document} commands.

If you want to use parentheses around all equation numbers use

    \usepackage{varioref}
\labelformat{equation}{(#1)}


If you want to use "equation (#)" everywhere, where "#" is the equation number use

    \usepackage{varioref}
\labelformat{equation}{equation~(#1)}


If you want to use some styles in some places and some in others don't use add any extra commands to the preamble and use
InputExample Output
\ref{label}1
(\ref{label})(1)
equation (\ref{label})  equation (1)

Multiple commands can be defined to do different types of equation number customization in the same document but that is beyond the scope of this document.