diff --git a/.vscode/settings.json b/.vscode/settings.json index 207eee9c..3d6faa33 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -36,5 +36,6 @@ // "CODE_OF_CONDUCT.md": true, // "LICENSE": true }, - "markdown.editor.pasteUrlAsFormattedLink.enabled": "smart" + "markdown.editor.pasteUrlAsFormattedLink.enabled": "smart", + "markdown.validate.referenceLinks.enabled": "ignore" } diff --git a/src/assets/15e71e5849e591f2252b7e706e8d6707_MD5.png b/src/assets/15e71e5849e591f2252b7e706e8d6707_MD5.png new file mode 100644 index 00000000..f8e595bf Binary files /dev/null and b/src/assets/15e71e5849e591f2252b7e706e8d6707_MD5.png differ diff --git a/src/assets/1e7deb7a378eadbeda2d05f2ed6408ca_MD5.png b/src/assets/1e7deb7a378eadbeda2d05f2ed6408ca_MD5.png new file mode 100644 index 00000000..953e54a2 Binary files /dev/null and b/src/assets/1e7deb7a378eadbeda2d05f2ed6408ca_MD5.png differ diff --git a/src/assets/2a4390faa87ca714c9264b8f3bae4b64_MD5.png b/src/assets/2a4390faa87ca714c9264b8f3bae4b64_MD5.png new file mode 100644 index 00000000..7552cc48 Binary files /dev/null and b/src/assets/2a4390faa87ca714c9264b8f3bae4b64_MD5.png differ diff --git a/src/assets/4a3c7755cb85eb19bc614090a3f08676_MD5.png b/src/assets/4a3c7755cb85eb19bc614090a3f08676_MD5.png new file mode 100644 index 00000000..0bceebde Binary files /dev/null and b/src/assets/4a3c7755cb85eb19bc614090a3f08676_MD5.png differ diff --git a/src/assets/4de80b5cd85863024d63689cdf806721_MD5.png b/src/assets/4de80b5cd85863024d63689cdf806721_MD5.png new file mode 100644 index 00000000..8e59d066 Binary files /dev/null and b/src/assets/4de80b5cd85863024d63689cdf806721_MD5.png differ diff --git a/src/assets/50a0fa1a34f38c62dcbd4cc31b579087_MD5.png b/src/assets/50a0fa1a34f38c62dcbd4cc31b579087_MD5.png new file mode 100644 index 00000000..f62c0193 Binary files /dev/null and b/src/assets/50a0fa1a34f38c62dcbd4cc31b579087_MD5.png differ diff --git a/src/assets/5ff7f644bdf93f26d18e48f2f0ee3c43_MD5.png b/src/assets/5ff7f644bdf93f26d18e48f2f0ee3c43_MD5.png new file mode 100644 index 00000000..31c22d58 Binary files /dev/null and b/src/assets/5ff7f644bdf93f26d18e48f2f0ee3c43_MD5.png differ diff --git a/src/assets/67c928f040091835a073775ea418ff4c_MD5.png b/src/assets/67c928f040091835a073775ea418ff4c_MD5.png new file mode 100644 index 00000000..b9c7ed3b Binary files /dev/null and b/src/assets/67c928f040091835a073775ea418ff4c_MD5.png differ diff --git a/src/assets/6b8137561c99a0795bdcb48f57fab85e_MD5.png b/src/assets/6b8137561c99a0795bdcb48f57fab85e_MD5.png new file mode 100644 index 00000000..30a17bc5 Binary files /dev/null and b/src/assets/6b8137561c99a0795bdcb48f57fab85e_MD5.png differ diff --git a/src/assets/6dd98ac109ac059509e72720c885e733_MD5.png b/src/assets/6dd98ac109ac059509e72720c885e733_MD5.png new file mode 100644 index 00000000..0ac4642d Binary files /dev/null and b/src/assets/6dd98ac109ac059509e72720c885e733_MD5.png differ diff --git a/src/assets/7b352103fed9e315ab8c3543f0ceb4f1_MD5.png b/src/assets/7b352103fed9e315ab8c3543f0ceb4f1_MD5.png new file mode 100644 index 00000000..f3aba787 Binary files /dev/null and b/src/assets/7b352103fed9e315ab8c3543f0ceb4f1_MD5.png differ diff --git a/src/assets/81ab37e57b20cd4223c7e3b4c42f0232_MD5.png b/src/assets/81ab37e57b20cd4223c7e3b4c42f0232_MD5.png new file mode 100644 index 00000000..4cbb519d Binary files /dev/null and b/src/assets/81ab37e57b20cd4223c7e3b4c42f0232_MD5.png differ diff --git a/src/assets/83ee28582510c7573aceb4284b3c4ac0_MD5.png b/src/assets/83ee28582510c7573aceb4284b3c4ac0_MD5.png new file mode 100644 index 00000000..b495a3ee Binary files /dev/null and b/src/assets/83ee28582510c7573aceb4284b3c4ac0_MD5.png differ diff --git a/src/assets/8a33ca40095a62ad5b3c6857dc6add55_MD5.png b/src/assets/8a33ca40095a62ad5b3c6857dc6add55_MD5.png new file mode 100644 index 00000000..eee74f78 Binary files /dev/null and b/src/assets/8a33ca40095a62ad5b3c6857dc6add55_MD5.png differ diff --git a/src/assets/8addbd81b3d85f5501f1a58020ab3191_MD5.png b/src/assets/8addbd81b3d85f5501f1a58020ab3191_MD5.png new file mode 100644 index 00000000..f2a19e19 Binary files /dev/null and b/src/assets/8addbd81b3d85f5501f1a58020ab3191_MD5.png differ diff --git a/src/assets/a01d83b2dbe0f1d2c356c891336416ec_MD5.png b/src/assets/a01d83b2dbe0f1d2c356c891336416ec_MD5.png new file mode 100644 index 00000000..d2963e2b Binary files /dev/null and b/src/assets/a01d83b2dbe0f1d2c356c891336416ec_MD5.png differ diff --git a/src/assets/a24bbdd6425f0d2aea3a7f34a0989386_MD5.png b/src/assets/a24bbdd6425f0d2aea3a7f34a0989386_MD5.png new file mode 100644 index 00000000..9321c105 Binary files /dev/null and b/src/assets/a24bbdd6425f0d2aea3a7f34a0989386_MD5.png differ diff --git a/src/assets/a2f3237d76883f049b272f29abdf0c51_MD5.png b/src/assets/a2f3237d76883f049b272f29abdf0c51_MD5.png new file mode 100644 index 00000000..0f870c3c Binary files /dev/null and b/src/assets/a2f3237d76883f049b272f29abdf0c51_MD5.png differ diff --git a/src/assets/aab13e38e1dbeb28f675129f45f38af8_MD5.png b/src/assets/aab13e38e1dbeb28f675129f45f38af8_MD5.png new file mode 100644 index 00000000..0c53ce36 Binary files /dev/null and b/src/assets/aab13e38e1dbeb28f675129f45f38af8_MD5.png differ diff --git a/src/assets/b8282b0cdce33505057400c176ea2cc5_MD5.png b/src/assets/b8282b0cdce33505057400c176ea2cc5_MD5.png new file mode 100644 index 00000000..e1bd703c Binary files /dev/null and b/src/assets/b8282b0cdce33505057400c176ea2cc5_MD5.png differ diff --git a/src/assets/d566856af09a69bd03db196b1e3744cf_MD5.png b/src/assets/d566856af09a69bd03db196b1e3744cf_MD5.png new file mode 100644 index 00000000..0e58066f Binary files /dev/null and b/src/assets/d566856af09a69bd03db196b1e3744cf_MD5.png differ diff --git a/src/assets/d8772b1c75f067c9322b337c5b6fe717_MD5.png b/src/assets/d8772b1c75f067c9322b337c5b6fe717_MD5.png new file mode 100644 index 00000000..aad7aca5 Binary files /dev/null and b/src/assets/d8772b1c75f067c9322b337c5b6fe717_MD5.png differ diff --git a/src/assets/df5d7f252fb711f5362abd06c293f8fd_MD5.png b/src/assets/df5d7f252fb711f5362abd06c293f8fd_MD5.png new file mode 100644 index 00000000..cba2db3a Binary files /dev/null and b/src/assets/df5d7f252fb711f5362abd06c293f8fd_MD5.png differ diff --git a/src/assets/e2f9f84e616a8113ce86de71f95e6764_MD5.png b/src/assets/e2f9f84e616a8113ce86de71f95e6764_MD5.png new file mode 100644 index 00000000..98b8841c Binary files /dev/null and b/src/assets/e2f9f84e616a8113ce86de71f95e6764_MD5.png differ diff --git a/src/assets/f30e9f8627698b66e84c9bdc9a595663_MD5.png b/src/assets/f30e9f8627698b66e84c9bdc9a595663_MD5.png new file mode 100644 index 00000000..e2483c84 Binary files /dev/null and b/src/assets/f30e9f8627698b66e84c9bdc9a595663_MD5.png differ diff --git a/src/assets/fb54e92ec7ed8c0a631028f76695a78a_MD5.png b/src/assets/fb54e92ec7ed8c0a631028f76695a78a_MD5.png new file mode 100644 index 00000000..ce77d942 Binary files /dev/null and b/src/assets/fb54e92ec7ed8c0a631028f76695a78a_MD5.png differ diff --git a/src/assets/fcbe2e6cdb021edcad348da71e947a2a_MD5.png b/src/assets/fcbe2e6cdb021edcad348da71e947a2a_MD5.png new file mode 100644 index 00000000..ce446601 Binary files /dev/null and b/src/assets/fcbe2e6cdb021edcad348da71e947a2a_MD5.png differ diff --git a/src/assets/image-endnote-link-citation-to-bib.png b/src/assets/image-endnote-link-citation-to-bib.png new file mode 100644 index 00000000..03e070c7 Binary files /dev/null and b/src/assets/image-endnote-link-citation-to-bib.png differ diff --git a/src/assets/image-settings-reinstalll-word-plugin.png b/src/assets/image-settings-reinstalll-word-plugin.png new file mode 100644 index 00000000..86d06e24 Binary files /dev/null and b/src/assets/image-settings-reinstalll-word-plugin.png differ diff --git a/src/assets/image-tools-addon.png b/src/assets/image-tools-addon.png new file mode 100644 index 00000000..e03fdd7f Binary files /dev/null and b/src/assets/image-tools-addon.png differ diff --git "a/src/assets/image-word-\345\237\237\344\273\243\347\240\201.png" "b/src/assets/image-word-\345\237\237\344\273\243\347\240\201.png" new file mode 100644 index 00000000..7f0204e6 Binary files /dev/null and "b/src/assets/image-word-\345\237\237\344\273\243\347\240\201.png" differ diff --git "a/src/assets/image-word-\347\241\256\350\256\244\344\277\235\345\255\230\344\277\256\346\224\271.png" "b/src/assets/image-word-\347\241\256\350\256\244\344\277\235\345\255\230\344\277\256\346\224\271.png" new file mode 100644 index 00000000..63e000ab Binary files /dev/null and "b/src/assets/image-word-\347\241\256\350\256\244\344\277\235\345\255\230\344\277\256\346\224\271.png" differ diff --git "a/src/assets/image-wps-\346\262\241\346\234\211\346\230\276\347\244\272\345\212\240\350\275\275\351\241\271.png" "b/src/assets/image-wps-\346\262\241\346\234\211\346\230\276\347\244\272\345\212\240\350\275\275\351\241\271.png" new file mode 100644 index 00000000..35b062c0 Binary files /dev/null and "b/src/assets/image-wps-\346\262\241\346\234\211\346\230\276\347\244\272\345\212\240\350\275\275\351\241\271.png" differ diff --git a/src/assets/image-zotero-addon-manager.png b/src/assets/image-zotero-addon-manager.png new file mode 100644 index 00000000..047f8813 Binary files /dev/null and b/src/assets/image-zotero-addon-manager.png differ diff --git a/src/user-guide/faqs/word-addon.md b/src/user-guide/faqs/word-addon.md new file mode 100644 index 00000000..6f0d81b6 --- /dev/null +++ b/src/user-guide/faqs/word-addon.md @@ -0,0 +1,216 @@ +--- +title: 关于 Word 加载项的各种问题 +author: + - name: Northword + - name: winding + - name: ShareStuff +date: 2023-10-04 11:38:09 +updated: 2023-10-04 12:06:21 +--- + +# 关于 Word 加载项的各种问题 + +## Word 中没有 Zotero 选项卡 + +一些朋友在 Word 中的 Zotero 选项卡突然消失了,或者使用的时候报错要求重装/升级该加载项。 **这一加载项需要在 Zotero 首选项 中安装** 。具体步骤如下: + +1. 保存好正在编辑的 Word 文档,并**彻底退出 Word**。 +2. 打开 `[Zotero 首选项]`。 +3. 在 `[引用/Cite]` -`[文字处理软件/Word Processors]` 中点击 `[重新安装 Microsoft Word 加载项/Reinstall Microsoft Word Add-in]` 即可完成安装/更新/重装。 + +![重新安装Word插件](../../assets/image-settings-reinstalll-word-plugin.png) + +:::warning + +如果退出 Word 后重新安装这一加载项仍然报错,建议重启电脑后再尝试。 + +::: + +若上图的【**文字处理软件/Word Processors**】没有内容显示,则需要在 Zotero 软件界面,单击打开【**工具/Tools**】-【**插件/Add-ons**】 + +![image.png](../../assets/image-tools-addon.png) + +找到【**Zotero Word for Windows Integration**】插件,确保其没有处理禁用状态。 + +![image.png](../../assets/image-zotero-addon-manager.png) + +## 报错“无法与 Zotero 通讯” + +::: info 待办 + +::: + +## 您已经修改该引文,是否保留更改? + +![image.png](../../assets/image-word-确认保存修改.png) + +该弹窗通常是用户手动修改了引文或参考文献表,比如该弹窗即为某文献在文中编码为“[1]”,用户手动把它修改为了“[111]”,Zotero 再次刷新时会询问用户是否保留这些修改? + +如果用户需要保留自己的修改,则点击“是 yes”,如果用户需要抛弃自己的修改,使用 Zotero 生成的内容,则需要选择“否 No”。 + +:::danger + +注意:请谨慎选择“是 Yes”,该操作会让 Zotero 不再更新此处! + +::: + +::: warning + +所有的引注顺序更改都应在 Word “引文编辑对话框”中进行,而不是手动修改! + +所有的引注/参考文献表的样式修改都应在 CSL 文件中进行,而不是手动修改! + +所有的条目信息,如作者、标题、期刊、期卷页等,都应在 Zotero 中更新条目,而不是手动在域代码上修改! + +::: + +如果已经点了 “是 yes”,Zotero 不再对这一处引文进行更新,而后续又想要 Zotero 对其更新,可以参照下一节。 + +### 使 Zotero 恢复对引文的更新 + +首先分析一下 Word 加载项 在 word 留下的域代码结构,以 [https://doi.org/10.1021/acscatal.0c05697](https://doi.org/10.1021/acscatal.0c05697) 为例,其正常插入 Word 后产生的域代码为: + +![image.png](../../assets/image-word-域代码.png) + +其中标黄部分是标识这是一个 Word 域代码块的声明,可以不去管,重点在包含在其中的 json 内容,为了方便理解,将其格式化后显示如下: + +```json +{ + "citationID": "gr3uElq7", + "properties": { + "formattedCitation": "\\super [1]\\nosupersub{}", + "plainCitation": "[1]", + "noteIndex": 0 + }, + "citationItems": [ + { + "id": 2220, + "uris": [ + "http://zotero.org/users/7424907/items/SUW7JYI9" + ], + "itemData": { + "id": 2220, + "type": "article-journal", + "abstract": "To explore effective way for the complete catalytic degradation of toluene at low temperature, catalysts with diverse activity of adsorbed oxygen (Oads) and lattice oxygen (Olatt) are synthesized by introducing Sr2+ into the birnessite structure. Sr modification highly improved low-temperature catalytic activity and CO2 selectivity of toluene oxidation under moist condition, especially on the BS-7.5 (Sr:Mn = 0.075) catalyst. A series of physiochemical characterizations and DFT calculations identified abundant Olatt with higher activity in Sr-doped birnessite and higher activity of Oads in pure birnessite. In situ DRIFTS analysis further confirmed that activation of Olatt introduced by Sr replacement of Mn governed the reaction process towards continuous deep oxidation of toluene. These findings provide a deeper understanding of the mechanism of toluene degradation and strongly pave a way for improving the complete catalytic oxidation performance of VOCs at low temperature over MnO2 catalysts from the aspect of regulating active oxygen-related properties.", + "archive": "Q1", + "archive_location": "工程技术1区 Top", + "call-number": "8.04", + "collection-title": "无", + "container-title": "Fuel", + "DOI": "10.1016/j.fuel.2022.124116", + "ISSN": "0016-2361", + "journalAbbreviation": "Fuel", + "language": "en", + "license": "8.04", + "note": "JCR分区: Q1\n中科院分区升级版: 工程技术1区\n中科院分区基础版: 工程技术2区\n影响因子: 8.04\n5年影响因子: 6.63\nEI: 是", + "page": "124116", + "source": "能源与燃料2区 工程:化工1区", + "title": "Regulating oxygen species for promoted deep oxidation of toluene: A comparative study of adsorbed oxygen and lattice oxygen", + "title-short": "Regulating oxygen species for promoted deep oxidation of toluene", + "volume": "321", + "author": [ + { + "family": "Zhang", + "given": "Luyue" + }, + { + "family": "Liu", + "given": "Yongjun" + }, + { + "family": "Fang", + "given": "Xue" + }, + { + "family": "Cheng", + "given": "Yan" + } + ], + "issued": { + "date-parts": [ + [ + "2022", + 8, + 1 + ] + ] + } + } + } + ], + "schema": "https://github.com/citation-style-language/schema/raw/master/csl-citation.json" +} +``` + +其被修改后,域代码则会变为: + +```json +{ + "citationID": "gr3uElq7", + "properties": { + "formattedCitation": "\\super [1]\\nosupersub{}", + "plainCitation": "[1]", + "dontUpdate": true, + "noteIndex": 0 + }, + "citationItems": [ + { + "id": 2220, + "uris": [ + "http://zotero.org/users/7424907/items/SUW7JYI9" + ], + "itemData": { + "id": 2220, + "type": "article-journal", + "abstract": "To explore effective way for the complete catalytic degradation of toluene at low temperature, catalysts with diverse activity of adsorbed oxygen (Oads) and lattice oxygen (Olatt) are synthesized by introducing Sr2+ into the birnessite structure. Sr modification highly improved low-temperature catalytic activity and CO2 selectivity of toluene oxidation under moist condition, especially on the BS-7.5 (Sr:Mn = 0.075) catalyst. A series of physiochemical characterizations and DFT calculations identified abundant Olatt with higher activity in Sr-doped birnessite and higher activity of Oads in pure birnessite. In situ DRIFTS analysis further confirmed that activation of Olatt introduced by Sr replacement of Mn governed the reaction process towards continuous deep oxidation of toluene. These findings provide a deeper understanding of the mechanism of toluene degradation and strongly pave a way for improving the complete catalytic oxidation performance of VOCs at low temperature over MnO2 catalysts from the aspect of regulating active oxygen-related properties.", + "archive": "Q1", + "archive_location": "工程技术1区 Top", + "call-number": "8.04", + "collection-title": "无", + "container-title": "Fuel", + "DOI": "10.1016/j.fuel.2022.124116", + "ISSN": "0016-2361", + "journalAbbreviation": "Fuel", + "language": "en", + "license": "8.04", + "note": "JCR分区: Q1\n中科院分区升级版: 工程技术1区\n中科院分区基础版: 工程技术2区\n影响因子: 8.04\n5年影响因子: 6.63\nEI: 是", + "page": "124116", + "source": "能源与燃料2区 工程:化工1区", + "title": "Regulating oxygen species for promoted deep oxidation of toluene: A comparative study of adsorbed oxygen and lattice oxygen", + "title-short": "Regulating oxygen species for promoted deep oxidation of toluene", + "volume": "321", + "author": [ + { + "family": "Zhang", + "given": "Luyue" + }, + { + "family": "Liu", + "given": "Yongjun" + }, + { + "family": "Fang", + "given": "Xue" + }, + { + "family": "Cheng", + "given": "Yan" + } + ], + "issued": { + "date-parts": [ + [ + "2022", + 8, + 1 + ] + ] + } + } + } + ], + "schema": "https://github.com/citation-style-language/schema/raw/master/csl-citation.json" +} +``` + +可以看到,多了第六行 `"dontUpdate": true,`,我们将这一行去掉,再更新域代码,即可恢复 Zotero 对该处的更新。 diff --git a/src/user-guide/misc/link-citation-to-bibliography.md b/src/user-guide/misc/link-citation-to-bibliography.md new file mode 100644 index 00000000..0c629b89 --- /dev/null +++ b/src/user-guide/misc/link-citation-to-bibliography.md @@ -0,0 +1,248 @@ +--- +date: 2022-07-29 20:23:17 +updated: 2023-10-04 11:59:36 +title: 在 Word 中把引注链接到参考文献表 +--- + +# 在 Word 中把引注链接到参考文献表 + +## 描述 + +建立引注(citation)与参考文献表(bibliography)之间的单向超链接(引用 -> 参考书目),类似于 endnotes 的“Link in-text citations to references in the bibliography”: + +![EndNote 中关于链接引注和参考文献表的选项](../../assets/image-endnote-link-citation-to-bib.png) + +Zotero 官方不提供该功能,这是因为 Zotero 使用的 CSL 处理器将 citation 渲染为一个 filed,无法添加超链接 [^1]。 + +从 Zotero 论坛发现了通过 word 宏实现的功能 [^2],虽有一些缺陷,但基本可以达成需求。 + +## 配置及使用 + +在 Word 里新建一个宏,添加宏代码如下: + +```vbnet +Public Sub ZoteroLinkCitation() + +' get selected area (if applicable) + Dim nStart&, nEnd& + nStart = Selection.Start + nEnd = Selection.End + +' toggle screen updating + Application.ScreenUpdating = False + +' define variables + Dim title As String + Dim titleAnchor As String + Dim style As String + Dim fieldCode As String + Dim numOrYear As String + Dim pos&, n1&, n2&, n3& + + ActiveWindow.View.ShowFieldCodes = True + Selection.Find.ClearFormatting + +' find the Zotero bibliography + With Selection.Find + .Text = "^d ADDIN ZOTERO_BIBL" + .Replacement.Text = "" + .Forward = True + .Wrap = wdFindContinue + .Format = False + .MatchCase = False + .MatchWholeWord = False + .MatchWildcards = False + .MatchSoundsLike = False + .MatchAllWordForms = False + End With + Selection.Find.Execute + + ' add bookmark for the Zotero bibliography + With ActiveDocument.Bookmarks + .Add Range:=Selection.Range, Name:="Zotero_Bibliography" + .DefaultSorting = wdSortByName + .ShowHidden = True + End With + + ' loop through each field in the document + For Each aField In ActiveDocument.Fields + ' check if the field is a Zotero in-text reference + '################################################## + If InStr(aField.Code, "ADDIN ZOTERO_ITEM") > 0 Then + fieldCode = aField.Code + '############# + ' Prepare + ' Plain citation== Format of Textfield shown + ' must be in Brackets + Dim plain_Cit As String + plCitStrBeg = """plainCitation"":""[" + plCitStrEnd = "]""" + n1 = InStr(fieldCode, plCitStrBeg) + n1 = n1 + Len(plCitStrBeg) + n2 = InStr(Mid(fieldCode, n1, Len(fieldCode) - n1), plCitStrEnd) - 1 + n1 + plain_Cit = Mid$(fieldCode, n1 - 1, n2 - n1 + 2) + 'Reference 'as shown' in word as a string + + 'Title array in fieldCode (all referenced Titles within this field) + Dim array_RefTitle(32) As String + i = 0 + Do While InStr(fieldCode, """title"":""") > 0 + n1 = InStr(fieldCode, """title"":""") + Len("""title"":""") + n2 = InStr(Mid(fieldCode, n1, Len(fieldCode) - n1), """,""") - 1 + n1 + If n2 < n1 Then 'Exception the type 'Article' + n2 = InStr(Mid(fieldCode, n1, Len(fieldCode) - n1), "}") - 1 + n1 - 1 + End If + array_RefTitle(i) = Mid(fieldCode, n1, n2 - n1) + fieldCode = Mid(fieldCode, n2 + 1, Len(fieldCode) - n2 - 1) + i = i + 1 + Loop + Titles_in_Cit = i + + 'Number array with References shown in PlainCit + 'Numer is equal or less than Titels, depending on the type + '[3], [8]-[10]; [2]-[4]; [2], [4], [5] + ' All citations have to be in Brackets each! [3], [8] not [3, 8] + ' This doesnt work otherwise! + ' --> treatment of other delimiters could be implemented here + Dim RefNumber(32) As String + i = 0 + Do While (InStr(plain_Cit, "]") Or InStr(plain_Cit, "[")) > 0 + n1 = InStr(plain_Cit, "[") + n2 = InStr(plain_Cit, "]") + RefNumber(i) = Mid(plain_Cit, n1 + 1, n2 - (n1 + 1)) + plain_Cit = Mid(plain_Cit, n2 + 1, Len(plain_Cit) - (n2 + 1) + 1) + i = i + 1 + Loop + Refs_in_Cit = i + 'treat only the shown references (skip the rest) + '[3], [8]-[10] --> skip [9] + 'Order of titles given from fieldcode, not checked! + If Titles_in_Cit > Refs_in_Cit Then + array_RefTitle(Refs_in_Cit - 1) = array_RefTitle(Titles_in_Cit - 1) + i = 1 + Do While Refs_in_Cit + i <= Titles_in_Cit + array_RefTitle(Refs_in_Cit + i - 1) = "" + i = i + 1 + Loop + End If + + '############# + 'Make the links + For Refs = 0 To Refs_in_Cit - 1 Step 1 + title = array_RefTitle(Refs) + array_RefTitle(Refs) = "" + ' make title a valid bookmark name + titleAnchor = title + titleAnchor = MakeValidBMName(titleAnchor) + + ActiveWindow.View.ShowFieldCodes = False + Selection.GoTo What:=wdGoToBookmark, Name:="Zotero_Bibliography" + + '' locate the corresponding reference in the bibliography + '' by searching for its title + Selection.Find.ClearFormatting + With Selection.Find + .Text = Left(title, 255) + .Replacement.Text = "" + .Forward = True + .Wrap = wdFindContinue + .Format = False + .MatchCase = False + .MatchWholeWord = False + .MatchWildcards = False + .MatchSoundsLike = False + .MatchAllWordForms = False + End With + Selection.Find.Execute + + ' select the whole caption (for mouseover tooltip) + Selection.MoveStartUntil ("["), Count:=wdBackward + Selection.MoveEndUntil (vbBack) + lnkcap = "[" & Selection.Text + lnkcap = Left(lnkcap, 70) + + ' add bookmark for the reference within the bibliography + Selection.Shrink + With ActiveDocument.Bookmarks + .Add Range:=Selection.Range, Name:=titleAnchor + .DefaultSorting = wdSortByName + .ShowHidden = True + End With + + ' jump back to the field + aField.Select + ' find and select the numeric part of the field which will become the hyperlink + Selection.Find.ClearFormatting + With Selection.Find + .Text = RefNumber(Refs) + .Replacement.Text = "" + .Forward = True + .Wrap = wdFindContinue + .Format = False + .MatchCase = False + .MatchWholeWord = False + .MatchWildcards = False + .MatchSoundsLike = False + .MatchAllWordForms = False + End With + Selection.Find.Execute + + numOrYear = Selection.Range.Text & "" + + ' store current style + style = Selection.style + ' Generate the Hyperlink -->Forward! + ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:="", SubAddress:=titleAnchor, ScreenTip:=lnkcap, TextToDisplay:="" & numOrYear + ' reset the style + Selection.style = style + + ' comment if you want standard link style + aField.Select + With Selection.Font + .Underline = wdUnderlineNone + .ColorIndex = wdBlack + End With + + Next Refs 'References in Cit + + End If 'If Zotero-Field + '######################### + + Next aField ' next field + + ' go back to original range selected + ActiveWindow.View.ShowFieldCodes = False + ActiveDocument.Range(nStart, nEnd).Select + + End Sub + Function MakeValidBMName(strIn As String) + Dim pFirstChr As String + Dim i As Long + Dim tempStr As String + strIn = Trim(strIn) + pFirstChr = Left(strIn, 1) + If Not pFirstChr Like "[A-Za-z]" Then + strIn = "A_" & strIn + End If + For i = 1 To Len(strIn) + Select Case Asc(Mid$(strIn, i, 1)) + Case 49 To 57, 65 To 90, 97 To 122 + tempStr = tempStr & Mid$(strIn, i, 1) + Case Else + tempStr = tempStr & "_" + End Select + Next i + tempStr = Replace(tempStr, " ", " ") + MakeValidBMName = Left(tempStr, 40) + End Function +``` + +## 缺陷和注意事项 + +- 手动更新引注时会出现引注已被修改的弹窗 +- 无法实现从参考文献表跳转到引注 +- 同时引用多个引注时只能链接最后一个。 + +[^1]: 来源添加 + +[^2]: [Word: Possibility to link references and bibliography in a document? -  Zotero Forums](https://forums.zotero.org/discussion/comment/324312/#Comment_324312) diff --git a/src/user-guide/misc/wps-plugin-vba.md b/src/user-guide/misc/wps-plugin-vba.md new file mode 100644 index 00000000..ccb71e20 --- /dev/null +++ b/src/user-guide/misc/wps-plugin-vba.md @@ -0,0 +1,261 @@ +--- +title: 通过 VBA 在 WPS 中使用 Word 插件 +date: 2023-10-04 11:38:09 +updated: 2023-10-04 12:06:44 +--- + +# 通过 VBA 在 WPS 中使用 Word 插件 + +## 前言(很重要哦!) + +:::info + +**Zotero Word 插件在 WPS 的使用操作与 Office Word 类似,因此不再展开说明,点击下方蓝字可查看 📝**[**在Word中插入引文**](../ms-word-plugin.md) + +::: + +> **🔊🔊🔊必看!!!**:当新建一个空白的 Word 文档用 WPS 打开撰写论文等情况时:一定要先用 WPS 里的 Zotero Word 加载项插入几个文献,再点击**Add/Edit Citation 等这 6 个按钮**,尤其是一定要多次点击**Refresh**和**Unlink Citations**按钮,检查是否正常使用!!!(无法正常使用请见本文档 **四、Refresh/Unlink Citations 莫名失效**) + +:::warning + +**以下是 WPS 的 Zotero Word 加载项的常见问题及解决方法,均以 Window 系统为例演示📝:** + +::: + +## 一、没有显示 Zotero 加载项 + +![image.png](../../assets/image-wps-没有显示加载项.png) + +:::info + +如上图所示,WPS 的文档界面不显示 Zotero 加载项。**解决办法如下**: + +::: + +### 1、检查 Microsoft Word 加载项 + +检查 Zotero 是否已正常安装好**Microsoft Word 加载项**。安装此加载项的步骤,详见 Zotero 百科全书的 [【引文|插件】Word 加载项相关问题](../faqs/word-addon.md)(点击左侧蓝字自查) + +![重新安装 Word 插件](../../assets/image-settings-reinstalll-word-plugin.png) + +### 2、WPS.VBA 插件的安装 + +若 WPS 为**个人版**,需额外安装 [**VBA插件**](https://pan.baidu.com/s/1y-cjisA6Lxbnw3r3g_jmKA?pwd=moyu)(点击左侧蓝字获取插件) + +:::warning + +WPS 专业版等版本一般已自带 VBA 宏功能,Zotero 加载项如有使用问题,也可选择安装 VBA 插件。 + +::: + +1)将 WPS.VBA 安装程序**下载并保存**到电脑,确保 WPS 程序是 **未运行**状态。 + +![image.png](../../assets/fb54e92ec7ed8c0a631028f76695a78a_MD5.png) + +2)**双击**打开 WPS. VBA 安装程序,依次单击【**Next**】,最后单击【**Finish**】。用 WPS 打开任意一个 word 文档,检查是否正常显示 Zotero 加载项。 + +![image.png](../../assets/f30e9f8627698b66e84c9bdc9a595663_MD5.png) + +:::warning + +若 WPS. VBA 安装后,仍未显示 Zotero 加载项,或需将【**宏安全性**】设成低(但不建议)。除此外可见下方**3、补充 Zotero. dotm 文件** + +::: + +### 3、补充 Zotero.dotm 文件 + +1)在 Zotero 图标处**右键单击**,单击【**打开文件所在的位置**】打开 Zotero 安装路径 + +![image.png](../../assets/e2f9f84e616a8113ce86de71f95e6764_MD5.png) + + 2)依次双击打开【**extensions**】-【**】-【install**】文件夹,复制 **Zotero.dotm** 文件。 + +![image.png](../../assets/8addbd81b3d85f5501f1a58020ab3191_MD5.png) + +![image.png](../../assets/67c928f040091835a073775ea418ff4c_MD5.png) + +:::warning + +如果上图文件夹位置没有 Zotero.dotm,可点击右侧蓝字获取 [**Zotero.dotm**](https://pan.baidu.com/s/1EMfR5KRi8Mxxn9Wa7UR7Ag?pwd=moyu) + +::: + +3)在 WPS 图标处**右键单击**,单击【**打开文件所在的位置**】打开 WPS 安装路径。 + +![image.png](../../assets/1e7deb7a378eadbeda2d05f2ed6408ca_MD5.png) + +:::warning + +以上前提是确保 WPS 已关闭,不在运行中!!! + +::: + +4)找到并打开**版本最新**的文件夹(即**数字最大**),再依次打开【**office6**】-【**startup**】 + +![image.png](../../assets/2a4390faa87ca714c9264b8f3bae4b64_MD5.png) + +![image.png](../../assets/6dd98ac109ac059509e72720c885e733_MD5.png) + +5)在 WPS 的【**startup**】启动项文件夹内,粘贴 **Zotero.dotm** 文件。再次用 WPS 打开任一 Word 文档,检查 WPS 是否已显示 Zotero 加载项。 + +![image.png](../../assets/50a0fa1a34f38c62dcbd4cc31b579087_MD5.png) + +## 二、Zotero 加载项出现弹窗报错 + +![image.png](../../assets/b8282b0cdce33505057400c176ea2cc5_MD5.png) + +:::info + +如上图所示,在 WPS 使用 Zotero 加载项的各个按钮时,会出现弹窗警告。**解决方法如下**: + +::: + +### 1、解决方法一 + +新建一个 Word 文档,先用 **Office**打开此文档,用 Zotero 加载项 **插入一篇文献**后,保存此文档即可。 + +![image.png](../../assets/83ee28582510c7573aceb4284b3c4ac0_MD5.png) + +:::warning + +设置较简单,仅适用于**同时安装 Office 和 WPS**。以后再使用时,可能还会报错。 + +如仍报错:可能是将光标置于插入引文 Citaion 和参考文献 References 位置的**前后或内部** + +解决方法:将光标定位在远离上述位置如正文文字处 + +::: + +### 2、解决方法二 + +1)单击【**开发者工具**】-【**加载项**】,弹出的对话框单击【**选用**】。 + +![image.png](../../assets/a24bbdd6425f0d2aea3a7f34a0989386_MD5.png) + +:::warning + +设置较复杂,适用于 **同时装有 Office 和 WPS**或 **只装有 WPS** + +::: + +:::warning + +若【**开发工具**】选项卡的内容为灰色,即无法点击操作。 + +**解决方法**:安装 WPS. VBA 插件(详见本文档 **WPS. VBA 插件的安装**) + +或需升级更新 WPS 版本,以及可能需要安装使用 WPS 专业版等版本。 + +::: + +2)弹出对话框,双击进入上方地址栏并复制**地址**,或地址栏处右键单击,再单击【**将地址复制为文本**】。复制好地址后,即可关闭当前窗口。 + +![image.png](../../assets/81ab37e57b20cd4223c7e3b4c42f0232_MD5.png) + +3)单击【**文件**】选项卡,再单击【**打开**】。将 **地址** 粘贴至【**文件名**】,【**文件类型**】选择 **所有文件**,然后单击【**打开**】。 + +![image.png](../../assets/6b8137561c99a0795bdcb48f57fab85e_MD5.png) + +![image.png](../../assets/d8772b1c75f067c9322b337c5b6fe717_MD5.png) + +4)选中 **Normal.dotm** 文件,单击【**打开**】,随之打开名为 **Normal.dotm** 文档。 + +![image.png](../../assets/4de80b5cd85863024d63689cdf806721_MD5.png) + +5)在 **Normal.dotm** 文档内,依次单击【**文件**】-【**文档加密**】-【**属性**】 + +![image.png](../../assets/5ff7f644bdf93f26d18e48f2f0ee3c43_MD5.png) + +6)在 **Normal.dotm** 属性对话框,切换到【**自定义**】窗口,【**名称**】和【**取值**】分别输入 **ZOTERO_PREF_1** 和 **1** ,点击【**添加**】。同理,再添加上 **ZOTERO_PREF_2** 和 **1** ,最后点击【**确定**】。 + +![image.png](../../assets/fcbe2e6cdb021edcad348da71e947a2a_MD5.png) + +这一步完成的效果如下: + +![image.png](../../assets/a2f3237d76883f049b272f29abdf0c51_MD5.png) + +7)左上角单击【**保存**】图标或快捷键 **Ctrl+S** 保存 **Normal.dotm** 文档。重新用 WPS 打开一个 Word 文档检查是否不再出现报错窗口。 + +![image.png](../../assets/8a33ca40095a62ad5b3c6857dc6add55_MD5.png) + +:::warning + +如仍报错:可能是将光标置于插入引文 Citaion 和参考文献 References 位置的**前后或内部** + +解决方法:将光标定位在远离上述位置如正文文字处 + +::: + +## **三、Refresh/Unlink Citations 问号图标** + +![image.png](../../assets/d566856af09a69bd03db196b1e3744cf_MD5.png) + +:::info + +如上图所示,**Refresh**和 **Unlink Citations**图标显示为问号,**解决办法如下**: + +::: + +### 1、直接安装美化后的图标文件 + +1)我已创建 5 种 [Refresh和Unlink Citations图标](https://pan.baidu.com/s/1BXjo-ZOT971qlsY-zboIdA?pwd=moyu)(任选其一),可直接安装使用。点击上方蓝字即可获取,首先将其**下载并保存**到电脑(如下图所示)。 + +![image.png](../../assets/a01d83b2dbe0f1d2c356c891336416ec_MD5.png) + +:::warning + +只需选择使用一个自己喜爱的图标文件或可自己编辑设计图标。 + +::: + +下方是 5 个已编辑好的 **Refresh**和 **Unlink Citations**图标的图片展示。 + +![image.png](../../assets/15e71e5849e591f2252b7e706e8d6707_MD5.png) + +2)将上述**任一 Zotero**文件,粘贴至 WPS 的**启动项文件夹**内(详见本文档的 **补充 Zotero.dotm 文件**) + +3)用 WPS 打开任一 Word 文档,但是会显示有 2 个 Zotero 加载项。 + +![image.png](../../assets/7b352103fed9e315ab8c3543f0ceb4f1_MD5.png) + +:::warning + +因为没更换 Zotero 安装路径的 Zotero.dotm,且 Office Word 的启动项文件夹未放置 Zotero.dotm。 + +::: + +:::info + +这样做的考虑是:保持 Office Word 的 Refresh 和 Unlink Citations 图标不变动,同时保留原有的 Zotero. dotm,以备不时之需。当然也可自己按喜好设置更换。 + +::: + +#### 只保留 1 个 Zotero 加载项 + +1)依次单击【**开发者工具**】-【**加载项**】。 单击选中 **Zotero.dotm**,单击【**禁用**】。 + +![image.png](../../assets/df5d7f252fb711f5362abd06c293f8fd_MD5.png) + +2)**Zotero.dotm** 前面方框,此刻已更改成 **取消勾选**,点击【**确定**】即可。 + +![image.png](../../assets/aab13e38e1dbeb28f675129f45f38af8_MD5.png) + +## 四、Refresh/Unlink Citations 莫名失效 + +有时新建 Word 文档,用 WPS 打开后,无故出现点击 Refresh 和 Unlink Citations 功能失效(即无响应或莫名删掉引文 Citation)。 + +**解决方法**: + +1)不要将光标置于插入引文 Citaion 和参考文献 References 的位置(即将光标定位在远离上述位置如正文文字处,再点击 Refresh 按钮) + +2)重启 WPS,或新建一个 Word 文档,再用 WPS 打开。或必要时重启电脑即可正常使用。 + +> **🔊🔊🔊必看!!!**:当新建一个空白的 Word 文档用 WPS 打开撰写论文等情况时:一定要先用 WPS 里的 Zotero Word 加载项插入几个文献,再点击**Add/Edit Citation 等这 6 个按钮**,尤其是一定要多次点击**Refresh**和**Unlink Citations**按钮,检查是否正常使用!!! + +## 致谢 + +:::info + +👍到这里,在 WPS 中使用 Zotero Word 加载项的使用已接近尾声。在此由衷地感谢来自 b 站、知乎、CSDN 等网站的大神们分享的有关 WPS 的 Zotero Word 加载项使用的宝贵经验!!! + +:::