6

In a document at my workplace, \autoref is redefined in the following way:

\renewcommand{\autoref}[1]{\cref{#1}}

I suppose this is important because it probably means that I cannot just overwrite \equationautorefname.

For equations, this results in something like "Equation (5.1)". The parenthis are fine when they are shown next to the equation, but in the text we want them to be displayed without the parenthesis.

How can I achieve this?

  • 1
    the parentheses are there for a reason. most authors don't write something that ends up as "equation (5.1)"; they have only the number, and if the parentheses aren't there, a reader can't tell the difference between equation 5.1 and section 5.1. if you do write out equation \ref{eq:5.1}, as you say, you don't want the parens, but that's a subjective choice. gonzalo's answer appears to do the job compactly. – barbara beeton Sep 3 '13 at 15:08
6

The presence of \cref in your question suggests the use of cleveref; in this case, use \crefformat to (re)format how the aspect of the cross-reference should be:

\documentclass{article}
\usepackage{amsmath}
\usepackage{hyperref}
\usepackage[noabbrev]{cleveref}

\crefformat{equation}{equation~\textup{#2#1#3}}
\Crefformat{equation}{Equation~\textup{#2#1#3}}

\renewcommand\autoref[1]{\cref{#1}}

\begin{document}

\autoref{equ:test}
\begin{equation}
\label{equ:test}
a = b.
\end{equation}

\end{document}

enter image description here

\textup makes sure the equation number will always be upright.

By the way, instead of redefining \autoref, it would be better perhaps to define your own new command.

  • It's common to ensure the equation number is upright, so \textup{#2#1#3} seems better. – egreg Sep 3 '13 at 14:54
  • @egreg you're (up)right (Sorry for the bad joke). I've incorporated this into my answer. Thanks. – Gonzalo Medina Sep 3 '13 at 14:56
  • This seems to work, apart from capitalization at the beginning of the sentence, but that's probably because of that weird redefinition of \autoref. Unfortunately, I probably cannot change that, as it's a template from work. – Franz Sep 3 '13 at 14:59
  • Oh, and what do you guys mean by upright? – Franz Sep 3 '13 at 14:59
  • Fixed my capitalization issue. Works beautifully. Thank you very much, you're a wizard. :) – Franz Sep 3 '13 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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