Appearance
\autoref中文引用名称
hyperref宏包提供的\autoref可以在交叉引用时自动带上 figure, table, chapter 等名称。
\autoref是给空格分词的语言准备的,按现在bithesis宏包的实现,\autoref{fig:sth}啊⇒图 1-1啊,数字前有空格,数字后没空格。改为\autoref{fig:sth} 啊(⇒图 1-1 啊)或再像下面那样定义\figureautorefname即可。在导言区加下面这段可实现
\autoref{ch:whatever}⇒第2章等。latex\usepackage{hyperref} % https://bithesis.bitnp.net/faq/autoref-name.html \def\chapterautorefname~#1\null{第~#1~章\null} \def\sectionautorefname~#1\null{第~#1~节\null} \def\subsectionautorefname~#1\null{第~#1~节\null} % 严格按学校标准:\def\equationautorefname~#1\null{式(#1)\null} \def\equationautorefname~#1\null{式~(#1)~\null}
来源:
- hyperref - How to use the command
\autorefto implement the same effect when use the command\eqref? - TeX - LaTeX Stack Exchange - 中国科学技术大学 USTC thesis、西南交通大学 SWJTU thesis
已知的问题
附录中也有 section,传入的#1形如附录 A,\autoref{…}会变成第 附录 A 节。
在\autoref前重定义\sectionautorefname可解决,但那样反而不如直接\ref{…} ⇒ 附录 A 方便。
相关讨论
- 如何在宏两侧自动插入CJKecglue · Issue #23 · CTeX-org/forum
\ref中出现数字时,与随后紧跟的汉字之间缺少空格 · Issue #392 · CTeX-org/ctex-kit
题外话
Reference Function – Typst Documentation
typst
#set ref(supplement: it => {
if it.func() == heading {
"Chapter"
} else {
"Thing"
}
})