File tree 1 file changed +38
-4
lines changed
1 file changed +38
-4
lines changed Original file line number Diff line number Diff line change @@ -16,9 +16,13 @@ title: 在 Word 中把引注链接到参考文献表
16
16
17
17
Zotero 官方不提供该功能,这是因为 Zotero 使用的 CSL 处理器将 citation 渲染为一个 filed,无法添加超链接 [ ^ 1 ] 。
18
18
19
+ 以下提供两种方法来实现为 citation 添加超链接的功能。
20
+
21
+ ## Word 宏
22
+
19
23
从 Zotero 论坛发现了通过 Word 宏实现的功能 [ ^ 2 ] ,虽有一些缺陷,但基本可以达成需求。
20
24
21
- ## 配置及使用
25
+ ### 配置及使用
22
26
23
27
在 Word 里新建一个宏,添加宏代码如下:
24
28
@@ -239,11 +243,41 @@ Public Sub ZoteroLinkCitation()
239
243
End Function
240
244
```
241
245
246
+ ## Python 脚本
247
+
248
+ 通过使用 Python 的 pywin32 库,可以在 Python 中实现与 Word 宏类似的功能。
249
+
250
+ ### 使用前的注意事项
251
+
252
+ - 本 Python 代码仅对引用格式为 ` (作者, 年份) ` 的文档做过测试
253
+
254
+ ### 配置及使用
255
+
256
+ 1 . 直接下载 [ link-zotero-citation-bibliography] ( https://github.com/Syize/link-zotero-citation-bibliography ) 仓库中的 [ link-zotero-citation-bibliography.py] ( https://github.com/Syize/link-zotero-citation-bibliography/blob/master/link-zotero-citation-bibliography.py ) 文件。
257
+ 2 . 安装以下依赖库:
258
+ - pywin32
259
+ - rich
260
+
261
+ ``` bash
262
+ pip install pywin32 rich
263
+ ```
264
+
265
+ 3 . 修改代码中的以下设置:
266
+ - ` word_file_path ` :您的 Word 文档的绝对路径。
267
+ - ` new_file_path ` :新保存的 Word 文档的绝对路径。
268
+ 4 . (可选) 修改函数 ` create_hyperlinks_to_literature_bookmarks ` 参数值:
269
+ - ` setColor ` :为 citation 设置的字体颜色,默认为蓝色。你可以通过查阅 VBA 的手册获取相应颜色的值[ ^ 3 ] 。
270
+ - ` etal_number ` :使用 ` et al. ` 或 ` 等 ` 代替作者名字时的作者数。
271
+ 5 . 运行代码。
272
+
242
273
## 缺陷和注意事项
243
274
244
- - 手动更新引注时会出现引注已被修改的弹窗
245
- - 无法实现从参考文献表跳转到引注
246
- - 同时引用多个引注时只能链接最后一个。
275
+ - 手动更新引注时会出现引注已被修改的弹窗。
276
+ - 无法实现从参考文献表跳转到引注。
277
+ - 使用 Word 宏方法时,同时引用多个引注时只能链接最后一个。
278
+ - Python 脚本未对顺序引注测试过。
279
+ - 当你选择 Unlink Citations 时,添加的所有超链接会失效。
247
280
248
281
[ ^ 1 ] : 来源添加
249
282
[ ^ 2 ] : [ Word: Possibility to link references and bibliography in a document? - Zotero Forums] ( https://forums.zotero.org/discussion/comment/324312/#Comment_324312 )
283
+ [ ^ 3 ] : [ VBA 文档] ( https://learn.microsoft.com/zh-cn/office/vba/api/word.wdcolor )
You can’t perform that action at this time.
0 commit comments