Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}

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

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?

share|improve this question
    
add comment

1 Answer

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.

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.