Skip to content

Commit 5248ce1

Browse files
docs(faq): 介绍 cleveref
Relates-to: BITNP/BIThesis#593 Co-Authored-By: Peng Gao <[email protected]>
1 parent e33196b commit 5248ce1

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

wiki/faq/autoref-name.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ tag:
2828
\def\equationautorefname~#1\null{式~(#1)~\null}
2929
```
3030

31+
::: tip 也可换用 cleveref
32+
如果`\autoref`不能满足需求,可换用[[pkg:cleveref]]`\cref`,详见[如何使用 cleveref](./cleveref-format.md)
33+
:::
34+
3135
来源:
3236

3337
- [hyperref - How to use the command `\autoref` to implement the same effect when use the command `\eqref`? - TeX - LaTeX Stack Exchange](https://tex.stackexchange.com/a/66150/82731)

wiki/faq/cleveref-format.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
tag:
3+
- package
4+
- text
5+
---
6+
7+
# 如何使用 cleveref 一次引用多个公式?
8+
9+
<!-- https://github.com/BITNP/BIThesis/issues/593 -->
10+
11+
如果需要一次引用多个公式,比如`式(4)、(8)、(9)和(11)`,那么[[pkg:hyperref]]`\autoref`不支持,可换成[[pkg:cleveref]]`\cref`
12+
13+
```latex
14+
\usepackage{cleveref}
15+
\crefformat{equation}{式(#2#1#3)}
16+
\crefrangeformat{equation}{式(#3#1#4)至(#5#2#6)}
17+
\crefmultiformat{equation}{式(#2#1#3)}{和(#2#1#3)}{、(#2#1#3)}{和(#2#1#3)}
18+
```
19+
20+
```latex
21+
\cref{eq:1};% 单个引用
22+
\cref{eq:1,eq:3,eq:4};% 多个引用
23+
\cref{eq:1,eq:2,eq:3}。% 多个引用恰好连续时,会自动缩写
24+
```
25+
26+
::: info 尽量最后导入 cleveref
27+
请尽量最后导入 cleveref,特别要保证 cleveref 在 hyperref 之后,详见[[texdoc:cleveref]]
28+
29+
对于[[pkg:bithesis]],模板已经在最开始`\documentclass`处自动导入了 hyperref,无需重复导入。
30+
:::

0 commit comments

Comments
 (0)