File tree Expand file tree Collapse file tree 2 files changed +83
-1
lines changed
Expand file tree Collapse file tree 2 files changed +83
-1
lines changed Original file line number Diff line number Diff line change 1212 https://github.com/BITNP/BIThesis/issues/38#issuecomment-631185830
1313-->
1414
15+ ::: tip 也可换用 cleveref
16+ 如果` \autoref ` 不能满足需求,可换用[[ pkg: cleveref ]] 的` \cref ` ,详见[ 如何使用 cleveref] ( ./cleveref.md ) 。
17+ :::
18+
1519[[ pkg: hyperref ]] 提供的` \autoref ` 可以在交叉引用时自动带上 figure, table, chapter 等名称。
1620
1721- ` \autoref ` 是给空格分词的语言准备的,按现在[[ pkg: bithesis ]] 的实现,` \autoref{fig:sth}啊 ` ⇒ ` 图 1-1啊 ` ,数字前有空格,数字后没空格。改为` \autoref{fig:sth} 啊 ` (⇒ ` 图 1-1 啊 ` )或再像下面那样定义` \figureautorefname ` 即可。
2024
2125 ``` latex
2226 \usepackage{hyperref}
23- % https://bithesis.bitnp.net/faq/autoref-name.html
2427 \def\chapterautorefname~#1\null{第~#1~章\null}
2528 \def\sectionautorefname~#1\null{第~#1~节\null}
2629 \def\subsectionautorefname~#1\null{第~#1~节\null}
Original file line number Diff line number Diff line change 1+ ---
2+ tag :
3+ - package
4+ - text
5+ - bithesis
6+ ---
7+
8+ # 如何使用 cleveref 交叉引用?
9+
10+ <!-- https://github.com/BITNP/BIThesis/issues/593 -->
11+
12+ 1 . 在导言区** 导入[[ pkg: cleveref ]] **
13+
14+ ``` latex
15+ \usepackage{cleveref}
16+ ```
17+
18+ 一般要在其之前导入[[ pkg: cleveref ]] ;不过对于[[ pkg: bithesis ]] ,模板已在最开始` \documentclass ` 处自动导入,无需重复。
19+
20+ 2 . ** 用` \label{…} ` 标记** 要引用的内容
21+
22+ <!-- 复制 lshort-zh-cn -->
23+
24+ - 章节标题:在章节标题命令` \section ` 等之后紧接着使用。
25+ - 图表标题:在图表标题命令` \caption ` 之后紧接着使用。
26+ - 行间公式:单行公式在公式内任意位置使用;多行公式在每一行公式的任意位置使用。
27+ - 有序列表:在` enumerate ` 环境的每个` \item ` 命令之后、下一个` \item ` 命令之前任意位置使用。
28+ - 定理环境:在定理环境内部任意位置使用。
29+
30+ ``` latex
31+ \section{章节标题} \label{sec:intro}
32+
33+ \begin{figure}[h]
34+ ……
35+ \caption{图表标题} \label{fig:example}
36+ \end{figure}
37+ ```
38+
39+ 3 . ** 用` \cref{…} ` 引用**
40+
41+ ``` latex
42+ 由\cref{sec:intro}的\cref{fig:param}、\cref{fig:result} 可验证\cref{eq:total}。
43+ ```
44+
45+ 以上代码的结果类似` 由第 1.2 节的图 3-4、图 3-5 可验证式(6-7)。 ` ,其中编号会根据前后顺序、模板类型(本科或硕博)自动设置。
46+
47+ ::: tip 🔍 数字与汉字间的空白
48+ [[ pkg: ctex ]] 会自动在数字与汉字间加些许空白,但` 图 3-5 可验证 ` 的` 5 可 ` 位于宏的边界处,不会自动加。如果您介意这一点,建议手动空一格。
49+ :::
50+
51+ ## 在同一处引用多项
52+
53+ ``` latex
54+ \cref{eq:1,eq:2} % 式(1)和(2)
55+ \cref{eq:1,eq:3,eq:4} % 式(1)、(3)和(4)
56+
57+ % 多个引用恰好连续时,会自动缩写
58+ \cref{eq:1,eq:2,eq:3} % 式(1)至(3)
59+ ```
60+
61+ ## 更改引用格式 {#customize}
62+
63+ 可以参考[[ texdoc: cleveref ]] 更改引用格式,下列几例。
64+
65+ 在英文模式下更换用词:
66+
67+ ``` latex
68+ \usepackage{cleveref}
69+ \crefname{equation}{formula}{formulae}
70+ ```
71+
72+ 完全重置格式,将 equation 全宽括号换成 ASCII 括号:
73+
74+ ``` latex
75+ \usepackage{cleveref}
76+ \crefformat{equation}{式~#2(#1)#3}
77+ \crefrangeformat{equation}{式~#3(#1)#4 至~#5(#2)#6}
78+ \crefmultiformat{equation}{式~#2(#1)#3}{和~#2(#1)#3}{、#2(#1)#3}{和~#2(#1)#3}
79+ ```
You can’t perform that action at this time.
0 commit comments