# Input manually a number into \eqref

Often while writing papers I find the need to cite particular equations from other papers. For example, the landmark paper by Einstein, Newton, and White (2015) lays out the theory of everything in the equation immutably numbered 42. In some other paper I'd like to cite this equation by number, using exactly the same formatting that would be applied to \eqref from amsmath, whatever that may be. Essentially, I want to be able to say something like

One can see that \eqref{eq:my_above_equation} above is a specific case of
\pseudoeqref{42} from \citet{ENW2015}.


The two equation numbers should be typeset identically. I could just hard-code in the (admittedly simple) formatting, but this seems against the spirit of LaTeX, with the same formatting being done both automatically and manually in different places. It also occurred to me to create a ghost equation somewhere at the end of the document, manually set its number, and give it a normal \label{}, but this idea seems wrong on many levels.

Is there a simple solution for matching the format of eqref but with hard-coded equation numbers?

-

It would be completely acceptable to create a macro that does all of that for you. That is, both set a \label and immediately \eqref it:

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\newcounter{peqrefcntr}
\makeatletter
\newcommand{\pseudoeqref}[1]{{% \pseudoeqref{<whatever>}
\refstepcounter{peqrefcntr}% Increment the pseudo \eqref counter (for uniqueness)
\def\@currentlabel{#1}% Updated the label to be stored
\label{peqref-\thepeqrefcntr}\eqref{peqref-\thepeqrefcntr}}}% \label and \ref
\makeatother
\begin{document}
$$f(x) = ax^2 + bx + c \label{eq:my_above_equation}$$
One can see that~\eqref{eq:my_above_equation} above is a specific case of~\pseudoeqref{42} from~XYZ.
$$g(x) = ax^2 + bx + c$$
Also see~\pseudoeqref{41} of~XYZ.
\end{document}


The above defines \pseudoeqref{<whatever>} that does an automated \label-\ref (requiring at least two compiles on the first run). The motivation for grouping the entire macro is to localize the effect of updating \@currentlabel; it may not be entirely necessary. Also, the use of \refstepcounter allows for an appropriate \phantomsection (or hyperlink anchor) if you plan on using hyperref.

With every call to \pseudoeqref, a unique label peqref-<num> is created, where <num> is stepped at every call.

-

Just look at the definition of \eqref in amsmath.sty:

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


Then it's easy to define your personal command in the preamble:

\makeatletter
\newcommand{\pseudoeqref}[1]{\textup{\tagform@{#1}}}
\makeatother


Complete example:

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\pseudoeqref}[1]{\textup{\tagform@{#1}}}
\makeatother

\begin{document}

One can see that~\eqref{eq:my_above_equation} above is a specific
case of~\pseudoeqref{42} from~XYZ.

\end{document}

-