将word中插入的zotero文献转为latex引用样式

在word中,可以使用zotero插件插入和管理参考文献。

例如:

若需要将这段内容移植到latex,就需要将对应的引用编号用\cite{}替换。手动替换非常麻烦且容易出错。要实现自动转换,可在zotero中定制一种新的引文格式,自动将引用编号替换为\cite{key},方法如下:

将下面的样式文件保存为better-bibtex-citekeys-latex.cls

cls 复制代码
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only" default-locale="en-US">
  <!-- This style was edited with the Visual CSL Editor (http://editor.citationstyles.org/visualEditor/) -->
  <info>
    <title>Better BibTeX Citekeys</title>
    <id>http://www.zotero.org/styles/better-bibtex-citekeys</id>
    <link href="http://www.zotero.org/styles/better-bibtex-citekeys" rel="self"/>
    <link href="http://www.zotero.org/support/bbt_citekeys" rel="documentation"/>
    <author>
      <name>Emiliano Heyns</name>
    </author>
    <category citation-format="author-date"/>
    <category field="generic-base"/>
    <summary>Style to show BBT citekeys</summary>
    <updated>2019-02-27T10:14:13+00:00</updated>
    <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
  </info>
  <macro name="author-short">
    <names variable="author">
      <name form="short" and="text" delimiter=", " initialize-with=". " sort-separator=", "/>
      <substitute>
        <names variable="editor"/>
        <names variable="translator"/>
        <text macro="title"/>
      </substitute>
    </names>
  </macro>
  <macro name="title">
    <text value="&quot;"/>
    <text variable="title"/>
    <text value="&quot;"/>
  </macro>
  <macro name="year-date">
    <choose>
      <if variable="issued">
        <date variable="issued">
          <date-part name="year"/>
        </date>
      </if>
      <else>
        <text term="no date" form="short"/>
      </else>
    </choose>
  </macro>
  <citation et-al-min="2" et-al-use-first="1" disambiguate-add-year-suffix="true" disambiguate-add-names="true" disambiguate-add-givenname="true">
    <sort>
      <key macro="author-short"/>
      <key macro="title"/>
      <key macro="year-date"/>
    </sort>
    <layout delimiter=", " prefix="\cite{" suffix="}">
      <group>
        <text value=""/>
        <text variable="citation-key"/>
        <text variable="locator" prefix=", p. "/>
      </group>
    </layout>
  </citation>
  <bibliography hanging-indent="true" et-al-min="2" et-al-use-first="1">
    <sort>
      <key macro="author-short"/>
      <key macro="year-date"/>
      <key variable="title"/>
    </sort>
    <layout prefix="{" suffix="}">
      <group delimiter=", ">
        <text macro="author-short"/>
        <text macro="title"/>
        <text macro="year-date"/>
      </group>
    </layout>
  </bibliography>
</style>

双击该cls文件,将这一样式安装到zotero(zotero上需要有Better bibtex插件):

在word中,应用该引用格式:

结果如下:

可见已将原文的引用编号转换为latex的\cite命令。

相关推荐
JaredYe4 小时前
纯 Node.js 编译 LaTeX:无需 TeX Live、无需宏包管理的工程级方案(node-latex-compiler)
node.js·latex·tectonic
缺点内向7 小时前
告别“复制粘贴”:用C#和模板高效生成Word文档
开发语言·c#·word
初九之潜龙勿用8 小时前
C#实现导出Word图表通用方法之散点图
开发语言·c#·word·.net·office·图表
私人珍藏库9 小时前
[吾爱大神原创工具] Word图片批量导出并插入Excel对应单元格
word·excel
a程序小傲9 小时前
SpringBoot 秒实现在线 Word 编辑、协同、转化等功能
java·开发语言·spring boot·后端·spring·word·深度优先
a程序小傲9 小时前
国家电网Java面试被问:API网关的JWT令牌验证和OAuth2.0授权码流程
java·开发语言·spring boot·后端·面试·职场和发展·word
gc_22991 天前
学习C#调用OpenXml操作word文档的基本用法(17:学习文档图片类)
c#·word·图片·openxml
2501_930707781 天前
使用C#代码在 Word 文档页面中添加装订线
开发语言·c#·word
miaobinfei1 天前
pdf转word,图片文字转word(使用OCR工具)
pdf·ocr·word
513495922 天前
在Vue.js项目中使用docx和file-saver实现Word文档导出
前端·vue.js·word