赞
踩
在撰写毕业论文时,使用文献管理软件可以帮助我们方便地引用文献。本人使用Word写论文,使用Zotero来进行文献管理,本文以之为例。在Zotero中,引文格式是由一个.csl文件来控制的。现有的Zotero中的csl文件貌似没有一个完美符合一般的毕业论文要求的(主要是中英文混用容易出现问题),为了避免在论文成文后对引用的文献逐一纠错,可以通过修改csl文件来使引文自动满足论文要求。本文简单介绍更改csl文件的方法。
此部分很基础,比较熟悉的同学不用看。
在一篇论文中,在行文过程中,使用的引文叫Citation,而论文最后的“参考文献”部分给的论文细节,被称作Bibliography。要在论文中插入文献,
通过前面的操作,可以方便地添加所需的参考文献,但是上图中可以看到,生成的参考文献的Bibliography有些小的问题。
CSL是 Citation Style Language的缩写。在Zotero中,当添加了某一文献到文献库后,其作者、文献标题、期刊名等信息就保存在了一个文本中,在word中使用该文献时,Zotero会通过.csl文件来对这些信息进行合理的排列和处理,生成论文中的Bibliography。因此,.scl文件的内容,对最终的显示起着决定性作用。不同的期刊,有着不同的参考文献样式,这些都可以通过改变所使用的csl来进行整篇论文中参考文献样式的批量修改。
如,上面的操作中使用的例子是“China National Standard GB/T 7714-2015 (numeric, 中文)”这个格式的,也可以通过点击Document Preferences来选择其他的格式进行显示。而选择某种格式,其实就是选择了某个scl文件。
如果你需要一种格式,而现在还没有,则在网上搜索。搜索某种格式有两种方法。
一个SCL文件是如何实现格式控制的呢?大家可以看看这个https://docs.citationstyles.org/en/1.0.1/primer.html。SCL文件是文本文件,是基于XML语言的。按我粗浅的理解,SCL文件中的内容会被专门的解释器来解释,并结合其他的一些文件内容(包括储存论文本身的信息文件,多国语言翻译规则等文件),最终组合形成所需的格式内容。在Zotero等程序的运行过程中,必定会有这样的解释器。
其中Item Metadata,按我的理解,可能是参考文献的信息。对于已经加入文库的文献,可以在Zotero中右击文献,导出条目,选择CSL JSON格式来导出。导出后的示例如下,大家可以看到其中的一些字段的名称。
[ { "id": "http://zotero.org/users/6541442/items/3MY7WESQ", "type": "article-journal", "abstract": "In this paper, ....", "container-title": "Acta Astronautica", "DOI": "10.1016/j.actaastro.2018.10.031", "ISSN": "00945765", "journalAbbreviation": "Acta Astronautica", "language": "en", "page": "146-153", "source": "DOI.org (Crossref)", "title": "Preliminary experimental study on solid rocket fuel gas scramjet", "URL": "https://linkinghub.elsevier.com/retrieve/pii/S0094576518311962", "volume": "153", "author": [ { "family": "Yang", "given": "Liu" }, { "family": "Yonggang", "given": "Gao" }, { "family": "Lei", "given": "Shi" }, { "family": "Zexin", "given": "Chai" }, { "family": "Xiaojing", "given": "Yu" } ], "accessed": { "date-parts": [ [ "2022", 1, 13 ] ] }, "issued": { "date-parts": [ [ "2018", 12 ] ] } } ]
从前面可以看到,使用下载得到的“China National Standard GB/T 7714-2015 (numeric, 中文)”格式与论文所需格式比较接近了,但是还有一些小瑕疵,我们可以通过修改.scl文件来实现格式的修改。
<title>test</title>
<title-short>GB/T 7714-2015</title-short>
<id>test</id>
cs:locale节点规定了一些term子节点,像前面提到的locale文件,这些子节点起到的作用也是把某些特定的英文词改为中文。按我的理解和测试,本文件中的这个节点可以去掉,因为即使不用它,程序也自动加载locale文件来实现基本的中文翻译。
几个cs:macro相当于定义了几个变量,比如参考文献在引用时的作者,日期,期刊名称等。这些变量同时会有些前缀或后缀等,用来合成正确的参考文献格式。
cs:citation决定了行文中的引用方式。可以看到本csl文件是以"[1]"这样的格式引用的,而且这也符合很多期刊的要求这些内容不需要变动。
最后,最重要的来了,就是cs:bibliography节点。可以看到,其下只有一个节点cs:layout,这个layout节点就是csl规定的,在解释器运行时,对于每篇参考文献,将按照cs:layout中的各个子节点,拼接成一条参考文献的内容。在前文的Word示例中,可以看到,一些小问题,现在分别进行修改。
9.1. 对于作者数量多的英文文章,按照当前的csl,将会在英文条目中产生“等”这个中文,这可能已经让许多人疯狂了。我现在重复一下某个珠玉修改的操作:在cs:bibliography中插入一个新的节点cs:layout放在第一个节点,这个节点与现有csl中的cs:layout几乎完全一样,只是在第一行的属性中标注其语言为英文。也就是这个节点的第一行应该是这样的<layout suffix="." locale="en">
。我对此的理解是,整个csl文件的最开头规定了默认语言是中文,当一篇论文的语言信息是英语时,解释器将在生成该文献的bibliography时,使用这个英文的cs:layout规定的规则,并且在使用cs:layout时,也将遵循英文规律。将修改后的csl文件保存,再双击以添加进Zotero样式,并应用于我们的论文,则可以发现英文文献中的“等”被改为“et al”了。(在添加进Zotero样式的时候,Zotero可能会弹出一个警告,可能是我们的csl文件不完全符合解释器的规则,我们可以选OK,确定我们的选择,生成的样式是可用的(当然,即使我说了没事也一定真没事,注意相关文件的保存))。对了,如果从Zotero样式库里删除某个样式,其对应的csl文件是直接会被销毁的,所以记得将csl文件也备份一下。
9.2. 第二个小问题是,中文书籍的版本显示不正常。在英文中,书的版本会显示“Third Edition”这样的结果。而本csl文件以及中文的locale文件中,将版本应用于中文时,只是粗暴地将"edition"这个词换成了“版”,结果就使得最终效果如上图最后一篇参考文献所示。为此我们需要在版本的号码“二”之前也加一个前缀。即,将cs:bibliography中的第二个cs:layout中的相关位置修改,给它添加一个前缀“第”。
<text macro="edition" prefix="第" suffix=". "/>
于是,论文中呈现的样子就更好一些了。
然而,这个“版”字前面居然有个空格!
9.3. 仔细查看,上面说的这个空格,其实是我们的csl模板中。有一个宏定义了“edition”这个变量,而其中包含了一个group,group中的两个信息是用空格隔开的。实际上,在csl中,本身就有一个变量叫“edition”的,使用这个变量即可,并不需要自己重新创建一个宏。我们把这个"edition"宏删掉,把cs:layout中的macro换成variable。<text variable="edition" prefix="第" suffix="版. "/>
。于是貌似好起来了。
最终生成的文件内容。应该是可以直接使用的。
<?xml version="1.0" encoding="utf-8"?> <style xmlns="http://purl.org/net/xbiblio/csl" version="1.0" class="in-text" default-locale="zh-CN" delimiter-precedes-last="always" demote-non-dropping-particle="never" initialize-with=" " name-delimiter=", " names-delimiter=". " name-as-sort-order="all" sort-separator=" "> <info> <title>test</title> <title-short>GB/T 7714-2015</title-short> <id>test</id> <link href="http://www.zotero.org/styles/china-national-standard-gb-t-7714-2015-numeric" rel="self"/> <link href="http://www.std.gov.cn/gb/search/gbDetailed?id=71F772D8055ED3A7E05397BE0A0AB82A" rel="documentation"/> <author> <name>牛耕田</name> <email>buffalo_d@163.com</email> </author> <category citation-format="numeric"/> <category field="generic-base"/> <summary>The Chinese GB/T7714-2015 numeric style</summary> <updated>2021-11-25T18:00:00+08: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="accessed-date"> <date variable="accessed" delimiter="–" prefix="[" suffix="]"> <date-part name="year"/> <date-part name="month" form="numeric-leading-zeros"/> <date-part name="day" form="numeric-leading-zeros"/> </date> </macro> <macro name="author"> <choose> <if variable="author"> <names variable="author"> <name> <name-part name="family" text-case="uppercase"/> <name-part name="given"/> </name> </names> </if> <else> <text term="anonymous"/> </else> </choose> </macro> <macro name="container-author"> <names variable="container-author"> <name> <name-part name="family" text-case="uppercase"/> <name-part name="given"/> </name> </names> </macro> <macro name="editor"> <names variable="editor translator"> <name> <name-part name="family" text-case="uppercase"/> <name-part name="given"/> </name> <label form="short" prefix=", "/> </names> </macro> <macro name="issued-date"> <choose> <if variable="issued"> <date variable="issued" delimiter="–"> <date-part name="year"/> <date-part name="month" form="numeric-leading-zeros"/> <date-part name="day" form="numeric-leading-zeros"/> </date> </if> <else> <text term="no date" prefix="[" suffix="]"/> </else> </choose> </macro> <macro name="issue-date-year"> <choose> <if variable="issued"> <date variable="issued" date-parts="year" form="numeric"/> </if> <else> <text term="no date" prefix="[" suffix="]"/> </else> </choose> </macro> <macro name="publishing"> <choose> <if variable="publisher"> <group delimiter=": "> <text variable="publisher-place"/> <group delimiter=", "> <text variable="publisher"/> <text macro="issue-date-year"/> </group> </group> <text variable="page" prefix=": "/> </if> </choose> </macro> <macro name="serial-information"> <group delimiter=", "> <text macro="issue-date-year"/> <text variable="volume"/> </group> <text variable="issue" prefix="(" suffix=")"/> <text variable="page" prefix=": "/> </macro> <macro name="type-code"> <choose> <if type="article-journal article-magazine" match="any"> <text value="J"/> </if> <else-if type="article-newspaper"> <text value="N"/> </else-if> <else-if type="bill legislation" match="any"> <text value="S"/> </else-if> <else-if type="book"> <text value="M"/> </else-if> <else-if type="chapter"> <text value="M"/> </else-if> <else-if type="dataset"> <text value="DS"/> </else-if> <else-if type="paper-conference"> <text value="C"/> </else-if> <else-if type="patent"> <text value="P"/> </else-if> <else-if type="post-weblog webpage" match="any"> <text value="EB"/> </else-if> <else-if type="report"> <text value="R"/> </else-if> <else-if type="thesis"> <text value="D"/> </else-if> <else> <text value="Z"/> </else> </choose> </macro> <macro name="title"> <text variable="title" text-case="title"/> <choose> <if type="bill broadcast legal_case legislation patent report song" match="any"> <text variable="number" prefix=": "/> </if> </choose> <group delimiter="/" prefix="[" suffix="]"> <text macro="type-code"/> <choose> <if variable="URL"> <text value="OL"/> </if> </choose> </group> </macro> <citation collapse="citation-number" after-collapse-delimiter=","> <sort> <key variable="citation-number" sort="ascending"/> </sort> <layout vertical-align="sup" delimiter="," prefix="[" suffix="]"> <text variable="citation-number"/> <group prefix="(" suffix=")"> <label variable="locator" suffix=". " form="short" strip-periods="true"/> <text variable="locator"/> </group> </layout> </citation> <bibliography entry-spacing="0" et-al-min="4" et-al-use-first="3" line-spacing="1" second-field-align="flush"> <layout suffix="." locale="en"> <text variable="citation-number" prefix="[" suffix="]"/> <text macro="author" suffix=". "/> <text macro="title"/> <choose> <if type="book bill chapter legislation paper-conference report thesis" match="any"> <text macro="editor" prefix=". "/> <choose> <if variable="container-title"> <text value="//"/> <text macro="container-author" suffix=". "/> <text variable="container-title" suffix=". " text-case="title"/> </if> <else> <text value=". "/> </else> </choose> <text variable="edition" suffix=". "/> <text macro="publishing"/> </if> <else-if type="article-journal article-magazine article-newspaper" match="any"> <group prefix=". "> <choose> <if variable="container-title"> <text variable="container-title" text-case="title"/> <text macro="serial-information" prefix=", "/> </if> <else> <text macro="serial-information" suffix=". "/> <text macro="publishing"/> </else> </choose> </group> </else-if> <else-if type="patent"> <text macro="issued-date" prefix=". "/> </else-if> <else> <text macro="publishing" prefix=". "/> <text macro="issued-date" prefix="(" suffix=")"/> </else> </choose> <text macro="accessed-date"/> <group delimiter=". " prefix=". "> <text variable="URL"/> <text variable="DOI" prefix="DOI:"/> </group> </layout> <layout suffix="."> <text variable="citation-number" prefix="[" suffix="]"/> <text macro="author" suffix=". "/> <text macro="title"/> <choose> <if type="book bill chapter legislation paper-conference report thesis" match="any"> <text macro="editor" prefix=". "/> <choose> <if variable="container-title"> <text value="//"/> <text macro="container-author" suffix=". "/> <text variable="container-title" suffix=". " text-case="title"/> </if> <else> <text value=". "/> </else> </choose> <text variable="edition" prefix="第" suffix="版. "/> <text macro="publishing"/> </if> <else-if type="article-journal article-magazine article-newspaper" match="any"> <group prefix=". "> <choose> <if variable="container-title"> <text variable="container-title" text-case="title"/> <text macro="serial-information" prefix=", "/> </if> <else> <text macro="serial-information" suffix=". "/> <text macro="publishing"/> </else> </choose> </group> </else-if> <else-if type="patent"> <text macro="issued-date" prefix=". "/> </else-if> <else> <text macro="publishing" prefix=". "/> <text macro="issued-date" prefix="(" suffix=")"/> </else> </choose> <text macro="accessed-date"/> <group delimiter=". " prefix=". "> <text variable="URL"/> <text variable="DOI" prefix="DOI:"/> </group> </layout> </bibliography> </style>
回顾一下,上面其实是一点简单的操作,但是可能困扰过不少人,列出来希望对大家有帮助。如果能让你对csl不那么发怵,并能自行修改生成所需的样式,那就更好了。
整理了一两个地址,算是本文的参考文献,也可以供大家学习。(在介绍参考文献的文章里,我还不会写参考文献。。。)
另外还有一个是我之前直接下载的,来源我忘记了。在最后的bibliography节点中要更加简洁一些。
<?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="zh-CN"> <info> <title>ttt</title> <id>http://www.zotero.org/styles/ttt</id> <author> <name>heromyth</name> <email>zxpmyth@yahoo.com.cn</email> </author> <category citation-format="numeric"/> <category field="engineering"/> <category field="generic-base"/> <category field="science"/> <summary>This style just partly implemented what the Chinese GB/T 7714-2005 requires.</summary> <updated>2021-02-15T03:41:57+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"> <names variable="author"> <name delimiter-precedes-last="always" et-al-min="4" et-al-use-first="3" initialize-with="" name-as-sort-order="all" sort-separator=" "> <name-part name="given" text-case="uppercase" font-variant="normal"/> </name> </names> </macro> <macro name="recipient"> <names variable="recipient"> <name name-as-sort-order="all" sort-separator=" " delimiter=", " delimiter-precedes-last="always"/> <label form="short" prefix=", " text-case="lowercase"/> </names> </macro> <macro name="interviewer"> <names variable="interviewer"> <name name-as-sort-order="all" sort-separator=" " delimiter=", " delimiter-precedes-last="always"/> <label form="short" prefix=", " text-case="lowercase"/> </names> </macro> <macro name="composer"> <names variable="composer"> <name name-as-sort-order="all" sort-separator=" " delimiter=", " delimiter-precedes-last="always"/> <label form="short" prefix=", " text-case="lowercase"/> </names> </macro> <macro name="original-author"> <names variable="original-author"> <name name-as-sort-order="all" sort-separator=" " delimiter=", " delimiter-precedes-last="always"/> <label form="short" prefix=", " text-case="lowercase"/> </names> </macro> <macro name="title"> <text variable="title"/> </macro> <macro name="titleField"> <choose> <if type="report"> <text macro="title" suffix="[R]. "/> </if> <else-if type="thesis"> <text macro="title" suffix="[D]. "/> </else-if> <else-if type="bill legislation" match="any"> <text variable="number" suffix=", "/> <text macro="title" suffix="[S]"/> </else-if> <else-if type="bill book graphic legal_case legislation motion_picture report song" match="any"> <text macro="title" suffix="[M]. "/> </else-if> <else-if type="paper-conference"> <text macro="title" suffix="[C]. "/> </else-if> <else-if type="chapter paper-conference" match="any"> <text macro="title" suffix="[G]."/> </else-if> <else-if type="webpage"> <text macro="title" suffix="[EB/OL]. "/> </else-if> <else-if type="patent"> <text macro="title"/> <text variable="number" prefix=": 中国, " suffix="[P]. "/> </else-if> <else> <text macro="title" suffix="[J]. "/> </else> </choose> </macro> <macro name="secondaryAuthor"> <names variable="editor"> <name initialize-with=" " name-as-sort-order="all" sort-separator=" " delimiter=", " delimiter-precedes-last="always"> <name-part name="family" text-case="uppercase"/> </name> </names> <names variable="translator"> <name name-as-sort-order="all" sort-separator=" " delimiter=", " delimiter-precedes-last="always" suffix=", 译"/> </names> </macro> <macro name="publisher"> <choose> <if type="chapter paper-conference" match="any"> <text variable="container-title" suffix=". "/> </if> <else-if type="report"> <text variable="collection-title" suffix=", "/> <text variable="number" suffix=", "/> </else-if> <else-if type="bill legislation" match="any"> <text variable="container-title" prefix=". "/> </else-if> <else> <text variable="container-title" suffix=", "/> </else> </choose> <!-- <text variable="event" suffix="event "/> <text variable="event-place" suffix="event-place "/> <text variable="original-title" suffix="original-title"/> --> <text variable="publisher-place" suffix=": "/> <group delimiter=", "> <text variable="publisher"/> <choose> <if type="webpage" variable="container-title" match="all"> <date variable="issued" suffix=". "> <date-part name="year"/> <date-part name="month" form="numeric-leading-zeros" prefix="-"/> <date-part name="day" form="numeric-leading-zeros" prefix="-"/> </date> </if> <else-if type="webpage"/> <else-if type="patent"> <date variable="issued"> <date-part name="year"/> <date-part name="month" form="numeric-leading-zeros" prefix="-"/> <date-part name="day" form="numeric-leading-zeros" prefix="-"/> </date> </else-if> <else-if variable="publisher"> <date variable="issued"> <date-part name="year"/> </date> </else-if> <else-if type="bill legislation" match="any"/> <else> <date variable="issued"> <date-part name="year"/> </date> </else> </choose> </group> <text variable="volume" prefix=", "/> <text variable="issue" prefix="(" suffix=")"/> </macro> <macro name="pageField"> <text variable="page"/> </macro> <macro name="referenceDate"> <choose> <if type="webpage"> <date variable="issued" prefix="(" suffix=")"> <date-part name="year"/> <date-part name="month" form="numeric-leading-zeros" prefix="-"/> <date-part name="day" form="numeric-leading-zeros" prefix="-"/> </date> <date variable="accessed" prefix="[" suffix="]"> <date-part name="year"/> <date-part name="month" form="numeric-leading-zeros" prefix="-"/> <date-part name="day" form="numeric-leading-zeros" prefix="-"/> </date> </if> </choose> </macro> <macro name="access"> <choose> <if variable="DOI"> <text variable="DOI" prefix="doi:"/> </if> <else-if variable="URL"> <text variable="URL"/> </else-if> </choose> </macro> <citation collapse="citation-number"> <sort> <key variable="citation-number" sort="ascending"/> </sort> <layout vertical-align="sup" prefix="[" suffix="]" delimiter=","> <text variable="citation-number"/> </layout> </citation> <bibliography et-al-min="4" et-al-use-first="3" second-field-align="flush" entry-spacing="0"> <layout suffix="." locale="en"> <text variable="citation-number" prefix="[" suffix="]"/> <text macro="author" suffix=". "/> <text macro="titleField"/> <text macro="secondaryAuthor" suffix=". "/> <text variable="edition" suffix=". "/> <text macro="publisher"/> <text macro="pageField" prefix=": "/> <text macro="referenceDate"/> <choose> <if type="webpage" match="any"> <text macro="access" prefix=". "/> </if> </choose> <text macro="recipient"/> <text macro="interviewer"/> <text macro="composer"/> <text macro="original-author"/> </layout> <layout suffix="."> <text variable="citation-number" prefix="[" suffix="]"/> <text macro="author" suffix=". "/> <text macro="titleField"/> <text macro="secondaryAuthor" suffix=". "/> <text variable="edition" prefix="第" suffix="版. "/> <text macro="publisher"/> <text macro="pageField" prefix=": "/> <text macro="referenceDate"/> <choose> <if type="webpage" match="any"> <text macro="access" prefix=". "/> </if> </choose> <text macro="recipient"/> <text macro="interviewer"/> <text macro="composer"/> <text macro="original-author"/> </layout> </bibliography> </style>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。