# Customize the way eqref works with tags

I'd like to have a version of \eqref that treats equations with a custom tag differently from the usual numbered equation. In particular, if I assign a tag to an equation, I'd like \eqref not to put parens around the reference. Below is an example.

\documentclass{article}
\usepackage{amsmath}
\begin{document}

$$\label{eq:normal} a = b$$
$$\label{eq:tagged} y = max\{1,x\} \tag{P(x)}$$

Equations \eqref{eq:normal} will display as "(1)" (i.e., with parens)
and \eqeref{eq:tagged} will display as "$P(x)$" (i.e., without parens).

\end{document}


How would I modify the \eqref command?

-
Is tex.stackexchange.com/q/28894/86 or tex.stackexchange.com/q/28903/86 useful to you? –  Loop Space Feb 22 '12 at 20:03

don't use \eqref. just use \ref. the main purpose of \eqref is to put parens around tags in accordance with ams style. it also ensures that they're set in upright type, which is not done with \ref, so you may still want to apply \upshape or \textup, although that isn't a problem as long as you are explicitly treating the tag as math.

Addendum: you can just equate \myeqref to \ref so that references to the explicitly-tagged displays can easily be found:

\newcommand\myeqref[1]{\ref{#1}}


although it's possible to adapt the amsmath definition to do what you want, it's more than i have time to unravel just now, especially when there's a simpler approach.

-
The problem with this (straightforward) approach is that if in a later draft I change my mind, and wish to remove the custom tag and just have a numbered citation, I have to change every \ref to \eqref. –  Michael Feb 22 '12 at 19:59
You can always do \renewcommand{\eqref}[1]{\textup{\ref{#1}}. Then if you change your mind, remove or comment this, or replace it with something else. –  Harald Hanche-Olsen Feb 22 '12 at 20:26
Herald: Wouldn't this unintentionally affect the way that \eqref{eq:normal} is displayed? My goal is only to change the way that \eqref{eq:tagged} is displayed. –  Michael Feb 22 '12 at 20:34
@HaraldHanche-Olsen: Your code in the comment is missing a final }. –  Ben Crowell Feb 4 at 5:57