最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Zotero

运维笔记admin7浏览0评论

Zotero

Zotero

参考文献格式:

引用格式:

,其中数字部分为超链接

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

2.创建

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 = FalseFor Each aField In ActiveDocument.Fields
' check if the field is a Zotero in-text referenceIf InStr(aField.Code, "ADDIN ZOTERO_ITEM") > 0 ThenfieldCode = aField.Codepos = 0Do While InStr(fieldCode, """title"":""") > 0n1 = InStr(fieldCode, """title"":""") + Len("""title"":""")n2 = InStr(Mid(fieldCode, n1, Len(fieldCode) - n1), """,""") - 1 + n1title = 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.ClearFormattingWith Selection.Find.Text = Left(title, 255).Replacement.Text = "".Forward = True.Wrap = wdFindAsk.Format = False.MatchCase = False.MatchWholeWord = False.MatchWildcards = False.MatchSoundsLike = False.MatchAllWordForms = FalseEnd WithSelection.Find.ExecuteSelection.Paragraphs(1).Range.SelectWith ActiveDocument.Bookmarks.Add Range:=Selection.Range, Name:=titleAnchor.DefaultSorting = wdSortByName.ShowHidden = TrueEnd WithaField.SelectSelection.Find.ClearFormattingWith Selection.Find.Text = "^#".Replacement.Text = "".Forward = True.Wrap = wdFindContinue.Format = False.MatchCase = False.MatchWholeWord = False.MatchWildcards = False.MatchSoundsLike = False.MatchAllWordForms = FalseEnd WithSelection.Find.ExecuteSelection.MoveLeft Unit:=wdCharacter, Count:=1Selection.MoveRight Unit:=wdCharacter, Count:=posSelection.Find.ExecuteSelection.MoveLeft Unit:=wdCharacter, Count:=1Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtendnumOrYear = Selection.Range.Text & ""pos = Len(numOrYear)style = Selection.styleActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:="", SubAddress:=titleAnchor, ScreenTip:="", TextToDisplay:="" & numOrYearaField.SelectSelection.style = style'Selection.style = ActiveDocument.Styles("CitationFormating")fieldCode = Mid(fieldCode, n2 + 1, Len(fieldCode) - n2 - 1)LoopEnd 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. 点击 调试,会出现下面的界面,会提示出现有问题的文献

解决办法:

  1. 点击结束,WORD会跳到有问题的文献

  2. 打开Zotero,查看有问题的文献

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

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

  5. 重新添加文献,最后在运行

发布评论

评论列表(0)

  1. 暂无评论