Zotero 您所在的位置:网站首页 在word中加超链接 Zotero

Zotero

2024-01-10 15:09| 来源: 网络整理| 查看: 265

参考文献格式:

在这里插入图片描述

引用格式:

在这里插入图片描述,其中数字部分为超链接。

1.打开Word->视图->宏->点击,选查看宏

在这里插入图片描述

2. 输入宏名:ZoteroLinkCitation,创建宏

在这里插入图片描述

3.将代码全部替换为下面这个代码 Public Sub ZoteroLinkCitation() Dim nStart&, nEnd& nStart = Selection.Start nEnd = Selection.End Application.ScreenUpdating = False Dim title As String Dim titleAnchor As String Dim style As String Dim fieldCode As String Dim numOrYear As String Dim pos&, n1&, n2& ActiveWindow.View.ShowFieldCodes = True Selection.Find.ClearFormatting 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 With ActiveDocument.Bookmarks .Add Range:=Selection.Range, Name:="Zotero_Bibliography" .DefaultSorting = wdSortByName .ShowHidden = True End With ActiveWindow.View.ShowFieldCodes = False 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 pos = 0 Do While InStr(fieldCode, """title"":""") > 0 n1 = InStr(fieldCode, """title"":""") + Len("""title"":""") n2 = InStr(Mid(fieldCode, n1, Len(fieldCode) - n1), """,""") - 1 + n1 title = Mid(fieldCode, n1, n2 - n1) titleAnchor = Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(title, " ", "_"), "&", "_"), ":", "_"), ",", "_"), "-", "_"), ".", "_"), "(", "_"), ")", "_"), "?", "_"), "!", "_") titleAnchor = Left(titleAnchor, 40) Selection.GoTo What:=wdGoToBookmark, Name:="Zotero_Bibliography" Selection.Find.ClearFormatting With Selection.Find .Text = Left(title, 255) .Replacement.Text = "" .Forward = True .Wrap = wdFindAsk .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Selection.Paragraphs(1).Range.Select With ActiveDocument.Bookmarks .Add Range:=Selection.Range, Name:=titleAnchor .DefaultSorting = wdSortByName .ShowHidden = True End With aField.Select Selection.Find.ClearFormatting With Selection.Find .Text = "^#" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Selection.MoveLeft Unit:=wdCharacter, Count:=1 Selection.MoveRight Unit:=wdCharacter, Count:=pos Selection.Find.Execute Selection.MoveLeft Unit:=wdCharacter, Count:=1 Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend numOrYear = Selection.Range.Text & "" pos = Len(numOrYear) style = Selection.style ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:="", SubAddress:=titleAnchor, ScreenTip:="", TextToDisplay:="" & numOrYear aField.Select Selection.style = style 'Selection.style = ActiveDocument.Styles("CitationFormating") fieldCode = Mid(fieldCode, n2 + 1, Len(fieldCode) - n2 - 1) Loop End If Next aField ActiveDocument.Range(nStart, nEnd).Select End Sub

注:要为生成的链接设置样式,请取消注释该行, 并在那里写下您的样式。

'Selection.style = ActiveDocument.Styles("CitationFormating")

代码链接: Zotero

4. Ctrl+s保存,左下角重命名为ZoteroLinkCitation,关闭页面,并关闭Word。

在这里插入图片描述

5. 打开word,查看宏 6. 运行宏ZoteroLinkCitation

在这里插入图片描述

7. 引用展示

在这里插入图片描述 在这里插入图片描述

8. tips

前提:已经插入好引用,并构建好参考文献了。这个宏只是将两者添加超链接。 技巧:可以插完全部参考文献再运行!! 注意:该方法根据标题将作者日期或数字样式引用链接到他们的参考文献条目。它在字段中搜索数字(年份或序号),选择它,然后将其链接到 zotero 字段中的标题。尚不支持上标样式,因为选择数字会导致整个字段被链接替换。

9. 运行出错的解决办法

1. 问题界面: 在这里插入图片描述 2. 点击 调试,会出现下面的界面,会提示出现有问题的文献: 在这里插入图片描述 解决办法:

点击结束,WORD会跳到有问题的文献。 在这里插入图片描述 在这里插入图片描述

打开Zotero,查看有问题的文献。 在这里插入图片描述

检查标题,会议名称,页码等信息。 注:这个错误是标题出现问题了。

找其他正确的文献,把正确的标题复制过来,在这个正确的基础上修改成自己的标题名称。

在重新添加文献,最后在运行宏。

附: 长时间不用可能出现word没有Zotero: 打开Zotero软件,按照“编辑——首选项——引用——文字处理软件——重新加载安装加载项”,点击安装之后,打开word显示即可。 参考文献生成

打开Zotero软件,按照“编辑——首选项——引用——样式”,添加参考文献的格式;

打开word软件,光标放在插入参考文献的位置,按照“Zotero——document preferences”,选中期刊参考文献的格式,点击“Add/Edit citation”添加或编辑参考文献,会出来一个搜索框,在框内输入题目或是姓名查找文献,点击文献即可。如果多个参考文献,就继续输入题目,添加文献。再次回车,可以看到word文档中已经出现该引文;

插入该文献列表:在需要的位置点击Add/Edit Bibliography插入该文献列表,插入后检查参考文献格式是否正确,如果不正确点击Add/Edit Bibliography编辑参考文献,点击右侧参考文献,进行修改,都修改后,点击OK; 在这里插入图片描述

运行宏,生成连接。



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有