1

Specifically, I'm wanting to \tag an equation with just "#", but then have \ref output "Equation #". The way I see this working is something like

\begin{equation}
a=b\tag[Equation #]{#}\label{eq:#}
\end{equation}

Did you know that a=b? (See \ref{eq:#}.)

Here, the output I have in mind would look like:

a=b (#)

Did you know that a=b? (See Equation #.)

I suspect this may seem like a silly question, since I can just type "See Equation \ref{eq:#}" to achieve the result I want in parentheses. The reason I'd like to do this the way I'm asking is because I'm using QuickLaTeX in WordPress, and my \ref{} adds a hyperlink. I would like the hyperlink to be displayed over the whole "Equation 1.6" rather than just the "1.6".

Anyway, it seems like it should be entirely possible for \tag to include an option to tag an equation one way, but then produce different text through \ref, but I can't seem to figure out how to do that. Any help would be much appreciated!

0

1 Answer 1

5

Rather than re-invent the wheel in terms of modifying \tag, \label, and/or \ref, simply load the cleveref package and use that package's \cref command. (Use \Cref if you want to upper-case the first letter in "equation".)

By the way, do not use TeX-special characters such as # in the argument of \label, \ref, and \cref.

A full MWE:

\documentclass{article}
\usepackage{amsmath} % for '\tag' macro
\usepackage[noabbrev]{cleveref}
\begin{document}

\begin{equation}
a=b\tag{\#}\label{eq:hashtag}
\end{equation}

Did you know that $a=b$? See \cref{eq:hashtag}.
\end{document}

enter image description here

4
  • Unfortunately, with QuickLaTeX I don't think there's a way to load packages or modify any code, so any solution would need to use the existing functionality provided by the plugin. I tried using \Cref, and the output simply displayed as "\Cref{eq:hashtag}", so the command wasn't recognised. It seems that maybe there isn't a way of doing this without using an additional package?
    – Daryl
    Commented Oct 7, 2017 at 16:39
  • @Daryl - According to the QuckLaTeX homepage, it’s entirely permissible to have \usepackage statements in the preamble.
    – Mico
    Commented Oct 7, 2017 at 16:44
  • I see that now. Thanks, and sorry for being a dummy. I think, since \ref is not used in an equation, that I need to add the cleveref package globally on the site (packages are added locally within e.g. [...] with [+preamble]\usepackage{*}[\preamble]). I've added the package globally at WP QuickLaTeX > Advanced, then tried to call \Cref{eq:hashtag} again in my editor, but the command is not being recognised and still simply shows up on the page as "\cref{eq:hashtag}". Have you used cleveref in WP QuickLaTeX? Do you know if it works? It seems that it should...
    – Daryl
    Commented Oct 7, 2017 at 17:27
  • @Daryl - I’m not a QickLaTeX expert. May I suggest you post a new query in which you ask how to best go about loading an external package?
    – Mico
    Commented Oct 7, 2017 at 22:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .