Create \eqref* (\eqref without link, i.e. starred eqref)
Here's a solution that borrows from Joseph Wright's LaTeX3
solution to Defining starred versions of commands (* macro)
% arara: pdflatex
\documentclass{article}
\usepackage{amsmath}
\usepackage{xparse}
\let\oldeqref\eqref
\makeatletter
\RenewDocumentCommand\eqref{s m}{%
\IfBooleanTF#1%
{\textup{\tagform@{\ref*{#2}}}}% If a star is seen
{\oldeqref{#2}}% If no star is seen
}
\makeatother
\usepackage{hyperref}
\begin{document}
\begin{equation}
a=b \label{1}
\end{equation}
\begin{itemize}
\item starred version: \eqref*{1}
\item unstarred version: \eqref{1}
\end{itemize}
\end{document}
This doesn't exactly answer your question, as I defined \Eqref
instead of a starred \eqref
. I just copied the definition of \eqref
from amsmath.sty
, and added a *
to the \ref
used there.
\documentclass{article}
\usepackage{amsmath}
\usepackage{hyperref}
\makeatletter
\newcommand{\Eqref}[1]{\textup{\tagform@{\ref*{#1}}}}
\makeatother
\begin{document}
\begin{equation}
a=b \label{1}
\end{equation}
\Eqref{1} \eqref{1}
\end{document}
Solution: Thanks to Torbjørn T. and oerpli, here's a(nother) solution:
\makeatletter
\def\eqref{\@ifstar\@eqref\@@eqref}
\def\@eqref#1{\textup{\tagform@{\ref*{#1}}}}
\def\@@eqref#1{\textup{\tagform@{\ref{#1}}}}
\makeatother
And a working example:
\documentclass{article}
\usepackage{amsmath}
\newtheorem{theorem}{theorem}
\usepackage{hyperref}
\makeatletter
\def\eqref{\@ifstar\@eqref\@@eqref}
\def\@eqref#1{\textup{\tagform@{\ref*{#1}}}}
\def\@@eqref#1{\textup{\tagform@{\ref{#1}}}}
\makeatother
\begin{document}
\begin{equation}
a=b \label{1}
\end{equation}
\begin{theorem}
A standard ref is italic in math mode: \ref{1} \\
A standard ref* is also italic in math mode: \ref*{1} \\
An eqref is upright: \eqref{1}\\
And so is the new eqref*: \eqref*{1}
\end{theorem}
\end{document}