\autoref{eq:speed}
类似输出的命令Equation~1
。即,公式和数字之间有一个空格(我猜是受保护的空格)。如何将其更改为例如小空格?
答案1
~
(或\nobreakspace
)用于将“\autoref
名称”与其编号联系起来。如果您希望全局更改 以\autoref
始终使用(例如)\space
,则可以添加
\usepackage{letltxmacro}
\let\oldautoref\autoref
\DeclareRobustCommand{\autoref}[1]{{\let\nobreakspace\space\oldautoref{#1}}}
到你的序言。这将更新\nobreakspace
为\space
仅供使用\autoref
。
\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}