1

A command like \autoref{eq:speed} outputs Equation~1. I.e. there is a blank (a protected space, I guess) between Equation and the number. How can this be changed, e.g. into a small space?

  • 3
    only by changing/patching an internal definition. Imho if you want more sophisticated output a dedicated package like cleveref or zref is better. – Ulrike Fischer May 07 '20 at 18:27

1 Answers1

1

~ (or \nobreakspace) is used to tie the "\autoref name" to its number. If you want a global change of \autoref to always use (say) \space, you can add

\usepackage{letltxmacro}
\let\oldautoref\autoref
\DeclareRobustCommand{\autoref}[1]{{\let\nobreakspace\space\oldautoref{#1}}}

to your preamble. This updates \nobreakspace to \space just for use with \autoref.

enter image description here

\documentclass{article}

\usepackage{hyperref}
\usepackage{letltxmacro}% https://tex.stackexchange.com/q/88001/5764

\begin{document}

Here is an equation:
\begin{equation}
  f(x) = ax^2 + bx + c \label{eq:eqn}
\end{equation}

One two three four five six seven eight nine ten eleven twelve seven Equation~\ref{eq:eqn}.

One two three four five six seven eight nine ten eleven twelve seven Equation \ref{eq:eqn}.

One two three four five six seven eight nine ten eleven twelve seven \autoref{eq:eqn}.

% Update \autoref to replace \nobreakspace with \space
\LetLtxMacro\oldautoref\autoref
\DeclareRobustCommand{\autoref}[1]{{\let\nobreakspace\space\oldautoref{#1}}}

One two three four five six seven eight nine ten eleven twelve seven \autoref{eq:eqn}.

\end{document}
Werner
  • 603,163