# Is there a way to make \eqref use the font weight from the current text font?

The command eqref from amsmath does not inherit the font weight from the current font. In particular, the command \textbf has no effect on it. Here is an MWE:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$$1=1 \label{my_eqn}$$

\noindent
Here is \verb|\textbf{(\ref{my_eqn})}|:\\
\textbf{(\ref{my_eqn})}
\\ (Boldfaced, as expected.)\\
And here is \verb|\textbf{\eqref{my_eqn}}|:\\
\textbf{\eqref{my_eqn}}
\\ (Not boldfaced!)

\section{Inside a section title: (\ref{my_eqn}) and \eqref{my_eqn}}

So, inside the section title as well, \verb|\ref| is boldfaced but \verb|\eqref| is not.
\end{document}


Output:

Is there a way to make \eqref use the font weight from the current text font?

The definition of \eqref is, in total

\newcommand{\eqref}[1]{\textup{\tagform@{\ref{#1}}}}


and the main function of \textup and the internal \tagform@ is to force the document equation style over-riding the current font, so to get what you want the simplest way would be to redefine it to

\renewcommand{\eqref}[1]{(\ref{#1})}


or

\renewcommand{\eqref}[1]{\textup{(\ref{#1})}}


If you want to inherit the font weight but not inherit italic or other font shapes.

• @Mico no it explictly does not does that as it removes \textup as the question asked to inherit the current font, so there it inherits italic. (you could of course put \textup back if that is required. Jan 24 at 8:04
• @Mico added that version (well \textup to match the ams version rather than \upshape) Jan 24 at 8:06

Rather than modify the definition of \eqref, mess about with the amsmath internal \tagform@ macro, or use the machinery of the mathtools package to create an entirel new tag form, I'd like to suggest that you load the cleveref package and use its \labelcref macro instead of \eqref.

\documentclass{article}
\usepackage{amsmath,cleveref}
\setlength\parindent{0pt} % just for this example

\begin{document}
$$\label{my_eqn} 1+1=2$$

\verb|(\ref{my_eqn})|: (\ref{my_eqn}) --- Normal font weight, as expected.

\verb|\labelcref{my_eqn}|: \labelcref{my_eqn} --- Also normal font weight.

\medskip
\verb|\textbf{(\ref{my_eqn})}|: \textbf{(\ref{my_eqn})} --- Boldfaced.

\verb|\textbf{\labelcref{my_eqn}}|: \textbf{\labelcref{my_eqn}} --- Also boldfaced.

\section{Cross-refs inside a section title: (\ref{my_eqn}) and \labelcref{my_eqn}}

\end{document}

• While your answer is arguably more practical (in fact, I already ended up using cleveref for other reasons anyway), David Carlisle's answer more strictly addresses the question as it was written, so I think I'll have to accept his answer. I wish I could accept both, though! Jan 24 at 19:08