texlive[57468] Master/texmf-dist: biblatex-gb7714-2015 (19jan21)
commits+karl at tug.org
commits+karl at tug.org
Tue Jan 19 23:57:40 CET 2021
Revision: 57468
http://tug.org/svn/texlive?view=revision&revision=57468
Author: karl
Date: 2021-01-19 23:57:40 +0100 (Tue, 19 Jan 2021)
Log Message:
-----------
biblatex-gb7714-2015 (19jan21)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/README.md
trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf
trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015.tex
trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/example.bib
trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/chinese-erj.bbx
trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/chinese-erj.cbx
trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.bbx
trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.cbx
trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx
trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.cbx
trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.bbx
trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.cbx
trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015mx.bbx
trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015mx.cbx
Removed Paths:
-------------
trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map-test.bib
trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map.py
trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex_check.py
trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gb7714texteg.dat
trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gb7714texttobib.pl
trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015.tex
trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015eg.tex
trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015fmt.tex
trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015lan.tex
trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015ms.tex
trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015thesis.tex
trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/readme-BibLatex-Check.md
trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/readme-BibLatex-map.md
Modified: trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/README.md 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/README.md 2021-01-19 22:57:40 UTC (rev 57468)
@@ -1,4 +1,4 @@
-<b>Date of last change: 2020-07-21 to version v1.0v</b>
+<b>Date of last change: 2021-01-19 to version v1.0w</b>
# biblatex-gb7714-2015: a biblatex style package
@@ -62,6 +62,18 @@
* [Study-LaTeX(LaTeX学习笔记)](https://github.com/Zousiyu/Study-LaTeX)
* [ElegantBook](https://github.com/ElegantLaTeX/ElegantBook)
* [《经济研究》杂志 LaTeX 论文模板)](https://github.com/EthanDeng/Chinese-ERJ)
+* [WUTthesis(武汉理工大学研究生学位论文的 LaTeX 模板)](https://github.com/Jiayin-Gu/WUTthesis)
+* [shtthesis (ShangHaiTech university THESIS)](https://github.com/lirundong/shtthesis)
+* [LaTeX-SWUFE-Bachelor-Thesis (西南财经大学本科毕业论文 LaTeX 模板)](https://github.com/sukanka/LaTeX-SWUFE-Bachelor-Thesis)
+* [NJU-thesis-esz(南京大学学位论文-微调整后适用于人文社科)](https://github.com/EdwardSaidZhou/NJU-thesis-esz)
+* [NKThesis(南开大学硕士毕业论文(博士论文)Latex模板)](https://github.com/procuteboy/NKThesis)
+* [NKUBachelorThesis(南开大学本科生毕业论文(毕业设计)LaTeX模板)](https://github.com/NKcqx/NKUBachelorThesis)
+* [BIThesis(bachelor graduation thesis for Dept. of Undergraduate Academic Affairs of Beijing Institute of Technology.)](https://github.com/BITNP/BIThesis)
+* [nputhesis(NPU 博士、硕士学位论文 \LaTeX 模板)](https://github.com/NPUSCG/nputhesis)
+* [sustechthesis(Southern University of Science and Technology Thesis Template LaTeX Template)](https://github.com/Iydon/sustechthesis)
+* [SHMTUThesis(上海海事大学 LaTeX 学位论文模板)](https://github.com/hellckt/SHMTUThesis)
+* [LZUthesis(兰州大学本科毕业论文LaTeX模板)](https://github.com/szsdk/LZUthesis)
+* [nuaa-thesis(南京航空航天大学本科、硕士和博士学位论文的样式模板)](https://github.com/nuaa803/nuaa-thesis)
* [...]
@@ -1170,6 +1182,7 @@
* 2020/03/04 v1.0t,ctan
* 2020/03/30 v1.0u
* 2020/07/21 v1.0v,ctan
+* 2021/01/19 v1.0w,ctan
Modified: trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015.tex 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015.tex 2021-01-19 22:57:40 UTC (rev 57468)
@@ -93,7 +93,8 @@
姓名格式调整(gbnamefmt选项,可以设置大写、小写、西语习惯用法、拼音习惯用法)、
出版项控制(gbpub选项,可设置出版项缺失时是否填补信息)、类型和载体标识控制(gbtype选项,可设置不输出)、
析出文献标识符控制(gbpunctin选项,可设置\texttt{//}不输出或其它表示形式)、
-标题超链接控制(gbtitlelink选项,可设置标题超链接)、
+标题超链接控制(gbtitlelink选项,可设置文献表中各条目标题超链接)、
+标准标签超链接控制(gblabelref选项,可设置标注中作者标签的超链接)、
作者项处理(gbnoauthor选项,可设置作者缺失时是否填补信息);
著录表格式选项和命令:
@@ -643,6 +644,20 @@
\caption{文献标题超链接控制选项}\label{fig:eg:optgbtitlelink}
\end{figure}
+
+ \pdfbookmark[4]{gblabelref}{gblabelref}
+ \item[gblabelref]=\textbf{true},false. \hfill default is true
+
+ 为作者年制设置标注中的作者标签的超链接增加的选项。
+ \begin{itemize}
+ \item gblabelref=true,即默认给作者标签加上超链接。
+ \item gblabelref=false,不给作者标签加上超链接。
+ \end{itemize}
+ 测试文件见:
+ \href{run:egphoto/opt-gblabelref-true.tex}{opt-gblabelref-true.tex}。
+
+
+
\pdfbookmark[4]{gblocal}{gblocal}
\item[gblocal]=\textbf{gb7714-2015},chinese,english. \hfill default is gb7714-2015
\item[gbcitelocal]=\textbf{gb7714-2015},chinese,english. \hfill default is gb7714-2015
@@ -2347,7 +2362,7 @@
\end{example}
其中连续出版物的出版者用institution表示。
-\qd{因为连续出版物可能用到两个日期,两个卷,两个期,所以录入数据时需要特别处理。不需要录入endyear等信息,只需要在到year或date域录入两个日期,由biber自动解析,两个日期之间用/分隔。而卷和期由于可能有合订模式,且合订卷期之间用/分隔(参考GB/T 7714-2015第8.8.3节),因此如果需要解析有起止范围的卷和期,录入到volume和number域的信息中起止值之间应用-分隔。}
+\qd{因为连续出版物可能用到两个日期,两个卷,两个期,所以录入数据时需要特别处理。不需要录入endyear等信息,只需要在到year或date域录入两个日期,由biber自动解析,由于一个日期内部的年月日之间是用-进行分隔,因此两个日期之间用/分隔。而卷和期由于可能有合订模式,且合订卷期之间用/分隔(参考GB/T 7714-2015第8.8.3节),因此如果需要解析有起止范围的卷和期,录入到volume和number域的信息中起止值之间应用-分隔。}
\subsubsection{连续出版物的析出文献/article}
\begin{refentry}{}{}%[break at=0.5cm/0pt]
Deleted: trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map-test.bib
===================================================================
--- trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map-test.bib 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map-test.bib 2021-01-19 22:57:40 UTC (rev 57468)
@@ -1,114 +0,0 @@
-
- at NEWSPAPER{CITATION_NEWSPAPER,
- author = "吴刚",
- title = "立陶宛进入欧元时代",
- journaltitle = "人民日报",
- date = "2015-1-2",
- language = "chs",
- note = ""
-}
-
- at BOOK{SANGUOYANYI,
- author = "罗贯中",
- title = "三国演义",
- edition = "1",
- address = "山西太原",
- year = "元末明初",
- language = "chs"
-}
-
- at ELECTRONIC{BUPT_Thesis_Format_2004,
- title = "关于研究生学位论文格式的统一要求",
- author = "北京邮电大学研究生院培养与学位办公室",
- etype = "EB",
- ehowpublished = "OL",
- date = "2004",
- url = "http://www.bupt.edu.cn/",
- language = "chs"
-}
-
- at ELECTRONIC{latex-bupt,
- author = "王旭",
- title = "latex-bupt: \LaTeX style for {BUPT} thesis",
- year = "2007",
- etype = "EB",
- ehowpublished = "OL",
- refdate = "2009-01-14",
- url = "http://code.google.com/p/latex-bupt/",
- language = "chs"
-}
-
- at ELECTRONIC{buptthesis,
- author = "张煜",
- title = "北京邮电大学研究生学位论文 \LaTeX{} 文档类",
- year = "2009",
- dhowpublished = "online",
- urldate = "2013-7-6",
- source = "http://code.google.com/p/buptthesis/",
- language = "chs"
-}
-
- at BOOK{Miroslav2003--,
- AUTHOR = {Miroslav, D. L. and Dejan, V. T.},
- TRANSLATOR = {朱义胜 and 董辉},
- LANGUAGE = {chinese},
- LOCATION = {北京},
- PUBLISHER = {电子工业出版社},
- DATE = {2003-01},
- TITLE = {信号处理滤波器设计方法},
-}
-
- at ARTICLE{于潇2011-15-23,
- AUTHOR = {于潇 and 刘义 and 柴跃廷 and others},
- DATE = {2011},
- JOURNALTITLE = {清华大学学报},
- NUMBER = {11},
- PAGES = {15--23},
- TITLE = {互联网药品可信交易环境中主体资质审核备案模式},
- VOLUME = {52},
-}
-
- at INBOOK{姚中秋2008--,
- AUTHOR = {姚, 中秋},
- BOOKAUTHOR = {罗, 卫东 and 姚, 中秋},
- LOCATION = {杭州},
- PUBLISHER = {浙江大学出版社},
- BOOKTITLE = {中国转型的理论分析},
- DATE = {2008},
- PAGES = {44},
- TITLE = {一种制度变迁模式},
-}
-
- at Newspaper{张田勤2000--,
- Title = {犯罪DNA库与生命伦理学计划},
- Author = {张田勤},
- year = {{2000-11-12}},
- Journaltitle = {大众科技报},
- Note = {news},
- Number = {7}
-}
-
- at Www{萧钰2001--,
- Title = {出版业信息化迈入快车道},
- Author = {萧钰},
- Url = {http://www.creader.com/news/20011219/200112190019.html},
- Urldate = {2002-04-15},
- Date = {2001-12-19}
-}
- at Patent{刘加林1993--,
- Title = {多功能一次性压舌板},
- Author = {刘加林},
- year = {{1993-04-14}},
- Number = {92214985.2},
- Location = {中国发明专利}
-}
-
- at PhdThesis{张若凌2004--,
- Title = {高超声速非平衡流动的计算和实验研究},
- Author = {张若凌},
- School = {中国空气动力研究与发展中心},
- Year = {2004},
- Location = {绵阳}
-}
-
-
Deleted: trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map.py
===================================================================
--- trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map.py 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map.py 2021-01-19 22:57:40 UTC (rev 57468)
@@ -1,2059 +0,0 @@
-#!/usr/bin/env python
-
-"""
-A python script to modify bib data and
-to display references with specific bibliography standard
-
-two key features:
-
-两大核心功能
-1. bib文件抽取,bib文件内容的自定义修改
-2. 格式化文献表输出,包括json,bib,text,html,bbl文件,其中bbl文件可以在tex源代码中直接使用,利用natbib宏包可以实现不同的标注样式。
-
-
-"""
-
-__author__ = "Hu zhenzhen"
-__version__ = "1.0"
-__license__ = "MIT"
-__email__ = "hzzmail at 163.com"
-
-import string
-import re
-import sys
-import datetime
-import copy
-import json
-import operator
-
-
-
-#
-# 为数据map设置参数
-# 选项的逻辑与biblatex基本一致,
-# 差别包括:overwrite选项可以放到step步中表示
-#[]=maps
-#[[],[]]=map in maps
-#[[[]],[]]=step in map in mpas
-#[[[{optionkey: }]],[]]=step in map in mpas
-#注意python正则表达方式与perl的略有不同,比如unicode表示
-#python用\xHH,\uHHHH,\UHHHHHHHH表示,而perl直接用\x{HHHH}表示。
-sourcemaps=[#maps
- [#map1:将ELECTRONIC类型转换为online类型
- [{"typesource":"ELECTRONIC","typetarget":"online"}]#step1
- ],
- [#map2:将source域转换为url域
- [{"fieldsource":"source","fieldtarget":"url"}]#step1
- ],
- [#map3:将urldate域的信息“yyyy-m-d”转换为“yyyy-mm-dd”,注意正则表达式直接写不用在外面套""
- [{"fieldsource":"urldate","match":r'(\d\d\d\d)\-(\d)\-(\d)',"replace":r'\1-0\2-0\3'}]#step1
- ],
- [#map4:将urldate域的信息“yyyy-m-d”转换为“yyyy-mm-dd”,注意正则表达式直接写不用在外面套""
- [{"fieldsource":"date","match":r'(\d\d\d\d)\-(\d)\-(\d)',"replace":r'\1-0\2-0\3',"overwrite":True}]#step1
- ],
- [#map5:将refdate域转换为urldate域
- [{"fieldsource":"refdate","fieldtarget":"urldate"}]#step1
- ],
- [#map6:对于newspaper类型,设置note为news
- [{"pertype":"newspaper"}],#step1
- [{"fieldset":"note","fieldvalue":"news","overwrite":True}]#step2
- ],
- [#map7:设置edition域等于version
- [{"fieldsource":"version","final":True}],#step1
- [{"fieldset":"edition","origfieldval":True}]#step2
- ],
- [#map8:设置entrykey域设置给keywords
- [{"fieldsource":"entrykey"}],#step1
- [{"fieldset":"keywords","origfieldval":True}]#step2
- ],
- [#map9:对于存在note域的情况,将其值添加到keywords
- [{"fieldsource":"note","final":True}],#step1
- [{"fieldset":"keywords","origfieldval":True,"overwrite":True,"append":True}]#step2
- ],
- [#map10:根据标题的字符编码范围确定标题的语言类型
- [{"fieldsource":"title","match":r'[\u2FF0-\u9FA5]',"final":True}],#step1
- [{"fieldset":"userd","fieldvalue":"chinese"}]#step2
- ],
-]
-
-#重设新的任务处理
-sourcemaps=[
- [#map1:设置entrykey域设置给keywords
- [{"fieldsource":"entrykey"}],#step1
- [{"fieldset":"keywords","origfieldval":True,"overwrite":True}]#step2
- ],
-]
-
-
-#重设新的任务
-sourcemaps=[
- [#map1:取消note域
- [{"fieldsource":"note","final":True}],#step1
- [{"fieldset":"note","null":True,"overwrite":True}]#step2
- ],
- [#map2:取消abstract域
- [{"fieldsource":"abstract","final":True}],#step1
- [{"fieldset":"abstract","null":True,"overwrite":True}]#step2
- ],
- [#map3:取消keywords域
- [{"fieldsource":"keywords","final":True}],#step1
- [{"fieldset":"keywords","null":True,"overwrite":True}]#step2
- ],
- [#map4:取消keywords-plus域
- [{"fieldsource":"keywords-plus","final":True}],#step1
- [{"fieldset":"keywords-plus","null":True,"overwrite":True}]#step2
- ],
- [#map5:取消affiliation域
- [{"fieldsource":"affiliation","final":True}],#step1
- [{"fieldset":"affiliation","null":True,"overwrite":True}]#step2
- ],
- [#map6:取消funding-acknowledgement域
- [{"fieldsource":"funding-acknowledgement","final":True}],#step1
- [{"fieldset":"funding-acknowledgement","null":True,"overwrite":True}]#step2
- ],
- [#map7:取消funding-text域
- [{"fieldsource":"funding-text","final":True}],#step1
- [{"fieldset":"funding-text","null":True,"overwrite":True}]#step2
- ],
- ]
-
-#重设不处理
-sourcemaps=[]
-
-
-##------------------------------------------
-## 参考文献表的制定格式设置,比如GB/T 7714-2015
-##
-
-#全局选项
-formatoptions={
-"style":'authoryear',#写bbl信息的设置选项,authoryear,'numeric'
-"nameformat":'uppercase',#姓名处理选项:uppercase,lowercase,given-family,family-given,pinyin
-"giveninits":'space',#使用名的缩写,space表示名见用空格分隔,dotspace用点加空格,dot用点,terse无分隔,false不使用缩写
-"maxbibnames":3,#
-"minbibnames":3,#
-"morenames":True,#
-"maxbibitems":1,#
-"minbibitems":1,#
-"moreitems":False,#
-"date":'year',#'日期处理选项':year,iso,等
-"urldate":'iso',#'日期处理选项':year,iso,等
-}
-
-#本地化字符串
-localstrings={
-'andothers':{'english':'et al.','chinese':'等'},
-'and':{'english':' and ','chinese':'和'},
-'edition':{'english':'th ed','chinese':'版'},#th ed. 中的点不要,为方便标点处理
-'in':{'english':'in: ','chinese':'见: '},
-'nolocation':{'english':'[S.l.]','chinese':'[出版地不详]'},
-'nopublisher':{'english':'[s.n.]','chinese':'[出版者不详]'},
-'bytranslator':{'english':'trans by','chinese':'译'},
-}
-
-#标点
-localpuncts={
-'multinamedelim':', ',
-'finalnamedelim':', ',
-'andothorsdelim':', ',
-'finalitemdelim':', ',
-'multiitemdelim':', ',
-}
-
-#替换字符串
-replacestrings={
-'[出版地不详]: [出版者不详]':'[出版地不详 : 出版者不详]',
-'[S.l.]: [s.n.]':'[S.l. : s.n.]',
-'..':'.',
-}
-
-#类型和载体字符串
-typestrings={
-'book':'[M]',
-'inbook':'[M]',
-'standard':'[S]',
-'periodical':'[J]',
-'article':'[J]',
-'newspaper':'[N]',
-'patent':'[P]',
-'online':'[EB]',
-'www':'[EB]',
-'electronic':'[EB]',
-'proceedings':'[C]',
-'inproceedings':'[C]',
-'conference':'[C]',
-'collection':'[G]',
-'incollection':'[G]',
-'thesis':'[D]',
-'mastersthsis':'[D]',
-'phdthesis':'[D]',
-'report':'[R]',
-'techreport':'[R]',
-'manual':'[A]',
-'archive/manual':'[A]',
-'database':'[DB]',
-'dataset':'[DS]',
-'software':'[CP]',
-'map':'[CM]',
-'unpublished':'[Z]',
-'misc':'[Z]',
-}
-
-#数据类型
-datatypeinfo={
-'namelist':['author','editor','translator','bookauthor'],
-'literallist':['location','address','publisher','institution','organization','school','language','keywords'],
-'literalfield':['title','journaltitle','journal','booktitle','subtitle','titleaddon','edition','version','url',
- 'volume','number','endvolume','endnumber','type','note','labelnumber'],
-'datefield':['date','year','urldate','enddate','origdate','eventdate'],
-'rangefield':['pages']
-}
-
-#条目的著录格式
-bibliographystyle={
-"book":[
-#{"fieldsource":["labelnumber"],'prestring':"[","posstring":"]","pospunct":" "},
-{"fieldsource":['author','editor','translator'],'options':{'nameformat':'uppercase'}},
-{"fieldsource":['title'],'caseformat':'sentencecase','prepunct':". ",'prepunctifnolastfield':'','posstring':r"\typestring"},
-{"fieldsource":['translator'],'options':{'nameformat':'uppercase'},'prepunct':". ",'posstring':r', \bibstring{bytranslator}'},
-{"fieldsource":['edition'],'numerformat':'arabic','prepunct':". ","posstringifnumber":r'\bibstring{edition}'},
-{"fieldsource":['location','address'],'prepunct':". ",'replstring':r"\bibstring{nolocation}"},
-{"fieldsource":['publisher'],'prepunct':": ",'replstring':r"\bibstring{nopublisher}",'prepunctifnolastfield':'. '},
-{"fieldsource":['date','year'],'prepunct':", "},
-{"fieldsource":['pages'],'prepunct':": "},
-{"fieldsource":['urldate'],'prestring':"[","posstring":"]"},
-{"fieldsource":['url'],'prepunct':". ",'prestring':r'\url{','posstring':'}'},
-{"fieldsource":['doi'],'prepunct':". "},
-{"fieldsource":['endpunct'],'replstring':"."}
-],
-"article":[
-#{"fieldsource":["labelnumber"],'prestring':"[","posstring":"]","pospunct":" "},
-{"fieldsource":['author','editor','translator'],'options':{'nameformat':'uppercase'}},
-{"fieldsource":['title'],'caseformat':'sentencecase','prepunct':". ",'prepunctifnolastfield':'','posstring':r"\typestring"},
-{"fieldsource":['journaltitle','journal'],'prepunct':". "},
-{"fieldsource":['year','date'],'prepunct':", "},
-{"fieldsource":['volume'],'prepunct':", "},
-{"fieldsource":['number'],'prestring':"(",'posstring':")"},
-{"fieldsource":['pages'],'prepunct':": "},
-{"fieldsource":['urldate'],'prestring':"[","posstring":"]"},
-{"fieldsource":['url'],'prepunct':". "},
-{"fieldsource":['doi'],'prepunct':". "},
-{"fieldsource":['endpunct'],'replstring':"."}
-],
-"newspaper":[
-#{"fieldsource":["labelnumber"],'prestring':"[","posstring":"]","pospunct":" "},
-{"fieldsource":['author','editor','translator'],'options':{'nameformat':'uppercase'}},
-{"fieldsource":['title'],'caseformat':'sentencecase','prepunct':". ",'prepunctifnolastfield':'','posstring':r"\typestring"},
-{"fieldsource":['journaltitle','journal'],'prepunct':". "},
-{"fieldsource":['date','year'],'prepunct':", ",'options':{'date':'iso'}},
-{"fieldsource":['number'],'prestring':"(",'posstring':")"},
-{"fieldsource":['pages'],'prepunct':": "},
-{"fieldsource":['urldate'],'prestring':"[","posstring":"]"},
-{"fieldsource":['url'],'prepunct':". "},
-{"fieldsource":['doi'],'prepunct':". "},
-{"fieldsource":['endpunct'],'replstring':"."}
-],
-"inbook":[
-#{"fieldsource":["labelnumber"],'prestring':"[","posstring":"]","pospunct":" "},
-{"fieldsource":['author','translator'],'options':{'nameformat':'uppercase'}},
-{"fieldsource":['title'],'caseformat':'sentencecase','prepunct':". ",'prepunctifnolastfield':'','posstring':r"\typestring"},
-{"fieldsource":['in'],'replstring':"//",'omitifnofield':['bookauthor','editor','booktitle']},
-{"fieldsource":['bookauthor','editor'],'options':{'nameformat':'uppercase'}},
-{"fieldsource":['booktitle'],'caseformat':'sentencecase','prepunct':". ",'prepunctifnolastfield':''},
-{"fieldsource":['edition'],'numerformat':'arabic','prepunct':". ","posstring":r'\bibstring{edition}'},
-{"fieldsource":['location','address'],'prepunct':". ",'replstring':r"\bibstring{nolocation}"},
-{"fieldsource":['publisher'],'prepunct':": ",'replstring':r"\bibstring{nopublisher}",'prepunctifnolastfield':'. '},
-{"fieldsource":['date','year'],'prepunct':", "},
-{"fieldsource":['pages'],'prepunct':": "},
-{"fieldsource":['urldate'],'prestring':"[","posstring":"]"},
-{"fieldsource":['url'],'prepunct':". "},
-{"fieldsource":['doi'],'prepunct':". "},
-{"fieldsource":['endpunct'],'replstring':"."}
-],
-"inproceedings":"inbook",
-"incollection":"inbook",
-"standard":"inbook",
-"proceedings":"book",
-"collection":"book",
-"patent":[
-#{"fieldsource":["labelnumber"],'prestring':"[","posstring":"]","pospunct":" "},
-{"fieldsource":['author'],'options':{'nameformat':'uppercase'}},
-{"fieldsource":['title'],'caseformat':'sentencecase','prepunct':". ",'prepunctifnolastfield':'','posstring':r"\typestring"},
-{"fieldsource":['number'],'prepunct':": "},
-{"fieldsource":['date','year'],'prepunct':", "},
-{"fieldsource":['urldate'],'prestring':"[","posstring":"]"},
-{"fieldsource":['url'],'prepunct':". "},
-{"fieldsource":['doi'],'prepunct':". "},
-{"fieldsource":['endpunct'],'replstring':"."}
-],
-"online":[
-#{"fieldsource":["labelnumber"],'prestring':"[","posstring":"]","pospunct":" "},
-{"fieldsource":['author','editor','translator'],'options':{'nameformat':'uppercase'}},
-{"fieldsource":['title'],'caseformat':'sentencecase','prepunct':". ",'prepunctifnolastfield':'','posstring':r"\typestring"},
-{"fieldsource":['organization','instiution'],'prepunct':". "},
-{"fieldsource":['date','year'],'prepunct':", ",'prepunctifnolastfield':'. ','omitifnofield':['enddate','eventdate']},
-{"fieldsource":['pages'],'prepunct':": "},
-{"fieldsource":['date','enddate','eventdate'],'prepunct':". ",'options':{"date":"iso",'eventdate':'iso'},'prestring':"(","posstring":")"},
-{"fieldsource":['urldate'],'prestring':"[","posstring":"]",'prepunctifnolastfield':'. '},
-{"fieldsource":['url'],'prepunct':". ",'prepunctifnolastfield':''},
-{"fieldsource":['doi'],'prepunct':". "},
-{"fieldsource":['endpunct'],'replstring':"."}
-],
-"www":"online",
-"electronic":"online",
-"report":[
-#{"fieldsource":["labelnumber"],'prestring':"[","posstring":"]","pospunct":" "},
-{"fieldsource":['author','editor','translator'],'options':{'nameformat':'uppercase'}},
-{"fieldsource":['title'],'caseformat':'sentencecase','prepunct':". ",'prepunctifnolastfield':'','posstring':r"\typestring"},
-{"fieldsource":['translator'],'options':{'nameformat':'uppercase'},'prepunct':". "},
-{"fieldsource":['type'],'prepunct':". "},
-{"fieldsource":['number'],'prepunct':"",'prepunctifnolastfield':'. '},
-{"fieldsource":['version'],'prepunct':". "},
-{"fieldsource":['location','address'],'prepunct':". ",'replstring':r"\bibstring{nolocation}"},
-{"fieldsource":['institution','publisher'],'prepunct':": ",'replstring':r"\bibstring{nopublisher}",'prepunctifnolastfield':'. '},
-{"fieldsource":['date','year'],'prepunct':", ",'omitifnofield':['location','address','institution','publisher'],'omitiffield':['url']},
-{"fieldsource":['date','year'],'prepunct':". ",'prestring':'(','posstring':')','omitiffield':['location','address','institution','publisher']},
-{"fieldsource":['pages'],'prepunct':": "},
-{"fieldsource":['urldate'],'prestring':"[","posstring":"]"},
-{"fieldsource":['url'],'prepunct':". "},
-{"fieldsource":['doi'],'prepunct':". "},
-{"fieldsource":['endpunct'],'replstring':"."}
-],
-"techreport":"report",
-"periodical":[
-#{"fieldsource":["labelnumber"],'prestring':"[","posstring":"]","pospunct":" "},
-{"fieldsource":['editor','author'],'options':{'nameformat':'uppercase'}},
-{"fieldsource":['title'],'caseformat':'sentencecase','prepunct':". ",'prepunctifnolastfield':'','posstring':r"\typestring"},
-{"fieldsource":['year','date'],'prepunct':", "},
-{"fieldsource":['volume'],'prepunct':", "},
-{"fieldsource":['number'],'prestring':"(",'posstring':")-"},
-{"fieldsource":['endyear','enddate'],'prepunct':", "},
-{"fieldsource":['endvolume'],'prepunct':", "},
-{"fieldsource":['endnumber'],'prestring':"(",'posstring':")"},
-{"fieldsource":['location','address'],'prepunct':". ",'replstring':r"\bibstring{nolocation}"},
-{"fieldsource":['institution','publisher'],'prepunct':": ",'replstring':r"\bibstring{nopublisher}",'prepunctifnolastfield':'. '},
-{"fieldsource":['year','date'],'prepunct':", ",'posstring':'-'},
-{"fieldsource":['pages'],'prepunct':": "},
-{"fieldsource":['urldate'],'prestring':"[","posstring":"]"},
-{"fieldsource":['url'],'prepunct':". "},
-{"fieldsource":['doi'],'prepunct':". "},
-{"fieldsource":['endpunct'],'replstring':"."}
-],
-#omitifnofield:必须所有的域都不存在才为true
-#omitiffield:只要存在一个域就为true
-"thesis":[
-#{"fieldsource":["labelnumber"],'prestring':"[","posstring":"]","pospunct":" "},
-{"fieldsource":['author','editor','translator'],'options':{'nameformat':'uppercase'}},
-{"fieldsource":['title'],'caseformat':'sentencecase','prepunct':". ",'prepunctifnolastfield':'','posstring':r"\typestring"},
-{"fieldsource":['translator'],'options':{'nameformat':'uppercase'},'prepunct':". "},
-{"fieldsource":['location','address'],'prepunct':". "},
-{"fieldsource":['institution','publisher','school'],'prepunct':": ",'prepunctifnolastfield':'. '},
-{"fieldsource":['date','year'],'prepunct':", ",'omitifnofield':['location','address','institution','publisher'],'omitiffield':['url']},
-{"fieldsource":['date','year'],'prepunct':". ",'prestring':'(','posstring':')','omitiffield':['location','address','institution','publisher']},
-{"fieldsource":['pages'],'prepunct':": "},
-{"fieldsource":['urldate'],'prestring':"[","posstring":"]"},
-{"fieldsource":['url'],'prepunct':". ",'prestring':r'\url{','posstring':'}'},
-{"fieldsource":['doi'],'prepunct':". "},
-{"fieldsource":['endpunct'],'replstring':"."}
-],
-"manual":"thesis",
-"unpublished":"thesis",
-"database":"thesis",
-"dataset":"thesis",
-"software":"thesis",
-"map":"thesis",
-"archive":"thesis",
-"misc":[
-#{"fieldsource":["labelnumber"],'prestring':"[","posstring":"]","pospunct":" "},
-{"fieldsource":['author','editor','translator'],'options':{'nameformat':'uppercase'}},
-{"fieldsource":['title'],'caseformat':'sentencecase','prepunct':". ",'prepunctifnolastfield':'','posstring':r"\typestring"},
-{"fieldsource":['howpublished'],'prepunct':". "},
-{"fieldsource":['location','address'],'prepunct':". "},
-{"fieldsource":['institution','publisher'],'prepunct':": ",'prepunctifnolastfield':'. '},
-{"fieldsource":['date','year'],'prepunct':", "},
-{"fieldsource":['pages'],'prepunct':": "},
-{"fieldsource":['urldate'],'prestring':"[","posstring":"]"},
-{"fieldsource":['url'],'prepunct':". "},
-{"fieldsource":['doi'],'prepunct':". "},
-{"fieldsource":['endpunct'],'replstring':"."}
-],
-"phdthesis":"thesis",
-"mastersthesis":"thesis",
-}
-
-
-#
-#
-#打印格式化后的全部文献条目文本
-def printbibliography():
-
- bibliographyentries=bibliographytext.split('\n')
-
- #md文件输出,直接用write写
- mdoutfile="newformatted"+inputbibfile.replace('.bib','.md')
- fout = open(mdoutfile, 'w', encoding="utf8")
- print("INFO: writing cited references to '" + mdoutfile + "'")
-
- biblabelnumber=0
- for prtbibentry in bibliographyentries:
- if len(prtbibentry)>0:
- biblabelnumber=biblabelnumber+1
- fout.write('['+str(biblabelnumber)+'] '+prtbibentry+'\n')
- fout.close()
-
- #html文件输出,直接用write写
- mdoutfile="newformatted"+inputbibfile.replace('.bib','.html')
- fout = open(mdoutfile, 'w', encoding="utf8")
- print("INFO: writing cited references to '" + mdoutfile + "'")
- fout.write('<html><head><title>references</title></head>')
- fout.write('<body bgcolor="lightgray"><div align="top"><center>')
- fout.write('<font color="blue">')
- fout.write('<table border="0" cellPadding="10" cellSpacing="5" height="400" width="70%">')
- fout.write('<tr><td height="1" width="566" align="center" colspan="1" bgcolor="teal"></td></tr>')
-
- biblabelnumber=0
- for prtbibentry in bibliographyentries:
- if len(prtbibentry)>0:
- biblabelnumber=biblabelnumber+1
- fout.write('<tr> <td width="480" height="15" colspan="6"><font color="blue">')
- fout.write('<span style="font-family: 宋体; font-size: 14">')
- fout.write('['+str(biblabelnumber)+'] '+prtbibentry)
- fout.write('</span></font></td> </tr>')
-
- fout.write('<tr><td height="1" width="566" align="center" colspan="1" bgcolor="teal"></td></tr>')
- fout.write('</table></div></body></html>')
- fout.close()
-
- if auxfile:
- bblfile=auxfile.replace('.aux','.bbl')
- else:
- bblfile=inputbibfile.replace('.bib','.bbl')
- bbloutfile=bblfile
- fout = open(bbloutfile, 'w', encoding="utf8")
- print("INFO: writing cited references to '" + bbloutfile + "'")
-
- fout.write(r'\begin{thebibliography}{'+str(len(bibentries))+'}\n')
-
- biblabelnumber=0
- for prtbibentry in bibliographyentries:
- if len(prtbibentry)>0:
- biblabelnumber=biblabelnumber+1
-
- entrysn=0
- for bibentry in bibentries:
- entrysn=entrysn+1
- if entrysn==biblabelnumber:
- entrykeystr=bibentry['entrykey']
- entryciteauthor=formatlabelauthor(bibentry)
- entryciteyear=formatlabelyear(bibentry)
- entrycitelabel=entryciteauthor[0]+'('+entryciteyear+')'+entryciteauthor[1]
- #Baker et~al.(1995)Baker and Jackson
- break
- if formatoptions['style']=='authoryear':
- fout.write(r'\bibitem['+entrycitelabel+']{'+entrykeystr+'}'+prtbibentry+'\n')
- else:
- fout.write(r'\bibitem['+str(biblabelnumber)+']{'+entrykeystr+'}'+prtbibentry+'\n')
-
- fout.write(r'\end{thebibliography}')
- fout.close()
-
-
-
-#
-#authoryear样式提供标注标签的作者信息
-#
-def formatlabelauthor(bibentry):
-
- if 'author' in bibentry:
- namelist=bibentry['author']
- elif 'editor' in bibentry:
- namelist=bibentry['editor']
- elif 'translator' in bibentry:
- namelist=bibentry['translator']
- else:
- namelist='Anon'
-
- return [namelist,namelist]
-
-#
-#authoryear样式提供标注标签的年份信息
-#
-def formatlabelyear(bibentry):
-
- if 'year' in bibentry:
- yearlist=bibentry['year']
- elif 'eventyear' in bibentry:
- yearlist=bibentry['eventyear']
- elif 'origyear' in bibentry:
- yearlist=bibentry['origyear']
- elif 'urlyear' in bibentry:
- yearlist=bibentry['urlyear']
- else:
- yearlist='N.D.'
-
- return yearlist
-
-#
-#
-#格式化全部文献条目文本
-def formatallbibliography():
- labelnumber=0
- global bibliographytext
- bibliographytext=''
- for bibentry in bibentries:
- labelnumber=labelnumber+1
- bibentry['labelnumber']=labelnumber
- bibentrytext=''
- bibentrytext=formatbibentry(bibentry)
- bibliographytext=bibliographytext+bibentrytext+'\n'
-
- print('\nreferecences')
- print(bibliographytext)
-
-#
-#
-#格式化一个文献条目文本
-def formatbibentry(bibentry):
-
- print('--------------new entry---------')
- print('\nbibentry:',bibentry)
- #bibentrytext='entry:'
-
- #
- # 由于volume和number域可能存在范围的特殊情况,首先做特殊处理
- #
- if 'volume' in bibentry:
- if '-' in bibentry['volume']:
- multivolume=bibentry['volume'].split("-")
- bibentry['volume']=multivolume[0]
- bibentry['endvolume']=multivolume[1]
- if 'number' in bibentry:
- if '-' in bibentry['number']:
- multinumber=bibentry['number'].split("-")
- bibentry['number']=multinumber[0]
- bibentry['endnumber']=multinumber[1]
-
- #四种日期域也做范围解析
- if 'date' in bibentry:
- if '/' in bibentry['date']:
- datestring=bibentry['date'].split('/')
- bibentry['date']=datestring[0]
- bibentry['enddate']=datestring[1]
-
- if 'urldate' in bibentry:
- if '/' in bibentry['urldate']:
- datestring=bibentry['urldate'].split('/')
- bibentry['urldate']=datestring[0]
- bibentry['endurldate']=datestring[1]
-
- if 'eventdate' in bibentry:
- if '/' in bibentry['eventdate']:
- datestring=bibentry['eventdate'].split('/')
- bibentry['eventdate']=datestring[0]
- bibentry['endeventdate']=datestring[1]
-
- if 'origdate' in bibentry:
- if '/' in bibentry['origdate']:
- datestring=bibentry['origdate'].split('/')
- bibentry['origdate']=datestring[0]
- bibentry['endorigdate']=datestring[1]
-
- #
- #接着处理所有域到一个条目文本
- #
- bibentrytext=''
-
- if bibentry['entrytype'] in bibliographystyle:
- print('INFO: format style of entrytype',bibentry['entrytype'],'is defined.')
- if isinstance(bibliographystyle[bibentry['entrytype']],str):
- formattype=bibliographystyle[bibentry['entrytype']]
- else:
- formattype=bibentry['entrytype']
-
- lastfield=True #前一域存在
-
- for fieldinfo in bibliographystyle[formattype]:
-
- rtnfield=formatfield(bibentry,fieldinfo,lastfield)
- fieldtext=rtnfield[0]
- lastfield=rtnfield[1]
-
- bibentrytext=bibentrytext+fieldtext
-
- #对替换字符串做处理
- #包括对重复的标点做处理比如:..变为.
- for k,v in replacestrings.items():
- print(k,v)
- #m=re.search(k,bibentrytext)
- #print(m)
- #bibentrytext=re.sub(k,v,bibentrytext)
- #利用正则反而不行,直接用字符串替换
- bibentrytext=bibentrytext.replace(k,v)
-
- print(bibentrytext)
- return bibentrytext
-
-
-
-#
-#
-#格式化文献条目的域
-#不同类型的域不同处理
-#分5类:姓名列表,文本列表,文本域,日期域,范围域
-#其中姓名列表,文本列表,日期域,日期域,范围域,都需要进行特殊的解析
-#而volume,number如果需要特殊解析则在文件域的格式处理时增加新的处理逻辑。
-def formatfield(bibentry,fieldinfo,lastfield):
-
- print('fieldinfo:',fieldinfo)
- #首先把域的内容先解析处理
- fieldcontents=''
-
- fieldsource=None
-
- #首先判断域是否忽略
- fieldomit=False
-
- if 'omitifnofield' in fieldinfo and 'omitiffield' in fieldinfo:
-
- fieldomita=True#假设忽略的条件满足
- for field in fieldinfo['omitifnofield']:#只要需要不存在的域有一个存在,那么条件就不满足
- if field in bibentry:
- fieldomita=False
- break
-
- fieldomitb=False#假设忽略的条件不满足
- for field in fieldinfo['omitiffield']:#只要需要存在的域中有一个存在,那么条件就满足
- if field not in bibentry:
- fieldomitb=True
- break
-
- fieldomit=fieldomita and fieldomitb
-
- elif 'omitifnofield' in fieldinfo:
-
- fieldomit=True#假设忽略的条件满足
- for field in fieldinfo['omitifnofield']:#只要需要不存在的域有一个存在,那么条件就不满足
- if field in bibentry:
- fieldomit=False
- break
-
- elif 'omitiffield' in fieldinfo:
-
- fieldomit=False#假设忽略的条件不满足
- for field in fieldinfo['omitiffield']:#只要需要存在的域中有一个存在,那么条件就满足
- if field not in bibentry:
- fieldomit=True
- break
-
- print(fieldomit)
-
-
- #如果不忽略该域那么:
- if not fieldomit:
-
- #当域为姓名列表域时:
- if fieldinfo['fieldsource'][0] in datatypeinfo['namelist']:
- #print('0',fieldinfo['fieldsource'][0])
- #print('author' in bibentry)
- for field in fieldinfo['fieldsource']:#
- #print(fieldinfo['fieldsource'])
- #print('namelist:',field)
- if field in bibentry:#当域存在域条目中时,确定要处理的域
- fieldsource=field
- break
- if fieldsource:
- #传递条目给出的一些控制选项
- if 'options' in fieldinfo:
- options=fieldinfo['options']
- else:
- options={}
- fieldcontents=namelistparser(bibentry,fieldsource,options)
-
-
- #当域为文本列表域时:
- elif fieldinfo['fieldsource'][0] in datatypeinfo['literallist']:
-
- for field in fieldinfo['fieldsource']:#
- if field in bibentry:#当域存在域条目中时,确定要处理的域
- fieldsource=field
- break
- if fieldsource:
- fieldcontents=literallistparser(bibentry,fieldsource)
-
- #当域为文本域时:
- elif fieldinfo['fieldsource'][0] in datatypeinfo['literalfield']:
-
- for field in fieldinfo['fieldsource']:#
- if field in bibentry:#当域存在域条目中时,确定要处理的域
- fieldsource=field
- break
- if fieldsource:
- fieldcontents=literalfieldparser(bibentry,fieldsource)
-
-
- #当域为日期域时:
- elif fieldinfo['fieldsource'][0] in datatypeinfo['datefield']:
-
- for field in fieldinfo['fieldsource']:#
- if field in bibentry:#当域存在域条目中时,确定要处理的域
- fieldsource=field
- break
- if fieldsource:
- #传递条目给出的一些控制选项
- if 'options' in fieldinfo:
- options=fieldinfo['options']
- else:
- options={}
- fieldcontents=datefieldparser(bibentry,fieldsource,options)
-
-
- #当域为范围域时:
- elif fieldinfo['fieldsource'][0] in datatypeinfo['rangefield']:
-
- for field in fieldinfo['fieldsource']:#
- if field in bibentry:#当域存在域条目中时,确定要处理的域
- fieldsource=field
- break
- if fieldsource:
- fieldcontents=rangefieldparser(bibentry,fieldsource)
-
- if not fieldsource:
- if 'replstring' in fieldinfo and fieldinfo['replstring']:
- print('replstring')
- fieldsource=True
- fieldcontents=fieldinfo['replstring']
-
-
- #接着做进一步的格式化,包括标点,格式,字体等
- fieldtext=''
-
- print(fieldsource)
- if fieldsource:
- if lastfield:#当前一个著录项存在,则正常输出
- if 'prepunct' in fieldinfo:
- fieldtext=fieldtext+fieldinfo['prepunct']
- else:#当前一个著录项不存在,则首先输出'prepunctifnolastfield'
- if 'prepunctifnolastfield' in fieldinfo:
- fieldtext=fieldtext+fieldinfo['prepunctifnolastfield']
- elif 'prepunct' in fieldinfo:
- fieldtext=fieldtext+fieldinfo['prepunct']
-
- if 'prestring' in fieldinfo:
- fieldtext=fieldtext+fieldinfo['prestring']
-
- if 'fieldformat' in fieldinfo:
- fieldtext=fieldtext+'{'+fieldinfo['fieldformat']+'{'+fieldcontents+'}}'
- else:
- fieldtext=fieldtext+str(fieldcontents)
-
- if 'posstring' in fieldinfo:
- fieldtext=fieldtext+fieldinfo['posstring']
-
- if 'posstringifnumber' in fieldinfo:
- try:
- numtemp=int(fieldcontents)
- if isinstance(numtemp,int):
- fieldtext=fieldtext+fieldinfo['posstringifnumber']
- except:
- print('info:waring the field value can not convert to integer')
-
- if 'pospunct' in fieldinfo:
- fieldtext=fieldtext+fieldinfo['pospunct']
-
- #更新lastfiled
- lastfield=True
- else:
- lastfield=False
-
-
- #自定义标点的处理
- print('fieldtext:',fieldtext)
- while r'\printdelim' in fieldtext:
-
- m = re.search(r'\\printdelim{([^\}]*)}',fieldtext)#注意贪婪算法的影响,所以要排除\}字符
- print('m.group(1):',m.group(1))
- fieldtext=re.sub(r'\\printdelim{[^\}]*}',localpuncts[m.group(1)],fieldtext,count=1)
- print('fieldtext:',fieldtext)
-
-
- #本地化字符串的处理
- print('fieldtext:',fieldtext)
- while r'\bibstring' in fieldtext:
-
- language=languagejudgement(bibentry,fieldinfo,fieldsource)
- m = re.search(r'\\bibstring{([^\}]*)}',fieldtext)#注意\字符的匹配,即便是在r''中也需要用\\表示
- fieldtext=re.sub(r'\\bibstring{[^\}]*}',localstrings[m.group(1)][language],fieldtext,count=1)
- print('fieldtext:',fieldtext)
- #下面这句不行因为,在字典取值是,不支持\1这样的正则表达式
- #fieldtext=re.sub(r'\\bibstring{(.*)}',localstrings[r'\1'][language],fieldtext,count=1)
-
- #标题的类型和载体标识符的处理
- if r'\typestring' in fieldtext:#当需要处理类型和载体时
- if bibentry['entrytype'] in typestrings:#当条目对应的类型存在时
- print(r'\typestring in',fieldtext)
- typestring=typestrings[bibentry['entrytype']]
- if 'url' in bibentry:
- typestring=typestring.replace(']','/OL]')
- elif 'medium' in bibentry:
- rplctypestring=bibentry['medium']+']'
- typestring=typestring.replace(']',rplctypestring)
- else:#当条目对应的类型不存在时,当做其它类型处理
- typestring='[Z]'
-
- print(typestring)
- fieldtext=fieldtext.replace(r'\typestring',typestring)
-
- return [fieldtext,lastfield]
-
-
-
-
-
-#
-#根据作者域或者标题域确定条目的语言
-#
-def languagejudgement(bibentry,fieldinfo,fieldsource):
-
- if fieldsource in datatypeinfo['namelist']:#当域是作者类时,利用作者域本身信息做判断
-
- language=fieldlanguage(bibentry[fieldsource])
-
- else:#其它情况,利用title域做判断
- if 'title' in bibentry:
- language=fieldlanguage(bibentry['title'])
- elif 'author' in bibentry:
- language=fieldlanguage(bibentry['author'])
- else:
- language='english'
-
- return language
-
-
-#
-#根据域值所在的字符范围确定域的语言
-#
-def fieldlanguage(fieldvalueinfo):
-
- if re.match(r'[\u2FF0-\u9FA5]', fieldvalueinfo):
- language='chinese'
- elif re.match(r'[\u3040-\u30FF\u31F0}-\u31FF]', fieldvalueinfo):
- language='japanese'
- elif re.match(r'[\u1100-\u11FF\u3130-\u318F\uAC00-\uD7AF]', fieldvalueinfo):
- language='korean'
- elif re.match(r'[\u0400-\u052F]', fieldvalueinfo):
- language='russian'
- elif re.match(r'[\u0100-\u017F]', fieldvalueinfo):
- language='french'
- else:
- language='english'
-
- return language
-
-
-#
-#
-#对存在{}做保护的字符串进行分割
-def safetysplit(strtosplt,seps):
-
- #首先查找{}保护的所有字符串
- s1=re.findall('\{.*?\}',strtosplt)
-
- #接着确定保护字符串中是否存在分割用字符串
- sepinbrace=False
- for s1a in s1:
- for sep in seps:
- if sep in s1a:
- sepinbrace=True
- break
- if sepinbrace:
- break
- #print(sepinbrace)
-
- #若保护字符串中存在分割字符串那么做特殊处理
- a=strtosplt
- if sepinbrace:
-
- #保护字符串用特殊字符串代替,特殊字符串与分割字符串没有任何关联
- strsn=0
- for stra1 in s1:
- strsn=strsn+1
- a=a.replace(stra1,'$'+str(strsn)+'$')
- #print(a)
-
- #处理原字符串为只需要一个分隔字符串就能分隔
- if len(seps)>1:
- for i in range(1,len(seps)):
- a=a.replace(seps[i],seps[0])
- #print(a)
-
- #接着做分割
- names=a.split(seps[0])
- #print(names)
-
- #对分割后的字符串做还原,即把特殊字符串还原回保护字符串
- namesnew=[]
- for name in names:
- strsn=0
- for stra1 in s1:
- strsn=strsn+1
- name=name.replace('$'+str(strsn)+'$',stra1)
- #print(name)
- namesnew.append(name.strip().lstrip())
-
- else:
- #处理原字符串为只需要一个分隔字符串就能分隔
- if len(seps)>1:
- for i in range(1,len(seps)):
- a=a.replace(seps[i],seps[0])
- #print(a)
-
- #直接分割
- names=a.split(seps[0])
- namesnew=[]
- for name in names:
- namesnew.append(name.strip().lstrip())
-
- #print(namesnew)
- return namesnew
-
-#
-#
-#姓名列表解析
-#增加条目给出的选项
-def namelistparser(bibentry,fieldsource,options):
- fieldcontents=bibentry[fieldsource]
-
- #首先做针对{}保护的处理
- #{}有可能保护一部分,有可能保护全部
- #首先判断{}是否存在,若存在,那么可以确定需要做保护处理,否则用常规处理
- #当然这些事情可以在一个函数中处理
-
- #首先姓名列表进行分解,包括用' and '和' AND '做分解
- #利用safetysplit函数实现安全的分解
- seps=[' and ',' AND ']
- fieldcontents=fieldcontents.lstrip().strip()
- fieldauthors=safetysplit(fieldcontents,seps)
-
- print('fieldauthors:',fieldauthors)
- #接着从各个姓名得到更详细的分解信息
- fieldnames=[]
- for name in fieldauthors:
- if name.lower() == 'others':
- nameinfo={'morename':True}
- else:
- if fieldlanguage(name)=='chinese':#当中文姓名中存在逗号先去除
- if ', ' in name:
- name=name.replace(', ','')
- else:
- pass
- nameinfo=singlenameparser(name)
- fieldnames.append(nameinfo)
-
- #最后根据全局和局部选项进行格式化
- nameformattedstr=''
-
- #根据'maxbibnames'和'minbibnames'截短
- if 'maxbibnames' in options:#首先使用条目中的选项
- if len(fieldnames)>options['maxbibnames']:
- fieldnamestrunc=fieldnames[:options['minbibnames']]
- nameinfo={'morename':True}
- fieldnamestrunc.append(nameinfo)
- else:
- fieldnamestrunc=fieldnames
- elif 'maxbibnames' in formatoptions:#接着使用全局选项
- if len(fieldnames)>formatoptions['maxbibnames']:
- fieldnamestrunc=fieldnames[:formatoptions['minbibnames']]
- nameinfo={'morename':True}
- fieldnamestrunc.append(nameinfo)
- else:
- fieldnamestrunc=fieldnames
- else:
- fieldnamestrunc=fieldnames
-
- #当条目选择中存在'nameformat'
- if 'nameformat' in options:
- option={'nameformat':options['nameformat']}
- else:
- option={}
-
- print('fieldnamestrunc:',fieldnamestrunc)
- nameliststop=len(fieldnamestrunc)
- nameliststart=1
- namelistcount=0
- for nameinfo in fieldnamestrunc:
- namelistcount=namelistcount+1
- if 'morename' in nameinfo:
- if formatoptions['morenames']:#只有设置morenames为true是才输出other的相关信息
- nameformattedstr=nameformattedstr+r'\printdelim{andothorsdelim}\bibstring{andothers}'
- else:
- if namelistcount==nameliststop and namelistcount>1:#当没有others时最后一个姓名前加的标点
- nameformattedstr=nameformattedstr+r'\printdelim{finalnamedelim}'+singlenameformat(nameinfo,option)
- elif namelistcount==nameliststart:
- nameformattedstr=singlenameformat(nameinfo,option)
- else:
- nameformattedstr=nameformattedstr+r'\printdelim{multinamedelim}'+singlenameformat(nameinfo,option)
-
- return nameformattedstr
-
-
-#
-#
-#单个姓名格式化
-def singlenameformat(nameinfo,option):
-
- singlenamefmtstr=''
-
-
- if 'nameformat' in option:#首先使用条目给出的选项
- nameformat=option['nameformat']
- elif 'nameformat' in formatoptions:#接着使用全局的选项
- nameformat=formatoptions['nameformat']
- else:#最后使用默认的选项
- nameformat='uppercase'
-
-
- #根据单个姓名格式化选项来实现具体的格式
- if nameformat=='uppercase':
-
- if nameinfo['family'].startswith('{'):
- singlenamefmtstr=nameinfo['family']
- else:
- singlenamefmtstr=nameinfo['family'].upper()
-
- #根据选项确定使用名的缩写
- if formatoptions["giveninits"]=='space':#space表示名见用空格分隔,
- if 'given' in nameinfo:
- singlenamefmtstr=singlenamefmtstr+' '+nameinfo['giveni'].upper()
- if 'middle' in nameinfo:
- singlenamefmtstr=singlenamefmtstr+' '+nameinfo['middlei'].upper()
- elif formatoptions["giveninits"]=='dotspace':#dotspace用点加空格,
- if 'given' in nameinfo:
- singlenamefmtstr=singlenamefmtstr+' '+nameinfo['giveni'].upper()
- if 'middle' in nameinfo:
- singlenamefmtstr=singlenamefmtstr+'. '+nameinfo['middlei'].upper()+'.'
- elif formatoptions["giveninits"]=='dot':#dot用点,
- if 'given' in nameinfo:
- singlenamefmtstr=singlenamefmtstr+' '+nameinfo['giveni'].upper()
- if 'middle' in nameinfo:
- singlenamefmtstr=singlenamefmtstr+'.'+nameinfo['middlei'].upper()+'.'
- elif formatoptions["giveninits"]=='terse':#terse无分隔,
- if 'given' in nameinfo:
- singlenamefmtstr=singlenamefmtstr+' '+nameinfo['giveni'].upper()
- if 'middle' in nameinfo:
- singlenamefmtstr=singlenamefmtstr+nameinfo['middlei'].upper()
- elif formatoptions["giveninits"]=='false':#false不使用缩写
- if 'given' in nameinfo:
- singlenamefmtstr=singlenamefmtstr+' '+nameinfo['given'].upper()
- if 'middle' in nameinfo:
- singlenamefmtstr=singlenamefmtstr+' '+nameinfo['middle'].upper()
-
-
- elif nameformat=='lowercase':
- pass
- elif nameformat=='given-family':
- pass
- elif nameformat=='family-given':
- pass
- elif nameformat=='pinyin':
- pass
- else:
- pass
-
- return singlenamefmtstr
-
-
-#
-#
-#单个姓名解析
-def singlenameparser(name):
-
- singlename=name
-
- print('name:',name)
-
- #字典用于存储所有的姓名成分信息
- namepartsinfo={}
-
- nameparts=safetysplit(singlename,[','])
-
- if len(nameparts)==3:#两个逗号的情况,表示存在family和suffix
-
- prefixfamily=safetysplit(nameparts[0].lstrip().strip(),[' '])
- if len(prefixfamily)>1:
- namepartsinfo['prefix']=prefixfamily[0].lstrip().strip()
- namepartsinfo['family']=prefixfamily[1].lstrip().strip()
- else:
- namepartsinfo['family']=prefixfamily[0].lstrip().strip()
-
- namepartsinfo['suffix']=nameparts[1].lstrip().strip()
-
-
- givenmiddle=safetysplit(nameparts[2].lstrip().strip(),[' '])
- if len(givenmiddle)>1:
- namepartsinfo['given']=givenmiddle[0].lstrip().strip()
- namepartsinfo['middle']=givenmiddle[1].lstrip().strip()
- else:
- namepartsinfo['given']=givenmiddle[0].lstrip().strip()
-
- elif len(nameparts)==2:
-
- prefixfamily=safetysplit(nameparts[0].lstrip().strip(),[' '])
- if len(prefixfamily)>1:
- namepartsinfo['prefix']=prefixfamily[0].lstrip().strip()
- namepartsinfo['family']=prefixfamily[1].lstrip().strip()
- else:
- namepartsinfo['family']=prefixfamily[0].lstrip().strip()
-
-
- givenmiddle=safetysplit(nameparts[1].lstrip().strip(),[' '])
- if len(givenmiddle)>1:
- namepartsinfo['given']=givenmiddle[0].lstrip().strip()
- namepartsinfo['middle']=givenmiddle[1].lstrip().strip()
- else:
- namepartsinfo['given']=givenmiddle[0].lstrip().strip()
-
- else:
- givenmiddlefamily=safetysplit(nameparts[0].lstrip().strip(),[' '])
- if len(givenmiddlefamily)==3:
- namepartsinfo['given']=givenmiddlefamily[0].lstrip().strip()
- namepartsinfo['middle']=givenmiddlefamily[1].lstrip().strip()
- namepartsinfo['family']=givenmiddlefamily[2].lstrip().strip()
- elif len(givenmiddlefamily)==2:
- namepartsinfo['given']=givenmiddlefamily[0].lstrip().strip()
- namepartsinfo['family']=givenmiddlefamily[1].lstrip().strip()
- elif len(givenmiddlefamily)==1:
- namepartsinfo['family']=givenmiddlefamily[0].lstrip().strip()
-
-
- print('nameparts:',namepartsinfo)
-
- if 'family' in namepartsinfo:
- if namepartsinfo['family'].startswith('{'):
- namepartsinfo['familyi']=namepartsinfo['family']
- else:
- namepartsinfo['familyi']=namepartsinfo['family'][0].upper()
-
- if 'given' in namepartsinfo:
- #print(namepartsinfo['given'])
- if namepartsinfo['given'].startswith('{'):
- namepartsinfo['giveni']=namepartsinfo['given']
- else:
- namepartsinfo['giveni']=namepartsinfo['given'][0].upper()
-
- if 'middle' in namepartsinfo:
- if namepartsinfo['middle'].startswith('{'):
- namepartsinfo['middle']=namepartsinfo['middle']
- else:
- namepartsinfo['middlei']=namepartsinfo['middle'][0].upper()
-
- return namepartsinfo
-
-#
-#
-#文本列表解析
-def literallistparser(bibentry,fieldsource):
- fieldcontents=bibentry[fieldsource]
-
-
- #首先从文本列表分解出各个项,包括用' and '和' AND '做分解
- #利用safetysplit函数实现安全的分解
- seps=[' and ',' AND ']
- fieldcontents=fieldcontents.lstrip().strip()
- fielditems=safetysplit(fieldcontents,seps)
-
- print('fielditems:',fielditems)
-
- #根据'maxbibitems'和'minbibitems'截短
- fielditemstrunc=[]
-
- if len(fielditems)>formatoptions['maxbibitems']:
- fielditemstrunc=fielditems[:formatoptions['minbibitems']]
- fielditemstrunc.append('others')
- else:
- fielditemstrunc=fielditems
-
- #重设一下others的大小写,因为可能输入的时大写的
- if fielditems[-1].lower() == 'others':
- fielditems[-1]='others'
-
- #最后根据全局和局部选项进行格式化
- itemliststop=len(fielditemstrunc)
- itemliststart=1
- itemlistcount=0
- itemformattedstr=''
- for iteminfo in fielditemstrunc:
- itemlistcount=itemlistcount+1
- if iteminfo == 'others':
- if formatoptions['moreitems']:#只有设置moreitems为true是才输出other的相关信息
- itemformattedstr=itemformattedstr+r'\printdelim{andothorsdelim}\bibstring{andothers}'
- else:
- if itemlistcount==itemliststop and itemlistcount>1:#当没有others时最后一个项前加标点
- itemformattedstr=itemformattedstr+r'\printdelim{finalitemdelim}'+iteminfo
- elif itemlistcount==itemliststart:
- itemformattedstr=iteminfo
- else:
- itemformattedstr=itemformattedstr+r'\printdelim{multiitemdelim}'+iteminfo
-
- return itemformattedstr
-
-#
-#
-#文本域解析
-def literalfieldparser(bibentry,fieldsource):
- fieldcontents=bibentry[fieldsource]
-
- return fieldcontents
-
-#
-#
-#日期域解析
-#条目设置的选项options:
-def datefieldparser(bibentry,fieldsource,options):
- fieldcontents=bibentry[fieldsource]
-
- #首先从日期域,解析日期类型:
- dateparts={}
- if fieldsource=='year':
- datestring=bibentry[fieldsource]
- datetype=''
- else:
- datetype=fieldsource.replace('date','')
- datestring=bibentry[fieldsource]
-
-
- #日期的年月日解析
- #日期一般很少用{}进行保护,当保护的时候通常是整个进行包括,所以通常{}会出现在域的起始和末尾
- #所以当出现{字符时通常不用再做解析
- if '{' in datestring:
- datepartinfo=[datestring]
- else:
- datepartinfo=datestring.split('-')
-
- if len(datepartinfo)==3:
- dateparts[datetype+'year']=datepartinfo[0].strip().lstrip()
- dateparts[datetype+'month']=datepartinfo[1].strip().lstrip()
- dateparts[datetype+'day']=datepartinfo[2].strip().lstrip()
- elif len(datepartinfo)==2:
- dateparts[datetype+'year']=datepartinfo[0].strip().lstrip()
- dateparts[datetype+'month']=datepartinfo[1].strip().lstrip()
- else:
- dateparts[datetype+'year']=datepartinfo[0].strip().lstrip()
-
- print(dateparts)
-
- #判断解析的年月日是不是整数,若不是则表示日期不可解析
- datecanbeparse=True
- for k,v in dateparts.items():
- try:
- datepartisint=isinstance(int(v),int)
- except:
- print('INFO: WARNING'+fieldsource+'can not be parsed')
- datecanbeparse=False
- break
-
-
- #然后根据全局选项进行格式化:
- #如果解析的年月日不是整数,那么对于date域则忽略,对于year域则直接输出
- if datecanbeparse:
- if datetype+'date' in options:#首先使用条目给出的选项
- fieldcontents=singledateformat(dateparts,datetype,options[datetype+'date'])
- elif datetype+'date' in formatoptions:#接着使用全局给出的选项
- fieldcontents=singledateformat(dateparts,datetype,formatoptions[datetype+'date'])
- else:#否则使用默认选项
- fieldcontents=singledateformat(dateparts,datetype,'default')
- else:
- if fieldsource=='year':
- fieldcontents=bibentry[fieldsource]
- else:
- fieldcontents=''
-
- return fieldcontents
-
-
-#
-#
-# 根据日期的设置选项格式化单个日期
-def singledateformat(dateparts,datetype,formatoption):
- if formatoption=='year':
- dateformatstr=dateparts[datetype+'year']
- elif formatoption=='iso':
- dateformatstr=dateparts[datetype+'year']
- if len(dateparts[datetype+'month'])<2:
- dateformatstr=dateformatstr+'-0'+dateparts[datetype+'month']
- else:
- dateformatstr=dateformatstr+'-'+dateparts[datetype+'month']
- if len(dateparts[datetype+'day'])<2:
- dateformatstr=dateformatstr+'-0'+dateparts[datetype+'day']
- else:
- dateformatstr=dateformatstr+'-'+dateparts[datetype+'day']
- elif formatoption=='ymd':
- dateformatstr=dateparts[datetype+'year']
- dateformatstr=dateformatstr+'-'+dateparts[datetype+'month']
- dateformatstr=dateformatstr+'-'+dateparts[datetype+'day']
- elif formatoption=='default':
- dateformatstr=dateparts[datetype+'year']
- else:
- pass
-
- return dateformatstr
-
-
-
-
-
-#
-#
-#范围域解析
-def rangefieldparser(bibentry,fieldsource):
- fieldcontents=bibentry[fieldsource]
-
- return fieldcontents
-
-
-#
-#
-#打开bib文件
-def readfilecontents(bibFile):
- print("INFO: Reading references from '" + bibFile + "'")
- try:
- fIn = open(bibFile, 'r', encoding="utf8")
- global bibfilecontents
- bibfilecontents=fIn.readlines()
- fIn.close()
-
- global usedIds
- usedIds = set()
- if auxfile:
- fInAux = open(auxfile, 'r', encoding="utf8")
- for line in fInAux:
- if line.startswith("\\citation") or line.startswith("\\abx at aux@cite"):
- ids = line.split("{")[1].rstrip("} \n").split(", ")
- for id in ids:
- if (id != ""):
- usedIds.add(id)
- fInAux.close()
- print('references:',usedIds)
-
- except IOError:
- print("ERROR: Input bib file '" + bibFile +
- "' doesn't exist or is not readable")
- sys.exit(-1)
-
-#
-#打印bib文件内容
-def printfilecontents():
- for line in bibfilecontents:
- print(line)
-
-
-
-#
-#输出修改后的bib文件
-def writefilenewbib(bibFile):
-
- print(datetime.datetime.now().isoformat(timespec='seconds'))
-
- #json文件输出,用dump方法
- jsonoutfile="new"+bibFile.replace('.bib','.json')
- print("INFO: writing all references to '" + jsonoutfile + "'")
- fout = open(jsonoutfile, 'w', encoding="utf8")
- json.dump(bibentries, fout)
- fout.close()
-
- #json文件输出,直接用write写
- jsonoutfile="new"+bibFile.replace('.bib','cited.json')
- fout = open(jsonoutfile, 'w', encoding="utf8")
- print("INFO: writing cited references to '" + jsonoutfile + "'")
- fout.write('[\n')
- for bibentry in bibentries:
- if bibentry["entrykey"] in usedIds or not usedIds:
- fout.write(repr(bibentry)+',\n')
- fout.write(']\n')
- fout.close()
-
- #bib文件输出
- biboutfile="new"+bibFile
-
- try:
- fout = open(biboutfile, 'w', encoding="utf8")
- fout.write("%% \n")
- fout.write("%% bib file modified by biblatex-map.py\n")
-
- fout.write("%% "+datetime.datetime.now().isoformat(timespec='seconds')+"\n")
- fout.write("%% \n\n\n")
-
- for bibcomment in bibcomments:
- for k,v in bibcomment.items():
- if k=="entrytype":
- fout.write('@'+bibcomment["entrytype"]+'{')
- else:
- fout.write(str(v))
- fout.write('}\n\n')
-
- for bibstring in bibstrings:
- for k,v in bibstring.items():
- if k=="entrytype":
- fout.write('@'+bibstring["entrytype"]+'{')
- else:
- fout.write(str(v))
- fout.write('}\n\n')
-
- writebibentrycounter=0
- if auxfile:
- print("INFO: writing cited references in aux to '" + biboutfile + "'")
-
- for bibentry in bibentries:
- if bibentry["entrykey"] in usedIds:
- writebibentrycounter=writebibentrycounter+1
- fout.write('@'+bibentry["entrytype"]+'{'+bibentry["entrykey"]+',\n')
- for k,v in bibentry.items():
- if k=="entrytype" or k=="entrykey" or v=='""' or v==None or k=='entrysn':
- pass
- else:
- fout.write('\t'+str(k)+' = {'+str(v)+'},\n')
- fout.write('}\n\n')
- else:
- print("INFO: writing all references to '" + biboutfile + "'")
- for bibentry in bibentries:
- writebibentrycounter=writebibentrycounter+1
- fout.write('@'+bibentry["entrytype"]+'{'+bibentry["entrykey"]+',\n')
- for k,v in bibentry.items():
- if k=="entrytype" or k=="entrykey" or v=='""' or k=='entrysn' or v==None:
- pass
- else:
- fout.write('\t'+k+' = {'+v+'},\n')
- fout.write('}\n\n')
-
- fout.close()
- print("INFO: " + str(writebibentrycounter) + " references writed")
- except IOError:
- print("ERROR: Input bib file '" + bibFile +
- "' doesn't exist or is not readable")
- sys.exit(-1)
-
-
-
-
-#
-#将条目解析放到bibentries列表中
-#每个条目是一个dict字典
-def bibentryparsing():
- global bibentries
- global bibcomments
- global bibstrings
- bibentries=[]#用于记录所有条目
- bibentry={}#用于记录当前条目
-
- bibcomments=[]#用于记录所有@comment条目
- bibcomment={}#用于记录当前@comment条目
-
- bibstrings=[]#用于记录所有@stirng条目
- bibstring={}#用于记录当前@stirng条目
-
- entrysn=0 #用于标记条目序号
- bibentrycounter=0##用于标记条目总数
- commentsn=0 #用于标记@comment条目序号
- bibcommentcounter=0#用于标记@comment条目总数
- stringsn=0 #用于标记@stirng条目序号
- bibstringcounter=0#用于标记@stirng条目总数
-
- entrystated=False #用于标记条目开始
- fieldvalended=True #用于标记域的值当前行是否已经结束
- fieldvalue="" #用于记录当前域的值
- counterbracket=0 #用于追踪{}符号
- counterquotes=0 #用于追踪“”符号
- enclosebracket=True #用于记录是用{}还是用“”做为域的值的包围符号
- enclosenone=False #用于记录域的值无包围符号的情况
-
- for line in bibfilecontents:#遍历所有行
- #print(line)
-
- if line.startswith("@") and not "@comment" in line.lower() and not "@string" in line.lower():#判断条目开始行
- entrysn=entrysn+1
- entrystated=True #新条目开始
- print('entrysn=',entrysn)
- entrynow=line.lstrip('@').split(sep='{', maxsplit=1)
- #print(entrynow)
- entrytype=entrynow[0]
- bibentry['entrytype']=entrytype.lower()#条目类型小写,方便比较
- entrykey=entrynow[1].split(sep=',', maxsplit=1)[0]
- bibentry['entrykey']=entrykey
- bibentry['entrysn']=entrysn
- elif entrystated: #只有新条目开始了才有意义
-
- if fieldvalended: #当前行不是前面的未结束域的值
- if '=' in line and not line.lstrip().startswith("}"):
- #排除以'}'开头的行后根据=号判断条目域信息行,不可能出现=号无法判断信息行的问题,
- #因为是域值中存在=的特殊情况已经在未结束逻辑处理
- entryline=line.lstrip()
- entrynow=entryline.split(sep='=', maxsplit=1)
- #print(entrynow)
- entryfield=entrynow[0].strip().lstrip().lower()#域名小写,方便比较
- entryfieldline=entrynow[1].lstrip()
-
- if entryfieldline.startswith("{"):
- enclosebracket=True
- elif entryfieldline.startswith('"'):
- enclosebracket=False
- else:#当没有符号包围是设置enclosenone以便特殊处理
- enclosenone=True
-
- fieldvalcontinued=True #临时标记,用于记录域值是否还未结束,先假设未结束
- for chari in entryfieldline.strip():#遍历域值中的每个字符
- fieldvalue=fieldvalue+chari
- if chari =='{':#对{符号进行追踪
- counterbracket=counterbracket+1
- elif chari =='}':#对}符号进行追踪
- counterbracket=counterbracket-1
- if enclosebracket:
- if counterbracket==0:#当}与域开始的{配对,那么说明域值已经结束
- bibentry[entryfield]=fieldvalue[1:-1]#利用strip可能会消多次,因此用list的方式处理
- fieldvalue=""
- counterbracket=0
- counterquotes=0
- fieldvalended=True
- fieldvalcontinued=False
- break #直接跳出循环
- elif chari =='"':
- counterquotes=counterquotes+1
- if not enclosebracket:
- if operator.mod(counterquotes,2)==0:
- bibentry[entryfield]=fieldvalue[1:-1]
- fieldvalue=""
- counterbracket=0
- counterquotes=0
- fieldvalended=True
- fieldvalcontinued=False
- break
- elif chari ==',':#若域值没有包围符号那么遇到,号即为域值结束
- if enclosenone:
- bibentry[entryfield]=fieldvalue[:-1]
- fieldvalue=""
- counterbracket=0
- counterquotes=0
- fieldvalended=True
- fieldvalcontinued=False
- enclosenone=False
-
- #测试:输出看是否正确
- #if entryfield=='abstract':
- # print('val=',fieldvalue)
- # print('counterbracket=',counterbracket)
-
- if fieldvalcontinued:
- fieldvalended=False
-
- elif '}' in line:#条目结束行
-
- #global bibentryglobal
- #bibentryglobal=copy.deepcopy(bibentry)
- #print('entry:',bibentryglobal)
- #bibentries.append(bibentryglobal)
- print('entry:',bibentry)
- bibentries.append(bibentry)
- bibentry={}
- entrystated=False
-
- else: #当前行是前面的未结束域的值,因此直接往前面的域值添加即可
- fieldvalcontinued=True
-
- entryfieldline=line
-
- if enclosenone:#当域没有包围符号时,接续的行可能是用逗号结束的域,也可能没有逗号,而用}直接结束条目信息
- for chari in entryfieldline.strip():
- fieldvalue=fieldvalue+chari
- if chari ==',':
- bibentry[entryfield]=fieldvalue[:-1]
- fieldvalue=""
- counterbracket=0
- counterquotes=0
- fieldvalended=True
- fieldvalcontinued=False
- enclosenone=False
- elif chari =='}':
- bibentry[entryfield]=fieldvalue[:-1]
- fieldvalue=""
- counterbracket=0
- counterquotes=0
- fieldvalended=True
- fieldvalcontinued=False
- enclosenone=False
- print('entry:',bibentry)
- bibentries.append(bibentry)
- bibentry={}
- entrystated=False
-
- else:
- for chari in entryfieldline.strip():
- fieldvalue=fieldvalue+chari
- if chari =='{':
- counterbracket=counterbracket+1
- elif chari =='}':
- counterbracket=counterbracket-1
- if enclosebracket:
- if counterbracket==0:
- bibentry[entryfield]=fieldvalue[1:-1]
- fieldvalue=""
- counterbracket=0
- counterquotes=0
- fieldvalended=True
- fieldvalcontinued=False
- break
- elif chari =='"':
- counterquotes=counterquotes+1
- if not enclosebracket:
- if mod(counterquotes,2)==0:
- bibentry[entryfield]=fieldvalue[1:-1]
- fieldvalue=""
- counterbracket=0
- counterquotes=0
- fieldvalended=True
- fieldvalcontinued=False
- break
-
-
- if fieldvalcontinued:
- fieldvalended=False
- elif line.startswith("@") and "@comment" in line.lower():#@comment的起始
- commentsn=commentsn+1
- entrynow=line.lstrip('@').split(sep='{', maxsplit=1)
- entrytype=entrynow[0]
- bibcomment['entrytype']=entrytype.lower()#条目类型小写,方便比较
- entrycontents=entrynow[1].strip()[:-1]
- bibcomment['entrycontents']=entrycontents
- print(bibcomment)
- bibcomments.append(bibcomment)
- bibcomment={}
-
- elif line.startswith("@") and "@string" in line.lower():#@string的起始
- stringsn=stringsn+1
- entrynow=line.lstrip('@').split(sep='{', maxsplit=1)
- entrytype=entrynow[0]
- bibstring['entrytype']=entrytype.lower()#条目类型小写,方便比较
- entrycontents=entrynow[1].strip()[:-1]
- bibstring['entrycontents']=entrycontents
- print(bibstring)
- bibstrings.append(bibstring)
- bibstring={}
-
-
- bibentrycounter=len(bibentries)
- bibcommentcounter=len(bibcomments)
- bibstringcounter=len(bibstrings)
- print('entrysn=',entrysn,' commentsn=',commentsn,' stringsn=',stringsn)
- print('entryct=',bibentrycounter,' commentct=',bibcommentcounter,' stringct=',bibstringcounter)
-
- if not bibentrycounter==entrysn or not bibcommentcounter==commentsn or not bibstringcounter==stringsn:
- try:
- raise BibParsingError('bib file parsing went wrong!')
- except BibParsingError as e:
- raise BibParsingError(e.message)
- print('entrytotal=',bibentrycounter)
-
- #输出解析后的bib文件信息
- #for bibentryi in bibentries:
- #print(bibentryi)
-
-
-#
-#打印bibentries列表中的所有条目
-def printbibentries():
- for bibentryi in bibentries:
- print(bibentryi)
-
-
-#
-#自定义异常类
-class BibParsingError(Exception):
- def __init__(self,message):
- Exception.__init__(self)
- self.message=message
-
-#
-# 执行数据映射操作
-# 还有很多选项没有实现,20190209
-# 实现的选项中也需要和未实现的选项进行数据传递
-def execsourcemap():
- for map in sourcemaps:#every map in maps,每个map逐步开始
- for bibentry in bibentries:#每个映射都需要遍历所有条目,对每个条目做map
-
- mapcontinue=1#大于0表示正常,继续当前条目的map
- typesrcinfo={}#用于记录typesource相关处理结果
- fieldsrcinfo={}#用于记录fieldsource相关处理的结果
- constraintinfo={}#用于记录类型等限制信息记录
- constraintinfo['pertype']=[]
- constraintinfo['pernottype']=[]
-
- #print("map info=",map)
- for step in map:#every step in map
- if mapcontinue>0:#对前面已经final完成的情况做限制
- for keyvals in step:#key-vals in step
- for k,v in keyvals.items():#step 是有迹可循的,每个step总是存在一些东西,找到这些做其中的逻辑即可
- #print(k,v)
-
- if k=="typesource":#条目类型设置
- mapcontinue=maptypesource(keyvals,bibentry,typesrcinfo)#coef is dict
-
- elif k=="fieldsource":#域查找或设置
- mapcontinue=mapfieldsource(keyvals,bibentry,fieldsrcinfo,constraintinfo)#
- #print("fieldsource step:",fieldsrcinfo)
-
- elif k=="fieldset":#域设置
- mapcontinue=mapfieldset(keyvals,bibentry,typesrcinfo,fieldsrcinfo,constraintinfo)#
-
- elif k=="pertype": #类型限制
- mapcontinue=mappertype(keyvals,constraintinfo)
-
- elif k=="pernottype":#类型限制
- mapcontinue=mappernottype(keyvals,constraintinfo)
-
- elif k=="notfield":#域限制
- mapcontinue=mapnotfield(keyvals,bibentry,fieldsrcinfo,constraintinfo)#
- else:
- pass
-
-
-#
-#域限制,若域确定不存在则终止map
-def mapnotfield(keyvals,bibentry,fieldsrcinfo,constraintinfo):
-
- setcontinue=True
- print(setcontinue)
- if len(constraintinfo['pertype'])>0:
- if bibentry['entrytype'] not in constraintinfo['pertype']:#
- setcontinue=False
- if len(constraintinfo['pernottype'])>0:
- if bibentry['entrytype'] in constraintinfo['pernottype']:#
- setcontinue=False
- print(setcontinue)
-
-
- print("constraints:notfield")
- if setcontinue:
- for k,v in keyvals.items():
- #print(k,v)
- if k=='notfield':
- notfield=v.lower()
- elif k=='final':
- fieldfinal=v
- else:
- pass
-
- if notfield not in bibentry:#当notfield不存在,则判断为true,若存在final则终止,否则继续
- if fieldfinal:
- return 0
- else:
- return 1
- else:
- return 1
-
- else:
- return 0
-
-
-
- #
-#条目类型限制,将类型限制信息放入字典
-def mappertype(keyvals,constraintinfo):
-
- print("constraints:pertype")
- for k,v in keyvals.items():
- #print(k,v)
- if k=='pertype':
- pertype=v.lower()#因为大小写区分,所以全部小写方便比较
- else:
- pass
- print('pertype=',pertype)
-
- constraintinfo['pertype'].append(pertype)
- return 1
-
-#
-#条目类型限制,将类型限制信息放入字典
-def mappernottype(keyvals,constraintinfo):
-
- print("constraints:pernottype")
- for k,v in keyvals.items():
- #print(k,v)
- if k=='pernottype':
- pernottype=v.lower()#因为大小写区分,所以全部小写方便比较
- else:
- pass
- print('pertype=',pertype)
-
- constraintinfo['pernottype'].append(pernottype)
- return 1
-
-
-#
-#条目类型转换
-def maptypesource(keyvals,bibentry,typesrcinfo):
- retrunval=1
- for k,v in keyvals.items():
- #print(k,v)
- if k=='typesource':
- typesource=v.lower()
- elif k=='typetarget':
- typetarget=v.lower()
- elif k=='final':
- retrunval=0
- else:
- pass
-
- typesrcinfo
- if typetarget:
- if bibentry['entrytype']==typesource:
- bibentry['entrytype']=typetarget
- typesrcinfo['typesource']=typesource
- return 1
- else:
- return retrunval #存在final时,且不匹配则终止map
- else:
- if bibentry['entrytype']==typesource:
- typesrcinfo['typesource']=typesource
- else:
- typesrcinfo['typesource']=None
- return retrunval
-#
-#
-# 域信息设置
-def mapfieldset(keyvals,bibentry,typesrcinfo,fieldsrcinfo,constraintinfo):
- overwrite=False
- append=False
-
- setcontinue=True
- print(setcontinue)
- if len(constraintinfo['pertype'])>0:
- if bibentry['entrytype'] not in constraintinfo['pertype']:#
- setcontinue=False
- if len(constraintinfo['pernottype'])>0:
- if bibentry['entrytype'] in constraintinfo['pernottype']:#
- setcontinue=False
- print(setcontinue)
-
- if setcontinue:
-
- for k,v in keyvals.items():
- #print(k,v)
- if k=='fieldset':
- fieldset=v.lower()
- elif k=='fieldvalue':
- fieldvalue=v
- elif k=='origfieldval':
- fieldvalue=fieldsrcinfo[fieldsrcinfo['fieldsource']]
- print(fieldvalue)
- elif k=='origentrytype':
- fieldvalue=typesrcinfo['typesource']
- print(fieldvalue)
- elif k=='origfield':
- fieldvalue=fieldsrcinfo['fieldsource']
- print(fieldvalue)
- elif k=='null':
- fieldvalue=None
- print(fieldvalue)
- elif k=='append':
- append=v
- elif k=='overwrite':
- overwrite=v
- else:
- pass
-
-
- print("fieldset=",fieldset)
- if overwrite:
- if append:
- oldvalue=bibentry[fieldset]
- newvalue=oldvalue+","+fieldvalue
- bibentry[fieldset]=newvalue
- else:
- bibentry[fieldset]=fieldvalue
- else:
- if fieldset in bibentry:
- pass
- else:
- bibentry[fieldset]=fieldvalue
- return 1
-
- else:
- return 1
-
-#
-#域名转换或判断域是否存在或match
-def mapfieldsource(keyvals,bibentry,fieldsrcinfo,constraintinfo):
- mapfieldtype=0 #域名map的类型设置
- fieldmatch=''#匹配模式默认为空
- fieldmatchi=''#匹配模式默认为空
-
-
- setcontinue=True
- print(setcontinue)
- if len(constraintinfo['pertype'])>0:
- if bibentry['entrytype'] not in constraintinfo['pertype']:#
- setcontinue=False
- if len(constraintinfo['pernottype'])>0:
- if bibentry['entrytype'] in constraintinfo['pernottype']:#
- setcontinue=False
- print(setcontinue)
-
-
- overwrite=False
- for k,v in keyvals.items():
- #print(k,v)
- if k=='fieldsource':
- fieldsource=v.lower()
- elif k=='fieldtarget':
- fieldtarget=v.lower()
- mapfieldtype=1 #域map类型1,直接做域名转换
- elif k=='replace':
- fieldreplace=v
- mapfieldtype=2 #域map类型2,直接做域信息转换
- elif k=='final':
- fieldfinal=v #final要么选项不给出,要么选项给出为true
- if fieldfinal:#当为true时则做终止判断
- mapfieldtype=3 #域map类型3,做final判断可以终止map
- elif k=='overwrite':#
- overwrite=v
- elif k=='match':#不区分大小写的match
- fieldmatch=v
- elif k=='matchi':#区分大小写的match
- fieldmatchi=v
- elif k=='notmatch':#不区分大小写的notmatch,下面这两个选项的逻辑没有实现
- fieldnotmatch=v
- elif k=='notmatchi':#区分大小写的notmatch
- fieldnotmatch=v
- else:
- pass
-
-
- if setcontinue:
-
- #返回字典的第一项是fieldsource信息
- fieldsrcinfo['fieldsource']=fieldsource
-
- if mapfieldtype==0:#第0中情况即,不做信息转换,也不终止map,仅返回一些信息
-
- if fieldsource in bibentry:
- if fieldmatch:
- m = re.match(fieldmatch, bibentry[fieldsource])
- if m:
- fieldsrcinfo[fieldsource]=[bibentry[fieldsource],fieldmatch]
- else:
- fieldsrcinfo[fieldsource]=[None] #正则不匹配,则返回为None
-
- elif fieldmatchi:
- m = re.match(fieldmatchi, bibentry[fieldsource])
- if m:
- fieldsrcinfo[fieldsource]=[bibentry[fieldsource],fieldmatchi]
- else:
- fieldsrcinfo[fieldsource]=[None] #正则不匹配,则返回为None
-
- else:
- fieldsrcinfo[fieldsource]=bibentry[fieldsource]#将域的值记录下来,用于下一step
-
- else:
- fieldsrcinfo[fieldsource]=[None] #域不存在则返回为None
- return 1
-
-
- elif mapfieldtype==1:#第1中情况即,做域名转换
- print('fieldsource=',fieldsource,'fieldtarget=',fieldtarget)
- if fieldsource in bibentry:
- bibentry[fieldtarget]=bibentry[fieldsource]
- del bibentry[fieldsource]
- fieldsrcinfo[fieldsource]=bibentry[fieldtarget]
- else:
- fieldsrcinfo[fieldsource]=[None]
- return 1
-
-
- elif mapfieldtype==2:#域map类型2,直接做域信息转换,真正操作需要overwrite选项支持
- print('fieldsource=',fieldsource)
- print('fieldmatch=',fieldmatch)
- print('fieldreplace=',fieldreplace)
- if overwrite:
- if fieldsource in bibentry:
- if fieldmatch:
- #strafrpl=re.sub(r'(\d\d\d\d)\-(\d)\-(\d)',r'\1-0\2-0\3','2015-1-3')
- #strafrpl=re.sub(r'(\d\d\d\d)\-(\d)\-(\d)',r'\1-0\2-0\3',bibentry[fieldsource])
- strafrpl=re.sub(fieldmatch,fieldreplace,bibentry[fieldsource]) #执行替换
- print('strafterreplace=',strafrpl)
- bibentry[fieldsource]=strafrpl
- elif fieldmatchi:
- strafrpl=re.sub(fieldmatchi, fieldreplace,bibentry[fieldsource])
- bibentry[fieldsource]=strafrpl
- else:
- fieldsrcinfo[fieldsource]=[None]
- else:
- fieldsrcinfo[fieldsource]=[None]
- else:
- fieldsrcinfo[fieldsource]=[None]
- return 1
-
-
- elif mapfieldtype==3:#域map类型3,当没有匹配则终止map
- if fieldsource in bibentry:
- if fieldmatch:
- m = re.match(fieldmatch, bibentry[fieldsource])
- if m:
- fieldsrcinfo[fieldsource]=[bibentry[fieldsource],fieldmatch]
- return 1
- else:
- return 0
-
- elif fieldmatchi:
- if m:
- fieldsrcinfo[fieldsource]=[bibentry[fieldsource],fieldmatchi]
- return 1
- else:
- return 0
-
- else:
- fieldsrcinfo[fieldsource]=bibentry[fieldsource]#将域的值记录下来,用于下一step
- return 1
-
- else:
- return 0
-
- else:
- fieldsrcinfo[fieldsource]=[None]
- return 1
-
-
-
-
-
-#运行脚本测试
-if __name__=="__main__":
-
- #设置需要修改的bib文件
- #inputbibfile='example.bib'
- #inputbibfile='biblatex-map-test.bib'
- inputbibfile='eg-thesis.bib'
-
- #auxfile="opt-gbpub-true.aux"
- #set the aux file
- #this is not necessary
- auxfile=''
- #auxfile="opt-gbpub-true.aux"
-
- readfilecontents(inputbibfile)
-
- #printfilecontents()
-
- bibentryparsing()
-
- #printbibentries()
-
- execsourcemap()
-
- #printbibentries()
-
- writefilenewbib(inputbibfile)
-
- #print(bibentries[0])
-
- #print(formatbibentry(bibentries[0]))
-
- formatallbibliography()
- printbibliography()
-
\ No newline at end of file
Deleted: trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex_check.py
===================================================================
--- trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex_check.py 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex_check.py 2021-01-19 22:57:40 UTC (rev 57468)
@@ -1,590 +0,0 @@
-#!/usr/bin/env python
-
-"""
-BibLaTeX check on missing fields and consistent name conventions,
-especially developed for requirements in Computer Science.
-"""
-
-__author__ = "Pez Cuckow"
-__version__ = "0.1.4"
-__credits__ = ["Pez Cuckow", "BibTex Check 0.2.0 by Fabian Beck"]
-__license__ = "MIT"
-__email__ = "email<at>pezcuckow.com"
-
-####################################################################
-# Properties (please change according to your needs)
-####################################################################
-
-# links
-citeulikeUsername = "" # if no username is profided, no CiteULike links appear
-citeulikeHref = "http://www.citeulike.org/user/" + \
- citeulikeUsername + "/article/"
-
-libraries = [("Scholar", "http://scholar.google.de/scholar?hl=en&q="),
- ("Google", "https://www.google.com/search?q="),
- ("DBLP", "http://dblp.org/search/index.php#query="),
- ("IEEE", "http://ieeexplore.ieee.org/search/searchresult.jsp?queryText="),
- ("ACM", "http://dl.acm.org/results.cfm?query="),
- ]
-
-
-# fields that are required for a specific type of entry
-requiredFields = {"article": ["author", "title", "journaltitle/journal", "year/date"],
- "book": ["author", "title", "year/date"],
- "mvbook": "book",
- "inbook": ["author", "title", "booktitle", "year/date"],
- "bookinbook": "inbook",
- "suppbook": "inbook",
- "booklet": ["author/editor", "title", "year/date"],
- "collection": ["editor", "title", "year/date"],
- "mvcollection": "collection",
- "incollection": ["author", "title", "booktitle", "year/date"],
- "suppcollection": "incollection",
- "manual": ["author/editor", "title", "year/date"],
- "misc": ["author/editor", "title", "year/date"],
- "online": ["author/editor", "title", "year/date", "url"],
- "patent": ["author", "title", "number", "year/date"],
- "periodical": ["editor", "title", "year/date"],
- "suppperiodical": "article",
- "proceedings": ["title", "year/date"],
- "mvproceedings": "proceedings",
- "inproceedings": ["author", "title", "booktitle", "year/date"],
- "reference": "collection",
- "mvreference": "collection",
- "inreference": "incollection",
- "report": ["author", "title", "type", "institution", "year/date"],
- "thesis": ["author", "title", "type", "institution", "year/date"],
- "unpublished": ["author", "title", "year/date"],
-
- # semi aliases (differing fields)
- "mastersthesis": ["author", "title", "institution", "year/date"],
- "techreport": ["author", "title", "institution", "year/date"],
-
- # other aliases
- "conference": "inproceedings",
- "electronic": "online",
- "phdthesis": "mastersthesis",
- "www": "online",
- "school": "mastersthesis"
- }
-
-####################################################################
-#import os
-import string
-import re
-import sys
-from optparse import OptionParser
-
-# Parse options
-usage = sys.argv[
- 0] + " [-b|--bib=<input.bib>] [-a|--aux=<input.aux>] [-o|--output=<output.html>] [-v|--view] [-h|--help]"
-
-parser = OptionParser(usage)
-
-parser.add_option("-b", "--bib", dest="bibFile",
- help="Bib File", metavar="input.bib", default="input.bib")
-
-parser.add_option("-a", "--aux", dest="auxFile",
- help="Aux File", metavar="input.aux", default="references.aux")
-
-parser.add_option("-o", "--output", dest="htmlOutput",
- help="HTML Output File", metavar="output.html")
-
-parser.add_option("-v", "--view", dest="view", action="store_true",
- help="Open in Browser")
-
-parser.add_option("-N", "--no-console", dest="no_console", action="store_true",
- help="Do not print problems to console")
-
-(options, args) = parser.parse_args()
-
-# Backporting Python 3 open(encoding="utf-8") to Python 2
-# based on http://stackoverflow.com/questions/10971033/backporting-python-3-openencoding-utf-8-to-python-2
-
-if sys.version_info[0] > 2:
- # py3k
- pass
-else:
- # py2
- import codecs
- import warnings
- reload(sys)
- sys.setdefaultencoding('utf8')
- def open(file, mode='r', buffering=-1, encoding=None,
- errors=None, newline=None, closefd=True, opener=None):
- if newline is not None:
- warnings.warn('newline is not supported in py2')
- if not closefd:
- warnings.warn('closefd is not supported in py2')
- if opener is not None:
- warnings.warn('opener is not supported in py2')
- return codecs.open(filename=file, mode=mode, encoding=encoding,
- errors=errors, buffering=buffering)
-
-### End Backport ###
-
-print("INFO: Reading references from '" + options.bibFile + "'")
-try:
- fIn = open(options.bibFile, 'r', encoding="utf8")
-except IOError as e:
- print("ERROR: Input bib file '" + options.bibFile +
- "' doesn't exist or is not readable")
- sys.exit(-1)
-
-if options.no_console:
- print("INFO: Will surpress problems on console")
-
-if options.htmlOutput:
- print("INFO: Will output HTML to '" + options.htmlOutput + "'"
- + (" and auto open in the default web browser" if options.view else ""))
-else:#output a default file if -o option is not provided
- options.htmlOutput=options.bibFile.repalce('.bib','.html')
-
-# Filter by reference ID's that are used
-usedIds = set()
-if options.auxFile:
- print("INFO: Filtering by references found in '" + options.auxFile + "'")
- try:
- fInAux = open(options.auxFile, 'r', encoding="utf8")
- for line in fInAux:
- if line.startswith("\\citation"):
- ids = line.split("{")[1].rstrip("} \n").split(", ")
- for id in ids:
- if (id != ""):
- usedIds.add(id)
- fInAux.close()
- except IOError as e:
- print ("WARNING: Aux file '" + options.auxFile +
- "' doesn't exist -> not restricting entries")
-
-
-# Go through and check all references
-completeEntry = ""
-currentId = ""
-ids = []
-currentType = ""
-currentArticleId = ""
-currentTitle = ""
-fields = []
-problems = []
-subproblems = []
-
-counterMissingFields = 0
-counterFlawedNames = 0
-counterWrongTypes = 0
-counterNonUniqueId = 0
-counterWrongFieldNames = 0
-
-removePunctuationMap = dict((ord(char), None) for char in string.punctuation)
-
-for line in fIn:
- line = line.strip("\n")
- if line.startswith("@"):
- if currentId in usedIds or not usedIds:
- for fieldName, requiredFieldsType in requiredFields.items():
- if fieldName == currentType.lower():
- # alises use a string to point at another set of fields
- currentRequiredFields = requiredFieldsType
- while isinstance(currentRequiredFields, str):
- currentRequiredFields = requiredFields[currentRequiredFields] # resolve alias
-
- for requiredFieldsString in currentRequiredFields:
- # support for author/editor syntax
- typeFields = requiredFieldsString.split('/')
-
- # at least one the required fields is not found
- if set(typeFields).isdisjoint(fields):
- subproblems.append(
- "missing field '" + requiredFieldsString + "'")
- counterMissingFields += 1
- else:
- subproblems = []
-
- if currentId in usedIds or (currentId and not usedIds):
- cleanedTitle = currentTitle.translate(removePunctuationMap)
- problem = "<div id='" + currentId + \
- "' class='problem severe" + str(len(subproblems)) + "'>"
- problem += "<h2>" + currentId + " (" + currentType + ")</h2> "
- problem += "<div class='links'>"
- if citeulikeUsername:
- problem += "<a href='" + citeulikeHref + \
- currentArticleId + "' target='_blank'>CiteULike</a> |"
-
- list = []
- for name, site in libraries:
- list.append(
- " <a href='" + site + cleanedTitle + "' target='_blank'>" + name + "</a>")
- problem += " | ".join(list)
-
- problem += "</div>"
- problem += "<div class='reference'>" + currentTitle
- problem += "</div>"
- problem += "<ul>"
- for subproblem in subproblems:
- problem += "<li>" + subproblem + "</li>"
- if not options.no_console:
- print("PROBLEM: " + currentId + " - " + subproblem)
- problem += "</ul>"
- problem += "<form class='problem_control'><label>checked</label><input type='checkbox' class='checked'/></form>"
- problem += "<div class='bibtex_toggle'>Current BibLaTex Entry</div>"
- problem += "<div class='bibtex'>" + completeEntry + "</div>"
- problem += "</div>"
- problems.append(problem)
- fields = []
- subproblems = []
- currentId = line.split("{")[1].rstrip(",\n")
- if currentId in ids:
- subproblems.append("non-unique id: '" + currentId + "'")
- counterNonUniqueId += 1
- else:
- ids.append(currentId)
- currentType = line.split("{")[0].strip("@ ")
- completeEntry = line + "<br />"
- else:
- if line != "":
- completeEntry += line + "<br />"
- if currentId in usedIds or not usedIds:
- if "=" in line:
- # biblatex is not case sensitive
- field = line.split("=")[0].strip().lower()
- fields.append(field)
- value = line.split("=")[1].strip("{} ,\n")
- if field == "author":
- currentAuthor = filter(
- lambda x: not (x in "\\\"{}"), value.split(" and ")[0])
- if field == "citeulike-article-id":
- currentArticleId = value
- if field == "title":
- currentTitle = re.sub(r'\}|\{', r'', value)
-
- ###############################################################
- # Checks (please (de)activate/extend to your needs)
- ###############################################################
-
- # check if type 'proceedings' might be 'inproceedings'
- if currentType == "proceedings" and field == "pages":
- subproblems.append(
- "wrong type: maybe should be 'inproceedings' because entry has page numbers")
- counterWrongTypes += 1
-
- # check if abbreviations are used in journal titles
- if currentType == "article" and (field == "journal" or field == "journaltitle"):
-
- if "." in line:
- subproblems.append(
- "flawed name: abbreviated journal title '" + value + "'")
- counterFlawedNames += 1
-
- # check booktitle format; expected format "ICBAB '13: Proceeding of the 13th International Conference on Bla and Blubb"
- # if currentType == "inproceedings" and field == "booktitle":
- # if ":" not in line or ("Proceedings" not in line and "Companion" not in line) or "." in line or " '" not in line or "workshop" in line or "conference" in line or "symposium" in line:
- #subproblems.append("flawed name: inconsistent formatting of booktitle '"+value+"'")
- #counterFlawedNames += 1
-
- # check if title is capitalized (heuristic)
- # if field == "title":
- # for word in currentTitle.split(" "):
- #word = word.strip(":")
- # if len(word) > 7 and word[0].islower() and not "-" in word and not "_" in word and not "[" in word:
- #subproblems.append("flawed name: non-capitalized title '"+currentTitle+"'")
- #counterFlawedNames += 1
- # break
-
- ###############################################################
-
-fIn.close()
-
-
-problemCount = counterMissingFields + counterFlawedNames + counterWrongFieldNames + counterWrongTypes + counterNonUniqueId
-
-# Write out our HTML file
-if options.htmlOutput:
- html = open(options.htmlOutput, 'w', encoding="utf8")
- html.write("""<!doctype html>
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-<title>BibLatex Check</title>
-<style>
-body {
- font-family: Calibri, Arial, Sans;
- padding: 10px;
- width: 1030px;
- margin: 10px auto;
- border-top: 1px solid black;
-}
-
-#title {
- width: 720px;
- border-bottom: 1px solid black;
-}
-
-#title h1 {
- margin: 10px 0px;
-}
-
-#title h1 a {
- color: black;
- text-decoration: none;
-}
-
-#control {
- clear: both;
-}
-
-#search {
- float: left;
-}
-
-#search input {
- width: 300px;
- font-size: 14pt;
-}
-
-#mode {
- text-align: right;
-}
-
-#mode label:first-child {
- font-weight: bold;
-}
-
-#mode input {
- margin-left: 20px;
-}
-
-.info {
- margin-top: 10px;
- padding: 10px;
- background: #FAFADD;
- width: 250px;
- float: right;
- box-shadow: 1px 1px 1px 1px #ccc;
- clear: both;
-}
-
-.info h2 {
- font-size: 12pt;
- padding: 0px;
- margin: 0px;
-}
-
-.problem {
- margin-top: 10px;
- margin-bottom: 10px;
- padding: 10px;
- background: #FFBBAA;
- counter-increment: problem;
- width: 700px;
- border: 1px solid #993333;
- border-left: 5px solid #993333;
- box-shadow: 1px 1px 1px 1px #ccc;
- float: left;
-}
-
-.active {
- box-shadow: 5px 5px 3px 3px #ccc;
- position: relative;
- top: -2px;
-}
-
-.severe0 {
- background: #FAFAFA;
- border: 1px solid black;
- border-left: 5px solid black;
-}
-
-.severe1 {
- background: #FFEEDD;
-}
-
-.severe2 {
- background: #FFDDCC;
-}
-
-.severe3 {
- background: #FFCCBB;
-}
-
-.problem_checked {
- border: 1px solid #339933;
- border-left: 5px solid #339933;
-}
-
-.problem h2:before {
- content: counter(problem) ". "; color: gray;
-}
-
-.problem h2 {
- font-size: 12pt;
- padding: 0px;
- margin: 0px;
-}
-
-.problem .links {
- float: right;
- position:relative;
- top: -22px;
-}
-
-.problem .links a {
- color: #3333CC;
-}
-
-.problem .links a:visited {
- color: #666666;
-}
-
-.problem .reference {
- clear: both;
- font-size: 9pt;
- margin-left: 20px;
- font-style:italic;
- font-weight:bold;
-}
-
-.problem ul {
- clear: both;
-}
-
-.problem .problem_control {
- float: right;
- margin: 0px;
- padding: 0px;
-}
-
-.problem .bibtex_toggle{
- text-decoration: underline;
- font-size: 9pt;
- cursor: pointer;
- padding-top: 5px;
-}
-
-.problem .bibtex {
- margin-top: 5px;
- font-family: Monospace;
- font-size: 8pt;
- display: none;
- border: 1px solid black;
- background-color: #FFFFFF;
- padding: 5px;
-}
-</style>
-<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
-<script>
-
-function isInProblemMode() {
- return $('#mode_problems:checked').val() == 'problems'
-}
-
-function update() {
- $('.problem').hide();
- $('.problem[id*='+$('#search input').val()+']').show();
- $('.problem .checked').each(function () {
- if ($(this).attr('checked')) {
- $(this).parents('.problem').addClass('problem_checked');
- } else {
- $(this).parents('.problem').removeClass('problem_checked');
- }
- });
- if (isInProblemMode()) {
- $('.severe0').hide();
- $('.problem_checked').hide();
- }
-}
-
-$(document).ready(function(){
-
- $(".bibtex_toggle").click(function(event){
- event.preventDefault();
- $(this).next().slideToggle();
- });
-
- $('#search input').live('input', function() {
- update();
- });
-
- $('#mode input').change(function() {
- update();
- });
-
- $("#uncheck_button").click(function(){
- $('.problem .checked').attr('checked',false);
- localStorage.clear();
- update();
- });
-
- $('.problem a').mousedown(function(event) {
- $('.problem').removeClass('active');
- $(this).parents('.problem').addClass('active');
- });
-
- $('.problem .checked').change(function(event) {
- var problem = $(this).parents('.problem');
- problem.toggleClass('problem_checked');
- var checked = problem.hasClass('problem_checked');
- localStorage.setItem(problem.attr('id'),checked);
- if (checked && isInProblemMode()) {
- problem.slideUp();
- }
- });
-
- $('.problem .checked').each(function () {
- $(this).attr('checked',localStorage.getItem($(this).parents('.problem').attr('id'))=='true');
- });
- update();
-});
-
-</script>
-</head>
-<body>
-<div id="title">
-<h1><a href='http://github.com/pezmc/BibLatex-Check'>BibLaTeX Check</a></h1>
-<div id="control">
-<form id="search"><input placeholder="search entry ID ..."/></form>
-<form id="mode">
-<label>show entries:</label>
-<input type = "radio"
- name = "mode"
- id = "mode_problems"
- value = "problems"
- checked = "checked" />
- <label for = "mode_problems">problems</label>
- <input type = "radio"
- name = "mode"
- id = "mode_all"
- value = "all" />
- <label for = "mode_all">all</label>
-<input type="button" value="uncheck all" id="uncheck_button"></button>
-</form>
-<br style="clear: both; " />
-</div>
-</div>
-""")
- html.write("<div class='info'><h2>Info</h2><ul>")
- html.write("<li>bib file: " + options.bibFile + "</li>")
- html.write("<li>aux file: " + options.auxFile + "</li>")
- html.write("<li># entries: " + str(len(problems)) + "</li>")
- html.write("<li># problems: " + str(problemCount) + "</li><ul>")
- html.write("<li># missing fields: " + str(counterMissingFields) + "</li>")
- html.write("<li># flawed names: " + str(counterFlawedNames) + "</li>")
- html.write("<li># wrong types: " + str(counterWrongTypes) + "</li>")
- html.write("<li># non-unique id: " + str(counterNonUniqueId) + "</li>")
- html.write("<li># wrong field: " + str(counterWrongFieldNames) + "</li>")
- html.write("</ul></ul></div>")
-
- problems.sort()
- for problem in problems:
- html.write(problem)
- html.write("</body></html>")
- html.close()
-
- if options.view:
- import webbrowser
- webbrowser.open(html.name)
-
- print("SUCCESS: Report {} has been generated".format(options.htmlOutput))
-
-if problemCount > 0:
- print("WARNING: Found {} problems.".format(problemCount))
- sys.exit(-1)
Modified: trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/example.bib
===================================================================
--- trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/example.bib 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/example.bib 2021-01-19 22:57:40 UTC (rev 57468)
@@ -502,7 +502,7 @@
DATE = {1993},
number={7},
PAGES = {50-58},
- journaltitle={ Отечестsенная гелогия}
+ journaltitle={Отечестsенная гелогия}
}
%%Кочекоs А Я. Молибден-медно-эолотопорфиооое месторождение Рябиноосе[J/ОL]. ,1993(7):50-58
Deleted: trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gb7714texteg.dat
===================================================================
--- trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gb7714texteg.dat 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gb7714texteg.dat 2021-01-19 22:57:40 UTC (rev 57468)
@@ -1,214 +0,0 @@
-[14] ANDERSEN J B, RAPPAPORT T S, YOSHIDA S. Propagation measurements and models for wireless communications channels[J]. IEEE Commun. Mag., 1995, 33(1): 42–49.
-[49] 陈高峰. 基于开放式框架的交叉开发环境设计与实现[J]. 煤炭技术, 2011, 30(6): 230–232.
-[51] 陈金成, 杨海威, 钟廷修. 一种开放式体系结构经济型数控装置的研制[J]. 上海交通大学学报, 2001, 35(12): 1861–1864.
-[52] 高光明. 信号情报接收机的发展现状及趋势[J]. 电讯技术, 1998, 38(2): 60–65.
-[53] 高翔, 李辰. 复杂航电架构的开放式系统标准研究[J]. 航空电子技术, 2015, 46(2): 26–31.
-[55] 李炳穆. 理想的图书管理员和信息专家的素养与形象[J]. 图书情报工作, 2000(2): 5–8.
-[48] ZHAO L, HAIMOVICH A M. Performance of ultra-wideband communications in the presence of interference[J]. IEEE J. Sel. Areas Commun., 2002, 20(9): 1684–1691.
-[8] 张敏莉, 易仕和, 赵玉新. 超声速短化喷管的设计和试验研究[J]. 空气动力学报, 2007, 25(4): 500–503.
-
-[47] WALLS S C, BARICHIVICH W J, BROWN M E. Drought, deluge and declines: the impact of precipition extremes on amphibians in a changing climate[J/OL]. Biology, 2013, 2(1): 399–418[2013–11–04]. http://www.mdpi.com.
-[50] 陈建军. 从数字地球到智慧地球[J/OL]. 国图资源导刊, 2010, 7(10): 93 [2013–03–20]. http://d.g.wanfangdata.com.cn. doi: 10.3969/j.issn.1672-5603.2010.10.038.
-[54] 江向东. 互联网环境下的信息处理与图书管理系统解决方案[J/OL]. 情报学报, 1999, 18(2): 4[2000–01–18]. http://www.chinainfo.gov.cn/periodical/qbxb/qbxb99/qbxb990203.
-[7] 储大同. 恶性肿瘤个体化治疗靶向药物的临床表现[J/OL]. 中华肿瘤杂志, 2010, 32(10): 721–724[2014–06–25]. http://www.sohu.com. doi: 10.7666/d.y351065.
-[9] 储大同. 恶性肿瘤个体化治疗靶向药物的临床表现[J/OL]. 中华肿瘤杂志, 2010, 32(9/10): 721–724 [2014–06–25]. http://www.sohu.com. doi: 10.7666/d.y351065.
-
-[10] 丁文祥. 数字革命与竞争国际化[N]. 中国青年报, 2000–11–20(15).
-[11] 傅刚, 赵承, 李佳路. 大风沙过后的思考[N/OL]. 北京青年报, 2000–04–12(14) [2005–07–12]. http://www.bjyouth.com.cn/Bqb/20000412/GB/4216%5ED0412B1401.htm.
-[12] 刘裕国, 杨柳, 张洋, 等. 雾霾来袭,如何突围[N/OL]. 人民日报, 2013–01–12 [2013–11–06]. http://paper.people.com.cn.
-[13] 张田勤. 犯罪 DNA 库与生命伦理学计划[N]. 大众科技报, 2000–11–12(7).
-
-
-
-
-[2] CHIANI M, CONTI A, TRALLI V. Further results on convolutional code search for blockfading channels[J]. IEEE Trans. Inf. Theory, 2004, 50(6): 1312–1318.
-[2] CHIANI M, CONTI A, TRALLI V. Further results on convolutional code search for blockfading channels[J]. IEEE Trans. Inf. Theory, 2004, 50(6).
-[2] CHIANI M, CONTI A, TRALLI V. Further results on convolutional code search for blockfading channels[J]. IEEE Trans. Inf. Theory, 2004, 50: 1312–1318.
-[2] CHIANI M, CONTI A, TRALLI V. Further results on convolutional code search for blockfading channels[J]. IEEE Trans. Inf. Theory, 2004(6): 1312–1318.
-[2] CHIANI M, CONTI A, TRALLI V. Further results on convolutional code search for blockfading channels[J]. IEEE Trans. Inf. Theory, 50(6): 1312–1318.
-[2] CHIANI M, CONTI A, TRALLI V. Further results on convolutional code search for blockfading channels[J]. IEEE Trans. Inf. Theory, 2004, 50.
-[2] CHIANI M, CONTI A, TRALLI V. Further results on convolutional code search for blockfading channels[J]. IEEE Trans. Inf. Theory, 2004(6).
-[2] CHIANI M, CONTI A, TRALLI V. Further results on convolutional code search for blockfading channels[J]. IEEE Trans. Inf. Theory, 50(6).
-[2] CHIANI M, CONTI A, TRALLI V. Further results on convolutional code search for blockfading channels[J]. IEEE Trans. Inf. Theory, 2004: 1312–1318.
-[2] CHIANI M, CONTI A, TRALLI V. Further results on convolutional code search for blockfading channels[J]. IEEE Trans. Inf. Theory, 50: 1312–1318.
-
-[1] 中国地质学会. 地质评论[J]. 1936, 1(1)–. 北京: [出版者不详], 1936–.
-[2] 中国图书馆学会. 图书馆学通信[J]. 1957(1)–1990(4). 北京: 北京图书馆, 1957–1990.
-[3] American Association for the Advancement of Science. Science[J]. 1883, 1(1)–. Washington, D.C.: [s.n.], 1883–.
-[4] 中华医学会湖北分会. 临床内科杂志[J]. 1984, 1(1)–. 武汉: 中华医学会湖北分会, 1984–.
-[8] 张敏莉, 易仕和, 赵玉新. 超声速短化喷管的设计和试验研究[J]. 空气动力学报, 2007, 25(4): 500–503.
-[8] ZHANG M L, YI S H, ZHAO Y X. The design and experimental investigations of supersonic length shorted nozzle[J]. ACTA AERODYNAMICA SINICA, 2007, 25(4): 500–503.
-[14] ANDERSEN J B, RAPPAPORT T S, YOSHIDA S. Propagation measurements and models for wireless communications channels[J]. IEEE Commun. Mag., 1995, 33(1): 42–49.
-[15] ANDRISANO O, TRALLI V, VERDONE R. Millimeter waves for short-range multimedia communication systems[J]. Proc. IEEE, 1998, 86(7): 1383–1401.
-[16] CAPLAN P. Cataloging internet resources[J]. The public Access Computer Systems Review, 1993, 4(2): 61–66.
-[7] 储大同. 恶性肿瘤个体化治疗靶向药物的临床表现[J/OL]. 中华肿瘤杂志, 2010, 32(10): 721–724[2014–06–25]. http://www.sohu.com. doi: 10.7666/d.y351065.
-
-
-[1] 韩吉人. 论职工教育的特点[G]//中国职工教育研究会. 职工教育研究论文集. 北京: 人民教育出版社, 1985: 90–99.
-[2] FOURNEY M E. Advances in holographic photoelasticity[C]//Symposium on Applications of Holography in Mechanics, August 23-25, 1971, University of Southern California, Los Angeles, California. New York: ASME, 1971: 17–38.
-[3] FOURNEY M E. Advances in holographic photoelasticity[C]//American Society of Mechanical Engineers.Applied Mechanics Division. Symposium on Applications of Holography in Mechanics, August 23-25, 1971. University of Southern California, Los Angeles, California. New York: ASME, 1971: 17–38.
-[4] NEMEC B. Force control of redundant robots[C]//Processings of Symposium on Robot Control. [S.l.]: [s.n.], 1997: 209–214.
-[5] 贾东琴, 柯平. 面向数字素养的高校图书馆数字服务体系研究[C]//中国图书馆学会. 中国图书馆学会年会论文集:2011 年卷. 北京: 国家图书馆出版社, 2011: 45–52.
-[6] 裴丽生. 在中国科协技术期刊编辑工作经验交流会上的讲话[C]//中国科学技术协会学会工作部. 中国科协学术期刊编辑工作经验交流会资料选. 北京: 中国科学技术协会学会工作部, 1981: 2–10.
-[7] 汪学军. 中国农业转基因生物研发进展与安全管理[C]//国家环境保护总局生物安全管理办公室. 中国国家生物安全框架实施国际合作项目研讨会论文集. 北京: 中国环境科学出版社, 2002: 22–25.
-[8] 张忠智. 科技书刊的总编 (主编) 的角色要求[C]//中国科学技术期刊编辑学会学术委员会. 中国科学技术期刊编辑学会建会十周年学术研讨会论文汇编. 北京: 中国科学技术期刊编辑学会学术委员会, 1997: 33–34.
-[9] CHOI J D, STARK W E. Performance analysis of ultra-wideband spread-spectrum communications in narrowband interference[C]//Proc. IEEE Military Commun. Conf. (MILCOM). Vol. 2. Anaheim, CA: [s.n.], 2002: 1075–1080.
-[10] DARDARI D, PASOLINI G. Simple and accurate models for error probability evaluation of IEEE802.11 DS-SS physical interface in the presence of Bluetooth interference[C]//Proc. IEEE Global Telecommun. Conf. (GLOBECOM). Vol. 1. Taipei: [s.n.], 2002: 201–206.
-[11] FIROOZBAKHSH B, PRATT T G, JAYANT N. Analysis of IEEE 802.11a interference on UWB systems[C]//Proc. of IEEE Conference on Ultrawideband Systems and Technologies (UWBST). Oulu, Finland: [s.n.], 2003: 473–477.
-[12] FOERSTER J R. Interference modeling of pulse-based UWB waveforms on narrowband systems[C]//Proc. IEEE Veh. Technol. Conf. Vol. 4. Birmingham, AL: [s.n.], 2002: 1931–1935.
-[13] FONTANA R J. An insight into UWB interference from a shot noise perspective[C]//Proc. of IEEE Conference on Ultrawideband Systems and Technologies (UWBST). Baltimore, MD: [s.n.], 2002: 309–313.
-[14] GIORGETTI A. Coexistence of UWB and narrowband systems in Nakagami/Rice channels[C]//Proc. Int. Symp. on Wireless Personal Multimedia Commun. (WPMC). Aalborg, Denmark: [s.n.], 2005: 794–798.
-[15] GIORGETTI A, CHIANI M, DARDARI D. Coexistence issues in cognitive radios based on ultra-wide bandwidth systems[C]//Proc. IEEE Int. Conf. on Cognitive Radio Oriented Wireless Net. and Comm. (CROWNCOM). Mykonos, Greece: [s.n.], 2006.
-[16] LI Y, MOLISCH A F, ZHANG J. Practical approaches to channel estimation and interference suppression for OFDM based UWB communications[C]//Proc. of the IEEE 6th Circ. and Syst., Symp. on Emerging Technologies: Frontiers of Mobile and Wireless Communication. Vol. 1. [S.l.]: [s.n.], 2004: 21–24.
-[17] NASRI A, SCHOBER R, LAMPE L. Performance Evaluation of BICM-OFDM Systems Impaired by UWB Interference[C]//Proc. IEEE Int. Conf. on Commun. Beijing, China: [s.n.], 2008: 3616–3621.
-[18] PIAZZO L. UWB EM compatibility and coexistence issues[C]//Proc. 1st Int. Workshop on Networking with UWB. Rome, Italy: [s.n.], 2001.
-[19] 陈志勇. 中国财税文化价值研究:“中国财税文化国际学术研讨会”论文集[C/OL]. 北京: 经济科学出版社, 2011 [2013–10–14]. http://apabi.lib.pku.edu.cn.
-[20] 雷光春. 综合湿地管理: 综合湿地管理国际研讨会论文集[C]. 北京: 海洋出版社, 2012.
-[21] ROSENTHALL E M. Proceedings of the Fifth Canadian Mathematical Congress, University of Montreal, 1961[C]. Toronto: University of Toronto Press, 1963.
-[22] GANZHA V G, MAYR E W, VOROZHTSOV E V. Computer algebra in scientific computing:CASC 2000:proceedings of the Third Workshop on Computer Algebra in Scientific Computing, Samarkand, October 5-9, 2000[C]. Berlin: Springer, 2000.
-[23] BABU B V, NAGAR A K, DEEP K, et al. Proceedings of the second international conference on soft computing for problem solving, December 28-30[C]. New Delhi: Springer, 2014.
-[24] 中国力学学会. 第 3 届全国实验流体力学学术会议论文集[C]. 天津: [出版者不详], 1999.
-[25] 中国社会科学院台湾史研究中心. 台湾光复六十五周年暨抗战史实学术研讨会论文集[C]. 北京: 九州出版社, 2012.
-
-
-[8] LEHMAN P, KIME P, BORUVKA A, et al. The biblatex Package: Programmable Bibliographies and Citations[A]. version 2.8a. 2013.
-[9] LEHMAN P, KIME P, BORUVKA A, et al. The Biblatex Package: Programmable Bibliographies and Citations[A]. 3.0. 2015.
-[10] MITTELBACH F. An environment for multicolumn output[A]. 2015.
-[11] OETIKER T, PARTL H, HYNA I, et al. The Not So Short Introduction to L ATEX 2ε[A]. 2011.
-[12] ROBERTSON W, WILSON P, PRESS H. The ccaption package[A]. v3.2c. 2011.
-[13] SOMMERFELDT A. Customizing captions of floating environments[A/OL]. 2011. http://sourceforge.net/projects/latex-caption/.
-[14] UMEKI H. The geometry package[A]. v5.6. 2010.
-[15] 胡振震. 符合 GB7714-2015 标准的 biblatex 参考文献样式文件[A]. 2016.
-[16] 吴凌云. CTEX FAQ: 常见问题集[A]. version 0.4. 2007.
-[17] 中国第一历史档案馆, 辽宁省档案馆. 中国明朝档案总汇[A]. 桂林: 广西师范大学出版社, 2001.
-[18] 包太雷. LaTeX Notes: 雷太赫排版系统简介[Z]. 2013.
-[1] CALKIN D, AGER A, THOMPSON M. A comparative risk assessment framework for wildland fire management: the 2010 cohesive strategy Science report:RMRS-GTR-262[R]. 2011: 8–9.
-[2] EGGRERS A J. One-dimensional flows of an imperfect diatomic gas[R]. NACA report 959.
-[3] HUMPHREY R L, WAGNER J L. The sonic throat method and real gas one-dimensional flow: an application to air and nitrogen[R]. AD 730029. 1971.
-[4] U.S. Department of Transportation Federal Highway Administration. Guidelines for handling excavated acid-producing materials, PB 91-194001[R]. Springfield: U.S. Department of Commerce National Information Service, 1990.
-[5] World Health Organization. Factors regulating the immune response: report of WHO Scientific Group[R]. Geneva: WHO, 1970.
-[6] 汤万金, 杨跃翔, 刘文, 等. 人体安全重要技术标准研制最终报告:7178999X[R/OL]. 2013 [2014–06–24]. http://www.nstrs.org.cn.
-[7] 中华人民共和国国务院新闻办公室. 国防白皮书: 中国武装力量的多样化运用[R/OL]. 2013 [2014–06–11]. http://www.mod.gov.cn.
-
-[1] Commonwealth libraries bureau of library development.Pennsylvania department of education office. Pennsylvania library laws[EB/OL]. [2013–03–24]. http://www.racc.edu.
-[3] Omg Inc. Unified Modeling Language: Superstructure[EB/OL]. (2003). http://www.omg.org.
-[4] Online Computer Library Center, Inc. History of OCLC[EB/OL]. [2000–01–08]. http://www.oclc.org/about/history/default.htm.
-[2] HOPKINSON A. UNIMARC and metadata: Dublin Core[EB/OL]. [1999–12–08]. http://www.rfla.org/IV/rfla64/13801613.htm.
-[5] 李强. 化解医患矛盾需釜底抽薪[EB/OL]. (2012–05–03) [2013–03–25]. http://wenku.baidu.com.
-[6] 萧钰. 出版业信息化迈入快车道[EB/OL]. (2001–12–19) [2002–04–15]. http://www.creader.com/news/20011219/200112190019.html.
-[7] WiMedia Alliance[EB/OL]. www.wimedia.org.
-[8] Dublin Core metadata element set: version 1.1[EB/OL]. (2012–06–14) [2014–06–11]. http://dublincore.org.
-[9] JabRef 中文手册[EB/OL]. http://blog.csdn.net/zd0303/article/details/7676807.
-[10] PACS-L:the public-access computer systems forum[EB/OL]. (1989) [1995–05–17]. http://info.lib.uh.edu/pacsl.html.
-
-[33] 全国信息文献标准化技术委员会. 文献著录: 第 4 部分 非书资料:GB/T3792.4-2009[S]. 北京: 中国标准出版社, 2010: 3.
-[34] 全国广播电视标准化技术委员会. 广播电视音像资料编目规范: 第 2 部分 广播资料:GY/T202.2-2007[S]. 北京: 国家广播电影电视局广播电视规划院, 2007: 1.
-[35] 国家环境保护局科技标准司. 土壤环境质量标准:GB 15616-1995[S/OL]. 北京: 中国标准出版社, 1996: 2–3 [2013–10–14]. http://wenku.baidu.com.
-[36] Information and documdocument-the Dublin core metadata element set:ISO 15836:2009[S/OL].[2013–03–24]. http://www.iso.org.
-[40] 国家标准局信息分类编码研究所. 世界各国和地区名称代码 GB/T 2659-1986[S]//全国文献工作标准化技术委员会. 文献工作国家标准汇编: 3. 北京: 中国标准出版社, 1988: 59–92.
-[41] 宋史卷三: 本纪第三[M/OL]//李承森. 宋史: 第 1 册. 北京: 中华书局, 2011: 11–12 [2013–05–09]. http://apabi.lib.pku.edu.cn.
-
-[1] CALMS R B. Infrared spectroscopic studies on solid oxygen[D]. Berkeley: Univ. of California, 1965.
-[4] 张若凌. 高超声速非平衡流动的计算和实验研究[D]. 绵阳: 中国空气动力研究与发展中心, 2004.
-[5] 张志祥. 间断动力系统的随机扰动及其在守恒律方程中的应用[D]. 北京: 北京大学数学学院, 1998.
-[2] 马欢. 人类活动影响下海河流域典型区水循环变化分析[D/OL]. 北京: 清华大学, 2011: 27 [2013–10–14]. http://www.cnki.net.
-[3] 吴云芳. 面向中文信息处理的现代汉语并列结构研究[D/OL]. 北京: 北京大学, 2003 [2013–10–14]. http://thesis.lib.pku.edu.cn.
-
-[2] 中国职工教育研究会. 职工教育研究论文集[G]. 北京: 人民教育出版社, 1985.
-[1] 韩吉人. 论职工教育的特点[G]//中国职工教育研究会. 职工教育研究论文集. 北京: 人民教育出版社, 1985: 90–99.
-[1] KOSEKI A, MOMOSE H, KAWAHITO M, et al. Compiler: US828402[P/OL]. 2002–05–25[2002–05–28]. http://FF&p=1&u=netahtml/PTO/search-bool.html&r=5&f=G&l=50&col=AND&d=PG01&sl=IBM.AS.&0S=AN/IBM&RS=AN/IBM.
-[2] TACHIBANA R, SHIMIZU S, KOBAYSHI S, et al. Electronic watermarking method and system: US6915001[P/OL]. 2002–04–25 [2002–05–28]. http://patftuspto.gov/netacgi/nphParser?%20Seetl=PTO2&Sect2=HITOFF&=1&u=/netahhml/search-bool.html%20&r=1&f=G&1=50&col=AND&d=ptxt&sl=%60Electronic+watermarking+method+system'.TTL.&OS=TTL/.
-[3] 河北绿洲生态环境科技有限公司. 一种荒漠化地区生态植被综合培育种植方法: 01129210.5[P/OL]. 2001–10–24 [2002–05–28]. http://211.152.9.47/sipoasp/zlijs/hyjs-yx-new.asp?recid=01129210.5&leixin.27
-[4] 姜锡洲. 一种温热外敷药制备方案: 中国: 88105607.3[P]. 1989–07–26.
-[5] 刘加林. 多功能一次性压舌板: 92214985.2[P]. 1993–04–14.
-[6] 西安电子科技大学. 光折变自适应光外差探测方法: 01128777.2[P/OL]. 2002–03–06 [2002–05–28]. http://211.152.9.47/sipoasp/zljs/hyjs-yx-new.asp?recid=01128777.2&leixin=0.
-[7] 张凯军. 轨道火车及高速轨道火车紧急安全制动辅助装置: 201220158825.2[P]. 2012–04–05.
-
-[1] Commonwealth libraries bureau of library development.Pennsylvania department of education office. Pennsylvania library laws[EB/OL]. [2013–03–24]. http://www.racc.edu.
-[2] HOPKINSON A. UNIMARC and metadata: Dublin Core[EB/OL]. [1999–12–08]. http://www.rfla.org/IV/rfla64/13801613.htm.
-[3] Omg Inc. Unified Modeling Language: Superstructure[EB/OL]. (2003). http://www.omg.org.
-[4] Online Computer Library Center, Inc. History of OCLC[EB/OL]. [2000–01–08]. http://www.oclc.org/about/history/default.htm.
-[5] 李强. 化解医患矛盾需釜底抽薪[EB/OL]. (2012–05–03) [2013–03–25]. http://wenku.baidu.com.
-[6] 萧钰. 出版业信息化迈入快车道[EB/OL]. (2001–12–19) [2002–04–15]. http://www.creader.com/news/20011219/200112190019.html.
-[7] WiMedia Alliance[EB/OL]. www.wimedia.org.
-[8] Dublin Core metadata element set: version 1.1[EB/OL]. (2012–06–14) [2014–06–11]. http://dublincore.org.
-[9] JabRef 中文手册[EB/OL]. http://blog.csdn.net/zd0303/article/details/7676807.
-[10] PACS-L:the public-access computer systems forum[EB/OL]. (1989) [1995–05–17]. http://info.lib.uh.edu/pacsl.html.
-
-[38] 白书农. 植物开花研究[M]//李承森. 植物科学进展. 北京: 高等教育出版社, 1998: 146–163.
-[42] 楼梦麟, 杨燕. 汶川地震基岩地震动特征分析[M/OL]//同济大学土木工程防灾国家重点实验室. 汶川地震震害研究. 上海: 同济大学出版社, 2011: 11–12 [2013–05–09]. http://apabi.lib.pku.edu.cn. DOI: AFAC1212121.
-[42] 楼梦麟, 杨燕. 汶川地震基岩地震动特征分析[M/OL]//同济大学土木工程防灾国家重点实验室. 汶川地震震害研究. 上海: 同济大学出版社: 11–12 [2013–05–09]. http://apabi.lib.pku.edu.cn. DOI: AFAC1212121.
-[42] 楼梦麟, 杨燕. 汶川地震基岩地震动特征分析[M/OL]//同济大学土木工程防灾国家重点实验室. 汶川地震震害研究. 上海: 同济大学出版社, 2011[2013–05–09]. http://apabi.lib.pku.edu.cn. DOI: AFAC1212121.
-[42] 楼梦麟, 杨燕. 汶川地震基岩地震动特征分析[M/OL]//同济大学土木工程防灾国家重点实验室. 汶川地震震害研究. 上海: 同济大学出版社[2013–05–09]. http://apabi.lib.pku.edu.cn. DOI: AFAC1212121.
-[41] 宋史卷三: 本纪第三[M/OL]//李承森. 宋史colon第 1 册. 北京: 中华书局, 2011: 11–12 [2013–05–09]. http://apabi.lib.pku.edu.cn.
-[41] 宋史卷三: 本纪第三[M]//李承森. 宋史colon第 1 册. 北京: 中华书局.
-[41] 宋史卷三: 本纪第三[M]//宋史: 第 1 册. 北京: 中华书局.
-[41] 宋史卷三: 本纪第三[M]//宋史. 北京: 中华书局.
-[37] 卷 39 乞致任第一[M]//苏魏公文集: 下册. 北京: 中华书局, 1988: 590.
-[41] 宋史卷三: 本纪第三[M]//宋史: 第 1 册. 北京: 中华书局, 1977: 49.
-[43] BUSECK P R, NORD G L Jr., VEBLEN D R. Subsolidus phenomena in pyroxenes[M]//PREWITT C. Pyroxense. Washington, D.C.: Mineralogical Society of America, 1980: 117–211.
-[42] 楼梦麟, 杨燕. 汶川地震基岩地震动特征分析[M]//同济大学土木工程防灾国家重点实验室. 汶川地震震害研究. 上海: 同济大学出版社, 2011: 11–12.
-[33] POISEL R A. 通信电子战原理[M/OL]. 聂皞, 王振华, 陈少昌, 等, 译. 2 版. 北京: 电子工业出版社[2013–08–01]. http://www.baidu.com. DOI: AFAC1212121.
-[33] POISEL R A. 通信电子战原理[M/OL]. 聂皞, 王振华, 陈少昌, 等, 译. 2 版. 北京: 电子工业出版社: 23–26 [2013–08–01]. http://www.baidu.com. DOI: AFAC1212121.
-[33] POISEL R A. 通信电子战原理[M/OL]. 聂皞, 王振华, 陈少昌, 等, 译. 2 版. 北京: 电子工业出版社, 2013: 23–26 [2013–08–01]. http://www.baidu.com. DOI: AFAC1212121.
-[33] 赵学功. 当代美国外交[M/OL]. [出版地不详]: 社会科学文献出版社, 2001 [2014–06–11]. http://www.baidu.com.
-[3] 余敏. 出版集团研究[M/OL]. 北京: 中国书籍出版社, 2001. www.bla~bla.org.
-[10] 余敏. 出版集团研究[M/OL]. 北京: 中国书籍出版社, 2001: 179–193 [2001–08–04]. http://www.baidu.com.
-[11] 候文顺. 高分子物理: 高分子材料分析、选择与改性[M/OL]. 北京: 化学工业出版社, 2010: 119[2012–11–27]. http://apabi.lib.pku.edu.cn.
-[15] KINCHY A. Seeds, Sciences, and struggle : the global politics of transgenic crops[M/OL]. Cambridge,Mass.: MIT Press, 2012: 50 [2013–07–14]. http://lib.myilibary.com.
-[16] PRAETZELLIS A. Death by theory: a tale of mystery and archaeological theory[M/OL]. Rev.ed. [S.l.]: Rowman & Littlefield Publishing Group, Inc., 2011: 13 [2012–07–26]. http://lib.myilibrary.com.
-[15] KINCHY A. Seeds, Sciences, and struggle : the global politics of transgenic crops[M]. Cambridge,Mass.: MIT Press, 2012: 50.
-[22] 易仕和, 赵玉新, 何霖, 等. 超声速和高超声速喷管设计[M]. 北京: 国防工业出版社, 2013.
-[24] MIROSLAV D L, DEJAN V T, BRIAN L E. 信号处理滤波器设计-基于 matlab 和 mathematica 的设计方法[M]. 朱义胜, 董辉, 译. 北京: 电子工业出版社, 2004.
-[25] 蔡敏, 徐慧慧, 黄柄强. UML 基础和 Rose 建模教程[M]. 北京: 人民邮电出版社, 2006.
-[33] POISEL R A. 通信电子战原理[M]. 聂皞, 王振华, 陈少昌, 等, 译. 2 版. 北京: 电子工业出版社, 2013: 23–26.
-[27] SIMON M K, OMURA J K, SCHOLTZ R A, et al. Spread Spectrum Communications Handbook[M]. New York City: McGraw-Hill, Inc., 2001.
-[23] Von PEEBLES P Z Jr, LIN S, DANIEL COSTELLO J. Probability, random variable, and random signal Principles[M]. 4th ed. New York: McGraw-Hill, 2001: 100.
-[22] YI S H, ZHAO Y X, HE L, et al. Supersonic and hypersonic nozzle design[M]. BeiJing: National Defense Industry Press, 2013.
-[41] LIN S, DANIEL COSTELLO J. Error Control Coding[M]. Second Edition. Englewood Cliffs: NJ:Prentice Hall, 2004.
-[45] PROAKIS J G, MANOLAKIS D G. Digital signal processing: Principles,algorithms, and applications[M]. 第 4 版. 北京: 电子工业出版社, 2007.
-[46] REED J H. An Introduction to Ultrawideband Communication Systems[M]. Upper Saddle River: NJ: Prentice Hall, 2005.
-[47] ROOD H J. Logic and structured design for computer programmers[M]. 3rd ed. [S.l.]: Brooks/ColeThomson Learning, 2001.
-[48] ROSS S M. 概率论基础教程[M]. 郑忠国, 詹从赞, 译. 第 8 版. 北京: 人民邮电出版社, 2010.
-[49] SIMON M K, ALOUINI M S. Digital Communication over Fading Channels[M]. Hoboken: NJ: Wiley-IEEE Press, 2004.
-[50] STUBER G L. Principles of Mobile Communication[M]. Second Edition. Norwell: MA: Kluwer Academic Publishers, 2001.
-[51] YUFIN S A. Geoecology and computers: proceedings of the Third International Conference on Advances of Computer Methods in Geotechnical and Geoenvironmental Engineering, Moscow, Russia, February 1-4, 2000[M]. Rotterdam: A. A. Balkema, 2000.
-[52] 埃伯哈德 蔡德勒, 等. 数学指南-实用数学手册[M]. 李文林等, 译. 北京: 科学出版社, 2012.
-[53] 陈希孺. 概率论与数理统计[M]. 合肥: 中国科学技术大学出版社, 2009.
-[54] 陈志杰, 赵书钦, 李树钧, 等. LaTeX 入门与提高[M]. 第二版. 北京: 高等教育出版社, 2010.
-[1] 张伯伟. 全唐五代诗格会考[M]. 南京: 江苏古籍出版社, 2002: 288.
-[2] 师伏堂日记: 第 4 册[M]. 北京: 北京图书馆出版社, 2009: 155.
-[3] 胡承正, 周详, 缪灵. 理论物理概论: 上[M]. 武汉: 武汉大学出版社, 2010: 112.
-[4] 美国妇产科医师学会. 新生儿脑病和脑性瘫痪发病机制与病理生理[M]. 段涛, 杨慧霞, 译. 北京: 人民卫生出版社, 2010: 38–39.
-[5] 康熙字典: 已集上: 水部[M]. 同文书局影印本. 北京: 中华书局, 1962: 50.
-[6] 汪昂. 增订本草备要: 四卷[M]. 刻本. 上海: 老二酉堂.
-[7] 蒋有绪, 郭泉水, 马娟, 等. 中国森林群落分类及其群落学特征[M]. 北京: 科学出版社, 1998.
-[8] 中国企业投资协会, 台湾并购与私募股权协会, 汇盈国际投资集团. 投资台湾: 大陆企业赴台投资指南[M]. 北京: 九州出版社, 2013.
-[9] 罗斯基. 战前中国经济的增长[M]. 唐巧天, 毛立坤, 姜修宪, 译. 杭州: 浙江大学出版社, 2009.
-[10] 库恩. 科学革命的结构: 第 4 版[M]. 金吾伦, 胡新和, 译. 2 版. 北京: 北京大学出版社, 2012.
-[12] CRAWFPRD W, GORMAN M. Future libraries:dreams, maddness, & reality[M]. Chicago: American Library Association, 1995.
-[13] International Federation of Library Association and Institutions. Names of persons: national usages for entry in catalogues[M]. 3rd ed. London: IFLA International Office for UBC, 1977.
-[14] O’BRIEN J A. Introduction to information systems[M]. 7th ed. Burr Ridge, III.: Irwin, 1994.
-[10] 库恩, 余敏, 阿飞, 等. 科学革命的结构: 第 4 版[M]. 金吾伦, 胡新和, 译. 北京: 北京大学出版社, 2012.
-[10] 库恩. 科学革命的结构: 第 4 版[M]. 北京: 北京大学出版社, 2012.
-[10] 库恩. 科学革命的结构: 第 4 版[M]. 金吾伦, 胡新和, 译. 2 版. 北京: 北京大学出版社, 2012.
-[8] 余敏. 出版集团研究[M]. 3 版. 北京: 中国书籍出版社, 2001. DOI: AFAC1212121.
-[1] 余敏. 出版集团研究[M]. 北京: 中国书籍出版社. DOI: AFAC1212121.
-[1] 余敏. 出版集团研究[M]. 北京: 中国书籍出版社: 179–193. DOI: AFAC1212121.
-[11] 出版集团研究[M]. 北京: 中国书籍出版社, 2001: 179–193.
-[8] 余敏. 出版集团研究[M]. 北京: 中国书籍出版社, 2001: 179–193.DOI:AFAC1212121.
-[7] 余敏. 出版集团研究[M]. 北京: 中国书籍出版社, 2001: 179–193.
-[2] 余敏. 出版集团研究[M]. [出版地不详]: 中国书籍出版社, 2001: 179–193.
-[4] 余敏. 出版集团研究[M]. 北京: [出版者不详], 2001.
-[5] 余敏. 出版集团研究[M]. 北京: [出版者不详].
-[6] 余敏. 出版集团研究[M]. 北京: [出版者不详], 2001: 20–30.
-[9] 余敏. 出版集团研究[M]. 2 版. 北京: 中国书籍出版社, 2001: 179–193.
-[11] 出版集团研究[M]. 北京: 中国书籍出版社, 2001: 179–193.
-[12] PARSONS. The Mobile Radio Propagation Channel[M]. 2nd ed. Hoboken: John Wiley, Sons,2000.
-[13] Parsons. The Mobile Radio Propagation Channel[M]. 2nd ed. Hoboken: John Wiley, Sons, 2000.
-[14] PARSONS J D. The Mobile Radio Propagation Channel[M]. 2nd ed. Hoboken: John Wiley,Sons, 2000.
-[15] PARSONS J D. The Mobile Radio Propagation Channel[M]. 2nd ed. Hoboken: John Wiley,Sons.
-[16] PARSONS J D. The Mobile Radio Propagation Channel[M]. 2nd ed. [S.l.]: John Wiley, Sons,2000.
-[17] PARSONS J D. The Mobile Radio Propagation Channel[M]. 2nd ed. Hoboken: [s.n.], 2000.
-[18] PARSONS J D. The Mobile Radio Propagation Channel[M]. 2nd ed. Hoboken: [s.n.].
-[19] PARSONS J D. The Mobile Radio Propagation Channel[M]. 2nd ed. Hoboken: [s.n.], 2000: 15–20.
\ No newline at end of file
Deleted: trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gb7714texttobib.pl
===================================================================
--- trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gb7714texttobib.pl 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gb7714texttobib.pl 2021-01-19 22:57:40 UTC (rev 57468)
@@ -1,1670 +0,0 @@
-##%
-##% ---------------------------------------------------------------
-##% gb7714texttobib--- A transformation tool for GB/T 7714-2015 style
-##% bibliography text to bib source file
-##%
-##% Maintained by huzhenzhen
-##% Homepage: <https://github.com/hushidong/biblatex-gb7714-2015>
-##% history:
-##% 2017/02/26 v1.0g
-##% E-mail:
-##% hzzmail at 163.com
-##% Released under the LaTeX Project Public License v1.3c or later
-##% usage:
-##% perl gb7714texttobib.pl in=textfilename out=bibfilename
-##% options(need to do):
-##% style=ay or default
-##% key=ay or default
-##%
-##% ---------------------------------------------------------------
-#%Target:: 将pdf文档中拷出的参考文献文本转换成bib文件,文本文件中的一条参考文献为一行
-#%Method:: 利用perl进行文本处理,处理和判断的两个重要方面是:
-# 分析分割后的文本的位置和内容,使用的是正则表达式匹配,主要两种方式
-# 1.根据标点和本文特征一部分一部分的解析,比如book条目处理
-# 2.直接列出所有可能的正则表达式一个个匹配,比如article条目处理
-#%Date :: 2017-02-22
-#%Note :: 1.网址之类如果解析出错,应确认其前导词http://之前没有空格
-# 2.有些以.连接有从属关系的机构作者,可以把.后的空格去掉便于正确解析
-# 3.有些尽管解析到的域不是真实的域,但不影响著录格式(显示效果),相应条目的域
-# 可以在bib文件中完善,尽管从实用角度并不需要这么做。
-#
-##% ---------------------------------------------------------------
-##% todo: 1. pdf 的比较?
-##% obsolete intro:
-##% 1.源文件文档如果个别地方不符合规范,可以修改一下
-##% (a):inbook/standard类中,当出现//后面第二项是booktitle且其中存在:时,先把父标题的冒号改成colon,比如
-##% [M]//李承森. 宋史: 第 1 册. 北京: 中华书局. 应把宋史后的冒号改掉
-##% [S]//全国文献工作标准化技术委员会. 文献工作国家标准汇编: 3. 北京: 中国标准出版社, 1988: 59–92.
-##% ---------------------------------------------------------------
-
-
-foreach $file(@ARGV){
- print 'file:',$file,"\n";
- if($file=~m/in=/){
- ($infile)=($file=~m/in=(.*)/)
- }
- if($file=~m/out=/){
- ($outfile)=($file=~m/out=(.*)/)
- }
-}
-
-open (FHR,"<$infile");
-open (FHW,">$outfile");
-print FHW '% Encoding: UTF-8',"\n";
-
- at references=<FHR>;#将所有的文献存为@references数组,各文献以<行>为单位进行区分
-
-$ns=1;
-$ne=@references;
-$nline=0;
-foreach $reference(@references){
-
- $nline=$nline+1;
- if($nline<$ns){next;} #先跳过几行进行,配合后面的last进行当行测试
-
- while($reference=~m/–/){
- $reference=~s/–/-/;#直接利用正则表达式更正页码/日期/网址中的连字符
- }
- print "$reference ";#打印各文献的内容
-
- undef $entrytype;
- undef $author;
- undef $title;
- undef $journal;
- undef $translator;
- undef $bookauthor;
- undef $booktitle;
- undef $version;
- undef $address;
- undef $publisher;
- undef $institution;
- undef $year;
- undef $type;
- undef $date;
- undef $volume;
- undef $number;
- undef $pages;
- undef $eventdate;
- undef $urldate;
- undef $url;
- undef $doi;
- undef $note;
- undef $eventyvn;
- undef $endeventyvn;
- undef $eventdate;
- undef $eventvol;
- undef $eventnum;
- undef $endeventdate;
- undef $endeventvol;
- undef $endeventnum;
-
- #---------------------------------------------------------------
- #条目类型:期刊和期刊中析出的文献/periodical、article
- #---------------------------------------------------------------
- if(1){
- if($reference=~m/\[J\]/){
- if($reference=~m/:\s/ and $reference=~m/:\s\D/){#根据存在出版社前的冒号加空格区分
- print 'this entry is periodical',"\n";
- $entrytype='periodical';
- }else{
- print 'this entry is article',"\n";
- $entrytype='article';
- }
- }
-
- if($entrytype eq 'periodical'){#字符串比较用eq而数字比较用==,如果用==那么两边都是1,则是真
- $regexformach='\[J\]\.';
- &bfidentifier;
-
- ($preadderess, $pospublisher)=($reference=~m/\[J\]\.(.*):\s(.*)/);
- print 'preadderess =',$preadderess,"\n";
- print 'pospublisher=',$pospublisher,"\n";
- ($eventyear, $address)=($preadderess=~m/(.*)\.\s(.*)/);
- print 'eventyear =',$eventyear,"\n";
- print 'address =',$address,"\n";
- ($eventyvn, $endeventyvn)=($eventyear=~m/(.*)\-(.*)/);#yvn表示year,volume,number
- print 'eventyvn =',$eventyvn,"\n";
- print 'endeventyvn =',$endeventyvn,"\n";
- if($eventyvn=~m/.*,.*/){#存在逗号表明有卷信息
- ($eventdate, $eventvol, $eventnum)=($eventyvn=~m/\s*(.*),\s(.*)\((.*)\)/);#yvn表示year,volume,number
- print 'eventdate =',$eventdate,"\n";
- print 'eventvol =',$eventvol,"\n";
- print 'eventnum =',$eventnum,"\n";
- if($endeventyvn){
- ($endeventdate, $endeventvol, $endeventnum)=($endeventyvn=~m/\s*(.*),\s(.*)\((.*)\)/);#yvn表示year,volume,number
- print 'endeventdate =',$endeventdate,"\n";
- print 'endeventvol =',$endeventvol,"\n";
- print 'endeventnum =',$endeventnum,"\n";
- }
- }else{
- ($eventdate, $eventnum)=($eventyvn=~m/\s*(.*)\((.*)\)/);#yvn表示year,volume,number
- print 'eventdate =',$eventdate,"\n";
- print 'eventvol =',$eventvol,"\n";
- print 'eventnum =',$eventnum,"\n";
- if($endeventyvn){
- ($endeventdate, $endeventnum)=($endeventyvn=~m/\s*(.*)\((.*)\)/);#yvn表示year,volume,number
- print 'endeventdate =',$endeventdate,"\n";
- print 'endeventvol =',$endeventvol,"\n";
- print 'endeventnum =',$endeventnum,"\n";
- }
- }
- if($endeventdate){
- $date=$eventdate.'-'.$endeventdate;
- }else{
- $date=$eventdate
- }
- if($endeventvol){
- $volume=$eventvol.'-'.$endeventvol;
- }else{
- $volume=$eventvol
- }
- if($endeventnum){
- $number=$eventnum.'-'.$endeventnum;
- }else{
- $number=$eventnum
- }
- print 'date =',$date,"\n";
- print 'volume =',$volume,"\n";
- print 'number =',$number,"\n";
- ($publisher)=($pospublisher=~m/(.*),/);
- print 'publisher =',$publisher,"\n";
- }
-
- if($entrytype eq 'article'){
- $regexformach='\[J\]\.';
- &bfidentifier;
-
- $flagmatched=0;
- $regexbfjournal='\]\.\s(.*),\s(.*),\s(.*)\((.*)\):\s(.*)\.';#包括全部信息
- if($reference=~m/$regexbfjournal/){
- ($journal,$date,$volume,$number,$pages)=($reference=~m/$regexbfjournal/);
- $flagmatched=1;
- print '包括全部信息',"\n";
- }
- $regexbfjournal='\]\.\s(.*),\s(.*),\s(.*)\((.*)\)\.';#没有页码
- if($reference=~m/$regexbfjournal/ and $flagmatched==0){
- ($journal,$date,$volume,$number)=($reference=~m/$regexbfjournal/);
- $flagmatched=1;
- print '没有页码',"\n";
- }
- $regexbfjournal='\]\.\s(.*),\s(.*),\s(.*):\s(.*)\.';#没有期
- if($reference=~m/$regexbfjournal/ and $flagmatched==0){
- ($journal,$date,$volume,$pages)=($reference=~m/$regexbfjournal/);
- $flagmatched=1;
- print '没有期',"\n";
- }
- $regexbfjournal='\]\.\s(.*),\s(.*)\((.*)\):\s(.*)\.';#没有卷/年
- if($reference=~m/$regexbfjournal/ and $flagmatched==0){
- ($journal,$date,$number,$pages)=($reference=~m/$regexbfjournal/);
- $flagmatched=1;
- if($date!~m/\d{4}/){
- $volume=$date;
- $date='';
- }
- print '没有卷/年',"\n";
- }
- $regexbfjournal='\]\.\s(.*),\s(.*),\s(.*)\.';#没有页码,期
- if($reference=~m/$regexbfjournal/ and $flagmatched==0){
- ($journal,$date,$volume)=($reference=~m/$regexbfjournal/);
- $flagmatched=1;
- print '没有页码,期',"\n";
- }
- $regexbfjournal='\]\.\s(.*),\s(.*)\((.*)\)\.';#没有页码,卷/年
- if($reference=~m/$regexbfjournal/ and $flagmatched==0){
- ($journal,$date,$number)=($reference=~m/$regexbfjournal/);
- $flagmatched=1;
- if($date!~m/\d{4}/){
- $volume=$date;
- $date='';
- }
- print '没有页码,卷/年',"\n";
- }
- $regexbfjournal='\]\.\s(.*),\s(.*):\s(.*)\.';#没有卷/年,期
- if($reference=~m/$regexbfjournal/ and $flagmatched==0){
- ($journal,$date,$pages)=($reference=~m/$regexbfjournal/);
- $flagmatched=1;
- if($date!~m/\d{4}/){
- $volume=$date;
- $date='';
- }
- print '没有卷/年,期',"\n";
- }
-
- if($flagmatched==0){
- print 'the text after title was not matched, please add a regex for the current entry in the perl source code!',"\n";
- print '当前条目标题之后的内容没有匹配的正则表达式,请在perl代码中增加适合该条目正则表达式!',"\n";
- }
-
- print 'journal =',$journal,"\n";
- print 'date =',$date,"\n";
- print 'volume =',$volume,"\n";
- print 'number =',$number,"\n";
- print 'pages =',$pages,"\n";
-
- }
-
- #判断期刊中析出的文献,带url
- if($reference=~m/\[J\/OL\]/){
- print 'this entry is article with url',"\n";
- $entrytype='article';
-
- $regexformach='\[J\/OL\]\.';
- &bfidentifier;
-
- ($postitle)=($reference=~m/\[J\/OL\]\.\s(.*)/);
- if($postitle=~m/\[.*\]/){#存在urldate
- ($preurldate,$urldate,$posurl)=($postitle=~m/(.*)\[(.*)\]\.\s(.*)/);
- }else{#不存在urldate
- ($preurldate,$posurl)=($postitle=~m/(.*)(http:.*)/);
- }
- unless($preurldate=~m/\.$/){$preurldate=$preurldate.'.';}#加个点统一上面两种方式
-
- #处理url和doi
- $regexposurl='(.*)doi:\s(.*)';#处理url和doi
- if($posurl=~m/$regexposurl/i){
- ($url,$doi)=($posurl=~m/$regexposurl/i);
- }else{
- $url=$posurl;
- }
-
- #处理urldate前的内容,基本article不带url的情况相同
- $flagmatched=0;
- $regexbfjournal='(.*),\s(.*),\s(.*)\((.*)\):\s(.*)\.';#包括全部信息
- if($preurldate=~m/$regexbfjournal/ and $flagmatched==0){
- ($journal,$date,$volume,$number,$pages)=($preurldate=~m/$regexbfjournal/);
- $flagmatched=1;
- }
- $regexbfjournal='(.*),\s(.*),\s(.*)\((.*)\)\.';#没有页码
- if($preurldate=~m/$regexbfjournal/ and $flagmatched==0){
- ($journal,$date,$volume,$number)=($preurldate=~m/$regexbfjournal/);
- $flagmatched=1;
- }
- $regexbfjournal='(.*),\s(.*),\s(.*):\s(.*)\.';#没有期
- if($preurldate=~m/$regexbfjournal/ and $flagmatched==0){
- ($journal,$date,$volume,$pages)=($preurldate=~m/$regexbfjournal/);
- $flagmatched=1;
- }
- $regexbfjournal='(.*),\s(.*)\((.*)\):\s(.*)\.';#没有卷/年
- if($preurldate=~m/$regexbfjournal/ and $flagmatched==0){
- ($journal,$date,$number,$pages)=($preurldate=~m/$regexbfjournal/);
- $flagmatched=1;
- if($date!~m/\d{4}/){
- $volume=$date;
- $date='';
- }
- }
- $regexbfjournal='(.*),\s(.*),\s(.*)\.';#没有页码,期
- if($preurldate=~m/$regexbfjournal/ and $flagmatched==0){
- ($journal,$date,$volume)=($preurldate=~m/$regexbfjournal/);
- $flagmatched=1;
- }
- $regexbfjournal='(.*),\s(.*)\((.*)\)\.';#没有页码,卷/年
- if($preurldate=~m/$regexbfjournal/ and $flagmatched==0){
- ($journal,$date,$number)=($preurldate=~m/$regexbfjournal/);
- $flagmatched=1;
- if($date!~m/\d{4}/){
- $volume=$date;
- $date='';
- }
- }
- $regexbfjournal='(.*),\s(.*):\s(.*)\.';#没有卷/年,期
- if($preurldate=~m/$regexbfjournal/ and $flagmatched==0){
- ($journal,$date,$pages)=($preurldate=~m/$regexbfjournal/);
- $flagmatched=1;
- if($date!~m/\d{4}/){
- $volume=$date;
- $date='';
- }
- }
-
- if($flagmatched==0){
- print 'the text after title was not matched, please add a regex for the current entry in the perl source code!',"\n";
- print '当前条目标题之后的内容没有匹配的正则表达式,请在perl代码中增加适合该条目正则表达式!',"\n";
- }
-
- print 'journal =',$journal,"\n";
- print 'date =',$date,"\n";
- print 'volume =',$volume,"\n";
- print 'number =',$number,"\n";
- print 'pages =',$pages,"\n";
- print 'urldate =',$urldate,"\n";
- print 'url =',$url,"\n";
- print 'doi =',$doi,"\n";
-
-
- }
- }
-
- #---------------------------------------------------------------
- #条目类型:判断报纸中析出的文献/newspaper
- #---------------------------------------------------------------
- if(1){
- if($reference=~m/\[N\]/){
- print 'this entry is newspaper',"\n";
- $entrytype='newspaper';
- $note='news';
- $regexnewsflag='\[N\]';
- $onlineflag=0;
- }
- if($reference=~m/\[N\/OL\]/){
- print 'this entry is newspaper with url',"\n";
- $entrytype='newspaper';
- $note='news';
- $regexnewsflag='\[N\/OL\]';
- $onlineflag=1;
- }
- if($entrytype eq 'newspaper'){
- if($onlineflag==1){
- $regexformach='\[N\/OL\]';
- &bfidentifier;
-
- print 'has url',"\n";
- $flagmatched=0;
- $regexnewspostitle='\.\s(.*),\s(.*)\((.*)\)\s*\[(.*)\]\.\s(.*)';
- if($reference=~m/$regexnewsflag$regexnewspostitle/ and $flagmatched==0){
- $flagmatched=1;
- ($journal,$date,$number,$urldate,$posurl)=($reference=~m/$regexnewsflag$regexnewspostitle/);}
- $regexnewspostitle='\.\s(.*),\s(.*)\s*\[(.*)\]\.\s(.*)';
- if($reference=~m/$regexnewsflag$regexnewspostitle/ and $flagmatched==0){
- $flagmatched=1;
- ($journal,$date,$urldate,$posurl)=($reference=~m/$regexnewsflag$regexnewspostitle/);}
- if($flagmatched==0){
- print 'the text after title was not matched, please add a regex for the current entry in the perl source code!',"\n";
- print '当前条目标题之后的内容没有匹配的正则表达式,请在perl代码中增加适合该条目正则表达式!',"\n";
- }
- }else{
- $regexformach='\[N\]';
- &bfidentifier;
-
- print 'no url',"\n";
- $regexnewspostitle='\.\s(.*),\s(.*)\((.*)\)';
- ($journal,$date,$number)=($reference=~m/$regexnewsflag$regexnewspostitle/);
- }
- #处理url和doi
- $regexposurl='(.*)doi:\s(.*)';#处理url和doi
- if($posurl=~m/$regexposurl/i){
- ($url,$doi)=($posurl=~m/$regexposurl/i);
- }else{
- $url=$posurl;
- }
-
- # print 'journal =',$journal,"\n";
- # print 'date =',$date,"\n";
- # print 'volume =',$volume,"\n";
- # print 'number =',$number,"\n";
- # print 'pages =',$pages,"\n";
- # print 'urldate =',$urldate,"\n";
- # print 'url =',$url,"\n";
- # print 'doi =',$doi,"\n";
- }
- }
-
-
- #---------------------------------------------------------------
- #条目类型:论文集中析出的文献/inproceedings
- #---------------------------------------------------------------
- if(1){#\/\/
- if ($reference=~m/\[C\/OL\]\/\//){
- $entrytype='inproceedings';
- print "this entry's type is: $entrytype with url\n";
- $regexformach='\[C\/OL\]\/\/';
- &bfidentifier;
-
- $regexformach='C\/OL\]\/\/';
- &bfaddressinbook;
-
- &afpublisherbookurl;
- }elsif($reference=~m/\[C\]\/\//){
- $entrytype='inproceedings';
- print "this entry's type is: $entrytype \n";
- $regexformach='\[C\]\/\/';
- &bfidentifier;
-
- $regexformach='C\]\/\/';
- &bfaddressinbook;
-
- &afpublisherbook;
- }
-
- if ($entrytype eq 'inproceedings'){
- if ($address=~m/\[S\.l\.\]/ or $address=~m/出版地不详/) {#当存在英文的[s.n.]
- $address="";
- }
- if ($publisher=~m/\[s\.n\.\]/ or $publisher=~m/出版者不详/) {#当存在英文的[s.n.]
- $publisher="";
- }
- $date=$year;
- }
-
- }
-
-
- #---------------------------------------------------------------
- #条目类型:论文集/proceedings
- #---------------------------------------------------------------
- if(1){
- if ($reference=~m/\[C\/OL\]\./){
- $entrytype='proceedings';
- print "this entry's type is: $entrytype with url\n";
- $regexformach='\[C\/OL\]\.';
- &bfidentifier;
-
- $regexformach='C\/OL\]\.';
- &bfaddressbook;
-
- &afpublisherbookurl;
- }elsif($reference=~m/\[C\]\./){
- $entrytype='proceedings';
- print "this entry's type is: $entrytype \n";
- $regexformach='\[C\]\.';
- &bfidentifier;
-
- $regexformach='C\]\.';
- &bfaddressbook;
-
- &afpublisherbook;
- }
-
- if ($entrytype eq 'proceedings'){
- if ($address=~m/\[S\.l\.\]/ or $address=~m/出版地不详/) {#当存在英文的[s.n.]
- $address="";
- }
- if ($publisher=~m/\[s\.n\.\]/ or $publisher=~m/出版者不详/) {#当存在英文的[s.n.]
- $publisher="";
- }
- $date=$year;
- print 'date=',"$date";
- }
- }
-
-
-
-
- #---------------------------------------------------------------
- #条目类型:未出版物/unpublished
- #---------------------------------------------------------------
- if(1){
- if ($reference=~m/\[Z\/OL\]\./){
- $entrytype='unpublished';
- print "this entry's type is: $entrytype with url\n";
- $regexformach='\[Z\/OL\]\.';
- &bfidentifier;
-
- $regexformach='Z\/OL\]\.';
- &bfaddressbook;
-
- &afpublisherbookurlb;
- }elsif($reference=~m/\[Z\]\./){
- $entrytype='unpublished';
- print "this entry's type is: $entrytype \n";
- $regexformach='\[Z\]\.';
- &bfidentifier;
-
- $regexformach='Z\]\.';
- &bfaddressbook;
-
- &afpublisherbookb;
- }
-
- if ($entrytype eq 'unpublished'){
- $date=$year;
- print 'date=',"$date";
- }
- }
-
-
- #---------------------------------------------------------------
- #条目类型:手册、档案/manual
- #---------------------------------------------------------------
- if(1){
- if ($reference=~m/\[A\/OL\]\./){
- $entrytype='manual';
- print "this entry's type is: $entrytype with url\n";
- $regexformach='\[A\/OL\]\.';
- &bfidentifier;
-
- $regexformach='A\/OL\]\.';
- &bfaddressbook;
-
- &afpublisherbookurlb;
- }elsif($reference=~m/\[A\]\./){
- $entrytype='manual';
- print "this entry's type is: $entrytype \n";
- $regexformach='\[A\]\.';
- &bfidentifier;
-
- $regexformach='A\]\.';
- &bfaddressbook;
-
- &afpublisherbookb;
- }
-
- if ($entrytype eq 'manual'){
- $date=$year;
- print 'date=',"$date";
- }
- }
-
-
-
- #---------------------------------------------------------------
- #条目类型:报告/report
- #---------------------------------------------------------------
- if(1){
- if ($reference=~m/\[R\/OL\]\./){
- $entrytype='report';
- print "this entry's type is: $entrytype with url\n";
- $regexformach='\[R\/OL\]\.';
- &bfidentifier;
-
- $regexformach='R\/OL\]\.';
- &bfaddressbook;
-
- &afpublisherbookurlb;
- }elsif($reference=~m/\[R\]\./){
- $entrytype='report';
- print "this entry's type is: $entrytype \n";
- $regexformach='\[R\]\.';
- &bfidentifier;
-
- $regexformach='R\]\.';
- &bfaddressbook;
-
- &afpublisherbookb;
- }
-
- if ($entrytype eq 'report'){
- $date=$year;
- print 'date=',"$date";
- }
-
- }
-
- #---------------------------------------------------------------
- #条目类型:标准/standard
- #---------------------------------------------------------------
- if(1){
- if ($reference=~m/\[S\/OL\]\./){
- $entrytype='standard';
- print "this entry's type is: $entrytype with url\n";
- $regexformach='\[S\/OL\]\.';
- &bfidentifier;
-
- $regexformach='S\/OL\]\.';
- &bfaddressbook;
- &afpublisherbookurl;
- }elsif($reference=~m/\[S\]\./){
- $entrytype='standard';
- print "this entry's type is: $entrytype \n";
- $regexformach='\[S\]\.';
- &bfidentifier;
-
- $regexformach='S\]\.';
- &bfaddressbook;
-
- &afpublisherbook;
- }elsif ($reference=~m/\[S\/OL\]\/\//){
- $entrytype='standard';
- print "this entry's type is: $entrytype with url\n";
- $regexformach='\[S\/OL\]\/\/';
- &bfidentifier;
-
- $regexformach='S\/OL\]\/\/';
- &bfaddressinbook;
-
- &afpublisherbookurl;
- }elsif($reference=~m/\[S\]\/\//){
- $entrytype='standard';
- print "this entry's type is: $entrytype \n";
- $regexformach='\[S\]\/\/';
- &bfidentifier;
-
- $regexformach='S\]\/\/';
- &bfaddressinbook;
-
- &afpublisherbook;
- }
- if ($entrytype eq 'standard'){
- if ($address=~m/\[S\.l\.\]/ or $address=~m/出版地不详/) {#当存在英文的[s.n.]
- $address="";
- }
- if ($publisher=~m/\[s\.n\.\]/ or $publisher=~m/出版者不详/) {#当存在英文的[s.n.]
- $publisher="";
- }
- $date=$year;
- $note='standard';
- print 'date=',"$date";
- print 'note=',"$note";
- }
-
- }
-
- #---------------------------------------------------------------
- #条目类型:学位论文/thesis
- #---------------------------------------------------------------
- if(1){
- if ($reference=~m/\[D\/OL\]\./){
- $entrytype='thesis';
- print "this entry's type is: $entrytype with url\n";
- $regexformach='\[D\/OL\]\.';
- &bfidentifier;
-
- $regexformach='D\/OL\]\.';
- &bfaddressbook;
-
- &afpublisherbookurl;
- }elsif($reference=~m/\[D\]\./){
- $entrytype='thesis';
- print "this entry's type is: $entrytype \n";
- $regexformach='\[D\]\.';
- &bfidentifier;
-
- $regexformach='D\]\.';
- &bfaddressbook;
-
- &afpublisherbook;
- }
-
- if ($entrytype eq 'thesis'){
- if ($address=~m/\[S\.l\.\]/ or $address=~m/出版地不详/) {#当存在英文的[s.n.]
- $address="";
- }
- if ($publisher=~m/\[s\.n\.\]/ or $publisher=~m/出版者不详/) {#当存在英文的[s.n.]
- $publisher="";
- }
- $date=$year;
- print 'date=',"$date";
- }
-
- }
-
-
- #---------------------------------------------------------------
- #条目类型:汇编中析出的文献/incollection
- #---------------------------------------------------------------
- if(1){#\/\/
- if ($reference=~m/\[G\/OL\]\/\//){
- $entrytype='incollection';
- print "this entry's type is: $entrytype with url\n";
- $regexformach='\[G\/OL\]\/\/';
- &bfidentifier;
-
- $regexformach='G\/OL\]\/\/';
- &bfaddressinbook;
-
- &afpublisherbookurl;
- }elsif($reference=~m/\[G\]\/\//){
- $entrytype='incollection';
- print "this entry's type is: $entrytype \n";
- $regexformach='\[G\]\/\/';
- &bfidentifier;
-
- $regexformach='G\]\/\/';
- &bfaddressinbook;
-
- &afpublisherbook;
- }
-
- if ($entrytype eq 'incollection'){
- if ($address=~m/\[S\.l\.\]/ or $address=~m/出版地不详/) {#当存在英文的[s.n.]
- $address="";
- }
- if ($publisher=~m/\[s\.n\.\]/ or $publisher=~m/出版者不详/) {#当存在英文的[s.n.]
- $publisher="";
- }
- $date=$year;
- }
-
- }
-
-
- #---------------------------------------------------------------
- #条目类型:汇编/collection
- #---------------------------------------------------------------
- if(1){
- if ($reference=~m/\[G\/OL\]\./){
- $entrytype='collection';
- print "this entry's type is: $entrytype with url\n";
- $regexformach='\[G\/OL\]\.';
- &bfidentifier;
-
- $regexformach='G\/OL\]\.';
- &bfaddressbook;
-
- &afpublisherbookurl;
- }elsif($reference=~m/\[G\]\./){
- $entrytype='collection';
- print "this entry's type is: $entrytype \n";
- $regexformach='\[G\]\.';
- &bfidentifier;
-
- $regexformach='G\]\.';
- &bfaddressbook;
-
- &afpublisherbook;
- }
-
- if ($entrytype eq 'collection'){
- if ($address=~m/\[S\.l\.\]/ or $address=~m/出版地不详/) {#当存在英文的[s.n.]
- $address="";
- }
- if ($publisher=~m/\[s\.n\.\]/ or $publisher=~m/出版者不详/) {#当存在英文的[s.n.]
- $publisher="";
- }
- $date=$year;
- print 'date=',"$date";
- }
- }
-
-
- #---------------------------------------------------------------
- #条目类型:专利/patent
- #---------------------------------------------------------------
- if(1){
- if ($reference=~m/\[P\/OL\]\./){
- $entrytype='patent';
- print "this entry's type is: $entrytype with url\n";
- $regexformach='\[P\/OL\]\.';
- &bfidentifier;
- }elsif($reference=~m/\[P\]\./){
- $entrytype='patent';
- print "this entry's type is: $entrytype \n";
- $regexformach='\[P\]\.';
- &bfidentifier;
- }
-
- if($entrytype eq 'patent'){
- ($postitle)=($reference=~m/$regexformach\s*(.*)/);
- print 'postitle=',$postitle,"\n";
- $titlenumber=$title;
- if($titlenumber=~m/:\s*\d.*/){
- ($title,$number)=($titlenumber=~m/(.*):\s*(\d.*)/);
- print 'title =',$title,"\n";
- print 'number =',$number,"\n";
- }
-
- if($postitle=~m/\[.*\]/ and $reference=~m/\[P\/OL\]\./){
- ($date,$urldate,$posurl)=($postitle=~/(.*)\s*\[(.*)\]\.\s*(.*)/);
- print 'date=',$date,"\n";
- print 'urldate =',$urldate,"\n";
- print 'posurl =',$posurl,"\n";
- if($posurl=~m/DOI/i){#匹配存在doi的话
- ($url,$doi)=($posurl=~m/(.*)DOI:(.*)\./i);
- print 'url=',"$url \n";
- print 'doi=',"$doi \n";
- }else{
- $url=$posurl;
- print 'url =',"$url \n";
- }
- }else{
- $posurl=$postitle;
- if($posurl=~m/DOI/i){#匹配存在doi的话
- ($date,$doi)=($posurl=~m/(.*)DOI:(.*)\./i);
- print 'date=',"$date \n";
- print 'doi =',"$doi \n";
- }else{
- $date=$posurl;
- print 'date =',"$date \n";
- }
- }
- }
- }
-
-
- #---------------------------------------------------------------
- #条目类型:电子资源/online
- #---------------------------------------------------------------
- if(1){
- if ($reference=~m/\[EB\/OL\]\./){#匹配[EB/OL]判断为online类型
- $entrytype='online';
- print "this entry's type is: $entrytype \n";
-
- $regexformach='\[EB\/OL\]\.';
- &bfidentifier;
-
- ($postitle)=($reference=~m/$regexformach\s*(.*)/);
- print 'postitle=',$postitle,"\n";
-
- if($postitle=~m/\(.*\)/ and $postitle=~m/\[.*\]/){#存在更新日期和引用日期
- ($eventdate,$urldate,$posurl)=($postitle=~/\s*\((.*)\)\s*\[(.*)\]\.\s*(.*)/);
- }elsif($postitle=~m/\(.*\)/ and $postitle!~m/\[.*\]/){#存在更新日期但无引用日期
- ($eventdate,$posurl)=($postitle=~/\s*\((.*)\)\.\s*(.*)/);
- }elsif($postitle!~m/\(.*\)/ and $postitle=~m/\[.*\]/){#存在引用日期但无更新日期
- ($urldate,$posurl)=($postitle=~/\s*\[(.*)\]\.\s*(.*)/);
- }else{
- ($posurl)=($postitle=~/\s*(.*)/);
- }
- print 'eventdate=',$eventdate,"\n";
- print 'urldate =',$urldate,"\n";
- print 'posurl =',$posurl,"\n";
-
- if($posurl=~m/DOI/i){#匹配存在doi的话
- ($url,$doi)=($posurl=~m/(.*)DOI:(.*)\./i);
- print 'url=',"$url \n";
- print 'doi=',"$doi \n";
- }else{
- $url=$posurl;
- print 'url =',"$url \n";
- }
- }
- }
-
- #---------------------------------------------------------------
- #条目类型:专著/book
- #---------------------------------------------------------------
- if(1){
- if ($reference=~m/\[M\]\./){#匹配[M]判断为book类型
- print "this entry's type is: book \n";
- $entrytype='book';
-
- $regexformach='\[M\]\.';
- &bfidentifier;
-
- $regexformach='M\]\.';
- &bfaddressbook;
-
- &afpublisherbook;
-
- if ($address=~m/\[S\.l\.\]/ or $address=~m/出版地不详/) {#当存在英文的[s.n.]
- $address="";
- }
- if ($publisher=~m/\[s\.n\.\]/ or $publisher=~m/出版者不详/) {#当存在英文的[s.n.]
- $publisher="";
- }
- $date=$year;
- }
- }
-
- #---------------------------------------------------------------
- #条目类型:专著但存在网址/book with url
- #---------------------------------------------------------------
- if(1){
- if ($reference=~m/\[M\/OL\]\./){
- print "this entry's type is: book with url\n";
- $entrytype='book';
-
- $regexformach='\[M\/OL\]\.';
- &bfidentifier;
-
- $regexformach='M\/OL\]\.';
- &bfaddressbook;
-
- &afpublisherbookurl;
-
-
- if ($address=~m/\[S\.l\.\]/ or $address=~m/出版地不详/) {#当存在英文的[s.n.]
- $address="";
- }
- if ($publisher=~m/\[s\.n\.\]/ or $publisher=~m/出版者不详/) {#当存在英文的[s.n.]
- $publisher="";
- }
- $date=$year;
- }
- }
-
-
- #---------------------------------------------------------------
- #条目类型:专著中析出文献/inbook
- #---------------------------------------------------------------
- if(1){
- if ($reference=~m/\[M\]\/\//){#匹配[M]//判断为inbook类型
- print "this entry's type is: inbook \n";
- $entrytype='inbook';
-
- $regexformach='\[M\]\/\/';
- &bfidentifier;
-
- $regexformach='M\]\/\/';
- &bfaddressinbook;
-
- &afpublisherbook;#出版社及之后的信息inbook/book一样的
-
-
- if ($address=~m/\[S\.l\.\]/ or $address=~m/出版地不详/) {#当存在英文的[s.n.]
- $address="";
- }
- if ($publisher=~m/\[s\.n\.\]/ or $publisher=~m/出版者不详/) {#当存在英文的[s.n.]
- $publisher="";
- }
- $date=$year;
- }
- }
-
-
- #---------------------------------------------------------------
- #条目类型:专著中析出文献但存在网址/inbook with url
- #---------------------------------------------------------------
- if(1){
- if ($reference=~m/\[M\/OL\]\/\//){#匹配[M]//判断为inbook类型
- print "this entry's type is: inbook \n";
- $entrytype='inbook';
-
-
- $regexformach='\[M\/OL\]\/\/';
- &bfidentifier;
-
- $regexformach='M\/OL\]\/\/';
- &bfaddressinbook;
-
- &afpublisherbookurl;#出版社及之后的信息inbook/book一样的
-
-
- if ($address=~m/\[S\.l\.\]/ or $address=~m/出版地不详/) {#当存在英文的[s.n.]
- $address="";
- }
- if ($publisher=~m/\[s\.n\.\]/ or $publisher=~m/出版者不详/) {#当存在英文的[s.n.]
- $publisher="";
- }
- $date=$year;
- }
- }
-
-
- #---------------------------------------------------------------
- #输出到bib文件中
- #---------------------------------------------------------------
- if(1){
- if($date=~m/-\d{4}/){#存在enddate的情况下,将中间的连字符转化成斜杠
- print 'date=',$date,"\n";
- ($datetempa,$datetempb)=($date=~m/(.*)-(\d{4}.*)/);
- $date=$datetempa.'/'.$datetempb;
- print 'date=',$date,"\n";
- }
-
- if($url=~m/.*\.$/){
- $urlplusdot=$url;
- ($url)=($urlplusdot=~m/(.*)\.$/);#去掉处于条目末尾的url地址后的点
- }
- #最后输出
- print "\n";
- print '@',"$entrytype",'{',"ref-$nline-$sn",',',"\n";
- $author&& print 'author = {',$author,'},',"\n";
- $title&& print 'title = {',$title,'},',"\n";
- $journal&& print 'journal = {',$journal,'},',"\n";
- $translator&& print 'translator= {',$translator,'},',"\n";
- $bookauthor&& print 'bookauthor= {',$bookauthor,'},',"\n";
- $booktitle&& print 'booktitle = {',$booktitle,'},',"\n";
- $version&& print 'version = {',$version,'},',"\n";
- $address&& print 'address = {',$address,'},',"\n";
- $publisher&& print 'publisher = {',$publisher,'},',"\n";
- $type&& print 'type = {',$type,'},',"\n";
- $date&& print 'date = {',$date,'},',"\n";
- $volume&& print 'volume = {',$volume,'},',"\n";
- $number&& print 'number = {',$number,'},',"\n";
- $pages&& print 'pages = {',$pages,'},',"\n";
- $eventdate&& print 'eventdate = {',$eventdate,'},',"\n";
- $urldate&& print 'urldate = {',$urldate,'},',"\n";
- $url&& print 'url = {',$url,'},',"\n";
- $doi&& print 'doi = {',$doi,'},',"\n";
- $note&& print 'note = {',$note,'},',"\n";
- print '}',"\n";
- print 'authorlabel=',$authorlabel,"\n";
-
-
- print FHW '@',"$entrytype",'{',"ref-$nline-$sn-$authorlabel",',',"\n";
- $author&& print FHW 'author = {',$author,'},',"\n";
- $title&& print FHW 'title = {',$title,'},',"\n";
- $journal&& print FHW 'journal = {',$journal,'},',"\n";
- $translator&& print FHW 'translator= {',$translator,'},',"\n";
- $bookauthor&& print FHW 'bookauthor= {',$bookauthor,'},',"\n";
- $booktitle&& print FHW 'booktitle = {',$booktitle,'},',"\n";
- $version&& print FHW 'version = {',$version,'},',"\n";
- $address&& print FHW 'address = {',$address,'},',"\n";
- $publisher&& print FHW 'publisher = {',$publisher,'},',"\n";
- $type&& print FHW 'type = {',$type,'},',"\n";
- $date&& print FHW 'date = {',$date,'},',"\n";
- $volume&& print FHW 'volume = {',$volume,'},',"\n";
- $number&& print FHW 'number = {',$number,'},',"\n";
- $pages&& print FHW 'pages = {',$pages,'},',"\n";
- $eventdate&& print FHW 'eventdate = {',$eventdate,'},',"\n";
- $urldate&& print FHW 'urldate = {',$urldate,'},',"\n";
- $url&& print FHW 'url = {',$url,'},',"\n";
- $doi&& print FHW 'doi = {',$doi,'},',"\n";
- $note&& print FHW 'note = {',$note,'},',"\n";
- print FHW '}',"\n";
- }
-
-
- print "\n";
- if($nline>=$ne){last;} #先跳过几行进行,配合后面的last进行当行测试
-}
-
- sub bfidentifier{#bf表示before,标识符前所有的类型都一样
- #$regexpformach=@_;
- #print '@_=', at _,"\n";
- #print 'regexpformach=',"$regexpformach \n";
- #标识符之前很容易匹配三个内容,序号,作者和标题
- if($reference=~m/.*\D\.\s\D.*$regexformach/){#匹配存在作者后的点的话,同时点号周围不是数字,有时标题中可能出现1.1这样的信息
- ($sn , $author , $title)=($reference=~m/\[(\d+)\]\s*(.*)\.\s(.*)$regexformach/);
- print 'sn =',"$sn \n";
- print 'author=',"$author \n";#作者多个姓名还需要处理,还要注意有前后缀的情况
- print 'title =',"$title \n";
- if($author=~m/等/){
- $author=~s/等/others/;#将等换成others
- }else{
- $author=~s/,\s*$//;#将最后一个逗号去掉
- }
- if($author=~m/et\sal/){
- $author=~s/et\sal/others/;#将et al.换成others
- }else{
- $author=~s/,\s*$//;#将最后一个逗号去掉
- }
- while($author=~m/,/){
- $author=~s/,/ and /;#将逗号换成and
- }
- print 'author=',"$author \n";
- }else{#不存在作者的话\[M\]\/\/
- ($sn , $title)=($reference=~m/\[(\d+)\]\s*(.*)$regexformach/);#标识符之前很容易匹配三个内容,序号,作者和标题
- print 'sn =',"$sn \n";
- print 'title =',"$title \n";
- }
-
- #进一步处理责任者的姓名,主要针对英文名需要有一些符号进行区分姓,名,前缀和后缀。
- @names=split('and',$author);
- print 'names=', at names,"\n";
- $author="";
- $j=0;
- foreach $name(@names){#一个姓名一个姓名处理
-
- $j=$j+1;
- #print $name,"\n";
- @nameparts=split(' ',$name);
- #print 'nameparts=', at nameparts,"\n";
-
- $org=0;
- for($k=0;$k<@nameparts;$k++){
- if(@nameparts[$k]=~m/.{2,}/ and @nameparts[$k]!~m/\s*von\s*/i and @nameparts[$k]!~m/\s*jr\s*/i){
- #当分解的单作者的各个部分,存在两个以上为2个字符以上的情况,说明不是一般的姓名而是机构作者
- $org=$org+1;
- print 'org=',"$org\n";
- }
- }
-
- if(@nameparts>1){
- if(@nameparts[0]=~m/\s*von\s*/i){#确定姓的位置
- $family=1;
- @nameparts[1]=@nameparts[1].',';
- }else{
- $family=0;
- @nameparts[0]=@nameparts[0].',';
- }
- if(@nameparts[-1]=~m/\s*jr\s*/i){#确定后缀的位置
- @nameparts[-1]=@nameparts[-1].'.,';
- $given=@nameparts-2;
- $suffix=1;
- }else{
- $suffix=0;
- $given=@nameparts-1;
- }
- print 'family=',$family,"\n";
- print 'given=',$given,"\n";
- print 'suffix=',$suffix,"\n";
- print 'familyname=', at nameparts[$family],"\n";
-
- $namefmt="";
- for($i=0;$i<=$family;$i++){
- $namefmt=$namefmt. at nameparts[$i].' ';
- print $i,$family,$namefmt,"\n";
- }
- if($suffix){
- $namefmt=$namefmt. at nameparts[-1].' ';
- }
- for($i=$family+1;$i<=$given;$i++){
- $namefmt=$namefmt. at nameparts[$i].' ';
- print $i,$family,$namefmt,"\n";
- }
- }else{
- $namefmt=$name;
- }
- if($org > 1){#当是机构作者时
- $namefmt='{'.$name.'}';
- }
- print 'namefmt=',"$namefmt \n";
-
- if($j==1){#把姓名用and连接起来
- $author=$namefmt;
- }else{
- $author=$author.' and '.$namefmt;
- }
-
- if($j==1){#根据第一个作者构建authorlabel
- if($org > 1){#机构作者取各单词的首字母
- $authorlabel='';
- for($k=0;$k<@nameparts;$k++){
- ($strtmp)=($nameparts[$k]=~/^(.)/);
- $authorlabel=$authorlabel.$strtmp;
- }
- }else{#姓名则仅取作者姓
- ($authorlabel)=$nameparts[$family];
- if($authorlabel=~m/,$/){$authorlabel=~s/,$//;}#去掉最后的逗号
- }
- }
- }
- while($author=~m/\s{2,}/){
- $author=~s/\s{2,}/ /;#将多余的空格去掉
- }
- while($author=~m/\.{2,}/){
- $author=~s/\.{2,}/\./;#将多余的点去掉
- }
- print 'author=',"$author\n";
- }
-
-
- sub bfaddressbook{#bf表示before,出版者前book和inbook不一样
- #对于book类型,必然存在出版地和出版者信息,以此为根据展开
- print 'sub:bfaddressbook ',"\n";
- if($reference!~m/$regexformach\s*[^:]+:\s\D{1,}.*/){#如果不存在出版地和出版者信息
- ($pospublisher)=($reference=~m/$regexformach\s*(.*)/);
- print 'pospublisher=',"$pospublisher \n";
- }else{
- ($preaddress, $pospublisher)=($reference=~m/$regexformach\s*([^:]+):\s(\D{1,}.*)/);#标识符之后根据第一个冒号分为包括地址的信息和包括出版者的信息两部分
- print 'preaddress =',"$preaddress \n";
- print 'pospublisher=',"$pospublisher \n";
-
- #处理出版地及其前面的信息
- if ($preaddress=~m/.*\[S\.l\.\].*/) {#当存在英文的[S.l.],英文的一般不存在译者,所以下面处理比较简单
- $preaddress=~s/\[S\.l\.\]/\[S-l-\]/; #先将[S.l.]换成[S-l-]然后换回来
- }
- if ($preaddress=~m/.*\d.*\.\s*.*/){#匹配存在数字版本的话
- ($preversion, $version, $address)=($preaddress=~m/(.*)(\d)[^\.]*\.\s*(.*)/);
- print 'preversion =',"$preversion \n";
- print 'version =',"$version \n";
- print 'address =',"$address \n";
- if($preversion=~m/.*\..*/){#如果存在译者等信息
- ($translator)=($preversion=~m/(.*)\..*/);
- print 'translator =',"$translator \n";#作者多个姓名还需要处理,还有译这个标识
- }
- }else {#不存在数字版本的话
- if($preaddress=~m/.*\.\s+.*/){#存在点加空格,表示存在其他作者信息,区别点在末尾但无空格
- ($preversion,$address)=($preaddress=~m/(.*)\.\s*(.*)/);
- print 'preversion =',"$preversion \n";
- print 'address =',"$address \n";
- $translator=$preversion;
- print 'translator =',"$translator \n";
- }else{
- $address=$preaddress;
- print 'address =',"$address \n";
- }
- }
-
- if($translator=~m/译/){#当译者真实存在
- $translator=~s/,\s*译//;#将译去掉
- if($translator=~m/等/){
- $translator=~s/等/others/;#将等换成others
- }else{
- $translator=~s/,\s*$//;#将最后一个逗号去掉
- }
- while($translator=~m/,/){
- $translator=~s/,/ and /;#将逗号换成and
- }
- print 'translator =',"$translator \n";
- }else {#当译者不存在,那么translator中信息可能是非数字的版本信息
- unless($version) {#除非version没有信息
- $version=$translator;
- $translator="";
- }else{
- print "version is already exisit!\n";
- print 'version=',$version,"\n";
- print 'translator=',$translator,"\n";
- }
- }
-
- if ($address=~m/.*\[S-l-\].*/) {#当存在英文的[S-l-][S.l.]
- $address=~s/\[S-l-\]/\[S\.l\.\]/; #将[S-l-]换回[S.l.]
- }
- }
- }
-
-
- sub bfaddressinbook{#bf表示before,出版者前book和inbook不一样
- ($postitle)=($reference=~m/$regexformach\s*(.*)/);
- print 'postitle=',$postitle,"\n";
- if($postitle=~m/^[^:\.]+:[^:\.]+\./){#当存在析出源第一项中出现:时
- $postitle=~s/:/colon/;#先将该冒号换成colon
- print 'postitle=',$postitle,"\n";
- }
- #对于inbook类型,必然存在出版地和出版者信息,以此为根据展开
- ($preaddress, $pospublisher)=($postitle=~m/\s*(.*):\s(\D.*)/);
- #($preaddress, $pospublisher)=($postitle=~m/\s*([^:]+):\s(\D.*)/);
- #标识符之后根据第一个冒号分为包括地址的信息和包括出版者的信息两部分
- print 'preaddress =',"$preaddress \n";
- print 'pospublisher=',"$pospublisher \n";
-
- #处理出版地及其前面的信息
- if ($preaddress=~m/.*\[S\.l\.\].*/) {#当存在英文的[S.l.],英文的一般不存在译者,所以下面处理比较简单
- $preaddress=~s/\[S\.l\.\]/\[S-l-\]/; #先将[S.l.]换成[S-l-]然后换回来
- }
- if ($preaddress=~m/.*\d.*\.\s+.*/ and ($preaddress=~m/.*th\sed.*/ or $preaddress=~m/.*版.*/)){#匹配存在数字版本的话
- ($preversion, $version, $address)=($preaddress=~m/(.*)(\d)[^\.]*\.\s+(.*)/);
- print 'preversion =',"$preversion \n";
- print 'version =',"$version \n";
- print 'address =',"$address \n";
- if($preversion=~m/.*\.\s+.*/){#如果存在译者等信息
- ($translator)=($preversion=~m/(.*)\.\s+.*/);
- print 'translator =',"$translator \n";#作者多个姓名还需要处理,还有译这个标识
- }
- }else {#不存在数字版本的话
- if($preaddress=~m/.*\.\s+.*/){#存在点加空格,表示存在其他作者信息,区别点在末尾但无空格
- ($preversion,$address)=($preaddress=~m/(.*)\.\s+(.*)/);
- print 'preversion =',"$preversion \n";
- print 'address =',"$address \n";
- if($preversion=~m/.*\.\s+.*/){#中间还存在点加空格
- ($bookauthor,$booktitle)=($preversion=~m/(.*)\.\s+(.*)/);
-
- if($bookauthor=~m/等/){
- $bookauthor=~s/等/others/;#将等换成others
- }else{
- $bookauthor=~s/,\s*$//;#将最后一个逗号去掉
- }
- if($bookauthor=~m/et\sal/){
- $bookauthor=~s/et\sal/others/;#将et al.换成others
- }else{
- $bookauthor=~s/,\s*$//;#将最后一个逗号去掉
- }
- while($bookauthor=~m/,/){
- $bookauthor=~s/,/ and /;#将逗号换成and
- }
- print 'bookauthor=',"$bookauthor \n";
- }else{
- $booktitle=$preversion;
- }
- }else{
- $address=$preaddress;
- print 'address =',"$address \n";
- }
- }
-
- if ($address=~m/.*\[S-l-\].*/) {#当存在英文的[S-l-][S.l.]
- $address=~s/\[S-l-\]/\[S\.l\.\]/; #将[S-l-]换回[S.l.]
- }
- if ($booktitle=~m/.*colon.*/) {#当存在colon
- $booktitle=~s/colon/:/; #将colon换回:
- }
-
- #进一步处理责任者的姓名,主要针对英文名需要有一些符号进行区分姓,名,前缀和后缀。
- @names=split('and',$bookauthor);
- print 'names=', at names,"\n";
- $bookauthor="";
- $j=0;
- foreach $name(@names){
- $j=$j+1;
- #print $name,"\n";
- @nameparts=split(' ',$name);
- #print 'nameparts=', at nameparts,"\n";
-
- $org=0;
- for($k=0;$k<@nameparts;$k++){
- if(@nameparts[$k]=~m/.{2,}/ and @nameparts[$k]!~m/\s*von\s*/i and @nameparts[$k]!~m/\s*jr\s*/i){
- #当分解的单作者的各个部分,存在两个以上为2个字符以上的情况,说明不是一般的姓名而是机构作者
- $org=$org+1;
- print 'org=',"$org\n";
- }
- }
-
- if(@nameparts>1){
- if(@nameparts[0]=~m/\s*von\s*/i){#确定姓的位置
- $family=1;
- @nameparts[1]=@nameparts[1].',';
- }else{
- $family=0;
- @nameparts[0]=@nameparts[0].',';
- }
- if(@nameparts[-1]=~m/\s*jr\s*/i){#确定后缀的位置
- @nameparts[-1]=@nameparts[-1].'.,';
- $given=@nameparts-2;
- $suffix=1;
- }else{
- $suffix=0;
- $given=@nameparts-1;
- }
- #print 'family=',$family,"\n";
- #print 'given=',$given,"\n";
- #print 'suffix=',$suffix,"\n";
-
- $namefmt="";
- for($i=0;$i<=$family;$i++){
- $namefmt=$namefmt. at nameparts[$i].' ';
- #print $i,$family,$namefmt,"\n";
- }
- if($suffix){
- $namefmt=$namefmt. at nameparts[-1].' ';
- }
- for($i=$family+1;$i<=$given;$i++){
- $namefmt=$namefmt. at nameparts[$i].' ';
- }
- }else{
- $namefmt=$name;
- }
- if($org > 1){#当是机构作者时
- $namefmt='{'.$name.'}';
- }
- #print 'namefmt=',"$namefmt \n";
-
- if($j==1){
- $bookauthor=$namefmt;
- }else{
- $bookauthor=$bookauthor.' and '.$namefmt;
- }
- }
- while($bookauthor=~m/\s{2,}/){
- $bookauthor=~s/\s{2,}/ /;#将多余的空格去掉
- }
- while($bookauthor=~m/\.{2,}/){
- $bookauthor=~s/\.{2,}/\./;#将多余的点去掉
- }
- print 'bookauthor=',"$bookauthor\n";
- }
-
-
- sub afpublisherbook{#af表示after,出版者后book和inbook一样,但如果存在url则不同
- #处理出版者及其后面的信息
- if ($pospublisher=~m/.*\[s\.n\.\].*/) {#当存在英文的[s.n.]
- $pospublisher=~s/\[s\.n\.\]/\[s-n-\]/; #先将[s.n.]换成[s-n-]然后换回来
- }
- if ($pospublisher=~m/.*,\s*\d{4}\S+/){#匹配存在年份的话
- ($publisher, $year, $posyear)=($pospublisher=~m/(.*),\s*(\d{4})(.*)/);
- print 'publisher=',"$publisher \n";
- print 'year =',"$year \n";
- print 'posyear =',"$posyear \n";
- if($posyear=~m/^:/){#匹配存在页码前面的冒号的话
- ($pages, $pospages)=($posyear=~m/^:([^\.]+)\.(.*)/);
- print 'pages =',"$pages \n";
- print 'pospages=',"$pospages \n";
- if($pospages=~m/DOI/i){#匹配存在doi的话
- ($doi)=($pospages=~m/DOI:(.*)\./i);
- print 'doi=',"$doi \n";
- }
- }else{#不存在页码的话
- if($posyear=~m/DOI/i){#匹配存在doi的话
- ($doi)=($posyear=~m/DOI:(.*)\./i);
- print 'doi=',"$doi \n";
- }
- }
- }else{#不存在年份,匹配一下是否存在冒号和页码
- if($pospublisher=~m/.*[^DOI]:.*/i){#当存在不是doi后面的冒号时,说明有页码
- ($publisher, $pages, $pospages)=($pospublisher=~m/([^:]*):([^\.]*)\.(.*)/);
- print 'publisher=',"$publisher \n";
- print 'pages =',"$pages \n";
- print 'pospages =',"$pospages \n";
- if($pospages=~m/DOI/i){#匹配存在doi的话
- ($doi)=($pospages=~m/DOI:(.*)\./i);
- print 'doi=',"$doi \n";
- }
- }else{#没有页码冒号以点作为出版者后的分隔点
- ($publisher, $pospages)=($pospublisher=~m/([^\.]*)\.(.*)/);
- print 'publisher=',"$publisher \n";
- print 'pospages =',"$pospages \n";
- if($pospages=~m/DOI/i){#匹配存在doi的话
- ($doi)=($pospages=~m/DOI:(.*)\./i);
- print 'doi=',"$doi \n";
- }
- }
- }
- if ($publisher=~m/.*\[s-n-\].*/) {#当存在英文的[s-n-]
- $publisher=~s/\[s-n-\]/\[s\.n\.\]/; #将[s-n-]换回[s.n.]
- }
- }
-
-
- sub afpublisherbookurl{#af表示after,出版者后book和inbook一样,但如果存在url则不同
- #处理出版者及其后面的信息
- if ($pospublisher=~m/.*\[s\.n\.\].*/) {#当存在英文的[s.n.]
- $pospublisher=~s/\[s\.n\.\]/\[s-n-\]/; #先将[s.n.]换成[s-n-]然后换回来
- }
- if ($pospublisher=~m/.*,\s*\d{4}[^\d-]/){#匹配存在年份的话,4个数字后面跟着不能是数字和连字符-
- ($publisher, $year, $posyear)=($pospublisher=~m/(.*),\s*(\d{4})(.*)/);
- print 'publisher=',"$publisher \n";
- print 'year =',"$year \n";
- print 'posyear =',"$posyear \n";
- if($posyear=~m/^:/){#匹配存在页码前面的冒号的话
- ($pages, $pospages)=($posyear=~m/^:([^\.]+)\.(.*)/);
- print 'pages =',"$pages \n";
- print 'pospages=',"$pospages \n";
- if($pages=~m/\[.*\]/){
- ($pagesa, $urldate)=($pages=~m/(.*)\[(.*)\]/);
- $pages=$pagesa;
- print 'urldate=',"$urldate \n";
- print 'pages=',"$pages \n";
- }
- if($pospages=~m/DOI/i){#匹配存在doi的话
- ($url, $doi)=($pospages=~m/(.*)\.\s*DOI:(.*)\./i);
- print 'url=',"$url \n";
- print 'doi=',"$doi \n";
- }else{
- ($url)=($pospages=~m/(.*)\./i);
- print 'url=',"$url \n";
- }
- }
- else{#不存在页码的话
- if($posyear=~m/\[.*\]/){
- ($urldate,$pospages)=($posyear=~m/.*\[(.*)\]\.(.*)/);
- print 'urldate=',"$urldate \n";
- print 'pospages=',"$pospages \n";
- }
- else{#不存在页码,又不存在引用日期的话,那么会有一个点和空格
- ($pospages)=($posyear=~m/.*\s(.*)/);
- print 'pospages=',"$pospages \n";
- }
- if($pospages=~m/DOI/i){#匹配存在doi的话
- ($url, $doi)=($pospages=~m/(.*)\.\s*DOI:(.*)\./i);
- print 'url=',"$url \n";
- print 'doi=',"$doi \n";
- }else{
- ($url)=($pospages=~m/(.*)\./i);
- print 'url=',"$url \n";
- }
- }
- }else{#不存在年份,匹配一下是否存在冒号和页码
- if($pospublisher=~m/.*[^DOIhttp]:.*/i){#当存在不是doi或http后面的冒号时,说明有页码
- ($publisher, $pages, $pospages)=($pospublisher=~m/([^:]*):([^\.]*)\.(.*)/);
- print 'publisher=',"$publisher \n";
- print 'pages =',"$pages \n";
- print 'pospages =',"$pospages \n";
- if($pages=~m/\[.*\]/){
- ($pagesa, $urldate)=($pages=~m/(.*)\[(.*)\]/);
- $pages=$pagesa;
- print 'urldate=',"$urldate \n";
- print 'pages=',"$pages \n";
- }
- if($pospages=~m/DOI/i){#匹配存在doi的话
- ($url, $doi)=($pospages=~m/(.*)\.\s*DOI:(.*)\./i);
- print 'url=',"$url \n";
- print 'doi=',"$doi \n";
- }else{
- ($url)=($pospages=~m/(.*)\./i);
- print 'url=',"$url \n";
- }
- }else{#没有页码冒号以点作为出版者后的分隔点
- ($publisher, $pospages)=($pospublisher=~m/([^\.]*)\.(.*)/);
- print 'publisher=',"$publisher \n";
- print 'pospages =',"$pospages \n";
- if($publisher=~m/\[.*\]/){
- ($publishera, $urldate)=($publisher=~m/(.*)\[(.*)\]/);
- $publisher=$publishera;
- print 'urldate=',"$urldate \n";
- print 'publisher=',"$publisher \n";
- }
- if($pospages=~m/DOI/i){#匹配存在doi的话
- ($url, $doi)=($pospages=~m/(.*)\.\s*DOI:(.*)\./i);
- print 'url=',"$url \n";
- print 'doi=',"$doi \n";
- }else{
- ($url)=($pospages=~m/(.*)\./i);
- print 'url=',"$url \n";
- }
- }
- }
- if ($publisher=~m/.*\[s-n-\].*/) {#当存在英文的[s-n-]
- $publisher=~s/\[s-n-\]/\[s\.n\.\]/; #将[s-n-]换回[s.n.]
- }
- }
-
-
- sub afpublisherbookb{#af表示after,出版者后book和inbook一样,但如果存在url则不同
- #处理出版者及其后面的信息
- if ($pospublisher=~m/.*\[s\.n\.\].*/) {#当存在英文的[s.n.]
- $pospublisher=~s/\[s\.n\.\]/\[s-n-\]/; #先将[s.n.]换成[s-n-]然后换回来
- }
- if ($pospublisher=~m/.*[\.\s,]*\d{4}[\D\S]+/){#匹配存在年份的话,年份前面没有逗号+空格
- ($publisher, $year, $posyear)=($pospublisher=~m/(.*)[\.\s,]*(\d{4})([\D\S].*)/);
- print 'publisher=',"$publisher \n";
- if($publisher=~m/[,\s]+$/){$publisher=~s/[,\s]+$//;}#去掉最后的逗号
- unless($address){#当没有出版地时,也没有必要存在
- $version=$publisher;
- $publisher='';
- }
- print 'year =',"$year \n";
- print 'posyear =',"$posyear \n";
- if($posyear=~m/^:/){#匹配存在页码前面的冒号的话
- ($pages, $pospages)=($posyear=~m/^:([^\.]+)\.(.*)/);
- print 'pages =',"$pages \n";
- print 'pospages=',"$pospages \n";
- if($pospages=~m/DOI/i){#匹配存在doi的话
- ($doi)=($pospages=~m/DOI:(.*)\./i);
- print 'doi=',"$doi \n";
- }
- }else{#不存在页码的话
- if($posyear=~m/DOI/i){#匹配存在doi的话
- ($doi)=($posyear=~m/DOI:(.*)\./i);
- print 'doi=',"$doi \n";
- }
- }
- }else{#不存在年份,匹配一下是否存在冒号和页码
- if($pospublisher=~m/.*[^DOI]:.*/i){#当存在不是doi后面的冒号时,说明有页码
- ($publisher, $pages, $pospages)=($pospublisher=~m/([^:]*):([^\.]*)\.(.*)/);
- print 'publisher=',"$publisher \n";
- print 'pages =',"$pages \n";
- print 'pospages =',"$pospages \n";
- if($pospages=~m/DOI/i){#匹配存在doi的话
- ($doi)=($pospages=~m/DOI:(.*)\./i);
- print 'doi=',"$doi \n";
- }
- }else{#没有页码冒号以点作为出版者后的分隔点
- ($publisher, $pospages)=($pospublisher=~m/([^\.]*)\.(.*)/);
- print 'publisher=',"$publisher \n";
- print 'pospages =',"$pospages \n";
- if($pospages=~m/DOI/i){#匹配存在doi的话
- ($doi)=($pospages=~m/DOI:(.*)\./i);
- print 'doi=',"$doi \n";
- }
- }
- if($publisher=~m/,$/){$publisher=~s/,$//;}#去掉最后的逗号
- unless($address){#当没有出版地时,也没有必要存在
- $type=$publisher;
- $publisher='';
- }
- }
- if ($publisher=~m/.*\[s-n-\].*/) {#当存在英文的[s-n-]
- $publisher=~s/\[s-n-\]/\[s\.n\.\]/; #将[s-n-]换回[s.n.]
- }
- }
-
-
-
- sub afpublisherbookurlb{#af表示after,出版者后book和inbook一样,但如果存在url则不同
- #处理出版者及其后面的信息
- if ($pospublisher=~m/.*\[s\.n\.\].*/) {#当存在英文的[s.n.]
- $pospublisher=~s/\[s\.n\.\]/\[s-n-\]/; #先将[s.n.]换成[s-n-]然后换回来
- }
- if ($pospublisher=~m/.*[\.\s,]*\d{4}[^\d-]/){#匹配存在年份的话,4个数字后面跟着不能是数字和连字符-
- ($publisher, $year, $posyear)=($pospublisher=~m/(.*)[\.\s,]*(\d{4})([^\d-].*)/);
- print 'publisher=',"$publisher \n";
- print 'year =',"$year \n";
- print 'posyear =',"$posyear \n";
- if($publisher=~m/,$/){$publisher=~s/,$//;}#去掉最后的逗号
- unless($address){#当没有出版地时,也没有必要存在
- $version=$publisher;
- $publisher='';
- }
- if($posyear=~m/^:/){#匹配存在页码前面的冒号的话
- ($pages, $pospages)=($posyear=~m/^:([^\.]+)\.(.*)/);
- print 'pages =',"$pages \n";
- print 'pospages=',"$pospages \n";
- if($pages=~m/\[.*\]/){
- ($pagesa, $urldate)=($pages=~m/(.*)\[(.*)\]/);
- $pages=$pagesa;
- print 'urldate=',"$urldate \n";
- print 'pages=',"$pages \n";
- }
- if($pospages=~m/DOI/i){#匹配存在doi的话
- ($url, $doi)=($pospages=~m/(.*)\.\s*DOI:(.*)\./i);
- print 'url=',"$url \n";
- print 'doi=',"$doi \n";
- }else{
- ($url)=($pospages=~m/(.*)\./i);
- print 'url=',"$url \n";
- }
- }
- else{#不存在页码的话
- if($posyear=~m/\[.*\]/){
- ($urldate,$pospages)=($posyear=~m/.*\[(.*)\]\.(.*)/);
- print 'urldate=',"$urldate \n";
- print 'pospages=',"$pospages \n";
- }
- else{#不存在页码,又不存在引用日期的话,那么会有一个点和空格
- ($pospages)=($posyear=~m/.*\s(.*)/);
- print 'pospages=',"$pospages \n";
- }
- if($pospages=~m/DOI/i){#匹配存在doi的话
- ($url, $doi)=($pospages=~m/(.*)\.\s*DOI:(.*)\./i);
- print 'url=',"$url \n";
- print 'doi=',"$doi \n";
- }else{
- ($url)=($pospages=~m/(.*)\./i);
- print 'url=',"$url \n";
- }
- }
- }else{#不存在年份,匹配一下是否存在冒号和页码
- if($pospublisher=~m/.*[^DOIhttp]:.*/i){#当存在不是doi或http后面的冒号时,说明有页码
- ($publisher, $pages, $pospages)=($pospublisher=~m/([^:]*):([^\.]*)\.(.*)/);
- print 'publisher=',"$publisher \n";
- print 'pages =',"$pages \n";
- print 'pospages =',"$pospages \n";
- if($pages=~m/\[.*\]/){
- ($pagesa, $urldate)=($pages=~m/(.*)\[(.*)\]/);
- $pages=$pagesa;
- print 'urldate=',"$urldate \n";
- print 'pages=',"$pages \n";
- }
- if($pospages=~m/DOI/i){#匹配存在doi的话
- ($url, $doi)=($pospages=~m/(.*)\.\s*DOI:(.*)\./i);
- print 'url=',"$url \n";
- print 'doi=',"$doi \n";
- }else{
- ($url)=($pospages=~m/(.*)\./i);
- print 'url=',"$url \n";
- }
- }else{#没有页码冒号以点作为出版者后的分隔点
- ($publisher, $pospages)=($pospublisher=~m/([^\.]*)\.(.*)/);
- print 'publisher=',"$publisher \n";
- print 'pospages =',"$pospages \n";
- if($publisher=~m/\[.*\]/){
- ($publishera, $urldate)=($publisher=~m/(.*)\[(.*)\]/);
- $publisher=$publishera;
- print 'urldate=',"$urldate \n";
- print 'publisher=',"$publisher \n";
- }
- if($pospages=~m/DOI/i){#匹配存在doi的话
- ($url, $doi)=($pospages=~m/(.*)\.\s*DOI:(.*)\./i);
- print 'url=',"$url \n";
- print 'doi=',"$doi \n";
- }else{
- ($url)=($pospages=~m/(.*)\./i);
- print 'url=',"$url \n";
- }
- }
- if($publisher=~m/,$/){$publisher=~s/,$//;}#去掉最后的逗号
- unless($address){#当没有出版地时,也没有必要存在
- $type=$publisher;
- $publisher='';
- }
- }
- if ($publisher=~m/.*\[s-n-\].*/) {#当存在英文的[s-n-]
- $publisher=~s/\[s-n-\]/\[s\.n\.\]/; #将[s-n-]换回[s.n.]
- }
- }
-
-
-
-close (FHR);
-close (FHW);
\ No newline at end of file
Deleted: trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015.tex 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015.tex 2021-01-19 22:57:40 UTC (rev 57468)
@@ -1,15 +0,0 @@
-\documentclass{article}
-\usepackage{pdfpages}%直接插入pdf文件页
-\graphicspath{{egfigure/}{example/}}
-
-\begin{document}
-
-\includepdf[pages=-]{egfigure/tgbcitation.pdf}
-
-\IfFileExists{egfigure/tngbcitationay.pdf}
-{\includepdf[pages=-]{egfigure/tngbcitationay.pdf}}
-{\includepdf[pages=-]{egfigure/tngbcitationaynew.pdf}}
-
-\includepdf[pages=-]{egfigure/tgbbiblio.pdf}
-
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015eg.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015eg.tex 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015eg.tex 2021-01-19 22:57:40 UTC (rev 57468)
@@ -1,114 +0,0 @@
-\documentclass{article}
-\usepackage[colorlinks=true]{hyperref}
-\usepackage{pdfpages}%直接插入pdf文件页
-\graphicspath{{egfigure/}{example/}}
-
-\begin{document}
-
-\phantomsection
-%\addcontentsline{toc}{section}{cls-beamer}
-\includepdf[pages=-,addtotoc={1,section,1,cls-beamer,eg:beamer}]{example/cls-beamer.pdf}
-
-
-\phantomsection
-%\addcontentsline{toc}{section}{cls-beameray}
-\includepdf[pages=-,addtotoc={1,section,1,cls-beameray,eg:beameray}]{example/cls-beameray.pdf}
-
-
-\phantomsection
-%\addcontentsline{toc}{section}{codeopt-gbcodegbk}
-\includepdf[pages=-,addtotoc={1,section,1,codeopt-gbcodegbk,eg:gbk}]{example/codeopt-gbcodegbk.pdf}
-
-
-\phantomsection
-%\addcontentsline{toc}{section}{eg-opt-gbstyle}
-\includepdf[pages=-,addtotoc={1,section,1,eg-opt-gbstyle,eg:multistyle}]{example/eg-opt-gbstyle.pdf}
-
-
-\phantomsection
-%\addcontentsline{toc}{section}{opt-gbalign-center}
-\includepdf[pages=-,addtotoc={1,section,1,opt-gbalign-center,eg:aligncenter}]{example/opt-gbalign-center.pdf}
-
-
-\phantomsection
-%\addcontentsline{toc}{section}{opt-gbalign-gb}
-\includepdf[pages=-,addtotoc={1,section,1,opt-gbalign-gb,eg:aligngb}]{example/opt-gbalign-gb.pdf}
-
-
-\phantomsection
-%\addcontentsline{toc}{section}{opt-gbalign-left}
-\includepdf[pages=-,addtotoc={1,section,1,opt-gbalign-left,eg:alignleft}]{example/opt-gbalign-left.pdf}
-
-
-\phantomsection
-%\addcontentsline{toc}{section}{opt-gbbiblabel}
-\includepdf[pages=-,addtotoc={1,section,1,opt-gbbiblabel,eg:biblabel}]{example/opt-gbbiblabel.pdf}
-
-
-
-
-
-\phantomsection
-%\addcontentsline{toc}{section}{opt-gbfieldstd}
-\includepdf[pages=-,addtotoc={1,section,1,opt-gbfieldstd,eg:fieldstd}]{example/opt-gbfieldstd.pdf}
-
-
-\phantomsection
-%\addcontentsline{toc}{section}{opt-gbnamefmt}
-\includepdf[pages=-,addtotoc={1,section,1,opt-gbnamefmt,eg:namefmt}]{example/opt-gbnamefmt.pdf}
-
-
-\phantomsection
-%\addcontentsline{toc}{section}{opt-gbnamefmt-default}
-\includepdf[pages=-,addtotoc={1,section,1,opt-gbnamefmt-default,eg:namefmta}]{example/opt-gbnamefmt-default.pdf}
-
-
-
-\phantomsection
-%\addcontentsline{toc}{section}{opt-gbpub-true}
-\includepdf[pages=-,addtotoc={1,section,1,opt-gbpub-true,eg:pub}]{example/opt-gbpub-true.pdf}
-
-
-\phantomsection
-%\addcontentsline{toc}{section}{opt-gbpunctin}
-\includepdf[pages=-,addtotoc={1,section,1,opt-gbpunctin,eg:in}]{example/opt-gbpunctin.pdf}
-
-
-\phantomsection
-%\addcontentsline{toc}{section}{opt-gbtitlelink}
-\includepdf[pages=-,addtotoc={1,section,1,opt-gbtitlelink,eg:titlelink}]{example/opt-gbtitlelink.pdf}
-
-
-
-\phantomsection
-%\addcontentsline{toc}{section}{opt-footbib}
-\includepdf[pages=-,addtotoc={1,section,1,opt-gbfootbib,eg:footbib}]{example/opt-gbfootbib.pdf}
-
-
-\phantomsection
-%\addcontentsline{toc}{section}{opt-gbtype}
-\includepdf[pages=-,addtotoc={1,section,1,opt-gbtype,eg:entrytype}]{example/opt-gbtype.pdf}
-
-\phantomsection
-%\addcontentsline{toc}{section}{opt-gbctexset}
-\includepdf[pages=-,addtotoc={1,section,1,opt-gbctexset,eg:ctexset}]{example/opt-gbctexset.pdf}
-
-\phantomsection
-%\addcontentsline{toc}{section}{opt-gbnoauthor-false}
-\includepdf[pages=-,addtotoc={1,section,1,opt-gbnoauthor-false,eg:noauthor}]{example/opt-gbnoauthor-false.pdf}
-
-
-\phantomsection
-%\addcontentsline{toc}{section}{opt-gbnoauthor-true}
-\includepdf[pages=-,addtotoc={1,section,1,opt-gbnoauthor-true,eg:noauthora}]{example/opt-gbnoauthor-true.pdf}
-
-
-\phantomsection
-%\addcontentsline{toc}{section}{opt-gblocal}
-\includepdf[pages=-,addtotoc={1,section,1,opt-gblocal,eg:local}]{example/opt-gblocal.pdf}
-
-
-
-
-
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015fmt.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015fmt.tex 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015fmt.tex 2021-01-19 22:57:40 UTC (rev 57468)
@@ -1,13 +0,0 @@
-\documentclass{article}
-\usepackage[colorlinks=true]{hyperref}
-\usepackage{pdfpages}%直接插入pdf文件页
-\graphicspath{{egfigure/}{example/}}
-
-\begin{document}
-
-
-\phantomsection
-%\addcontentsline{toc}{section}{testallformat}
-\includepdf[pages=-,addtotoc={1,section,1,allfmt,eg:allfmt}]{example/testallformat.pdf}
-
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015lan.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015lan.tex 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015lan.tex 2021-01-19 22:57:40 UTC (rev 57468)
@@ -1,45 +0,0 @@
-\documentclass{article}
-\usepackage[colorlinks=true]{hyperref}
-\usepackage{pdfpages}%直接插入pdf文件页
-\graphicspath{{egfigure/}{example/}}
-
-\begin{document}
-
-\phantomsection
-%\addcontentsline{toc}{section}{opt-eg-authoryear}
-\includepdf[pages=-,addtotoc={1,section,1,opt-eg-dblang,eg:doublelang}]{example/opt-eg-dblang.pdf}
-
-
-\phantomsection
-%\addcontentsline{toc}{section}{opt-eg-authoryear}
-\includepdf[pages=-,addtotoc={1,section,1,opt-eg-authoryear,eg:ay}]{example/opt-eg-authoryear.pdf}
-
-\phantomsection
-%\addcontentsline{toc}{section}{opt-autolang-multilan}
-\includepdf[pages=-,addtotoc={1,section,1,opt-autolang-multilan,eg:multilang}]{example/opt-autolang-multilan.pdf}
-
-
-\phantomsection
-%\addcontentsline{toc}{section}{opt-eg-multilan}
-\includepdf[pages=-,addtotoc={1,section,1,opt-eg-multilan,eg:multilanga}]{example/opt-eg-multilan.pdf}
-
-
-\phantomsection
-\includepdf[pages=-,addtotoc={1,section,1,opt-gblanorder-chineseahead,eg:lanordercnah}]{example/opt-gblanorder-chineseahead.pdf}
-
-\phantomsection
-\includepdf[pages=-,addtotoc={1,section,1,opt-gblanorder-englishahead,eg:lanorderenah}]{example/opt-gblanorder-englishahead.pdf}
-
-\phantomsection
-\includepdf[pages=-,addtotoc={1,section,1,opt-gblanorder-udforder,eg:lanorderudf}]{example/opt-gblanorder-udforder.pdf}
-
-\phantomsection
-\includepdf[pages=-,addtotoc={1,section,1,test-setlocal,eg:setlocalstring}]
-{example/test-setlocal.pdf}
-
-\phantomsection
-\includepdf[pages=-,addtotoc={1,section,1,test-setlocal-multilan,eg:setlocalstringmutillan}]
-{example/test-setlocal-multilan.pdf}
-
-
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015ms.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015ms.tex 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015ms.tex 2021-01-19 22:57:40 UTC (rev 57468)
@@ -1,15 +0,0 @@
-\documentclass{article}
-\usepackage{pdfpages}%直接插入pdf文件页
-\graphicspath{{egfigure/}{example/}}
-
-\begin{document}
-
-\includepdf[pages=-]{egfigure/tgbcitationms.pdf}
-
-\IfFileExists{egfigure/tngbcitationay.pdf}
-{\includepdf[pages=-]{egfigure/tngbcitationay.pdf}}
-{\includepdf[pages=-]{egfigure/tngbcitationaynew.pdf}}
-
-\includepdf[pages=-]{egfigure/tgbbiblioms.pdf}
-
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015thesis.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015thesis.tex 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015thesis.tex 2021-01-19 22:57:40 UTC (rev 57468)
@@ -1,68 +0,0 @@
-\documentclass{article}
-\usepackage[colorlinks]{hyperref}
-\usepackage{pdfpages}%直接插入pdf文件页
-\graphicspath{{egfigure/}{example/}}
-
-\begin{document}
-
-\tableofcontents
-
-\newpage
-%\addcontentsline{toc}{section}{BUPT}
-\includepdf[pages=-,addtotoc={1,section,1,BUPT,eg:BUPT}]{egthesis/thesis-bupt-numeric.pdf}
-
-
-%\addcontentsline{toc}{section}{CAU}
-\includepdf[pages=-,addtotoc={1,section,1,CAU,eg:CAU}]{egthesis/thesis-cau-numeric.pdf}
-
-
-%\addcontentsline{toc}{section}{ECNU}
-\includepdf[pages=-,addtotoc={1,section,1,ECNU,eg:ECNU}]{egthesis/thesis-ecnu-numeric.pdf}
-
-
-%\addcontentsline{toc}{section}{FDU}
-\includepdf[pages=-,addtotoc={1,section,1,FDU,eg:FDU}]{egthesis/thesis-fdu-numeric.pdf}
-
-
-%\addcontentsline{toc}{section}{NWAFU}
-\includepdf[pages=-,addtotoc={1,section,1,NWAFU,eg:nwafu}]{egthesis/thesis-nwafu-ay.pdf}
-
-%\addcontentsline{toc}{section}{SEU}
-\includepdf[pages=-,addtotoc={1,section,1,SEU,eg:seu}]{egthesis/thesis-seu-numeric.pdf}
-
-%\addcontentsline{toc}{section}{SJTU}
-\includepdf[pages=-,addtotoc={1,section,1,SJTU,eg:SJTU}]{egthesis/thesis-sjtu-numeric.pdf}
-
-
-%\addcontentsline{toc}{section}{THU}
-\includepdf[pages=-,addtotoc={1,section,1,THU,eg:THU}]{egthesis/thesis-thu-numeric.pdf}
-
-%\addcontentsline{toc}{section}{THU}
-\includepdf[pages=-,addtotoc={1,section,1,THU,eg:TongJi}]{egthesis/thesis-tongji.pdf}
-
-%\addcontentsline{toc}{section}{UCAS}
-\includepdf[pages=-,addtotoc={1,section,1,UCAS-m,eg:UCASm}]{egthesis/thesis-ucas-m.pdf}
-
-
-%\addcontentsline{toc}{section}{UIBE}
-\includepdf[pages=-,addtotoc={1,section,1,UIBE,eg:UIBE}]{egthesis/thesis-uibe-numeric.pdf}
-
-
-%\addcontentsline{toc}{section}{USTC}
-\includepdf[pages=-,addtotoc={1,section,1,USTC-ay,eg:USTCay}]{egthesis/thesis-ustc-authoryear.pdf}
-
-
-%\addcontentsline{toc}{section}{USTC}
-\includepdf[pages=-,addtotoc={1,section,1,USTC-num,eg:USTCnum}]{egthesis/thesis-ustc-numeric.pdf}
-
-
-%\addcontentsline{toc}{section}{XJTU}
-\includepdf[pages=-,addtotoc={1,section,1,XJTU,eg:XJTU}]{egthesis/thesis-xjtu-numeric.pdf}
-
-
-%\addcontentsline{toc}{section}{ZJU}
-\includepdf[pages=-,addtotoc={1,section,1,ZJU,eg:ZJU}]{egthesis/thesis-zju-numeric.pdf}
-
-
-
-\end{document}
Deleted: trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/readme-BibLatex-Check.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/readme-BibLatex-Check.md 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/readme-BibLatex-Check.md 2021-01-19 22:57:40 UTC (rev 57468)
@@ -1,27 +0,0 @@
-BibLatex-Check
-
-是Pezmc开发检查bib文件中参考文献条目和域是否符合biblatex设定的python脚本。
-输入为bib文件,输出为bib文件正确与否的信息,会包括域的欠缺信息等,为一个html文件,该用firefox打开会比较快。
-
-仓库见:https://github.com/Pezmc/BibLatex-Check
-
-用法:
-
-`./biblatex_check.py <-b input.bib> [-a input.aux] [-o output.html]`
-
-注意:aux和html文件是可选的。
-
-帮助命令:
-
-`./biblatex_check.py -h`
-
-选项:
-
-- -b (--bib=file.bib) Set the input Bib File
-- -a (--aux=file.aux) Set the input Aux File
-- -o (--output=file.html) Write results to the HTML Output File.
-- -v (--view) Open in Browser. Use together with -o.
-- -N (--no-console) Do not print problems to console. An exit code is always returned.
-
-
-
Deleted: trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/readme-BibLatex-map.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/readme-BibLatex-map.md 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/readme-BibLatex-map.md 2021-01-19 22:57:40 UTC (rev 57468)
@@ -1,152 +0,0 @@
-# biblatex-map.py
-
-是一个用于处理、修改和规范化bib文件的python脚本。
-
-主要功能包括:
-1. 基于biblatex的source map的逻辑修改bib文件中的参考文献信息
-2. 输入bib文件的解析,输出修改后的bib文件,以及json格式的参考文献文件
-3. 输出定制著录格式比如GB/T 7714-2015标准的参考文献表,输出文本或者thebibliography环境。简化格式定制方式
-4. 进一步可以实现一个宏包,实现一个简化功能的低配版biblatex
-
-处理的逻辑遵循biblatex的动态数据修改的规范,修改参数设置基本相同,只是把biblatex用tex命令表示的`\maps`、`\map`和`\step`转换为用json格式表示。
-
-等价于用python重新实现了biber的动态数据修改功能。
-
--------------------------------
-
-本来想将这一内容放到Pezmc开发的biblatex_check脚本中,但想想还是纯粹点好了。
-
--------------------------------
-
-Maintainer: huzhenzhen <hzzmail at 163.com>
-
-Homepage: <https://github.com/hushidong/biblatex-map>
-
-License:MIT license
-
-
---------------------------------------
-
-## 用法:
-
-直接在python命令行中运行
-
-`./biblatex-map.py`
-
-需要修改的bib文件在`biblatex-map.py`修改:
-
-```
-if __name__=="__main__":
-
- #设置输入的bib文件
- inputbibfile='biblatex-map-test.bib'
-
- #set the aux file
- #this is not necessary
- #auxfile='tex-source-code.aux'
-```
-
-输出的bib/json文件自动生成,当设置了aux文件后,那么输出的bib文件中条目将限制为aux中引用的文献条目。
-
-修改bib文件内容的配置用json格式表示,直接在`biblatex-map.py`修改sourcemaps参数:
-
-```
-#maps所有的修改用map构成一个maps
-sourcemaps=[
- [#map1:将ELECTRONIC类型转换为online类型
- [{"typesource":"ELECTRONIC","typetarget":"online"}]#step1
- ],
- [#map2:将source域转换为url域
- [{"fieldsource":"source","fieldtarget":"url"}]#step1
- ],
- [#map3:将urldate域的信息“yyyy-m-d”转换为“yyyy-mm-dd”,注意正则表达式直接写不用在外面套""
- [{"fieldsource":"urldate","match":r'(\d\d\d\d)\-(\d)\-(\d)',"replace":r'\1-0\2-0\3'}]#step1
- ],
- [#map4:将urldate域的信息“yyyy-m-d”转换为“yyyy-mm-dd”,注意正则表达式直接写不用在外面套""
- [{"fieldsource":"date","match":r'(\d\d\d\d)\-(\d)\-(\d)',"replace":r'\1-0\2-0\3',"overwrite":True}]#step1
- ],
- [#map5:将refdate域转换为urldate域
- [{"fieldsource":"refdate","fieldtarget":"urldate"}]#step1
- ],
- [#map6:对于newspaper类型,设置note为news
- [{"pertype":"newspaper"}],#step1
- [{"fieldset":"note","fieldvalue":"news","overwrite":True}]#step2
- ],
- [#map7:设置edition域等于version
- [{"fieldsource":"version","final":True}],#step1
- [{"fieldset":"edition","origfieldval":True}]#step2
- ],
- [#map8:设置entrykey域设置给keywords
- [{"fieldsource":"entrykey"}],#step1
- [{"fieldset":"keywords","origfieldval":True}]#step2
- ],
- [#map9:对于存在note域的情况,将其值添加到keywords
- [{"fieldsource":"note","final":True}],#step1
- [{"fieldset":"keywords","origfieldval":True,"overwrite":True,"append":True}]#step2
- ],
- [#map10:根据标题的字符编码范围确定标题的语言类型
- [{"fieldsource":"title","match":r'[\u2FF0-\u9FA5]',"final":True}],#step1
- [{"fieldset":"userd","fieldvalue":"chinese"}]#step2
- ],
-]
-```
-
-sourcemaps参数其实是json格式的。
-sourcemaps是一个列表,记录所有的修改,一个修改是一个map,也是一个列表。
-一个map列表中有任意数量的step(步骤),一个step内由一个key-val参数构成字典(dict)数据结构。
-
-处理逻辑是这样:
-```
- for map in maps #遍历maps中的所有map
- for entry in entries #对所有的条目均执行该map
- for step in map #遍历map中的所有step
- code for the step to modify the bib entry
-```
-
-需要注意:python中正则和perl中的略有不同,比如python用\xHH,\uHHHH,\UHHHHHHHH表示unicode字符,而perl直接用\x{HHHH}表示。
-
-## need to do:
-
-已实现的选项:
-typesource=?entrytype?
-typetarget=?entrytype?
-fieldsource=?entryfield?
-fieldtarget=?entryfield?
-match=?regexp?
-matchi=?regexp?
-notmatch=?regexp?
-notmatchi=?regexp?
-replace=?regexp?
-
-notfield=?entryfield?
-final=true, false default: false
-origfieldval=true, false default: false
-append=true, false default: false
-pertype
-pernottype
-
-fieldset=?entryfield?
-fieldvalue=?string?
-null=true, false default: false
-origfield=true, false default: false
-origentrytype=true, false default: false
-origfieldval=true, false default: false
-
-
-
-未实现的选项
-
-entryclone=?clonekey?
-entrynew=?entrynewkey?
-entrynewtype=?string?
-entrytarget=?string?
-entrynocite=true, false default: false
-entrynull=true, false default: false
-
-1. match 大小写区分的match
-
-
-
-
-
-
Modified: trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/chinese-erj.bbx
===================================================================
--- trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/chinese-erj.bbx 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/chinese-erj.bbx 2021-01-19 22:57:40 UTC (rev 57468)
@@ -1,237 +1,237 @@
-%%
-%% ---------------------------------------------------------------
-%% erj.bbx --- A bibliography style of Economic Research Journal in china
-%% modified from gb7714-2015ay at the request of ddswhu
-%% Maintained by huzhenzhen
-%% E-mail: hzzmail at 163.com
-%% Released under the LaTeX Project Public License v1.3c or later
-%% ---------------------------------------------------------------
-%%
-%%用法:类似于标准的样式在biblatex加载时设置样式
-%%文献表正常处理,标注命令主要用cite和textcite
-\ProvidesFile{chinese-erj.bbx}[2019/03/28 v1.0 a biblatex bibliography style for ERJ]
-
-
-%==================================================
-%加载gb样式
-%==================================================
-\RequireBibliographyStyle{gb7714-2015ay}
-\RequirePackage{mfirstuc}%单词首字母大写的问题
-\MFUnocap{in}%
-\MFUnocap{the}%
-\MFUnocap{of}%
-\MFUnocap{on}%
-\MFUnocap{and}%
-\MFUnocap{for}%
-
-
-%==================================================
-%考虑多音字增加multipinyin排序,是其可以根据key域添加拼音来排序
-%==================================================
-\DeclareSortingTemplate{multipinyin}{
- \sort{
- \field{presort}
- }
- \sort{
- \field{lansortorder}%language
- }
- \sort{
- \field{sortkey}
- }
- \sort{%[direction=descending]
- \field{sortname}
- \field{author}
- \field{editor}
- \field{translator}
- }
- \sort{
- \field{sortyear}
- \field{year}
- }
- \sort{
- \field{sorttitle}
- \field{title}
- }
- \sort{
- \field{volume}
- \literal{0}
- }
- }
-
-%==================================================
-%选项设置
-%==================================================
- \ExecuteBibliographyOptions{
- maxbibnames=99,
- gbtype=false,
- gbpub=false,
- gbnamefmt=reverseorder,
- sorting=multipinyin,
- doi=false,
- url=false,
- }
-
-%==================================================
-%为标注和文献表中标点格式,重设and本地化字符串
-%==================================================
-\DefineBibliographyStrings{english}{
- and = { and},%and后面的空格在finalnamedelim已经加过了,所以这里去掉20191009
- andcn = {、},
- andincitecn = {和},%将标注中的分开,便于与文献表中的区分
- andincite = {\&},
- %andotherscn={等},
- %mathesiscn={[硕士学位论文]},
- %phdthesiscn={[博士学位论文]},
-}
-
-
-%==================================================
-%设置一些标点格式为中文的标点
-%==================================================
-\DeclareFieldFormat{titlecase}{\iffieldequalstr{userd}{chinese}{#1}{\capitalisewords{#1}}}
-\DeclareFieldFormat*{title}{\iffieldequalstr{userd}{chinese}{《#1》}{#1\isdot}}
-\DeclareFieldFormat[article]{title}{\iffieldequalstr{userd}{chinese}{《#1》}{\mkbibquote{#1}\isdot}}
-\DeclareFieldFormat*{journaltitle}{\iffieldequalstr{userd}{chinese}{《#1》}{\textit{#1}}}%
-%\DeclareFieldFormat*{booktitle}{《#1》}
-\renewcommand*{\revsdnamepunct}{,}%%来源biblatex.def
-\DeclareDelimFormat*{multinamedelim}{\iffieldequalstr{userd}{chinese}{、}{,}}%\addcomma\addspace
-\DeclareDelimFormat{finalnamedelim}{%
- %\ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
- %\addspace%
- \edef\userfieldabcde{userd}%
- \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
- \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
- \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
- \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
- \ifcase\value{gbcitelocalcase}%
- \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andincitecn}}{}%
- \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
- \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}%
- \iffieldequalstr{\userfieldabcde}{english}{\space\bibstring{andincite}\space}{}%
- \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}%
- \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}%
-%\space%
- \or%
- \bibstring{andincitecn}\space%
- \or%
- \bibstring{andincite}\space%
- \fi}
-\DeclareDelimFormat[bib,biblist]{finalnamedelim}{%
-% \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
-% \addspace%
- \edef\userfieldabcde{userd}%
- \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
- \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
- \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
- \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
- \ifcase\value{gbbiblocalcase}%
- \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}%
- \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
- \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}%
- \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}%
- \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}%
- \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}%
-\space%
- \or%
- \bibstring{andcn}\space%
- \or%
- \bibstring{and}\space%
- \fi}
-\DeclareDelimFormat{nameyeardelim}{,}%\addcomma\addspace
-\DeclareDelimFormat[bib,biblist]{nameyeardelim}{,}%\addcomma\addspace
-\DeclareDelimFormat{bibpagespunct}{\iffieldequalstr{userd}{chinese}{}{,}}%\addcomma\addspace
-\renewcommand*{\newunitpunct}{,}%\addcomma\space %,
-\renewcommand*{\finentrypunct}{\iffieldequalstr{userd}{chinese}{。}{\adddot}}
-
-%==================================================
-%调整部分域的输出格式
-%==================================================
-%
-% 修改number和volume的格式
-%
-\newcounter{numberwithoutzero}
-\DeclareFieldFormat[article,periodical]{number}%
- {\iffieldequalstr{userd}{chinese}{%
- \iffieldint{number}{\setcounter{numberwithoutzero}{#1}\printtext{\bibstring{serialcn}\addthinspace\arabic{numberwithoutzero}\addthinspace 期}}
- {\printtext{\bibstring{serialcn}\addthinspace#1\addthinspace 期}}%
- }%
- {\printtext{(}#1\printtext{)}}}% %
-\DeclareFieldFormat[article,periodical]{volume}%
- {\iffieldequalstr{userd}{chinese}{}%
- {#1}}% volume of a book
-
-%
-% 调整期刊名的格式
-%
-% 原理方法:因为作者年制年份提到前面,因此涉及到期刊名与后面的卷期的关系。
-% v1.0k,20180425,增加了字体控制命令,hzz
-\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx
- \usebibmacro{journal}%
- %\setunit*{\addspace}%
- %\setunit*{\addcomma\addspace}%修改为增加一个逗号
- \iffieldundef{series}%
- {}%
- {\newunit%
- \printfield{series}%
- \setunit{\addspace}}%
- %\usebibmacro{volume+number+eid}%
- %\setunit{\addspace}%
- \usebibmacro{issue+date}%
- %\setunit{\addcolon\space}%
- %\iffieldundef{volume}{}{\setunit{\addcomma\space}}%
- %换成逗号和空格
- \usebibmacro{issue}%
- \usebibmacro{volume+number+eid}%把卷期放到年份后面
- %\newunit
- }
-
-% 调整期刊卷和期的格式
-%
-\renewbibmacro*{volume+number+eid}{%源来自standard.bbx
-\iffieldequalstr{userd}{chinese}{%\printfield{volume}%
- \iffieldundef{number}{}{\printfield{number}}%区别于顺序编码制
- }
- {\newunit\printfield{volume}%
- %\setunit*{\adddot\space}%
- \printfield{number}%
- \setunit{\addcomma\space}%
- \printfield{eid}}}
-
-%
-% 重设title的输出
-%
-% 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen
-% 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件
-% 利用toggle做标识符是否输出的判断
-\renewbibmacro*{title}{%
- \ifboolexpr{%
- test{\iffieldundef{title}}%
- and
- test{\iffieldundef{subtitle}}%
- }%
- {}%
- {\setunit{:}\printtext[title]{\bibtitlefont%增加字体控制命令%增加了标点:
- \printfield[titlecase]{title}%
- \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
- {}{\setunit{\subtitlepunct}%
- \printfield[titlecase]{subtitle}}%
- \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
- {\setunit{\subtitlepunct}\printfield{titleaddon}}%
- \iftoggle{bbx:gbtype}{%
- \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准
- {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准
- {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}% 判断是否为报纸
- {\printfield[gbtypeflag]{usera}}}% 其它
- }}{}%
- %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
- %\newunit
- }%
-}}
-
-\DeclareFieldFormat{pages}{\iffieldequalstr{userd}{chinese}{}{#1}}%页码引用格式的修改%去掉前面引导页码的pp.等字符
-
-\setlength{\bibitemindent}{1.5\ccwd} % bibitemindent表示一条文献中第一行相对后面各行的缩进
-\setlength{\bibhang}{0pt} % 作者年制中 bibhang 表示的各行起始位置到页
- % 边的距离,顺序编码制中
- % bibhang+labelnumberwidth 表示各行起始位置
- % 到页边的距离
+%%
+%% ---------------------------------------------------------------
+%% erj.bbx --- A bibliography style of Economic Research Journal in china
+%% modified from gb7714-2015ay at the request of ddswhu
+%% Maintained by huzhenzhen
+%% E-mail: hzzmail at 163.com
+%% Released under the LaTeX Project Public License v1.3c or later
+%% ---------------------------------------------------------------
+%%
+%%用法:类似于标准的样式在biblatex加载时设置样式
+%%文献表正常处理,标注命令主要用cite和textcite
+\ProvidesFile{chinese-erj.bbx}[2019/03/28 v1.0 a biblatex bibliography style for ERJ]
+
+
+%==================================================
+%加载gb样式
+%==================================================
+\RequireBibliographyStyle{gb7714-2015ay}
+\RequirePackage{mfirstuc}%单词首字母大写的问题
+\MFUnocap{in}%
+\MFUnocap{the}%
+\MFUnocap{of}%
+\MFUnocap{on}%
+\MFUnocap{and}%
+\MFUnocap{for}%
+
+
+%==================================================
+%考虑多音字增加multipinyin排序,是其可以根据key域添加拼音来排序
+%==================================================
+\DeclareSortingTemplate{multipinyin}{
+ \sort{
+ \field{presort}
+ }
+ \sort{
+ \field{lansortorder}%language
+ }
+ \sort{
+ \field{sortkey}
+ }
+ \sort{%[direction=descending]
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ }
+ \sort{
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field{volume}
+ \literal{0}
+ }
+ }
+
+%==================================================
+%选项设置
+%==================================================
+ \ExecuteBibliographyOptions{
+ maxbibnames=99,
+ gbtype=false,
+ gbpub=false,
+ gbnamefmt=reverseorder,
+ sorting=multipinyin,
+ doi=false,
+ url=false,
+ }
+
+%==================================================
+%为标注和文献表中标点格式,重设and本地化字符串
+%==================================================
+\DefineBibliographyStrings{english}{
+ and = { and},%and后面的空格在finalnamedelim已经加过了,所以这里去掉20191009
+ andcn = {、},
+ andincitecn = {和},%将标注中的分开,便于与文献表中的区分
+ andincite = {\&},
+ %andotherscn={等},
+ %mathesiscn={[硕士学位论文]},
+ %phdthesiscn={[博士学位论文]},
+}
+
+
+%==================================================
+%设置一些标点格式为中文的标点
+%==================================================
+\DeclareFieldFormat{titlecase}{\iffieldequalstr{userd}{chinese}{#1}{\capitalisewords{#1}}}
+\DeclareFieldFormat*{title}{\iffieldequalstr{userd}{chinese}{《#1》}{#1\isdot}}
+\DeclareFieldFormat[article]{title}{\iffieldequalstr{userd}{chinese}{《#1》}{\mkbibquote{#1}\isdot}}
+\DeclareFieldFormat*{journaltitle}{\iffieldequalstr{userd}{chinese}{《#1》}{\textit{#1}}}%
+%\DeclareFieldFormat*{booktitle}{《#1》}
+\renewcommand*{\revsdnamepunct}{,}%%来源biblatex.def
+\DeclareDelimFormat*{multinamedelim}{\iffieldequalstr{userd}{chinese}{、}{,}}%\addcomma\addspace
+\DeclareDelimFormat{finalnamedelim}{%
+ %\ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
+ %\addspace%
+ \edef\userfieldabcde{userd}%
+ \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
+ \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
+ \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
+ \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbcitelocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andincitecn}}{}%
+ \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{english}{\space\bibstring{andincite}\space}{}%
+ \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}%
+ \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}%
+%\space%
+ \or%
+ \bibstring{andincitecn}\space%
+ \or%
+ \bibstring{andincite}\space%
+ \fi}
+\DeclareDelimFormat[bib,biblist]{finalnamedelim}{%
+% \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
+% \addspace%
+ \edef\userfieldabcde{userd}%
+ \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
+ \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
+ \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
+ \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbbiblocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}%
+ \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}%
+ \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}%
+ \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}%
+\space%
+ \or%
+ \bibstring{andcn}\space%
+ \or%
+ \bibstring{and}\space%
+ \fi}
+\DeclareDelimFormat{nameyeardelim}{,}%\addcomma\addspace
+\DeclareDelimFormat[bib,biblist]{nameyeardelim}{,}%\addcomma\addspace
+\DeclareDelimFormat{bibpagespunct}{\iffieldequalstr{userd}{chinese}{}{,}}%\addcomma\addspace
+\renewcommand*{\newunitpunct}{,}%\addcomma\space %,
+\renewcommand*{\finentrypunct}{\iffieldequalstr{userd}{chinese}{。}{\adddot}}
+
+%==================================================
+%调整部分域的输出格式
+%==================================================
+%
+% 修改number和volume的格式
+%
+\newcounter{numberwithoutzero}
+\DeclareFieldFormat[article,periodical]{number}%
+ {\iffieldequalstr{userd}{chinese}{%
+ \iffieldint{number}{\setcounter{numberwithoutzero}{#1}\printtext{\bibstring{serialcn}\addthinspace\arabic{numberwithoutzero}\addthinspace 期}}
+ {\printtext{\bibstring{serialcn}\addthinspace#1\addthinspace 期}}%
+ }%
+ {\printtext{(}#1\printtext{)}}}% %
+\DeclareFieldFormat[article,periodical]{volume}%
+ {\iffieldequalstr{userd}{chinese}{}%
+ {#1}}% volume of a book
+
+%
+% 调整期刊名的格式
+%
+% 原理方法:因为作者年制年份提到前面,因此涉及到期刊名与后面的卷期的关系。
+% v1.0k,20180425,增加了字体控制命令,hzz
+\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx
+ \usebibmacro{journal}%
+ %\setunit*{\addspace}%
+ %\setunit*{\addcomma\addspace}%修改为增加一个逗号
+ \iffieldundef{series}%
+ {}%
+ {\newunit%
+ \printfield{series}%
+ \setunit{\addspace}}%
+ %\usebibmacro{volume+number+eid}%
+ %\setunit{\addspace}%
+ \usebibmacro{issue+date}%
+ %\setunit{\addcolon\space}%
+ %\iffieldundef{volume}{}{\setunit{\addcomma\space}}%
+ %换成逗号和空格
+ \usebibmacro{issue}%
+ \usebibmacro{volume+number+eid}%把卷期放到年份后面
+ %\newunit
+ }
+
+% 调整期刊卷和期的格式
+%
+\renewbibmacro*{volume+number+eid}{%源来自standard.bbx
+\iffieldequalstr{userd}{chinese}{%\printfield{volume}%
+ \iffieldundef{number}{}{\printfield{number}}%区别于顺序编码制
+ }
+ {\newunit\printfield{volume}%
+ %\setunit*{\adddot\space}%
+ \printfield{number}%
+ \setunit{\addcomma\space}%
+ \printfield{eid}}}
+
+%
+% 重设title的输出
+%
+% 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen
+% 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件
+% 利用toggle做标识符是否输出的判断
+\renewbibmacro*{title}{%
+ \ifboolexpr{%
+ test{\iffieldundef{title}}%
+ and
+ test{\iffieldundef{subtitle}}%
+ }%
+ {}%
+ {\setunit{:}\printtext[title]{\bibtitlefont%增加字体控制命令%增加了标点:
+ \printfield[titlecase]{title}%
+ \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
+ {}{\setunit{\subtitlepunct}%
+ \printfield[titlecase]{subtitle}}%
+ \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
+ {\setunit{\subtitlepunct}\printfield{titleaddon}}%
+ \iftoggle{bbx:gbtype}{%
+ \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准
+ {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准
+ {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}% 判断是否为报纸
+ {\printfield[gbtypeflag]{usera}}}% 其它
+ }}{}%
+ %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
+ %\newunit
+ }%
+}}
+
+\DeclareFieldFormat{pages}{\iffieldequalstr{userd}{chinese}{}{#1}}%页码引用格式的修改%去掉前面引导页码的pp.等字符
+
+\setlength{\bibitemindent}{1.5\ccwd} % bibitemindent表示一条文献中第一行相对后面各行的缩进
+\setlength{\bibhang}{0pt} % 作者年制中 bibhang 表示的各行起始位置到页
+ % 边的距离,顺序编码制中
+ % bibhang+labelnumberwidth 表示各行起始位置
+ % 到页边的距离
Modified: trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/chinese-erj.cbx
===================================================================
--- trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/chinese-erj.cbx 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/chinese-erj.cbx 2021-01-19 22:57:40 UTC (rev 57468)
@@ -1,151 +1,151 @@
-%%
-%% ---------------------------------------------------------------
-%% erj.cbx --- A citation style of Economic Research Journal in china
-%% modified from gb7714-2015ay for the request by ddswhu
-%% Maintained by huzhenzhen
-%% E-mail: hzzmail at 163.com
-%% Released under the LaTeX Project Public License v1.3c or later
-%% ---------------------------------------------------------------
-%%
-%%用法:类似于标准的样式在biblatex加载时设置样式
-%%文献表正常处理,标注命令主要用cite和textcite
-
-\ProvidesFile{chinese-erj.cbx}[2019/03/28 v1.0 a biblatex citation style for ERJ]
-
-%==================================================
-%加载gb样式
-%==================================================
-\RequireCitationStyle{gb7714-2015ay} %
-
-
-
-%==================================================
-%选项设置
-%==================================================
-\ExecuteBibliographyOptions{
- maxcitenames=2,
- mincitenames=1,
-}
-
-%==================================================
-%引用命令设置,主要用cite和textcite
-%包括标点设置
-%==================================================
-\renewcommand*{\multicitedelim}{;}%\addsemicolon\addspace;
-\renewcommand*{\textcitedelim}{%
- \iffinalcitedelim
- {\ifnumgreater{\value{textcitetotal}}{2}
- {}{}%\iftextcitepunct{\finalandsemicolon}{\finalandcomma}
- \addspace 、}%\addspace\bibstring{andincitecn}
- {\iftextcitepunct{\addsemicolon\space}{\addspace 、}}%\addcomma
-}%\space
-
-\DeclareDelimFormat[textcite]{nameyeardelim}{\addspace}%\addcomma\space
-\DeclareDelimFormat[textcite]{andothersdelim}{\iffieldequalstr{userf}{chinese}{}{\addspace}}%
-
-%之所以不用\DeclareDelimFormat{andothersdelim}{}这样的设置是因为gb7714-2015中为兼容老版本的biblatex做的处理就是这样的
-%所以用相同的方式
-\AtEveryCitekey{%
-\iffieldequalstr{userf}{chinese}{\renewcommand*{\andothersdelim}{}}%\addthinspace
- {\renewcommand*{\andothersdelim}{\addspace}}%
-}
-
-%标注压缩时,直接用date+extradate代替extradate实现2006a,2006b的效果
-%\DeclareDelimFormat*{compcitedelim}{、}%\addcomma\addspace
-\newbibmacro*{cite:extradate}{%
- \iffieldundef{extradate}
- {}
- {\printtext[bibhyperref]{\addspace\printlabeldateextra}}}%\printfield{extradate}\printlabeldateextra \printfield{labelyear}\printfield{extradate}
-
-%\AtEveryCite{%
-%\let\parentext=\parentexttrack%
-%\let\bibopenparen=(%
-%\let\bibcloseparen=)}
-
-%添加前后空格
-\DeclareCiteCommand{\cite}%[\mkbibparens]
- {\usebibmacro{cite:init}%
- \printtext{(}\usebibmacro{prenote}}%)\addspace
- {\usebibmacro{citeindex}%
- \usebibmacro{cite}}
- {}
- {\usebibmacro{postnote}%(
- )}%\addspace
-
-%原版
-%\DeclareCiteCommand{\cite}[\mkbibparens]
-% {\usebibmacro{cite:init}%
-% \usebibmacro{prenote}}%)
-% {\usebibmacro{citeindex}%
-% \usebibmacro{cite}}
-% {}
-% {\usebibmacro{postnote}}
-
-%
-%添加后面空格
-%\DeclareCiteCommand{\cbx at textcite}
-% {\usebibmacro{cite:init}}
-% {\usebibmacro{citeindex}%
-% \usebibmacro{textcite}}
-% {}
-% {\usebibmacro{textcite:postnote}\addspace}
-
-\newbibmacro*{textcite}{%
- \iffieldequals{namehash}{\cbx at lasthash}
- {\iffieldundef{shorthand}
- {\ifthenelse{\iffieldequals{labelyear}{\cbx at lastyear}\AND
- \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
- {\setunit{\addcomma}%
- \usebibmacro{cite:extradate}}
- {\setunit{\compcitedelim}%
- \usebibmacro{cite:labeldate+extradate}%
- \savefield{labelyear}{\cbx at lastyear}}}
- {\setunit{\compcitedelim}%
- \usebibmacro{cite:shorthand}%
- \global\undef\cbx at lastyear}}
- {\ifnameundef{labelname}
- {\iffieldundef{shorthand}
- {\usebibmacro{cite:label}%
- \setunit{%
- \global\booltrue{cbx:parens}%
- \printdelim{nonameyeardelim}(}%\bibopenparen
- \ifnumequal{\value{citecount}}{1}
- {\usebibmacro{prenote}}
- {}%
- \usebibmacro{cite:labeldate+extradate}}
- {\usebibmacro{cite:shorthand}}}
- {\printnames{labelname}%
- \setunit{%
- \global\booltrue{cbx:parens}%
- \printdelim{nameyeardelim}(}%\bibopenparen
- \ifnumequal{\value{citecount}}{1}
- {\usebibmacro{prenote}}
- {}%
- \iffieldundef{shorthand}
- {\iffieldundef{labelyear}
- {\usebibmacro{cite:label}}
- {\usebibmacro{cite:labeldate+extradate}}%
- \savefield{labelyear}{\cbx at lastyear}}
- {\usebibmacro{cite:shorthand}%
- \global\undef\cbx at lastyear}}%
- \stepcounter{textcitecount}%
- \savefield{namehash}{\cbx at lasthash}}%
- \setunit{%
- \ifbool{cbx:parens}
- {)\global\boolfalse{cbx:parens}}%\bibcloseparen
- {}%
- \textcitedelim}}
-
-\newbibmacro*{textcite:postnote}{%
- \usebibmacro{postnote}%
- \ifthenelse{\value{multicitecount}=\value{multicitetotal}}
- {\setunit{}%
- \printtext{%
- \ifbool{cbx:parens}
- {)\global\boolfalse{cbx:parens}}%\bibcloseparen
- {}}}
- {\setunit{%
- \ifbool{cbx:parens}
- {)\global\boolfalse{cbx:parens}}%\bibcloseparen
- {}%
- \textcitedelim}}}
+%%
+%% ---------------------------------------------------------------
+%% erj.cbx --- A citation style of Economic Research Journal in china
+%% modified from gb7714-2015ay for the request by ddswhu
+%% Maintained by huzhenzhen
+%% E-mail: hzzmail at 163.com
+%% Released under the LaTeX Project Public License v1.3c or later
+%% ---------------------------------------------------------------
+%%
+%%用法:类似于标准的样式在biblatex加载时设置样式
+%%文献表正常处理,标注命令主要用cite和textcite
+
+\ProvidesFile{chinese-erj.cbx}[2019/03/28 v1.0 a biblatex citation style for ERJ]
+
+%==================================================
+%加载gb样式
+%==================================================
+\RequireCitationStyle{gb7714-2015ay} %
+
+
+
+%==================================================
+%选项设置
+%==================================================
+\ExecuteBibliographyOptions{
+ maxcitenames=2,
+ mincitenames=1,
+}
+
+%==================================================
+%引用命令设置,主要用cite和textcite
+%包括标点设置
+%==================================================
+\renewcommand*{\multicitedelim}{;}%\addsemicolon\addspace;
+\renewcommand*{\textcitedelim}{%
+ \iffinalcitedelim
+ {\ifnumgreater{\value{textcitetotal}}{2}
+ {}{}%\iftextcitepunct{\finalandsemicolon}{\finalandcomma}
+ \addspace 、}%\addspace\bibstring{andincitecn}
+ {\iftextcitepunct{\addsemicolon\space}{\addspace 、}}%\addcomma
+}%\space
+
+\DeclareDelimFormat[textcite]{nameyeardelim}{\addspace}%\addcomma\space
+\DeclareDelimFormat[textcite]{andothersdelim}{\iffieldequalstr{userf}{chinese}{}{\addspace}}%
+
+%之所以不用\DeclareDelimFormat{andothersdelim}{}这样的设置是因为gb7714-2015中为兼容老版本的biblatex做的处理就是这样的
+%所以用相同的方式
+\AtEveryCitekey{%
+\iffieldequalstr{userf}{chinese}{\renewcommand*{\andothersdelim}{}}%\addthinspace
+ {\renewcommand*{\andothersdelim}{\addspace}}%
+}
+
+%标注压缩时,直接用date+extradate代替extradate实现2006a,2006b的效果
+%\DeclareDelimFormat*{compcitedelim}{、}%\addcomma\addspace
+\newbibmacro*{cite:extradate}{%
+ \iffieldundef{extradate}
+ {}
+ {\printtext[bibhyperref]{\addspace\printlabeldateextra}}}%\printfield{extradate}\printlabeldateextra \printfield{labelyear}\printfield{extradate}
+
+%\AtEveryCite{%
+%\let\parentext=\parentexttrack%
+%\let\bibopenparen=(%
+%\let\bibcloseparen=)}
+
+%添加前后空格
+\DeclareCiteCommand{\cite}%[\mkbibparens]
+ {\usebibmacro{cite:init}%
+ \printtext{(}\usebibmacro{prenote}}%)\addspace
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite}}
+ {}
+ {\usebibmacro{postnote}%(
+ )}%\addspace
+
+%原版
+%\DeclareCiteCommand{\cite}[\mkbibparens]
+% {\usebibmacro{cite:init}%
+% \usebibmacro{prenote}}%)
+% {\usebibmacro{citeindex}%
+% \usebibmacro{cite}}
+% {}
+% {\usebibmacro{postnote}}
+
+%
+%添加后面空格
+%\DeclareCiteCommand{\cbx at textcite}
+% {\usebibmacro{cite:init}}
+% {\usebibmacro{citeindex}%
+% \usebibmacro{textcite}}
+% {}
+% {\usebibmacro{textcite:postnote}\addspace}
+
+\newbibmacro*{textcite}{%
+ \iffieldequals{namehash}{\cbx at lasthash}
+ {\iffieldundef{shorthand}
+ {\ifthenelse{\iffieldequals{labelyear}{\cbx at lastyear}\AND
+ \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
+ {\setunit{\addcomma}%
+ \usebibmacro{cite:extradate}}
+ {\setunit{\compcitedelim}%
+ \usebibmacro{cite:labeldate+extradate}%
+ \savefield{labelyear}{\cbx at lastyear}}}
+ {\setunit{\compcitedelim}%
+ \usebibmacro{cite:shorthand}%
+ \global\undef\cbx at lastyear}}
+ {\ifnameundef{labelname}
+ {\iffieldundef{shorthand}
+ {\usebibmacro{cite:label}%
+ \setunit{%
+ \global\booltrue{cbx:parens}%
+ \printdelim{nonameyeardelim}(}%\bibopenparen
+ \ifnumequal{\value{citecount}}{1}
+ {\usebibmacro{prenote}}
+ {}%
+ \usebibmacro{cite:labeldate+extradate}}
+ {\usebibmacro{cite:shorthand}}}
+ {\printnames{labelname}%
+ \setunit{%
+ \global\booltrue{cbx:parens}%
+ \printdelim{nameyeardelim}(}%\bibopenparen
+ \ifnumequal{\value{citecount}}{1}
+ {\usebibmacro{prenote}}
+ {}%
+ \iffieldundef{shorthand}
+ {\iffieldundef{labelyear}
+ {\usebibmacro{cite:label}}
+ {\usebibmacro{cite:labeldate+extradate}}%
+ \savefield{labelyear}{\cbx at lastyear}}
+ {\usebibmacro{cite:shorthand}%
+ \global\undef\cbx at lastyear}}%
+ \stepcounter{textcitecount}%
+ \savefield{namehash}{\cbx at lasthash}}%
+ \setunit{%
+ \ifbool{cbx:parens}
+ {)\global\boolfalse{cbx:parens}}%\bibcloseparen
+ {}%
+ \textcitedelim}}
+
+\newbibmacro*{textcite:postnote}{%
+ \usebibmacro{postnote}%
+ \ifthenelse{\value{multicitecount}=\value{multicitetotal}}
+ {\setunit{}%
+ \printtext{%
+ \ifbool{cbx:parens}
+ {)\global\boolfalse{cbx:parens}}%\bibcloseparen
+ {}}}
+ {\setunit{%
+ \ifbool{cbx:parens}
+ {)\global\boolfalse{cbx:parens}}%\bibcloseparen
+ {}%
+ \textcitedelim}}}
Modified: trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.bbx
===================================================================
--- trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.bbx 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.bbx 2021-01-19 22:57:40 UTC (rev 57468)
@@ -1,3899 +1,3900 @@
-%%
-%% ---------------------------------------------------------------
-%% biblatex-gb7714-2015 --- A biblatex implementation of the
-%% GBT7714-2015 bibliography style,numerical sequence
-%% Maintained by huzhenzhen
-%% E-mail: hzzmail at 163.com
-%% Released under the LaTeX Project Public License v1.3c or later
-%% ---------------------------------------------------------------
-%%
-
-%
-% 版本和时间信息
-%
-\def\versionofgbtstyle{2020/07/21 v1.0v}
-\def\versionofbiblatex{\abx at version}
-\ProvidesFile{gb7714-2015.bbx}[\versionofgbtstyle biblatex bibliography style]
-%\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求
-
-%=====================================================================
-% 加载标准样式
-%=====================================================================
-\RequireBibliographyStyle{numeric-comp}
-\RequirePackage{xstring}%解决texlive2015的biblatex3.0不加载xstring包的问题
-
-
-%=====================================================================
-% 功能函数
-%=====================================================================
- %
- % biblatex版本判断
- % 20180405,v1.0k,为兼容biblatexv3.11增加toggle:iftlnine,HU zhenzhen
- % 20181020,v1.0n,为不再使用xstring宏包做的修改,hzz
- %
- % 原理方法:当版本继续更新时,增加一个新的toggle用以处理新的旧版,最新版和未判断出来的版本永远用iftlatest
- \providetoggle{iftlfive}\togglefalse{iftlfive} %处理biblatex3.2之前版本,时间2016-03-01前
- \providetoggle{iftlsix}\togglefalse{iftlsix} %处理biblatex3.3开始改变姓名机制后版本,时间2016-03-01及以后
- \providetoggle{iftlseven}\togglefalse{iftlseven}%处理biblatex3.7的兼容性,时间2016-12-01后
- \providetoggle{iftleight}\togglefalse{iftleight}%处理biblatex3.8到3.9的兼容性,时间2017-11-01后到2017-12-01前
- \providetoggle{iftlnine}\togglefalse{iftlnine} %处理biblatex10的兼容性,时间2017-12-01后
- \providetoggle{iftlatest}\toggletrue{iftlatest} %假设是最新版biblatex
-
- \@ifpackagelater{biblatex}{2014/04/01}{
- \@ifpackagelater{biblatex}{2016/03/01}{
- \@ifpackagelater{biblatex}{2016/12/01}{
- \@ifpackagelater{biblatex}{2017/11/01}{
- \@ifpackagelater{biblatex}{2017/12/01}{
- \@ifpackagelater{biblatex}{2018/02/19}{}
- {\toggletrue{iftlnine}\togglefalse{iftlatest}}}
- {\toggletrue{iftleight}\togglefalse{iftlatest}}}
- {\toggletrue{iftlseven}\togglefalse{iftlatest}}}
- {\toggletrue{iftlsix}\togglefalse{iftlatest}}}
- {\toggletrue{iftlfive}\togglefalse{iftlatest}}}
- {\PackageError{biblatex}{Outdated 'biblatex' package}
- {Please update biblatex, This is a fatal error.}}
-
- \newcommand\defversion[2]{\csdef{codeversion#1#2}}%定义不同版本的命令
- \newcommand\switchversion[2]{\csuse{codeversion#1#2}}%使用不同版本的命令
-
- %
- % 判断CJK字符的函数,用于判断作者等信息是否由中文字符构成
- % v1.0k,20180509,hzz
- %
- % 原理方法:用biber中的perl方法代替。因为利用tex函数对字符判断时,当字符在宏
- % 中时,基于`的方法无法解决GBK编码的问题,基于CJKsymbol的方法无法解决utf-8
- % 编码用xelatex编译的问题。
- %
- % 原理是:利用perl正则将中文标识记录到域中,
- % 然后利用\iffieldundef和\iffieldequalstr进行判断
- \providetoggle{ifCJKforgbt}
- \def\testCJKfirst#1{%
- \iffieldundef{#1}{\togglefalse{ifCJKforgbt}}{%
- \iffieldequalstr{#1}{chinese}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}}}
-
- %
- % 2个卷的解析函数,用于连续出版物
- %
- % 原理方法: 范围起止间隔符号还是用-,而不是与date相同的/,因为有合期期刊的问题,需要用到/符号
- \newcommand{\multivolparser}[1]{%
- \IfSubStr{#1}{-}%
- {\StrBefore{#1}{-}[\multivolfirst]\StrBehind{#1}{-}[\multivolsecond]}%
- {\def\multivolfirst{#1}\def\multivolsecond{}}%
- }
-
-
- %
- % 2个期的解析函数,用于连续出版物
- %
- \newcommand{\multinumberparser}[1]{%
- \IfSubStr{#1}{-}%
- {\StrBefore{#1}{-}[\multinumberfirst]\StrBehind{#1}{-}[\multinumbersecond]}%
- {\def\multinumberfirst{#1}\def\multinumbersecond{}}%
- }
-
- % 对没有分隔符环境命令的低版本biblatex做增补,避免报错
- %
- \iftoggle{iftlfive}{
-
- \def\blx at inf@delimdeclare#1#2{%
- \blx at info{Delimiter '#1' in context '#2' already defined, overwriting}}
-
- \def\blx at warn@delimuse#1#2{%
- \blx at warning{Delimiter '#1' in context '#2' undefined}}
- % Delimiter interface
-
- % [<contextname, ...>]{<name, ...>}{<code>}
- \newrobustcmd*{\DeclareDelimFormat}{%
- \@ifstar
- {\blx at declaredelimclear}
- {\blx at declaredelim}}
-
- \newrobustcmd*{\blx at declaredelimclear}[3][]{%
- \ifcsvoid{blx at declaredelimcontexts@#2}
- {}
- {\def\do##1{\csundef{blx at printdelim@##1@#2}}%
- \dolistcsloop{blx at declaredelimcontexts@#2}}%
- \cslet{blx at declaredelimcontexts@#2}\@empty
- \ifblank{#1}
- {\blx at declaredelim{#2}{#3}}
- {\blx at declaredelim[#1]{#2}{#3}}}
-
- \newrobustcmd*{\blx at declaredelim}[3][]{%
- \ifblank{#1}
- {\blx at declaredelim@i{}{}{#2}{#3}}
- {\def\do##1{%
- \listcsadd{blx at declaredelimcontexts@#2}{##1}%
- \blx at declaredelim@i{blx at printdelim@##1@}{##1}{#2}{#3}}%
- \docsvlist{#1}}}%
-
- \def\blx at declaredelim@i#1#2#3#4{%
- \def\do at i##1{%
- \ifcsdef{#1##1}
- {\blx at inf@delimdeclare{##1}{#2}}
- {}%
- \csdef{#1##1}{#4}}%
- \forcsvlist{\do at i}{#3}}
-
- % *[<contextname, ...>]{<alias>}{<delim>}
- \newrobustcmd*{\DeclareDelimAlias}{%
- \@ifstar
- {\blx at declaredelimalias}
- {\blx at declaredelimaliasauto}}
-
- \newrobustcmd*{\blx at declaredelimalias}[3][]{%
- \ifblank{#1}
- {\blx at declaredelimalias@i{}{#2}{#3}}
- {\def\do##1{%
- \blx at declaredelimalias@i{blx at printdelim@##1@}{#2}{#3}}%
- \docsvlist{#1}}}
-
- \newrobustcmd*{\blx at declaredelimaliasauto}[2]{%
- \blx at declaredelimalias@i{}{#1}{#2}%
- \ifcsvoid{blx at declaredelimcontexts@#2}
- {}
- {\def\do##1{%
- \blx at declaredelimalias@i{blx at printdelim@##1@}{#1}{#2}}%
- \dolistcsloop{blx at declaredelimcontexts@#2}}}
-
- \def\blx at declaredelimalias@i#1#2#3{%
- \ifcsdef{#1#2}
- {\blx at inf@delimdeclare{#2}{#1}}
- {}%
- \csdef{#1#2}{\csuse{#1#3}}}
-
- \def\blx at delimcontext{none}
- \newcommand*{\printdelim}[2][]{%
- \ifblank{#1}
- {\ifcsdef{blx at printdelim@\blx at delimcontext @#2}
- {\csuse{blx at printdelim@\blx at delimcontext @#2}}
- {\ifcsdef{#2}% fall back on legacy macros
- {\csuse{#2}}
- {\blx at warn@delimuse{#2}{*}}}}
- {\ifcsdef{blx at printdelim@#1@#2}
- {\csuse{blx at printdelim@#1@#2}}
- {\blx at warn@delimuse{#2}{#1}}}}
-
- \newcommand*{\delimcontext}[1]{%
- \edef\blx at delimcontext{\blx at delimcontextalias{#1}}}
-
- \def\blx at delimcontextalias#1{%
- \ifcsdef{blx at delimcontextalias@#1}
- {\csuse{blx at delimcontextalias@#1}}
- {#1}}
-
- \newcommand*{\DeclareDelimcontextAlias}[2]{%
- \csgdef{blx at delimcontextalias@#1}{#2}}
- }{}
-
-
-%=====================================================================
-% 数据模型定义
-%=====================================================================
- %定义类型和载体标识,从gb内容看载体基本属于介质。
- %为与lee zeping的bst的样式统一,使用mark和medium这两域名
- %为单个条目的姓名格式控制增加nameformat和namefmtid两个域
- %为缩略信息文献表增加了shortbooktitle域
- %为多语言排序增加了lansortorder域
- \DeclareDatamodelFields[type=field,datatype=literal]{mark,medium,nameformat}
- \DeclareDatamodelFields[type=field,datatype=integer]{namefmtid}
- \DeclareDatamodelFields[type=field,datatype=literal]{shortbooktitle}
- \DeclareDatamodelFields[type=field,datatype=literal]{lansortorder}
-
- %因为biblatex更新3.14版本以后,biber对于为声明数据模型的条目类型
- %不再默认读取,而是以空字符串作为条目类型名,自然在条目定义alias时
- %就会出现问题,因此显式的声明一下newspaper,然后保留后面采用alias的方式
- %而standard类型则是采用另一种方式直接在sourcemap中转换为其它类型。
- \@ifpackagelater{biblatex}{2019/11/30}{%2019/12/01 v3.14
- \DeclareDatamodelEntrytypes{newspaper}%
- }{}
-
-
-
-%=====================================================================
-% 设置宏包选项
-%=====================================================================
- %
- % 增加一个控制是否输出文献载体的选项
- % 20191125,v1,0s,hzz
- \newtoggle{bbx:gbmedium}
- \DeclareBibliographyOption{gbmedium}[true]{%biblatex低版本
- \settoggle{bbx:gbmedium}{#1}}
- \ExecuteBibliographyOptions{gbmedium}
-
- %
- % 增加一个控制是否输出annotation域的选项,该域可以用于在文献条目后面输出一些注释信息
- % 20190509,v1,0s,hzz
- \newtoggle{bbx:gbannote}
- \DeclareBibliographyOption{gbannote}[false]{%biblatex低版本
- \settoggle{bbx:gbannote}{#1}}
- \ExecuteBibliographyOptions{gbannote}
- %
- %用于在文献条目后面输出注释信息的宏
- %FieldFormat{annotation}用于设置注释信息的格式
- \DeclareFieldFormat{annotation}{%
- \printtext{\addspace(#1)}%
- }
- \renewbibmacro*{annotation}{%
- \iftoggle{bbx:gbannote}%
- {\iffieldundef{annotation}%
- {\printfile[annotation]{\bibannotationprefix\thefield{entrykey}.tex}}%
- {\printfield{annotation}}}%
- {}%
- }
-
- %
- % 增加一个控制是否输出type域的选项
- % 20190212,v1,0q,hzz
- \newtoggle{bbx:gbfieldtype}
- \DeclareBibliographyOption{gbfieldtype}[false]{%biblatex低版本
- \settoggle{bbx:gbfieldtype}{#1}}
- \ExecuteBibliographyOptions{gbfieldtype}
-
- %
- % 增加一个控制是否根据页码重设脚注数字标号的选项
- % 20190422,v1,0r,hzz
- \newtoggle{bbx:gbfnperpage}
- \DeclareBibliographyOption{gbfnperpage}[false]{%
- \settoggle{bbx:gbfnperpage}{#1}}
- \ExecuteBibliographyOptions{gbfnperpage}
-
-
- %
- % 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表
- % 20190203,v1.0p,hzz
- % 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签
- % 当前面的脚注中已经存在当前文献,那么当前文献内容不再输出而用同(4)这样的方式
- % 需要注意的是由于小页环境和表格中的脚注本身的问题,可能会有一些问题
- \DeclareBibliographyOption{gbfootbib}[false]{%
- \ifstrequal{#1}{false}{}{\execgbfootbib}}
- \ExecuteBibliographyOptions{gbfootbib}
-
- %%
- \newlength{\footbibmargin}
- \newlength{\footbiblabelsep}
- \setlength{\footbibmargin}{1em}%脚注的段落左侧缩进距离
- \setlength{\footbiblabelsep}{0.5em}%脚注中标记号与脚注段落的间距
- \def\execgbfootbib%
- {%
- %开启引用跟踪计数器,为使用\ifciteseen等测试命令
- \ExecuteBibliographyOptions{citetracker=true}
- %
- %利用footmisc宏包来实现脚注文献的悬挂对齐
- \AtEndPreamble{
- \@ifclassloaded{beamer}{}{
- %beamer类因为其特殊性,为避免冲突不调footmisc。
- %同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接
- %如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。
- %\PassOptionsToPackage{perpage,hang}{footmisc}%
- %\RequirePackage{footmisc}%
-
- %重新实现脚注的根据单页重设脚注号码
- %重新实现脚注的悬挂对齐问题,不再使用footmisc,直接从latex核心代码和hyperref代码进行修改
- %v1.0q 20190317 hzz
- %v1.0r 20190422 hzz 根据gbfnperpage选项设置
- \iftoggle{bbx:gbfnperpage}%
- {\@addtoreset{footnote}{page}}{}%重设计数器
-
-\@ifpackageloaded{hyperref}{%加载hyperref则对\H@@footnotetext做重定义
- \long\def\H@@footnotetext##1{\insert\footins{%
- \reset at font\footnotesize
- \interlinepenalty\interfootnotelinepenalty
- \splittopskip\footnotesep
- \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
- \hsize\columnwidth \@parboxrestore
- \protected at edef\@currentlabel{%
- \csname p at footnote\endcsname\@thefnmark
- }%
- \color at begingroup
- \leftskip \footbibmargin%增加的左侧缩进
- \@makefntext{%
- \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox%
- }%
- \color at endgroup}}%
-
- \long\def\H@@mpfootnotetext##1{%
- \global\setbox\@mpfootins\vbox{%
- \unvbox\@mpfootins
- \reset at font\footnotesize
- \hsize\columnwidth
- \@parboxrestore
- \protected at edef\@currentlabel
- {\csname p at mpfootnote\endcsname\@thefnmark}%
- \leftskip \footbibmargin%增加的左侧缩进
- \color at begingroup
- \@makefntext{%
- \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}%
- \color at endgroup}}
- }{%否则对latex核心代码中的\@footnotetext做重定义
- \long\def\@footnotetext##1{\insert\footins{%
- \reset at font\footnotesize
- \interlinepenalty\interfootnotelinepenalty
- \splittopskip\footnotesep
- \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
- \hsize\columnwidth \@parboxrestore
- \protected at edef\@currentlabel{%
- \csname p at footnote\endcsname\@thefnmark
- }%
- \color at begingroup
- \leftskip \footbibmargin%增加的左侧缩进
- \@makefntext{%
- \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox%
- }%
- \color at endgroup}}%
-
- \long\def\@mpfootnotetext##1{%
- \global\setbox\@mpfootins\vbox{%
- \unvbox\@mpfootins
- \reset at font\footnotesize
- \hsize\columnwidth
- \@parboxrestore
- \protected at edef\@currentlabel
- {\csname p at mpfootnote\endcsname\@thefnmark}%
- \leftskip \footbibmargin%增加的左侧缩进
- \color at begingroup
- \@makefntext{%
- \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}%
- \color at endgroup}}
- }
-
- \long\def\@makefntext##1{%增加了脚注标记与正文的间隔
- \parindent 1em\noindent \hb at xt@ 0em{\hss \@makefnmark\makebox[\footbiblabelsep]{}}##1}
-
- }
-
- %
- %使脚注标记加圈并设置数字的字体为tiny,不使用修改thefootnote的方式
- \def\@makefnmark{\hbox{\@textsuperscript{\textcircled{\tiny\@thefnmark}}}}
- %做patch使得脚注内容中的脚注数字标签不上标
- \pretocmd{\@makefntext}{%
- \def\@makefnmark{%
- \hbox{\textcircled{\tiny\@thefnmark}}%
- }%
- }{}{}
- }
-
- %
- %判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容)
- %记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。
- %v1.0q 20190309 区分使脚注标注适应minipage中的情况
- \newbibmacro*{citesavefn}{%
- \ifciteseen%当被引用过为true
- {\ifcsdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%当已经定义过脚注序号信息
- {\csgdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{%
- \str at sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}%
- \@makefnmark%
- }}%
- {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{%
- \ifcsstring{@mpfn}{mpfootnote}{\@alph\c at mpfootnote}{\thefootnote}%
- }}%
- }%
- {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{%
- \ifcsstring{@mpfn}{mpfootnote}{\@alph\c at mpfootnote}{\thefootnote}%
- %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断
- }}%
- }
-
- %
- %重定义\footfullcite使完成gb7714-2015的脚注文献要求
- \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]%
- {\defcounter{maxnames}{\blx at maxbibnames}%局部定义maxnames和minnames计数器
- \defcounter{minnames}{\blx at minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。
- \usebibmacro{prenote}%
- \renewbibmacro*{postnote}{%
- \iffieldundef{postnote}%
- {}{\setunit{\addcolon\addspace}\printfield{postnote}}}%与ay样式不同,由于已修改postnote域格式,直接用printfield
- }%
- {\usebibmacro{citesavefn}%
- \ifcsdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%
- {\csuse{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}%\nopunct
- {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}%
- }%
- {\multicitedelim}%
- {\usebibmacro{postnote}}
-
- }
-
- %
- % 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式
- % 20180814,v1.0m,hzz
- % 原理方法:
- % 只为兼容性考虑不做任何处理
- \DeclareBibliographyOption{gbstyle}[true]{%biblatex低版本
- }
-
- %
- % 增加一个控制是否输出文献类型和载体标识的选项
- %
- % 原理方法:
- % 对于biblatex3.4以上版本DeclareBibliographyOption命令中的[datatype]如果是boolean,那么是可以省略的
- % 所以用老版本的不用[datatype]的命令可以兼容所有biblatex版本
- \newtoggle{bbx:gbtype}
- %\DeclareBibliographyOption[boolean]{gbtype}[true]{%biblatex高版本
- \DeclareBibliographyOption{gbtype}[true]{%biblatex低版本
- \settoggle{bbx:gbtype}{#1}}
- \ExecuteBibliographyOptions{gbtype}
-
- %
- % 增加一个源文件编码选择选项,当true时可以使用GBK编码。
- % v1.0k, 2018.05.08, by hzz
- %
- % 原理方法:将需要输出的中文字符串用命令形式表示存储,采用utf8编码时采用bbx文档
- % 内的定义即是utf8编码的中文字符串,但tex源文件是gbk编码时,利用gb7714-2015-gbk.def
- % 文档内的gbk编码的字符串覆盖。这种覆盖只能在宏包末尾加载时成功实现,所以使用
- % AtEndOfPackage。该解决思路源自biblatex-caspervector宏包。
- % 另外注意:
- % gbk编码的tex文档,利用pdflatex/latex能正确编译,利用xelatex能编译,但中文显示乱码
- % 在源文档前面增加 XeTeX 原语:\XeTeXinputencoding "GBK" 后,显示正常
- % utf-8编码的tex文档,利用xelatex能正确编译,而pdflatex/latex不能编译。
- \newtoggle{bbx:codegbk}
- \DeclareBibliographyOption{gbcodegbk}[false]{%
- \settoggle{bbx:codegbk}{#1}}
- \ExecuteBibliographyOptions{gbcodegbk}
-
- \def\str at bibliography{参考文献}
- \def\str at references{参考文献}
- \def\str at bytranslator{译}
- \def\str at andotherscn{等}
- \def\str at andcn{和}
- \def\str at backrefpage{引用页}
- \def\str at backrefpages{引用页}
- \def\str at noaddress{出版地不详}
- \def\str at nopublisher{出版者不详}
- \def\str at edition{版}
- \def\str at volumecn{卷}
- \def\str at numbercn{册}
- \def\str at serialcn{第}
- \def\str at sameentry{同}
- \def\str at incn{见}
- \def\str at mathesiscn{硕士学位论文}
- \def\str at phdthesiscn{博士学位论文}
- \def\str at editorcn{主编}
-
- \AtEndOfPackage{%
- \iftoggle{bbx:codegbk}{%
- \ExecuteBibliographyOptions{texencoding = GBK}
- \input{gb7714-2015-gbk.def}
- }{}}
-
- %
- % 增加一个严格按GB/T 7714-2015给出著录格式控制域的输出的选项
- % v1.0k, 2018.05.08, by hzz
- %
- % 原理方法:
- % 默认设置该选项为真,进而不输出GB/T 7714-2015中没有的域的信息
- % 这样可以避免因为bib文件带有多余的域的信息的输出,比如因为bibtex样式
- % 可能需要用于中英文判断的language域的信息。
- \newtoggle{bbx:gbstrict}
- \DeclareBibliographyOption{gbstrict}[true]{%
- \settoggle{bbx:gbstrict}{#1}}
- \ExecuteBibliographyOptions{gbstrict}
-
- %
- % 增加一个控制标题域超链接设置的选项
- % v1.0k, 2018.05.24, by hzz
- %
- % 原理方法:
- % 利用标题域格式来实现,默认设置该选项为false,不做超链接。
- % 设置为true,则标题设置超链接
- \newtoggle{bbx:titlelink}
- \DeclareBibliographyOption{gbtitlelink}[false]{%
- \settoggle{bbx:titlelink}{#1}}
- \ExecuteBibliographyOptions{gbtitlelink}
-
- %
- % 增加一个控制参考文献标题是否能够被ctex宏包设置的选项
- % v1.0l, 2018.07.02, by hzz
- %
- % 原理方法:
- % 重定义biblatex的宏,去除使用本地化字符串的方式,是的可以利用ctexset进行设置
- \newtoggle{bbx:ctexset}
- \DeclareBibliographyOption{gbctexset}[true]{%
- \settoggle{bbx:ctexset}{#1}}
- \ExecuteBibliographyOptions{gbctexset}
-
- \AtEndOfPackage{%
- \iftoggle{bbx:ctexset}{%
- \def\blx at defbibstrings#1#2{%
- \def\do##1{\csundef{abx at lstr@##1}\csundef{abx at sstr@##1}}%
- \abx at dostrings
- \csuse{abx at strings@#1}%
- \setkeys{blx at lbx}{#2}%
- \let\do\blx at defbibstrings@i
- \csxdef{abx at strings@#1}{\abx at dostrings}%
- }
- }{}}
-
- %
- % 增加一个处理佚名或noauthor的控制选项
- %
- % 原理方法:在顺序编码制中不需要使用,为与作者年制的兼容性考虑,这里也增加避免报错
- \DeclareBibliographyOption{gbnoauthor}[true]{}%
-
-
- %
- % 增加一个恢复域格式为标准样式的控制选项
- % v1.0k, 2018.05.15, by hzz
- %
- % 原理方法:
- % 默认设置该选项为false,采用国标要求的域格式输出相关域
- % 当设置该选项为true时,则重新利用标准样式的域格式输出相关的域
- \newtoggle{bbx:gbfieldstd}
- \DeclareBibliographyOption{gbfieldstd}[false]{%
- \settoggle{bbx:gbfieldstd}{#1}%
- \ifstrequal{#1}{false}{}{\execgbfdfmtstd}%
- }
- \ExecuteBibliographyOptions{gbfieldstd}
-
- %
- % 增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。
- %
- \newtoggle{bbx:gbpub}
- \DeclareBibliographyOption{gbpub}[true]{%
- %\settoggle{bbx:gbpub}{#1} %或采用下面这一句
- \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}}
- \ExecuteBibliographyOptions{gbpub}
-
- %
- % 增加控制析出文献来源前的标点符号//输出的选项
- % v1.0k, 2018.04.20,added in by hzz
- \newtoggle{bbx:gbpunctin}
- \DeclareBibliographyOption{gbpunctin}[true]{%
- \settoggle{bbx:gbpunctin}{#1}}
- \ExecuteBibliographyOptions{gbpunctin}
-
-
-
-
-
- %
- % 选项设置
- %
- \ExecuteBibliographyOptions{
- sorting=none,
- useprefix=true, %名字的信息包括前缀
- date = year, %日期仅写到年
- maxbibnames = 3,%设置名字最大数量
- minbibnames = 3, %设置缩减后的名字最小数量
- maxitems = 1,%设置列表最大数量
- minitems = 1, %设置缩减后的列表最小数量
- isbn=false,
- }
-
- %
- %为日期相关选项增加选项值gb7714-2015
- %
- \csdef{mkdaterangegb7714-2015}#1{%
- \begingroup
- \blx at metadateinfo{#1}%
- \iffieldundef{#1year}
- {}
- {\printtext[#1date]{%
- \blx at gbdate{#1}{}}}%
- \endgroup}
-
- \newrobustcmd*{\blx at gbdate}[3][]{%
- \dateeraprintpre{#2#3year}%
- \blx at imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}%
- \iffieldundef{#2#3month}{}{\hyphen\blx at imc@forcezerosmdt{\thefield{#2#3month}}}%
- \iffieldundef{#2#3day}{}{\hyphen\blx at imc@forcezerosmdt{\thefield{#2#3day}}}}
-
-
- %为姓名格式选择增加的计数器
- \newcounter{gbnamefmtcase}
- \def\thegbnamefmtcase{\the\c at gbnamefmtcase}
- %为数字标签格式选择增加的计数器/命令
- \newcommand{\mkgbnumlabel}[1]{\mkbibbrackets{#1}}
- \def\gbbiblabelopt at bracket{\renewcommand{\mkgbnumlabel}[1]{\mkbibbrackets{##1}}}
- \def\gbbiblabelopt at parens{\renewcommand{\mkgbnumlabel}[1]{\mkbibparens{##1}}}
- \def\gbbiblabelopt at dot{\renewcommand{\mkgbnumlabel}[1]{##1\adddot}}
- \def\gbbiblabelopt at plain{\renewcommand{\mkgbnumlabel}[1]{##1}}
- \def\gbbiblabelopt at box{\renewcommand{\mkgbnumlabel}[1]{\framebox{##1}}}
- \def\gbbiblabelopt at circle{\renewcommand{\mkgbnumlabel}[1]{\textcircled{##1}}}
- %为文献表中数字标签对齐方式选择增加的计数器/命令
- \newcounter{gbalignlabel}
- \def\thegbalignlabel{\the\c at gbalignlabel}
- %为引用标签标注/文献表中本地化字符串中英文选择增加的计数器/命令
- \newcounter{gbcitelocalcase}
- \newcounter{gbbiblocalcase}
- \def\thegbcitelocalcase{\the\c at gbcitelocalcase}
- \def\thegbbiblocalcase{\the\c at gbbiblocalcase}
-
-\@ifpackagelater{biblatex}{2016/03/27}
- { % 针对biblatex>=3.3版本的选项设置
- % 增加不同语言排序的切换选项
- % numeric样式,不使用该选项,这里给出仅为兼容性考虑
- % v1.0q,20190307,hzz
- %
- % 增加不同语言排序的切换选项
- % gblanorder=chineseahead的顺序为cn,jp,kr,en,fr,ru
- % gblanorder=englishahead的顺序为en,fr,ru,cn,jp,kr
- % gblanorder=cn;en;ru;fr;jp;kr的顺序为指定的cn;en;ru;fr;jp;kr,自定义内容可以随意写以分号分隔
- % v1.0q,20190307,hzz
- %
- \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{%
- \ifstrequal{#1}{chineseahead}%%中文在前的顺序
- {\gdef\lancnorder{1}\gdef\lanjporder{2}\gdef\lankrorder{3}%
- \gdef\lanenorder{4}\gdef\lanfrorder{5}\gdef\lanruorder{6}}%
- {%
- \ifstrequal{#1}{englishahead}%
- {\execlanodeah\dealsortlan}%
- {\execlanodudf{#1}\dealsortlan}%
- }%
- }
- \ExecuteBibliographyOptions{gblanorder}
-
- \def\execlanodeah{%中文在后的顺序
- \gdef\lancnorder{4}
- \gdef\lanjporder{5}
- \gdef\lankrorder{6}
- \gdef\lanenorder{1}
- \gdef\lanfrorder{2}
- \gdef\lanruorder{3}}
-
- \newcounter{lanordernum}
- \newcommand{\execlanodudf}[1]{%like:cn;en;ru;fr;jp;kr
- \setcounter{lanordernum}{0}
- \DeclareListParser{\parsinglanorder}{;}
- \renewcommand*{\do}[1]{\stepcounter{lanordernum}\csxdef{lan##1order}{\thelanordernum}}
- \parsinglanorder{#1}
- }
-
- %
- % 增加本地化字符串的中英文切换选项
- % gbcitelocal指标注中的本地化字符串
- % gbbiblocal 指文献表中的本地化字符串
- % gblocal 指设置文献表和标注中的本地化字符串
- % v1.0o,20190103,hzz
- %
- \DeclareBibliographyOption[string]{gbcitelocal}[gb7714-2015]{%
- \ifstrequal{#1}{gb7714-2015}{\setcounter{gbcitelocalcase}{0}}{}%
- \ifstrequal{#1}{chinese}{\setcounter{gbcitelocalcase}{1}}{}%
- \ifstrequal{#1}{english}{\setcounter{gbcitelocalcase}{2}}{}%
- }
- \ExecuteBibliographyOptions{gbcitelocal}
-
- \DeclareBibliographyOption[string]{gbbiblocal}[gb7714-2015]{%
- \ifstrequal{#1}{gb7714-2015}{\setcounter{gbbiblocalcase}{0}}{}%
- \ifstrequal{#1}{chinese}{\setcounter{gbbiblocalcase}{1}}{}%
- \ifstrequal{#1}{english}{\setcounter{gbbiblocalcase}{2}}{}%
- }
- \ExecuteBibliographyOptions{gbbiblocal}
-
- \DeclareBibliographyOption[string]{gblocal}[gb7714-2015]{%
- \ExecuteBibliographyOptions{gbbiblocal=#1}%
- \ExecuteBibliographyOptions{gbcitelocal=#1}%
- }
- %\ExecuteBibliographyOptions{gblocal} %默认值已经通过两个相关选项设置
-
- %
- % 增加序号标签格式处理选项
- % v1.0l,20180623,hzz
- %
- \DeclareBibliographyOption[string]{gbbiblabel}[bracket]{%
- \csuse{gbbiblabelopt@#1}
- }
- \ExecuteBibliographyOptions{gbbiblabel}
-
- %
- % 增加姓名大小写格式处理选项
- %
- \DeclareBibliographyOption[string]{gbnamefmt}[uppercase]{%
- \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}%
- \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}%
- \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family
- \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{}
- \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given
- \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family
- }
- \ExecuteBibliographyOptions{gbnamefmt}
-
- %
- % 增加标签对齐选项
- %
- % right是默认的右对齐,left是左对齐,gb7714-2015是项对齐方式
- \DeclareBibliographyOption[string]{gbalign}[right]{%
- \ifstrequal{#1}{right}{\setcounter{gbalignlabel}{0}}{}
- \ifstrequal{#1}{left}{\setcounter{gbalignlabel}{1}}{}
- \ifstrequal{#1}{center}{\setcounter{gbalignlabel}{2}}{}
- \ifstrequal{#1}{gb7714-2015}{\setaligngbstyle}{}
- }
- }
- {% 针对biblatex<3.3版本的选项设置
- % 增加不同语言排序的切换选项
- % numeric样式, biblatex 3.4及以下版本不能使用多个stylesourcemap,所以不使用该选项
- % v1.0q,20190307,hzz
- %
- \DeclareBibliographyOption{gblanorder}[chineseahead]{}
-
- %
- % 增加序号标签格式处理选项
- % v1.0l,20180623,hzz
- %
- \DeclareBibliographyOption{gbbiblabel}[bracket]{%
- \csuse{gbbiblabelopt@#1}
- }
- \ExecuteBibliographyOptions{gbbiblabel}
-
- %
- % 增加姓名大小写格式处理选项
- %
- \DeclareBibliographyOption{gbnamefmt}[uppercase]{%
- \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}%
- \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}%
- \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family
- \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{}
- \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given
- \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family
- }
- \ExecuteBibliographyOptions{gbnamefmt}
-
- %
- % 增加标签对齐选项
- %
- % 原理方法:right是默认的右对齐,left是左对齐,gb7714-2015无效,仍然为右对齐模式,
- % 因为在这种biblatex低版本中,舍弃了list类环境后,会出错。
- % 注意:texlive2015中的3.0版中的DeclareBibliographyOption选项没有类型说明
- \DeclareBibliographyOption{gbalign}[right]{%
- \ifstrequal{#1}{right}{\setcounter{gbalignlabel}{0}}{}
- \ifstrequal{#1}{left}{\setcounter{gbalignlabel}{1}}{}
- \ifstrequal{#1}{center}{\setcounter{gbalignlabel}{2}}{}
- \ifstrequal{#1}{gb7714-2015}{}{}
- }
- }
-
-
-%
-% 针对biblatex<3.3版本的选项设置,比如texlive2015中的3.0版
-%
-\defversion{3.0}{opt}{
- \ExecuteBibliographyOptions{
- firstinits=true, %名字有缩写,参考3.1.2.3 Internal
- }
-}
-%
-% 针对3.3<=biblatex<3.5版本的选项设置,比如texlive2016中的3.4版
-%
-\defversion{3.4}{opt}{
- \ExecuteBibliographyOptions{
- giveninits=true, %名字有缩写,参考3.1.2.3 Internal
- }
-}
-%
-% 针对3.7<=biblatex<=3.9版本的选项设置,比如texlive2017中的3.7版
-%
-\defversion{3.7}{opt}{
- \ExecuteBibliographyOptions{
- giveninits=true,
- urldate =edtf, %iso8601
- eventdate =edtf,
- }
-}
-%
-% 针对3.10<=biblatex版本的选项设置,比如texlive2018中的3.11版
-%
-\defversion{3.10}{opt}{
- \ExecuteBibliographyOptions{
- giveninits=true,
- urldate =gb7714-2015, %iso,iso8601,edtf
- eventdate =gb7714-2015,
- }
-}
-
-%
-% 根据biblatex版本信息,选择选项设置
-%
-% 原理方法:如下这种选择机制能自动兼容更新的版本,但对于老版本
-% 必须要把情况列全。
-\iftoggle{iftlfive}{\switchversion{3.0}{opt}}{}%biblatex<=3.2
-\iftoggle{iftlsix}{\switchversion{3.4}{opt}}{}%3.3<=biblatex<=3.6
-\iftoggle{iftlseven}{\switchversion{3.7}{opt}}{}%biblatex=3.7
-\iftoggle{iftleight}{\switchversion{3.7}{opt}}{}%3.8<=biblatex<=3.9
-\iftoggle{iftlnine}{\switchversion{3.10}{opt}}{}%biblatex=3.10
-\iftoggle{iftlatest}{\switchversion{3.10}{opt}}{}%biblatex最新3.11
-
-
-%=====================================================================
-% 设置本地化字符串
-%=====================================================================
- %
- % 新建当地化字符串,用来记录“等”字符、“和”字符
- %
- \NewBibliographyString{andotherscn}
- \NewBibliographyString{andothersincitecn}
- \NewBibliographyString{andothersincite}
- \NewBibliographyString{andcn}
- \NewBibliographyString{andothersjp}
- \NewBibliographyString{andotherskr}
- \NewBibliographyString{andjp}
- \NewBibliographyString{andkr}
- \NewBibliographyString{andincitecn}
- \NewBibliographyString{andincite}
- \NewBibliographyString{volumecn}
- \NewBibliographyString{numbercn}
- \NewBibliographyString{serialcn}
- \NewBibliographyString{incn}
- \NewBibliographyString{mathesiscn}
- \NewBibliographyString{phdthesiscn}
- \NewBibliographyString{editorcn}
- \NewBibliographyString{editorscn}
-
-
-
- %
- % 修改一些当地化字符串
- %
- % 原理方法:直接利用当地化格式english修改出一些中文的格式,具体修改内容参考english.lbx文件
- % 当然也可以增加比如上面定义的andotherscn
- % 注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别
-
- \DefineBibliographyStrings{english}{
- bibliography = {\str at bibliography},
- references = {\str at references},
- bytranslator= {\str at bytranslator},%\addperiod,%将trans. by 改成 译\addcomma\
- and = {\addcomma},%将第2和3人名间的and符号改成逗号,用\finalnamedelim命令也可以定义,参见3.9.1节
- andcn = {\addcomma},%and本地化字符串的中文对应词
- andincitecn = {\str at andcn},%将标注中的分开,便于与文献表中的区分
- andincite = {\addcomma},
- %andothers = {et al.},%将超过3个人名的省略,et al.改成为 等
- andotherscn = {\str at andotherscn},%将超过3个人名的省略,et al.改成为 等
- andothersincitecn={\str at andotherscn},%将标注中的分开,便于与文献表中的区分
- andothersincite={et al\adddot},
- backrefpage = {\str at backrefpage:},
- backrefpages = {\str at backrefpages:},
- in={in\intitlepunct},
- volumecn={\str at volumecn},
- numbercn={\str at numbercn},
- serialcn={\str at serialcn},
- andothersjp={他},
- andotherskr={외},
- andjp={和},
- andkr={和},
- incn={\str at incn\addcolon\addspace},
- mathesiscn={\str at mathesiscn},
- phdthesiscn={\str at phdthesiscn},
- editorscn={\str at editorcn},
- editorcn={\str at editorcn},
-}
-
- %
- % 增加两个命令用于临时的局部的修改本地化字符串
- % 其中\setlocalbibstring修改缩写字符串,setlocalbiblstring修改长字符串
- % 注意使用时因为是局部修改,因此要将其与需要修改的引用命令放在一个编组符号内
- % v1.0t,hzz,20190525
- \newcommand{\setlocalbibstring}[2]{%
- \csdef{abx at sstr@#1}{#2}}
- \newcommand{\setlocalbiblstring}[2]{%
- \csdef{abx at lstr@#1}{#2}}
-
-%=====================================================================
-% 动态数据修改
-%=====================================================================
-%
-% 各层次的数据映射和动态修改
-%
-% 原理方法:
-% 1. 进行语言包括中英文判断,并设置和记录,比如记录到userf,usere中
-% 2. 增加文献标识符如[M],[J]等,对一些容易混淆的域进行设置以增强兼容性
-% 3. \DeclareSourcemap命令对于biblatex3.11以下版本只能出现一次,3.11版开始支持多个
-% 4. \DeclarestyleSourcemap在biblatex v3.7版开始可以支持出现多次
-% 5. 把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。
-% 注意:这里用userf,usere而不是namee,namef,是因为只有把name列表转成域,才能有效读取姓名中的字符,
-% 如果用namee,namef,name信息会自动解析,所以就不能为cjk判断提供需要的信息
-%
-% 不同的文献类型使用相同的驱动输出可以有5种方法:
-% 1. 是数据源层的映射,将其它类型转换为某一要使用驱动的类型
-% 2. 是样式层映射,也是将其它类型转换为某一要使用驱动的类型
-% 3. 是驱动层映射,也是将其它类型转换为某一要使用驱动的类型
-% 4. 定义驱动类型别名DeclareBibliographyAlias,将其它类型定义为某一要使用驱动的类型的别名
-% 驱动别名定义本质上是做了驱动层映射
-% 5. 直接定义不同的类型的驱动,但驱动内容相同。
-%
-% 关于数据映射和驱动使用的考虑如下:
-% 1. 为避免利用biber输出bib文件时的数据变动,尽量不在数据源层映射做类型转换
-% 2. 为减少代码量,尽量少做内容相同的不同类型驱动
-% 3. 因此类型相关的处理主要在样式层映射、驱动层映射、驱动别名
-% 4. 由于biblatex默认做的驱动别名处理可能增加一些信息比如masterthesis转thesis时增加的type
-% 可以在样式层映射做某些需要避免这种默认处置的转换
-% 5. 当没有避免默认行为的需求时,全部采用驱动别名的方式处理,等价于驱动层的映射
-%
-% 文献类型和驱动考虑如下:
-% 1. 连续出版物及析出文献有其特殊性,因此考虑两类periodical和article
-% newpaper映射为article,并以note域做区分特殊处理
-% 2. 专著和专著中的析出文献是主要的类型,因此考虑book和inbook
-% standard映射为book或inbook,并以note域做区分特殊处理
-% collection和proceedings基本与book类似,因此做book驱动别名处理
-% incollection和inproceedings基本与inbook类似,因此做inbook驱动别名处理
-% 3. 专利类型有其特殊性,考虑patent类型
-% 4. 电子资源类型有其特殊性,考虑online类型
-% 5. 报告类型与book有点类似,出版项处理与book一样,但有时又要有修改和更新日期
-% 因此考虑用一种类型来输出,使用report类型
-% 6. 手册/学位论文等类型与book有点类似,但对于出版项处理时,有缺省时,直接省略,
-% 同时有version和edition的区别,因此考虑用一种类型来输出,使用manual类型
-% 7. 包括报告,学位论文在内的其它所有的类型,都做一个判断,当没有出版项时,
-% 且存在网址信息时,将其转换为online类型输出,否则都做为manual类型输出。
-% 8. 备选类型misc当存在网址时直接转换为online,由于howpublished域可用于描述
-% 更多的信息,因此不存在网址时,独立做一个备选格式
-% 9. 出版项主要以如下方式处理:
-% (a) location+institution+date 仅用于连续出版物
-% (b)publisher+location+date 用于需要完整输出出版项的类型,比如book,collection,proceedings,in*,report
-% (c)institution+location+date 用于出版项缺失时不输出的类型,包括manual,thesis,archive等其他类型
-% (d)printlist{insitution} 用于电子资源,仅输出出版者或组织,为数据映射方便,本来默认的organization域转换为用insitution输出。
-% (e) 不输出,主要用于连续出版物析出的文献
-% 10. 日期以如下方式处理:
-% date 由于存在biblatex选项,因此通过选项控制,数据源为date解析数据或year
-% urldate 由于存在biblatex选项,因此通过选项控制,输出到日,且用[]包围,数据源为urldate
-% newsdate 用于公告日期,公开日期或新闻日期,输出到日,但无包围符号,数据源为date
-% modifydate 用于更新或修改日期,输出到日,且用()包围,数据源为date或enddate或eventdate
-
-
-\DeclareSourcemap{
-\maps[datatype=bibtex]{%
- \map{%当没有作者时将editor转成author
- \pernottype{inbook}%因为in系列中editor可能用来表示bookauthor,所以排除
- \pernottype{inproceedings}
- \pernottype{incollection}
- \pernottype{periodical}%因为peridical直接使用editor,所以排除
- %注意notfield在低版本biblatex中没有
- %\step[notfield=author,final]%当author不存在,将editor复制给author
- \step[fieldsource=editor,fieldtarget=author]%并删除editor
- }
- \map{%当没有作者时将translator转成author
- \pernottype{inbook}
- \pernottype{inproceedings}
- \pernottype{incollection}
- %\step[notfield=author,final]%当author不存在,将translator复制给author
- \step[fieldsource=translator,fieldtarget=author]%并删除translator
- }
- \map{%让address和location同步,biblatex中address是location的别名
- %因此输出的时候只有location信息,但处理过程中是可以存在address的。
- %\step[notfield=address,final]
- \step[fieldsource=location,final]
- \step[fieldset=address,origfieldval]
- }
- \map{%让address和location同步
- %\step[notfield=location,final]
- \step[fieldsource=address,final]
- \step[fieldset=location,origfieldval]
- }
- \map{%处理在bib文件用mark标记文献类型标识符的情况
- \step[fieldsource=mark,final]
- \step[fieldset=usera, origfieldval]
- }
- \map{%处理在bib文件中直接给出文献的姓名格式为lowercase的情况
- \step[fieldsource=nameformat,match=lowercase,final]
- \step[fieldset=namefmtid,fieldvalue={1}]
- }
- \map{%处理在bib文件中直接给出文献的姓名格式为givenahead的情况
- \step[fieldsource=nameformat,match=givenahead,final]
- \step[fieldset=namefmtid,fieldvalue={2}]
- }
- \map{%处理在bib文件中直接给出文献的姓名格式为familyahead的情况
- \step[fieldsource=nameformat,match=familyahead,final]
- \step[fieldset=namefmtid,fieldvalue={3}]
- }
- \map{%处理在bib文件中直接给出文献的姓名格式为pinyin的情况
- \step[fieldsource=nameformat,match=pinyin,final]
- \step[fieldset=namefmtid,fieldvalue={4}]
- }
- \map{%根据article确定文献类型标识符
- \pertype{article}
- \step[fieldset=usera, fieldvalue={J}]
- }
- \map{%根据periodical确定文献类型标识符
- \pertype{periodical}
- \step[fieldset=usera, fieldvalue={J}]
- \step[fieldsource=author] %有时会把author和editor混淆,处理后使用editor
- \step[fieldset=editor, origfieldval]
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{%根据增加一个新闻报纸的类型newspaper确定文献类型标识符
- \pertype{newspaper}
- \step[fieldset=usera, fieldvalue={N}]
- \step[fieldset=note, fieldvalue=news]%因为没有专门的驱动,记录note方便映射为article后判断
- }
- \map{%对应增加的一个数据库类型database确定文献类型标识符
- \pertype{database}
- \step[fieldset=usera, fieldvalue={DB}]
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{%对应增加的一个数据集类型dataset确定文献类型标识符
- \pertype{dataset}
- \step[fieldset=usera, fieldvalue={DS}]%
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{%对应增加的一个软件类型software确定文献类型标识符
- \pertype{software}
- \step[fieldset=usera, fieldvalue={CP}]
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{%对应增加的一个舆图类型map确定文献类型标识符
- \pertype{map}
- \step[fieldset=usera, fieldvalue={CM}]%
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{%对应增加的一个档案类型archive确定文献类型标识符
- \pertype{archive}
- \step[fieldset=usera, fieldvalue={A}]
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{%因为misc类型本身就是没有类型,而不像其它文献有明确的类型,所以
- %当misc类型带有网址时,直接将其转换为online类型
- \pertype{misc}
- \step[fieldsource=url,final]
- \step[typesource=misc,typetarget=online]
- }
- \map{%对应增加的一个备选类型misc确定文献类型标识符
- \pertype{misc}
- \step[fieldset=usera, fieldvalue={Z}]%
- }
- \map{
- \pertype{book}
- \pertype{inbook}
- \step[fieldset=usera, fieldvalue={M}]
- \step[fieldsource=version] %有时会把version和edition混淆,处理后直接用edition
- \step[fieldset=edition, origfieldval]
- }
- \map{%兼容老的standard类型,确定文献类型标识符
- \pertype{standard}
- \step[fieldset=usera, fieldvalue={S}]
- \step[fieldset=note, fieldvalue=standard]%因为没有专门的驱动,记录note方便映射为book和inbook后判断
- }
- \map{
- \pertype{patent}
- \step[fieldset=usera, fieldvalue={P}]
- }
- \map{
- \pertype{inproceedings}
- \pertype{conference}%兼容老的conference类型
- \step[fieldset=usera, fieldvalue={C}]
- \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
- \step[fieldset=publisher, origfieldval]
- }
- \map{
- \pertype{proceedings}
- \step[fieldset=usera, fieldvalue={C}]
- \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
- \step[fieldset=publisher, origfieldval]
- }
- \map{
- \pertype{incollection}
- \step[fieldset=usera, fieldvalue={G}]
- \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
- \step[fieldset=publisher, origfieldval]
- }
- \map{
- \pertype{collection}
- \step[fieldset=usera, fieldvalue={G}]
- \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
- \step[fieldset=publisher, origfieldval]
- }
- \map{
- \pertype{report}
- \pertype{techreport}%兼容老的techreport类型
- \step[fieldset=usera, fieldvalue={R}]
- \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
- \step[fieldset=publisher, origfieldval]
- }
- \map{
- \pertype{thesis}
- \pertype{mastersthesis}%兼容老的mastersthesis和phdthesis类型
- \pertype{phdthesis}
- \step[fieldset=usera, fieldvalue={D}]
- \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{
- \pertype{online}
- \pertype{electronic}%兼容老的electronic类型
- \pertype{www}%兼容老的www类型
- \step[fieldset=usera, fieldvalue={EB}]
- \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]%因为online的出版项处理类似手册
- \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性
- \step[fieldset=institution, origfieldval]
- }
- \map{
- \pertype{manual}
- \step[fieldset=usera, fieldvalue={A}]
- \step[fieldsource=edition]%有时会把version和edition混淆,处理后使用version
- \step[fieldset=version, origfieldval]
- \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性
- \step[fieldset=institution, origfieldval]
- }
- \map{
- \pertype{unpublished}
- \step[fieldset=usera, fieldvalue={Z}]
- }
- \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
- \step[fieldsource={author}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
- }%
- \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
- \step[fieldsource={editor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
- }%
- \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
- \step[fieldsource={translator}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
- }%
- \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
- \step[fieldsource={bookauthor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
- }%
- \map{%处理一些用year表示date的情况
- %这样处理将会设置date域,并使得labeldatesource变为空,因为date的前缀为空(如果是urldate,那么labeldatesource就是url)。
- %同时date域会被biblatex自动解析为year,month,day,并且覆盖原来的year信息
- \step[fieldsource=year]
- \step[fieldset=date, origfieldval]
- }
- \map{%将entrykey放入keywords中用于后期使用
- \step[fieldsource=entrykey]
- \step[fieldset=keywords, origfieldval]
- }
- \map{\step[fieldsource=title,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
- \step[fieldset=userd,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
- }
- \map{%
- \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final]
- \step[fieldset=userd,fieldvalue={russian}]%俄语
- }
- \map{%
- \step[fieldsource=title,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
- \step[fieldset=userd,fieldvalue={japanese}]%日语
- } %确定形式后可增加类似andotherscn这样的本地化字符串处理
- \map{%
- \step[fieldsource=title,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
- \step[fieldset=userd,fieldvalue={korean}]%韩语
- }
- \map{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题
- \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%
- \step[fieldset=userd, fieldvalue={chinese}]
- }
- \map{%将没有设置userd,且存在title域的默认设置为英文
- \step[fieldsource=title,final]
- \step[fieldset=userd,fieldvalue={english}]
- }
- \map{\step[fieldsource=author,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
- \step[fieldset=userf,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
- }
- \map{%
- \step[fieldsource=author,match=\regexp{[\x{0400}-\x{052F}]},final]
- \step[fieldset=userf,fieldvalue={russian}]%俄语
- }
- \map{%
- \step[fieldsource=author,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
- \step[fieldset=userf,fieldvalue={japanese}]%日语
- } %确定形式后可增加类似andotherscn这样的本地化字符串处理
- \map{%
- \step[fieldsource=author,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
- \step[fieldset=userf,fieldvalue={korean}]%韩语
- }
- \map{%作者的中文判断
- \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
- \step[fieldset=userf, fieldvalue={chinese}]
- }
- \map{%将没有设置userf,且存在author域的默认设置为英文
- \step[fieldsource=author,final]
- \step[fieldset=userf,fieldvalue={english}]
- }
- \map{\step[fieldsource=translator,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
- \step[fieldset=usere,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
- }
- \map{%
- \step[fieldsource=translator,match=\regexp{[\x{0400}-\x{052F}]},final]
- \step[fieldset=usere,fieldvalue={russian}]%俄语
- }
- \map{%
- \step[fieldsource=translator,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
- \step[fieldset=usere,fieldvalue={japanese}]%日语
- } %确定形式后可增加类似andotherscn这样的本地化字符串处理
- \map{%
- \step[fieldsource=translator,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
- \step[fieldset=usere,fieldvalue={korean}]%韩语
- }
- \map{%译者的中文判断
- \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
- \step[fieldset=usere, fieldvalue={chinese}]
- }
- \map{%将没有设置usere,且存在translator域的默认设置为英文
- \step[fieldsource=translator,final]
- \step[fieldset=usere,fieldvalue={english}]
- }
- \map{\step[fieldsource=editor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
- \step[fieldset=userc,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
- }
- \map{%
- \step[fieldsource=editor,match=\regexp{[\x{0400}-\x{052F}]},final]
- \step[fieldset=userc,fieldvalue={russian}]%俄语
- }
- \map{%
- \step[fieldsource=editor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
- \step[fieldset=userc,fieldvalue={japanese}]%日语
- } %确定形式后可增加类似andotherscn这样的本地化字符串处理
- \map{%
- \step[fieldsource=editor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
- \step[fieldset=userc,fieldvalue={korean}]%韩语
- }
- \map{%编者的中文判断
- \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5
- \step[fieldset=userc, fieldvalue={chinese}]
- }
- \map{%将没有设置userc,且存在editor域的默认设置为英文
- \step[fieldsource=editor,final]
- \step[fieldset=userc,fieldvalue={english}]
- }
- \map{\step[fieldsource=bookauthor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
- \step[fieldset=userb,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
- }
- \map{%
- \step[fieldsource=bookauthor,match=\regexp{[\x{0400}-\x{052F}]},final]
- \step[fieldset=userb,fieldvalue={russian}]%俄语
- }
- \map{%
- \step[fieldsource=bookauthor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
- \step[fieldset=userb,fieldvalue={japanese}]%日语
- } %确定形式后可增加类似andotherscn这样的本地化字符串处理
- \map{%
- \step[fieldsource=bookauthor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
- \step[fieldset=userb,fieldvalue={korean}]%韩语
- }
- \map{%编者的中文判断
- \step[fieldsource=bookauthor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5
- \step[fieldset=userb, fieldvalue={chinese}]
- }
- \map{%将没有设置userc,且存在editor域的默认设置为英文
- \step[fieldsource=bookauthor,final]
- \step[fieldset=userb,fieldvalue={english}]
- }
- \map{\step[fieldsource=userd,final]%userd存在则用根据标题的语言设定language
- \step[fieldset=language,origfieldval]%本身language存在则不设定
- }
- \map{\step[fieldsource=userf,final]%userd不存在,而userf存在则根据author的语言设定language
- \step[fieldset=language,origfieldval]
- }%如果没有作者和标题,那么剩下的最可能有意义的只有网址了,而网址通常是英文的,因此不用再进一步对其它域进行判断了。
- \map{%将没有设置的language设置成en,即认为不是中文的就是英文的。
- \step[fieldset=language,fieldvalue={english}]
- }
- \map{%一条文献的语言已经设定在language域中,由于出版项相关宏中使用userd判断,
- %所以将一条文献的主体语言设定到userd中,本身前面userd已经设定,但没有处理无标题的情况,
- %这里的处理等价于没有标题时,利用作者的语言设定userd,再没有作者,则默认用英文设定userd
- \step[fieldsource=language]
- \step[fieldset=userd,origfieldval]
- }
- \map{%当文献给出language域时,设置文献要使用的本地化字符串的语言
- %biblatex 3.11及以下版本仅有match是区分大小写的,而3.12版开始用matchi来区分大小,而match不区分
- %这里为兼容3.11及以下版本,所以用一个复杂一点的正则表达式
- \step[fieldsource=language,match=\regexp{(e|E)(n|N)(g|G)(l|L)(i|I)(s|S)(h|H)},final]
- \step[fieldset=langid,fieldvalue={english}]
- \step[fieldset=lansortorder,fieldvalue=\lanenorder]
- }
- \map{
- \step[fieldsource=language,match=\regexp{(r|R)(u|U)(s|S)(s|S)(i|I)(a|A)(n|N)},final]
- \step[fieldset=langid,fieldvalue={russian}]
- \step[fieldset=lansortorder,fieldvalue=\lanruorder]
- }
- \map{%
- \step[fieldsource=language,match=\regexp{(f|F)(r|R)(e|E)(n|N)(c|C)(h|H)},final]
- \step[fieldset=langid,fieldvalue={french}]
- \step[fieldset=lansortorder,fieldvalue=\lanfrorder]
- }
- \map{%
- \step[fieldsource=language,match=\regexp{(c|C)(h|H)(i|I)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english,
- \step[fieldset=langid,fieldvalue={english}]
- \step[fieldset=lansortorder,fieldvalue=\lancnorder]
- }
- \map{%
- \step[fieldsource=language,match=\regexp{(j|J)(a|A)(p|P)(a|A)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english,
- \step[fieldset=langid,fieldvalue={english}]
- \step[fieldset=lansortorder,fieldvalue=\lanjporder]
- }
- \map{%
- \step[fieldsource=language,match=\regexp{(k|K)(o|O)(r|R)(e|E)(a|A)(n|N)},final]%中日韩语目前都用english,
- \step[fieldset=langid,fieldvalue={english}]
- \step[fieldset=lansortorder,fieldvalue=\lankrorder]
- }
-}
-}
-
-
-%
-% 修改输入的参考文献数据,样式层的操作
-%
-% 原理方法:因为biblatex3.0版的map不使用foreach选项,所以需要一个一个写,以处理特殊字符
-\defversion{3.0}{map}{
- \DeclareStyleSourcemap{
- \maps[datatype=bibtex]{
- \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook,
- %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义
- %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断
- \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook
- \step[typesource=standard, typetarget=inbook, final]
- }
- \map{%剩下的全部映射为book
- \step[typesource=standard, typetarget=book, final]
- }
-% \map{%先于标准样式的driver层映射,以取消type设置
-% \step[typesource=mastersthesis, typetarget=thesis, final]
-% %\step[fieldset=type, fieldvalue=mathesis]
-% }
-% \map{%先于标准样式的driver层映射,以取消type设置
-% \step[typesource=phdthesis, typetarget=thesis, final]
-% %\step[fieldset=type, fieldvalue=phdthesis]
-% }
- \map{%先于标准样式的driver层映射,以取消type设置
- \step[typesource=techreport, typetarget=report, final]
- %\step[fieldset=type, fieldvalue=techreport]
- }
- \map{%
- \pertype{report}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=report,typetarget=online]
- \step[fieldset=note,fieldvalue={report}]
- }
- \map{%
- \pertype{thesis}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=thesis,typetarget=online]
- }
- \map{%
- \pertype{manual}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=manual,typetarget=online]
- }
- \map{%
- \pertype{unpublished}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=unpublished,typetarget=online]
- }
- \map{%
- \pertype{database}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=databasetypetarget=online]
- }
- \map{%
- \pertype{dataset}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=dataset,typetarget=online]
- }
- \map{%
- \pertype{software}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=software,typetarget=online]
- }
- \map{%
- \pertype{map}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=map,typetarget=online]
- }
- \map{%
- \pertype{archive}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=archive,typetarget=online]
- }
- \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确)
- \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸
- \step[fieldset=keywords, fieldvalue={,}, append]
- \step[fieldset=keywords, origfieldval, append]
- }
- \map[overwrite]{%title,booktitle,journaltitle,journal,publisher,address,location,institution,organization
- \step[fieldsource={title}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
- }
- \map[overwrite]{
- \step[fieldsource={booktitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
- }
- \map[overwrite]{
- \step[fieldsource={journaltitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
- }
- \map[overwrite]{
- \step[fieldsource={journal}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
- }
- \map[overwrite]{
- \step[fieldsource={publisher}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
- }
- \map[overwrite]{
- \step[fieldsource={address}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
- }
- \map[overwrite]{
- \step[fieldsource={location}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
- }
- \map[overwrite]{
- \step[fieldsource={institution}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
- }
- \map[overwrite]{
- \step[fieldsource={booktitle}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}]
- }
- \map[overwrite]{
- \step[fieldsource={booktitle}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}]
- }
- }
- }
-}
-
-%
-% 修改输入的参考文献数据,样式层的操作
-%
-% 原理方法:biblatex3.4以上版本
-\defversion{3.4}{map}{
- \DeclareStyleSourcemap{
- \maps[datatype=bibtex]{
- \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook,
- %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义
- %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断
- \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook
- \step[typesource=standard, typetarget=inbook, final]
- }
- \map{%剩下的全部映射为book
- \step[typesource=standard, typetarget=book, final]
- }
-% \map{%先于标准样式的driver层映射,以取消type设置
-% \step[typesource=mastersthesis, typetarget=thesis, final]
-% %\step[fieldset=type, fieldvalue=mathesis]
-% }
-% \map{%先于标准样式的driver层映射,以取消type设置
-% \step[typesource=phdthesis, typetarget=thesis, final]
-% %\step[fieldset=type, fieldvalue=phdthesis]
-% }
- \map{%先于标准样式的driver层映射,以取消type设置
- \step[typesource=techreport, typetarget=report, final]
- %\step[fieldset=type, fieldvalue=techreport]
- }
- \map{%
- \pertype{report}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=report,typetarget=online]
- \step[fieldset=note,fieldvalue={report}]
- }
- \map{%
- \pertype{thesis}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=thesis,typetarget=online]
- }
- \map{%
- \pertype{manual}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=manual,typetarget=online]
- }
- \map{%
- \pertype{unpublished}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=unpublished,typetarget=online]
- }
- \map{%
- \pertype{database}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=databasetypetarget=online]
- }
- \map{%
- \pertype{dataset}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=dataset,typetarget=online]
- }
- \map{%
- \pertype{software}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=software,typetarget=online]
- }
- \map{%
- \pertype{map}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=map,typetarget=online]
- }
- \map{%
- \pertype{archive}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=archive,typetarget=online]
- }
- \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确)
- \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸
- \step[fieldset=keywords, fieldvalue={,}, append]
- \step[fieldset=keywords, origfieldval, append]
- }
- \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{
- \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}]
- }
- \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{
- \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}]
- }
- \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,%
- address,location,institution,organization}]{
- \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
- }
- }
- }
-}
-
-\iftoggle{iftlfive}%
- {\switchversion{3.0}{map}}%%当采用biblatex<=3.2版本时
- {\switchversion{3.4}{map}}%%当采用3.3<=biblatex版本时
-
-
-%
-% 不同语言分集调整的实现方式
-%
-% 原理方法:利用样式层的动态数据修改lansortorder域来实现排序
-\def\dealsortlan{
- \DeclareStyleSourcemap{
- \maps[datatype=bibtex]{
- \map[overwrite]{%当文献给出language域时,设置文献要使用的本地化字符串的语言
- \step[fieldsource=language,match=english,final]
- \step[fieldset=lansortorder,fieldvalue=\lanenorder]
- }
- \map[overwrite]{
- \step[fieldsource=language,match=russian,final]
- \step[fieldset=lansortorder,fieldvalue=\lanruorder]
- }
- \map[overwrite]{%
- \step[fieldsource=language,match=french,final]
- \step[fieldset=lansortorder,fieldvalue=\lanfrorder]
- }
- \map[overwrite]{%
- \step[fieldsource=language,match=chinese,final]%中日韩语目前都用english,
- \step[fieldset=lansortorder,fieldvalue=\lancnorder]
- }
- \map[overwrite]{%
- \step[fieldsource=language,match=japanese,final]%中日韩语目前都用english,
- \step[fieldset=lansortorder,fieldvalue=\lanjporder]
- }
- \map[overwrite]{%
- \step[fieldsource=language,match=korean,final]%中日韩语目前都用english,
- \step[fieldset=lansortorder,fieldvalue=\lankrorder]
- }
- }
- }
-}
-
-%
-%驱动别名等价于驱动层映射
-%
-\DeclareBibliographyAlias{newspaper}{article}%
-\DeclareBibliographyAlias{inproceedings}{inbook}%会议论文文献类型驱动
-\DeclareBibliographyAlias{conference}{inbook}%会议论文文献类型驱动
-\DeclareBibliographyAlias{incollection}{inbook}%文集中析出文献类型驱动
-\DeclareBibliographyAlias{collection}{book}%%文集类型驱动
-\DeclareBibliographyAlias{proceedings}{book}%会议论文集文献类型驱动
-\DeclareBibliographyAlias{thesis}{manual}%学位论文驱动
-\DeclareBibliographyAlias{unpublished}{manual}%其它类型驱动
-\DeclareBibliographyAlias{database}{manual}
-\DeclareBibliographyAlias{dataset}{manual}
-\DeclareBibliographyAlias{software}{manual}
-\DeclareBibliographyAlias{map}{manual}
-\DeclareBibliographyAlias{archive}{manual}
-
-%=====================================================================
-% 设置排序格式
-%=====================================================================
-%
-% 排序格式,用降序,及userb域,针对biblatex3.7及以下版本
-%
-\defversion{3.7}{sort}{%这是3.4版的,3.7版略有差异,但不大,后面有注释
- \DeclareSortingScheme{gb7714-2015}{
- \sort{
- \field{presort}
- }
- %\sort[final]{
- %\field{sortkey}
- %}
- \sort{
- \field{lansortorder}%language
- }
- \sort{
- \field{sortkey}
- }
- \sort{%[direction=descending]
- \field{sortname}
- \field{author}
- \field{editor}
- \field{translator}
- }
- \sort{
- \field{sortyear}
- \field{year}
- }
- \sort{
- \field{sorttitle}
- \field{title}
- }
- \sort{
- \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume}
- \literal{0000}%3.7版是\literal{0}
- }
- }
-
- %降序的nyt
- \DeclareSortingScheme{gbnytd}{
- \sort{
- \field{presort}
- }
- %\sort[final]{
- %\field{sortkey}
- %}
- \sort{
- \field{lansortorder}%language
- }
- \sort[direction=descending]{
- \field{sortkey}
- }
- \sort[direction=descending]{
- \field{sortname}
- \field{author}
- \field{editor}
- \field{translator}
- }
- \sort{
- \field{sortyear}
- \field{year}
- }
- \sort{
- \field{sorttitle}
- \field{title}
- }
- \sort{
- \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume}
- \literal{0000}%3.7版是\literal{0}
- }
- }
-
- %降序的ynt
- \DeclareSortingScheme{gbyntd}{
- \sort{
- \field{presort}
- }
- %\sort[final]{
- %\field{sortkey}
- %}
- \sort{
- \field{lansortorder}%language
- }
- \sort[direction=descending]{
- \field{sortyear}
- \field{year}
- }
- \sort{
- \field{sortkey}
- }
- \sort{
- \field{sortname}
- \field{author}
- \field{editor}
- \field{translator}
- }
- \sort{
- \field{sorttitle}
- \field{title}
- }
- \sort{
- \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume}
- \literal{0000}%3.7版是\literal{0}
- }
- }
-
- %升序的ynt
- \DeclareSortingScheme{gbynta}{
- \sort{
- \field{presort}
- }
- %\sort[final]{
- %\field{sortkey}
- %}
- \sort{
- \field{lansortorder}%language
- }
- \sort{
- \field{sortyear}
- \field{year}
- }
- \sort{
- \field{sortkey}
- }
- \sort{
- \field{sortname}
- \field{author}
- \field{editor}
- \field{translator}
- }
- \sort{
- \field{sorttitle}
- \field{title}
- }
- \sort{
- \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume}
- \literal{0000}%3.7版是\literal{0}
- }
- }
-}
-
-
-%
-% 排序格式,用降序,及userb域,针对biblatex3.8及以上版本
-%
-\defversion{3.8}{sort}{
- \DeclareSortingTemplate{gb7714-2015}{
- \sort{
- \field{presort}
- }
- %\sort[final]{
- %\field{sortkey}
- %}
- \sort{
- \field{lansortorder}%language
- }
- \sort{
- \field{sortkey}
- }
- \sort{%[direction=descending]
- \field{sortname}
- \field{author}
- \field{editor}
- \field{translator}
- }
- \sort{
- \field{sortyear}
- \field{year}
- }
- \sort{
- \field{sorttitle}
- \field{title}
- }
- \sort{
- \field{volume}
- \literal{0}
- }
- }
-
- %降序的nyt
- \DeclareSortingTemplate{gbnytd}{
- \sort{
- \field{presort}
- }
-% \sort[final]{
-% \field{sortkey}
-% }
- \sort{
- \field{lansortorder}%language
- }
- \sort[direction=descending]{
- \field{sortkey}
- }
- \sort[direction=descending]{%
- \field{sortname}
- \field{author}
- \field{editor}
- \field{translator}
- }
- \sort{
- \field{sortyear}
- \field{year}
- }
- \sort{
- \field{sorttitle}
- \field{title}
- }
- \sort{
- \field{volume}
- \literal{0}
- }
- }
-
- %降序的ynt
- \DeclareSortingTemplate{gbyntd}{
- \sort{
- \field{presort}
- }
-% \sort[final]{
-% \field{sortkey}
-% }
- \sort{
- \field{lansortorder}%language
- }
- \sort[direction=descending]{
- \field{sortyear}
- \field{year}
- }
- \sort{
- \field{sortkey}
- }
- \sort{%
- \field{sortname}
- \field{author}
- \field{editor}
- \field{translator}
- }
- \sort{
- \field{sorttitle}
- \field{title}
- }
- \sort{
- \field{volume}
- \literal{0}
- }
- }
-
- %升序的ynt
- \DeclareSortingTemplate{gbynta}{
- \sort{
- \field{presort}
- }
-% \sort[final]{
-% \field{sortkey}
-% }
- \sort{
- \field{lansortorder}%language
- }
- \sort{%[direction=ascending]
- \field{sortyear}
- \field{year}
- }
- \sort{
- \field{sortkey}
- }
- \sort{%
- \field{sortname}
- \field{author}
- \field{editor}
- \field{translator}
- }
- \sort{
- \field{sorttitle}
- \field{title}
- }
- \sort{
- \field{volume}
- \literal{0}
- }
- }
-}
-
-
-\ifboolexpr{
-test {\iftoggle{iftlfive}}
-or
-test {\iftoggle{iftlsix}}
-or
-test {\iftoggle{iftlseven}}%biblatex<=3.7
-}{\switchversion{3.7}{sort}}{\switchversion{3.8}{sort}}%3.8<=biblatex
-
-%=====================================================================
-% 参考文献表环境
-%=====================================================================
-%
-% 列表格式
-%
-% 增加一个\bibitemindent尺寸用于控制list环境的itemindent
-% v1.0l,20180615,hzz
-% v1.0t,20200319,hzz,增加尺寸\biblabelextend使某些字体下标签宽度不足时可增加标签宽度
-\setlength{\bibhang}{\biblabelsep}%
-\newlength{\bibitemindent}
-\setlength{\bibitemindent}{0pt}
-\newlength{\biblabelextend}
-\setlength{\biblabelextend}{0pt}
-
-
-\defbibenvironment{bibliography}
- {\list
- {\printtext[labelnumberwidth]{%
- \printfield{labelprefix}%
- \printfield{labelnumber}}}
- {\addtolength{\labelnumberwidth}{\biblabelextend}%
- \setlength{\labelwidth}{\labelnumberwidth}%
- \setlength{\labelsep}{\biblabelsep}%
- \setlength{\leftmargin}{\bibhang}%
- \addtolength{\leftmargin}{\labelnumberwidth}%
- \setlength{\itemindent}{\bibitemindent}%
- \setlength{\itemsep}{\bibitemsep}%
- \setlength{\parsep}{\bibparsep}}%
- \renewcommand*{\makelabel}[1]{\hss##1}}
- {\endlist}
- {\item}
-
-%
-% 顺序编码制-标签对齐方式处理
-%
-% 原理方法:利用选项提供的计数器数值做选择
-% 左对齐,右对齐为list环境下的处理,此时list环境的\labelwidth只能设置一个,是最宽标签的宽度
-% 项对齐则是在段落环境下做的处理。
-% 左对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距可变
-% 右对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距相等,标签与页边距离可变
-% 项对齐时,序号标签贴在页边,序号标签与参考文献项内容的间距相等
-% 修改序号标签格式为:
-% \DeclareFieldFormat{shorthandwidth}{\mkbibbrackets{#1}} %源来自numeric.BBX
-% \DeclareFieldFormat{labelnumberwidth}{\ttfamily\mkbibbrackets{#1}\hfill}
-\DeclareFieldFormat{labelnumberwidth}{%
-\ifcase\value{gbalignlabel}%右对齐,整个标签为右对齐
- \mkgbnumlabel{#1}%
-\or%左对齐,整个标签为左对齐
- \mkgbnumlabel{#1}\hfill%
-\or%中间对齐,比如:序号数字居于[]中间
- \hfil\mkgbnumlabel{\hfill#1\hfill}\hfil%
-\fi}
-
-%
-% 修改序号标签格式为以各条参文献为基础进行对齐的方式,即序号与条目内容间隔相等的方式。
-\def\setaligngbstyle{%
-\def\blx at bibitem##1{%
- \blx at ifdata{##1}
- {\begingroup
- \blx at getdata{##1}%
- \blx at bibcheck
- \iftoggle{blx at skipentry}{}{%
- \blx at setdefaultrefcontext{##1}%
- \global\let\blx at noitem\@empty
- \blx at setoptions@type\abx at field@entrytype
- \blx at setoptions@entry
- \blx at thelabelnumber
- \addtocounter{instcount}\@ne
- \blx at initsep
- \blx at namesep
- \csuse{blx at item@\blx at theenv}\relax
-% \blx at initsep %移动到上面去,恢复bibnamesep等的作用机制
-% \blx at namesep
- \csuse{blx at hook@bibitem}%
- \blx at execute
- \blx at initunit
- \blx at anchor
- \blx at beglangbib
- \bibsentence
- \blx at pagetracker
- \blx at driver\abx at field@entrytype
- \blx at postpunct
- \blx at endlangbib}%
- \par\endgroup}%这里增加了一个\par
- {}}
-\newlength{\lengthid}
-\newlength{\lengthlw}
-\newcommand{\itemcmd}{%
-\settowidth{\lengthid}{\mkgbnumlabel{\printfield{labelnumber}}}
-\addtolength{\lengthid}{\biblabelsep}
-\setlength{\lengthlw}{\textwidth}
-\addtolength{\lengthlw}{-\lengthid}
-\addvspace{\bibitemsep}%恢复\bibitemsep的作用
-%\parshape 2 0em \textwidth \lengthid \lengthlw
-\hangindent\lengthid
-\mkgbnumlabel{\printfield{labelnumber}}%
-\hspace{\biblabelsep}}
-%
-% 简单的段落环境
-\defbibenvironment{bibliography}
-{\begingroup\setlength{\parindent}{0em}}
-{\endgroup}
-{\itemcmd}}
-
-
-%=====================================================================
-% 设置单元或块等的标点
-%=====================================================================
-\renewrobustcmd*{\bibinithyphendelim}{\addhighpenspace}%用于处理姓名中名部分存在-的情况,比如ZHANG Yu-xin
-\renewcommand*{\subtitlepunct}{\addcolon\addspace} %修改标题和其它标题信息间的标点,来源biblatex.def,
-%
-% 利用set实现的多语言文献不同语言间的分隔符
-% 20170411,双语之间用newline替换par,避免采用gb7714-2015的项对齐方式第二语言间分段导致没有缩进
-%
-% 原理方法:set方法可以参考3.11.5 Entry Sets,4.11.1 Entry Sets
-% 这里调整一下两种语言参考文献的间隔,源来自biblatex.def
-\renewcommand*{\entrysetpunct}{\adddot\newline\nobreak}
-\renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%%页码引用格式的修改,修改为用冒号
-%\renewcommand{\relateddelim}{}%\par
-
-%=====================================================================
-% 修改域的格式,重定义域的输出宏
-%=====================================================================
-%
-% 新增文献类型标识符的格式
-% []前的nobreak,从GB4.1节的例子看不应该加,所以去掉
-% 但因为考虑到cjk字符和[]之间可能添加空格,所以仍然加上
-% 而[]中间的内容,从4.6.2节的例子看也是可以分割的,因此内部的nobreak也可以去掉
-%
-\DeclareFieldFormat{gbtypeflag}{%
-\iftoggle{bbx:gbmedium}%
-{\iftoggle{bbx:url}%
- {\iffieldundef{url}%当存在url时,增加一个OL标识符
- {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}%
- {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}%
- }%
- {\ifentrytype{online}%
- {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}%
- {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}%
- }}%
- {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}%
-}
-
-%
-% 新增用于报纸的文献类型标识符的格式
-%
-\DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper
-\iftoggle{bbx:gbmedium}%
-{\iftoggle{bbx:url}%
- {\iffieldundef{url}%当存在url时,增加一个OL标识符
- {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
- {\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}%
- }%
- {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
-}{\nobreak\printtext{[}\nobreak N\printtext{]}\nobreak}%
-}
-
-%
-% 新增用于标准的文献类型标识符的格式
-%
-\DeclareFieldFormat{gbtypeflags}{%用于标准standard
-\iftoggle{bbx:gbmedium}%
-{\iftoggle{bbx:url}%
- {\iffieldundef{url}%当存在url时,增加一个OL标识符
- {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
- {\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}%
- }%
- {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
-}{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}%
-}
-
-%
-% 重设title等参考文献信息的输出格式
-%
-% 原理方法:修改来自biblatex.def文件的原格式
-\newcommand{\bibtitlefont}{}
-\newcommand{\bibauthorfont}{}
-\newcommand{\bibpubfont}{}
-
-\DeclareFieldFormat{title}{#1\adddot\addthinspace}
-\DeclareFieldFormat{journaltitle}{#1\isdot}%添加\isdot用于缩写名带点情况,将其转换为缩写点,便于标点的追踪
-\DeclareFieldFormat{issuetitle}{#1}
-\DeclareFieldFormat{maintitle}{#1}
-\DeclareFieldFormat{booktitle}{#1}
-\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉
- [article,patent,thesis,unpublished]
- {title}{#1\adddot\addthinspace}%\mkbibquote{#1\isdot}
-\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉
- [inbook,incollection,inproceedings]
- {title}{#1}%\nopunct\unspace
-\DeclareFieldFormat{url}{\url{#1}} %%url相关输出,url域修改如本行,源来自biblatex.def
-\def\UrlFont{\rmfamily}%设置url字体为roman字体%\ttfamily
-%\urlstyle{rm} %使用这句也一样
-\setcounter{biburlnumpenalty}{100} %让url可以在数字后断行
-\setcounter{biburlucpenalty}{100} %让url可以在大写字母后断行
-\setcounter{biburllcpenalty}{100} %让url可以在小写字母后断行
-\DeclareFieldFormat{doi}{%
- \rmfamily{DOI}\addcolon\space
- \ifhyperref
- {\href{https://doi.org/#1}{\nolinkurl{#1}}}
- {\nolinkurl{#1}}}
-%
-% 标题的字母大小写格式修改
-%
-% 注意:修改标题的字母大小写,不能用前面的title的格式而要用titlecase
-% 因为titlecase is applied to the contents of the field directly,title is not
-%\DeclareFieldFormat{titlecase}{\MakeCapital#1}%重设标题格式,将其修改为首字母大写
-\DeclareFieldFormat{titlecase}{\iftoggle{bbx:titlelink}{%
-\iffieldundef{url}{\MakeCapital#1}{%
-\href{\thefield{url}}{#1}}}{\MakeCapital#1}}%重设标题格式,将其修改为首字母大写
-\DeclareFieldFormat{pages}{#1}%去掉前面引导页码的pp.等字符,\mkpageprefix[bookpagination]{#1}
-\DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{-}}%将页码间隔符替换会英文的短横线
-
-\def\execgbfdfmtstd{%恢复到标准样式的设置
-\DeclareFieldFormat{title}{\mkbibemph{##1}}
-\DeclareFieldFormat
- [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
- {title}{\mkbibquote{##1\isdot}}
-\DeclareFieldFormat
- [suppbook,suppcollection,suppperiodical]
- {title}{##1}
-\DeclareFieldFormat{journaltitle}{\mkbibemph{##1}}
-\DeclareFieldFormat{issuetitle}{\mkbibemph{##1}}
-\DeclareFieldFormat{maintitle}{\mkbibemph{##1}}
-\DeclareFieldFormat{booktitle}{\mkbibemph{##1}}
-\DeclareFieldFormat{url}{\mkbibacro{URL}\addcolon\space\url{##1}}
-\DeclareFieldFormat{titlecase}{##1}
-\DeclareFieldFormat{pages}{\mkpageprefix[bookpagination]{##1}}
-}
-
-%
-% 文献标题后的标点问题
-% v1.0k,20180405,为texlive2017以上版本中的beamer兼容性做的处理,Hu Zhenzhen
-%
-% 原理方法:如下代码处理texlive2017以上版本中,beamer中文献的标题后出现两个点的情况:
-% texlive2017以上的beamer中对macro{title}做了patch,正常情况下不会出现两个点的情况,但由于
-% 之前为了处理texlive2015,2016下的title格式添加了adddot,导致出现两个点的情况,而且也影响
-% 析出文献的//符号的输出,因此再次对macro{title}做patch消除beamer中做apptocmd时添加的\newunitpunct
-\ifboolexpr{%
- test{\iftoggle{iftlfive}}
- or
- test{\iftoggle{iftlsix}}
- }{}%
- {%texlive 2017对应iftlseven以上版本
- \@ifclassloaded{beamer}{
- \DeclareFieldFormat{title}{#1}%
- \DeclareFieldFormat[article,patent,thesis,unpublished]{title}{#1}
- \AtBeginDocument{%
- \patchcmd{\abx at macro@title}{\newunitpunct}{}{}{}}}{}
- }
-
-
-%
-% 修改译者位置格式
-%
-% 原理方法:修改来自biblatex.def文件的bytranslator+others宏的格式
-\renewbibmacro*{bytranslator+others}{\bibauthorfont%
- \ifnameundef{translator}
- {}
- {%\usebibmacro{bytranslator+othersstrg}
- %\setunit{\addspace}%
- \printnames[bytranslator]{translator}%
- \clearname{translator}%
- %从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理
- %比如生成cotranslator等用于调用cotranslator所代表的当地化字符串
- \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。
- %\setunit{\addspace}%
- \newunit}%
- \usebibmacro{withothers}}
-
-
-%
-% 修改作者数量超过限定值,做省略时的处理格式
-% v1.0,20160701,hzz
-% v1.0O,20190103,hzz,修改利用新定义的一个分隔符strandothersdelim
-%
-% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。
-\renewbibmacro*{name:andothers}{\bibauthorfont%
- \ifboolexpr{
- test {\ifnumequal{\value{listcount}}{\value{liststop}}}
- and
- test \ifmorenames
- }{\ifnumgreater{\value{liststop}}{1}%
- {\finalandcomma}%
- {}%
-\printdelim{andothersdelim}\printdelim{strandothersdelim}%
-}{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如:
-%袁训来, 陈哲, 肖书海, 等.
-%胡泳, 范海燕, 译.
-%潘惠霞, 魏婧, 杨艳, 等译.
-\ifcurrentname{translator}{\addcomma\addthinspace}{}%为了实现上述第二个示例情况做的处理
-}}
-
-
-% 修改省略作者后的本地化字符串,比如et al.
-% v1.0o,20190103,hzz
-%
-% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andotherscn=“等”,否则用andothers=“et al.”。
-% 非默认情况,根据选项信息,选择选择强制中文或英文
-% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了
-% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置
-\DeclareDelimFormat{strandothersdelim}{%
- \edef\userfieldabcde{userd}%这里使用\iffieldequalstr{labelnamesource}替代ifcurrentname因为标注中使用ifcurrentname无效
- \iffieldequalstr{labelnamesource}{translator}{\edef\userfieldabcde{usere}}{}%
- \iffieldequalstr{labelnamesource}{editor}{\edef\userfieldabcde{userc}}{}%
- \iffieldequalstr{labelnamesource}{author}{\edef\userfieldabcde{userf}}{}%
- \iffieldequalstr{labelnamesource}{bookauthor}{\edef\userfieldabcde{userb}}{}%
- \ifcase\value{gbcitelocalcase}%
- \iffieldequalstr{\userfieldabcde}{chinese}{\ifbibstring{andothersincitecn}{\bibstring{andothersincitecn}}{\bibstring{andothers}}}{}%中文已经通过english本地化字符串定义
- \iffieldequalstr{\userfieldabcde}{korean}{\ifbibstring{andotherskr}{\bibstring{andotherskr}}{\bibstring{andothers}}}{}%韩语未定义,所以与bib中一致
- \iffieldequalstr{\userfieldabcde}{japanese}{\ifbibstring{andothersjp}{\bibstring{andothersjp}}{\bibstring{andothers}}}{}%日与同韩语
- \iffieldequalstr{\userfieldabcde}{english}{\ifbibstring{andothersincite}{\bibstring{andothersincite}}{\bibstring{andothers}}}{}%英语已定义
- \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%法语未定义,若要定义需要针对french本地化字符串定义
- \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%俄语未定义,若要定义需要针对russian本地化字符串定义
- \or%
- \bibstring{andothersincitecn}%
- \or%
- \bibstring{andothersincite}%
- \fi}
-
-
-\DeclareDelimFormat[bib,biblist]{strandothersdelim}{%
- \edef\userfieldabcde{userd}%
- \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
- \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
- \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
- \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
- \ifcase\value{gbbiblocalcase}%
- \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}%
- \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}%
- \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andothersjp}}{}%
- \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}%
- \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%
- \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%
- \or%
- \bibstring{andotherscn}%
- \or%
- \bibstring{andothers}%
- \fi}
-
-%
-% 修改最后一个作者前的字符串,比如 and
-% v1.0o,20190103,hzz
-%
-% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andcn=“和”,否则用and=“and”。
-% 非默认情况,根据选项信息,选择选择强制中文或英文
-% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了
-% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置
-\DeclareDelimFormat{finalnamedelim}{%
- \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
-% \addspace%
- \edef\userfieldabcde{userd}%
- \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
- \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
- \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
- \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
- \ifcase\value{gbcitelocalcase}%
- \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andincitecn}}{}%
- \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
- \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}%
- \iffieldequalstr{\userfieldabcde}{english}{\space\bibstring{andincite}\space}{}%
- \iffieldequalstr{\userfieldabcde}{french}{\space\bibstring{and}\space}{}%
- \iffieldequalstr{\userfieldabcde}{russian}{\space\bibstring{and}\space}{}%
-%\space%
- \or%
- \bibstring{andincitecn}%\space%
- \or%
-\space\bibstring{andincite}\space%
- \fi}
-
-\DeclareDelimFormat[bib,biblist]{finalnamedelim}{%
- \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
- \addspace%
- \edef\userfieldabcde{userd}%
- \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
- \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
- \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
- \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
- \ifcase\value{gbbiblocalcase}%
- \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}%
- \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
- \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}%
- \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}%
- \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}%
- \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}%
-\space%
- \or%
- \bibstring{andcn}\space%
- \or%
- \bibstring{and}\space%
- \fi}
-
-
-%
-% 重设title的输出
-%
-% 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen
-% 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件
-% 利用toggle做标识符是否输出的判断
-\renewbibmacro*{title}{%
- \ifboolexpr{%
- test{\iffieldundef{title}}%
- and
- test{\iffieldundef{subtitle}}%
- }%
- {}%
- {\printtext[title]{\bibtitlefont%增加字体控制命令
- \printfield[titlecase]{title}%
- \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
- {}{\setunit{\subtitlepunct}%
- \printfield[titlecase]{subtitle}}%
- \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
- {\setunit{\subtitlepunct}\printfield{titleaddon}}%
- \iftoggle{bbx:gbtype}{%
- \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准
- {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准
- {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸
- {\printfield[gbtypeflag]{usera}}}%其它
- }}{}%
- %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
- %\newunit
-}%
-}}
-
-%
-% 作者信息的输出格式
-%
-% 20180425,v1.0k,为作者增加字体控制命令,Hu Zhenzhen
-% 20180603,v1.0l,增加使用nameformat域来选择姓名格式
-\DeclareNameFormat{namefmtselected}{%
-\iffieldundef{namefmtid}{}%
-{\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}%
-\ifcase\value{gbnamefmtcase}%
- \ifgiveninits
- {\usebibmacro{name:gbuppercase}
- {\namepartfamily}
- {\namepartgiveni}
- {\namepartprefix}
- {\namepartsuffix}}
- {\usebibmacro{name:gbuppercase}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}}%
-\or
- \ifgiveninits
- {\usebibmacro{name:gblowercase}
- {\namepartfamily}
- {\namepartgiveni}
- {\namepartprefix}
- {\namepartsuffix}}
- {\usebibmacro{name:gblowercase}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}}%
-\or
- \ifgiveninits
- {\usebibmacro{name:given-family}
- {\namepartfamily}
- {\namepartgiveni}
- {\namepartprefix}
- {\namepartsuffix}}
- {\usebibmacro{name:given-family}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}}%
-\or
- \ifgiveninits
- {\usebibmacro{name:family-given}
- {\namepartfamily}
- {\namepartgiveni}
- {\namepartprefix}
- {\namepartsuffix}}
- {\usebibmacro{name:family-given}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}}%
-\or
-\usebibmacro{name:gbpinyin}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}%
-\or
- \ifnumequal{\value{listcount}}{1}
- {\ifgiveninits
- {\usebibmacro{name:family-given}
- {\namepartfamily}
- {\namepartgiveni}
- {\namepartprefix}
- {\namepartsuffix}}
- {\usebibmacro{name:family-given}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}}%
- \ifboolexpe{%
- test {\ifdefvoid\namepartgiven}
- and
- test {\ifdefvoid\namepartprefix}}
- {}
- {\usebibmacro{name:revsdelim}}}
- {\ifgiveninits
- {\usebibmacro{name:given-family}
- {\namepartfamily}
- {\namepartgiveni}
- {\namepartprefix}
- {\namepartsuffix}}
- {\usebibmacro{name:given-family}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}}}%
-\fi
- \usebibmacro{name:andothers}}
-
-\DeclareNameAlias{default}{namefmtselected}%姓名的默认格式采用可选的模式
-\DeclareNameAlias{sortname}{default}% Used in the bibliography %family-given/given-family
-\DeclareNameAlias{citename}{default}% Default used by \citename
-
-\DeclareDelimFormat[bib,biblist]{andothersdelim}{\addcomma\addspace}
-%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}%
-
-%GB/T 7714-2015 风格,全部大写
-\newbibmacro*{name:gbuppercase}[4]{\bibauthorfont%
-\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
-\renewcommand*{\revsdnamepunct}{}%
- \ifuseprefix%
- {\usebibmacro{name:delim}{#3#1}%
- \usebibmacro{name:hook}{#3#1}%
- \ifdefvoid{#3}{}{%
- \ifcapital%
- {\mkbibnameprefix{\MakeCapital{#3}}\isdot}%
- {\mkbibnameprefix{#3}\isdot}%
- \ifprefchar{}{\bibnamedelimc}}%
- \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
- \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号
- {\usebibmacro{name:delim}{#1}%
- \usebibmacro{name:hook}{#1}%
- \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
- \ifboolexpe{%
- test {\ifdefvoid{#2}}
- and
- test {\ifdefvoid{#3}}}
- {}{\revsdnamepunct}%
- \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
- \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号
-}
-
-%GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出
-\newbibmacro*{name:gblowercase}[4]{\bibauthorfont%
- \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
- \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
- \ifuseprefix
- {\usebibmacro{name:delim}{#3#1}%
- \usebibmacro{name:hook}{#3#1}%
- \ifdefvoid{#3}{}{%
- \ifcapital
- {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
- {\mkbibnameprefix{#3}\isdot}%
- \ifprefchar{}{\bibnamedelimc}}%
- \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot%
- \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号
- {\usebibmacro{name:delim}{#1}%
- \usebibmacro{name:hook}{#1}%
- \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot%
- \ifboolexpe{%
- test {\ifdefvoid{#2}}
- and
- test {\ifdefvoid{#3}}}
- {}{\revsdnamepunct}%
- \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}
- \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号
-}
-
-%中文常见风格,汉语拼音全拼模式
-\newbibmacro*{name:gbpinyin}[4]{\bibauthorfont%
-\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY
-\renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
-\renewrobustcmd*{\bibnamedelima}{\mbox{-}}%
- \ifuseprefix
- {\usebibmacro{name:delim}{#3#1}%
- \usebibmacro{name:hook}{#3#1}%
- \ifdefvoid{#3}{}{%
- \ifcapital
- {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
- {\mkbibnameprefix{#3}\isdot}%
- \ifprefchar{}{\bibnamedelimc}}%
- \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
- \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamegiven{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}
- {\usebibmacro{name:delim}{#1}%
- \usebibmacro{name:hook}{#1}%
- \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
- \ifboolexpe{%
- test {\ifdefvoid{#2}}
- and
- test {\ifdefvoid{#3}}}
- {}
- {\revsdnamepunct}%
- \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeCapital{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}
- \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%
-}
-
-
-\@ifpackagelater{biblatex}{2016/03/27}%biblatex<3.2版的情况
- {}{
- %GB/T 7714-2015 风格,全部大写
- \renewbibmacro*{name:gbuppercase}[4]{\bibauthorfont%
- \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
- \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
- \ifuseprefix
- {\usebibmacro{name:delim}{#3#1}%
- \usebibmacro{name:hook}{#3#1}%
- \ifblank{#3}{}{%
- \ifcapital
- {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
- {\mkbibnameprefix{#3}\isdot}%
- \ifpunctmark{'}{}{\bibnamedelimc}}%
- %\mkbibnamelast{#1}\isdot
- \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase
- %注意上一句\MakeCapital后面如果再跟一个{}包含#1,则没有效果,可能是包在里面少了一层展开
- %因为机构名通常包括在{}内,所以要多展开一次才行,所以这里去掉#1外面的{}
- %\mkbibnamelast{\MakeUppercase{#1}}\isdot
- %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面
- \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}%
- \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}}%后缀前加逗号
- {\usebibmacro{name:delim}{#1}%
- \usebibmacro{name:hook}{#1}%
- %\mkbibnamelast{#1}\isdot %3.9.1 Generic Commands and Hooks,对姓重新处理,如下句: %\mkbibnamelast{\MakeUppercase{#1}}
- \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase
- %\mkbibnamelast{\MakeUppercase{#1}}\isdot
- %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面
- \ifblank{#2#3}{}{\revsdnamepunct}%
- \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}%
- \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
- \addcomma\addspace%
- \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}%%后缀前加逗号
- }%
- }
-
- %GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出
- \renewbibmacro*{name:gblowercase}[4]{\bibauthorfont%
- \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
- \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
- \ifuseprefix
- {\usebibmacro{name:delim}{#3#1}%
- \usebibmacro{name:hook}{#3#1}%
- \ifblank{#3}{}{%
- \ifcapital
- {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
- {\mkbibnameprefix{#3}\isdot}%
- \ifpunctmark{'}{}{\bibnamedelimc}}%
- \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase
- \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{{#2}}\isdot}%
- \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}}%后缀前加逗号
- {\usebibmacro{name:delim}{#1}%
- \usebibmacro{name:hook}{#1}%
- \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase
- \ifblank{#2#3}{}{\revsdnamepunct}%
- \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{{#2}}\isdot}%
- \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
- \addcomma\addspace%
- \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}%%后缀前加逗号
- }%
- }
-
- %中文常见风格,汉语拼音全拼模式
- \renewbibmacro*{name:gbpinyin}[4]{\bibauthorfont%
- \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
- \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
- \renewrobustcmd*{\bibnamedelima}{\mbox{-}}%
- \ifuseprefix
- {\usebibmacro{name:delim}{#3#1}%
- \usebibmacro{name:hook}{#3#1}%
- \ifblank{#3}{}{%
- \ifcapital
- {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
- {\mkbibnameprefix{#3}\isdot}%
- \ifpunctmark{'}{}{\bibnamedelimc}}%
- \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase
- \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamefirst{#2}}\isdot}%
- \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}}
- {\usebibmacro{name:delim}{#1}%
- \usebibmacro{name:hook}{#1}%
- \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase
- \ifblank{#2#3}{}{\revsdnamepunct}%
- \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}%
- \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
- \addcomma\addspace%
- \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}%
- }%
- }
-
- %%biblatex<3.2版的情况,姓名的处理格式带参数
- \DeclareNameFormat{namefmtselected}{%
- \iffieldundef{namefmtid}{}%
- {\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}%
- \ifcase\value{gbnamefmtcase}%
- \iffirstinits
- {\usebibmacro{name:gbuppercase}{#1}{#4}{#5}{#7}}
- {\usebibmacro{name:gbuppercase}{#1}{#3}{#5}{#7}}%
- \or
- \iffirstinits
- {\usebibmacro{name:gblowercase}{#1}{#4}{#5}{#7}}
- {\usebibmacro{name:gblowercase}{#1}{#3}{#5}{#7}}%
- \or
- \iffirstinits
- {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}}
- {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}%
- \ifblank{#3#5}
- {}
- {\usebibmacro{name:revsdelim}}%
- \or
- \iffirstinits
- {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}}
- {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}%
- \or
- \usebibmacro{name:gbpinyin}{#1}{#3}{#5}{#7}%
- \or
- \ifnumequal{\value{listcount}}{1}
- {\iffirstinits
- {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}}
- {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}%
- \ifblank{#3#5}
- {}
- {\usebibmacro{name:revsdelim}}}
- {\iffirstinits
- {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}}
- {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}}%
- \fi
- \usebibmacro{name:andothers}}
-}
-
-%
-% url和url日期格式
-%
-\renewbibmacro*{url+urldate}{%
- %\usebibmacro{url}%%更换url的位置,放到下面
- \iffieldundef{urlyear}%
- {}{%\setunit*{\addspace}%
- \usebibmacro{urldate}}%
- \setunit{\addperiod\addspace}%
- \usebibmacro{url}}
-\renewbibmacro*{url}{\printfield{url}}
-
-
-
-
-%
-% 日期信息的输出格式,针对biblatex<3.7版本
-%
-\defversion{3.4}{date}{
- \renewbibmacro*{urldate}{%
- \addthinspace\printtext{[}\printfield{urlyear}%
- \iffieldundef{urlmonth}{}{\bibrangedash\printfield{urlmonth}}%
- \iffieldundef{urlday}{}{\bibrangedash\printfield{urlday}}\printtext{]}}
-
- \newbibmacro*{newsdate}{%%新增加一个公告日期,公开日期或新闻日期
- \iffieldundef{year}{}{\printfield{year}%
- \iffieldundef{month}{}{\bibrangedash\printtext{\thefield{month}}%
- \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}%
- }
-
- \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式
- \ifboolexpr{%
- test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
- }%
- {}%更新或修改日期通常有day信息
- {\iffieldequalstr{year}{}{%替换\iffieldundef{year},因为year总是存在,但为空
- \iffieldundef{endyear}{%
- \iffieldundef{eventyear}{}{\printtext{\mkbibparens{\printtext{\printfield{eventyear}}%
- \iffieldundef{eventmonth}{}{\bibrangedash\thefield{eventmonth}}%
- \iffieldundef{eventday}{}{\bibrangedash\printfield{eventday}}}}%
- }%
- }{%
- \iffieldundef{endyear}{}{\printtext{\mkbibparens{\printtext{\printfield{endyear}}%
- \iffieldundef{endmonth}{}{\bibrangedash\thefield{endmonth}}%
- \iffieldundef{endday}{}{\bibrangedash\printfield{endday}}}}%
- }%
- }%
- }%
- {%
- \iffieldundef{year}{}{\printtext{\mkbibparens{\printtext{\printfield{year}}%
- \iffieldundef{month}{}{\bibrangedash\thefield{month}}%
- \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}%
- }%
- }%
- }}%
-}
-
-%
-% 日期信息的输出格式,针对3.9>=biblatex>=3.7版本
-%
-\defversion{3.7}{date}{
- \DeclareFieldFormat{urldate}{##1}
- \renewbibmacro*{urldate}{%
- \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx at edtfdate这种更底层的命令
-
- %
- % 专利的公告日期、或报纸的日期的输出宏
- % 20160701,v1.0,新增加
- % 20180405,v1.0k,为biblatexv3.7-3.9版本,出现多出点bug做处理,Hu Zhenzhen
- %
- % 原理方法:加上printtext避免破坏异步标点机制
- %
- \newbibmacro*{newsdate}{%
- \printtext{\blx at edtfdate{}{}}%
- }
-
- \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式
- \ifboolexpr{%
- test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
- }%
- {}%更新或修改日期通常有day信息
- {\iffieldundef{year}{%
- \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}%
- {\printtext{(}\printenddate\printtext{)}}%
- }{\iffieldequalstr{year}{}{%因为year存在,但为空
- }{\printtext{(}\blx at edtfdate{}{}\printtext{)}}%
- }%
- }}%
-}
-
-%
-% 日期信息的输出格式,针对biblatex>=3.10版本
-%
-\defversion{3.10}{date}{
- \DeclareFieldFormat{urldate}{##1}
- \renewbibmacro*{urldate}{%
- \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx at edtfdate这种更底层的命令
-
- %
- % 专利的公告日期、或报纸的日期的输出宏
- % 20160701,v1.0,新增加
- % 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen
- %
- % 原理方法:加上printtext避免破坏异步标点机制
- % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份
- % 所以无法再用选项设置的方法,印象需要用底层的命令
- % 这里可以用\blx at isodate,但用\blx at gbdate试图避免版本判断
- \newbibmacro*{newsdate}{%%
- \printtext{\blx at gbdate{}{}}%%\blx at isodate{}{}%
- }
-
- %
- \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式
- \ifboolexpr{%
- test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
- }%
- {}%更新或修改日期通常有day信息
- {\iffieldundef{year}{%
- \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}%
- {\printtext{(}\printenddate\printtext{)}}%
- }{\iffieldequalstr{year}{}{%因为year存在,但为空
- }{\printtext{(}\blx at gbdate{}{}\printtext{)}}%
- }%
- }}%
-}
-
-%
-% biblatex>v3.8版利用related实现双语文献的处理
-%
-\defversion{3.8}{dblang}{
- %为了实现v3.8以上版本的双语文献,采用related的方法代替set方法,因为set方法已经无法实现了,
- %因为set不再复制其第一个成员的信息。于是定义一个命令,用于动态的修改数据,即添加related域的信息
- %其中使用了\DeclareStyleSourcemap,但由于其只能出现在导言区中,因此\defdoublelangentry命令也只能出现在导言区中
- \newcommand{\defdoublelangentry}[2]{%
- \edef\entrykeya{##1}
- \edef\entrykeyb{##2}
- \DeclareStyleSourcemap{
- \maps[datatype=bibtex]{
- \map{
- \step[fieldsource=entrykey, match=\entrykeya, final]
- \step[fieldset=related, fieldvalue=\entrykeyb]
- }
- }
- }
- }
-}
-
-%
-% 关联文献间的分隔符
-%
-\renewcommand{\relateddelim}{\adddot\newline\nobreak}%\par,而作者年样式不需要修改,因为没有项对齐的标签问题
-
-%
-% 关联文献的输出格式,针对3.9>=biblatex>=3.7版本
-%
-% 原理方法:因为related宏中带有##了,所以无法封装到defversion中了。所以直接做判断
-% 下面这一段主要针对v3.8-3.10,因为我提问后,biblatex作者为3.11版增加了一个钩子控制relatedblock前的分隔符。
-\ifboolexpr{
-test{\iftoggle{iftleight}}
-or
-test{\iftoggle{iftlnine}}
-}{\renewbibmacro*{related}{%standard.bbx
- \ifboolexpr{ test {\iffieldundef{related}} or test {\ifrelatedloop} }
- {}
- {\usebibmacro{begrelated}%
- \def\bbx at tempa{}%
- \setcounter{bbx:relatedtotal}{0}%
- \def\do##1{%
- \entrydata{##1}{%
- \ifrelatedloop
- {}
- {\stepcounter{bbx:relatedtotal}%
- \gappto{\bbx at tempa}{##1,}}}}%
- \docsvfield{related}%
- \restorefield{related}{\bbx at tempa}%
- \ifnumgreater{\value{bbx:relatedtotal}}{0}
- {\listcsxadd{bbx:relatedloop}{\strfield{entrykey}}%
- \iffieldundef{clonesourcekey}
- {}
- {\listcsxadd{bbx:relatedloop}{\strfield{clonesourcekey}}}%
- \setcounter{bbx:relatedcount}{0}%
- \def\do{%
- \stepcounter{bbx:relatedcount}%
- \ifnumgreater{\value{bbx:relatedcount}}{0}%这里从1改为0
- {\ifcsundef{relateddelim\strfield{relatedtype}}
- {\printtext{\relateddelim}}
- {\printtext{\csuse{relateddelim\strfield{relatedtype}}}}}
- {}}%
- \ifbibmacroundef{related:\strfield{relatedtype}}
- {\appto{\do}{\usebibmacro{related:default}}}
- {\appto{\do}{\usebibmacro*{related:\strfield{relatedtype}}}}%
- \iffieldformatundef{related:\strfield{relatedtype}}
- {\def\bbx at tempa{related}}
- {\def\bbx at tempa{related:\strfield{relatedtype}}}%
- \iffieldformatundef{relatedstring:\strfield{relatedtype}}
- {\def\bbx at tempb{relatedstring:default}}
- {\def\bbx at tempb{relatedstring:\strfield{relatedtype}}}%
- \printtext[\bbx at tempa]{%
- \usebibmacro{begrelatedloop}%
- \iffieldundef{relatedstring}
- {\ifboolexpr{
- test {\ifnumgreater{\value{bbx:relatedtotal}}{1}}
- and
- test {\ifbibxstring{\thefield{relatedtype}s}}
- }
- {\printtext[\bbx at tempb]{%
- \bibstring[\mkrelatedstring]{\thefield{relatedtype}s}}}
- {\iffieldbibstring{relatedtype}
- {\printtext[\bbx at tempb]{%
- \bibstring[\mkrelatedstring]{\thefield{relatedtype}}}}
- {}}}
- {\iffieldbibstring{relatedstring}
- {\printtext[\bbx at tempb]{%
- \bibstring[\mkrelatedstring]{\thefield{relatedstring}}}}
- {\printfield[\bbx at tempb]{relatedstring}}}%
- \docsvfield{related}%
- \usebibmacro{endrelatedloop}}}%
- {}%
- \usebibmacro{endrelated}}}
-}{}
-
-%
-% 关联文献块前的分隔符,针对biblatex>3.11
-%
-% 原理方法:因为增加了begrelateddelim钩子,所以不需要重定义related输出宏
-\defversion{3.11}{related}{
-\renewcommand{\begrelateddelim}{\adddot\newline\nobreak}
-}
-
-\iftoggle{iftlfive}{\switchversion{3.4}{date}}{}%biblatex<=3.2
-\iftoggle{iftlsix}{\switchversion{3.4}{date}}{}%3.3<=biblatex<=3.6
-\iftoggle{iftlseven}{\switchversion{3.7}{date}}{}%biblatex=3.7
-\iftoggle{iftleight}{\switchversion{3.7}{date}\switchversion{3.8}{dblang}}{}%3.8<=biblatex<=3.9
-\iftoggle{iftlnine}{\switchversion{3.10}{date}\switchversion{3.8}{dblang}}{}%biblatex=3.10
-\iftoggle{iftlatest}{\switchversion{3.10}{date}\switchversion{3.8}{dblang}\switchversion{3.11}{related}}{}%biblatex最新3.11
-
-%
-% 调整doi+eprint+url格式
-% 2016.07.01 byhzz
-% 2019.05.01 byhzz 在eprint前增加一个空格
-% 原理方法:源来自standard.bbx,因为页码后面直接跟引用日期,没有标点所以去掉其中的标点。
-\renewbibmacro*{doi+eprint+url}{%
-% \iftoggle{bbx:doi}%把doi的位置放到url后面
-% {\printfield{doi}}
-% {}%
- %\newunit\newblock
- \iftoggle{bbx:eprint}
- {\iffieldundef{eprint}{}{\newunit\usebibmacro{eprint}}}
- {}%
- %\newunit\newblock
- \iftoggle{bbx:url}
- {\usebibmacro{url+urldate}}
- {}
- \newunit\newblock
- \iftoggle{bbx:doi}
- {\printfield{doi}}
- {}}
-
-%
-% 调整页码的格式,即chapter+pages格式
-%
-\renewbibmacro*{chapter+pages}{%
-\iftoggle{bbx:gbstrict}{}{%
- \printfield{chapter}}%
- \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出
- \setunit{\bibpagespunct}%
- \printfield{pages}}%
- %\newunit %这里的标点去掉
-}
-
-%
-% 当location等出版项超过maxitem缩减后不再输出etal
-%
-\DeclareListFormat{location}{%
- \usebibmacro{list:delim}{#1}%
- #1\isdot}
-\DeclareListAlias{institution}{location}
-\DeclareListAlias{publisher}{location}
-
-% 新增一个样式用于输出连续出版物的地址,单位,时间,
-% 用于periodical连续出版物的出版社和地址的处理
-%
-% v1.0k,20180425,为出版信息增加字体控制命令,hzz
-% %类似\newbibmacro*{publisher+location+date}
-\newbibmacro*{location+institution+date}{\bibpubfont%
-\iftoggle{bbx:gbpub}%
-{\testCJKfirst{userd}%
-\ifboolexpr{%
-test {\iflistundef{location}} and test {\iflistundef{institution}}%
-}{\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress}\space :\space\str at nopublisher]}%
-{\printtext{[S.l.\space :\space s.n.\adddot]}}%
-}{%
-\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress]}}{\printtext{[S.l.\adddot]}}}%
- {\printlist{location}}%
-\addcolon\addspace%
-\iflistundef{institution}{%
-\iftoggle{ifCJKforgbt}{\printtext{[\str at nopublisher]}}{\printtext{\mkbibbrackets{s.n.}}}}%
-{\printlist{institution}}}%
-\setunit{\addcomma\addspace}%
- %\usebibmacro{date}%
- \printfield{year}%
- \bibrangedash%
- \iffieldundef{endyear}{}{\printfield{endyear}}%
- \newunit}%
-{\printlist{location}%
- \iflistundef{institution}%
- {\setunit*{\addcomma\space}}
- {\setunit*{\addcolon\space}}%
- \printlist{institution}%
- \setunit*{\addcomma\space}%
- \usebibmacro{date}%
- \newunit}%
-}
-%
-% 通用的出版社和地址的处理
-%
-% 原理方法:当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。
-% 事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。
-% 注意标准standard类型,因为当没有出版项时直接省略,所以做特殊处理
-\renewbibmacro*{publisher+location+date}{\bibpubfont%
-\iftoggle{bbx:gbpub}%
-{\testCJKfirst{userd}%
- \ifboolexpr{ test {\iflistundef{location}} and test {\iflistundef{publisher}} }%
- {\iffieldequalstr{note}{standard}{}{\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress}\space :\space\str at nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}%
- {\iflistundef{location}{%\adddot
- \iffieldequalstr{note}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。
- {\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}}}% \bibstring{noaddress}
- {\printlist{location}\addcolon\addspace}%%\addcolon\addspace%
- \iflistundef{publisher}{%
- \iffieldequalstr{note}{standard}{}%
- {\iftoggle{ifCJKforgbt}{\printtext{[\str at nopublisher]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}%
- {\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}}}%
- {\printlist{publisher}}}%
-\setunit*{\addcomma\addspace}%\addcomma\addspace%
-\usebibmacro{date}%%\newunit %去掉这个标点
-}%
-{\printlist{location}%
- \iflistundef{publisher}
- {\setunit*{\addcomma\space}}
- {\setunit*{\addcolon\space}}%
- \printlist{publisher}%
- \setunit*{\addcomma\space}%
- \usebibmacro{date}%%\newunit
- }%
-}
-
-%
-% 修改了一个institution+location+date用于manual、report、thesis等类型
-%
-% 20180425,v1.0k,增加了字体控制命令,hzz
-% 20190105,v1.0o,加了一个编组避免\usebibmacro{date}把month和day信息去掉
-\renewbibmacro*{institution+location+date}{\bibpubfont%当没有institution时不处理。
-{\printlist{location}%%加了一个编组避免\usebibmacro{date}把month和day信息去掉
- \iflistundef{institution}
- {\setunit*{\addcomma\space}}
- {\setunit*{\addcolon\space}}%
- \printlist{institution}%
- \setunit*{\addcomma\space}%
- \usebibmacro{date}%
- %\newunit
- }}
-
-%
-% 对volume卷信息格式做出修改
-% v1.0o,20190105,hzz
-%
-\DeclareFieldFormat{volume}{%
-\testCJKfirst{userd}%
-\iftoggle{ifCJKforgbt}%
-{\bibstring{serialcn}#1\bibstring{volumecn}}%
-{\bibstring{volume}~#1}%
-}% volume of a book
-\DeclareFieldFormat[article,periodical]{volume}{#1}% volume of a journal
-
-%
-% 对number册信息格式做出修改
-% v1.0o,20190105,hzz
-%
-\DeclareFieldFormat{number}{#1}%
-\DeclareFieldFormat[book,collection,inbook,%
-incollection,proceedings,inproceedings]{number}{%
-\testCJKfirst{userd}%
-\iftoggle{ifCJKforgbt}%
-{\bibstring{serialcn}#1\bibstring{numbercn}}%
-{#1}%
-}%
-
-%
-% 对edition版本信息格式做出修改
-%
-\DeclareFieldFormat{edition}{\bibtitlefont%源来自biblatex.DEF
-\testCJKfirst{userd}%
-\iftoggle{ifCJKforgbt}%
-{\ifinteger{#1}%
-{\printtext{#1\str at edition}}%
-{#1\isdot}}%
-{\ifinteger{#1}%
-{\mkbibordedition{#1}~\bibstring{edition}}%
-{#1\isdot}}}
-
-%
-% 对version的版本信息做出修改
-%
-\DeclareFieldFormat{version}{\bibtitlefont%源来自biblatex.DEF
-\testCJKfirst{userd}%
-\ifinteger{#1}%
-{\iftoggle{ifCJKforgbt}{\printtext{#1\str at edition}}%
-{\mkbibordedition{#1}~\bibstring{version}}}%
-{#1\isdot}}
-
-%
-% 修改析出文献的文集的标题与附加标题间的符号
-%
-\renewbibmacro*{booktitle}{%
- \ifboolexpr{
- test {\iffieldundef{booktitle}}
- and
- test {\iffieldundef{booksubtitle}}
- }
- {}
- {\printtext[booktitle]{\bibtitlefont%
- \printfield[titlecase]{booktitle}%
- \setunit{\subtitlepunct}%
- \printfield[titlecase]{booksubtitle}}%
- \newunit%标点换成下一句
- \setunit{\subtitlepunct}}%
- \printfield{booktitleaddon}}
-
-
-%
-% 调整期刊名的格式
-%
-% v1.0k,20180425,增加了字体控制命令,hzz
-\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx
- \usebibmacro{journal}%
- %\setunit*{\addspace}%
- \setunit*{\addcomma\addspace}%修改为增加一个逗号
- \iffieldundef{series}
- {}
- {\newunit
- \printfield{series}%
- \setunit{\addspace}}%
- %\usebibmacro{volume+number+eid}%
- %\setunit{\addspace}%
- \usebibmacro{issue+date}%
- %\setunit{\addcolon\space}%
- \iffieldundef{volume}{}{\setunit{\addcomma\space}}%
- %换成逗号和空格
- \usebibmacro{issue}%
- \usebibmacro{volume+number+eid}%把卷期放到年份后面
- %\newunit
- }
-
-
-
-%
-% 调整期刊卷和期的格式
-%
-\renewbibmacro*{volume+number+eid}{%源来自standard.bbx
-\iftoggle{bbx:gbfieldstd}{%
- \printfield{volume}%
- \setunit*{\adddot}%
- \printfield{number}%
- \setunit{\addcomma\space}%
- \printfield{eid}}{%
- \printfield{volume}%
- %\setunit*{\adddot}%去掉点号
- %\printfield{number}%
- \iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号
- \iffieldundef{eid}{}{%
- \setunit{\addcomma\space}%
- \printfield{eid}}}}
-
-%
-% 调整期刊年份的格式
-%
-\renewbibmacro*{issue+date}{%去掉括号
- \printtext{%去掉了[parens]
- \iffieldundef{issue}
- {%\usebibmacro{date}
- \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸
- {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸
- {\usebibmacro{date}}%
- }}%
- {\iftoggle{bbx:gbstrict}{}{\printfield{issue}%
- \setunit*{\addspace}}%
- %\usebibmacro{date}
- \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸
- {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸
- {\usebibmacro{date}}%
- }}}%
- %\newunit
- }
-
-%
-% 调整页码前的标点和去掉期刊文章等页码后面的标点
-%
-\renewbibmacro*{note+pages}{%源来自standard.bbx
- %\printfield{note}%不要note,note用来判断是否是报纸newspaper
- \iffieldundef{pages}{}{
- \setunit{\bibpagespunct}%
- \printfield{pages}}%
- %\newunit
- }
-
-
-%
-% 编者的符号修改一下
-% v1.0 2016-07-01
-% v1.0q 2019-03-01 hzz 修改editortype前的标点
-%
-\renewbibmacro*{editor}{%源来自biblatex.DEF
- \ifboolexpr{
- test \ifuseeditor
- and
- not test {\ifnameundef{editor}}
- }
- {\printnames{editor}%
- \iffieldundef{editortype}%增加一个类型判断,用于存在editortype的情况
- {\setunit\addspace}%当没有editortype时,直接用句点
- {%\setunit{\addcomma\space}%
- \usebibmacro{editorstrg}}%
- %\clearname{editor}
- }%
- {}}
-
-%
-% 编者类型做一修改
-% v1.0 2016-07-01
-% v1.0q 2019-03-01 hzz 修改editortype不同语言的不同本地化字符串
-%
-\renewbibmacro*{editorstrg}{%源来自biblatex.DEF
- \printtext[editortype]{%
- \iffieldundef{editortype}
- {%
-% \ifboolexpr{ %这一段去掉,未定义编者类型情况下不处理
-% test {\ifnumgreater{\value{editor}}{1}}
-% or
-% test {\ifandothers{editor}}
-% }
-% {\bibstring{editors}}
-% {\bibstring{editor}}
- }
- {\ifbibxstring{\thefield{editortype}} %定义编者类型情况下处理,以后根据需要修改
- {\ifboolexpr{
- test {\ifnumgreater{\value{editor}}{1}}
- or
- test {\ifandothers{editor}}
- }
- {\printdelim{streditortypes}}
- {\printdelim{streditortype}}}
- {\thefield{editortype}}}%
- }}
-
-%
-% 编者类型的本地化字符串输出
-% v1.0q 2019-03-01 hzz
-% 能对不同条目类型作格式设置的域格式,能对不同环境做格式设置的分隔符
-% 能对不同文境作设置的包括排序,标签等
-% 这里因为考虑可能标注和文献表中存在不同,所以用分隔符来输出本地化字符串
-%
-\DeclareDelimFormat{streditortypes}{%
- \edef\userfieldabcde{userd}%
- \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
- \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
- \ifcase\value{gbbiblocalcase}%
- \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}scn}}{}%
- \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}skr}}{}%
- \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}sjp}}{}%
- \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}%
- \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}%
- \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}%
- \or%
- \bibstring{\thefield{editortype}scn}%
- \or%
- \addcomma\addthinspace\bibstring{\thefield{editortype}s}%
- \fi}
-%
-\DeclareDelimFormat{streditortype}{%
- \edef\userfieldabcde{userd}%
- \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
- \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
- \ifcase\value{gbbiblocalcase}%
- \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}cn}}{}%
- \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}kr}}{}%
- \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}jp}}{}%
- \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}%
- \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}%
- \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}%
- \or%
- \bibstring{\thefield{editortype}cn}%
- \or%
- \addcomma\addthinspace\bibstring{\thefield{editortype}}%
- \fi}
-
-
-%
-% bookauthor域的输出,
-% v1.0q 2019-03-01 hzz
-% 不再对editor和bookauthor做sourcemap,而是下面的宏内逻辑代替,
-% 使得除使用bookauthor外也可以使用editor,便于在使用editor时使用editortype
-\renewbibmacro*{bybookauthor}{%
- \ifnameundef{bookauthor}%
- {\ifnameundef{editor}%
- {}%
- {\ifnamesequal{author}{editor}%
- {}{\usebibmacro{editor}}}%
- }%
- {\ifnamesequal{author}{bookauthor}%
- {}{\printnames{bookauthor}}%
- }%
-}
-
-%
-% 修改期刊的标题
-%
-\renewbibmacro*{periodical}{%源来自biblatex.DEF
- \iffieldundef{title}
- {}
- {\printtext[title]{\bibtitlefont%
- \printfield[titlecase]{title}%
- %\setunit{\subtitlepunct}%
- \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
- {}{\setunit{\subtitlepunct}
- \printfield[titlecase]{subtitle}}%
- %}%把编组结束移到后面去
- \iftoggle{bbx:gbtype}{%
- \iffieldundef{usera}{}{%在标题后直接给出文献标识字母
- \printfield[gbtypeflag]{usera}}}{}
- }}
- }
-
-%
-% 期刊的标题做修改
-%
-\renewbibmacro*{title+issuetitle}{%源来自standard.BBX
- \usebibmacro{periodical}%
- %\setunit*{\addspace}%
- \setunit*{\adddot\addspace}%标点修改为句点
- \iffieldundef{series}
- {}
- {\newunit
- \printfield{series}%
- \setunit{\addspace}}%
- \usebibmacro{periodical+issue}%将issue调整到上面来,并修改
-\iffieldundef{number}{}{%%进一步处理有范围的数字
- \multinumberparser{\thefield{number}}}%
- \iffieldundef{volume}%
- {\printfield{year}%
- \printtext{\mkbibparens{\multinumberfirst}}%
- \bibrangedash%
- \iffieldundef{endyear}{}{\printfield{endyear}\printtext{\mkbibparens{\multinumbersecond}}}%
- }%
- {\multivolparser{\thefield{volume}}%
- \printfield{year}%
- \setunit{\addcomma\space}%将冒号修改为逗号
- \printtext{\multivolfirst}%
- \printtext{\mkbibparens{\multinumberfirst}}%
- \bibrangedash%
- \iffieldundef{endyear}{}{%
- \printfield{endyear}%
- \setunit{\addcomma\space}%将冒号修改为逗号
- \printtext{\multivolsecond}%
- \printtext{\mkbibparens{\multinumbersecond}}}%
- }%
- \setunit{\addcomma\space}%
- \printfield{eid}%
- \setunit{\addspace}%
- %\usebibmacro{issue+date}%
- %\setunit{\addcolon\space}%
- \usebibmacro{issue}%
- \newunit}
-
-%
-% 新增一个样式用于调整期刊年份的格式,只打印年份
-%
-\newbibmacro*{periodical+issue}{%
- \printtext{%去掉了[parens]
- \iffieldundef{issue}
- {%\usebibmacro{date}%修改为下一句
- }%
- {\printfield{issue}%
- \setunit*{\addspace}%
- %\usebibmacro{date}%修改为下一句
- }%
- }%
- %\newunit
-}
-
-%
-% 重设专利title的输出,将文献类型标识符输出出去
-%
-\newbibmacro*{patenttitle}{%原输出来自biblatex.def文件
- \ifboolexpr{%
- test{\iffieldundef{title}}%
- and%
- test{\iffieldundef{subtitle}}%
- }%
- {}%
- {\printtext[title]{\bibtitlefont%
- \printfield[titlecase]{title}%
- \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
- {}{\setunit{\subtitlepunct}%
- \printfield[titlecase]{subtitle}}%
- \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
- {\setunit{\subtitlepunct}\printfield{titleaddon}}%
- \setunit{\subtitlepunct}\printfield{number}%写专利号
- \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}%
- %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
- %\newunit
- }%
-}%
-}
-
-
-
-%
-% 修改in:用于inbook、incollection、inproceedings等类型
-% 2018.04.20,v1.0k,renewed marco,by hzz
-% 20190212,v1.0q,增加中英文区分,by hzz
-%
-% 原理方法:使用bibmacro{in:}改变了以前在driver中直接输出//的方式,同时也简化了标点控制。
-\renewbibmacro*{in:}{%
- \iftoggle{bbx:gbpunctin}{\printtext{\texttt{//}\allowbreak}}%\addthinspace
- {\setunit{\adddot\addspace}%
- \iffieldequalstr{userd}{chinese}%
- {\printtext{\bibstring{incn}}}%
- {\printtext{\bibstring{in}}}%
- }}%\newunit\newblock\intitlepunct
-
-%
-% 修改type域的输出格式
-% 2019.02.12,v1.0q,byhzz
-% 使其可以区分中英文输出不同的格式,比如博士论文英文输出PHD thesis,中文则是博士学位论文
-\DeclareFieldFormat{type}%
-{\iffieldequalstr{userd}{chinese}%
- {\ifbibxstring{#1cn}{\bibxstring{#1cn}}{#1}}%
- {\ifbibstring{#1}{\bibstring{#1}}{#1}}%
-}
-
-%
-% 修改series域的输出格式
-% 2019.05.01,v1.0r,byhzz
-\renewbibmacro*{series+number}{%
- \printfield{series}%
- %\setunit*{\addspace}%
- %\printfield{number}%
- %\newunit
- }
-
-%=====================================================================
-%设置驱动格式
-%=====================================================================
-%
-% book条目类的驱动
-%
- \DeclareBibliographyDriver{book}{%源来自standard.bbx文件
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
-\usebibmacro{author/editor+others/translator+others}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
-\usebibmacro{maintitle+title}%
-\iftoggle{bbx:gbstrict}{}{%
-\newunit
-\printlist{language}%
-\newunit\newblock%
-\usebibmacro{byauthor}%
-\newunit\newblock}%
-\usebibmacro{byeditor+others}%
-\newunit
-\printfield{edition}%
-\newunit\newblock%%
-\iftoggle{bbx:gbstrict}{}{%
-\iffieldundef{maintitle}%
-{\printfield{volume}%
-\printfield{part}}%
-{}%
-\newunit%
-\printfield{volumes}%
-\newunit\newblock%
-\usebibmacro{series+number}}%
-\newunit\newblock%
-%\printfield{note}%
-%\newunit\newblock%
-\usebibmacro{publisher+location+date}%
-%\newunit\newblock %这里标点去掉
-\usebibmacro{chapter+pages}%
- \iffieldundef{url}{}{%当没有网址时也不输出
- \usebibmacro{modifydate}}%带括号的修改或更新日期,
-\usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。
- \newunit\newblock%
- \printfield{pagetotal}%
- \newunit\newblock%
- \iftoggle{bbx:isbn}
- {\printfield{isbn}}
- {}%
- \newunit\newblock
- %\usebibmacro{doi+eprint+url}%
- %\newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-
-%
-% 期刊文章,连续出版物中的析出文献的格式
-%
- \DeclareBibliographyDriver{article}{%
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author/translator+others}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
- \usebibmacro{title}%
- \iftoggle{bbx:gbstrict}{}{%
- \newunit%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}%
- \newunit\newblock
- \usebibmacro{bytranslator+others}%
- \newunit\newblock
- \printfield{version}}%
- \newunit\newblock
- %\usebibmacro{in:}% 不使用in来表示期刊等连续出版物
- \usebibmacro{journal+issuetitle}%
- %\newunit
-% \usebibmacro{byeditor+others}%
-% \newunit
- \usebibmacro{note+pages}%
- \iffieldequalstr{note}{news}{}{%当是新闻时不输出修改或更新日期
- \iffieldundef{url}{}{%当没有网址时也不输出
- \iftoggle{bbx:url}{%当url选项为false时,也不输出
- \usebibmacro{modifydate}}{}}}%带括号的修改或更新日期,
- \usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置
- \newunit\newblock
- \iftoggle{bbx:isbn}
- {\printfield{issn}}
- {}%
- \newunit\newblock
- %\usebibmacro{doi+eprint+url}%
- %\newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-
-
-%
-% 连续出版物的驱动
-%
- \DeclareBibliographyDriver{periodical}{%源来自standard.BBX
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{editor}%
- %\setunit{\labelnamepunct}\newblock
- \newunit\newblock %删除上面一行,添加这一行
- \usebibmacro{title+issuetitle}%
- \newunit\newblock%
- \usebibmacro{location+institution+date}%添加这一行用于输出地址,单位和时间
- \newunit\newblock%添加这一行
- \iftoggle{bbx:gbstrict}{}{%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byeditor}%
- \newunit\newblock
- \printfield{note}%
- \newunit\newblock}
- \iftoggle{bbx:isbn}
- {\printfield{issn}}
- {}%
- \newunit\newblock
- \usebibmacro{doi+eprint+url}%
- \newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-%
-% 专利文献驱动
-%
- \DeclareBibliographyDriver{patent}{%源来自standard.BBX
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
- %\usebibmacro{title}%
- \usebibmacro{patenttitle}%给出专利专用的标题输出
- \iftoggle{bbx:gbstrict}{}{%
- \newunit%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}}%
- \newunit\newblock
- \printfield{type}%
- \setunit*{\addspace}%
- %\printfield{number}%已放到patenttitle中处理
- \iflistundef{location}
- {}
- {\setunit*{\addspace}%
- \printtext{%[parens]
- \printlist[][-\value{listtotal}]{location}}}%
- \newunit\newblock
- \usebibmacro{byholder}%
- \newunit\newblock
- \printfield{note}%
- \newunit\newblock
- \usebibmacro{newsdate}%
- %\newunit\newblock
- \usebibmacro{doi+eprint+url}%
- \newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-
-%
-% 在线文献驱动
-%
-\DeclareBibliographyDriver{online}{%源来自standard.BBX
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author/editor+others/translator+others}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
- \usebibmacro{title}%
- \iftoggle{bbx:gbstrict}{}{%
- \newunit%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}%
- \newunit\newblock
- \usebibmacro{byeditor+others}%
- \newunit\newblock
- \printfield{note}}%
- \newunit
- \printfield{version}%
- \newunit\newblock
- %\printlist{organization}%
- \printlist{institution}%
- \newunit\newblock
-\ifboolexpr{%
-test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
-}{\usebibmacro{date}}%
-{\usebibmacro{modifydate}}%修改或更新日期,为带括号的时间
- \usebibmacro{url+urldate}%从下面移上来
- \newunit\newblock
- \iftoggle{bbx:eprint}
- {\usebibmacro{eprint}}
- {}%
- \newunit\newblock
- %\usebibmacro{url+urldate}%
- %\newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-
-%
-% 报告类型驱动
-% 当有网址无出版项时,用online输出
-%
-\DeclareBibliographyDriver{report}{%
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
- \usebibmacro{title}%
- \iftoggle{bbx:gbstrict}{}{%
- \newunit%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}}%
- \newunit\newblock
- \usebibmacro{byeditor+others}%增加的译者信息
- \newunit\newblock
- \printfield{type}%
- \setunit*{\addspace}%
- \printfield{number}%
- \newunit\newblock
- \printfield{version}%
- \newunit
- \printfield{note}%
- \newunit\newblock
- \usebibmacro{publisher+location+date}%
- %\newunit\newblock
- \usebibmacro{chapter+pages}%
- \usebibmacro{doi+eprint+url}%
- \newunit
- \printfield{pagetotal}%
- \newunit\newblock
- \iftoggle{bbx:isbn}
- {\printfield{isrn}}
- {}%
- \newunit\newblock
-% \usebibmacro{doi+eprint+url}%
-% \newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-%
-% 论文、手册类型驱动
-% 2016-11-11,增加了译者信息
-%
-\DeclareBibliographyDriver{manual}{%
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
- \usebibmacro{title}%
- \iftoggle{bbx:gbstrict}{}{%
- \newunit%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}}%
- \newunit\newblock
- \usebibmacro{byeditor+others}%增加的译者信息
- \newunit\newblock
- \iftoggle{bbx:gbfieldtype}{%
- \printfield{type}%
- \setunit*{\addspace}}{}%
- \printfield{number}%
- \newunit\newblock
- \printfield{version}%
- \newunit
- \printfield{note}%
- \newunit\newblock
- \usebibmacro{institution+location+date}%
- %\newunit\newblock
- \usebibmacro{chapter+pages}%
- \iffieldundef{url}{}{%当没有网址时也不输出修改或更新日期
- \usebibmacro{modifydate}}%修改或更新日期为带括号的时间
- \usebibmacro{doi+eprint+url}%
- \newunit
- \printfield{pagetotal}%
- \newunit\newblock
- \iftoggle{bbx:isbn}
- {\printfield{isrn}}
- {}%
- \newunit\newblock
-% \usebibmacro{doi+eprint+url}%
-% \newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-%
-% 备选类型驱动
-%
-% 利用biblatex的misc驱动
-\DeclareBibliographyDriver{misc}{%
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author/editor+others/translator+others}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
- \usebibmacro{title}%
-\iftoggle{bbx:gbstrict}{}{%
- \newunit
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}%
- \newunit\newblock
- \usebibmacro{byeditor+others}}%
- \newunit\newblock
- \printfield{howpublished}%
- \newunit\newblock
- \printfield{type}%
- \newunit
- \printfield{version}%
- \newunit
- \printfield{note}%
- \newunit\newblock
- \usebibmacro{institution+location+date}%
- %\usebibmacro{organization+location+date}%
- %\newunit\newblock
- \usebibmacro{doi+eprint+url}%
- \newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-
-%
-% 专著中的析出文献的格式修改
-%
-\DeclareBibliographyDriver{inbook}{%源来自standard.bbx
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author/translator+others}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
-\usebibmacro{title}%
-\usebibmacro{in:}%
-%\printtext{\texttt{//}\addthinspace}%
- \usebibmacro{bybookauthor}%
- \ifnameundef{bookauthor}{%
- \ifnameundef{editor}{}{\newunit}%
- }{\newunit}%替换下一句
- %\newunit\newblock
-\iffieldundef{series}{}{\usebibmacro{series+number}\setunit{\addcolon\addspace}}%为处理一些存在series的情况而增加
- \usebibmacro{maintitle+booktitle}%
-\iffieldundef{volume}{}{\setunit{\addcolon\addspace}\printfield{volume}}%
-\iffieldundef{number}{}{\setunit{\addcolon\addspace}\printfield{number}}%增加卷和册信息
- \newunit\newblock%
-% \usebibmacro{byeditor+others}%
-% \newunit\newblock
- \printfield{edition}%
- \newunit
- \iftoggle{bbx:gbstrict}{}{%
-% \iffieldundef{maintitle}
-% {\printfield{volume}%
-% \printfield{part}}
-% {}%
-% \newunit
-% \printfield{volumes}%
-% \newunit\newblock
-% \usebibmacro{series+number}
- }%
- \newunit\newblock
- %\printfield{note}%
- %\newunit\newblock
- \usebibmacro{publisher+location+date}%
- %\newunit\newblock
- \usebibmacro{chapter+pages}%
- %\newunit\newblock
- \usebibmacro{doi+eprint+url}%移到上面来
- \newunit\newblock
- \iftoggle{bbx:isbn}
- {\printfield{isbn}}
- {}%
- \newunit\newblock
-% \usebibmacro{doi+eprint+url}%
-% \newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
+%%
+%% ---------------------------------------------------------------
+%% biblatex-gb7714-2015 --- A biblatex implementation of the
+%% GBT7714-2015 bibliography style,numerical sequence
+%% Maintained by huzhenzhen
+%% E-mail: hzzmail at 163.com
+%% Released under the LaTeX Project Public License v1.3c or later
+%% ---------------------------------------------------------------
+%%
+
+%
+% 版本和时间信息
+%
+\def\versionofgbtstyle{2021/01/19 v1.0w}
+\def\versionofbiblatex{\abx at version}
+\ProvidesFile{gb7714-2015.bbx}[\versionofgbtstyle biblatex bibliography style]
+%\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求
+
+%=====================================================================
+% 加载标准样式
+%=====================================================================
+\RequireBibliographyStyle{numeric-comp}
+\RequirePackage{xstring}%解决texlive2015的biblatex3.0不加载xstring包的问题
+
+
+%=====================================================================
+% 功能函数
+%=====================================================================
+ %
+ % biblatex版本判断
+ % 20180405,v1.0k,为兼容biblatexv3.11增加toggle:iftlnine,HU zhenzhen
+ % 20181020,v1.0n,为不再使用xstring宏包做的修改,hzz
+ %
+ % 原理方法:当版本继续更新时,增加一个新的toggle用以处理新的旧版,最新版和未判断出来的版本永远用iftlatest
+ \providetoggle{iftlfive}\togglefalse{iftlfive} %处理biblatex3.2之前版本,时间2016-03-01前
+ \providetoggle{iftlsix}\togglefalse{iftlsix} %处理biblatex3.3开始改变姓名机制后版本,时间2016-03-01及以后
+ \providetoggle{iftlseven}\togglefalse{iftlseven}%处理biblatex3.7的兼容性,时间2016-12-01后
+ \providetoggle{iftleight}\togglefalse{iftleight}%处理biblatex3.8到3.9的兼容性,时间2017-11-01后到2017-12-01前
+ \providetoggle{iftlnine}\togglefalse{iftlnine} %处理biblatex10的兼容性,时间2017-12-01后
+ \providetoggle{iftlatest}\toggletrue{iftlatest} %假设是最新版biblatex
+
+ \@ifpackagelater{biblatex}{2014/04/01}{
+ \@ifpackagelater{biblatex}{2016/03/01}{
+ \@ifpackagelater{biblatex}{2016/12/01}{
+ \@ifpackagelater{biblatex}{2017/11/01}{
+ \@ifpackagelater{biblatex}{2017/12/01}{
+ \@ifpackagelater{biblatex}{2018/02/19}{}
+ {\toggletrue{iftlnine}\togglefalse{iftlatest}}}
+ {\toggletrue{iftleight}\togglefalse{iftlatest}}}
+ {\toggletrue{iftlseven}\togglefalse{iftlatest}}}
+ {\toggletrue{iftlsix}\togglefalse{iftlatest}}}
+ {\toggletrue{iftlfive}\togglefalse{iftlatest}}}
+ {\PackageError{biblatex}{Outdated 'biblatex' package}
+ {Please update biblatex, This is a fatal error.}}
+
+ \newcommand\defversion[2]{\csdef{codeversion#1#2}}%定义不同版本的命令
+ \newcommand\switchversion[2]{\csuse{codeversion#1#2}}%使用不同版本的命令
+
+ %
+ % 判断CJK字符的函数,用于判断作者等信息是否由中文字符构成
+ % v1.0k,20180509,hzz
+ %
+ % 原理方法:用biber中的perl方法代替。因为利用tex函数对字符判断时,当字符在宏
+ % 中时,基于`的方法无法解决GBK编码的问题,基于CJKsymbol的方法无法解决utf-8
+ % 编码用xelatex编译的问题。
+ %
+ % 原理是:利用perl正则将中文标识记录到域中,
+ % 然后利用\iffieldundef和\iffieldequalstr进行判断
+ \providetoggle{ifCJKforgbt}
+ \def\testCJKfirst#1{%
+ \iffieldundef{#1}{\togglefalse{ifCJKforgbt}}{%
+ \iffieldequalstr{#1}{chinese}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}}}
+
+ %
+ % 2个卷的解析函数,用于连续出版物
+ %
+ % 原理方法: 范围起止间隔符号还是用-,而不是与date相同的/,因为有合期期刊的问题,需要用到/符号
+ \newcommand{\multivolparser}[1]{%
+ \IfSubStr{#1}{-}%
+ {\StrBefore{#1}{-}[\multivolfirst]\StrBehind{#1}{-}[\multivolsecond]}%
+ {\def\multivolfirst{#1}\def\multivolsecond{}}%
+ }
+
+
+ %
+ % 2个期的解析函数,用于连续出版物
+ %
+ \newcommand{\multinumberparser}[1]{%
+ \IfSubStr{#1}{-}%
+ {\StrBefore{#1}{-}[\multinumberfirst]\StrBehind{#1}{-}[\multinumbersecond]}%
+ {\def\multinumberfirst{#1}\def\multinumbersecond{}}%
+ }
+
+ % 对没有分隔符环境命令的低版本biblatex做增补,避免报错
+ %
+ \iftoggle{iftlfive}{
+
+ \def\blx at inf@delimdeclare#1#2{%
+ \blx at info{Delimiter '#1' in context '#2' already defined, overwriting}}
+
+ \def\blx at warn@delimuse#1#2{%
+ \blx at warning{Delimiter '#1' in context '#2' undefined}}
+ % Delimiter interface
+
+ % [<contextname, ...>]{<name, ...>}{<code>}
+ \newrobustcmd*{\DeclareDelimFormat}{%
+ \@ifstar
+ {\blx at declaredelimclear}
+ {\blx at declaredelim}}
+
+ \newrobustcmd*{\blx at declaredelimclear}[3][]{%
+ \ifcsvoid{blx at declaredelimcontexts@#2}
+ {}
+ {\def\do##1{\csundef{blx at printdelim@##1@#2}}%
+ \dolistcsloop{blx at declaredelimcontexts@#2}}%
+ \cslet{blx at declaredelimcontexts@#2}\@empty
+ \ifblank{#1}
+ {\blx at declaredelim{#2}{#3}}
+ {\blx at declaredelim[#1]{#2}{#3}}}
+
+ \newrobustcmd*{\blx at declaredelim}[3][]{%
+ \ifblank{#1}
+ {\blx at declaredelim@i{}{}{#2}{#3}}
+ {\def\do##1{%
+ \listcsadd{blx at declaredelimcontexts@#2}{##1}%
+ \blx at declaredelim@i{blx at printdelim@##1@}{##1}{#2}{#3}}%
+ \docsvlist{#1}}}%
+
+ \def\blx at declaredelim@i#1#2#3#4{%
+ \def\do at i##1{%
+ \ifcsdef{#1##1}
+ {\blx at inf@delimdeclare{##1}{#2}}
+ {}%
+ \csdef{#1##1}{#4}}%
+ \forcsvlist{\do at i}{#3}}
+
+ % *[<contextname, ...>]{<alias>}{<delim>}
+ \newrobustcmd*{\DeclareDelimAlias}{%
+ \@ifstar
+ {\blx at declaredelimalias}
+ {\blx at declaredelimaliasauto}}
+
+ \newrobustcmd*{\blx at declaredelimalias}[3][]{%
+ \ifblank{#1}
+ {\blx at declaredelimalias@i{}{#2}{#3}}
+ {\def\do##1{%
+ \blx at declaredelimalias@i{blx at printdelim@##1@}{#2}{#3}}%
+ \docsvlist{#1}}}
+
+ \newrobustcmd*{\blx at declaredelimaliasauto}[2]{%
+ \blx at declaredelimalias@i{}{#1}{#2}%
+ \ifcsvoid{blx at declaredelimcontexts@#2}
+ {}
+ {\def\do##1{%
+ \blx at declaredelimalias@i{blx at printdelim@##1@}{#1}{#2}}%
+ \dolistcsloop{blx at declaredelimcontexts@#2}}}
+
+ \def\blx at declaredelimalias@i#1#2#3{%
+ \ifcsdef{#1#2}
+ {\blx at inf@delimdeclare{#2}{#1}}
+ {}%
+ \csdef{#1#2}{\csuse{#1#3}}}
+
+ \def\blx at delimcontext{none}
+ \newcommand*{\printdelim}[2][]{%
+ \ifblank{#1}
+ {\ifcsdef{blx at printdelim@\blx at delimcontext @#2}
+ {\csuse{blx at printdelim@\blx at delimcontext @#2}}
+ {\ifcsdef{#2}% fall back on legacy macros
+ {\csuse{#2}}
+ {\blx at warn@delimuse{#2}{*}}}}
+ {\ifcsdef{blx at printdelim@#1@#2}
+ {\csuse{blx at printdelim@#1@#2}}
+ {\blx at warn@delimuse{#2}{#1}}}}
+
+ \newcommand*{\delimcontext}[1]{%
+ \edef\blx at delimcontext{\blx at delimcontextalias{#1}}}
+
+ \def\blx at delimcontextalias#1{%
+ \ifcsdef{blx at delimcontextalias@#1}
+ {\csuse{blx at delimcontextalias@#1}}
+ {#1}}
+
+ \newcommand*{\DeclareDelimcontextAlias}[2]{%
+ \csgdef{blx at delimcontextalias@#1}{#2}}
+ }{}
+
+
+%=====================================================================
+% 数据模型定义
+%=====================================================================
+ %定义类型和载体标识,从gb内容看载体基本属于介质。
+ %为与lee zeping的bst的样式统一,使用mark和medium这两域名
+ %为单个条目的姓名格式控制增加nameformat和namefmtid两个域
+ %为缩略信息文献表增加了shortbooktitle域
+ %为多语言排序增加了lansortorder域
+ \DeclareDatamodelFields[type=field,datatype=literal]{mark,medium,nameformat}
+ \DeclareDatamodelFields[type=field,datatype=integer]{namefmtid}
+ \DeclareDatamodelFields[type=field,datatype=literal]{shortbooktitle}
+ \DeclareDatamodelFields[type=field,datatype=literal]{lansortorder}
+
+ %因为biblatex更新3.14版本以后,biber对于为声明数据模型的条目类型
+ %不再默认读取,而是以空字符串作为条目类型名,自然在条目定义alias时
+ %就会出现问题,因此显式的声明一下newspaper,然后保留后面采用alias的方式
+ %而standard类型则是采用另一种方式直接在sourcemap中转换为其它类型。
+ \@ifpackagelater{biblatex}{2019/11/30}{%2019/12/01 v3.14
+ \DeclareDatamodelEntrytypes{newspaper}%
+ }{}
+
+
+
+%=====================================================================
+% 设置宏包选项
+%=====================================================================
+ %
+ % 增加一个控制是否输出文献载体的选项
+ % 20191125,v1,0s,hzz
+ \newtoggle{bbx:gbmedium}
+ \DeclareBibliographyOption{gbmedium}[true]{%biblatex低版本
+ \settoggle{bbx:gbmedium}{#1}}
+ \ExecuteBibliographyOptions{gbmedium}
+
+ %
+ % 增加一个控制是否输出annotation域的选项,该域可以用于在文献条目后面输出一些注释信息
+ % 20190509,v1,0s,hzz
+ \newtoggle{bbx:gbannote}
+ \DeclareBibliographyOption{gbannote}[false]{%biblatex低版本
+ \settoggle{bbx:gbannote}{#1}}
+ \ExecuteBibliographyOptions{gbannote}
+ %
+ %用于在文献条目后面输出注释信息的宏
+ %FieldFormat{annotation}用于设置注释信息的格式
+ \DeclareFieldFormat{annotation}{%
+ \printtext{\addspace(#1)}%
+ }
+ \renewbibmacro*{annotation}{%
+ \iftoggle{bbx:gbannote}%
+ {\iffieldundef{annotation}%
+ {\printfile[annotation]{\bibannotationprefix\thefield{entrykey}.tex}}%
+ {\printfield{annotation}}}%
+ {}%
+ }
+
+ %
+ % 增加一个控制是否输出type域的选项
+ % 20190212,v1,0q,hzz
+ \newtoggle{bbx:gbfieldtype}
+ \DeclareBibliographyOption{gbfieldtype}[false]{%biblatex低版本
+ \settoggle{bbx:gbfieldtype}{#1}}
+ \ExecuteBibliographyOptions{gbfieldtype}
+
+ %
+ % 增加一个控制是否根据页码重设脚注数字标号的选项
+ % 20190422,v1,0r,hzz
+ \newtoggle{bbx:gbfnperpage}
+ \DeclareBibliographyOption{gbfnperpage}[false]{%
+ \settoggle{bbx:gbfnperpage}{#1}}
+ \ExecuteBibliographyOptions{gbfnperpage}
+
+
+ %
+ % 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表
+ % 20190203,v1.0p,hzz
+ % 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签
+ % 当前面的脚注中已经存在当前文献,那么当前文献内容不再输出而用同(4)这样的方式
+ % 需要注意的是由于小页环境和表格中的脚注本身的问题,可能会有一些问题
+ \DeclareBibliographyOption{gbfootbib}[false]{%
+ \ifstrequal{#1}{false}{}{\execgbfootbib}}
+ \ExecuteBibliographyOptions{gbfootbib}
+
+ %%
+ \newlength{\footbibmargin}
+ \newlength{\footbiblabelsep}
+ \setlength{\footbibmargin}{1em}%脚注的段落左侧缩进距离
+ \setlength{\footbiblabelsep}{0.5em}%脚注中标记号与脚注段落的间距
+ \def\execgbfootbib%
+ {%
+ %开启引用跟踪计数器,为使用\ifciteseen等测试命令
+ \ExecuteBibliographyOptions{citetracker=true}
+ %
+ %利用footmisc宏包来实现脚注文献的悬挂对齐
+ \AtEndPreamble{
+ \@ifclassloaded{beamer}{}{
+ %beamer类因为其特殊性,为避免冲突不调footmisc。
+ %同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接
+ %如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。
+ %\PassOptionsToPackage{perpage,hang}{footmisc}%
+ %\RequirePackage{footmisc}%
+
+ %重新实现脚注的根据单页重设脚注号码
+ %重新实现脚注的悬挂对齐问题,不再使用footmisc,直接从latex核心代码和hyperref代码进行修改
+ %v1.0q 20190317 hzz
+ %v1.0r 20190422 hzz 根据gbfnperpage选项设置
+ \iftoggle{bbx:gbfnperpage}%
+ {\@addtoreset{footnote}{page}}{}%重设计数器
+
+\@ifpackageloaded{hyperref}{%加载hyperref则对\H@@footnotetext做重定义
+ \long\def\H@@footnotetext##1{\insert\footins{%
+ \reset at font\footnotesize
+ \interlinepenalty\interfootnotelinepenalty
+ \splittopskip\footnotesep
+ \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
+ \hsize\columnwidth \@parboxrestore
+ \protected at edef\@currentlabel{%
+ \csname p at footnote\endcsname\@thefnmark
+ }%
+ \color at begingroup
+ \leftskip \footbibmargin%增加的左侧缩进
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox%
+ }%
+ \color at endgroup}}%
+
+ \long\def\H@@mpfootnotetext##1{%
+ \global\setbox\@mpfootins\vbox{%
+ \unvbox\@mpfootins
+ \reset at font\footnotesize
+ \hsize\columnwidth
+ \@parboxrestore
+ \protected at edef\@currentlabel
+ {\csname p at mpfootnote\endcsname\@thefnmark}%
+ \leftskip \footbibmargin%增加的左侧缩进
+ \color at begingroup
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}%
+ \color at endgroup}}
+ }{%否则对latex核心代码中的\@footnotetext做重定义
+ \long\def\@footnotetext##1{\insert\footins{%
+ \reset at font\footnotesize
+ \interlinepenalty\interfootnotelinepenalty
+ \splittopskip\footnotesep
+ \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
+ \hsize\columnwidth \@parboxrestore
+ \protected at edef\@currentlabel{%
+ \csname p at footnote\endcsname\@thefnmark
+ }%
+ \color at begingroup
+ \leftskip \footbibmargin%增加的左侧缩进
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox%
+ }%
+ \color at endgroup}}%
+
+ \long\def\@mpfootnotetext##1{%
+ \global\setbox\@mpfootins\vbox{%
+ \unvbox\@mpfootins
+ \reset at font\footnotesize
+ \hsize\columnwidth
+ \@parboxrestore
+ \protected at edef\@currentlabel
+ {\csname p at mpfootnote\endcsname\@thefnmark}%
+ \leftskip \footbibmargin%增加的左侧缩进
+ \color at begingroup
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}%
+ \color at endgroup}}
+ }
+
+ \long\def\@makefntext##1{%增加了脚注标记与正文的间隔
+ \parindent 1em\noindent \hb at xt@ 0em{\hss \@makefnmark\makebox[\footbiblabelsep]{}}##1}
+
+ }
+
+ %
+ %使脚注标记加圈并设置数字的字体为tiny,不使用修改thefootnote的方式
+ \def\@makefnmark{\hbox{\@textsuperscript{\textcircled{\tiny\@thefnmark}}}}
+ %做patch使得脚注内容中的脚注数字标签不上标
+ \pretocmd{\@makefntext}{%
+ \def\@makefnmark{%
+ \hbox{\textcircled{\tiny\@thefnmark}}%
+ }%
+ }{}{}
+ }
+
+ %
+ %判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容)
+ %记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。
+ %v1.0q 20190309 区分使脚注标注适应minipage中的情况
+ \newbibmacro*{citesavefn}{%
+ \ifciteseen%当被引用过为true
+ {\ifcsdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%当已经定义过脚注序号信息
+ {\csgdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{%
+ \str at sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}%
+ \@makefnmark%
+ }}%
+ {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{%
+ \ifcsstring{@mpfn}{mpfootnote}{\@alph\c at mpfootnote}{\thefootnote}%
+ }}%
+ }%
+ {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{%
+ \ifcsstring{@mpfn}{mpfootnote}{\@alph\c at mpfootnote}{\thefootnote}%
+ %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断
+ }}%
+ }
+
+ %
+ %重定义\footfullcite使完成gb7714-2015的脚注文献要求
+ \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]%
+ {\defcounter{maxnames}{\blx at maxbibnames}%局部定义maxnames和minnames计数器
+ \defcounter{minnames}{\blx at minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。
+ \usebibmacro{prenote}%
+ \renewbibmacro*{postnote}{%
+ \iffieldundef{postnote}%
+ {}{\setunit{\addcolon\addspace}\printfield{postnote}}}%与ay样式不同,由于已修改postnote域格式,直接用printfield
+ }%
+ {\usebibmacro{citesavefn}%
+ \ifcsdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%
+ {\csuse{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}%\nopunct
+ {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}%
+ }%
+ {\multicitedelim}%
+ {\usebibmacro{postnote}}
+
+ }
+
+ %
+ % 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式
+ % 20180814,v1.0m,hzz
+ % 原理方法:
+ % 只为兼容性考虑不做任何处理
+ \DeclareBibliographyOption{gbstyle}[true]{%biblatex低版本
+ }
+
+ %
+ % 增加一个控制是否输出文献类型和载体标识的选项
+ %
+ % 原理方法:
+ % 对于biblatex3.4以上版本DeclareBibliographyOption命令中的[datatype]如果是boolean,那么是可以省略的
+ % 所以用老版本的不用[datatype]的命令可以兼容所有biblatex版本
+ \newtoggle{bbx:gbtype}
+ %\DeclareBibliographyOption[boolean]{gbtype}[true]{%biblatex高版本
+ \DeclareBibliographyOption{gbtype}[true]{%biblatex低版本
+ \settoggle{bbx:gbtype}{#1}}
+ \ExecuteBibliographyOptions{gbtype}
+
+ %
+ % 增加一个源文件编码选择选项,当true时可以使用GBK编码。
+ % v1.0k, 2018.05.08, by hzz
+ %
+ % 原理方法:将需要输出的中文字符串用命令形式表示存储,采用utf8编码时采用bbx文档
+ % 内的定义即是utf8编码的中文字符串,但tex源文件是gbk编码时,利用gb7714-2015-gbk.def
+ % 文档内的gbk编码的字符串覆盖。这种覆盖只能在宏包末尾加载时成功实现,所以使用
+ % AtEndOfPackage。该解决思路源自biblatex-caspervector宏包。
+ % 另外注意:
+ % gbk编码的tex文档,利用pdflatex/latex能正确编译,利用xelatex能编译,但中文显示乱码
+ % 在源文档前面增加 XeTeX 原语:\XeTeXinputencoding "GBK" 后,显示正常
+ % utf-8编码的tex文档,利用xelatex能正确编译,而pdflatex/latex不能编译。
+ \newtoggle{bbx:codegbk}
+ \DeclareBibliographyOption{gbcodegbk}[false]{%
+ \settoggle{bbx:codegbk}{#1}}
+ \ExecuteBibliographyOptions{gbcodegbk}
+
+ \def\str at bibliography{参考文献}
+ \def\str at references{参考文献}
+ \def\str at bytranslator{译}
+ \def\str at andotherscn{等}
+ \def\str at andcn{和}
+ \def\str at backrefpage{引用页}
+ \def\str at backrefpages{引用页}
+ \def\str at noaddress{出版地不详}
+ \def\str at nopublisher{出版者不详}
+ \def\str at edition{版}
+ \def\str at volumecn{卷}
+ \def\str at numbercn{册}
+ \def\str at serialcn{第}
+ \def\str at sameentry{同}
+ \def\str at incn{见}
+ \def\str at mathesiscn{硕士学位论文}
+ \def\str at phdthesiscn{博士学位论文}
+ \def\str at editorcn{主编}
+
+ \AtEndOfPackage{%
+ \iftoggle{bbx:codegbk}{%
+ \ExecuteBibliographyOptions{texencoding = GBK}
+ \input{gb7714-2015-gbk.def}
+ }{}}
+
+ %
+ % 增加一个严格按GB/T 7714-2015给出著录格式控制域的输出的选项
+ % v1.0k, 2018.05.08, by hzz
+ %
+ % 原理方法:
+ % 默认设置该选项为真,进而不输出GB/T 7714-2015中没有的域的信息
+ % 这样可以避免因为bib文件带有多余的域的信息的输出,比如因为bibtex样式
+ % 可能需要用于中英文判断的language域的信息。
+ \newtoggle{bbx:gbstrict}
+ \DeclareBibliographyOption{gbstrict}[true]{%
+ \settoggle{bbx:gbstrict}{#1}}
+ \ExecuteBibliographyOptions{gbstrict}
+
+ %
+ % 增加一个控制标题域超链接设置的选项
+ % v1.0k, 2018.05.24, by hzz
+ %
+ % 原理方法:
+ % 利用标题域格式来实现,默认设置该选项为false,不做超链接。
+ % 设置为true,则标题设置超链接
+ \newtoggle{bbx:titlelink}
+ \DeclareBibliographyOption{gbtitlelink}[false]{%
+ \settoggle{bbx:titlelink}{#1}}
+ \ExecuteBibliographyOptions{gbtitlelink}
+
+ %
+ % 增加一个控制参考文献标题是否能够被ctex宏包设置的选项
+ % v1.0l, 2018.07.02, by hzz
+ %
+ % 原理方法:
+ % 重定义biblatex的宏,去除使用本地化字符串的方式,是的可以利用ctexset进行设置
+ \newtoggle{bbx:ctexset}
+ \DeclareBibliographyOption{gbctexset}[true]{%
+ \settoggle{bbx:ctexset}{#1}}
+ \ExecuteBibliographyOptions{gbctexset}
+
+ \AtEndOfPackage{%
+ \iftoggle{bbx:ctexset}{%
+ \def\blx at defbibstrings#1#2{%
+ \def\do##1{\csundef{abx at lstr@##1}\csundef{abx at sstr@##1}}%
+ \abx at dostrings
+ \csuse{abx at strings@#1}%
+ \setkeys{blx at lbx}{#2}%
+ \let\do\blx at defbibstrings@i
+ \csxdef{abx at strings@#1}{\abx at dostrings}%
+ }
+ }{}}
+
+ %
+ % 增加一个处理佚名或noauthor的控制选项
+ %
+ % 原理方法:在顺序编码制中不需要使用,为与作者年制的兼容性考虑,这里也增加避免报错
+ \DeclareBibliographyOption{gbnoauthor}[true]{}%
+
+
+ %
+ % 增加一个恢复域格式为标准样式的控制选项
+ % v1.0k, 2018.05.15, by hzz
+ %
+ % 原理方法:
+ % 默认设置该选项为false,采用国标要求的域格式输出相关域
+ % 当设置该选项为true时,则重新利用标准样式的域格式输出相关的域
+ \newtoggle{bbx:gbfieldstd}
+ \DeclareBibliographyOption{gbfieldstd}[false]{%
+ \settoggle{bbx:gbfieldstd}{#1}%
+ \ifstrequal{#1}{false}{}{\execgbfdfmtstd}%
+ }
+ \ExecuteBibliographyOptions{gbfieldstd}
+
+ %
+ % 增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。
+ %
+ \newtoggle{bbx:gbpub}
+ \DeclareBibliographyOption{gbpub}[true]{%
+ %\settoggle{bbx:gbpub}{#1} %或采用下面这一句
+ \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}}
+ \ExecuteBibliographyOptions{gbpub}
+
+ %
+ % 增加控制析出文献来源前的标点符号//输出的选项
+ % v1.0k, 2018.04.20,added in by hzz
+ \newtoggle{bbx:gbpunctin}
+ \DeclareBibliographyOption{gbpunctin}[true]{%
+ \settoggle{bbx:gbpunctin}{#1}}
+ \ExecuteBibliographyOptions{gbpunctin}
+
+
+
+
+
+ %
+ % 选项设置
+ %
+ \ExecuteBibliographyOptions{
+ sorting=none,
+ useprefix=true, %名字的信息包括前缀
+ date = year, %日期仅写到年
+ maxbibnames = 3,%设置名字最大数量
+ minbibnames = 3, %设置缩减后的名字最小数量
+ maxitems = 1,%设置列表最大数量
+ minitems = 1, %设置缩减后的列表最小数量
+ isbn=false,
+ }
+
+ %
+ %为日期相关选项增加选项值gb7714-2015
+ %
+ \csdef{mkdaterangegb7714-2015}#1{%
+ \begingroup
+ \blx at metadateinfo{#1}%
+ \iffieldundef{#1year}
+ {}
+ {\printtext[#1date]{%
+ \blx at gbdate{#1}{}}}%
+ \endgroup}
+
+ \newrobustcmd*{\blx at gbdate}[3][]{%
+ \dateeraprintpre{#2#3year}%
+ \blx at imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}%
+ \iffieldundef{#2#3month}{}{\hyphen\blx at imc@forcezerosmdt{\thefield{#2#3month}}}%
+ \iffieldundef{#2#3day}{}{\hyphen\blx at imc@forcezerosmdt{\thefield{#2#3day}}}}
+
+
+ %为姓名格式选择增加的计数器
+ \newcounter{gbnamefmtcase}
+ \def\thegbnamefmtcase{\the\c at gbnamefmtcase}
+ %为数字标签格式选择增加的计数器/命令
+ \newcommand{\mkgbnumlabel}[1]{\mkbibbrackets{#1}}
+ \def\gbbiblabelopt at bracket{\renewcommand{\mkgbnumlabel}[1]{\mkbibbrackets{##1}}}
+ \def\gbbiblabelopt at parens{\renewcommand{\mkgbnumlabel}[1]{\mkbibparens{##1}}}
+ \def\gbbiblabelopt at dot{\renewcommand{\mkgbnumlabel}[1]{##1\adddot}}
+ \def\gbbiblabelopt at plain{\renewcommand{\mkgbnumlabel}[1]{##1}}
+ \def\gbbiblabelopt at box{\renewcommand{\mkgbnumlabel}[1]{\framebox{##1}}}
+ \def\gbbiblabelopt at circle{\renewcommand{\mkgbnumlabel}[1]{\textcircled{##1}}}
+ %为文献表中数字标签对齐方式选择增加的计数器/命令
+ \newcounter{gbalignlabel}
+ \def\thegbalignlabel{\the\c at gbalignlabel}
+ %为引用标签标注/文献表中本地化字符串中英文选择增加的计数器/命令
+ \newcounter{gbcitelocalcase}
+ \newcounter{gbbiblocalcase}
+ \def\thegbcitelocalcase{\the\c at gbcitelocalcase}
+ \def\thegbbiblocalcase{\the\c at gbbiblocalcase}
+
+\@ifpackagelater{biblatex}{2016/03/27}
+ { % 针对biblatex>=3.3版本的选项设置
+ % 增加不同语言排序的切换选项
+ % numeric样式,不使用该选项,这里给出仅为兼容性考虑
+ % v1.0q,20190307,hzz
+ %
+ % 增加不同语言排序的切换选项
+ % gblanorder=chineseahead的顺序为cn,jp,kr,en,fr,ru
+ % gblanorder=englishahead的顺序为en,fr,ru,cn,jp,kr
+ % gblanorder=cn;en;ru;fr;jp;kr的顺序为指定的cn;en;ru;fr;jp;kr,自定义内容可以随意写以分号分隔
+ % v1.0q,20190307,hzz
+ %
+ \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{%
+ \ifstrequal{#1}{chineseahead}%%中文在前的顺序
+ {\gdef\lancnorder{1}\gdef\lanjporder{2}\gdef\lankrorder{3}%
+ \gdef\lanenorder{4}\gdef\lanfrorder{5}\gdef\lanruorder{6}}%
+ {%
+ \ifstrequal{#1}{englishahead}%
+ {\execlanodeah\dealsortlan}%
+ {\execlanodudf{#1}\dealsortlan}%
+ }%
+ }
+ \ExecuteBibliographyOptions{gblanorder}
+
+ \def\execlanodeah{%中文在后的顺序
+ \gdef\lancnorder{4}
+ \gdef\lanjporder{5}
+ \gdef\lankrorder{6}
+ \gdef\lanenorder{1}
+ \gdef\lanfrorder{2}
+ \gdef\lanruorder{3}}
+
+ \newcounter{lanordernum}
+ \newcommand{\execlanodudf}[1]{%like:cn;en;ru;fr;jp;kr
+ \setcounter{lanordernum}{0}
+ \DeclareListParser{\parsinglanorder}{;}
+ \renewcommand*{\do}[1]{\stepcounter{lanordernum}\csxdef{lan##1order}{\thelanordernum}}
+ \parsinglanorder{#1}
+ }
+
+ %
+ % 增加本地化字符串的中英文切换选项
+ % gbcitelocal指标注中的本地化字符串
+ % gbbiblocal 指文献表中的本地化字符串
+ % gblocal 指设置文献表和标注中的本地化字符串
+ % v1.0o,20190103,hzz
+ %
+ \DeclareBibliographyOption[string]{gbcitelocal}[gb7714-2015]{%
+ \ifstrequal{#1}{gb7714-2015}{\setcounter{gbcitelocalcase}{0}}{}%
+ \ifstrequal{#1}{chinese}{\setcounter{gbcitelocalcase}{1}}{}%
+ \ifstrequal{#1}{english}{\setcounter{gbcitelocalcase}{2}}{}%
+ }
+ \ExecuteBibliographyOptions{gbcitelocal}
+
+ \DeclareBibliographyOption[string]{gbbiblocal}[gb7714-2015]{%
+ \ifstrequal{#1}{gb7714-2015}{\setcounter{gbbiblocalcase}{0}}{}%
+ \ifstrequal{#1}{chinese}{\setcounter{gbbiblocalcase}{1}}{}%
+ \ifstrequal{#1}{english}{\setcounter{gbbiblocalcase}{2}}{}%
+ }
+ \ExecuteBibliographyOptions{gbbiblocal}
+
+ \DeclareBibliographyOption[string]{gblocal}[gb7714-2015]{%
+ \ExecuteBibliographyOptions{gbbiblocal=#1}%
+ \ExecuteBibliographyOptions{gbcitelocal=#1}%
+ }
+ %\ExecuteBibliographyOptions{gblocal} %默认值已经通过两个相关选项设置
+
+ %
+ % 增加序号标签格式处理选项
+ % v1.0l,20180623,hzz
+ %
+ \DeclareBibliographyOption[string]{gbbiblabel}[bracket]{%
+ \csuse{gbbiblabelopt@#1}
+ }
+ \ExecuteBibliographyOptions{gbbiblabel}
+
+ %
+ % 增加姓名大小写格式处理选项
+ %
+ \DeclareBibliographyOption[string]{gbnamefmt}[uppercase]{%
+ \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}%
+ \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}%
+ \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family
+ \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{}
+ \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given
+ \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family
+ }
+ \ExecuteBibliographyOptions{gbnamefmt}
+
+ %
+ % 增加标签对齐选项
+ %
+ % right是默认的右对齐,left是左对齐,gb7714-2015是项对齐方式
+ \DeclareBibliographyOption[string]{gbalign}[right]{%
+ \ifstrequal{#1}{right}{\setcounter{gbalignlabel}{0}}{}
+ \ifstrequal{#1}{left}{\setcounter{gbalignlabel}{1}}{}
+ \ifstrequal{#1}{center}{\setcounter{gbalignlabel}{2}}{}
+ \ifstrequal{#1}{gb7714-2015}{\setaligngbstyle}{}
+ }
+ }
+ {% 针对biblatex<3.3版本的选项设置
+ % 增加不同语言排序的切换选项
+ % numeric样式, biblatex 3.4及以下版本不能使用多个stylesourcemap,所以不使用该选项
+ % v1.0q,20190307,hzz
+ %
+ \DeclareBibliographyOption{gblanorder}[chineseahead]{}
+
+ %
+ % 增加序号标签格式处理选项
+ % v1.0l,20180623,hzz
+ %
+ \DeclareBibliographyOption{gbbiblabel}[bracket]{%
+ \csuse{gbbiblabelopt@#1}
+ }
+ \ExecuteBibliographyOptions{gbbiblabel}
+
+ %
+ % 增加姓名大小写格式处理选项
+ %
+ \DeclareBibliographyOption{gbnamefmt}[uppercase]{%
+ \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}%
+ \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}%
+ \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family
+ \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{}
+ \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given
+ \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family
+ }
+ \ExecuteBibliographyOptions{gbnamefmt}
+
+ %
+ % 增加标签对齐选项
+ %
+ % 原理方法:right是默认的右对齐,left是左对齐,gb7714-2015无效,仍然为右对齐模式,
+ % 因为在这种biblatex低版本中,舍弃了list类环境后,会出错。
+ % 注意:texlive2015中的3.0版中的DeclareBibliographyOption选项没有类型说明
+ \DeclareBibliographyOption{gbalign}[right]{%
+ \ifstrequal{#1}{right}{\setcounter{gbalignlabel}{0}}{}
+ \ifstrequal{#1}{left}{\setcounter{gbalignlabel}{1}}{}
+ \ifstrequal{#1}{center}{\setcounter{gbalignlabel}{2}}{}
+ \ifstrequal{#1}{gb7714-2015}{}{}
+ }
+ }
+
+
+%
+% 针对biblatex<3.3版本的选项设置,比如texlive2015中的3.0版
+%
+\defversion{3.0}{opt}{
+ \ExecuteBibliographyOptions{
+ firstinits=true, %名字有缩写,参考3.1.2.3 Internal
+ }
+}
+%
+% 针对3.3<=biblatex<3.5版本的选项设置,比如texlive2016中的3.4版
+%
+\defversion{3.4}{opt}{
+ \ExecuteBibliographyOptions{
+ giveninits=true, %名字有缩写,参考3.1.2.3 Internal
+ }
+}
+%
+% 针对3.7<=biblatex<=3.9版本的选项设置,比如texlive2017中的3.7版
+%
+\defversion{3.7}{opt}{
+ \ExecuteBibliographyOptions{
+ giveninits=true,
+ urldate =edtf, %iso8601
+ eventdate =edtf,
+ }
+}
+%
+% 针对3.10<=biblatex版本的选项设置,比如texlive2018中的3.11版
+%
+\defversion{3.10}{opt}{
+ \ExecuteBibliographyOptions{
+ giveninits=true,
+ urldate =gb7714-2015, %iso,iso8601,edtf
+ eventdate =gb7714-2015,
+ }
+}
+
+%
+% 根据biblatex版本信息,选择选项设置
+%
+% 原理方法:如下这种选择机制能自动兼容更新的版本,但对于老版本
+% 必须要把情况列全。
+\iftoggle{iftlfive}{\switchversion{3.0}{opt}}{}%biblatex<=3.2
+\iftoggle{iftlsix}{\switchversion{3.4}{opt}}{}%3.3<=biblatex<=3.6
+\iftoggle{iftlseven}{\switchversion{3.7}{opt}}{}%biblatex=3.7
+\iftoggle{iftleight}{\switchversion{3.7}{opt}}{}%3.8<=biblatex<=3.9
+\iftoggle{iftlnine}{\switchversion{3.10}{opt}}{}%biblatex=3.10
+\iftoggle{iftlatest}{\switchversion{3.10}{opt}}{}%biblatex最新3.11
+
+
+%=====================================================================
+% 设置本地化字符串
+%=====================================================================
+ %
+ % 新建当地化字符串,用来记录“等”字符、“和”字符
+ %
+ \NewBibliographyString{andotherscn}
+ \NewBibliographyString{andothersincitecn}
+ \NewBibliographyString{andothersincite}
+ \NewBibliographyString{andcn}
+ \NewBibliographyString{andothersjp}
+ \NewBibliographyString{andotherskr}
+ \NewBibliographyString{andjp}
+ \NewBibliographyString{andkr}
+ \NewBibliographyString{andincitecn}
+ \NewBibliographyString{andincite}
+ \NewBibliographyString{volumecn}
+ \NewBibliographyString{numbercn}
+ \NewBibliographyString{serialcn}
+ \NewBibliographyString{incn}
+ \NewBibliographyString{mathesiscn}
+ \NewBibliographyString{phdthesiscn}
+ \NewBibliographyString{editorcn}
+ \NewBibliographyString{editorscn}
+
+
+
+ %
+ % 修改一些当地化字符串
+ %
+ % 原理方法:直接利用当地化格式english修改出一些中文的格式,具体修改内容参考english.lbx文件
+ % 当然也可以增加比如上面定义的andotherscn
+ % 注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别
+
+ \DefineBibliographyStrings{english}{
+ bibliography = {\str at bibliography},
+ references = {\str at references},
+ bytranslator= {\str at bytranslator},%\addperiod,%将trans. by 改成 译\addcomma\
+ and = {\addcomma},%将第2和3人名间的and符号改成逗号,用\finalnamedelim命令也可以定义,参见3.9.1节
+ andcn = {\addcomma},%and本地化字符串的中文对应词
+ andincitecn = {\str at andcn},%将标注中的分开,便于与文献表中的区分
+ andincite = {\addcomma},
+ %andothers = {et al.},%将超过3个人名的省略,et al.改成为 等
+ andotherscn = {\str at andotherscn},%将超过3个人名的省略,et al.改成为 等
+ andothersincitecn={\str at andotherscn},%将标注中的分开,便于与文献表中的区分
+ andothersincite={et al\adddot},
+ backrefpage = {\str at backrefpage:},
+ backrefpages = {\str at backrefpages:},
+ in={in\intitlepunct},
+ volumecn={\str at volumecn},
+ numbercn={\str at numbercn},
+ serialcn={\str at serialcn},
+ andothersjp={他},
+ andotherskr={외},
+ andjp={和},
+ andkr={和},
+ incn={\str at incn\addcolon\addspace},
+ mathesiscn={\str at mathesiscn},
+ phdthesiscn={\str at phdthesiscn},
+ editorscn={\str at editorcn},
+ editorcn={\str at editorcn},
+}
+
+ %
+ % 增加两个命令用于临时的局部的修改本地化字符串
+ % 其中\setlocalbibstring修改缩写字符串,setlocalbiblstring修改长字符串
+ % 注意使用时因为是局部修改,因此要将其与需要修改的引用命令放在一个编组符号内
+ % v1.0t,hzz,20190525
+ \newcommand{\setlocalbibstring}[2]{%
+ \csdef{abx at sstr@#1}{#2}}
+ \newcommand{\setlocalbiblstring}[2]{%
+ \csdef{abx at lstr@#1}{#2}}
+
+%=====================================================================
+% 动态数据修改
+%=====================================================================
+%
+% 各层次的数据映射和动态修改
+%
+% 原理方法:
+% 1. 进行语言包括中英文判断,并设置和记录,比如记录到userf,usere中
+% 2. 增加文献标识符如[M],[J]等,对一些容易混淆的域进行设置以增强兼容性
+% 3. \DeclareSourcemap命令对于biblatex3.11以下版本只能出现一次,3.11版开始支持多个
+% 4. \DeclarestyleSourcemap在biblatex v3.7版开始可以支持出现多次
+% 5. 把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。
+% 注意:这里用userf,usere而不是namee,namef,是因为只有把name列表转成域,才能有效读取姓名中的字符,
+% 如果用namee,namef,name信息会自动解析,所以就不能为cjk判断提供需要的信息
+%
+% 不同的文献类型使用相同的驱动输出可以有5种方法:
+% 1. 是数据源层的映射,将其它类型转换为某一要使用驱动的类型
+% 2. 是样式层映射,也是将其它类型转换为某一要使用驱动的类型
+% 3. 是驱动层映射,也是将其它类型转换为某一要使用驱动的类型
+% 4. 定义驱动类型别名DeclareBibliographyAlias,将其它类型定义为某一要使用驱动的类型的别名
+% 驱动别名定义本质上是做了驱动层映射
+% 5. 直接定义不同的类型的驱动,但驱动内容相同。
+%
+% 关于数据映射和驱动使用的考虑如下:
+% 1. 为避免利用biber输出bib文件时的数据变动,尽量不在数据源层映射做类型转换
+% 2. 为减少代码量,尽量少做内容相同的不同类型驱动
+% 3. 因此类型相关的处理主要在样式层映射、驱动层映射、驱动别名
+% 4. 由于biblatex默认做的驱动别名处理可能增加一些信息比如masterthesis转thesis时增加的type
+% 可以在样式层映射做某些需要避免这种默认处置的转换
+% 5. 当没有避免默认行为的需求时,全部采用驱动别名的方式处理,等价于驱动层的映射
+%
+% 文献类型和驱动考虑如下:
+% 1. 连续出版物及析出文献有其特殊性,因此考虑两类periodical和article
+% newpaper映射为article,并以note域做区分特殊处理
+% 2. 专著和专著中的析出文献是主要的类型,因此考虑book和inbook
+% standard映射为book或inbook,并以note域做区分特殊处理
+% collection和proceedings基本与book类似,因此做book驱动别名处理
+% incollection和inproceedings基本与inbook类似,因此做inbook驱动别名处理
+% 3. 专利类型有其特殊性,考虑patent类型
+% 4. 电子资源类型有其特殊性,考虑online类型
+% 5. 报告类型与book有点类似,出版项处理与book一样,但有时又要有修改和更新日期
+% 因此考虑用一种类型来输出,使用report类型
+% 6. 手册/学位论文等类型与book有点类似,但对于出版项处理时,有缺省时,直接省略,
+% 同时有version和edition的区别,因此考虑用一种类型来输出,使用manual类型
+% 7. 包括报告,学位论文在内的其它所有的类型,都做一个判断,当没有出版项时,
+% 且存在网址信息时,将其转换为online类型输出,否则都做为manual类型输出。
+% 8. 备选类型misc当存在网址时直接转换为online,由于howpublished域可用于描述
+% 更多的信息,因此不存在网址时,独立做一个备选格式
+% 9. 出版项主要以如下方式处理:
+% (a) location+institution+date 仅用于连续出版物
+% (b)publisher+location+date 用于需要完整输出出版项的类型,比如book,collection,proceedings,in*,report
+% (c)institution+location+date 用于出版项缺失时不输出的类型,包括manual,thesis,archive等其他类型
+% (d)printlist{insitution} 用于电子资源,仅输出出版者或组织,为数据映射方便,本来默认的organization域转换为用insitution输出。
+% (e) 不输出,主要用于连续出版物析出的文献
+% 10. 日期以如下方式处理:
+% date 由于存在biblatex选项,因此通过选项控制,数据源为date解析数据或year
+% urldate 由于存在biblatex选项,因此通过选项控制,输出到日,且用[]包围,数据源为urldate
+% newsdate 用于公告日期,公开日期或新闻日期,输出到日,但无包围符号,数据源为date
+% modifydate 用于更新或修改日期,输出到日,且用()包围,数据源为date或enddate或eventdate
+
+
+\DeclareSourcemap{
+\maps[datatype=bibtex]{%
+ \map{%当没有作者时将editor转成author
+ \pernottype{inbook}%因为in系列中editor可能用来表示bookauthor,所以排除
+ \pernottype{inproceedings}
+ \pernottype{incollection}
+ \pernottype{periodical}%因为peridical直接使用editor,所以排除
+ %注意notfield在低版本biblatex中没有
+ %\step[notfield=author,final]%当author不存在,将editor复制给author
+ \step[fieldsource=editor,fieldtarget=author]%并删除editor
+ }
+ \map{%当没有作者时将translator转成author
+ \pernottype{inbook}
+ \pernottype{inproceedings}
+ \pernottype{incollection}
+ %\step[notfield=author,final]%当author不存在,将translator复制给author
+ \step[fieldsource=translator,fieldtarget=author]%并删除translator
+ }
+ \map{%让address和location同步,biblatex中address是location的别名
+ %因此输出的时候只有location信息,但处理过程中是可以存在address的。
+ %\step[notfield=address,final]
+ \step[fieldsource=location,final]
+ \step[fieldset=address,origfieldval]
+ }
+ \map{%让address和location同步
+ %\step[notfield=location,final]
+ \step[fieldsource=address,final]
+ \step[fieldset=location,origfieldval]
+ }
+ \map{%处理在bib文件用mark标记文献类型标识符的情况
+ \step[fieldsource=mark,final]
+ \step[fieldset=usera, origfieldval]
+ }
+ \map{%处理在bib文件中直接给出文献的姓名格式为lowercase的情况
+ \step[fieldsource=nameformat,match=lowercase,final]
+ \step[fieldset=namefmtid,fieldvalue={1}]
+ }
+ \map{%处理在bib文件中直接给出文献的姓名格式为givenahead的情况
+ \step[fieldsource=nameformat,match=givenahead,final]
+ \step[fieldset=namefmtid,fieldvalue={2}]
+ }
+ \map{%处理在bib文件中直接给出文献的姓名格式为familyahead的情况
+ \step[fieldsource=nameformat,match=familyahead,final]
+ \step[fieldset=namefmtid,fieldvalue={3}]
+ }
+ \map{%处理在bib文件中直接给出文献的姓名格式为pinyin的情况
+ \step[fieldsource=nameformat,match=pinyin,final]
+ \step[fieldset=namefmtid,fieldvalue={4}]
+ }
+ \map{%根据article确定文献类型标识符
+ \pertype{article}
+ \step[fieldset=usera, fieldvalue={J}]
+ }
+ \map{%根据periodical确定文献类型标识符
+ \pertype{periodical}
+ \step[fieldset=usera, fieldvalue={J}]
+ \step[fieldsource=author] %有时会把author和editor混淆,处理后使用editor
+ \step[fieldset=editor, origfieldval]
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{%根据增加一个新闻报纸的类型newspaper确定文献类型标识符
+ \pertype{newspaper}
+ \step[fieldset=usera, fieldvalue={N}]
+ \step[fieldset=note, fieldvalue=news]%因为没有专门的驱动,记录note方便映射为article后判断
+ }
+ \map{%对应增加的一个数据库类型database确定文献类型标识符
+ \pertype{database}
+ \step[fieldset=usera, fieldvalue={DB}]
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{%对应增加的一个数据集类型dataset确定文献类型标识符
+ \pertype{dataset}
+ \step[fieldset=usera, fieldvalue={DS}]%
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{%对应增加的一个软件类型software确定文献类型标识符
+ \pertype{software}
+ \step[fieldset=usera, fieldvalue={CP}]
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{%对应增加的一个舆图类型map确定文献类型标识符
+ \pertype{map}
+ \step[fieldset=usera, fieldvalue={CM}]%
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{%对应增加的一个档案类型archive确定文献类型标识符
+ \pertype{archive}
+ \step[fieldset=usera, fieldvalue={A}]
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{%因为misc类型本身就是没有类型,而不像其它文献有明确的类型,所以
+ %当misc类型带有网址时,直接将其转换为online类型
+ \pertype{misc}
+ \step[fieldsource=url,final]
+ \step[typesource=misc,typetarget=online]
+ }
+ \map{%对应增加的一个备选类型misc确定文献类型标识符
+ \pertype{misc}
+ \step[fieldset=usera, fieldvalue={Z}]%
+ }
+ \map{
+ \pertype{book}
+ \pertype{inbook}
+ \step[fieldset=usera, fieldvalue={M}]
+ \step[fieldsource=version] %有时会把version和edition混淆,处理后直接用edition
+ \step[fieldset=edition, origfieldval]
+ }
+ \map{%兼容老的standard类型,确定文献类型标识符
+ \pertype{standard}
+ \step[fieldset=usera, fieldvalue={S}]
+ \step[fieldset=note, fieldvalue=standard]%因为没有专门的驱动,记录note方便映射为book和inbook后判断
+ }
+ \map{
+ \pertype{patent}
+ \step[fieldset=usera, fieldvalue={P}]
+ }
+ \map{
+ \pertype{inproceedings}
+ \pertype{conference}%兼容老的conference类型
+ \step[fieldset=usera, fieldvalue={C}]
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
+ \step[fieldset=publisher, origfieldval]
+ }
+ \map{
+ \pertype{proceedings}
+ \step[fieldset=usera, fieldvalue={C}]
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
+ \step[fieldset=publisher, origfieldval]
+ }
+ \map{
+ \pertype{incollection}
+ \step[fieldset=usera, fieldvalue={G}]
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
+ \step[fieldset=publisher, origfieldval]
+ }
+ \map{
+ \pertype{collection}
+ \step[fieldset=usera, fieldvalue={G}]
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
+ \step[fieldset=publisher, origfieldval]
+ }
+ \map{
+ \pertype{report}
+ \pertype{techreport}%兼容老的techreport类型
+ \step[fieldset=usera, fieldvalue={R}]
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
+ \step[fieldset=publisher, origfieldval]
+ }
+ \map{
+ \pertype{thesis}
+ \pertype{mastersthesis}%兼容老的mastersthesis和phdthesis类型
+ \pertype{phdthesis}
+ \step[fieldset=usera, fieldvalue={D}]
+ \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{
+ \pertype{online}
+ \pertype{electronic}%兼容老的electronic类型
+ \pertype{www}%兼容老的www类型
+ \step[fieldset=usera, fieldvalue={EB}]
+ \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]%因为online的出版项处理类似手册
+ \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{
+ \pertype{manual}
+ \step[fieldset=usera, fieldvalue={A}]
+ \step[fieldsource=edition]%有时会把version和edition混淆,处理后使用version
+ \step[fieldset=version, origfieldval]
+ \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{
+ \pertype{unpublished}
+ \step[fieldset=usera, fieldvalue={Z}]
+ }
+ \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
+ \step[fieldsource={author}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
+ }%
+ \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
+ \step[fieldsource={editor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
+ }%
+ \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
+ \step[fieldsource={translator}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
+ }%
+ \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
+ \step[fieldsource={bookauthor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
+ }%
+ \map{%处理一些用year表示date的情况
+ %这样处理将会设置date域,并使得labeldatesource变为空,因为date的前缀为空(如果是urldate,那么labeldatesource就是url)。
+ %同时date域会被biblatex自动解析为year,month,day,并且覆盖原来的year信息
+ \step[fieldsource=year]
+ \step[fieldset=date, origfieldval]
+ }
+ \map{%将entrykey放入keywords中用于后期使用
+ \step[fieldsource=entrykey]
+ \step[fieldset=keywords, origfieldval]
+ }
+ \map{\step[fieldsource=title,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
+ \step[fieldset=userd,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
+ }
+ \map{%
+ \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final]
+ \step[fieldset=userd,fieldvalue={russian}]%俄语
+ }
+ \map{%
+ \step[fieldsource=title,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
+ \step[fieldset=userd,fieldvalue={japanese}]%日语
+ } %确定形式后可增加类似andotherscn这样的本地化字符串处理
+ \map{%
+ \step[fieldsource=title,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
+ \step[fieldset=userd,fieldvalue={korean}]%韩语
+ }
+ \map{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题
+ \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%
+ \step[fieldset=userd, fieldvalue={chinese}]
+ }
+ \map{%将没有设置userd,且存在title域的默认设置为英文
+ \step[fieldsource=title,final]
+ \step[fieldset=userd,fieldvalue={english}]
+ }
+ \map{\step[fieldsource=author,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
+ \step[fieldset=userf,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
+ }
+ \map{%
+ \step[fieldsource=author,match=\regexp{[\x{0400}-\x{052F}]},final]
+ \step[fieldset=userf,fieldvalue={russian}]%俄语
+ }
+ \map{%
+ \step[fieldsource=author,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
+ \step[fieldset=userf,fieldvalue={japanese}]%日语
+ } %确定形式后可增加类似andotherscn这样的本地化字符串处理
+ \map{%
+ \step[fieldsource=author,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
+ \step[fieldset=userf,fieldvalue={korean}]%韩语
+ }
+ \map{%作者的中文判断
+ \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
+ \step[fieldset=userf, fieldvalue={chinese}]
+ }
+ \map{%将没有设置userf,且存在author域的默认设置为英文
+ \step[fieldsource=author,final]
+ \step[fieldset=userf,fieldvalue={english}]
+ }
+ \map{\step[fieldsource=translator,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
+ \step[fieldset=usere,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
+ }
+ \map{%
+ \step[fieldsource=translator,match=\regexp{[\x{0400}-\x{052F}]},final]
+ \step[fieldset=usere,fieldvalue={russian}]%俄语
+ }
+ \map{%
+ \step[fieldsource=translator,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
+ \step[fieldset=usere,fieldvalue={japanese}]%日语
+ } %确定形式后可增加类似andotherscn这样的本地化字符串处理
+ \map{%
+ \step[fieldsource=translator,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
+ \step[fieldset=usere,fieldvalue={korean}]%韩语
+ }
+ \map{%译者的中文判断
+ \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
+ \step[fieldset=usere, fieldvalue={chinese}]
+ }
+ \map{%将没有设置usere,且存在translator域的默认设置为英文
+ \step[fieldsource=translator,final]
+ \step[fieldset=usere,fieldvalue={english}]
+ }
+ \map{\step[fieldsource=editor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
+ \step[fieldset=userc,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
+ }
+ \map{%
+ \step[fieldsource=editor,match=\regexp{[\x{0400}-\x{052F}]},final]
+ \step[fieldset=userc,fieldvalue={russian}]%俄语
+ }
+ \map{%
+ \step[fieldsource=editor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
+ \step[fieldset=userc,fieldvalue={japanese}]%日语
+ } %确定形式后可增加类似andotherscn这样的本地化字符串处理
+ \map{%
+ \step[fieldsource=editor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
+ \step[fieldset=userc,fieldvalue={korean}]%韩语
+ }
+ \map{%编者的中文判断
+ \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5
+ \step[fieldset=userc, fieldvalue={chinese}]
+ }
+ \map{%将没有设置userc,且存在editor域的默认设置为英文
+ \step[fieldsource=editor,final]
+ \step[fieldset=userc,fieldvalue={english}]
+ }
+ \map{\step[fieldsource=bookauthor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
+ \step[fieldset=userb,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
+ }
+ \map{%
+ \step[fieldsource=bookauthor,match=\regexp{[\x{0400}-\x{052F}]},final]
+ \step[fieldset=userb,fieldvalue={russian}]%俄语
+ }
+ \map{%
+ \step[fieldsource=bookauthor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
+ \step[fieldset=userb,fieldvalue={japanese}]%日语
+ } %确定形式后可增加类似andotherscn这样的本地化字符串处理
+ \map{%
+ \step[fieldsource=bookauthor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
+ \step[fieldset=userb,fieldvalue={korean}]%韩语
+ }
+ \map{%编者的中文判断
+ \step[fieldsource=bookauthor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5
+ \step[fieldset=userb, fieldvalue={chinese}]
+ }
+ \map{%将没有设置userc,且存在editor域的默认设置为英文
+ \step[fieldsource=bookauthor,final]
+ \step[fieldset=userb,fieldvalue={english}]
+ }
+ \map{\step[fieldsource=userd,final]%userd存在则用根据标题的语言设定language
+ \step[fieldset=language,origfieldval]%本身language存在则不设定
+ }
+ \map{\step[fieldsource=userf,final]%userd不存在,而userf存在则根据author的语言设定language
+ \step[fieldset=language,origfieldval]
+ }%如果没有作者和标题,那么剩下的最可能有意义的只有网址了,而网址通常是英文的,因此不用再进一步对其它域进行判断了。
+ \map{%将没有设置的language设置成en,即认为不是中文的就是英文的。
+ \step[fieldset=language,fieldvalue={english}]
+ }
+ \map{%一条文献的语言已经设定在language域中,由于出版项相关宏中使用userd判断,
+ %所以将一条文献的主体语言设定到userd中,本身前面userd已经设定,但没有处理无标题的情况,
+ %这里的处理等价于没有标题时,利用作者的语言设定userd,再没有作者,则默认用英文设定userd
+ \step[fieldsource=language]
+ \step[fieldset=userd,origfieldval]
+ }
+ \map{%当文献给出language域时,设置文献要使用的本地化字符串的语言
+ %biblatex 3.11及以下版本仅有match是区分大小写的,而3.12版开始用matchi来区分大小,而match不区分
+ %这里为兼容3.11及以下版本,所以用一个复杂一点的正则表达式
+ \step[fieldsource=language,match=\regexp{(e|E)(n|N)(g|G)(l|L)(i|I)(s|S)(h|H)},final]
+ \step[fieldset=langid,fieldvalue={english}]
+ \step[fieldset=lansortorder,fieldvalue=\lanenorder]
+ }
+ \map{
+ \step[fieldsource=language,match=\regexp{(r|R)(u|U)(s|S)(s|S)(i|I)(a|A)(n|N)},final]
+ \step[fieldset=langid,fieldvalue={russian}]
+ \step[fieldset=lansortorder,fieldvalue=\lanruorder]
+ }
+ \map{%
+ \step[fieldsource=language,match=\regexp{(f|F)(r|R)(e|E)(n|N)(c|C)(h|H)},final]
+ \step[fieldset=langid,fieldvalue={french}]
+ \step[fieldset=lansortorder,fieldvalue=\lanfrorder]
+ }
+ \map{%
+ \step[fieldsource=language,match=\regexp{(c|C)(h|H)(i|I)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english,
+ \step[fieldset=langid,fieldvalue={english}]
+ \step[fieldset=lansortorder,fieldvalue=\lancnorder]
+ }
+ \map{%
+ \step[fieldsource=language,match=\regexp{(j|J)(a|A)(p|P)(a|A)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english,
+ \step[fieldset=langid,fieldvalue={english}]
+ \step[fieldset=lansortorder,fieldvalue=\lanjporder]
+ }
+ \map{%
+ \step[fieldsource=language,match=\regexp{(k|K)(o|O)(r|R)(e|E)(a|A)(n|N)},final]%中日韩语目前都用english,
+ \step[fieldset=langid,fieldvalue={english}]
+ \step[fieldset=lansortorder,fieldvalue=\lankrorder]
+ }
+}
+}
+
+
+%
+% 修改输入的参考文献数据,样式层的操作
+%
+% 原理方法:因为biblatex3.0版的map不使用foreach选项,所以需要一个一个写,以处理特殊字符
+\defversion{3.0}{map}{
+ \DeclareStyleSourcemap{
+ \maps[datatype=bibtex]{
+ \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook,
+ %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义
+ %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断
+ \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook
+ \step[typesource=standard, typetarget=inbook, final]
+ }
+ \map{%剩下的全部映射为book
+ \step[typesource=standard, typetarget=book, final]
+ }
+% \map{%先于标准样式的driver层映射,以取消type设置
+% \step[typesource=mastersthesis, typetarget=thesis, final]
+% %\step[fieldset=type, fieldvalue=mathesis]
+% }
+% \map{%先于标准样式的driver层映射,以取消type设置
+% \step[typesource=phdthesis, typetarget=thesis, final]
+% %\step[fieldset=type, fieldvalue=phdthesis]
+% }
+ \map{%先于标准样式的driver层映射,以取消type设置
+ \step[typesource=techreport, typetarget=report, final]
+ %\step[fieldset=type, fieldvalue=techreport]
+ }
+ \map{%
+ \pertype{report}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=report,typetarget=online]
+ \step[fieldset=note,fieldvalue={report}]
+ }
+ \map{%
+ \pertype{thesis}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=thesis,typetarget=online]
+ }
+ \map{%
+ \pertype{manual}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=manual,typetarget=online]
+ }
+ \map{%
+ \pertype{unpublished}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=unpublished,typetarget=online]
+ }
+ \map{%
+ \pertype{database}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=databasetypetarget=online]
+ }
+ \map{%
+ \pertype{dataset}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=dataset,typetarget=online]
+ }
+ \map{%
+ \pertype{software}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=software,typetarget=online]
+ }
+ \map{%
+ \pertype{map}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=map,typetarget=online]
+ }
+ \map{%
+ \pertype{archive}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=archive,typetarget=online]
+ }
+ \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确)
+ \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸
+ \step[fieldset=keywords, fieldvalue={,}, append]
+ \step[fieldset=keywords, origfieldval, append]
+ }
+ \map[overwrite]{%title,booktitle,journaltitle,journal,publisher,address,location,institution,organization
+ \step[fieldsource={title}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
+ }
+ \map[overwrite]{
+ \step[fieldsource={booktitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
+ }
+ \map[overwrite]{
+ \step[fieldsource={journaltitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
+ }
+ \map[overwrite]{
+ \step[fieldsource={journal}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
+ }
+ \map[overwrite]{
+ \step[fieldsource={publisher}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
+ }
+ \map[overwrite]{
+ \step[fieldsource={address}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
+ }
+ \map[overwrite]{
+ \step[fieldsource={location}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
+ }
+ \map[overwrite]{
+ \step[fieldsource={institution}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
+ }
+ \map[overwrite]{
+ \step[fieldsource={booktitle}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}]
+ }
+ \map[overwrite]{
+ \step[fieldsource={booktitle}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}]
+ }
+ }
+ }
+}
+
+%
+% 修改输入的参考文献数据,样式层的操作
+%
+% 原理方法:biblatex3.4以上版本
+\defversion{3.4}{map}{
+ \DeclareStyleSourcemap{
+ \maps[datatype=bibtex]{
+ \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook,
+ %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义
+ %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断
+ \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook
+ \step[typesource=standard, typetarget=inbook, final]
+ }
+ \map{%剩下的全部映射为book
+ \step[typesource=standard, typetarget=book, final]
+ }
+% \map{%先于标准样式的driver层映射,以取消type设置
+% \step[typesource=mastersthesis, typetarget=thesis, final]
+% %\step[fieldset=type, fieldvalue=mathesis]
+% }
+% \map{%先于标准样式的driver层映射,以取消type设置
+% \step[typesource=phdthesis, typetarget=thesis, final]
+% %\step[fieldset=type, fieldvalue=phdthesis]
+% }
+ \map{%先于标准样式的driver层映射,以取消type设置
+ \step[typesource=techreport, typetarget=report, final]
+ %\step[fieldset=type, fieldvalue=techreport]
+ }
+ \map{%
+ \pertype{report}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=report,typetarget=online]
+ \step[fieldset=note,fieldvalue={report}]
+ }
+ \map{%
+ \pertype{thesis}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=thesis,typetarget=online]
+ }
+ \map{%
+ \pertype{manual}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=manual,typetarget=online]
+ }
+ \map{%
+ \pertype{unpublished}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=unpublished,typetarget=online]
+ }
+ \map{%
+ \pertype{database}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=databasetypetarget=online]
+ }
+ \map{%
+ \pertype{dataset}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=dataset,typetarget=online]
+ }
+ \map{%
+ \pertype{software}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=software,typetarget=online]
+ }
+ \map{%
+ \pertype{map}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=map,typetarget=online]
+ }
+ \map{%
+ \pertype{archive}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=archive,typetarget=online]
+ }
+ \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确)
+ \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸
+ \step[fieldset=keywords, fieldvalue={,}, append]
+ \step[fieldset=keywords, origfieldval, append]
+ }
+ \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{
+ \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}]
+ }
+ \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{
+ \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}]
+ }
+ \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,%
+ address,location,institution,organization}]{
+ \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
+ }
+ }
+ }
+}
+
+\iftoggle{iftlfive}%
+ {\switchversion{3.0}{map}}%%当采用biblatex<=3.2版本时
+ {\switchversion{3.4}{map}}%%当采用3.3<=biblatex版本时
+
+
+%
+% 不同语言分集调整的实现方式
+%
+% 原理方法:利用样式层的动态数据修改lansortorder域来实现排序
+\def\dealsortlan{
+ \DeclareStyleSourcemap{
+ \maps[datatype=bibtex]{
+ \map[overwrite]{%当文献给出language域时,设置文献要使用的本地化字符串的语言
+ \step[fieldsource=language,match=english,final]
+ \step[fieldset=lansortorder,fieldvalue=\lanenorder]
+ }
+ \map[overwrite]{
+ \step[fieldsource=language,match=russian,final]
+ \step[fieldset=lansortorder,fieldvalue=\lanruorder]
+ }
+ \map[overwrite]{%
+ \step[fieldsource=language,match=french,final]
+ \step[fieldset=lansortorder,fieldvalue=\lanfrorder]
+ }
+ \map[overwrite]{%
+ \step[fieldsource=language,match=chinese,final]%中日韩语目前都用english,
+ \step[fieldset=lansortorder,fieldvalue=\lancnorder]
+ }
+ \map[overwrite]{%
+ \step[fieldsource=language,match=japanese,final]%中日韩语目前都用english,
+ \step[fieldset=lansortorder,fieldvalue=\lanjporder]
+ }
+ \map[overwrite]{%
+ \step[fieldsource=language,match=korean,final]%中日韩语目前都用english,
+ \step[fieldset=lansortorder,fieldvalue=\lankrorder]
+ }
+ }
+ }
+}
+
+%
+%驱动别名等价于驱动层映射
+%
+\DeclareBibliographyAlias{newspaper}{article}%
+\DeclareBibliographyAlias{inproceedings}{inbook}%会议论文文献类型驱动
+\DeclareBibliographyAlias{conference}{inbook}%会议论文文献类型驱动
+\DeclareBibliographyAlias{incollection}{inbook}%文集中析出文献类型驱动
+\DeclareBibliographyAlias{collection}{book}%%文集类型驱动
+\DeclareBibliographyAlias{proceedings}{book}%会议论文集文献类型驱动
+\DeclareBibliographyAlias{thesis}{manual}%学位论文驱动
+\DeclareBibliographyAlias{unpublished}{manual}%其它类型驱动
+\DeclareBibliographyAlias{database}{manual}
+\DeclareBibliographyAlias{dataset}{manual}
+\DeclareBibliographyAlias{software}{manual}
+\DeclareBibliographyAlias{map}{manual}
+\DeclareBibliographyAlias{archive}{manual}
+
+%=====================================================================
+% 设置排序格式
+%=====================================================================
+%
+% 排序格式,用降序,及userb域,针对biblatex3.7及以下版本
+%
+\defversion{3.7}{sort}{%这是3.4版的,3.7版略有差异,但不大,后面有注释
+ \DeclareSortingScheme{gb7714-2015}{
+ \sort{
+ \field{presort}
+ }
+ %\sort[final]{
+ %\field{sortkey}
+ %}
+ \sort{
+ \field{lansortorder}%language
+ }
+ \sort{
+ \field{sortkey}
+ }
+ \sort{%[direction=descending]
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ }
+ \sort{
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume}
+ \literal{0000}%3.7版是\literal{0}
+ }
+ }
+
+ %降序的nyt
+ \DeclareSortingScheme{gbnytd}{
+ \sort{
+ \field{presort}
+ }
+ %\sort[final]{
+ %\field{sortkey}
+ %}
+ \sort{
+ \field{lansortorder}%language
+ }
+ \sort[direction=descending]{
+ \field{sortkey}
+ }
+ \sort[direction=descending]{
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ }
+ \sort{
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume}
+ \literal{0000}%3.7版是\literal{0}
+ }
+ }
+
+ %降序的ynt
+ \DeclareSortingScheme{gbyntd}{
+ \sort{
+ \field{presort}
+ }
+ %\sort[final]{
+ %\field{sortkey}
+ %}
+ \sort{
+ \field{lansortorder}%language
+ }
+ \sort[direction=descending]{
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sortkey}
+ }
+ \sort{
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume}
+ \literal{0000}%3.7版是\literal{0}
+ }
+ }
+
+ %升序的ynt
+ \DeclareSortingScheme{gbynta}{
+ \sort{
+ \field{presort}
+ }
+ %\sort[final]{
+ %\field{sortkey}
+ %}
+ \sort{
+ \field{lansortorder}%language
+ }
+ \sort{
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sortkey}
+ }
+ \sort{
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume}
+ \literal{0000}%3.7版是\literal{0}
+ }
+ }
+}
+
+
+%
+% 排序格式,用降序,及userb域,针对biblatex3.8及以上版本
+%
+\defversion{3.8}{sort}{
+ \DeclareSortingTemplate{gb7714-2015}{
+ \sort{
+ \field{presort}
+ }
+ %\sort[final]{
+ %\field{sortkey}
+ %}
+ \sort{
+ \field{lansortorder}%language
+ }
+ \sort{
+ \field{sortkey}
+ }
+ \sort{%[direction=descending]
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ }
+ \sort{
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field{volume}
+ \literal{0}
+ }
+ }
+
+ %降序的nyt
+ \DeclareSortingTemplate{gbnytd}{
+ \sort{
+ \field{presort}
+ }
+% \sort[final]{
+% \field{sortkey}
+% }
+ \sort{
+ \field{lansortorder}%language
+ }
+ \sort[direction=descending]{
+ \field{sortkey}
+ }
+ \sort[direction=descending]{%
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ }
+ \sort{
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field{volume}
+ \literal{0}
+ }
+ }
+
+ %降序的ynt
+ \DeclareSortingTemplate{gbyntd}{
+ \sort{
+ \field{presort}
+ }
+% \sort[final]{
+% \field{sortkey}
+% }
+ \sort{
+ \field{lansortorder}%language
+ }
+ \sort[direction=descending]{
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sortkey}
+ }
+ \sort{%
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field{volume}
+ \literal{0}
+ }
+ }
+
+ %升序的ynt
+ \DeclareSortingTemplate{gbynta}{
+ \sort{
+ \field{presort}
+ }
+% \sort[final]{
+% \field{sortkey}
+% }
+ \sort{
+ \field{lansortorder}%language
+ }
+ \sort{%[direction=ascending]
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sortkey}
+ }
+ \sort{%
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field{volume}
+ \literal{0}
+ }
+ }
+}
+
+
+\ifboolexpr{
+test {\iftoggle{iftlfive}}
+or
+test {\iftoggle{iftlsix}}
+or
+test {\iftoggle{iftlseven}}%biblatex<=3.7
+}{\switchversion{3.7}{sort}}{\switchversion{3.8}{sort}}%3.8<=biblatex
+
+%=====================================================================
+% 参考文献表环境
+%=====================================================================
+%
+% 列表格式
+%
+% 增加一个\bibitemindent尺寸用于控制list环境的itemindent
+% v1.0l,20180615,hzz
+% v1.0t,20200319,hzz,增加尺寸\biblabelextend使某些字体下标签宽度不足时可增加标签宽度
+\setlength{\bibhang}{\biblabelsep}%
+\newlength{\bibitemindent}
+\setlength{\bibitemindent}{0pt}
+\newlength{\biblabelextend}
+\setlength{\biblabelextend}{0pt}
+
+
+\defbibenvironment{bibliography}
+ {\list
+ {\printtext[labelnumberwidth]{%
+ \printfield{labelprefix}%
+ \printfield{labelnumber}}}
+ {\addtolength{\labelnumberwidth}{\biblabelextend}%
+ \setlength{\labelwidth}{\labelnumberwidth}%
+ \setlength{\labelsep}{\biblabelsep}%
+ \setlength{\leftmargin}{\bibhang}%
+ \addtolength{\leftmargin}{\labelnumberwidth}%
+ \setlength{\itemindent}{\bibitemindent}%
+ \setlength{\itemsep}{\bibitemsep}%
+ \setlength{\parsep}{\bibparsep}}%
+ \renewcommand*{\makelabel}[1]{\hss##1}}
+ {\endlist}
+ {\item}
+
+%
+% 顺序编码制-标签对齐方式处理
+%
+% 原理方法:利用选项提供的计数器数值做选择
+% 左对齐,右对齐为list环境下的处理,此时list环境的\labelwidth只能设置一个,是最宽标签的宽度
+% 项对齐则是在段落环境下做的处理。
+% 左对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距可变
+% 右对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距相等,标签与页边距离可变
+% 项对齐时,序号标签贴在页边,序号标签与参考文献项内容的间距相等
+% 修改序号标签格式为:
+% \DeclareFieldFormat{shorthandwidth}{\mkbibbrackets{#1}} %源来自numeric.BBX
+% \DeclareFieldFormat{labelnumberwidth}{\ttfamily\mkbibbrackets{#1}\hfill}
+\DeclareFieldFormat{labelnumberwidth}{%
+\ifcase\value{gbalignlabel}%右对齐,整个标签为右对齐
+ \mkgbnumlabel{#1}%
+\or%左对齐,整个标签为左对齐
+ \mkgbnumlabel{#1}\hfill%
+\or%中间对齐,比如:序号数字居于[]中间
+ \hfil\mkgbnumlabel{\hfill#1\hfill}\hfil%
+\fi}
+
+%
+% 修改序号标签格式为以各条参文献为基础进行对齐的方式,即序号与条目内容间隔相等的方式。
+\def\setaligngbstyle{%
+\def\blx at bibitem##1{%
+ \blx at ifdata{##1}
+ {\begingroup
+ \blx at getdata{##1}%
+ \blx at bibcheck
+ \iftoggle{blx at skipentry}{}{%
+ \blx at setdefaultrefcontext{##1}%
+ \global\let\blx at noitem\@empty
+ \blx at setoptions@type\abx at field@entrytype
+ \blx at setoptions@entry
+ \blx at thelabelnumber
+ \addtocounter{instcount}\@ne
+ \blx at initsep
+ \blx at namesep
+ \csuse{blx at item@\blx at theenv}\relax
+% \blx at initsep %移动到上面去,恢复bibnamesep等的作用机制
+% \blx at namesep
+ \csuse{blx at hook@bibitem}%
+ \blx at execute
+ \blx at initunit
+ \blx at anchor
+ \blx at beglangbib
+ \bibsentence
+ \blx at pagetracker
+ \blx at driver\abx at field@entrytype
+ \blx at postpunct
+ \blx at endlangbib}%
+ \par\endgroup}%这里增加了一个\par
+ {}}
+\newlength{\lengthid}
+\newlength{\lengthlw}
+\newcommand{\itemcmd}{%
+\settowidth{\lengthid}{\mkgbnumlabel{\printfield{labelnumber}}}
+\addtolength{\lengthid}{\biblabelsep}
+\setlength{\lengthlw}{\textwidth}
+\addtolength{\lengthlw}{-\lengthid}
+\addvspace{\bibitemsep}%恢复\bibitemsep的作用
+%\parshape 2 0em \textwidth \lengthid \lengthlw
+\hangindent\lengthid
+\mkgbnumlabel{\printfield{labelnumber}}%
+\hspace{\biblabelsep}}
+%
+% 简单的段落环境
+\defbibenvironment{bibliography}
+{\begingroup\setlength{\parindent}{0em}}
+{\endgroup}
+{\itemcmd}}
+
+
+%=====================================================================
+% 设置单元或块等的标点
+%=====================================================================
+\renewrobustcmd*{\bibinithyphendelim}{\addhighpenspace}%用于处理姓名中名部分存在-的情况,比如ZHANG Yu-xin
+\renewcommand*{\subtitlepunct}{\addcolon\addspace} %修改标题和其它标题信息间的标点,来源biblatex.def,
+%
+% 利用set实现的多语言文献不同语言间的分隔符
+% 20170411,双语之间用newline替换par,避免采用gb7714-2015的项对齐方式第二语言间分段导致没有缩进
+%
+% 原理方法:set方法可以参考3.11.5 Entry Sets,4.11.1 Entry Sets
+% 这里调整一下两种语言参考文献的间隔,源来自biblatex.def
+\renewcommand*{\entrysetpunct}{\adddot\newline\nobreak}
+\renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%%页码引用格式的修改,修改为用冒号
+%\renewcommand{\relateddelim}{}%\par
+
+%=====================================================================
+% 修改域的格式,重定义域的输出宏
+%=====================================================================
+%
+% 新增文献类型标识符的格式
+% []前的nobreak,从GB4.1节的例子看不应该加,所以去掉
+% 但因为考虑到cjk字符和[]之间可能添加空格,所以仍然加上
+% 而[]中间的内容,从4.6.2节的例子看也是可以分割的,因此内部的nobreak也可以去掉
+%
+\DeclareFieldFormat{gbtypeflag}{%
+\iftoggle{bbx:gbmedium}%
+{\iftoggle{bbx:url}%
+ {\iffieldundef{url}%当存在url时,增加一个OL标识符
+ {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}%
+ {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}%
+ }%
+ {\ifentrytype{online}%
+ {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}%
+ {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}%
+ }}%
+ {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}%
+}
+
+%
+% 新增用于报纸的文献类型标识符的格式
+%
+\DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper
+\iftoggle{bbx:gbmedium}%
+{\iftoggle{bbx:url}%
+ {\iffieldundef{url}%当存在url时,增加一个OL标识符
+ {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
+ {\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}%
+ }%
+ {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
+}{\nobreak\printtext{[}\nobreak N\printtext{]}\nobreak}%
+}
+
+%
+% 新增用于标准的文献类型标识符的格式
+%
+\DeclareFieldFormat{gbtypeflags}{%用于标准standard
+\iftoggle{bbx:gbmedium}%
+{\iftoggle{bbx:url}%
+ {\iffieldundef{url}%当存在url时,增加一个OL标识符
+ {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
+ {\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}%
+ }%
+ {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
+}{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}%
+}
+
+%
+% 重设title等参考文献信息的输出格式
+%
+% 原理方法:修改来自biblatex.def文件的原格式
+\newcommand{\bibtitlefont}{}
+\newcommand{\bibauthorfont}{}
+\newcommand{\bibpubfont}{}
+
+\DeclareFieldFormat{title}{#1\adddot\addthinspace}
+\DeclareFieldFormat{journaltitle}{#1\isdot}%添加\isdot用于缩写名带点情况,将其转换为缩写点,便于标点的追踪
+\DeclareFieldFormat{issuetitle}{#1}
+\DeclareFieldFormat{maintitle}{#1}
+\DeclareFieldFormat{booktitle}{#1}
+\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉
+ [article,patent,thesis,unpublished]
+ {title}{#1\adddot\addthinspace}%\mkbibquote{#1\isdot}
+\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉
+ [inbook,incollection,inproceedings]
+ {title}{#1}%\nopunct\unspace
+\DeclareFieldFormat{url}{\url{#1}} %%url相关输出,url域修改如本行,源来自biblatex.def
+\def\UrlFont{\rmfamily}%设置url字体为roman字体%\ttfamily
+%\urlstyle{rm} %使用这句也一样
+\setcounter{biburlnumpenalty}{100} %让url可以在数字后断行
+\setcounter{biburlucpenalty}{100} %让url可以在大写字母后断行
+\setcounter{biburllcpenalty}{100} %让url可以在小写字母后断行
+\DeclareFieldFormat{doi}{%
+ \rmfamily{DOI}\addcolon\space
+ \ifhyperref
+ {\href{https://doi.org/#1}{\nolinkurl{#1}}}
+ {\nolinkurl{#1}}}
+%
+% 标题的字母大小写格式修改
+%
+% 注意:修改标题的字母大小写,不能用前面的title的格式而要用titlecase
+% 因为titlecase is applied to the contents of the field directly,title is not
+%\DeclareFieldFormat{titlecase}{\MakeCapital#1}%重设标题格式,将其修改为首字母大写
+\DeclareFieldFormat{titlecase}{\iftoggle{bbx:titlelink}{%
+\iffieldundef{url}{\MakeCapital#1}{%
+\href{\thefield{url}}{#1}}}{\MakeCapital#1}}%重设标题格式,将其修改为首字母大写
+\DeclareFieldFormat{pages}{#1}%去掉前面引导页码的pp.等字符,\mkpageprefix[bookpagination]{#1}
+\DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{-}}%将页码间隔符替换会英文的短横线
+\DefineBibliographyExtras{russian}{\renewcommand*{\bibrangedash}{-}}%将页码间隔符替换会英文的短横线
+
+\def\execgbfdfmtstd{%恢复到标准样式的设置
+\DeclareFieldFormat{title}{\mkbibemph{##1}}
+\DeclareFieldFormat
+ [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
+ {title}{\mkbibquote{##1\isdot}}
+\DeclareFieldFormat
+ [suppbook,suppcollection,suppperiodical]
+ {title}{##1}
+\DeclareFieldFormat{journaltitle}{\mkbibemph{##1}}
+\DeclareFieldFormat{issuetitle}{\mkbibemph{##1}}
+\DeclareFieldFormat{maintitle}{\mkbibemph{##1}}
+\DeclareFieldFormat{booktitle}{\mkbibemph{##1}}
+\DeclareFieldFormat{url}{\mkbibacro{URL}\addcolon\space\url{##1}}
+\DeclareFieldFormat{titlecase}{##1}
+\DeclareFieldFormat{pages}{\mkpageprefix[bookpagination]{##1}}
+}
+
+%
+% 文献标题后的标点问题
+% v1.0k,20180405,为texlive2017以上版本中的beamer兼容性做的处理,Hu Zhenzhen
+%
+% 原理方法:如下代码处理texlive2017以上版本中,beamer中文献的标题后出现两个点的情况:
+% texlive2017以上的beamer中对macro{title}做了patch,正常情况下不会出现两个点的情况,但由于
+% 之前为了处理texlive2015,2016下的title格式添加了adddot,导致出现两个点的情况,而且也影响
+% 析出文献的//符号的输出,因此再次对macro{title}做patch消除beamer中做apptocmd时添加的\newunitpunct
+\ifboolexpr{%
+ test{\iftoggle{iftlfive}}
+ or
+ test{\iftoggle{iftlsix}}
+ }{}%
+ {%texlive 2017对应iftlseven以上版本
+ \@ifclassloaded{beamer}{
+ \DeclareFieldFormat{title}{#1}%
+ \DeclareFieldFormat[article,patent,thesis,unpublished]{title}{#1}
+ \AtBeginDocument{%
+ \patchcmd{\abx at macro@title}{\newunitpunct}{}{}{}}}{}
+ }
+
+
+%
+% 修改译者位置格式
+%
+% 原理方法:修改来自biblatex.def文件的bytranslator+others宏的格式
+\renewbibmacro*{bytranslator+others}{\bibauthorfont%
+ \ifnameundef{translator}
+ {}
+ {%\usebibmacro{bytranslator+othersstrg}
+ %\setunit{\addspace}%
+ \printnames[bytranslator]{translator}%
+ \clearname{translator}%
+ %从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理
+ %比如生成cotranslator等用于调用cotranslator所代表的当地化字符串
+ \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。
+ %\setunit{\addspace}%
+ \newunit}%
+ \usebibmacro{withothers}}
+
+
+%
+% 修改作者数量超过限定值,做省略时的处理格式
+% v1.0,20160701,hzz
+% v1.0O,20190103,hzz,修改利用新定义的一个分隔符strandothersdelim
+%
+% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。
+\renewbibmacro*{name:andothers}{\bibauthorfont%
+ \ifboolexpr{
+ test {\ifnumequal{\value{listcount}}{\value{liststop}}}
+ and
+ test \ifmorenames
+ }{\ifnumgreater{\value{liststop}}{1}%
+ {\finalandcomma}%
+ {}%
+\printdelim{andothersdelim}\printdelim{strandothersdelim}%
+}{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如:
+%袁训来, 陈哲, 肖书海, 等.
+%胡泳, 范海燕, 译.
+%潘惠霞, 魏婧, 杨艳, 等译.
+\ifcurrentname{translator}{\addcomma\addthinspace}{}%为了实现上述第二个示例情况做的处理
+}}
+
+
+% 修改省略作者后的本地化字符串,比如et al.
+% v1.0o,20190103,hzz
+%
+% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andotherscn=“等”,否则用andothers=“et al.”。
+% 非默认情况,根据选项信息,选择选择强制中文或英文
+% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了
+% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置
+\DeclareDelimFormat{strandothersdelim}{%
+ \edef\userfieldabcde{userd}%这里使用\iffieldequalstr{labelnamesource}替代ifcurrentname因为标注中使用ifcurrentname无效
+ \iffieldequalstr{labelnamesource}{translator}{\edef\userfieldabcde{usere}}{}%
+ \iffieldequalstr{labelnamesource}{editor}{\edef\userfieldabcde{userc}}{}%
+ \iffieldequalstr{labelnamesource}{author}{\edef\userfieldabcde{userf}}{}%
+ \iffieldequalstr{labelnamesource}{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbcitelocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\ifbibstring{andothersincitecn}{\bibstring{andothersincitecn}}{\bibstring{andothers}}}{}%中文已经通过english本地化字符串定义
+ \iffieldequalstr{\userfieldabcde}{korean}{\ifbibstring{andotherskr}{\bibstring{andotherskr}}{\bibstring{andothers}}}{}%韩语未定义,所以与bib中一致
+ \iffieldequalstr{\userfieldabcde}{japanese}{\ifbibstring{andothersjp}{\bibstring{andothersjp}}{\bibstring{andothers}}}{}%日与同韩语
+ \iffieldequalstr{\userfieldabcde}{english}{\ifbibstring{andothersincite}{\bibstring{andothersincite}}{\bibstring{andothers}}}{}%英语已定义
+ \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%法语未定义,若要定义需要针对french本地化字符串定义
+ \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%俄语未定义,若要定义需要针对russian本地化字符串定义
+ \or%
+ \bibstring{andothersincitecn}%
+ \or%
+ \bibstring{andothersincite}%
+ \fi}
+
+
+\DeclareDelimFormat[bib,biblist]{strandothersdelim}{%
+ \edef\userfieldabcde{userd}%
+ \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
+ \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
+ \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
+ \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbbiblocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}%
+ \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andothersjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}%
+ \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%
+ \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%
+ \or%
+ \bibstring{andotherscn}%
+ \or%
+ \bibstring{andothers}%
+ \fi}
+
+%
+% 修改最后一个作者前的字符串,比如 and
+% v1.0o,20190103,hzz
+%
+% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andcn=“和”,否则用and=“and”。
+% 非默认情况,根据选项信息,选择选择强制中文或英文
+% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了
+% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置
+\DeclareDelimFormat{finalnamedelim}{%
+ \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
+% \addspace%
+ \edef\userfieldabcde{userd}%
+ \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
+ \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
+ \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
+ \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbcitelocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andincitecn}}{}%
+ \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{english}{\space\bibstring{andincite}\space}{}%
+ \iffieldequalstr{\userfieldabcde}{french}{\space\bibstring{and}\space}{}%
+ \iffieldequalstr{\userfieldabcde}{russian}{\space\bibstring{and}\space}{}%
+%\space%
+ \or%
+ \bibstring{andincitecn}%\space%
+ \or%
+\space\bibstring{andincite}\space%
+ \fi}
+
+\DeclareDelimFormat[bib,biblist]{finalnamedelim}{%
+ \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
+ \addspace%
+ \edef\userfieldabcde{userd}%
+ \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
+ \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
+ \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
+ \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbbiblocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}%
+ \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}%
+ \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}%
+ \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}%
+\space%
+ \or%
+ \bibstring{andcn}\space%
+ \or%
+ \bibstring{and}\space%
+ \fi}
+
+
+%
+% 重设title的输出
+%
+% 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen
+% 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件
+% 利用toggle做标识符是否输出的判断
+\renewbibmacro*{title}{%
+ \ifboolexpr{%
+ test{\iffieldundef{title}}%
+ and
+ test{\iffieldundef{subtitle}}%
+ }%
+ {}%
+ {\printtext[title]{\bibtitlefont%增加字体控制命令
+ \printfield[titlecase]{title}%
+ \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
+ {}{\setunit{\subtitlepunct}%
+ \printfield[titlecase]{subtitle}}%
+ \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
+ {\setunit{\subtitlepunct}\printfield{titleaddon}}%
+ \iftoggle{bbx:gbtype}{%
+ \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准
+ {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准
+ {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸
+ {\printfield[gbtypeflag]{usera}}}%其它
+ }}{}%
+ %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
+ %\newunit
+}%
+}}
+
+%
+% 作者信息的输出格式
+%
+% 20180425,v1.0k,为作者增加字体控制命令,Hu Zhenzhen
+% 20180603,v1.0l,增加使用nameformat域来选择姓名格式
+\DeclareNameFormat{namefmtselected}{%
+\iffieldundef{namefmtid}{}%
+{\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}%
+\ifcase\value{gbnamefmtcase}%
+ \ifgiveninits
+ {\usebibmacro{name:gbuppercase}
+ {\namepartfamily}
+ {\namepartgiveni}
+ {\namepartprefix}
+ {\namepartsuffix}}
+ {\usebibmacro{name:gbuppercase}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}}%
+\or
+ \ifgiveninits
+ {\usebibmacro{name:gblowercase}
+ {\namepartfamily}
+ {\namepartgiveni}
+ {\namepartprefix}
+ {\namepartsuffix}}
+ {\usebibmacro{name:gblowercase}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}}%
+\or
+ \ifgiveninits
+ {\usebibmacro{name:given-family}
+ {\namepartfamily}
+ {\namepartgiveni}
+ {\namepartprefix}
+ {\namepartsuffix}}
+ {\usebibmacro{name:given-family}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}}%
+\or
+ \ifgiveninits
+ {\usebibmacro{name:family-given}
+ {\namepartfamily}
+ {\namepartgiveni}
+ {\namepartprefix}
+ {\namepartsuffix}}
+ {\usebibmacro{name:family-given}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}}%
+\or
+\usebibmacro{name:gbpinyin}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}%
+\or
+ \ifnumequal{\value{listcount}}{1}
+ {\ifgiveninits
+ {\usebibmacro{name:family-given}
+ {\namepartfamily}
+ {\namepartgiveni}
+ {\namepartprefix}
+ {\namepartsuffix}}
+ {\usebibmacro{name:family-given}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}}%
+ \ifboolexpe{%
+ test {\ifdefvoid\namepartgiven}
+ and
+ test {\ifdefvoid\namepartprefix}}
+ {}
+ {\usebibmacro{name:revsdelim}}}
+ {\ifgiveninits
+ {\usebibmacro{name:given-family}
+ {\namepartfamily}
+ {\namepartgiveni}
+ {\namepartprefix}
+ {\namepartsuffix}}
+ {\usebibmacro{name:given-family}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}}}%
+\fi
+ \usebibmacro{name:andothers}}
+
+\DeclareNameAlias{default}{namefmtselected}%姓名的默认格式采用可选的模式
+\DeclareNameAlias{sortname}{default}% Used in the bibliography %family-given/given-family
+\DeclareNameAlias{citename}{default}% Default used by \citename
+
+\DeclareDelimFormat[bib,biblist]{andothersdelim}{\addcomma\addspace}
+%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}%
+
+%GB/T 7714-2015 风格,全部大写
+\newbibmacro*{name:gbuppercase}[4]{\bibauthorfont%
+\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
+\renewcommand*{\revsdnamepunct}{}%
+ \ifuseprefix%
+ {\usebibmacro{name:delim}{#3#1}%
+ \usebibmacro{name:hook}{#3#1}%
+ \ifdefvoid{#3}{}{%
+ \ifcapital%
+ {\mkbibnameprefix{\MakeCapital{#3}}\isdot}%
+ {\mkbibnameprefix{#3}\isdot}%
+ \ifprefchar{}{\bibnamedelimc}}%
+ \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
+ \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital
+ \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号
+ {\usebibmacro{name:delim}{#1}%
+ \usebibmacro{name:hook}{#1}%
+ \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
+ \ifboolexpe{%
+ test {\ifdefvoid{#2}}
+ and
+ test {\ifdefvoid{#3}}}
+ {}{\revsdnamepunct}%
+ \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital
+ \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
+ \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号
+}
+
+%GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出
+\newbibmacro*{name:gblowercase}[4]{\bibauthorfont%
+ \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
+ \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
+ \ifuseprefix
+ {\usebibmacro{name:delim}{#3#1}%
+ \usebibmacro{name:hook}{#3#1}%
+ \ifdefvoid{#3}{}{%
+ \ifcapital
+ {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
+ {\mkbibnameprefix{#3}\isdot}%
+ \ifprefchar{}{\bibnamedelimc}}%
+ \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot%
+ \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital
+ \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号
+ {\usebibmacro{name:delim}{#1}%
+ \usebibmacro{name:hook}{#1}%
+ \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot%
+ \ifboolexpe{%
+ test {\ifdefvoid{#2}}
+ and
+ test {\ifdefvoid{#3}}}
+ {}{\revsdnamepunct}%
+ \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital
+ \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}
+ \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号
+}
+
+%中文常见风格,汉语拼音全拼模式
+\newbibmacro*{name:gbpinyin}[4]{\bibauthorfont%
+\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY
+\renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
+\renewrobustcmd*{\bibnamedelima}{\mbox{-}}%
+ \ifuseprefix
+ {\usebibmacro{name:delim}{#3#1}%
+ \usebibmacro{name:hook}{#3#1}%
+ \ifdefvoid{#3}{}{%
+ \ifcapital
+ {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
+ {\mkbibnameprefix{#3}\isdot}%
+ \ifprefchar{}{\bibnamedelimc}}%
+ \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
+ \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamegiven{#2}}\isdot}%\MakeCapital
+ \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}
+ {\usebibmacro{name:delim}{#1}%
+ \usebibmacro{name:hook}{#1}%
+ \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
+ \ifboolexpe{%
+ test {\ifdefvoid{#2}}
+ and
+ test {\ifdefvoid{#3}}}
+ {}
+ {\revsdnamepunct}%
+ \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeCapital{#2}}\isdot}%\MakeCapital
+ \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}
+ \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%
+}
+
+
+\@ifpackagelater{biblatex}{2016/03/27}%biblatex<3.2版的情况
+ {}{
+ %GB/T 7714-2015 风格,全部大写
+ \renewbibmacro*{name:gbuppercase}[4]{\bibauthorfont%
+ \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
+ \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
+ \ifuseprefix
+ {\usebibmacro{name:delim}{#3#1}%
+ \usebibmacro{name:hook}{#3#1}%
+ \ifblank{#3}{}{%
+ \ifcapital
+ {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
+ {\mkbibnameprefix{#3}\isdot}%
+ \ifpunctmark{'}{}{\bibnamedelimc}}%
+ %\mkbibnamelast{#1}\isdot
+ \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase
+ %注意上一句\MakeCapital后面如果再跟一个{}包含#1,则没有效果,可能是包在里面少了一层展开
+ %因为机构名通常包括在{}内,所以要多展开一次才行,所以这里去掉#1外面的{}
+ %\mkbibnamelast{\MakeUppercase{#1}}\isdot
+ %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面
+ \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}%
+ \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}}%后缀前加逗号
+ {\usebibmacro{name:delim}{#1}%
+ \usebibmacro{name:hook}{#1}%
+ %\mkbibnamelast{#1}\isdot %3.9.1 Generic Commands and Hooks,对姓重新处理,如下句: %\mkbibnamelast{\MakeUppercase{#1}}
+ \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase
+ %\mkbibnamelast{\MakeUppercase{#1}}\isdot
+ %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面
+ \ifblank{#2#3}{}{\revsdnamepunct}%
+ \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}%
+ \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
+ \addcomma\addspace%
+ \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}%%后缀前加逗号
+ }%
+ }
+
+ %GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出
+ \renewbibmacro*{name:gblowercase}[4]{\bibauthorfont%
+ \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
+ \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
+ \ifuseprefix
+ {\usebibmacro{name:delim}{#3#1}%
+ \usebibmacro{name:hook}{#3#1}%
+ \ifblank{#3}{}{%
+ \ifcapital
+ {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
+ {\mkbibnameprefix{#3}\isdot}%
+ \ifpunctmark{'}{}{\bibnamedelimc}}%
+ \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase
+ \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{{#2}}\isdot}%
+ \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}}%后缀前加逗号
+ {\usebibmacro{name:delim}{#1}%
+ \usebibmacro{name:hook}{#1}%
+ \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase
+ \ifblank{#2#3}{}{\revsdnamepunct}%
+ \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{{#2}}\isdot}%
+ \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
+ \addcomma\addspace%
+ \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}%%后缀前加逗号
+ }%
+ }
+
+ %中文常见风格,汉语拼音全拼模式
+ \renewbibmacro*{name:gbpinyin}[4]{\bibauthorfont%
+ \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
+ \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
+ \renewrobustcmd*{\bibnamedelima}{\mbox{-}}%
+ \ifuseprefix
+ {\usebibmacro{name:delim}{#3#1}%
+ \usebibmacro{name:hook}{#3#1}%
+ \ifblank{#3}{}{%
+ \ifcapital
+ {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
+ {\mkbibnameprefix{#3}\isdot}%
+ \ifpunctmark{'}{}{\bibnamedelimc}}%
+ \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase
+ \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamefirst{#2}}\isdot}%
+ \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}}
+ {\usebibmacro{name:delim}{#1}%
+ \usebibmacro{name:hook}{#1}%
+ \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase
+ \ifblank{#2#3}{}{\revsdnamepunct}%
+ \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}%
+ \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
+ \addcomma\addspace%
+ \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}%
+ }%
+ }
+
+ %%biblatex<3.2版的情况,姓名的处理格式带参数
+ \DeclareNameFormat{namefmtselected}{%
+ \iffieldundef{namefmtid}{}%
+ {\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}%
+ \ifcase\value{gbnamefmtcase}%
+ \iffirstinits
+ {\usebibmacro{name:gbuppercase}{#1}{#4}{#5}{#7}}
+ {\usebibmacro{name:gbuppercase}{#1}{#3}{#5}{#7}}%
+ \or
+ \iffirstinits
+ {\usebibmacro{name:gblowercase}{#1}{#4}{#5}{#7}}
+ {\usebibmacro{name:gblowercase}{#1}{#3}{#5}{#7}}%
+ \or
+ \iffirstinits
+ {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}}
+ {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}%
+ \ifblank{#3#5}
+ {}
+ {\usebibmacro{name:revsdelim}}%
+ \or
+ \iffirstinits
+ {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}}
+ {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}%
+ \or
+ \usebibmacro{name:gbpinyin}{#1}{#3}{#5}{#7}%
+ \or
+ \ifnumequal{\value{listcount}}{1}
+ {\iffirstinits
+ {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}}
+ {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}%
+ \ifblank{#3#5}
+ {}
+ {\usebibmacro{name:revsdelim}}}
+ {\iffirstinits
+ {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}}
+ {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}}%
+ \fi
+ \usebibmacro{name:andothers}}
+}
+
+%
+% url和url日期格式
+%
+\renewbibmacro*{url+urldate}{%
+ %\usebibmacro{url}%%更换url的位置,放到下面
+ \iffieldundef{urlyear}%
+ {}{%\setunit*{\addspace}%
+ \usebibmacro{urldate}}%
+ \setunit{\addperiod\addspace}%
+ \usebibmacro{url}}
+\renewbibmacro*{url}{\printfield{url}}
+
+
+
+
+%
+% 日期信息的输出格式,针对biblatex<3.7版本
+%
+\defversion{3.4}{date}{
+ \renewbibmacro*{urldate}{%
+ \addthinspace\printtext{[}\printfield{urlyear}%
+ \iffieldundef{urlmonth}{}{\bibrangedash\printfield{urlmonth}}%
+ \iffieldundef{urlday}{}{\bibrangedash\printfield{urlday}}\printtext{]}}
+
+ \newbibmacro*{newsdate}{%%新增加一个公告日期,公开日期或新闻日期
+ \iffieldundef{year}{}{\printfield{year}%
+ \iffieldundef{month}{}{\bibrangedash\printtext{\thefield{month}}%
+ \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}%
+ }
+
+ \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式
+ \ifboolexpr{%
+ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
+ }%
+ {}%更新或修改日期通常有day信息
+ {\iffieldequalstr{year}{}{%替换\iffieldundef{year},因为year总是存在,但为空
+ \iffieldundef{endyear}{%
+ \iffieldundef{eventyear}{}{\printtext{\mkbibparens{\printtext{\printfield{eventyear}}%
+ \iffieldundef{eventmonth}{}{\bibrangedash\thefield{eventmonth}}%
+ \iffieldundef{eventday}{}{\bibrangedash\printfield{eventday}}}}%
+ }%
+ }{%
+ \iffieldundef{endyear}{}{\printtext{\mkbibparens{\printtext{\printfield{endyear}}%
+ \iffieldundef{endmonth}{}{\bibrangedash\thefield{endmonth}}%
+ \iffieldundef{endday}{}{\bibrangedash\printfield{endday}}}}%
+ }%
+ }%
+ }%
+ {%
+ \iffieldundef{year}{}{\printtext{\mkbibparens{\printtext{\printfield{year}}%
+ \iffieldundef{month}{}{\bibrangedash\thefield{month}}%
+ \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}%
+ }%
+ }%
+ }}%
+}
+
+%
+% 日期信息的输出格式,针对3.9>=biblatex>=3.7版本
+%
+\defversion{3.7}{date}{
+ \DeclareFieldFormat{urldate}{##1}
+ \renewbibmacro*{urldate}{%
+ \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx at edtfdate这种更底层的命令
+
+ %
+ % 专利的公告日期、或报纸的日期的输出宏
+ % 20160701,v1.0,新增加
+ % 20180405,v1.0k,为biblatexv3.7-3.9版本,出现多出点bug做处理,Hu Zhenzhen
+ %
+ % 原理方法:加上printtext避免破坏异步标点机制
+ %
+ \newbibmacro*{newsdate}{%
+ \printtext{\blx at edtfdate{}{}}%
+ }
+
+ \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式
+ \ifboolexpr{%
+ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
+ }%
+ {}%更新或修改日期通常有day信息
+ {\iffieldundef{year}{%
+ \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}%
+ {\printtext{(}\printenddate\printtext{)}}%
+ }{\iffieldequalstr{year}{}{%因为year存在,但为空
+ }{\printtext{(}\blx at edtfdate{}{}\printtext{)}}%
+ }%
+ }}%
+}
+
+%
+% 日期信息的输出格式,针对biblatex>=3.10版本
+%
+\defversion{3.10}{date}{
+ \DeclareFieldFormat{urldate}{##1}
+ \renewbibmacro*{urldate}{%
+ \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx at edtfdate这种更底层的命令
+
+ %
+ % 专利的公告日期、或报纸的日期的输出宏
+ % 20160701,v1.0,新增加
+ % 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen
+ %
+ % 原理方法:加上printtext避免破坏异步标点机制
+ % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份
+ % 所以无法再用选项设置的方法,印象需要用底层的命令
+ % 这里可以用\blx at isodate,但用\blx at gbdate试图避免版本判断
+ \newbibmacro*{newsdate}{%%
+ \printtext{\blx at gbdate{}{}}%%\blx at isodate{}{}%
+ }
+
+ %
+ \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式
+ \ifboolexpr{%
+ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
+ }%
+ {}%更新或修改日期通常有day信息
+ {\iffieldundef{year}{%
+ \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}%
+ {\printtext{(}\printenddate\printtext{)}}%
+ }{\iffieldequalstr{year}{}{%因为year存在,但为空
+ }{\printtext{(}\blx at gbdate{}{}\printtext{)}}%
+ }%
+ }}%
+}
+
+%
+% biblatex>v3.8版利用related实现双语文献的处理
+%
+\defversion{3.8}{dblang}{
+ %为了实现v3.8以上版本的双语文献,采用related的方法代替set方法,因为set方法已经无法实现了,
+ %因为set不再复制其第一个成员的信息。于是定义一个命令,用于动态的修改数据,即添加related域的信息
+ %其中使用了\DeclareStyleSourcemap,但由于其只能出现在导言区中,因此\defdoublelangentry命令也只能出现在导言区中
+ \newcommand{\defdoublelangentry}[2]{%
+ \edef\entrykeya{##1}
+ \edef\entrykeyb{##2}
+ \DeclareStyleSourcemap{
+ \maps[datatype=bibtex]{
+ \map{
+ \step[fieldsource=entrykey, match=\entrykeya, final]
+ \step[fieldset=related, fieldvalue=\entrykeyb]
+ }
+ }
+ }
+ }
+}
+
+%
+% 关联文献间的分隔符
+%
+\renewcommand{\relateddelim}{\adddot\newline\nobreak}%\par,而作者年样式不需要修改,因为没有项对齐的标签问题
+
+%
+% 关联文献的输出格式,针对3.9>=biblatex>=3.7版本
+%
+% 原理方法:因为related宏中带有##了,所以无法封装到defversion中了。所以直接做判断
+% 下面这一段主要针对v3.8-3.10,因为我提问后,biblatex作者为3.11版增加了一个钩子控制relatedblock前的分隔符。
+\ifboolexpr{
+test{\iftoggle{iftleight}}
+or
+test{\iftoggle{iftlnine}}
+}{\renewbibmacro*{related}{%standard.bbx
+ \ifboolexpr{ test {\iffieldundef{related}} or test {\ifrelatedloop} }
+ {}
+ {\usebibmacro{begrelated}%
+ \def\bbx at tempa{}%
+ \setcounter{bbx:relatedtotal}{0}%
+ \def\do##1{%
+ \entrydata{##1}{%
+ \ifrelatedloop
+ {}
+ {\stepcounter{bbx:relatedtotal}%
+ \gappto{\bbx at tempa}{##1,}}}}%
+ \docsvfield{related}%
+ \restorefield{related}{\bbx at tempa}%
+ \ifnumgreater{\value{bbx:relatedtotal}}{0}
+ {\listcsxadd{bbx:relatedloop}{\strfield{entrykey}}%
+ \iffieldundef{clonesourcekey}
+ {}
+ {\listcsxadd{bbx:relatedloop}{\strfield{clonesourcekey}}}%
+ \setcounter{bbx:relatedcount}{0}%
+ \def\do{%
+ \stepcounter{bbx:relatedcount}%
+ \ifnumgreater{\value{bbx:relatedcount}}{0}%这里从1改为0
+ {\ifcsundef{relateddelim\strfield{relatedtype}}
+ {\printtext{\relateddelim}}
+ {\printtext{\csuse{relateddelim\strfield{relatedtype}}}}}
+ {}}%
+ \ifbibmacroundef{related:\strfield{relatedtype}}
+ {\appto{\do}{\usebibmacro{related:default}}}
+ {\appto{\do}{\usebibmacro*{related:\strfield{relatedtype}}}}%
+ \iffieldformatundef{related:\strfield{relatedtype}}
+ {\def\bbx at tempa{related}}
+ {\def\bbx at tempa{related:\strfield{relatedtype}}}%
+ \iffieldformatundef{relatedstring:\strfield{relatedtype}}
+ {\def\bbx at tempb{relatedstring:default}}
+ {\def\bbx at tempb{relatedstring:\strfield{relatedtype}}}%
+ \printtext[\bbx at tempa]{%
+ \usebibmacro{begrelatedloop}%
+ \iffieldundef{relatedstring}
+ {\ifboolexpr{
+ test {\ifnumgreater{\value{bbx:relatedtotal}}{1}}
+ and
+ test {\ifbibxstring{\thefield{relatedtype}s}}
+ }
+ {\printtext[\bbx at tempb]{%
+ \bibstring[\mkrelatedstring]{\thefield{relatedtype}s}}}
+ {\iffieldbibstring{relatedtype}
+ {\printtext[\bbx at tempb]{%
+ \bibstring[\mkrelatedstring]{\thefield{relatedtype}}}}
+ {}}}
+ {\iffieldbibstring{relatedstring}
+ {\printtext[\bbx at tempb]{%
+ \bibstring[\mkrelatedstring]{\thefield{relatedstring}}}}
+ {\printfield[\bbx at tempb]{relatedstring}}}%
+ \docsvfield{related}%
+ \usebibmacro{endrelatedloop}}}%
+ {}%
+ \usebibmacro{endrelated}}}
+}{}
+
+%
+% 关联文献块前的分隔符,针对biblatex>3.11
+%
+% 原理方法:因为增加了begrelateddelim钩子,所以不需要重定义related输出宏
+\defversion{3.11}{related}{
+\renewcommand{\begrelateddelim}{\adddot\newline\nobreak}
+}
+
+\iftoggle{iftlfive}{\switchversion{3.4}{date}}{}%biblatex<=3.2
+\iftoggle{iftlsix}{\switchversion{3.4}{date}}{}%3.3<=biblatex<=3.6
+\iftoggle{iftlseven}{\switchversion{3.7}{date}}{}%biblatex=3.7
+\iftoggle{iftleight}{\switchversion{3.7}{date}\switchversion{3.8}{dblang}}{}%3.8<=biblatex<=3.9
+\iftoggle{iftlnine}{\switchversion{3.10}{date}\switchversion{3.8}{dblang}}{}%biblatex=3.10
+\iftoggle{iftlatest}{\switchversion{3.10}{date}\switchversion{3.8}{dblang}\switchversion{3.11}{related}}{}%biblatex最新3.11
+
+%
+% 调整doi+eprint+url格式
+% 2016.07.01 byhzz
+% 2019.05.01 byhzz 在eprint前增加一个空格
+% 原理方法:源来自standard.bbx,因为页码后面直接跟引用日期,没有标点所以去掉其中的标点。
+\renewbibmacro*{doi+eprint+url}{%
+% \iftoggle{bbx:doi}%把doi的位置放到url后面
+% {\printfield{doi}}
+% {}%
+ %\newunit\newblock
+ \iftoggle{bbx:eprint}
+ {\iffieldundef{eprint}{}{\newunit\usebibmacro{eprint}}}
+ {}%
+ %\newunit\newblock
+ \iftoggle{bbx:url}
+ {\usebibmacro{url+urldate}}
+ {}
+ \newunit\newblock
+ \iftoggle{bbx:doi}
+ {\printfield{doi}}
+ {}}
+
+%
+% 调整页码的格式,即chapter+pages格式
+%
+\renewbibmacro*{chapter+pages}{%
+\iftoggle{bbx:gbstrict}{}{%
+ \printfield{chapter}}%
+ \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出
+ \setunit{\bibpagespunct}%
+ \printfield{pages}}%
+ %\newunit %这里的标点去掉
+}
+
+%
+% 当location等出版项超过maxitem缩减后不再输出etal
+%
+\DeclareListFormat{location}{%
+ \usebibmacro{list:delim}{#1}%
+ #1\isdot}
+\DeclareListAlias{institution}{location}
+\DeclareListAlias{publisher}{location}
+
+% 新增一个样式用于输出连续出版物的地址,单位,时间,
+% 用于periodical连续出版物的出版社和地址的处理
+%
+% v1.0k,20180425,为出版信息增加字体控制命令,hzz
+% %类似\newbibmacro*{publisher+location+date}
+\newbibmacro*{location+institution+date}{\bibpubfont%
+\iftoggle{bbx:gbpub}%
+{\testCJKfirst{userd}%
+\ifboolexpr{%
+test {\iflistundef{location}} and test {\iflistundef{institution}}%
+}{\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress}\space :\space\str at nopublisher]}%
+{\printtext{[S.l.\space :\space s.n.\adddot]}}%
+}{%
+\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress]}}{\printtext{[S.l.\adddot]}}}%
+ {\printlist{location}}%
+\addcolon\addspace%
+\iflistundef{institution}{%
+\iftoggle{ifCJKforgbt}{\printtext{[\str at nopublisher]}}{\printtext{\mkbibbrackets{s.n.}}}}%
+{\printlist{institution}}}%
+\setunit{\addcomma\addspace}%
+ %\usebibmacro{date}%
+ \printfield{year}%
+ \bibrangedash%
+ \iffieldundef{endyear}{}{\printfield{endyear}}%
+ \newunit}%
+{\printlist{location}%
+ \iflistundef{institution}%
+ {\setunit*{\addcomma\space}}
+ {\setunit*{\addcolon\space}}%
+ \printlist{institution}%
+ \setunit*{\addcomma\space}%
+ \usebibmacro{date}%
+ \newunit}%
+}
+%
+% 通用的出版社和地址的处理
+%
+% 原理方法:当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。
+% 事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。
+% 注意标准standard类型,因为当没有出版项时直接省略,所以做特殊处理
+\renewbibmacro*{publisher+location+date}{\bibpubfont%
+\iftoggle{bbx:gbpub}%
+{\testCJKfirst{userd}%
+ \ifboolexpr{ test {\iflistundef{location}} and test {\iflistundef{publisher}} }%
+ {\iffieldequalstr{note}{standard}{}{\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress}\space :\space\str at nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}%
+ {\iflistundef{location}{%\adddot
+ \iffieldequalstr{note}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。
+ {\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}}}% \bibstring{noaddress}
+ {\printlist{location}\addcolon\addspace}%%\addcolon\addspace%
+ \iflistundef{publisher}{%
+ \iffieldequalstr{note}{standard}{}%
+ {\iftoggle{ifCJKforgbt}{\printtext{[\str at nopublisher]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}%
+ {\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}}}%
+ {\printlist{publisher}}}%
+\setunit*{\addcomma\addspace}%\addcomma\addspace%
+\usebibmacro{date}%%\newunit %去掉这个标点
+}%
+{\printlist{location}%
+ \iflistundef{publisher}
+ {\setunit*{\addcomma\space}}
+ {\setunit*{\addcolon\space}}%
+ \printlist{publisher}%
+ \setunit*{\addcomma\space}%
+ \usebibmacro{date}%%\newunit
+ }%
+}
+
+%
+% 修改了一个institution+location+date用于manual、report、thesis等类型
+%
+% 20180425,v1.0k,增加了字体控制命令,hzz
+% 20190105,v1.0o,加了一个编组避免\usebibmacro{date}把month和day信息去掉
+\renewbibmacro*{institution+location+date}{\bibpubfont%当没有institution时不处理。
+{\printlist{location}%%加了一个编组避免\usebibmacro{date}把month和day信息去掉
+ \iflistundef{institution}
+ {\setunit*{\addcomma\space}}
+ {\setunit*{\addcolon\space}}%
+ \printlist{institution}%
+ \setunit*{\addcomma\space}%
+ \usebibmacro{date}%
+ %\newunit
+ }}
+
+%
+% 对volume卷信息格式做出修改
+% v1.0o,20190105,hzz
+%
+\DeclareFieldFormat{volume}{%
+\testCJKfirst{userd}%
+\iftoggle{ifCJKforgbt}%
+{\bibstring{serialcn}#1\bibstring{volumecn}}%
+{\bibstring{volume}~#1}%
+}% volume of a book
+\DeclareFieldFormat[article,periodical]{volume}{#1}% volume of a journal
+
+%
+% 对number册信息格式做出修改
+% v1.0o,20190105,hzz
+%
+\DeclareFieldFormat{number}{#1}%
+\DeclareFieldFormat[book,collection,inbook,%
+incollection,proceedings,inproceedings]{number}{%
+\testCJKfirst{userd}%
+\iftoggle{ifCJKforgbt}%
+{\bibstring{serialcn}#1\bibstring{numbercn}}%
+{#1}%
+}%
+
+%
+% 对edition版本信息格式做出修改
+%
+\DeclareFieldFormat{edition}{\bibtitlefont%源来自biblatex.DEF
+\testCJKfirst{userd}%
+\iftoggle{ifCJKforgbt}%
+{\ifinteger{#1}%
+{\printtext{#1\str at edition}}%
+{#1\isdot}}%
+{\ifinteger{#1}%
+{\mkbibordedition{#1}~\bibstring{edition}}%
+{#1\isdot}}}
+
+%
+% 对version的版本信息做出修改
+%
+\DeclareFieldFormat{version}{\bibtitlefont%源来自biblatex.DEF
+\testCJKfirst{userd}%
+\ifinteger{#1}%
+{\iftoggle{ifCJKforgbt}{\printtext{#1\str at edition}}%
+{\mkbibordedition{#1}~\bibstring{version}}}%
+{#1\isdot}}
+
+%
+% 修改析出文献的文集的标题与附加标题间的符号
+%
+\renewbibmacro*{booktitle}{%
+ \ifboolexpr{
+ test {\iffieldundef{booktitle}}
+ and
+ test {\iffieldundef{booksubtitle}}
+ }
+ {}
+ {\printtext[booktitle]{\bibtitlefont%
+ \printfield[titlecase]{booktitle}%
+ \setunit{\subtitlepunct}%
+ \printfield[titlecase]{booksubtitle}}%
+ \newunit%标点换成下一句
+ \setunit{\subtitlepunct}}%
+ \printfield{booktitleaddon}}
+
+
+%
+% 调整期刊名的格式
+%
+% v1.0k,20180425,增加了字体控制命令,hzz
+\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx
+ \usebibmacro{journal}%
+ %\setunit*{\addspace}%
+ \setunit*{\addcomma\addspace}%修改为增加一个逗号
+ \iffieldundef{series}
+ {}
+ {\newunit
+ \printfield{series}%
+ \setunit{\addspace}}%
+ %\usebibmacro{volume+number+eid}%
+ %\setunit{\addspace}%
+ \usebibmacro{issue+date}%
+ %\setunit{\addcolon\space}%
+ \iffieldundef{volume}{}{\setunit{\addcomma\space}}%
+ %换成逗号和空格
+ \usebibmacro{issue}%
+ \usebibmacro{volume+number+eid}%把卷期放到年份后面
+ %\newunit
+ }
+
+
+
+%
+% 调整期刊卷和期的格式
+%
+\renewbibmacro*{volume+number+eid}{%源来自standard.bbx
+\iftoggle{bbx:gbfieldstd}{%
+ \printfield{volume}%
+ \setunit*{\adddot}%
+ \printfield{number}%
+ \setunit{\addcomma\space}%
+ \printfield{eid}}{%
+ \printfield{volume}%
+ %\setunit*{\adddot}%去掉点号
+ %\printfield{number}%
+ \iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号
+ \iffieldundef{eid}{}{%
+ \setunit{\addcomma\space}%
+ \printfield{eid}}}}
+
+%
+% 调整期刊年份的格式
+%
+\renewbibmacro*{issue+date}{%去掉括号
+ \printtext{%去掉了[parens]
+ \iffieldundef{issue}
+ {%\usebibmacro{date}
+ \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸
+ {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸
+ {\usebibmacro{date}}%
+ }}%
+ {\iftoggle{bbx:gbstrict}{}{\printfield{issue}%
+ \setunit*{\addspace}}%
+ %\usebibmacro{date}
+ \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸
+ {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸
+ {\usebibmacro{date}}%
+ }}}%
+ %\newunit
+ }
+
+%
+% 调整页码前的标点和去掉期刊文章等页码后面的标点
+%
+\renewbibmacro*{note+pages}{%源来自standard.bbx
+ %\printfield{note}%不要note,note用来判断是否是报纸newspaper
+ \iffieldundef{pages}{}{
+ \setunit{\bibpagespunct}%
+ \printfield{pages}}%
+ %\newunit
+ }
+
+
+%
+% 编者的符号修改一下
+% v1.0 2016-07-01
+% v1.0q 2019-03-01 hzz 修改editortype前的标点
+%
+\renewbibmacro*{editor}{%源来自biblatex.DEF
+ \ifboolexpr{
+ test \ifuseeditor
+ and
+ not test {\ifnameundef{editor}}
+ }
+ {\printnames{editor}%
+ \iffieldundef{editortype}%增加一个类型判断,用于存在editortype的情况
+ {\setunit\addspace}%当没有editortype时,直接用句点
+ {%\setunit{\addcomma\space}%
+ \usebibmacro{editorstrg}}%
+ %\clearname{editor}
+ }%
+ {}}
+
+%
+% 编者类型做一修改
+% v1.0 2016-07-01
+% v1.0q 2019-03-01 hzz 修改editortype不同语言的不同本地化字符串
+%
+\renewbibmacro*{editorstrg}{%源来自biblatex.DEF
+ \printtext[editortype]{%
+ \iffieldundef{editortype}
+ {%
+% \ifboolexpr{ %这一段去掉,未定义编者类型情况下不处理
+% test {\ifnumgreater{\value{editor}}{1}}
+% or
+% test {\ifandothers{editor}}
+% }
+% {\bibstring{editors}}
+% {\bibstring{editor}}
+ }
+ {\ifbibxstring{\thefield{editortype}} %定义编者类型情况下处理,以后根据需要修改
+ {\ifboolexpr{
+ test {\ifnumgreater{\value{editor}}{1}}
+ or
+ test {\ifandothers{editor}}
+ }
+ {\printdelim{streditortypes}}
+ {\printdelim{streditortype}}}
+ {\thefield{editortype}}}%
+ }}
+
+%
+% 编者类型的本地化字符串输出
+% v1.0q 2019-03-01 hzz
+% 能对不同条目类型作格式设置的域格式,能对不同环境做格式设置的分隔符
+% 能对不同文境作设置的包括排序,标签等
+% 这里因为考虑可能标注和文献表中存在不同,所以用分隔符来输出本地化字符串
+%
+\DeclareDelimFormat{streditortypes}{%
+ \edef\userfieldabcde{userd}%
+ \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
+ \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbbiblocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}scn}}{}%
+ \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}skr}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}sjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}%
+ \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}%
+ \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}%
+ \or%
+ \bibstring{\thefield{editortype}scn}%
+ \or%
+ \addcomma\addthinspace\bibstring{\thefield{editortype}s}%
+ \fi}
+%
+\DeclareDelimFormat{streditortype}{%
+ \edef\userfieldabcde{userd}%
+ \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
+ \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbbiblocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}cn}}{}%
+ \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}kr}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}jp}}{}%
+ \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}%
+ \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}%
+ \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}%
+ \or%
+ \bibstring{\thefield{editortype}cn}%
+ \or%
+ \addcomma\addthinspace\bibstring{\thefield{editortype}}%
+ \fi}
+
+
+%
+% bookauthor域的输出,
+% v1.0q 2019-03-01 hzz
+% 不再对editor和bookauthor做sourcemap,而是下面的宏内逻辑代替,
+% 使得除使用bookauthor外也可以使用editor,便于在使用editor时使用editortype
+\renewbibmacro*{bybookauthor}{%
+ \ifnameundef{bookauthor}%
+ {\ifnameundef{editor}%
+ {}%
+ {\ifnamesequal{author}{editor}%
+ {}{\usebibmacro{editor}}}%
+ }%
+ {\ifnamesequal{author}{bookauthor}%
+ {}{\printnames{bookauthor}}%
+ }%
+}
+
+%
+% 修改期刊的标题
+%
+\renewbibmacro*{periodical}{%源来自biblatex.DEF
+ \iffieldundef{title}
+ {}
+ {\printtext[title]{\bibtitlefont%
+ \printfield[titlecase]{title}%
+ %\setunit{\subtitlepunct}%
+ \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
+ {}{\setunit{\subtitlepunct}
+ \printfield[titlecase]{subtitle}}%
+ %}%把编组结束移到后面去
+ \iftoggle{bbx:gbtype}{%
+ \iffieldundef{usera}{}{%在标题后直接给出文献标识字母
+ \printfield[gbtypeflag]{usera}}}{}
+ }}
+ }
+
+%
+% 期刊的标题做修改
+%
+\renewbibmacro*{title+issuetitle}{%源来自standard.BBX
+ \usebibmacro{periodical}%
+ %\setunit*{\addspace}%
+ \setunit*{\adddot\addspace}%标点修改为句点
+ \iffieldundef{series}
+ {}
+ {\newunit
+ \printfield{series}%
+ \setunit{\addspace}}%
+ \usebibmacro{periodical+issue}%将issue调整到上面来,并修改
+\iffieldundef{number}{}{%%进一步处理有范围的数字
+ \multinumberparser{\thefield{number}}}%
+ \iffieldundef{volume}%
+ {\printfield{year}%
+ \printtext{\mkbibparens{\multinumberfirst}}%
+ \bibrangedash%
+ \iffieldundef{endyear}{}{\printfield{endyear}\printtext{\mkbibparens{\multinumbersecond}}}%
+ }%
+ {\multivolparser{\thefield{volume}}%
+ \printfield{year}%
+ \setunit{\addcomma\space}%将冒号修改为逗号
+ \printtext{\multivolfirst}%
+ \printtext{\mkbibparens{\multinumberfirst}}%
+ \bibrangedash%
+ \iffieldundef{endyear}{}{%
+ \printfield{endyear}%
+ \setunit{\addcomma\space}%将冒号修改为逗号
+ \printtext{\multivolsecond}%
+ \printtext{\mkbibparens{\multinumbersecond}}}%
+ }%
+ \setunit{\addcomma\space}%
+ \printfield{eid}%
+ \setunit{\addspace}%
+ %\usebibmacro{issue+date}%
+ %\setunit{\addcolon\space}%
+ \usebibmacro{issue}%
+ \newunit}
+
+%
+% 新增一个样式用于调整期刊年份的格式,只打印年份
+%
+\newbibmacro*{periodical+issue}{%
+ \printtext{%去掉了[parens]
+ \iffieldundef{issue}
+ {%\usebibmacro{date}%修改为下一句
+ }%
+ {\printfield{issue}%
+ \setunit*{\addspace}%
+ %\usebibmacro{date}%修改为下一句
+ }%
+ }%
+ %\newunit
+}
+
+%
+% 重设专利title的输出,将文献类型标识符输出出去
+%
+\newbibmacro*{patenttitle}{%原输出来自biblatex.def文件
+ \ifboolexpr{%
+ test{\iffieldundef{title}}%
+ and%
+ test{\iffieldundef{subtitle}}%
+ }%
+ {}%
+ {\printtext[title]{\bibtitlefont%
+ \printfield[titlecase]{title}%
+ \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
+ {}{\setunit{\subtitlepunct}%
+ \printfield[titlecase]{subtitle}}%
+ \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
+ {\setunit{\subtitlepunct}\printfield{titleaddon}}%
+ \setunit{\subtitlepunct}\printfield{number}%写专利号
+ \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}%
+ %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
+ %\newunit
+ }%
+}%
+}
+
+
+
+%
+% 修改in:用于inbook、incollection、inproceedings等类型
+% 2018.04.20,v1.0k,renewed marco,by hzz
+% 20190212,v1.0q,增加中英文区分,by hzz
+%
+% 原理方法:使用bibmacro{in:}改变了以前在driver中直接输出//的方式,同时也简化了标点控制。
+\renewbibmacro*{in:}{%
+ \iftoggle{bbx:gbpunctin}{\printtext{\allowbreak\texttt{//}\allowbreak}}%\addthinspace
+ {\setunit{\adddot\addspace}%
+ \iffieldequalstr{userd}{chinese}%
+ {\printtext{\bibstring{incn}}}%
+ {\printtext{\bibstring{in}}}%
+ }}%\newunit\newblock\intitlepunct
+
+%
+% 修改type域的输出格式
+% 2019.02.12,v1.0q,byhzz
+% 使其可以区分中英文输出不同的格式,比如博士论文英文输出PHD thesis,中文则是博士学位论文
+\DeclareFieldFormat{type}%
+{\iffieldequalstr{userd}{chinese}%
+ {\ifbibxstring{#1cn}{\bibxstring{#1cn}}{#1}}%
+ {\ifbibstring{#1}{\bibstring{#1}}{#1}}%
+}
+
+%
+% 修改series域的输出格式
+% 2019.05.01,v1.0r,byhzz
+\renewbibmacro*{series+number}{%
+ \printfield{series}%
+ %\setunit*{\addspace}%
+ %\printfield{number}%
+ %\newunit
+ }
+
+%=====================================================================
+%设置驱动格式
+%=====================================================================
+%
+% book条目类的驱动
+%
+ \DeclareBibliographyDriver{book}{%源来自standard.bbx文件
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+\usebibmacro{author/editor+others/translator+others}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+\usebibmacro{maintitle+title}%
+\iftoggle{bbx:gbstrict}{}{%
+\newunit
+\printlist{language}%
+\newunit\newblock%
+\usebibmacro{byauthor}%
+\newunit\newblock}%
+\usebibmacro{byeditor+others}%
+\newunit
+\printfield{edition}%
+\newunit\newblock%%
+\iftoggle{bbx:gbstrict}{}{%
+\iffieldundef{maintitle}%
+{\printfield{volume}%
+\printfield{part}}%
+{}%
+\newunit%
+\printfield{volumes}%
+\newunit\newblock%
+\usebibmacro{series+number}}%
+\newunit\newblock%
+%\printfield{note}%
+%\newunit\newblock%
+\usebibmacro{publisher+location+date}%
+%\newunit\newblock %这里标点去掉
+\usebibmacro{chapter+pages}%
+ \iffieldundef{url}{}{%当没有网址时也不输出
+ \usebibmacro{modifydate}}%带括号的修改或更新日期,
+\usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。
+ \newunit\newblock%
+ \printfield{pagetotal}%
+ \newunit\newblock%
+ \iftoggle{bbx:isbn}
+ {\printfield{isbn}}
+ {}%
+ \newunit\newblock
+ %\usebibmacro{doi+eprint+url}%
+ %\newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+
+%
+% 期刊文章,连续出版物中的析出文献的格式
+%
+ \DeclareBibliographyDriver{article}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/translator+others}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ \usebibmacro{title}%
+ \iftoggle{bbx:gbstrict}{}{%
+ \newunit%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}%
+ \newunit\newblock
+ \usebibmacro{bytranslator+others}%
+ \newunit\newblock
+ \printfield{version}}%
+ \newunit\newblock
+ %\usebibmacro{in:}% 不使用in来表示期刊等连续出版物
+ \usebibmacro{journal+issuetitle}%
+ %\newunit
+% \usebibmacro{byeditor+others}%
+% \newunit
+ \usebibmacro{note+pages}%
+ \iffieldequalstr{note}{news}{}{%当是新闻时不输出修改或更新日期
+ \iffieldundef{url}{}{%当没有网址时也不输出
+ \iftoggle{bbx:url}{%当url选项为false时,也不输出
+ \usebibmacro{modifydate}}{}}}%带括号的修改或更新日期,
+ \usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置
+ \newunit\newblock
+ \iftoggle{bbx:isbn}
+ {\printfield{issn}}
+ {}%
+ \newunit\newblock
+ %\usebibmacro{doi+eprint+url}%
+ %\newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+
+
+%
+% 连续出版物的驱动
+%
+ \DeclareBibliographyDriver{periodical}{%源来自standard.BBX
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{editor}%
+ %\setunit{\labelnamepunct}\newblock
+ \newunit\newblock %删除上面一行,添加这一行
+ \usebibmacro{title+issuetitle}%
+ \newunit\newblock%
+ \usebibmacro{location+institution+date}%添加这一行用于输出地址,单位和时间
+ \newunit\newblock%添加这一行
+ \iftoggle{bbx:gbstrict}{}{%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byeditor}%
+ \newunit\newblock
+ \printfield{note}%
+ \newunit\newblock}
+ \iftoggle{bbx:isbn}
+ {\printfield{issn}}
+ {}%
+ \newunit\newblock
+ \usebibmacro{doi+eprint+url}%
+ \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+%
+% 专利文献驱动
+%
+ \DeclareBibliographyDriver{patent}{%源来自standard.BBX
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ %\usebibmacro{title}%
+ \usebibmacro{patenttitle}%给出专利专用的标题输出
+ \iftoggle{bbx:gbstrict}{}{%
+ \newunit%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}}%
+ \newunit\newblock
+ \printfield{type}%
+ \setunit*{\addspace}%
+ %\printfield{number}%已放到patenttitle中处理
+ \iflistundef{location}
+ {}
+ {\setunit*{\addspace}%
+ \printtext{%[parens]
+ \printlist[][-\value{listtotal}]{location}}}%
+ \newunit\newblock
+ \usebibmacro{byholder}%
+ \newunit\newblock
+ \printfield{note}%
+ \newunit\newblock
+ \usebibmacro{newsdate}%
+ %\newunit\newblock
+ \usebibmacro{doi+eprint+url}%
+ \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+
+%
+% 在线文献驱动
+%
+\DeclareBibliographyDriver{online}{%源来自standard.BBX
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/editor+others/translator+others}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ \usebibmacro{title}%
+ \iftoggle{bbx:gbstrict}{}{%
+ \newunit%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}%
+ \newunit\newblock
+ \usebibmacro{byeditor+others}%
+ \newunit\newblock
+ \printfield{note}}%
+ \newunit
+ \printfield{version}%
+ \newunit\newblock
+ %\printlist{organization}%
+ \printlist{institution}%
+ \newunit\newblock
+\ifboolexpr{%
+test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
+}{\usebibmacro{date}}%
+{\usebibmacro{modifydate}}%修改或更新日期,为带括号的时间
+ \usebibmacro{url+urldate}%从下面移上来
+ \newunit\newblock
+ \iftoggle{bbx:eprint}
+ {\usebibmacro{eprint}}
+ {}%
+ \newunit\newblock
+ %\usebibmacro{url+urldate}%
+ %\newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+
+%
+% 报告类型驱动
+% 当有网址无出版项时,用online输出
+%
+\DeclareBibliographyDriver{report}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ \usebibmacro{title}%
+ \iftoggle{bbx:gbstrict}{}{%
+ \newunit%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}}%
+ \newunit\newblock
+ \usebibmacro{byeditor+others}%增加的译者信息
+ \newunit\newblock
+ \printfield{type}%
+ \setunit*{\addspace}%
+ \printfield{number}%
+ \newunit\newblock
+ \printfield{version}%
+ \newunit
+ \printfield{note}%
+ \newunit\newblock
+ \usebibmacro{publisher+location+date}%
+ %\newunit\newblock
+ \usebibmacro{chapter+pages}%
+ \usebibmacro{doi+eprint+url}%
+ \newunit
+ \printfield{pagetotal}%
+ \newunit\newblock
+ \iftoggle{bbx:isbn}
+ {\printfield{isrn}}
+ {}%
+ \newunit\newblock
+% \usebibmacro{doi+eprint+url}%
+% \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+%
+% 论文、手册类型驱动
+% 2016-11-11,增加了译者信息
+%
+\DeclareBibliographyDriver{manual}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ \usebibmacro{title}%
+ \iftoggle{bbx:gbstrict}{}{%
+ \newunit%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}}%
+ \newunit\newblock
+ \usebibmacro{byeditor+others}%增加的译者信息
+ \newunit\newblock
+ \iftoggle{bbx:gbfieldtype}{%
+ \printfield{type}%
+ \setunit*{\addspace}}{}%
+ \printfield{number}%
+ \newunit\newblock
+ \printfield{version}%
+ \newunit
+ \printfield{note}%
+ \newunit\newblock
+ \usebibmacro{institution+location+date}%
+ %\newunit\newblock
+ \usebibmacro{chapter+pages}%
+ \iffieldundef{url}{}{%当没有网址时也不输出修改或更新日期
+ \usebibmacro{modifydate}}%修改或更新日期为带括号的时间
+ \usebibmacro{doi+eprint+url}%
+ \newunit
+ \printfield{pagetotal}%
+ \newunit\newblock
+ \iftoggle{bbx:isbn}
+ {\printfield{isrn}}
+ {}%
+ \newunit\newblock
+% \usebibmacro{doi+eprint+url}%
+% \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+%
+% 备选类型驱动
+%
+% 利用biblatex的misc驱动
+\DeclareBibliographyDriver{misc}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/editor+others/translator+others}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ \usebibmacro{title}%
+\iftoggle{bbx:gbstrict}{}{%
+ \newunit
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}%
+ \newunit\newblock
+ \usebibmacro{byeditor+others}}%
+ \newunit\newblock
+ \printfield{howpublished}%
+ \newunit\newblock
+ \printfield{type}%
+ \newunit
+ \printfield{version}%
+ \newunit
+ \printfield{note}%
+ \newunit\newblock
+ \usebibmacro{institution+location+date}%
+ %\usebibmacro{organization+location+date}%
+ %\newunit\newblock
+ \usebibmacro{doi+eprint+url}%
+ \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+
+%
+% 专著中的析出文献的格式修改
+%
+\DeclareBibliographyDriver{inbook}{%源来自standard.bbx
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/translator+others}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+\usebibmacro{title}%
+\usebibmacro{in:}%
+%\printtext{\texttt{//}\addthinspace}%
+ \usebibmacro{bybookauthor}%
+ \ifnameundef{bookauthor}{%
+ \ifnameundef{editor}{}{\newunit}%
+ }{\newunit}%替换下一句
+ %\newunit\newblock
+\iffieldundef{series}{}{\usebibmacro{series+number}\setunit{\addcolon\addspace}}%为处理一些存在series的情况而增加
+ \usebibmacro{maintitle+booktitle}%
+\iffieldundef{volume}{}{\setunit{\addcolon\addspace}\printfield{volume}}%
+\iffieldundef{number}{}{\setunit{\addcolon\addspace}\printfield{number}}%增加卷和册信息
+ \newunit\newblock%
+% \usebibmacro{byeditor+others}%
+% \newunit\newblock
+ \printfield{edition}%
+ \newunit
+ \iftoggle{bbx:gbstrict}{}{%
+% \iffieldundef{maintitle}
+% {\printfield{volume}%
+% \printfield{part}}
+% {}%
+% \newunit
+% \printfield{volumes}%
+% \newunit\newblock
+% \usebibmacro{series+number}
+ }%
+ \newunit\newblock
+ %\printfield{note}%
+ %\newunit\newblock
+ \usebibmacro{publisher+location+date}%
+ %\newunit\newblock
+ \usebibmacro{chapter+pages}%
+ %\newunit\newblock
+ \usebibmacro{doi+eprint+url}%移到上面来
+ \newunit\newblock
+ \iftoggle{bbx:isbn}
+ {\printfield{isbn}}
+ {}%
+ \newunit\newblock
+% \usebibmacro{doi+eprint+url}%
+% \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
Modified: trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.cbx
===================================================================
--- trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.cbx 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.cbx 2021-01-19 22:57:40 UTC (rev 57468)
@@ -1,376 +1,376 @@
-%%
-%% ---------------------------------------------------------------
-%% biblatex-gb7714-2015 --- A biblatex implementation of the
-%% GBT7714-2015 citation style,numerical sequence
-%% Maintained by huzhenzhen
-%% E-mail: hzzmail at 163.com
-%% Released under the LaTeX Project Public License v1.3c or later
-%% ---------------------------------------------------------------
-%%
-\def\versionofgbtstyle{2020/07/21 v1.0v}
-\ProvidesFile{gb7714-2015.cbx}[\versionofgbtstyle biblatex citation style]
-
-%
-% 加载标准样式
-%
-\RequireCitationStyle{numeric-comp} %numeric
-
-
-%
-% 选项设置
-%
-\ExecuteBibliographyOptions{
- autocite = superscript ,
- autopunct = true ,
- %sorting = none ,
- maxcitenames=1,
- mincitenames=1,
-}
-
-%textcite标注命令中的标点设置
-%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}%
-
-%
-%将连续3篇文献压缩改为连续2篇文献压缩
-%
-%该宏的目的是抛弃压缩内部的编号,而仅输出最后一个编号,主要通过cbx at tempcnta来控制
-%一般情况下cbx at tempcnta为0,所以该宏不输出任何内容。当cbx at tempcnta在cite:comp:comp宏中更改变大后
-%说明开始进入需要压缩的范围,当到压缩终点时,cbx at tempcnta必然大于1,则输出内容。
-%修改第二行的数字1为0即可将默认的3个开始压缩变为2个开始压缩。
-\renewbibmacro*{cite:dump}{%
- \ifnumgreater{\value{cbx at tempcnta}}{0}%
- {\ifnumgreater{\value{cbx at tempcnta}}{0}%1改为0,可以将压缩起始3个编号改为2个编号
- {\bibrangedash}%
- {\multicitedelim}%
- \bibhyperref[\cbx at lastkey]{%
- \ifdef\cbx at lastprefix%
- {\printtext[labelprefix]{\cbx at lastprefix}}%
- {}%
- \printtext[labelnumber]{\cbx at lastnumber}}}%
- {}%
- \setcounter{cbx at tempcnta}{0}%
- \global\undef\cbx at lastprefix}
-
-%
-% 定义一个上标方括号wrapper
-%
-\newcommand*\mkbibsuperbracket[1]{%
- \mkbibsuperscript{\mkbibbrackets{#1}}%
-}
-
-% 修改postnote的输出格式
-\DeclareFieldFormat{postnote}{#1}
-
-%
-% 重定义cite命令
-%
-% 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode}
-% v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式
-\DeclareCiteCommand{\cite}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号
- {[\usebibmacro{cite:init}%
- \usebibmacro{prenote}}
- {\usebibmacro{citeindex}%
- \usebibmacro{cite:comp}}
- {}
- {\usebibmacro{cite:dump}]%
- \printfield{postnote}}
-% v1.0p 以前用的方式
-%\DeclareCiteCommand{\cite}[\mkbibsuperbracket]%利用mkbibsuperbracket添加方括号
-% {\usebibmacro{cite:init}%
-% \usebibmacro{prenote}}
-% {\usebibmacro{citeindex}%
-% \usebibmacro{cite:comp}}
-% {}
-% {\usebibmacro{cite:dump}%
-% \usebibmacro{postnote}}
-
-%
-% 定义upcite命令
-% 20180604,v1.0l,hzz
-% 20190409,v1.0r,hzz
-% 方法:对supercite增加[]
-\newrobustcmd*{\upcite}{%
- \cite}
-
-%
-% 重定义parencite命令,以满足标签带页码的国标要求
-%
-\DeclareCiteCommand{\parencite}%[\mkbibbrackets]
- {[\usebibmacro{cite:init}%]
- \usebibmacro{prenote}}%
- {\usebibmacro{citeindex}%
- \usebibmacro{cite:comp}}
- {}
- {%[
- \usebibmacro{cite:dump}]%
- \mkbibsuperscript{\printfield{postnote}}}
-
-%
-% 新定义pagescite命令,以满足标签带页码的国标要求
-%
-% 原理方法:
-% 1.新增页码输出宏
-\newbibmacro*{postpages}{%
- \iffieldundef{postnote}
- {\printfield[postnote]{pages}}
- {\printfield{postnote}}}
-% 2.新增\pagescite引用命令
-\DeclareCiteCommand{\pagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标
- {[\usebibmacro{cite:init}%]直接添加方括号
- \usebibmacro{prenote}%
- }
- {\usebibmacro{citeindex}%
- \usebibmacro{cite:comp}}
- {}
- {\usebibmacro{cite:dump}]%
- \usebibmacro{postpages}}
-
-%
-% 定义yearpagescite,为与ay样式兼容,等同于\pagescite
-%
-\DeclareCiteCommand{\yearpagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标
- {[\usebibmacro{cite:init}%]直接添加方括号
- \usebibmacro{prenote}%
- }
- {\usebibmacro{citeindex}%
- \usebibmacro{cite:comp}}
- {}
- {\usebibmacro{cite:dump}]%
- \usebibmacro{postpages}}
-
-%
-% 定义\yearcite命令,为与ay样式兼容,且提供不输出页码的标签格式,
-%
-% 原理方法:等同于\pagescite,但不要页码
-\DeclareCiteCommand{\yearcite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标
- {[\usebibmacro{cite:init}%]直接添加方括号
- \usebibmacro{prenote}%
- }
- {\usebibmacro{citeindex}%
- \usebibmacro{cite:comp}}
- {}
- {\usebibmacro{cite:dump}]}
-
-%
-% 定义\authornumcite命令,输出作者信息,然后在后面带上顺序编码
-% 20180427,v1.0k,增加,hzz
-% gb7714样式新定义的命令都把cite放到最后,比如前面的pagescite,yearcite,这里的\authornumcite
-% 区别于biblatex定义的命令都把cite放到前面,比如citeauthor等。
-%见numeric.CBX
-\newbibmacro*{cite}{%
- \printtext[bibhyperref]{%
- \printfield{labelprefix}%
- \printfield{labelnumber}%
- \ifbool{bbx:subentry}
- {\printfield{entrysetcount}}
- {}}}
-%见numeric.CBX,\DeclareCiteCommand{\cite},
-\DeclareCiteCommand{\authornumcite}%[\mkbibsuperscript]
- {\usebibmacro{prenote}}
- {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace
- {\renewcommand*{\andothersdelim}{\addspace}}%
- \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}%
- \usebibmacro{cite}}}}
- {\multicitedelim}
- {\mkbibsuperscript{\printfield{postnote}}}
-
-
-%
-% 增加如下多个命令
-% 20190409,v1.0r,hzz
-% 方法:利用newcommand或newrobustcmd命令进行定义
-% 注意\citet和\citep命令之所以不用newrobustcmd,是为避免加载natbib模块后产生冲突
-%\DeclareCiteCommand{\citet}%
-% {\usebibmacro{prenote}}
-% {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace
-% {\renewcommand*{\andothersdelim}{\addspace}}%
-% \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}%
-% \usebibmacro{cite}}}}
-% {\multicitedelim}
-% {\mkbibsuperscript{\printfield{postnote}}}
-
-%
-% 重定义citet,因为前面与\authornumcite同定义的命令无法正确处理多个bibtexkey同时给出的压缩情况
-% 20200721,v1.0v,hzz
-% 方法:利用textcite命令进行定义
-% 基本利用textcite命令来写citet,仅利用bool{cbx:incitet}做判断,进而处理不同的上标和页码形式
-\newbool{cbx:incitet}
-\global\booltrue{cbx:incitet}
-
-\newbibmacro*{citet}{%
- \iffieldequals{namehash}{\cbx at lasthash}%
- {\usebibmacro{cite:comp}}%
- {\usebibmacro{cite:dump}%
- \ifbool{cbx:parens}%
- {\mkbibsuperscript{\printtext{\bibclosebracket}}\global\boolfalse{cbx:parens}}%
- {}%
- \iffirstcitekey
- {}
- {\textcitedelim}%
- \usebibmacro{cite:init}%
- \ifnameundef{labelname}
- {\printfield[citetitle]{labeltitle}}
- {\printnames{labelname}}%
- \setunit*{\printdelim{namelabeldelim}}%
- \mkbibsuperscript{\printtext{\bibopenbracket}\global\booltrue{cbx:parens}%
- \ifnumequal{\value{citecount}}{1}
- {\usebibmacro{prenote}}%
- {}%
- \usebibmacro{cite:comp}%
- \stepcounter{textcitecount}%
- \savefield{namehash}{\cbx at lasthash}}}}
-
-\DeclareCiteCommand{\cbx at textcite}%
- {\usebibmacro{cite:init}}%
- {\usebibmacro{citeindex}%
- \ifbool{cbx:incitet}{\usebibmacro{citet}}{\usebibmacro{textcite}}%
- }%
- {}%
- {\ifbool{cbx:incitet}{\mkbibsuperscript{\usebibmacro{cite:dump}\usebibmacro{postnote}}}%
- {\usebibmacro{cite:dump}\usebibmacro{postnote}}%
- \ifbool{cbx:parens}%
- {\ifbool{cbx:incitet}{\mkbibsuperscript{\bibclosebracket}}{\bibclosebracket}%
- \global\boolfalse{cbx:parens}}%
- {}}
-
- \newrobustcmd{\cbx at citet@init}[2]{%
- \global\booltrue{cbx:incitet}%
- \setcounter{textcitetotal}{0}%
- \setcounter{textcitecount}{0}%
- \def\cbx at savedcites{#1}#2\cbx at savedcites\empty}
-
- \renewrobustcmd{\cbx at textcite@init}[2]{%
- \global\boolfalse{cbx:incitet}%
- \setcounter{textcitetotal}{0}%
- \setcounter{textcitecount}{0}%
- \def\cbx at savedcites{#1}#2\cbx at savedcites\empty}
-
-\DeclareCiteCommand{\citet}[\cbx at citet@init\cbx at textcite]
- {\gdef\cbx at savedkeys{}%
- \citetrackerfalse%
- \pagetrackerfalse%
- \DeferNextCitekeyHook%
- \usebibmacro{cite:init}}
- {\ifthenelse{\iffirstcitekey\AND\value{multicitetotal}>0}
- {\protected at xappto\cbx at savedcites{()(\thefield{multipostnote})}%
- \global\clearfield{multipostnote}}
- {}%
- \xappto\cbx at savedkeys{\thefield{entrykey},}%
- \iffieldequals{namehash}{\cbx at lasthash}
- {}
- {\stepcounter{textcitetotal}%
- \savefield{namehash}{\cbx at lasthash}}}
- {}
- {\protected at xappto\cbx at savedcites{%
- [\thefield{prenote}][\thefield{postnote}]{\cbx at savedkeys}}}
-
-
-
-\DeclareCiteCommand{\citep}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号
- {[\usebibmacro{cite:init}%
- \usebibmacro{prenote}}
- {\usebibmacro{citeindex}%
- \usebibmacro{cite:comp}}
- {}
- {\usebibmacro{cite:dump}]%
- \printfield{postnote}}
-
-\newrobustcmd*{\citetns}%
- {\textcite}
-
-\newrobustcmd*{\citepns}%
- {\parencite}
-
-\newrobustcmd*{\inlinecite}%
- {\parencite}
-
-%
-% 增加如下复数的命令,以符合biblatex的复数命令习惯
-% 20190430,v1.0r,hzz
-% citec和citecs命令是实现了[1]-[3]这样的压缩形式。
-% authornumcites是常用命令authornumcite的复数形式
-\DeclareFieldFormat{labelbracket}{\mkbibbrackets{#1}}
-
-\newbibmacro*{citec:comp:comp}{%
- \ifboolexpr{
- ( test {\iffieldundef{labelprefix}} and test {\ifundef\cbx at lastprefix} )
- or
- test {\iffieldequals{labelprefix}{\cbx at lastprefix}}
- }
- {\ifnumequal{\thefield{labelnumber}}{\value{cbx at tempcntb}}
- {\savefield{entrykey}{\cbx at lastkey}%
- \savefield{labelnumber}{\cbx at lastnumber}%
- \addtocounter{cbx at tempcnta}{1}}
- {\ifnumequal{\thefield{labelnumber}}{\value{cbx at tempcntb}-1}
- {}
- {\usebibmacro{citec:dump}%
- \ifnumgreater{\value{cbx at tempcntb}}{-1}
- {\multicitedelim}
- {}%
- \printtext[bibhyperref]{%
- \printfield{labelprefix}%
- \printtext[labelbracket]{\printfield{labelnumber}}}}}}
- {\usebibmacro{cite:comp:end}}%
- \setcounter{cbx at tempcntb}{\thefield{labelnumber}}%
- \savefield{labelprefix}{\cbx at lastprefix}}
-
-\newbibmacro*{citec:comp}{%
- \addtocounter{cbx at tempcntb}{1}%
- \iffieldundef{shorthand}
- {\ifbool{bbx:subentry}
- {\iffieldundef{entrysetcount}
- {\usebibmacro{citec:comp:comp}}
- {\usebibmacro{cite:comp:inset}}}
- {\usebibmacro{citec:comp:comp}}}
- {\usebibmacro{cite:comp:shand}}}
-
-\newbibmacro*{citec:dump}{%
- \ifnumgreater{\value{cbx at tempcnta}}{0}
- {\ifnumgreater{\value{cbx at tempcnta}}{1}
- {\bibrangedash}
- {\multicitedelim}%
- \bibhyperref[\cbx at lastkey]{%
- \ifdef\cbx at lastprefix
- {\printtext[labelprefix]{\cbx at lastprefix}}
- {}%
- \printtext[labelbracket]{\cbx at lastnumber}}}%labelnumber
- {}%
- \setcounter{cbx at tempcnta}{0}%
- \global\undef\cbx at lastprefix}
-
-%\DeclareCiteCommand{\citec}[\mkbibsuperscript]%[\mkbibbrackets]
-% {\usebibmacro{cite:init}%
-% \usebibmacro{prenote}}
-% {\usebibmacro{citeindex}%
-% \usebibmacro{citec:comp}}
-% {}
-% {\usebibmacro{citec:dump}%
-% \usebibmacro{postnote}}
-
-%上面这个用于非压缩情况,这里考虑了压缩的情况
-\DeclareCiteCommand{\citec}[\mkbibsuperscript]%
- {\ifnumless{\value{multicitecount}}{2}
- {\usebibmacro{cite:init}%
- \usebibmacro{prenote}}
- {\iffieldundef{prenote}
- {\iffieldundef{postnote}
- {}
- {\usebibmacro{citec:dump}%
- \usebibmacro{cite:init}%
- \setunit{\multicitedelim}}}
- {\usebibmacro{citec:dump}%
- \usebibmacro{cite:init}%
- \setunit{\multicitedelim}%
- \usebibmacro{prenote}}}}
- {\usebibmacro{citeindex}%
- \usebibmacro{citec:comp}}
- {}
- {\ifboolexpr{ test {\ifnumequal{\value{multicitecount}}{\value{multicitetotal}}}
- or not test {\iffieldundef{postnote}}}
- {\usebibmacro{citec:dump}%
- \usebibmacro{postnote}}
- {}}
-
-\DeclareMultiCiteCommand{\citecs}[\mkbibsuperscript]{\citec}{}
-
-\DeclareMultiCiteCommand{\authornumcites}[]{\authornumcite}{\multicitedelim}
+%%
+%% ---------------------------------------------------------------
+%% biblatex-gb7714-2015 --- A biblatex implementation of the
+%% GBT7714-2015 citation style,numerical sequence
+%% Maintained by huzhenzhen
+%% E-mail: hzzmail at 163.com
+%% Released under the LaTeX Project Public License v1.3c or later
+%% ---------------------------------------------------------------
+%%
+\def\versionofgbtstyle{2021/01/19 v1.0w}
+\ProvidesFile{gb7714-2015.cbx}[\versionofgbtstyle biblatex citation style]
+
+%
+% 加载标准样式
+%
+\RequireCitationStyle{numeric-comp} %numeric
+
+
+%
+% 选项设置
+%
+\ExecuteBibliographyOptions{
+ autocite = superscript ,
+ autopunct = true ,
+ %sorting = none ,
+ maxcitenames=1,
+ mincitenames=1,
+}
+
+%textcite标注命令中的标点设置
+%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}%
+
+%
+%将连续3篇文献压缩改为连续2篇文献压缩
+%
+%该宏的目的是抛弃压缩内部的编号,而仅输出最后一个编号,主要通过cbx at tempcnta来控制
+%一般情况下cbx at tempcnta为0,所以该宏不输出任何内容。当cbx at tempcnta在cite:comp:comp宏中更改变大后
+%说明开始进入需要压缩的范围,当到压缩终点时,cbx at tempcnta必然大于1,则输出内容。
+%修改第二行的数字1为0即可将默认的3个开始压缩变为2个开始压缩。
+\renewbibmacro*{cite:dump}{%
+ \ifnumgreater{\value{cbx at tempcnta}}{0}%
+ {\ifnumgreater{\value{cbx at tempcnta}}{0}%1改为0,可以将压缩起始3个编号改为2个编号
+ {\bibrangedash}%
+ {\multicitedelim}%
+ \bibhyperref[\cbx at lastkey]{%
+ \ifdef\cbx at lastprefix%
+ {\printtext[labelprefix]{\cbx at lastprefix}}%
+ {}%
+ \printtext[labelnumber]{\cbx at lastnumber}}}%
+ {}%
+ \setcounter{cbx at tempcnta}{0}%
+ \global\undef\cbx at lastprefix}
+
+%
+% 定义一个上标方括号wrapper
+%
+\newcommand*\mkbibsuperbracket[1]{%
+ \mkbibsuperscript{\mkbibbrackets{#1}}%
+}
+
+% 修改postnote的输出格式
+\DeclareFieldFormat{postnote}{#1}
+
+%
+% 重定义cite命令
+%
+% 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode}
+% v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式
+\DeclareCiteCommand{\cite}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号
+ {[\usebibmacro{cite:init}%
+ \usebibmacro{prenote}}
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite:comp}}
+ {}
+ {\usebibmacro{cite:dump}]%
+ \printfield{postnote}}
+% v1.0p 以前用的方式
+%\DeclareCiteCommand{\cite}[\mkbibsuperbracket]%利用mkbibsuperbracket添加方括号
+% {\usebibmacro{cite:init}%
+% \usebibmacro{prenote}}
+% {\usebibmacro{citeindex}%
+% \usebibmacro{cite:comp}}
+% {}
+% {\usebibmacro{cite:dump}%
+% \usebibmacro{postnote}}
+
+%
+% 定义upcite命令
+% 20180604,v1.0l,hzz
+% 20190409,v1.0r,hzz
+% 方法:对supercite增加[]
+\newrobustcmd*{\upcite}{%
+ \cite}
+
+%
+% 重定义parencite命令,以满足标签带页码的国标要求
+%
+\DeclareCiteCommand{\parencite}%[\mkbibbrackets]
+ {[\usebibmacro{cite:init}%]
+ \usebibmacro{prenote}}%
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite:comp}}
+ {}
+ {%[
+ \usebibmacro{cite:dump}]%
+ \mkbibsuperscript{\printfield{postnote}}}
+
+%
+% 新定义pagescite命令,以满足标签带页码的国标要求
+%
+% 原理方法:
+% 1.新增页码输出宏
+\newbibmacro*{postpages}{%
+ \iffieldundef{postnote}
+ {\printfield[postnote]{pages}}
+ {\printfield{postnote}}}
+% 2.新增\pagescite引用命令
+\DeclareCiteCommand{\pagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标
+ {[\usebibmacro{cite:init}%]直接添加方括号
+ \usebibmacro{prenote}%
+ }
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite:comp}}
+ {}
+ {\usebibmacro{cite:dump}]%
+ \usebibmacro{postpages}}
+
+%
+% 定义yearpagescite,为与ay样式兼容,等同于\pagescite
+%
+\DeclareCiteCommand{\yearpagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标
+ {[\usebibmacro{cite:init}%]直接添加方括号
+ \usebibmacro{prenote}%
+ }
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite:comp}}
+ {}
+ {\usebibmacro{cite:dump}]%
+ \usebibmacro{postpages}}
+
+%
+% 定义\yearcite命令,为与ay样式兼容,且提供不输出页码的标签格式,
+%
+% 原理方法:等同于\pagescite,但不要页码
+\DeclareCiteCommand{\yearcite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标
+ {[\usebibmacro{cite:init}%]直接添加方括号
+ \usebibmacro{prenote}%
+ }
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite:comp}}
+ {}
+ {\usebibmacro{cite:dump}]}
+
+%
+% 定义\authornumcite命令,输出作者信息,然后在后面带上顺序编码
+% 20180427,v1.0k,增加,hzz
+% gb7714样式新定义的命令都把cite放到最后,比如前面的pagescite,yearcite,这里的\authornumcite
+% 区别于biblatex定义的命令都把cite放到前面,比如citeauthor等。
+%见numeric.CBX
+\newbibmacro*{cite}{%
+ \printtext[bibhyperref]{%
+ \printfield{labelprefix}%
+ \printfield{labelnumber}%
+ \ifbool{bbx:subentry}
+ {\printfield{entrysetcount}}
+ {}}}
+%见numeric.CBX,\DeclareCiteCommand{\cite},
+\DeclareCiteCommand{\authornumcite}%[\mkbibsuperscript]
+ {\usebibmacro{prenote}}
+ {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace
+ {\renewcommand*{\andothersdelim}{\addspace}}%
+ \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}%
+ \usebibmacro{cite}}}}
+ {\multicitedelim}
+ {\mkbibsuperscript{\printfield{postnote}}}
+
+
+%
+% 增加如下多个命令
+% 20190409,v1.0r,hzz
+% 方法:利用newcommand或newrobustcmd命令进行定义
+% 注意\citet和\citep命令之所以不用newrobustcmd,是为避免加载natbib模块后产生冲突
+%\DeclareCiteCommand{\citet}%
+% {\usebibmacro{prenote}}
+% {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace
+% {\renewcommand*{\andothersdelim}{\addspace}}%
+% \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}%
+% \usebibmacro{cite}}}}
+% {\multicitedelim}
+% {\mkbibsuperscript{\printfield{postnote}}}
+
+%
+% 重定义citet,因为前面与\authornumcite同定义的命令无法正确处理多个bibtexkey同时给出的压缩情况
+% 20200721,v1.0v,hzz
+% 方法:利用textcite命令进行定义
+% 基本利用textcite命令来写citet,仅利用bool{cbx:incitet}做判断,进而处理不同的上标和页码形式
+\newbool{cbx:incitet}
+\global\booltrue{cbx:incitet}
+
+\newbibmacro*{citet}{%
+ \iffieldequals{namehash}{\cbx at lasthash}%
+ {\usebibmacro{cite:comp}}%
+ {\usebibmacro{cite:dump}%
+ \ifbool{cbx:parens}%
+ {\mkbibsuperscript{\printtext{\bibclosebracket}}\global\boolfalse{cbx:parens}}%
+ {}%
+ \iffirstcitekey
+ {}
+ {\textcitedelim}%
+ \usebibmacro{cite:init}%
+ \ifnameundef{labelname}
+ {\printfield[citetitle]{labeltitle}}
+ {\printnames{labelname}}%
+ \setunit*{\printdelim{namelabeldelim}}%
+ \mkbibsuperscript{\printtext{\bibopenbracket}\global\booltrue{cbx:parens}%
+ \ifnumequal{\value{citecount}}{1}
+ {\usebibmacro{prenote}}%
+ {}%
+ \usebibmacro{cite:comp}%
+ \stepcounter{textcitecount}%
+ \savefield{namehash}{\cbx at lasthash}}}}
+
+\DeclareCiteCommand{\cbx at textcite}%
+ {\usebibmacro{cite:init}}%
+ {\usebibmacro{citeindex}%
+ \ifbool{cbx:incitet}{\usebibmacro{citet}}{\usebibmacro{textcite}}%
+ }%
+ {}%
+ {\ifbool{cbx:incitet}{\mkbibsuperscript{\usebibmacro{cite:dump}\usebibmacro{postnote}}}%
+ {\usebibmacro{cite:dump}\usebibmacro{postnote}}%
+ \ifbool{cbx:parens}%
+ {\ifbool{cbx:incitet}{\mkbibsuperscript{\bibclosebracket}}{\bibclosebracket}%
+ \global\boolfalse{cbx:parens}}%
+ {}}
+
+ \newrobustcmd{\cbx at citet@init}[2]{%
+ \global\booltrue{cbx:incitet}%
+ \setcounter{textcitetotal}{0}%
+ \setcounter{textcitecount}{0}%
+ \def\cbx at savedcites{#1}#2\cbx at savedcites\empty}
+
+ \renewrobustcmd{\cbx at textcite@init}[2]{%
+ \global\boolfalse{cbx:incitet}%
+ \setcounter{textcitetotal}{0}%
+ \setcounter{textcitecount}{0}%
+ \def\cbx at savedcites{#1}#2\cbx at savedcites\empty}
+
+\DeclareCiteCommand{\citet}[\cbx at citet@init\cbx at textcite]
+ {\gdef\cbx at savedkeys{}%
+ \citetrackerfalse%
+ \pagetrackerfalse%
+ \DeferNextCitekeyHook%
+ \usebibmacro{cite:init}}
+ {\ifthenelse{\iffirstcitekey\AND\value{multicitetotal}>0}
+ {\protected at xappto\cbx at savedcites{()(\thefield{multipostnote})}%
+ \global\clearfield{multipostnote}}
+ {}%
+ \xappto\cbx at savedkeys{\thefield{entrykey},}%
+ \iffieldequals{namehash}{\cbx at lasthash}
+ {}
+ {\stepcounter{textcitetotal}%
+ \savefield{namehash}{\cbx at lasthash}}}
+ {}
+ {\protected at xappto\cbx at savedcites{%
+ [\thefield{prenote}][\thefield{postnote}]{\cbx at savedkeys}}}
+
+
+
+\DeclareCiteCommand{\citep}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号
+ {[\usebibmacro{cite:init}%
+ \usebibmacro{prenote}}
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite:comp}}
+ {}
+ {\usebibmacro{cite:dump}]%
+ \printfield{postnote}}
+
+\newrobustcmd*{\citetns}%
+ {\textcite}
+
+\newrobustcmd*{\citepns}%
+ {\parencite}
+
+\newrobustcmd*{\inlinecite}%
+ {\parencite}
+
+%
+% 增加如下复数的命令,以符合biblatex的复数命令习惯
+% 20190430,v1.0r,hzz
+% citec和citecs命令是实现了[1]-[3]这样的压缩形式。
+% authornumcites是常用命令authornumcite的复数形式
+\DeclareFieldFormat{labelbracket}{\mkbibbrackets{#1}}
+
+\newbibmacro*{citec:comp:comp}{%
+ \ifboolexpr{
+ ( test {\iffieldundef{labelprefix}} and test {\ifundef\cbx at lastprefix} )
+ or
+ test {\iffieldequals{labelprefix}{\cbx at lastprefix}}
+ }
+ {\ifnumequal{\thefield{labelnumber}}{\value{cbx at tempcntb}}
+ {\savefield{entrykey}{\cbx at lastkey}%
+ \savefield{labelnumber}{\cbx at lastnumber}%
+ \addtocounter{cbx at tempcnta}{1}}
+ {\ifnumequal{\thefield{labelnumber}}{\value{cbx at tempcntb}-1}
+ {}
+ {\usebibmacro{citec:dump}%
+ \ifnumgreater{\value{cbx at tempcntb}}{-1}
+ {\multicitedelim}
+ {}%
+ \printtext[bibhyperref]{%
+ \printfield{labelprefix}%
+ \printtext[labelbracket]{\printfield{labelnumber}}}}}}
+ {\usebibmacro{cite:comp:end}}%
+ \setcounter{cbx at tempcntb}{\thefield{labelnumber}}%
+ \savefield{labelprefix}{\cbx at lastprefix}}
+
+\newbibmacro*{citec:comp}{%
+ \addtocounter{cbx at tempcntb}{1}%
+ \iffieldundef{shorthand}
+ {\ifbool{bbx:subentry}
+ {\iffieldundef{entrysetcount}
+ {\usebibmacro{citec:comp:comp}}
+ {\usebibmacro{cite:comp:inset}}}
+ {\usebibmacro{citec:comp:comp}}}
+ {\usebibmacro{cite:comp:shand}}}
+
+\newbibmacro*{citec:dump}{%
+ \ifnumgreater{\value{cbx at tempcnta}}{0}
+ {\ifnumgreater{\value{cbx at tempcnta}}{1}
+ {\bibrangedash}
+ {\multicitedelim}%
+ \bibhyperref[\cbx at lastkey]{%
+ \ifdef\cbx at lastprefix
+ {\printtext[labelprefix]{\cbx at lastprefix}}
+ {}%
+ \printtext[labelbracket]{\cbx at lastnumber}}}%labelnumber
+ {}%
+ \setcounter{cbx at tempcnta}{0}%
+ \global\undef\cbx at lastprefix}
+
+%\DeclareCiteCommand{\citec}[\mkbibsuperscript]%[\mkbibbrackets]
+% {\usebibmacro{cite:init}%
+% \usebibmacro{prenote}}
+% {\usebibmacro{citeindex}%
+% \usebibmacro{citec:comp}}
+% {}
+% {\usebibmacro{citec:dump}%
+% \usebibmacro{postnote}}
+
+%上面这个用于非压缩情况,这里考虑了压缩的情况
+\DeclareCiteCommand{\citec}[\mkbibsuperscript]%
+ {\ifnumless{\value{multicitecount}}{2}
+ {\usebibmacro{cite:init}%
+ \usebibmacro{prenote}}
+ {\iffieldundef{prenote}
+ {\iffieldundef{postnote}
+ {}
+ {\usebibmacro{citec:dump}%
+ \usebibmacro{cite:init}%
+ \setunit{\multicitedelim}}}
+ {\usebibmacro{citec:dump}%
+ \usebibmacro{cite:init}%
+ \setunit{\multicitedelim}%
+ \usebibmacro{prenote}}}}
+ {\usebibmacro{citeindex}%
+ \usebibmacro{citec:comp}}
+ {}
+ {\ifboolexpr{ test {\ifnumequal{\value{multicitecount}}{\value{multicitetotal}}}
+ or not test {\iffieldundef{postnote}}}
+ {\usebibmacro{citec:dump}%
+ \usebibmacro{postnote}}
+ {}}
+
+\DeclareMultiCiteCommand{\citecs}[\mkbibsuperscript]{\citec}{}
+
+\DeclareMultiCiteCommand{\authornumcites}[]{\authornumcite}{\multicitedelim}
Modified: trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx
===================================================================
--- trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx 2021-01-19 22:57:40 UTC (rev 57468)
@@ -1,3844 +1,3845 @@
-%%
-%% ---------------------------------------------------------------
-%% biblatex-gb7714-2015 --- A biblatex implementation of the
-%% GBT7714-2015 bibliography style,author year sequence
-%% Maintained by huzhenzhen
-%% E-mail: hzzmail at 163.com
-%% Released under the LaTeX Project Public License v1.3c or later
-%% ---------------------------------------------------------------
-%%
-%
-% 版本和时间信息
-%
-\def\versionofgbtstyle{2020/07/21 v1.0v}
-\def\versionofbiblatex{\abx at version}
-\ProvidesFile{gb7714-2015ay.bbx}[\versionofgbtstyle biblatex bibliography style]
-%\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求
-
-%=====================================================================
-%加载标准样式
-%=====================================================================
-\RequireBibliographyStyle{authoryear}
-\RequirePackage{xstring}%解决texlive2015的biblatex3.0不加载xstring包的问题
-
-
-%=====================================================================
-% 功能函数
-%=====================================================================
- %
- % biblatex版本判断
- % 20180405,v1.0k,为兼容biblatexv3.11增加toggle:iftlnine,HU zhenzhen
- % 20181020,v1.0n,为不再使用xstring宏包做的修改,hzz
- %
- % 原理方法:当版本继续更新时,增加一个新的toggle用以处理新的旧版,最新版和未判断出来的版本永远用iftlatest
- \providetoggle{iftlfive}\togglefalse{iftlfive} %处理biblatex3.2之前版本,时间2016-03-01前
- \providetoggle{iftlsix}\togglefalse{iftlsix} %处理biblatex3.3开始改变姓名机制后版本,时间2016-03-01及以后
- \providetoggle{iftlseven}\togglefalse{iftlseven}%处理biblatex3.7的兼容性,时间2016-12-01后
- \providetoggle{iftleight}\togglefalse{iftleight}%处理biblatex3.8到3.9的兼容性,时间2017-11-01后到2017-12-01前
- \providetoggle{iftlnine}\togglefalse{iftlnine} %处理biblatex10的兼容性,时间2017-12-01后
- \providetoggle{iftlatest}\toggletrue{iftlatest} %假设是最新版biblatex
- \@ifpackagelater{biblatex}{2014/04/01}{
- \@ifpackagelater{biblatex}{2016/03/01}{
- \@ifpackagelater{biblatex}{2016/12/01}{
- \@ifpackagelater{biblatex}{2017/11/01}{
- \@ifpackagelater{biblatex}{2017/12/01}{
- \@ifpackagelater{biblatex}{2018/02/19}{}
- {\toggletrue{iftlnine}\togglefalse{iftlatest}}}
- {\toggletrue{iftleight}\togglefalse{iftlatest}}}
- {\toggletrue{iftlseven}\togglefalse{iftlatest}}}
- {\toggletrue{iftlsix}\togglefalse{iftlatest}}}
- {\toggletrue{iftlfive}\togglefalse{iftlatest}}}
- {\PackageError{biblatex}{Outdated 'biblatex' package}
- {Please update biblatex, This is a fatal error.}}
-
- \newcommand\defversion[2]{\csdef{codeversion#1#2}}%定义不同版本的命令
- \newcommand\switchversion[2]{\csuse{codeversion#1#2}}%使用不同版本的命令
-
- %
- % 判断CJK字符的函数,用于判断作者等信息是否由中文字符构成
- % v1.0k,20180509,hzz
- %
- % 原理方法:用biber中的perl方法代替。因为利用tex函数对字符判断时,当字符在宏
- % 中时,基于`的方法无法解决GBK编码的问题,基于CJKsymbol的方法无法解决utf-8
- % 编码用xelatex编译的问题。
- %
- % 原理是:利用perl正则将中文标识记录到域中,
- % 然后利用\iffieldundef和\iffieldequalstr进行判断
- \providetoggle{ifCJKforgbt}
- \def\testCJKfirst#1{%
- \iffieldundef{#1}{\togglefalse{ifCJKforgbt}}{%
- \iffieldequalstr{#1}{chinese}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}}}
-
- %
- % 2个卷的解析函数,用于连续出版物
- %
- % 原理方法: 范围起止间隔符号还是用-,而不是与date相同的/,因为有合期期刊的问题,需要用到/符号
- \newcommand{\multivolparser}[1]{%
- \IfSubStr{#1}{-}%
- {\StrBefore{#1}{-}[\multivolfirst]\StrBehind{#1}{-}[\multivolsecond]}%
- {\def\multivolfirst{#1}\def\multivolsecond{}}%
- }
-
- %
- % 2个期的解析函数,用于连续出版物
- %
- \newcommand{\multinumberparser}[1]{%
- \IfSubStr{#1}{-}%
- {\StrBefore{#1}{-}[\multinumberfirst]\StrBehind{#1}{-}[\multinumbersecond]}%
- {\def\multinumberfirst{#1}\def\multinumbersecond{}}%
- }
-
- % 对没有分隔符环境命令的低版本biblatex做增补,避免报错
- %
- \iftoggle{iftlfive}{
-
- \def\blx at inf@delimdeclare#1#2{%
- \blx at info{Delimiter '#1' in context '#2' already defined, overwriting}}
-
- \def\blx at warn@delimuse#1#2{%
- \blx at warning{Delimiter '#1' in context '#2' undefined}}
- % Delimiter interface
-
- % [<contextname, ...>]{<name, ...>}{<code>}
- \newrobustcmd*{\DeclareDelimFormat}{%
- \@ifstar
- {\blx at declaredelimclear}
- {\blx at declaredelim}}
-
- \newrobustcmd*{\blx at declaredelimclear}[3][]{%
- \ifcsvoid{blx at declaredelimcontexts@#2}
- {}
- {\def\do##1{\csundef{blx at printdelim@##1@#2}}%
- \dolistcsloop{blx at declaredelimcontexts@#2}}%
- \cslet{blx at declaredelimcontexts@#2}\@empty
- \ifblank{#1}
- {\blx at declaredelim{#2}{#3}}
- {\blx at declaredelim[#1]{#2}{#3}}}
-
- \newrobustcmd*{\blx at declaredelim}[3][]{%
- \ifblank{#1}
- {\blx at declaredelim@i{}{}{#2}{#3}}
- {\def\do##1{%
- \listcsadd{blx at declaredelimcontexts@#2}{##1}%
- \blx at declaredelim@i{blx at printdelim@##1@}{##1}{#2}{#3}}%
- \docsvlist{#1}}}%
-
- \def\blx at declaredelim@i#1#2#3#4{%
- \def\do at i##1{%
- \ifcsdef{#1##1}
- {\blx at inf@delimdeclare{##1}{#2}}
- {}%
- \csdef{#1##1}{#4}}%
- \forcsvlist{\do at i}{#3}}
-
- % *[<contextname, ...>]{<alias>}{<delim>}
- \newrobustcmd*{\DeclareDelimAlias}{%
- \@ifstar
- {\blx at declaredelimalias}
- {\blx at declaredelimaliasauto}}
-
- \newrobustcmd*{\blx at declaredelimalias}[3][]{%
- \ifblank{#1}
- {\blx at declaredelimalias@i{}{#2}{#3}}
- {\def\do##1{%
- \blx at declaredelimalias@i{blx at printdelim@##1@}{#2}{#3}}%
- \docsvlist{#1}}}
-
- \newrobustcmd*{\blx at declaredelimaliasauto}[2]{%
- \blx at declaredelimalias@i{}{#1}{#2}%
- \ifcsvoid{blx at declaredelimcontexts@#2}
- {}
- {\def\do##1{%
- \blx at declaredelimalias@i{blx at printdelim@##1@}{#1}{#2}}%
- \dolistcsloop{blx at declaredelimcontexts@#2}}}
-
- \def\blx at declaredelimalias@i#1#2#3{%
- \ifcsdef{#1#2}
- {\blx at inf@delimdeclare{#2}{#1}}
- {}%
- \csdef{#1#2}{\csuse{#1#3}}}
-
- \def\blx at delimcontext{none}
- \newcommand*{\printdelim}[2][]{%
- \ifblank{#1}
- {\ifcsdef{blx at printdelim@\blx at delimcontext @#2}
- {\csuse{blx at printdelim@\blx at delimcontext @#2}}
- {\ifcsdef{#2}% fall back on legacy macros
- {\csuse{#2}}
- {\blx at warn@delimuse{#2}{*}}}}
- {\ifcsdef{blx at printdelim@#1@#2}
- {\csuse{blx at printdelim@#1@#2}}
- {\blx at warn@delimuse{#2}{#1}}}}
-
- \newcommand*{\delimcontext}[1]{%
- \edef\blx at delimcontext{\blx at delimcontextalias{#1}}}
-
- \def\blx at delimcontextalias#1{%
- \ifcsdef{blx at delimcontextalias@#1}
- {\csuse{blx at delimcontextalias@#1}}
- {#1}}
-
- \newcommand*{\DeclareDelimcontextAlias}[2]{%
- \csgdef{blx at delimcontextalias@#1}{#2}}
- }{}
-
-
-%=====================================================================
-% 数据模型定义
-%=====================================================================
- %定义类型和载体标识,从gb内容看载体基本属于介质。
- %为与lee zeping的bst的样式统一,使用mark和medium这两域名
- %为单个条目的姓名格式控制增加nameformat和namefmtid两个域
- %为缩略信息文献表增加了shortbooktitle域
- %为多语言排序增加了lansortorder域
- \DeclareDatamodelFields[type=field,datatype=literal]{mark,medium,nameformat}
- \DeclareDatamodelFields[type=field,datatype=integer]{namefmtid}
- \DeclareDatamodelFields[type=field,datatype=literal]{shortbooktitle}
- \DeclareDatamodelFields[type=field,datatype=literal]{lansortorder}
-
- %因为biblatex更新3.14版本以后,biber对于为声明数据模型的条目类型
- %不再默认读取,而是以空字符串作为条目类型名,自然在条目定义alias时
- %就会出现问题,因此显式的声明一下newspaper,然后保留后面采用alias的方式
- %而standard类型则是采用另一种方式直接在sourcemap中转换为其它类型。
- \@ifpackagelater{biblatex}{2019/11/30}{%2019/12/01 v3.14
- \DeclareDatamodelEntrytypes{newspaper}%
- }{}
-
-%=====================================================================
-% 设置宏包选项
-%=====================================================================
- %
- % 增加一个控制是否输出文献载体的选项
- % 20191125,v1,0s,hzz
- \newtoggle{bbx:gbmedium}
- \DeclareBibliographyOption{gbmedium}[true]{%biblatex低版本
- \settoggle{bbx:gbmedium}{#1}}
- \ExecuteBibliographyOptions{gbmedium}
-
- %
- % 增加一个控制是否输出annotation域的选项,该域可以用于在文献条目后面输出一些注释信息
- % 20190509,v1,0s,hzz
- \newtoggle{bbx:gbannote}
- \DeclareBibliographyOption{gbannote}[false]{%biblatex低版本
- \settoggle{bbx:gbannote}{#1}}
- \ExecuteBibliographyOptions{gbannote}
- %
- %用于在文献条目后面输出注释信息的宏
- %FieldFormat{annotation}用于设置注释信息的格式
- \DeclareFieldFormat{annotation}{%
- \printtext{\addspace(#1)}%
- }
- \renewbibmacro*{annotation}{%
- \iftoggle{bbx:gbannote}%
- {\iffieldundef{annotation}%
- {\printfile[annotation]{\bibannotationprefix\thefield{entrykey}.tex}}%
- {\printfield{annotation}}}%
- {}%
- }
-
-
- %
- % 增加一个控制是否输出type域的选项
- % 20190212,v1,0q,hzz
- \newtoggle{bbx:gbfieldtype}
- \DeclareBibliographyOption{gbfieldtype}[false]{%biblatex低版本
- \settoggle{bbx:gbfieldtype}{#1}}
- \ExecuteBibliographyOptions{gbfieldtype}
-
- %
- % 增加一个控制是否根据页码重设脚注数字标号的选项
- % 20190422,v1,0r,hzz
- \newtoggle{bbx:gbfnperpage}
- \DeclareBibliographyOption{gbfnperpage}[false]{%
- \settoggle{bbx:gbfnperpage}{#1}}
- \ExecuteBibliographyOptions{gbfnperpage}
-
- %
- % 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表
- % 20190203,v1.0p,hzz
- % 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签
- % 当前面的脚注中已经存在当前文献,那么当前文献内容不再输出而用同(4)这样的方式
- % 需要注意的是由于小页环境和表格中的脚注本身的问题,可能会有一些问题
- \DeclareBibliographyOption{gbfootbib}[false]{%
- \ifstrequal{#1}{false}{}{\execgbfootbib}}
- \ExecuteBibliographyOptions{gbfootbib}
-
- %%
- \newlength{\footbibmargin}
- \newlength{\footbiblabelsep}
- \setlength{\footbibmargin}{1em}%脚注的段落左侧缩进距离
- \setlength{\footbiblabelsep}{0.5em}%脚注中标记号与脚注段落的间距
- \def\execgbfootbib%
- {%
- %开启引用跟踪计数器,为使用\ifciteseen等测试命令
- \ExecuteBibliographyOptions{citetracker=true}
- %
- %利用footmisc宏包来实现脚注文献的悬挂对齐
- \AtEndPreamble{
- \@ifclassloaded{beamer}{}{
- %beamer类因为其特殊性,为避免冲突不调footmisc。
- %同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接
- %如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。
- %\PassOptionsToPackage{perpage,hang}{footmisc}%
- %\RequirePackage{footmisc}%
-
- %重新实现脚注的根据单页重设脚注号码
- %重新实现脚注的悬挂对齐问题,不再使用footmisc,直接从latex核心代码和hyperref代码进行修改
- %v1.0q 20190317 hzz
- %v1.0r 20190422 hzz 根据gbfnperpage选项设置
- \iftoggle{bbx:gbfnperpage}%
- {\@addtoreset{footnote}{page}}{}%重设计数器
-
-\@ifpackageloaded{hyperref}{%加载hyperref则对\H@@footnotetext做重定义
- \long\def\H@@footnotetext##1{\insert\footins{%
- \reset at font\footnotesize
- \interlinepenalty\interfootnotelinepenalty
- \splittopskip\footnotesep
- \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
- \hsize\columnwidth \@parboxrestore
- \protected at edef\@currentlabel{%
- \csname p at footnote\endcsname\@thefnmark
- }%
- \color at begingroup
- \leftskip \footbibmargin%增加的左侧缩进
- \@makefntext{%
- \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox%
- }%
- \color at endgroup}}%
- \long\def\H@@mpfootnotetext##1{%
- \global\setbox\@mpfootins\vbox{%
- \unvbox\@mpfootins
- \reset at font\footnotesize
- \hsize\columnwidth
- \@parboxrestore
- \protected at edef\@currentlabel
- {\csname p at mpfootnote\endcsname\@thefnmark}%
- \leftskip \footbibmargin%增加的左侧缩进
- \color at begingroup
- \@makefntext{%
- \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}%
- \color at endgroup}}
- }{%否则对latex核心代码中的\@footnotetext做重定义
- \long\def\@footnotetext##1{\insert\footins{%
- \reset at font\footnotesize
- \interlinepenalty\interfootnotelinepenalty
- \splittopskip\footnotesep
- \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
- \hsize\columnwidth \@parboxrestore
- \protected at edef\@currentlabel{%
- \csname p at footnote\endcsname\@thefnmark
- }%
- \color at begingroup
- \leftskip \footbibmargin%增加的左侧缩进
- \@makefntext{%
- \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox%
- }%
- \color at endgroup}}%
-
- \long\def\@mpfootnotetext##1{%
- \global\setbox\@mpfootins\vbox{%
- \unvbox\@mpfootins
- \reset at font\footnotesize
- \hsize\columnwidth
- \@parboxrestore
- \protected at edef\@currentlabel
- {\csname p at mpfootnote\endcsname\@thefnmark}%
- \leftskip \footbibmargin%增加的左侧缩进
- \color at begingroup
- \@makefntext{%
- \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}%
- \color at endgroup}}
- }
-
- \long\def\@makefntext##1{%增加了脚注标记与正文的间隔
- \parindent 1em\noindent \hb at xt@ 0em{\hss \@makefnmark\makebox[\footbiblabelsep]{}}##1}
-
- }
-
- %
- %使脚注标记加圈并设置数字的字体为tiny,不使用修改thefootnote的方式
- \def\@makefnmark{\hbox{\@textsuperscript{\textcircled{\tiny\@thefnmark}}}}
- %做patch使得脚注内容中的脚注数字标签不上标
- \pretocmd{\@makefntext}{%
- \def\@makefnmark{%
- \hbox{\textcircled{\tiny\@thefnmark}}%
- }%
- }{}{}
- }
-
- %
- %判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容)
- %记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。
- %v1.0q 20190309 区分使脚注标注适应minipage中的情况
- \newbibmacro*{citesavefn}{%
- \ifciteseen%当被引用过为true
- {\ifcsdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%当已经定义过脚注序号信息
- {\csgdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{%
- \str at sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}%
- \@makefnmark%
- }}%
- {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{%
- \ifcsstring{@mpfn}{mpfootnote}{\@alph\c at mpfootnote}{\thefootnote}%
- }}%
- }%
- {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{%
- \ifcsstring{@mpfn}{mpfootnote}{\@alph\c at mpfootnote}{\thefootnote}%
- %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断
- }}%
- }
-
- %
- %重定义\footfullcite使完成gb7714-2015的脚注文献要求
- \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]%
- {\defcounter{maxnames}{\blx at maxbibnames}%局部定义maxnames和minnames计数器
- \defcounter{minnames}{\blx at minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。
- \usebibmacro{prenote}%
- \renewbibmacro*{postnote}{%
- \iffieldundef{postnote}%
- {}{\setunit{\addcolon\addspace}\printtext{\thefield{postnote}}}}%由于ay样式中没有修改postnote域,此处因为格式需要不使用默认域格式
- }%
- {\usebibmacro{citesavefn}%
- \ifcsdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%
- {\csuse{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}\nopunct}%
- {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}%
- }%
- {\multicitedelim}%
- {\usebibmacro{postnote}}
-
- }
-
- %
- % 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式
- % 20180814,v1.0m,hzz
- % 原理方法:
- % 只为兼容性考虑不做任何处理
- \DeclareBibliographyOption{gbstyle}[true]{%biblatex低版本
- }
-
- %
- % 增加一个控制是否输出文献类型和载体标识的选项
- %
- % 原理方法:
- % 对于biblatex3.4以上版本DeclareBibliographyOption命令中的[datatype]如果是boolean,那么是可以省略的
- % 所以用老版本的不用[datatype]的命令可以兼容所有biblatex版本
- \newtoggle{bbx:gbtype}
- %\DeclareBibliographyOption[boolean]{gbtype}[true]{%biblatex高版本
- \DeclareBibliographyOption{gbtype}[true]{%biblatex低版本
- \settoggle{bbx:gbtype}{#1}}
- \ExecuteBibliographyOptions{gbtype}
-
- %
- % 增加一个源文件编码选择选项,当true时可以使用GBK编码。
- % v1.0k, 2018.05.08, by hzz
- %
- % 原理方法:将需要输出的中文字符串用命令形式表示存储,采用utf8编码时采用bbx文档
- % 内的定义即是utf8编码的中文字符串,但tex源文件是gbk编码时,利用gb7714-2015-gbk.def
- % 文档内的gbk编码的字符串覆盖。这种覆盖只能在宏包末尾加载时成功实现,所以使用
- % AtEndOfPackage。该解决思路源自biblatex-caspervector宏包。
- % 另外注意:
- % gbk编码的tex文档,利用pdflatex/latex能正确编译,利用xelatex能编译,但中文显示乱码
- % 在源文档前面增加 XeTeX 原语:\XeTeXinputencoding "GBK" 后,显示正常
- % utf-8编码的tex文档,利用xelatex能正确编译,而pdflatex/latex不能编译。
- \newtoggle{bbx:codegbk}
- \DeclareBibliographyOption{gbcodegbk}[false]{%
- \settoggle{bbx:codegbk}{#1}}
- \ExecuteBibliographyOptions{gbcodegbk}
-
- \def\str at bibliography{参考文献}
- \def\str at references{参考文献}
- \def\str at bytranslator{译}
- \def\str at andotherscn{等}
- \def\str at andcn{和}
- \def\str at backrefpage{引用页}
- \def\str at backrefpages{引用页}
- \def\str at noaddress{出版地不详}
- \def\str at nopublisher{出版者不详}
- \def\str at edition{版}
- \def\str at volumecn{卷}
- \def\str at numbercn{册}
- \def\str at serialcn{第}
- \def\str at sameentry{同}
- \def\str at incn{见}
- \def\str at mathesiscn{硕士学位论文}
- \def\str at phdthesiscn{博士学位论文}
- \def\str at editorcn{主编}
-
- \AtEndOfPackage{%
- \iftoggle{bbx:codegbk}{%
- \ExecuteBibliographyOptions{texencoding = GBK}
- \input{gb7714-2015-gbk.def}
- }{}}
-
- %
- % 增加一个严格按GB/T 7714-2015给出著录格式控制域的输出的选项
- % v1.0k, 2018.05.08, by hzz
- %
- % 原理方法:
- % 默认设置该选项为真,进而不输出GB/T 7714-2015中没有的域的信息
- % 这样可以避免因为bib文件带有多余的域的信息的输出,比如因为bibtex样式
- % 可能需要用于中英文判断的language域的信息。
- \newtoggle{bbx:gbstrict}
- \DeclareBibliographyOption{gbstrict}[true]{%
- \settoggle{bbx:gbstrict}{#1}}
- \ExecuteBibliographyOptions{gbstrict}
-
- %
- % 增加一个控制标题域超链接设置的选项
- % v1.0k, 2018.05.24, by hzz
- %
- % 原理方法:
- % 利用标题域格式来实现,默认设置该选项为false,不做超链接。
- % 设置为true,则标题设置超链接
- \newtoggle{bbx:titlelink}
- \DeclareBibliographyOption{gbtitlelink}[false]{%
- \settoggle{bbx:titlelink}{#1}}
- \ExecuteBibliographyOptions{gbtitlelink}
-
- %
- % 增加一个控制参考文献标题是否能够被ctex宏包设置的选项
- % v1.0l, 2018.07.02, by hzz
- %
- % 原理方法:
- % 重定义biblatex的宏,去除使用本地化字符串的方式,是的可以利用ctexset进行设置
- \newtoggle{bbx:ctexset}
- \DeclareBibliographyOption{gbctexset}[true]{%
- \settoggle{bbx:ctexset}{#1}}
- \ExecuteBibliographyOptions{gbctexset}
-
- \AtEndOfPackage{%
- \iftoggle{bbx:ctexset}{%
- \def\blx at defbibstrings#1#2{%
- \def\do##1{\csundef{abx at lstr@##1}\csundef{abx at sstr@##1}}%
- \abx at dostrings
- \csuse{abx at strings@#1}%
- \setkeys{blx at lbx}{#2}%
- \let\do\blx at defbibstrings@i
- \csxdef{abx at strings@#1}{\abx at dostrings}%
- }
- }{}}
-
- %
- %增加一个处理佚名或noauthor的控制选项
- \DeclareBibliographyOption{gbnoauthor}[true]{%
- \ifstrequal{#1}{false}{}{\dealnoathor}}
- %\ExecuteBibliographyOptions{gbnoauthor=true}%对于需要展开较早(展开层级优先)的选项,这一执行无效,只能用宏包加载时给出的选项。
-
-
- %
- % 增加一个恢复域格式为标准样式的控制选项
- % v1.0k, 2018.05.15, by hzz
- %
- % 原理方法:
- % 默认设置该选项为false,采用国标要求的域格式输出相关域
- % 当设置该选项为true时,则重新利用标准样式的域格式输出相关的域
- \newtoggle{bbx:gbfieldstd}
- \DeclareBibliographyOption{gbfieldstd}[false]{%
- \settoggle{bbx:gbfieldstd}{#1}%
- \ifstrequal{#1}{false}{}{\execgbfdfmtstd}%
- }
- \ExecuteBibliographyOptions{gbfieldstd}
-
- %
- % 增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。
- %
- \newtoggle{bbx:gbpub}
- \DeclareBibliographyOption{gbpub}[true]{%
- %\settoggle{bbx:gbpub}{#1} %或采用下面这一句
- \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}}
- \ExecuteBibliographyOptions{gbpub}
-
- %
- % 增加控制析出文献来源前的标点符号//输出的选项
- % v1.0k, 2018.04.20,added in by hzz
- \newtoggle{bbx:gbpunctin}
- \DeclareBibliographyOption{gbpunctin}[true]{%
- \settoggle{bbx:gbpunctin}{#1}}
- \ExecuteBibliographyOptions{gbpunctin}
-
-
- % 选项设置
- %
- \ExecuteBibliographyOptions{
- useprefix = true, %名字的信息包括前缀
- date = year, %日期仅写到年
- maxbibnames=3, %将文献列表和引用中最大名字数量区分开
- minbibnames=3,
- maxitems = 1,%设置列表最大数量
- minitems = 1, %设置缩减后的列表最小数量
- isbn=false,
- sorting=gb7714-2015,
- sortlocale=zh__pinyin,%zh__big5han,%zh__stroke,%zh__gb2312han,%zh__pinyin,
- }
-
- %
- %为日期相关选项增加选项值gb7714-2015
- %
- \csdef{mkdaterangegb7714-2015}#1{%
- \begingroup
- \blx at metadateinfo{#1}%
- \iffieldundef{#1year}
- {}
- {\printtext[#1date]{%
- \blx at gbdate{#1}{}}}%
- \endgroup}
-
- \newrobustcmd*{\blx at gbdate}[3][]{%
- \dateeraprintpre{#2#3year}%
- \blx at imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}%
- \iffieldundef{#2#3month}{}{\hyphen\blx at imc@forcezerosmdt{\thefield{#2#3month}}}%
- \iffieldundef{#2#3day}{}{\hyphen\blx at imc@forcezerosmdt{\thefield{#2#3day}}}}
-
- %为姓名格式选择增加的计数器
- \newcounter{gbnamefmtcase}
- \def\thegbnamefmtcase{\the\c at gbnamefmtcase}
- %为引用标签标注/文献表中本地化字符串中英文选择增加的计数器/命令
- \newcounter{gbcitelocalcase}
- \newcounter{gbbiblocalcase}
- \def\thegbcitelocalcase{\the\c at gbcitelocalcase}
- \def\thegbbiblocalcase{\the\c at gbbiblocalcase}
-
-
-\@ifpackagelater{biblatex}{2016/03/27}
- { % 针对biblatex>=3.3版本的选项设置
-
- % 增加不同语言排序的切换选项
- % gblanorder=chineseahead的顺序为cn,jp,kr,en,fr,ru
- % gblanorder=englishahead的顺序为en,fr,ru,cn,jp,kr
- % gblanorder=cn;en;ru;fr;jp;kr的顺序为指定的cn;en;ru;fr;jp;kr,自定义内容可以随意写以分号分隔
- % v1.0q,20190307,hzz
- %
- \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{%
- \ifstrequal{#1}{chineseahead}%%中文在前的顺序
- {\gdef\lancnorder{1}\gdef\lanjporder{2}\gdef\lankrorder{3}%
- \gdef\lanenorder{4}\gdef\lanfrorder{5}\gdef\lanruorder{6}}%
- {%
- \ifstrequal{#1}{englishahead}%
- {\execlanodeah\dealsortlan}%
- {\execlanodudf{#1}\dealsortlan}%
- }%
- }
- \ExecuteBibliographyOptions{gblanorder}
-
- \def\execlanodeah{%中文在后的顺序
- \gdef\lancnorder{4}
- \gdef\lanjporder{5}
- \gdef\lankrorder{6}
- \gdef\lanenorder{1}
- \gdef\lanfrorder{2}
- \gdef\lanruorder{3}}
-
- \newcounter{lanordernum}
- \newcommand{\execlanodudf}[1]{%like:cn;en;ru;fr;jp;kr
- \setcounter{lanordernum}{0}
- \DeclareListParser{\parsinglanorder}{;}
- \renewcommand*{\do}[1]{\stepcounter{lanordernum}\csxdef{lan##1order}{\thelanordernum}}
- \parsinglanorder{#1}
- }
-
- % 增加本地化字符串的中英文切换选项
- % gbcitelocal指标注中的本地化字符串
- % gbbiblocal 指文献表中的本地化字符串
- % gblocal 指设置文献表和标注中的本地化字符串
- % v1.0o,20190103,hzz
- %
- \DeclareBibliographyOption[string]{gbcitelocal}[gb7714-2015]{%
- \ifstrequal{#1}{gb7714-2015}{\setcounter{gbcitelocalcase}{0}}{}%
- \ifstrequal{#1}{chinese}{\setcounter{gbcitelocalcase}{1}}{}%
- \ifstrequal{#1}{english}{\setcounter{gbcitelocalcase}{2}}{}%
- }
- \ExecuteBibliographyOptions{gbcitelocal}
-
- \DeclareBibliographyOption[string]{gbbiblocal}[gb7714-2015]{%
- \ifstrequal{#1}{gb7714-2015}{\setcounter{gbbiblocalcase}{0}}{}%
- \ifstrequal{#1}{chinese}{\setcounter{gbbiblocalcase}{1}}{}%
- \ifstrequal{#1}{english}{\setcounter{gbbiblocalcase}{2}}{}%
- }
- \ExecuteBibliographyOptions{gbbiblocal}
-
- \DeclareBibliographyOption[string]{gblocal}[gb7714-2015]{%
- \ExecuteBibliographyOptions{gbbiblocal=#1}%
- \ExecuteBibliographyOptions{gbcitelocal=#1}%
- }
- %\ExecuteBibliographyOptions{gblocal} %默认值已经通过两个相关选项设置
-
-
- %
- % 增加序号标签格式处理选项,作者年制不做处理,给出只为兼容选项考虑
- % v1.0l,20180623,hzz
- %
- \DeclareBibliographyOption[string]{gbbiblabel}[bracket]{}
-
- %
- % 增加姓名大小写格式处理选项
- %
- \DeclareBibliographyOption[string]{gbnamefmt}[uppercase]{%
- \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}%
- \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}%
- \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family
- \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{}%family-given
- \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%
- \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family
- }
- \ExecuteBibliographyOptions{gbnamefmt}
-
- %
- % 增加标签对齐选项
- %
- %因为在作者年制中,不需要使用,这里也增加,为了与顺序编码制的兼容性考虑。
- \DeclareBibliographyOption[string]{gbalign}[right]{}%
-
-
-
-
- }
- {
- % 增加不同语言排序的切换选项
- % biblatex 3.4及以下版本不能使用多个stylesourcemap,所以不使用该选项
- % 这里给出仅为兼容性考虑
- % v1.0q,20190307,hzz
- %
- \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{}
-
- %
- % 增加序号标签格式处理选项,作者年制不做处理,给出只为兼容选项考虑
- % v1.0l,20180623,hzz
- %
- \DeclareBibliographyOption{gbbiblabel}[bracket]{}
-
- %
- % 增加姓名大小写格式处理选项
- %
- \DeclareBibliographyOption{gbnamefmt}[uppercase]{%
- \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}%
- \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}%
- \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family
- \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{}
- \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given
- \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family
- }
- \ExecuteBibliographyOptions{gbnamefmt}
-
- %
- % 增加标签对齐选项
- %
- %因为在作者年制中,不需要使用,这里也增加,为了与顺序年制的兼容性考虑。
- \DeclareBibliographyOption{gbalign}[right]{}%
-
- }
-
-
-%
-% 针对biblatex<3.3版本的选项设置,比如texlive2015中的3.0版
-%
-\defversion{3.0}{opt}{
- \ExecuteBibliographyOptions{
- firstinits = true, %名字有缩写,参考3.1.2.3 Internal
- }
-}
-%
-% 针对3.3<=biblatex<3.5版本的选项设置,比如texlive2016中的3.4版
-%
-\defversion{3.4}{opt}{
- \ExecuteBibliographyOptions{
- giveninits = true,
- }
-}
-%
-% 针对3.7<=biblatex<=3.9版本的选项设置,比如texlive2017中的3.7版
-%
-\defversion{3.7}{opt}{
- \ExecuteBibliographyOptions{
- giveninits = true,
- urldate =edtf,
- eventdate =edtf,
- }
-}
-%
-% 针对3.10<=biblatex版本的选项设置,比如texlive2018中的3.11版
-%
-\defversion{3.10}{opt}{
- \ExecuteBibliographyOptions{
- giveninits = true,
- urldate =gb7714-2015,%iso
- eventdate =gb7714-2015,%iso
- }
-}
-
-%
-% 针对3.13<=biblatex版本的选项设置,因为内容有限,所以不再增加版本区分,而用时间直接判断
-%
-% 解决国标中“王临慧, 2010a.”和“王临慧, 等, 2010b.”的问题
-% 在没有这个选项之前无法加上a和b
-% v1.0s,20190828
-\@ifpackagelater{biblatex}{2019/08/16}{%
- \ExecuteBibliographyOptions{%
- nohashothers=true}}{}
-
-%
-% 根据biblatex版本信息,选择选项设置
-%
-% 原理方法:如下这种选择机制能自动兼容更新的版本,但对于老版本
-% 必须要把情况列全。
-\iftoggle{iftlfive}{\switchversion{3.0}{opt}}{}%biblatex<=3.2
-\iftoggle{iftlsix}{\switchversion{3.4}{opt}}{}%3.3<=biblatex<=3.6
-\iftoggle{iftlseven}{\switchversion{3.7}{opt}}{}%biblatex=3.7
-\iftoggle{iftleight}{\switchversion{3.7}{opt}}{}%3.8<=biblatex<=3.9
-\iftoggle{iftlnine}{\switchversion{3.10}{opt}}{}%biblatex=3.10
-\iftoggle{iftlatest}{\switchversion{3.10}{opt}}{}%biblatex最新3.11
-
-
-%=====================================================================
-%设置本地化字符串
-%=====================================================================
- %
- % 新建当地化字符串,用来记录“等”字符、“和”字符
- %
- \NewBibliographyString{andotherscn}
- \NewBibliographyString{andothersincitecn}
- \NewBibliographyString{andothersincite}
- \NewBibliographyString{andcn}
- \NewBibliographyString{andothersjp}
- \NewBibliographyString{andotherskr}
- \NewBibliographyString{andjp}
- \NewBibliographyString{andkr}
- \NewBibliographyString{andincitecn}
- \NewBibliographyString{andincite}
- \NewBibliographyString{volumecn}
- \NewBibliographyString{numbercn}
- \NewBibliographyString{serialcn}
- \NewBibliographyString{incn}
- \NewBibliographyString{mathesiscn}
- \NewBibliographyString{phdthesiscn}
- \NewBibliographyString{editorcn}
- \NewBibliographyString{editorscn}
-
- %
- % 修改一些当地化字符串
- %
- % 原理方法:直接利用当地化格式english修改出一些中文的格式,具体修改内容参考english.lbx文件
- % 当然也可以增加比如上面定义的andotherscn
- % 注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别
- \DefineBibliographyStrings{english}{
- bibliography = {\str at bibliography},
- references = {\str at references},
- bytranslator= {\str at bytranslator\adddot}, %将trans. by 改成 译
- and = {\addcomma},%将第2和3人名见的and符号改成 逗号,用\finalnamedelim命令也可以定义,参见3.9.1节
- andcn = {\addcomma},%\str at andcn\ and本地化字符串的中文对应词
- andincitecn = {\str at andcn},%将标注中的分开,便于与文献表中的区分
- andincite = {\addcomma},
- %andothers = {et al.}, %将超过3个人名的省略,et al.改成为 等
- andotherscn = {\str at andotherscn},%将超过3个人名的省略,et al.改成为 等
- andothersincitecn={\str at andotherscn},%将标注中的分开,便于与文献表中的区分
- andothersincite={et al\adddot},
- backrefpage = {\str at backrefpage:},
- backrefpages = {\str at backrefpages:},
- in={in\intitlepunct},
- volumecn={\str at volumecn},
- numbercn={\str at numbercn},
- serialcn={\str at serialcn},
- andothersjp={他},
- andotherskr={외},
- andjp={和},
- andkr={和},
- incn={\str at incn\addcolon\addspace},
- mathesiscn={\str at mathesiscn},
- phdthesiscn={\str at phdthesiscn},
- editorscn={\str at editorcn},
- editorcn={\str at editorcn},
- }
-
- %
- % 增加两个命令用于临时的局部的修改本地化字符串
- % 其中\setlocalbibstring修改缩写字符串,setlocalbiblstring修改长字符串
- % 注意使用时因为是局部修改,因此要将其与需要修改的引用命令放在一个编组符号内
- % v1.0t,hzz,20190525
- \newcommand{\setlocalbibstring}[2]{%
- \csdef{abx at sstr@#1}{#2}}
- \newcommand{\setlocalbiblstring}[2]{%
- \csdef{abx at lstr@#1}{#2}}
-
-%=====================================================================
-% 动态数据修改
-%=====================================================================
-%
-% 各层次的数据映射和动态修改
-%
-% 原理方法:
-% 1. 进行语言包括中英文判断,并设置和记录,比如记录到userf,usere中
-% 2. 增加文献标识符如[M],[J]等,对一些容易混淆的域进行设置以增强兼容性
-% 3. \DeclareSourcemap命令对于biblatex3.11以下版本只能出现一次,3.11版开始支持多个
-% 4. \DeclarestyleSourcemap在biblatex v3.7版开始可以支持出现多次
-% 5. 把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。
-% 注意:这里用userf,usere而不是namee,namef,是因为只有把name列表转成域,才能有效读取姓名中的字符,
-% 如果用namee,namef,name信息会自动解析,所以就不能为cjk判断提供需要的信息
-%
-% 不同的文献类型使用相同的驱动输出可以有5种方法:
-% 1. 是数据源层的映射,将其它类型转换为某一要使用驱动的类型
-% 2. 是样式层映射,也是将其它类型转换为某一要使用驱动的类型
-% 3. 是驱动层映射,也是将其它类型转换为某一要使用驱动的类型
-% 4. 定义驱动类型别名DeclareBibliographyAlias,将其它类型定义为某一要使用驱动的类型的别名
-% 驱动别名定义本质上是做了驱动层映射
-% 5. 直接定义不同的类型的驱动,但驱动内容相同。
-%
-% 关于数据映射和驱动使用的考虑如下:
-% 1. 为避免利用biber输出bib文件时的数据变动,尽量不在数据源层映射做类型转换
-% 2. 为减少代码量,尽量少做内容相同的不同类型驱动
-% 3. 因此类型相关的处理主要在样式层映射、驱动层映射、驱动别名
-% 4. 由于biblatex默认做的驱动别名处理可能增加一些信息比如masterthesis转thesis时增加的type
-% 可以在样式层映射做某些需要避免这种默认处置的转换
-% 5. 当没有避免默认行为的需求时,全部采用驱动别名的方式处理,等价于驱动层的映射
-%
-% 文献类型和驱动考虑如下:
-% 1. 连续出版物及析出文献有其特殊性,因此考虑两类periodical和article
-% newpaper映射为article,并以note域做区分特殊处理
-% 2. 专著和专著中的析出文献是主要的类型,因此考虑book和inbook
-% standard映射为book或inbook,并以note域做区分特殊处理
-% collection和proceedings基本与book类似,因此做book驱动别名处理
-% incollection和inproceedings基本与inbook类似,因此做inbook驱动别名处理
-% 3. 专利类型有其特殊性,考虑patent类型
-% 4. 电子资源类型有其特殊性,考虑online类型
-% 5. 报告类型与book有点类似,出版项处理与book一样,但有时又要有修改和更新日期
-% 因此考虑用一种类型来输出,使用report类型
-% 6. 手册/学位论文等类型与book有点类似,但对于出版项处理时,有缺省时,直接省略,
-% 同时有version和edition的区别,因此考虑用一种类型来输出,使用manual类型
-% 7. 包括报告,学位论文在内的其它所有的类型,都做一个判断,当没有出版项时,
-% 且存在网址信息时,将其转换为online类型输出,否则都做为manual类型输出。
-% 8. 备选类型misc当存在网址时直接转换为online,由于howpublished域可用于描述
-% 更多的信息,因此不存在网址时,独立做一个备选格式
-% 9. 出版项主要以如下方式处理:
-% (a) location+institution+date 仅用于连续出版物
-% (b)publisher+location+date 用于需要完整输出出版项的类型,比如book,collection,proceedings,in*,report
-% (c)institution+location+date 用于出版项缺失时不输出的类型,包括manual,thesis,archive等其他类型
-% (d)printlist{insitution} 用于电子资源,仅输出出版者或组织,为数据映射方便,本来默认的organization域转换为用insitution输出。
-% (e) 不输出,主要用于连续出版物析出的文献
-% 10. 日期以如下方式处理:
-% date 由于存在biblatex选项,因此通过选项控制,数据源为date解析数据或year
-% urldate 由于存在biblatex选项,因此通过选项控制,输出到日,且用[]包围,数据源为urldate
-% newsdate 用于公告日期,公开日期或新闻日期,输出到日,但无包围符号,数据源为date
-% modifydate 用于更新或修改日期,输出到日,且用()包围,数据源为date或enddate或eventdate
-
-\DeclareSourcemap{
-\maps[datatype=bibtex]{%
- \map{%当没有作者时将editor转成author
- \pernottype{inbook}%因为in系列中editor可能用来表示bookauthor,所以排除
- \pernottype{inproceedings}
- \pernottype{incollection}
- \pernottype{periodical}%因为peridical直接使用editor,所以排除
- %注意notfield在低版本biblatex中没有
- %\step[notfield=author,final]%当author不存在,将editor复制给author
- \step[fieldsource=editor,fieldtarget=author]%并删除editor
- }
- \map{%当没有作者时将translator转成author
- \pernottype{inbook}
- \pernottype{inproceedings}
- \pernottype{incollection}
- %\step[notfield=author,final]%当author不存在,将translator复制给author
- \step[fieldsource=translator,fieldtarget=author]%并删除translator
- }
- \map{%让address和location同步,biblatex中address是location的别名
- %因此输出的时候只有location信息,但处理过程中是可以存在address的。
- %\step[notfield=address,final]
- \step[fieldsource=location,final]
- \step[fieldset=address,origfieldval]
- }
- \map{%让address和location同步
- %\step[notfield=location,final]
- \step[fieldsource=address,final]
- \step[fieldset=location,origfieldval]
- }
- \map{%处理在bib文件用mark标记文献类型标识符的情况
- \step[fieldsource=mark,final]
- \step[fieldset=usera, origfieldval]
- }
- \map{%处理在bib文件中直接给出文献的姓名格式为lowercase的情况
- \step[fieldsource=nameformat,match=lowercase,final]
- \step[fieldset=namefmtid,fieldvalue={1}]
- }
- \map{%处理在bib文件中直接给出文献的姓名格式为givenahead的情况
- \step[fieldsource=nameformat,match=givenahead,final]
- \step[fieldset=namefmtid,fieldvalue={2}]
- }
- \map{%处理在bib文件中直接给出文献的姓名格式为familyahead的情况
- \step[fieldsource=nameformat,match=familyahead,final]
- \step[fieldset=namefmtid,fieldvalue={3}]
- }
- \map{%处理在bib文件中直接给出文献的姓名格式为pinyin的情况
- \step[fieldsource=nameformat,match=pinyin,final]
- \step[fieldset=namefmtid,fieldvalue={4}]
- }
- \map{%根据article确定文献类型标识符
- \pertype{article}
- \step[fieldset=usera, fieldvalue={J}]
- }
- \map{%根据periodical确定文献类型标识符
- \pertype{periodical}
- \step[fieldset=usera, fieldvalue={J}]
- \step[fieldsource=author] %有时会把author和editor混淆,处理后使用editor
- \step[fieldset=editor, origfieldval]
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{%根据增加一个新闻报纸的类型newspaper确定文献类型标识符
- \pertype{newspaper}
- \step[fieldset=usera, fieldvalue={N}]
- \step[fieldset=note, fieldvalue=news]%因为没有专门的驱动,记录note方便映射为article后判断
- }
- \map{%对应增加的一个数据库类型database确定文献类型标识符
- \pertype{database}
- \step[fieldset=usera, fieldvalue={DB}]
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{%对应增加的一个数据集类型dataset确定文献类型标识符
- \pertype{dataset}
- \step[fieldset=usera, fieldvalue={DS}]%
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{%对应增加的一个软件类型software确定文献类型标识符
- \pertype{software}
- \step[fieldset=usera, fieldvalue={CP}]
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{%对应增加的一个舆图类型map确定文献类型标识符
- \pertype{map}
- \step[fieldset=usera, fieldvalue={CM}]%
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{%对应增加的一个档案类型archive确定文献类型标识符
- \pertype{archive}
- \step[fieldset=usera, fieldvalue={A}]
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{%因为misc类型本身就是没有类型,而不像其它文献有明确的类型,所以
- %当misc类型带有网址时,直接将其转换为online类型
- \pertype{misc}
- \step[fieldsource=url,final]
- \step[typesource=misc,typetarget=online]
- }
- \map{%对应增加的一个备选类型misc确定文献类型标识符
- \pertype{misc}
- \step[fieldset=usera, fieldvalue={Z}]%
- }
- \map{
- \pertype{book}
- \pertype{inbook}
- \step[fieldset=usera, fieldvalue={M}]
- \step[fieldsource=version] %有时会把version和edition混淆,处理后直接用edition
- \step[fieldset=edition, origfieldval]
- }
- \map{%兼容老的standard类型,确定文献类型标识符
- \pertype{standard}
- \step[fieldset=usera, fieldvalue={S}]
- \step[fieldset=note, fieldvalue=standard]%因为没有专门的驱动,记录note方便映射为book和inbook后判断
- }
- \map{
- \pertype{patent}
- \step[fieldset=usera, fieldvalue={P}]
- }
- \map{
- \pertype{inproceedings}
- \pertype{conference}%兼容老的conference类型
- \step[fieldset=usera, fieldvalue={C}]
- \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
- \step[fieldset=publisher, origfieldval]
- }
- \map{
- \pertype{proceedings}
- \step[fieldset=usera, fieldvalue={C}]
- \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
- \step[fieldset=publisher, origfieldval]
- }
- \map{
- \pertype{incollection}
- \step[fieldset=usera, fieldvalue={G}]
- \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
- \step[fieldset=publisher, origfieldval]
- }
- \map{
- \pertype{collection}
- \step[fieldset=usera, fieldvalue={G}]
- \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
- \step[fieldset=publisher, origfieldval]
- }
- \map{
- \pertype{report}
- \pertype{techreport}%兼容老的techreport类型
- \step[fieldset=usera, fieldvalue={R}]
- \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
- \step[fieldset=publisher, origfieldval]
- }
- \map{
- \pertype{thesis}
- \pertype{mastersthesis}%兼容老的mastersthesis和phdthesis类型
- \pertype{phdthesis}
- \step[fieldset=usera, fieldvalue={D}]
- \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{
- \pertype{online}
- \pertype{electronic}%兼容老的electronic类型
- \pertype{www}%兼容老的www类型
- \step[fieldset=usera, fieldvalue={EB}]
- \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]%因为online的出版项处理类似手册
- \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性
- \step[fieldset=institution, origfieldval]
- }
- \map{
- \pertype{manual}
- \step[fieldset=usera, fieldvalue={A}]
- \step[fieldsource=edition]%有时会把version和edition混淆,处理后使用version
- \step[fieldset=version, origfieldval]
- \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性
- \step[fieldset=institution, origfieldval]
- }
- \map{
- \pertype{unpublished}
- \step[fieldset=usera, fieldvalue={Z}]
- }
- \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
- \step[fieldsource={author}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
- }%
- \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
- \step[fieldsource={editor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
- }%
- \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
- \step[fieldsource={translator}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
- }%
- \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
- \step[fieldsource={bookauthor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
- }%
- \map{%处理一些用year表示date的情况
- %这样处理将会设置date域,并使得labeldatesource变为空,因为date的前缀为空(如果是urldate,那么labeldatesource就是url)。
- %同时date域会被biblatex自动解析为year,month,day,并且覆盖原来的year信息
- \step[fieldsource=year]
- \step[fieldset=date, origfieldval]
- }
- \map{%将entrykey放入keywords中用于后期使用
- \step[fieldsource=entrykey]
- \step[fieldset=keywords, origfieldval]
- }
- \map{\step[fieldsource=title,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
- \step[fieldset=userd,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
- }
- \map{%
- \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final]
- \step[fieldset=userd,fieldvalue={russian}]%俄语
- }
- \map{%
- \step[fieldsource=title,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
- \step[fieldset=userd,fieldvalue={japanese}]%日语
- } %确定形式后可增加类似andotherscn这样的本地化字符串处理
- \map{%
- \step[fieldsource=title,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
- \step[fieldset=userd,fieldvalue={korean}]%韩语
- }
- \map{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题
- \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%
- \step[fieldset=userd, fieldvalue={chinese}]
- }
- \map{%将没有设置userd,且存在title域的默认设置为英文
- \step[fieldsource=title,final]
- \step[fieldset=userd,fieldvalue={english}]
- }
- \map{\step[fieldsource=author,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
- \step[fieldset=userf,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
- }
- \map{%
- \step[fieldsource=author,match=\regexp{[\x{0400}-\x{052F}]},final]
- \step[fieldset=userf,fieldvalue={russian}]%俄语
- }
- \map{%
- \step[fieldsource=author,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
- \step[fieldset=userf,fieldvalue={japanese}]%日语
- } %确定形式后可增加类似andotherscn这样的本地化字符串处理
- \map{%
- \step[fieldsource=author,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
- \step[fieldset=userf,fieldvalue={korean}]%韩语
- }
- \map{%作者的中文判断
- \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
- \step[fieldset=userf, fieldvalue={chinese}]
- }
- \map{%将没有设置userf,且存在author域的默认设置为英文
- \step[fieldsource=author,final]
- \step[fieldset=userf,fieldvalue={english}]
- }
- \map{\step[fieldsource=translator,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
- \step[fieldset=usere,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
- }
- \map{%
- \step[fieldsource=translator,match=\regexp{[\x{0400}-\x{052F}]},final]
- \step[fieldset=usere,fieldvalue={russian}]%俄语
- }
- \map{%
- \step[fieldsource=translator,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
- \step[fieldset=usere,fieldvalue={japanese}]%日语
- } %确定形式后可增加类似andotherscn这样的本地化字符串处理
- \map{%
- \step[fieldsource=translator,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
- \step[fieldset=usere,fieldvalue={korean}]%韩语
- }
- \map{%译者的中文判断
- \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
- \step[fieldset=usere, fieldvalue={chinese}]
- }
- \map{%将没有设置usere,且存在translator域的默认设置为英文
- \step[fieldsource=translator,final]
- \step[fieldset=usere,fieldvalue={english}]
- }
- \map{\step[fieldsource=editor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
- \step[fieldset=userc,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
- }
- \map{%
- \step[fieldsource=editor,match=\regexp{[\x{0400}-\x{052F}]},final]
- \step[fieldset=userc,fieldvalue={russian}]%俄语
- }
- \map{%
- \step[fieldsource=editor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
- \step[fieldset=userc,fieldvalue={japanese}]%日语
- } %确定形式后可增加类似andotherscn这样的本地化字符串处理
- \map{%
- \step[fieldsource=editor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
- \step[fieldset=userc,fieldvalue={korean}]%韩语
- }
- \map{%编者的中文判断
- \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5
- \step[fieldset=userc, fieldvalue={chinese}]
- }
- \map{%将没有设置userc,且存在editor域的默认设置为英文
- \step[fieldsource=editor,final]
- \step[fieldset=userc,fieldvalue={english}]
- }
- \map{\step[fieldsource=bookauthor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
- \step[fieldset=userb,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
- }
- \map{%
- \step[fieldsource=bookauthor,match=\regexp{[\x{0400}-\x{052F}]},final]
- \step[fieldset=userb,fieldvalue={russian}]%俄语
- }
- \map{%
- \step[fieldsource=bookauthor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
- \step[fieldset=userb,fieldvalue={japanese}]%日语
- } %确定形式后可增加类似andotherscn这样的本地化字符串处理
- \map{%
- \step[fieldsource=bookauthor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
- \step[fieldset=userb,fieldvalue={korean}]%韩语
- }
- \map{%编者的中文判断
- \step[fieldsource=bookauthor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5
- \step[fieldset=userb, fieldvalue={chinese}]
- }
- \map{%将没有设置userc,且存在editor域的默认设置为英文
- \step[fieldsource=bookauthor,final]
- \step[fieldset=userb,fieldvalue={english}]
- }
- \map{\step[fieldsource=userd,final]%userd存在则用根据标题的语言设定language
- \step[fieldset=language,origfieldval]%本身language存在则不设定
- }
- \map{\step[fieldsource=userf,final]%userd不存在,而userf存在则根据author的语言设定language
- \step[fieldset=language,origfieldval]
- }%如果没有作者和标题,那么剩下的最可能有意义的只有网址了,而网址通常是英文的,因此不用再进一步对其它域进行判断了。
- \map{%将没有设置的language设置成en,即认为不是中文的就是英文的。
- \step[fieldset=language,fieldvalue={english}]
- }
- \map{%一条文献的语言已经设定在language域中,由于出版项相关宏中使用userd判断,
- %所以将一条文献的主体语言设定到userd中,本身前面userd已经设定,但没有处理无标题的情况,
- %这里的处理等价于没有标题时,利用作者的语言设定userd,再没有作者,则默认用英文设定userd
- \step[fieldsource=language]
- \step[fieldset=userd,origfieldval]
- }
- \map{%当文献给出language域时,设置文献要使用的本地化字符串的语言
- %biblatex 3.11及以下版本仅有match是区分大小写的,而3.12版开始用matchi来区分大小,而match不区分
- %这里为兼容3.11及以下版本,所以用一个复杂一点的正则表达式
- \step[fieldsource=language,match=\regexp{(e|E)(n|N)(g|G)(l|L)(i|I)(s|S)(h|H)},final]
- \step[fieldset=langid,fieldvalue={english}]
- \step[fieldset=lansortorder,fieldvalue=\lanenorder]
- }
- \map{
- \step[fieldsource=language,match=\regexp{(r|R)(u|U)(s|S)(s|S)(i|I)(a|A)(n|N)},final]
- \step[fieldset=langid,fieldvalue={russian}]
- \step[fieldset=lansortorder,fieldvalue=\lanruorder]
- }
- \map{%
- \step[fieldsource=language,match=\regexp{(f|F)(r|R)(e|E)(n|N)(c|C)(h|H)},final]
- \step[fieldset=langid,fieldvalue={french}]
- \step[fieldset=lansortorder,fieldvalue=\lanfrorder]
- }
- \map{%
- \step[fieldsource=language,match=\regexp{(c|C)(h|H)(i|I)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english,
- \step[fieldset=langid,fieldvalue={english}]
- \step[fieldset=lansortorder,fieldvalue=\lancnorder]
- }
- \map{%
- \step[fieldsource=language,match=\regexp{(j|J)(a|A)(p|P)(a|A)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english,
- \step[fieldset=langid,fieldvalue={english}]
- \step[fieldset=lansortorder,fieldvalue=\lanjporder]
- }
- \map{%
- \step[fieldsource=language,match=\regexp{(k|K)(o|O)(r|R)(e|E)(a|A)(n|N)},final]%中日韩语目前都用english,
- \step[fieldset=langid,fieldvalue={english}]
- \step[fieldset=lansortorder,fieldvalue=\lankrorder]
- }
- \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook,
- %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义
- %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断
- \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook
- \step[typesource=standard, typetarget=inbook, final]
- }
- \map{%剩下的全部映射为book
- \step[typesource=standard, typetarget=book, final]
- }
-% \map{%先于标准样式的driver层映射,以取消type设置
-% \step[typesource=mastersthesis, typetarget=thesis, final]
-% %\step[fieldset=type, fieldvalue=mathesis]
-% }
-% \map{%先于标准样式的driver层映射,以取消type设置
-% \step[typesource=phdthesis, typetarget=thesis, final]
-% %\step[fieldset=type, fieldvalue=phdthesis]
-% }
- \map{%先于标准样式的driver层映射,以取消type设置
- \step[typesource=techreport, typetarget=report, final]
- %\step[fieldset=type, fieldvalue=techreport]
- }
- \map{%
- \pertype{report}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=report,typetarget=online]
- \step[fieldset=note,fieldvalue={report}]
- }
- \map{%
- \pertype{thesis}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=thesis,typetarget=online]
- }
- \map{%
- \pertype{manual}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=manual,typetarget=online]
- }
- \map{%
- \pertype{unpublished}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=unpublished,typetarget=online]
- }
- \map{%
- \pertype{database}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=databasetypetarget=online]
- }
- \map{%
- \pertype{dataset}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=dataset,typetarget=online]
- }
- \map{%
- \pertype{software}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=software,typetarget=online]
- }
- \map{%
- \pertype{map}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=map,typetarget=online]
- }
- \map{%
- \pertype{archive}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=archive,typetarget=online]
- }
- \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确)
- \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸
- \step[fieldset=keywords, fieldvalue={,}, append]
- \step[fieldset=keywords, origfieldval, append]
- }
- \map[overwrite]{%title,booktitle,journaltitle,journal,publisher,address,location,institution,organization
- \step[fieldsource={title}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
- }
- \map[overwrite]{
- \step[fieldsource={booktitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
- }
- \map[overwrite]{
- \step[fieldsource={journaltitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
- }
- \map[overwrite]{
- \step[fieldsource={journal}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
- }
- \map[overwrite]{
- \step[fieldsource={publisher}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
- }
- \map[overwrite]{
- \step[fieldsource={address}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
- }
- \map[overwrite]{
- \step[fieldsource={location}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
- }
- \map[overwrite]{
- \step[fieldsource={institution}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
- }
- \map[overwrite]{
- \step[fieldsource={booktitle}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}]
- }
- \map[overwrite]{
- \step[fieldsource={booktitle}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}]
- }
- %对于高版本(3.4以上)可以用下面这一段取代前面那一段,为了兼容gbnoauthor选项,这些代码只能在sourcemap中使用,所以只能选择前面那一段
- %\map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{
-% \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}]
-% }
-% \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{
-% \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}]
-% }
-% \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,%
-% address,location,institution,organization}]{
-% \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
-% }
- }
-}
-
-%
-% 佚名/noauthor的处理
-%
-% 原理方法:利用样式层的动态数据修改实现
-\def\dealnoathor{
- \DeclareStyleSourcemap{
- \maps[datatype=bibtex]{
- \map{%默认情况下将空缺作者的中文文献设置为佚名
- \step[fieldsource=language,match={chinese},final]
- \step[fieldset=author, fieldvalue={佚名}]
- }
- \map{%默认情况下将空缺作者的英文文献设置为A{non}
- \step[fieldsource=language,match={english},final]
- \step[fieldset=author, fieldvalue={A{non}}]%noauthor换成Anon,同时为避免大写还加了{}
- }
- }
- }
-}
-
-%
-% 不同语言分集调整的实现方式
-%
-% 原理方法:利用样式层的动态数据修改lansortorder域来实现排序
-\def\dealsortlan{
- \DeclareStyleSourcemap{
- \maps[datatype=bibtex]{
- \map[overwrite]{%当文献给出language域时,设置文献要使用的本地化字符串的语言
- \step[fieldsource=language,match=english,final]
- \step[fieldset=lansortorder,fieldvalue=\lanenorder]
- }
- \map[overwrite]{
- \step[fieldsource=language,match=russian,final]
- \step[fieldset=lansortorder,fieldvalue=\lanruorder]
- }
- \map[overwrite]{%
- \step[fieldsource=language,match=french,final]
- \step[fieldset=lansortorder,fieldvalue=\lanfrorder]
- }
- \map[overwrite]{%
- \step[fieldsource=language,match=chinese,final]%中日韩语目前都用english,
- \step[fieldset=lansortorder,fieldvalue=\lancnorder]
- }
- \map[overwrite]{%
- \step[fieldsource=language,match=japanese,final]%中日韩语目前都用english,
- \step[fieldset=lansortorder,fieldvalue=\lanjporder]
- }
- \map[overwrite]{%
- \step[fieldsource=language,match=korean,final]%中日韩语目前都用english,
- \step[fieldset=lansortorder,fieldvalue=\lankrorder]
- }
- }
- }
-}
-
-
-%
-%驱动别名等价于驱动层映射
-%
-\DeclareBibliographyAlias{newspaper}{article}%
-\DeclareBibliographyAlias{inproceedings}{inbook}%会议论文文献类型驱动
-\DeclareBibliographyAlias{conference}{inbook}%会议论文文献类型驱动
-\DeclareBibliographyAlias{incollection}{inbook}%文集中析出文献类型驱动
-\DeclareBibliographyAlias{collection}{book}%%文集类型驱动
-\DeclareBibliographyAlias{proceedings}{book}%会议论文集文献类型驱动
-\DeclareBibliographyAlias{thesis}{manual}%学位论文驱动
-\DeclareBibliographyAlias{unpublished}{manual}%其它类型驱动
-\DeclareBibliographyAlias{database}{manual}
-\DeclareBibliographyAlias{dataset}{manual}
-\DeclareBibliographyAlias{software}{manual}
-\DeclareBibliographyAlias{map}{manual}
-\DeclareBibliographyAlias{archive}{manual}
-
-%=====================================================================
-% 设置排序格式
-%=====================================================================
-%
-% 排序格式,用降序,及userb域,针对biblatex3.7及以下版本
-%
-\defversion{3.7}{sort}{%这是3.4版的,3.7版略有差异,但不大,后面有注释
- \DeclareSortingScheme{gb7714-2015}{
- \sort{
- \field{presort}
- }
- %\sort[final]{
- %\field{sortkey}
- %}
- \sort{
- \field{lansortorder}%language
- }
- \sort{
- \field{sortkey}
- }
- \sort{%[direction=descending]
- \field{sortname}
- \field{author}
- \field{editor}
- \field{translator}
- }
- \sort{
- \field{sortyear}
- \field{year}
- }
- \sort{
- \field{sorttitle}
- \field{title}
- }
- \sort{
- \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume}
- \literal{0000}%3.7版是\literal{0}
- }
- }
-
- %降序的nyt
- \DeclareSortingScheme{gbnytd}{
- \sort{
- \field{presort}
- }
- %\sort[final]{
- %\field{sortkey}
- %}
- \sort{
- \field{lansortorder}%language
- }
- \sort[direction=descending]{
- \field{sortkey}
- }
- \sort[direction=descending]{
- \field{sortname}
- \field{author}
- \field{editor}
- \field{translator}
- }
- \sort{
- \field{sortyear}
- \field{year}
- }
- \sort{
- \field{sorttitle}
- \field{title}
- }
- \sort{
- \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume}
- \literal{0000}%3.7版是\literal{0}
- }
- }
-
- %降序的ynt
- \DeclareSortingScheme{gbyntd}{
- \sort{
- \field{presort}
- }
- %\sort[final]{
- %\field{sortkey}
- %}
- \sort{
- \field{lansortorder}%language
- }
- \sort[direction=descending]{
- \field{sortyear}
- \field{year}
- }
- \sort{
- \field{sortkey}
- }
- \sort{
- \field{sortname}
- \field{author}
- \field{editor}
- \field{translator}
- }
- \sort{
- \field{sorttitle}
- \field{title}
- }
- \sort{
- \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume}
- \literal{0000}%3.7版是\literal{0}
- }
- }
-
- %升序的ynt
- \DeclareSortingScheme{gbynta}{
- \sort{
- \field{presort}
- }
- %\sort[final]{
- %\field{sortkey}
- %}
- \sort{
- \field{lansortorder}%language
- }
- \sort{
- \field{sortyear}
- \field{year}
- }
- \sort{
- \field{sortkey}
- }
- \sort{
- \field{sortname}
- \field{author}
- \field{editor}
- \field{translator}
- }
- \sort{
- \field{sorttitle}
- \field{title}
- }
- \sort{
- \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume}
- \literal{0000}%3.7版是\literal{0}
- }
- }
-}
-
-
-%
-% 排序格式,用降序,及userb域,针对biblatex3.8及以上版本
-%
-\defversion{3.8}{sort}{
- \DeclareSortingTemplate{gb7714-2015}{
- \sort{
- \field{presort}
- }
- %\sort[final]{
- %\field{sortkey}
- %}
- \sort{
- \field{lansortorder}%language
- }
- \sort{
- \field{sortkey}
- }
- \sort{%[direction=descending]
- \field{sortname}
- \field{author}
- \field{editor}
- \field{translator}
- }
- \sort{
- \field{sortyear}
- \field{year}
- }
- \sort{
- \field{sorttitle}
- \field{title}
- }
- \sort{
- \field{volume}
- \literal{0}
- }
- }
-
- %降序的nyt
- \DeclareSortingTemplate{gbnytd}{
- \sort{
- \field{presort}
- }
-% \sort[final]{
-% \field{sortkey}
-% }
- \sort{
- \field{lansortorder}%language
- }
- \sort[direction=descending]{
- \field{sortkey}
- }
- \sort[direction=descending]{%
- \field{sortname}
- \field{author}
- \field{editor}
- \field{translator}
- }
- \sort{
- \field{sortyear}
- \field{year}
- }
- \sort{
- \field{sorttitle}
- \field{title}
- }
- \sort{
- \field{volume}
- \literal{0}
- }
- }
-
- %降序的ynt
- \DeclareSortingTemplate{gbyntd}{
- \sort{
- \field{presort}
- }
-% \sort[final]{
-% \field{sortkey}
-% }
- \sort{
- \field{lansortorder}%language
- }
- \sort[direction=descending]{
- \field{sortyear}
- \field{year}
- }
- \sort{
- \field{sortkey}
- }
- \sort{%
- \field{sortname}
- \field{author}
- \field{editor}
- \field{translator}
- }
- \sort{
- \field{sorttitle}
- \field{title}
- }
- \sort{
- \field{volume}
- \literal{0}
- }
- }
-
- %升序的ynt
- \DeclareSortingTemplate{gbynta}{
- \sort{
- \field{presort}
- }
-% \sort[final]{
-% \field{sortkey}
-% }
- \sort{
- \field{lansortorder}%language
- }
- \sort{%[direction=ascending]
- \field{sortyear}
- \field{year}
- }
- \sort{
- \field{sortkey}
- }
- \sort{%
- \field{sortname}
- \field{author}
- \field{editor}
- \field{translator}
- }
- \sort{
- \field{sorttitle}
- \field{title}
- }
- \sort{
- \field{volume}
- \literal{0}
- }
- }
-
- %
- % 定义命令\defdoublelangentry,用于biblatex>v3.8版利用related实现双语文献的处理
- %
- %为了实现v3.8以上版本的双语文献,采用related的方法代替set方法,因为set方法已经无法实现了,
- %因为set不再复制其第一个成员的信息。于是定义一个命令,用于动态的修改数据,即添加related域的信息
- %其中使用了\DeclareStyleSourcemap,但由于其只能出现在导言区中,因此\defdoublelangentry命令也只能出现在导言区中
- \newcommand{\defdoublelangentry}[2]{%
- \edef\entrykeya{##1}
- \edef\entrykeyb{##2}
- \DeclareStyleSourcemap{
- \maps[datatype=bibtex]{
- \map{
- \step[fieldsource=entrykey, match=\entrykeya, final]
- \step[fieldset=related, fieldvalue=\entrykeyb]
- }
- }
- }
- }
-}
-
-
-\ifboolexpr{
-test {\iftoggle{iftlfive}}
-or
-test {\iftoggle{iftlsix}}
-or
-test {\iftoggle{iftlseven}}%biblatex<=3.7
-}{\switchversion{3.7}{sort}}{\switchversion{3.8}{sort}}%3.8<=biblatex
-
-
-%=====================================================================
-%参考文献表环境
-%=====================================================================
-
-%
-% 列表格式
-%
-% 增加一个\bibitemindent尺寸用于控制list环境的itemindent
-% v1.0l,20180615,hzz
-\setlength{\bibhang}{1em}
-\newlength{\bibitemindent}
-\setlength{\bibitemindent}{-\bibhang}
-\setlength{\bibitemsep}{4.5pt}
- \defbibenvironment{bibliography}
- {\list
- {}
- {\setlength{\leftmargin}{\bibhang}%
- \setlength{\itemindent}{\bibitemindent}%
- \setlength{\itemsep}{\bibitemsep}%
- \setlength{\parsep}{\bibparsep}}}
- {\endlist}
- {\item}
-
-
-%=====================================================================
-% 设置单元或块等的标点
-%=====================================================================
-\renewrobustcmd*{\bibinithyphendelim}{\addhighpenspace}%用于处理姓名中名部分存在-的情况,比如ZHANG Yu-xin
-\renewcommand*{\subtitlepunct}{\addcolon\space} %修改标题和其它标题信息间的标点%来源biblatex.def
-%
-% 利用set实现的多语言文献不同语言间的分隔符
-% 20170411,双语之间用newline替换par,避免采用gb7714-2015的项对齐方式第二语言间分段导致没有缩进
-%
-% 原理方法:set方法可以参考3.11.5 Entry Sets,4.11.1 Entry Sets
-% 这里调整一下两种语言参考文献的间隔,源来自biblatex.def
-\renewcommand*{\entrysetpunct}{\adddot\par\nobreak}%ay样式用par也可以,因为没有悬挂对齐问题
-\renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%%页码引用格式的修改,修改为用冒号
-%\renewcommand{\relateddelim}{}%\par
-
-%=====================================================================
-% 修改域的格式,重定义域的输出宏
-%=====================================================================
-%
-% 新增文献类型标识符的格式
-% []前的nobreak,从GB4.1节的例子看不应该加,所以去掉
-% 但因为考虑到cjk字符和[]之间可能添加空格,所以仍然加上
-% 而[]中间的内容,从4.6.2节的例子看也是可以分割的,因此内部的nobreak也可以去掉
-%
-\DeclareFieldFormat{gbtypeflag}{%
-\iftoggle{bbx:gbmedium}%
-{\iftoggle{bbx:url}%
- {\iffieldundef{url}%当存在url时,增加一个OL标识符
- {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}%
- {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}%
- }%
- {\ifentrytype{online}%
- {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}%
- {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}%
- }}%
- {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}%
-}
-
-%
-% 新增用于报纸的文献类型标识符的格式
-%
-\DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper
-\iftoggle{bbx:gbmedium}%
-{\iftoggle{bbx:url}%
- {\iffieldundef{url}%当存在url时,增加一个OL标识符
- {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
- {\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}%
- }%
- {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
-}{\nobreak\printtext{[}\nobreak N\printtext{]}\nobreak}%
-}
-
-%
-% 新增用于标准的文献类型标识符的格式
-%
-\DeclareFieldFormat{gbtypeflags}{%用于标准standard
-\iftoggle{bbx:gbmedium}%
-{\iftoggle{bbx:url}%
- {\iffieldundef{url}%当存在url时,增加一个OL标识符
- {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
- {\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}%
- }%
- {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
-}{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}%
-}
-
-%
-% 重设title等参考文献信息的输出格式
-%
-% 原理方法:修改来自biblatex.def文件的原格式
-\newcommand{\bibtitlefont}{}
-\newcommand{\bibauthorfont}{}
-\newcommand{\bibpubfont}{}
-\DeclareFieldFormat{title}{#1\adddot\addthinspace}
-\DeclareFieldFormat{journaltitle}{#1\isdot}%添加\isdot,用于缩写名带点情况,将其转换为缩写点,便于标点的追踪
-\DeclareFieldFormat{issuetitle}{#1}
-\DeclareFieldFormat{maintitle}{#1}
-\DeclareFieldFormat{booktitle}{#1}
-\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉
- [article,patent,thesis,unpublished]
- {title}{#1\adddot\addthinspace}
-\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉
- [inbook,incollection,inproceedings]
- {title}{#1}%\nopunct\unspace
-\DeclareFieldFormat{url}{\url{#1}} %url域修改如本行%url相关输出,源来自biblatex.def
-\def\UrlFont{\rmfamily}%设置url字体为roman字体%\ttfamily
-%\urlstyle{rm} %使用这句也一样
-\setcounter{biburlnumpenalty}{100} %让url可以在数字后断行
-\setcounter{biburlucpenalty}{100} %让url可以在大写字母后断行
-\setcounter{biburllcpenalty}{100} %让url可以在小写字母后断行
-\DeclareFieldFormat{doi}{%
- \rmfamily{DOI}\addcolon\space
- \ifhyperref
- {\href{https://doi.org/#1}{\nolinkurl{#1}}}
- {\nolinkurl{#1}}}
-%
-% 标题的字母大小写格式修改
-%
-% 注意:修改标题的字母大小写,不能用前面的title的格式而要用titlecase
-% 因为titlecase is applied to the contents of the field directly,title is not
-%\DeclareFieldFormat{titlecase}{\MakeCapital#1}%重设标题格式,将其修改为首字母大写
-\DeclareFieldFormat{titlecase}{\iftoggle{bbx:titlelink}{%
-\iffieldundef{url}{\MakeCapital#1}{%
-\href{\thefield{url}}{#1}}}{\MakeCapital#1}}%重设标题格式,将其修改为首字母大写
-\DeclareFieldFormat{pages}{#1}%页码引用格式的修改%去掉前面引导页码的pp.等字符
-\DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{-}}
-
-\def\execgbfdfmtstd{%恢复到标准样式的设置
-\DeclareFieldFormat{title}{\mkbibemph{##1}}
-\DeclareFieldFormat
- [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
- {title}{\mkbibquote{##1\isdot}}
-\DeclareFieldFormat
- [suppbook,suppcollection,suppperiodical]
- {title}{##1}
-\DeclareFieldFormat{journaltitle}{\mkbibemph{##1}}
-\DeclareFieldFormat{issuetitle}{\mkbibemph{##1}}
-\DeclareFieldFormat{maintitle}{\mkbibemph{##1}}
-\DeclareFieldFormat{booktitle}{\mkbibemph{##1}}
-\DeclareFieldFormat{url}{\mkbibacro{URL}\addcolon\space\url{##1}}
-\DeclareFieldFormat{titlecase}{##1}
-\DeclareFieldFormat{pages}{\mkpageprefix[bookpagination]{##1}}
-}
-
-%
-% 文献标题后的标点问题
-% v1.0k,20180405,为texlive2017以上版本中的beamer兼容性做的处理,Hu Zhenzhen
-%
-% 原理方法:如下代码处理texlive2017以上版本中,beamer中文献的标题后出现两个点的情况:
-% texlive2017以上的beamer中对macro{title}做了patch,正常情况下不会出现两个点的情况,但由于
-% 之前为了处理texlive2015,2016下的title格式添加了adddot,导致出现两个点的情况,而且也影响
-% 析出文献的//符号的输出,因此再次对macro{title}做patch消除beamer中做apptocmd时添加的\newunitpunct
-\ifboolexpr{%
- test{\iftoggle{iftlfive}}
- or
- test{\iftoggle{iftlsix}}
- }{}%
- {%texlive 2017对应iftlseven以上版本
- \@ifclassloaded{beamer}{
- \DeclareFieldFormat{title}{#1}%
- \DeclareFieldFormat[article,patent,thesis,unpublished]{title}{#1}
- \AtBeginDocument{%
- \patchcmd{\abx at macro@title}{\newunitpunct}{}{}{}}}{}
- }
-
-
-%
-% 修改译者位置格式
-%
-% 原理方法:修改来自biblatex.def文件的bytranslator+others宏的格式
-\renewbibmacro*{bytranslator+others}{\bibauthorfont%
- \ifnameundef{translator}
- {}
- {%\usebibmacro{bytranslator+othersstrg}
- %\setunit{\addspace}%
- \printnames[bytranslator]{translator}%
- \clearname{translator}%
- %从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理
- %比如生成cotranslator等用于调用cotranslator所代表的当地化字符串
- \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。
- %\setunit{\addspace}%
- \newunit}%
- \usebibmacro{withothers}}
-
-
-
-%
-% 修改作者数量超过限定值,做省略时的处理格式
-% v1.0,20160701,hzz
-% v1.0O,20190103,hzz,修改利用新定义的一个分隔符strandothersdelim
-%
-% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。
-% \printnames由start-stop控制项数,默认是1和maxnames/minnames
-\renewbibmacro*{name:andothers}{\bibauthorfont%
- \ifboolexpr{
- test {\ifnumequal{\value{listcount}}{\value{liststop}}}
- and
- test \ifmorenames
- }{\ifnumgreater{\value{liststop}}{1}%注意这里试图去区分姓名总数大于1的情况,当姓名总数大于1时,最后一个姓名后面先加入一个\finalandcomma
- {\finalandcomma}%目前国标没有这样的区分要求,如果有需要也是可以这么去做的。
- {}%
-\printdelim{andothersdelim}\printdelim{strandothersdelim}%
-}{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如:
-%袁训来, 陈哲, 肖书海, 等.
-%胡泳, 范海燕, 译.
-%潘惠霞, 魏婧, 杨艳, 等译.
-\ifcurrentname{translator}{\addcomma\addthinspace}{}%为了实现上述第二个示例情况做的处理
-}}
-
-% 修改省略作者后的本地化字符串,比如et al.
-% v1.0o,20190103,hzz
-%
-% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andotherscn=“等”,否则用andothers=“et al.”。
-% 非默认情况,根据选项信息,选择选择强制中文或英文
-% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了
-% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置
-\DeclareDelimFormat{strandothersdelim}{%
- \edef\userfieldabcde{userd}%这里使用\iffieldequalstr{labelnamesource}替代ifcurrentname因为标注中使用ifcurrentname无效
- \iffieldequalstr{labelnamesource}{translator}{\edef\userfieldabcde{usere}}{}%
- \iffieldequalstr{labelnamesource}{editor}{\edef\userfieldabcde{userc}}{}%
- \iffieldequalstr{labelnamesource}{author}{\edef\userfieldabcde{userf}}{}%
- \iffieldequalstr{labelnamesource}{bookauthor}{\edef\userfieldabcde{userb}}{}%
- \ifcase\value{gbcitelocalcase}%
- \iffieldequalstr{\userfieldabcde}{chinese}{\ifbibstring{andothersincitecn}{\bibstring{andothersincitecn}}{\bibstring{andothers}}}{}%中文已经通过english本地化字符串定义
- \iffieldequalstr{\userfieldabcde}{korean}{\ifbibstring{andotherskr}{\bibstring{andotherskr}}{\bibstring{andothers}}}{}%韩语未定义,所以与bib中一致
- \iffieldequalstr{\userfieldabcde}{japanese}{\ifbibstring{andothersjp}{\bibstring{andothersjp}}{\bibstring{andothers}}}{}%日与同韩语
- \iffieldequalstr{\userfieldabcde}{english}{\ifbibstring{andothersincite}{\bibstring{andothersincite}}{\bibstring{andothers}}}{}%英语已定义
- \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%法语未定义,若要定义需要针对french本地化字符串定义
- \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%俄语未定义,若要定义需要针对russian本地化字符串定义
- \or%
- \bibstring{andothersincitecn}%
- \or%
- \bibstring{andothersincite}%
- \fi}
-
-
-\DeclareDelimFormat[bib,biblist]{strandothersdelim}{%
- \edef\userfieldabcde{userd}%
- \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
- \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
- \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
- \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
- \ifcase\value{gbbiblocalcase}%
- \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}%
- \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}%
- \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andothersjp}}{}%
- \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}%
- \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%
- \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%
- \or%
- \bibstring{andotherscn}%
- \or%
- \bibstring{andothers}%
- \fi}
-
-
-%
-% 修改最后一个作者前的字符串,比如 and
-% v1.0o,20190103,hzz
-%
-% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andcn=“和”,否则用and=“and”。
-% 非默认情况,根据选项信息,选择选择强制中文或英文
-% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了
-% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置
-\DeclareDelimFormat{finalnamedelim}{%
- \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
-% \addspace%
- \edef\userfieldabcde{userd}%
- \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
- \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
- \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
- \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
- \ifcase\value{gbcitelocalcase}%
- \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andincitecn}}{}%
- \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
- \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}%
- \iffieldequalstr{\userfieldabcde}{english}{\space\bibstring{andincite}\space}{}%
- \iffieldequalstr{\userfieldabcde}{french}{\space\bibstring{and}\space}{}%
- \iffieldequalstr{\userfieldabcde}{russian}{\space\bibstring{and}\space}{}%
-%\space%
- \or%
- \bibstring{andincitecn}%\space%
- \or%
-\space\bibstring{andincite}\space%
- \fi}
-
-\DeclareDelimFormat[bib,biblist]{finalnamedelim}{%
- \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
- \addspace%
- \edef\userfieldabcde{userd}%
- \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
- \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
- \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
- \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
- \ifcase\value{gbbiblocalcase}%
- \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}%
- \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
- \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}%
- \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}%
- \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}%
- \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}%
-\space%
- \or%
- \bibstring{andcn}\space%
- \or%
- \bibstring{and}\space%
- \fi}
-
-
-
-%
-% 重设title的输出
-%
-% 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen
-% 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件
-% 利用toggle做标识符是否输出的判断
-\renewbibmacro*{title}{%
- \ifboolexpr{%
- test{\iffieldundef{title}}%
- and
- test{\iffieldundef{subtitle}}%
- }%
- {}%
- {\printtext[title]{\bibtitlefont%增加字体控制命令
- \printfield[titlecase]{title}%
- \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
- {}{\setunit{\subtitlepunct}%
- \printfield[titlecase]{subtitle}}%
- \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
- {\setunit{\subtitlepunct}\printfield{titleaddon}}%
- \iftoggle{bbx:gbtype}{%
- \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准
- {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准
- {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸
- {\printfield[gbtypeflag]{usera}}}%其它
- }}{}%
- %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
- %\newunit
- }%
-}}
-
-
-%
-% 作者信息的输出格式
-%
-% 20180425,v1.0k,为作者增加字体控制命令,Hu Zhenzhen
-% 20180603,v1.0l,增加使用nameformat域来选择姓名格式
-\DeclareNameFormat{namefmtselected}{%
-\iffieldundef{namefmtid}{}%
-{\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}%
-\ifcase\value{gbnamefmtcase}%
- \ifgiveninits
- {\usebibmacro{name:gbuppercase}
- {\namepartfamily}
- {\namepartgiveni}
- {\namepartprefix}
- {\namepartsuffix}}
- {\usebibmacro{name:gbuppercase}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}}%
-\or
- \ifgiveninits
- {\usebibmacro{name:gblowercase}
- {\namepartfamily}
- {\namepartgiveni}
- {\namepartprefix}
- {\namepartsuffix}}
- {\usebibmacro{name:gblowercase}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}}%
-\or
- \ifgiveninits
- {\usebibmacro{name:given-family}
- {\namepartfamily}
- {\namepartgiveni}
- {\namepartprefix}
- {\namepartsuffix}}
- {\usebibmacro{name:given-family}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}}%
-\or
- \ifgiveninits
- {\usebibmacro{name:family-given}
- {\namepartfamily}
- {\namepartgiveni}
- {\namepartprefix}
- {\namepartsuffix}}
- {\usebibmacro{name:family-given}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}}%
-\or
-\usebibmacro{name:gbpinyin}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}%
-\or
- \ifnumequal{\value{listcount}}{1}
- {\ifgiveninits
- {\usebibmacro{name:family-given}
- {\namepartfamily}
- {\namepartgiveni}
- {\namepartprefix}
- {\namepartsuffix}}
- {\usebibmacro{name:family-given}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}}%
- \ifboolexpe{%
- test {\ifdefvoid\namepartgiven}
- and
- test {\ifdefvoid\namepartprefix}}
- {}
- {\usebibmacro{name:revsdelim}}}
- {\ifgiveninits
- {\usebibmacro{name:given-family}
- {\namepartfamily}
- {\namepartgiveni}
- {\namepartprefix}
- {\namepartsuffix}}
- {\usebibmacro{name:given-family}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}}}%
-\fi
- \usebibmacro{name:andothers}}
-
-\DeclareNameAlias{default}{namefmtselected}%姓名的默认格式采用可选的模式
-\DeclareNameAlias{sortname}{default}% Used in the bibliography %family-given/given-family
-\DeclareNameAlias{citename}{default}% Default used by \citename
-
-\DeclareDelimFormat[bib,biblist]{andothersdelim}{\addcomma\addspace}
-%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}%
-
-%GB/T 7714-2015 风格,全部大写
-\newbibmacro*{name:gbuppercase}[4]{\bibauthorfont%
-\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
-\renewcommand*{\revsdnamepunct}{}%
- \ifuseprefix%
- {\usebibmacro{name:delim}{#3#1}%
- \usebibmacro{name:hook}{#3#1}%
- \ifdefvoid{#3}{}{%
- \ifcapital%
- {\mkbibnameprefix{\MakeCapital{#3}}\isdot}%
- {\mkbibnameprefix{#3}\isdot}%
- \ifprefchar{}{\bibnamedelimc}}%
- \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
- \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%
- {\usebibmacro{name:delim}{#1}%
- \usebibmacro{name:hook}{#1}%
- \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
- \ifboolexpe{%
- test {\ifdefvoid{#2}}
- and
- test {\ifdefvoid{#3}}}
- {}{\revsdnamepunct}%
- \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
- \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%
-}
-
-%GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出
-\newbibmacro*{name:gblowercase}[4]{\bibauthorfont%
- \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
- \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
- \ifuseprefix
- {\usebibmacro{name:delim}{#3#1}%
- \usebibmacro{name:hook}{#3#1}%
- \ifdefvoid{#3}{}{%
- \ifcapital
- {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
- {\mkbibnameprefix{#3}\isdot}%
- \ifprefchar{}{\bibnamedelimc}}%
- \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot%
- \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}
- {\usebibmacro{name:delim}{#1}%
- \usebibmacro{name:hook}{#1}%
- \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot%
- \ifboolexpe{%
- test {\ifdefvoid{#2}}
- and
- test {\ifdefvoid{#3}}}
- {}{\revsdnamepunct}%
- \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}
- \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%
-}
-
-%中文常见风格,汉语拼音全拼模式
-\newbibmacro*{name:gbpinyin}[4]{\bibauthorfont%
-\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY
-\renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
-\renewrobustcmd*{\bibnamedelima}{\mbox{-}}%
- \ifuseprefix
- {\usebibmacro{name:delim}{#3#1}%
- \usebibmacro{name:hook}{#3#1}%
- \ifdefvoid{#3}{}{%
- \ifcapital
- {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
- {\mkbibnameprefix{#3}\isdot}%
- \ifprefchar{}{\bibnamedelimc}}%
- \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
- \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamegiven{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}
- {\usebibmacro{name:delim}{#1}%
- \usebibmacro{name:hook}{#1}%
- \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
- \ifboolexpe{%
- test {\ifdefvoid{#2}}
- and
- test {\ifdefvoid{#3}}}
- {}
- {\revsdnamepunct}%
- \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeCapital{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}
- \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%
-}
-
-
-\@ifpackagelater{biblatex}{2016/03/27}%biblatex<3.2版的情况
- {}{
- %GB/T 7714-2015 风格,全部大写
- \renewbibmacro*{name:gbuppercase}[4]{\bibauthorfont%
- \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
- \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
- \ifuseprefix
- {\usebibmacro{name:delim}{#3#1}%
- \usebibmacro{name:hook}{#3#1}%
- \ifblank{#3}{}{%
- \ifcapital
- {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
- {\mkbibnameprefix{#3}\isdot}%
- \ifpunctmark{'}{}{\bibnamedelimc}}%
- %\mkbibnamelast{#1}\isdot
- \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase
- %注意上一句\MakeCapital后面如果再跟一个{}包含#1,则没有效果,可能是包在里面少了一层展开
- %因为机构名通常包括在{}内,所以要多展开一次才行,所以这里去掉#1外面的{}
- %\mkbibnamelast{\MakeUppercase{#1}}\isdot
- %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面
- \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}%
- \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}}
- {\usebibmacro{name:delim}{#1}%
- \usebibmacro{name:hook}{#1}%
- %\mkbibnamelast{#1}\isdot %3.9.1 Generic Commands and Hooks,对姓重新处理,如下句: %\mkbibnamelast{\MakeUppercase{#1}}
- \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase
- %\mkbibnamelast{\MakeUppercase{#1}}\isdot
- %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面
- \ifblank{#2#3}{}{\revsdnamepunct}%
- \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}%
- \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
- \addcomma\addspace%
- \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}%
- }%
- }
-
- %GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出
- \renewbibmacro*{name:gblowercase}[4]{\bibauthorfont%
- \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
- \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
- \ifuseprefix
- {\usebibmacro{name:delim}{#3#1}%
- \usebibmacro{name:hook}{#3#1}%
- \ifblank{#3}{}{%
- \ifcapital
- {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
- {\mkbibnameprefix{#3}\isdot}%
- \ifpunctmark{'}{}{\bibnamedelimc}}%
- \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase
- \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{{#2}}\isdot}%
- \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}}
- {\usebibmacro{name:delim}{#1}%
- \usebibmacro{name:hook}{#1}%
- \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase
- \ifblank{#2#3}{}{\revsdnamepunct}%
- \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{{#2}}\isdot}%
- \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
- \addcomma\addspace%
- \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}%
- }%
- }
-
- %中文常见风格,汉语拼音全拼模式
- \renewbibmacro*{name:gbpinyin}[4]{\bibauthorfont%
- \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
- \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
- \renewrobustcmd*{\bibnamedelima}{\mbox{-}}%
- \ifuseprefix
- {\usebibmacro{name:delim}{#3#1}%
- \usebibmacro{name:hook}{#3#1}%
- \ifblank{#3}{}{%
- \ifcapital
- {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
- {\mkbibnameprefix{#3}\isdot}%
- \ifpunctmark{'}{}{\bibnamedelimc}}%
- \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase
- \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamefirst{#2}}\isdot}%
- \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}}
- {\usebibmacro{name:delim}{#1}%
- \usebibmacro{name:hook}{#1}%
- \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase
- \ifblank{#2#3}{}{\revsdnamepunct}%
- \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}%
- \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
- \addcomma\addspace%
- \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}%
- }%
- }
-
- %%biblatex<3.2版的情况,姓名的处理格式带参数
- \DeclareNameFormat{namefmtselected}{%
- \iffieldundef{namefmtid}{}%
- {\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}%
- \ifcase\value{gbnamefmtcase}%
- \iffirstinits
- {\usebibmacro{name:gbuppercase}{#1}{#4}{#5}{#7}}
- {\usebibmacro{name:gbuppercase}{#1}{#3}{#5}{#7}}%
- \or
- \iffirstinits
- {\usebibmacro{name:gblowercase}{#1}{#4}{#5}{#7}}
- {\usebibmacro{name:gblowercase}{#1}{#3}{#5}{#7}}%
- \or
- \iffirstinits
- {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}}
- {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}%
- \ifblank{#3#5}
- {}
- {\usebibmacro{name:revsdelim}}%
- \or
- \iffirstinits
- {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}}
- {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}%
- \or
- \usebibmacro{name:gbpinyin}{#1}{#3}{#5}{#7}%
- \or
- \ifnumequal{\value{listcount}}{1}
- {\iffirstinits
- {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}}
- {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}%
- \ifblank{#3#5}
- {}
- {\usebibmacro{name:revsdelim}}}
- {\iffirstinits
- {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}}
- {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}}%
- \fi
- \usebibmacro{name:andothers}}
-}
-
-%
-% url和url日期格式
-%
-\renewbibmacro*{url+urldate}{%
- %\usebibmacro{url}%%更换url的位置,放到下面
- \iffieldundef{urlyear}%
- {}{%\setunit*{\addspace}%
- \usebibmacro{urldate}}%
- \setunit{\addperiod\addspace}%
- \usebibmacro{url}}
-\renewbibmacro*{url}{\printfield{url}}
-
-%
-% 日期信息的输出格式,针对biblatex<3.7版本
-%
-\defversion{3.4}{date}{
- \renewbibmacro*{urldate}{%
- \addthinspace\printtext{[}\printfield{urlyear}%
- \iffieldundef{urlmonth}{}{\bibrangedash\printfield{urlmonth}}%
- \iffieldundef{urlday}{}{\bibrangedash\printfield{urlday}}\printtext{]}}
-
- \newbibmacro*{newsdate}{%%新增加一个公告日期,公开日期或新闻日期
- \iffieldundef{year}{}{\printfield{year}%
- \iffieldundef{month}{}{\bibrangedash\printtext{\thefield{month}}%
- \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}%
- }
-
- \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式
- \ifboolexpr{%
- test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
- }%
- {}%更新或修改日期通常有day信息
- {\iffieldequalstr{year}{}{%替换\iffieldundef{year},因为year总是存在,但为空
- \iffieldundef{endyear}{%
- \iffieldundef{eventyear}{}{\printtext{\mkbibparens{\printtext{\printfield{eventyear}}%
- \iffieldundef{eventmonth}{}{\bibrangedash\thefield{eventmonth}}%
- \iffieldundef{eventday}{}{\bibrangedash\printfield{eventday}}}}%
- }%
- }{%
- \iffieldundef{endyear}{}{\printtext{\mkbibparens{\printtext{\printfield{endyear}}%
- \iffieldundef{endmonth}{}{\bibrangedash\thefield{endmonth}}%
- \iffieldundef{endday}{}{\bibrangedash\printfield{endday}}}}%
- }%
- }%
- }%
- {%
- \iffieldundef{year}{}{\printtext{\mkbibparens{\printtext{\printfield{year}}%
- \iffieldundef{month}{}{\bibrangedash\thefield{month}}%
- \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}%
- }%
- }%
- }}%
-}
-
-%
-% 日期信息的输出格式,针对3.9>=biblatex>=3.7版本
-%
-\defversion{3.7}{date}{
- \DeclareFieldFormat{urldate}{##1}
- \renewbibmacro*{urldate}{%
- \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx at edtfdate这种更底层的命令
-
- %
- % 专利的公告日期、或报纸的日期的输出宏
- % 20160701,v1.0,新增加
- % 20180405,v1.0k,为biblatexv3.7-3.9版本,出现多出点bug做处理,Hu Zhenzhen
- %
- % 原理方法:加上printtext避免破坏异步标点机制
- %
- \newbibmacro*{newsdate}{%
- \printtext{\blx at edtfdate{}{}}%
- }
-
- \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式
- \ifboolexpr{%
- test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
- }%
- {}%更新或修改日期通常有day信息
- {\iffieldundef{year}{%
- \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}%
- {\printtext{(}\printenddate\printtext{)}}%
- }{\iffieldequalstr{year}{}{%因为year存在,但为空
- }{\printtext{(}\blx at edtfdate{}{}\printtext{)}}%
- }%
- }}%
-}
-
-%
-% 日期信息的输出格式,针对biblatex>=3.10版本
-%
-\defversion{3.10}{date}{
- \DeclareFieldFormat{urldate}{##1}
- \renewbibmacro*{urldate}{%
- \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx at edtfdate这种更底层的命令
-
- %
- % 专利的公告日期、或报纸的日期的输出宏
- % 20160701,v1.0,新增加
- % 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen
- %
- % 原理方法:加上printtext避免破坏异步标点机制
- % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份
- % 所以无法再用选项设置的方法,印象需要用底层的命令
- % 这里可以用\blx at isodate,但用\blx at gbdate试图避免版本判断
- \newbibmacro*{newsdate}{%%
- \printtext{\blx at gbdate{}{}}%%\blx at isodate{}{}%
- }
-
- \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式
- \ifboolexpr{%
- test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
- }%
- {}%更新或修改日期通常有day信息
- {\iffieldundef{year}{%
- \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}%
- {\printtext{(}\printenddate\printtext{)}}%
- }{\iffieldequalstr{year}{}{%因为year存在,但为空
- }{\printtext{(}\blx at gbdate{}{}\printtext{)}}%
- }%
- }}%
-}
-
-%
-% 关联文献的输出格式,针对3.9>=biblatex>=3.7版本
-%
-% 原理方法:因为related宏中带有##了,所以无法封装到defversion中了。所以直接做判断
-% 下面这一段主要针对v3.8-3.10,因为我提问后,biblatex作者为3.11版增加了一个钩子控制relatedblock前的分隔符。
-\ifboolexpr{
-test{\iftoggle{iftleight}}
-or
-test{\iftoggle{iftlnine}}
-}{\renewbibmacro*{related}{%standard.bbx
- \ifboolexpr{ test {\iffieldundef{related}} or test {\ifrelatedloop} }
- {}
- {\usebibmacro{begrelated}%
- \def\bbx at tempa{}%
- \setcounter{bbx:relatedtotal}{0}%
- \def\do##1{%
- \entrydata{##1}{%
- \ifrelatedloop
- {}
- {\stepcounter{bbx:relatedtotal}%
- \gappto{\bbx at tempa}{##1,}}}}%
- \docsvfield{related}%
- \restorefield{related}{\bbx at tempa}%
- \ifnumgreater{\value{bbx:relatedtotal}}{0}
- {\listcsxadd{bbx:relatedloop}{\strfield{entrykey}}%
- \iffieldundef{clonesourcekey}
- {}
- {\listcsxadd{bbx:relatedloop}{\strfield{clonesourcekey}}}%
- \setcounter{bbx:relatedcount}{0}%
- \def\do{%
- \stepcounter{bbx:relatedcount}%
- \ifnumgreater{\value{bbx:relatedcount}}{0}%这里从1改为0
- {\ifcsundef{relateddelim\strfield{relatedtype}}
- {\printtext{\relateddelim}}
- {\printtext{\csuse{relateddelim\strfield{relatedtype}}}}}
- {}}%
- \ifbibmacroundef{related:\strfield{relatedtype}}
- {\appto{\do}{\usebibmacro{related:default}}}
- {\appto{\do}{\usebibmacro*{related:\strfield{relatedtype}}}}%
- \iffieldformatundef{related:\strfield{relatedtype}}
- {\def\bbx at tempa{related}}
- {\def\bbx at tempa{related:\strfield{relatedtype}}}%
- \iffieldformatundef{relatedstring:\strfield{relatedtype}}
- {\def\bbx at tempb{relatedstring:default}}
- {\def\bbx at tempb{relatedstring:\strfield{relatedtype}}}%
- \printtext[\bbx at tempa]{%
- \usebibmacro{begrelatedloop}%
- \iffieldundef{relatedstring}
- {\ifboolexpr{
- test {\ifnumgreater{\value{bbx:relatedtotal}}{1}}
- and
- test {\ifbibxstring{\thefield{relatedtype}s}}
- }
- {\printtext[\bbx at tempb]{%
- \bibstring[\mkrelatedstring]{\thefield{relatedtype}s}}}
- {\iffieldbibstring{relatedtype}
- {\printtext[\bbx at tempb]{%
- \bibstring[\mkrelatedstring]{\thefield{relatedtype}}}}
- {}}}
- {\iffieldbibstring{relatedstring}
- {\printtext[\bbx at tempb]{%
- \bibstring[\mkrelatedstring]{\thefield{relatedstring}}}}
- {\printfield[\bbx at tempb]{relatedstring}}}%
- \docsvfield{related}%
- \usebibmacro{endrelatedloop}}}%
- {}%
- \usebibmacro{endrelated}}}
-}{}
-
-%
-% 关联文献块前的分隔符,针对biblatex3.11
-%
-% 原理方法:因为增加了begrelateddelim钩子,所以不需要重定义related输出宏
-\defversion{3.11}{related}{
-\renewcommand{\begrelateddelim}{\adddot\newline\nobreak}
-}
-
-\iftoggle{iftlfive}{\switchversion{3.4}{date}}{}%biblatex<=3.2
-\iftoggle{iftlsix}{\switchversion{3.4}{date}}{}%3.3<=biblatex<=3.6
-\iftoggle{iftlseven}{\switchversion{3.7}{date}}{}%biblatex=3.7
-\iftoggle{iftleight}{\switchversion{3.7}{date}}{}%3.8<=biblatex<=3.9
-\iftoggle{iftlnine}{\switchversion{3.10}{date}}{}%biblatex3.10
-\iftoggle{iftlatest}{\switchversion{3.10}{date}\switchversion{3.11}{related}}{}%biblatex最新
-
-%
-% 调整doi+eprint+url格式
-%
-% 原理方法:源来自standard.bbx,因为页码后面直接跟引用日期,没有标点所以去掉其中的标点。
-\renewbibmacro*{doi+eprint+url}{%
-% \iftoggle{bbx:doi}%把doi的位置放到url后面
-% {\printfield{doi}}
-% {}%
- %\newunit\newblock
- \iftoggle{bbx:eprint}
- {\iffieldundef{eprint}{}{\newunit\usebibmacro{eprint}}}%必须要做域判断否则容易产生多余的标点
- {}%
- %\newunit\newblock
- \iftoggle{bbx:url}
- {\usebibmacro{url+urldate}}
- {}
- \newunit\newblock
- \iftoggle{bbx:doi}
- {\printfield{doi}}
- {}}
-
-%
-% 调整页码的格式,即chapter+pages格式
-%
-\renewbibmacro*{chapter+pages}{%
-\iftoggle{bbx:gbstrict}{}{%
- \printfield{chapter}}%
- \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出
- \setunit{\bibpagespunct}%
- \printfield{pages}}%
- %\newunit %这里的标点去掉
- }
-
-%
-% 当location等出版项超过maxitem缩减后不再输出etal
-%
-\DeclareListFormat{location}{%
- \usebibmacro{list:delim}{#1}%
- #1\isdot}
-\DeclareListAlias{institution}{location}
-\DeclareListAlias{publisher}{location}
-
-% 新增一个样式用于输出连续出版物的地址,单位,时间,
-% 用于periodical连续出版物的出版社和地址的处理
-%
-% v1.0k,20180425,为出版信息增加字体控制命令,hzz
-% %类似\newbibmacro*{publisher+location+date}
-\newbibmacro*{location+institution+date}{\bibpubfont%
-\iftoggle{bbx:gbpub}%
-{\testCJKfirst{userd}%
-\ifboolexpr{%
-test {\iflistundef{location}} and test {\iflistundef{institution}}%
-}{\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress}\space :\space\str at nopublisher]}%
-{\printtext{[S.l.\space :\space s.n.\adddot]}}%
-}{%
-\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress]}}{\printtext{[S.l.\adddot]}}}%
- {\printlist{location}}%
-\addcolon\addspace%
-\iflistundef{institution}{%
-\iftoggle{ifCJKforgbt}{\printtext{[\str at nopublisher]}}{\printtext{\mkbibbrackets{s.n.}}}}% \bibstring{nopublisher}%[s.n.\adddot]
-{\printlist{institution}}}%
-\setunit{\addcomma\addspace}%
- %\usebibmacro{date}%
- \printfield{year}%
- \bibrangedash%
- \iffieldundef{endyear}{}{\printfield{endyear}}%
- \newunit}%
-{ \printlist{location}%
- \iflistundef{institution}%
- {\setunit*{\addcomma\space}}
- {\setunit*{\addcolon\space}}%
- \printlist{institution}%
- \setunit*{\addcomma\space}%
- \usebibmacro{date}%
- \newunit}%
-}
-%
-% 通用的出版社和地址的处理
-%
-% 原理方法:当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。
-% 事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。
-% 注意标准standard类型,因为当没有出版项时直接省略,所以做特殊处理
-\renewbibmacro*{publisher+location+date}{\bibpubfont%
-\iftoggle{bbx:gbpub}%
-{\testCJKfirst{userd}%
- \ifboolexpr{ test {\iflistundef{location}} and test {\iflistundef{publisher}} }%
- {\iffieldequalstr{note}{standard}{}{\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress}\space :\space\str at nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}%
- {\iflistundef{location}{%\adddot
- \iffieldequalstr{note}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。
- {\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}}}% \bibstring{noaddress}
- {\printlist{location}\addcolon\addspace}%%\addcolon\addspace%
- \iflistundef{publisher}{%
- \iffieldequalstr{note}{standard}{}%
- {\iftoggle{ifCJKforgbt}{\printtext{[\str at nopublisher]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}%
- {\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}}}%
- {\printlist{publisher}}}%
-\setunit*{\addcomma\addspace}%\addcomma\addspace%
-\usebibmacro{date}%%\newunit %去掉这个标点
-}%
-{\printlist{location}%
- \iflistundef{publisher}
- {\setunit*{\addcomma\space}}
- {\setunit*{\addcolon\space}}%
- \printlist{publisher}%
- \setunit*{\addcomma\space}%
- \usebibmacro{date}%%\newunit
- }%
-}
-
-%
-% 修改了一个institution+location+date用于manual、report、thesis等类型
-%
-% 20180425,v1.0k,增加了字体控制命令,hzz
-% 20190105,v1.0o,加了一个编组避免\usebibmacro{date}把month和day信息去掉
-\renewbibmacro*{institution+location+date}{\bibpubfont%当没有institution时不处理。
-{\printlist{location}%%加了一个编组避免\usebibmacro{date}把month和day信息去掉
- \iflistundef{institution}
- {\setunit*{\addcomma\space}}
- {\setunit*{\addcolon\space}}%
- \printlist{institution}%
- \setunit*{\addcomma\space}%
- \usebibmacro{date}%
- %\newunit
- }}
-
-%
-% 对volume卷信息格式做出修改
-% v1.0o,20190105,hzz
-%
-\DeclareFieldFormat{volume}{%
-\testCJKfirst{userd}%
-\iftoggle{ifCJKforgbt}%
-{\bibstring{serialcn}#1\bibstring{volumecn}}%
-{\bibstring{volume}~#1}%
-}% volume of a book
-\DeclareFieldFormat[article,periodical]{volume}{#1}% volume of a journal
-
-%
-% 对number册信息格式做出修改
-% v1.0o,20190105,hzz
-%
-\DeclareFieldFormat{number}{#1}%
-\DeclareFieldFormat[book,collection,inbook,%
-incollection,proceedings,inproceedings]{number}{%
-\testCJKfirst{userd}%
-\iftoggle{ifCJKforgbt}%
-{\bibstring{serialcn}#1\bibstring{numbercn}}%
-{#1}%
-}%
-
-%
-% 对edition版本信息格式做出修改
-%
-\DeclareFieldFormat{edition}{\bibtitlefont%源来自biblatex.DEF
-\testCJKfirst{userd}%
-\iftoggle{ifCJKforgbt}%
-{\ifinteger{#1}%
-{\printtext{#1\str at edition}}%
-{#1\isdot}}%
-{\ifinteger{#1}%
-{\mkbibordedition{#1}~\bibstring{edition}}%
-{#1\isdot}}}
-
-%
-% 对version的版本信息做出修改
-%
-\DeclareFieldFormat{version}{\bibtitlefont%源来自biblatex.DEF
-\testCJKfirst{userd}%
- \ifinteger{#1}%
- {\iftoggle{ifCJKforgbt}{\printtext{#1\str at edition}}%
- {\mkbibordedition{#1}~\bibstring{version}}}%
- {#1\isdot}}
-
-%
-% 作者域的输出控制宏
-%
-% 当两篇文献作者相同且连续时,标准样式是用-代替后面的文献的作者,这里取消这一设置
-\renewbibmacro*{author}{%author for biblatex version <=3.7
- \ifboolexpr{
- test \ifuseauthor
- and
- not test {\ifnameundef{author}}
- }
- {\usebibmacro{bbx:dashcheck}
- {%\bibnamedash
- \printnames{author}%
- }%
- {\usebibmacro{bbx:savehash}%
- \printnames{author}%
- \iffieldundef{authortype}
- {\setunit{\addspace}}
- {\setunit{\addcomma\space}}}%
- \iffieldundef{authortype}
- {}
- {\usebibmacro{authorstrg}%
- \setunit{\addspace}}}%
- {\global\undef\bbx at lasthash
- \usebibmacro{labeltitle}%
- \setunit*{\addspace}}%
- \setunit{\addcomma\space}%增加一个逗号
- \usebibmacro{date+extrayear}
- }
-
-%
-% 设置标注和文献表中作者和年份之间的分隔符
-%
-% 原理方法:注意3.4版已经有\nameyeardelim,上述修改的author宏虽然定义了著录表中的标点,但标注中的未定义
-% 设置因为mergedate默认为true时的情况,来自\bbx at opt@mergedate at compact
-% 去掉作者后面包围年份的圆括号
-% 这里因为biblatex版本的不同,做不同的处理,texlive2017版/2016等低版本分开处理
-\defversion{3.0}{dateextra}{
-\renewcommand*{\nameyeardelim}{\addcomma\space}
- \renewbibmacro*{date+extrayear}{%%重设date+extrayear格式,源来自authoryear.BBX
- \iffieldundef{\thefield{datelabelsource}year}
- {}
- {\printtext{%[parens]%这里把括号去掉
- \iffieldsequal{year}{\thefield{datelabelsource}year}
- {\printdateextralabel}%
- {\printfield{labelyear}%
- \printfield{extrayear}}}}}%
- \newbibmacro{date+extradate}{\usebibmacro{date+extrayear}}
-}
-
-\defversion{3.4}{dateextra}{
- \DeclareDelimFormat{nameyeardelim}{\addcomma\space}
- \DeclareDelimFormat[bib,biblist]{nameyeardelim}{\addcomma\space}
- \renewbibmacro*{date+extrayear}{%%重设date+extrayear格式,源来自authoryear.BBX
- \iffieldundef{\thefield{datelabelsource}year}
- {}
- {\printtext{%[parens]%这里把括号去掉
- \iffieldsequal{year}{\thefield{datelabelsource}year}
- {\printdateextralabel}%
- {\printfield{labelyear}%
- \printfield{extrayear}}}}}%
- \newbibmacro{date+extradate}{\usebibmacro{date+extrayear}}
-}
-\defversion{3.7}{dateextra}{
- \DeclareDelimFormat{nameyeardelim}{\addcomma\space}
- \DeclareDelimFormat[bib,biblist]{nameyeardelim}{\addcomma\space}
- \renewbibmacro*{date+extrayear}{%以前的\printdateextralabel宏变为了\printlabeldateextra
- \iffieldundef{labelyear}
- {}
- {\printtext{%[parens]
- \iffieldsequal{year}{labelyear}
- {\printlabeldateextra}%
- {\printfield{labelyear}%
- \printfield{extrayear}}}}}%
-
-\newbibmacro{date+extradate}{\usebibmacro{date+extrayear}}
-}
-\defversion{3.8}{dateextra}{
- \DeclareDelimFormat{nameyeardelim}{\addcomma\space}
- \DeclareDelimFormat[bib,biblist]{nameyeardelim}{\addcomma\space}
-%注意这里当没有作者只有标题时在年份之前的标点是否需要标准并未涉及,所以未做处理。
-\renewbibmacro*{author}{%以前的date+extrayear变为date+extradate,所以对3.8以上版本重定义一下author
- \ifboolexpr{
- test \ifuseauthor
- and
- not test {\ifnameundef{author}}
- }
- {\usebibmacro{bbx:dashcheck}
- {%\bibnamedash %去掉相同作者用横线代替的处理
- \printnames{author}\setunit{\printdelim{nameyeardelim}}%把标点也带上
- }
- {\usebibmacro{bbx:savehash}%
- \printnames{author}%
- \iffieldundef{authortype}
- {\setunit{\printdelim{nameyeardelim}}}
- {\setunit{\printdelim{authortypedelim}}}}%
- \iffieldundef{authortype}
- {}
- {\usebibmacro{authorstrg}%
- \setunit{\printdelim{nameyeardelim}}}}%
- {\global\undef\bbx at lasthash
- \usebibmacro{labeltitle}%
- \setunit*{\printdelim{nonameyeardelim}}}%
- \usebibmacro{date+extradate}}
- \renewbibmacro*{date+extradate}{%
- \iffieldundef{labelyear}
- {}
- {\printtext{%[parens]%这里去掉括号
- \iflabeldateisdate
- {\printdateextra}
- {\printlabeldateextra}}}}%
-
-}
-
-
-%
-%为mergedate增加选项none,即实现年份不提前到作者后面的标签中
-%也不打印用于区分同作者同年份文献的标识符如(a,b,c)
-%目的是实现一些特殊的文献表样式比如ucas的作者年制
-%v1.0q,20190212,hzz
-\def\bbx at opt@mergedate at none{%
- \renewbibmacro*{date+extradate}{%
- \iffieldundef{labelyear}
- {}
- {}}%[parens]\printtext{\printlabeldateextra}
-\renewbibmacro*{bbx:ifmergeddate}{\@secondoftwo}%这一句用于3.12版本
-\renewbibmacro*{date}{\printdate}%这一句用于biblatex3.11以下版本
-\renewbibmacro*{issue+date}{%去掉括号
-\setunit{\addcomma\addspace}%
- \printtext{%去掉了[parens]
- \iffieldundef{issue}
- {%\usebibmacro{date}
- \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸
- {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸
- {\usebibmacro{date}}%
- }}%
- {\iftoggle{bbx:gbstrict}{}{\printfield{issue}%
- \setunit*{\addspace}}%
- %\usebibmacro{date}
- \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸
- {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸
- {\usebibmacro{date}}%
- }}}%
- %\newunit
- }%
- }
-
-\iftoggle{iftlfive}{\switchversion{3.0}{dateextra}}{}%biblatex<=3.2
-\iftoggle{iftlsix}{\switchversion{3.4}{dateextra}}{}%3.3<=biblatex<=3.6
-\iftoggle{iftlseven}{\switchversion{3.7}{dateextra}}{}%biblatex=3.7
-\iftoggle{iftleight}{\switchversion{3.8}{dateextra}}{}%<=3.8biblatex<=3.9
-\iftoggle{iftlnine}{\switchversion{3.8}{dateextra}}{}%biblatex3.10
-\iftoggle{iftlatest}{\switchversion{3.8}{dateextra}}{}%biblatex最新3.11
-
-%
-% 修改析出文献的文集的标题与附加标题间的符号
-%
-\renewbibmacro*{booktitle}{%
- \ifboolexpr{
- test {\iffieldundef{booktitle}}
- and
- test {\iffieldundef{booksubtitle}}
- }
- {}
- {\printtext[booktitle]{\bibtitlefont%
- \printfield[titlecase]{booktitle}%
- \setunit{\subtitlepunct}%
- \printfield[titlecase]{booksubtitle}}%
- \newunit%标点换成下一句
- \setunit{\subtitlepunct}}%
- \printfield{booktitleaddon}}
-
-%
-% 调整期刊名的格式
-%
-% 原理方法:因为作者年制年份提到前面,因此涉及到期刊名与后面的卷期的关系。
-% v1.0k,20180425,增加了字体控制命令,hzz
-\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx
- \usebibmacro{journal}%
- %\setunit*{\addspace}%
- %\setunit*{\addcomma\addspace}%修改为增加一个逗号
- \iffieldundef{series}%
- {}%
- {\newunit%
- \printfield{series}%
- \setunit{\addspace}}%
- %\usebibmacro{volume+number+eid}%
- %\setunit{\addspace}%
- \usebibmacro{issue+date}%
- %\setunit{\addcolon\space}%
- \iffieldundef{volume}{}{\setunit{\addcomma\space}}%
- %换成逗号和空格
- \usebibmacro{issue}%
- \usebibmacro{volume+number+eid}%把卷期放到年份后面
- %\newunit
- }
-
-%
-% 增加一个number带括号的格式,避免使用mkbibparens而引入一个不必要的空格
-%
-\DeclareFieldFormat{addnumflag}{%
-\nobreak\printtext{(}\nobreak #1\nobreak\printtext{)}}
-
-%
-% 调整journal输出
-%
-% 原理方法:首先判断子标题,然后再设置标点。
-% 避免直接设置标点后,当volume不存在时需要使用\nopuct去标点进而引入不必要的空格
-\renewbibmacro*{journal}{%
- \iffieldundef{journaltitle}%
- {}%
- {\printtext[journaltitle]{%
- \printfield[titlecase]{journaltitle}%
- \iffieldundef{journalsubtitle}{}{\setunit{\subtitlepunct}%
- \printfield[titlecase]{journalsubtitle}}}}}
-
-
-
-%
-% 调整期刊卷和期的格式
-%
-\renewbibmacro*{volume+number+eid}{%源来自standard.bbx
-\iftoggle{bbx:gbfieldstd}{%
- \printfield{volume}%
- \setunit*{\adddot}%
- \printfield{number}%
- \setunit{\addcomma\space}%
- \printfield{eid}}{%
- \printfield{volume}%
- %\setunit*{\adddot}%去掉点号
- %\printfield{number}%
- \iffieldundef{number}{}{\printfield[addnumflag]{number}}%区别于顺序编码制
- \iffieldundef{eid}{}{%
- \setunit{\addcomma\space}%
- \printfield{eid}}}}
-
-%
-% 调整期刊年份的格式
-%
-% 原理方法:原在authoryear.BBX中\bbx at opt@mergedate at compact中定义
-% 当issue存在时,才设置newunit。避免直接设置标点后,当volume不存在是需要使用\nopuct去标点进而引入不必要的空格
- \renewbibmacro*{issue+date}{%
- \iffieldundef{issue}%
- {}%
- {\iftoggle{bbx:gbstrict}{}{\printtext[parens]{\printfield{issue}}\newunit}}}
-
-
-
-%
-% 调整页码前的标点和去掉期刊文章等页码后面的标点
-%
-\renewbibmacro*{note+pages}{%源来自standard.bbx
- %\printfield{note}%不要note,note用来判断是否是报纸newspaper
- \iffieldundef{pages}{}{
- \setunit{\bibpagespunct}%
- \printfield{pages}}%
- %\newunit
- }
-
-%
-% 编者的符号修改一下
-% v1.0 2016-07-01
-% v1.0q 2019-03-01 hzz 修改editortype前的标点
-%
-\renewbibmacro*{editor}{%
- \ifboolexpr{
- test \ifuseeditor
- and
- not test {\ifnameundef{editor}}
- }
- {\usebibmacro{bbx:dashcheck}
- {%\bibnamedash
- \printnames{editor}%
- }
- {\printnames{editor}%
- %\setunit{\printdelim{editortypedelim}}%
- %\usebibmacro{bbx:savehash}
- }%
- \usebibmacro{editorstrg}%
- %\clearname{editor}%
- \setunit{\printdelim{nameyeardelim}}}%
- {\global\undef\bbx at lasthash
- \usebibmacro{labeltitle}%
- \setunit*{\printdelim{nonameyeardelim}}}%
- \ifboolexpr{%
-test {\ifentrytype{inbook}}
-or
-test {\ifentrytype{incollection}}
-or
-test {\ifentrytype{inproceedings}}
-or
-test {\ifentrytype{conference}}
-}%
-{}%
-{\usebibmacro{date+extradate}}}
-
-%
-% 编者类型做一修改
-% v1.0 2016-07-01
-% v1.0q 2019-03-01 hzz 修改editortype不同语言的不同本地化字符串
-%
-\renewbibmacro*{editorstrg}{%源来自biblatex.DEF
- \printtext[editortype]{%
- \iffieldundef{editortype}
- {%
-% \ifboolexpr{ %这一段去掉,未定义编者类型情况下不处理
-% test {\ifnumgreater{\value{editor}}{1}}
-% or
-% test {\ifandothers{editor}}
-% }
-% {\bibstring{editors}}
-% {\bibstring{editor}}
- }
- {\ifbibxstring{\thefield{editortype}} %定义编者类型情况下处理,以后根据需要修改
- {\ifboolexpr{
- test {\ifnumgreater{\value{editor}}{1}}
- or
- test {\ifandothers{editor}}
- }
- {\printdelim{streditortypes}}
- {\printdelim{streditortype}}}
- {\thefield{editortype}}}%
- }}
-
-%
-% 编者类型的本地化字符串输出
-% v1.0q 2019-03-01 hzz
-% 能对不同条目类型作格式设置的域格式,能对不同环境做格式设置的分隔符
-% 能对不同文境作设置的包括排序,标签等
-% 这里因为考虑可能标注和文献表中存在不同,所以用分隔符来输出本地化字符串
-%
-\DeclareDelimFormat{streditortypes}{%
- \edef\userfieldabcde{userd}%
- \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
- \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
- \ifcase\value{gbbiblocalcase}%
- \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}scn}}{}%
- \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}skr}}{}%
- \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}sjp}}{}%
- \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}%
- \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}%
- \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}%
- \or%
- \bibstring{\thefield{editortype}scn}%
- \or%
- \addcomma\addthinspace\bibstring{\thefield{editortype}s}%
- \fi}
-%
-\DeclareDelimFormat{streditortype}{%
- \edef\userfieldabcde{userd}%
- \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
- \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
- \ifcase\value{gbbiblocalcase}%
- \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}cn}}{}%
- \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}kr}}{}%
- \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}jp}}{}%
- \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}%
- \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}%
- \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}%
- \or%
- \bibstring{\thefield{editortype}cn}%
- \or%
- \addcomma\addthinspace\bibstring{\thefield{editortype}}%
- \fi}
-
-
-%
-% bookauthor域的输出,
-% v1.0q 2019-03-01 hzz
-% 不再对editor和bookauthor做sourcemap,而是下面的宏内逻辑代替,
-% 使得除使用bookauthor外也可以使用editor,便于在使用editor时使用editortype
-\renewbibmacro*{bybookauthor}{%
- \ifnameundef{bookauthor}%
- {\ifnameundef{editor}%
- {}%
- {\ifnamesequal{author}{editor}%
- {}{\usebibmacro{editor}}}%
- }%
- {\ifnamesequal{author}{bookauthor}%
- {}{\printnames{bookauthor}}%
- }%
-}
-
-%
-% 修改期刊的标题
-%
-\renewbibmacro*{periodical}{%源来自biblatex.DEF
- \iffieldundef{title}
- {}
- {\printtext[title]{\bibtitlefont%
- \printfield[titlecase]{title}%
- %\setunit{\subtitlepunct}%
- \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
- {}{\setunit{\subtitlepunct}
- \printfield[titlecase]{subtitle}}%
- %}%把编组结束移到后面去
- \iftoggle{bbx:gbtype}{%
- \iffieldundef{usera}{}{%在标题后直接给出文献标识字母
- \printfield[gbtypeflag]{usera}}}{}
- }}
- }
-
-%
-% 期刊的标题做修改
-%
-\renewbibmacro*{title+issuetitle}{%源来自standard.BBX
- \usebibmacro{periodical}%
- %\setunit*{\addspace}%
- \setunit*{\adddot\addspace}%标点修改为句点
- \iffieldundef{series}
- {}
- {\newunit
- \printfield{series}%
- \setunit{\addspace}}%
- \usebibmacro{periodical+issue}%将issue调整到上面来,并修改
-\iffieldundef{number}{}{%%进一步处理有范围的数字
- \multinumberparser{\thefield{number}}}%
- \iffieldundef{volume}%
- {\printfield{year}%
- \printtext{\mkbibparens{\multinumberfirst}}%
- \bibrangedash%
- \iffieldundef{endyear}{}{\printfield{endyear}\printtext{\mkbibparens{\multinumbersecond}}}%
- }%
- {\multivolparser{\thefield{volume}}%
- \printfield{year}%
- \setunit{\addcomma\space}%将冒号修改为逗号
- \printtext{\multivolfirst}%
- \printtext{\mkbibparens{\multinumberfirst}}%
- \bibrangedash%
- \iffieldundef{endyear}{}{%
- \printfield{endyear}%
- \setunit{\addcomma\space}%将冒号修改为逗号
- \printtext{\multivolsecond}%
- \printtext{\mkbibparens{\multinumbersecond}}}%
- }%
- \setunit{\addcomma\space}%
- \printfield{eid}%
- \setunit{\addspace}%
- %\usebibmacro{issue+date}%
- %\setunit{\addcolon\space}%
- \usebibmacro{issue}%
- \newunit}
-
-%
-% 新增一个样式用于调整期刊年份的格式,只打印年份
-%
-\newbibmacro*{periodical+issue}{%
- \printtext{%去掉了[parens]
- \iffieldundef{issue}
- {%\usebibmacro{date}%修改为下一句
- }%
- {\printfield{issue}%
- \setunit*{\addspace}%
- %\usebibmacro{date}%修改为下一句
- }%
- }%
- %\newunit
-}
-
-%
-% 重设专利title的输出,将文献类型标识符输出出去
-%
-\newbibmacro*{patenttitle}{%原输出来自biblatex.def文件
- \ifboolexpr{%
- test{\iffieldundef{title}}%
- and%
- test{\iffieldundef{subtitle}}%
- }%
- {}%
- {\printtext[title]{\bibtitlefont%
- \printfield[titlecase]{title}%
- \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
- {}{\setunit{\subtitlepunct}%
- \printfield[titlecase]{subtitle}}%
- \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
- {\setunit{\subtitlepunct}\printfield{titleaddon}}%
- \setunit{\subtitlepunct}\printfield{number}%写专利号
- \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}%
- %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
- %\newunit
- }%
-}%
-}
-
-
-
-%
-% 修改in:用于inbook、incollection、inproceedings等类型
-% 2018.04.20,v1.0k,renewed marco,by hzz
-% 20190212,v1.0q,增加中英文区分,by hzz
-%
-% 原理方法:使用bibmacro{in:}改变了以前在driver中直接输出//的方式,同时也简化了标点控制。
-\renewbibmacro*{in:}{%
- \iftoggle{bbx:gbpunctin}{\printtext{\texttt{//}\allowbreak}}%\addthinspace
- {\setunit{\adddot\addspace}%
- \iffieldequalstr{userd}{chinese}%
- {\printtext{\bibstring{incn}}}%
- {\printtext{\bibstring{in}}}%
- }}%\newunit\newblock\intitlepunct
-
-%
-% 修改type域的输出格式
-% 2019.02.12,v1.0q,byhzz
-% 使其可以区分中英文输出不同的格式,比如博士论文英文输出PHD thesis,中文则是博士学位论文
-\DeclareFieldFormat{type}%
-{\iffieldequalstr{userd}{chinese}%
- {\ifbibxstring{#1cn}{\bibxstring{#1cn}}{#1}}%
- {\ifbibstring{#1}{\bibstring{#1}}{#1}}%
-}
-
-
-%
-% 修改series域的输出格式
-% 2019.05.01,v1.0r,byhzz
-\renewbibmacro*{series+number}{%
- \printfield{series}%
- %\setunit*{\addspace}%
- %\printfield{number}%
- %\newunit
- }
-
-%=====================================================================
-%设置驱动格式
-%=====================================================================
-%
-% book条目类的驱动
-%
- \DeclareBibliographyDriver{book}{%源来自standard.bbx文件
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
-\usebibmacro{author/editor+others/translator+others}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
-\usebibmacro{maintitle+title}%
-\iftoggle{bbx:gbstrict}{}{%
-\newunit
-\printlist{language}%
-\newunit\newblock%
-\usebibmacro{byauthor}%
-\newunit\newblock}%
-\usebibmacro{byeditor+others}%
-\newunit
-\printfield{edition}%
-\newunit\newblock%%
-\iftoggle{bbx:gbstrict}{}{%
-\iffieldundef{maintitle}%
-{\printfield{volume}%
-\printfield{part}}%
-{}%
-\newunit%
-\printfield{volumes}%
-\newunit\newblock%
-\usebibmacro{series+number}}%
-\newunit\newblock%
-%\printfield{note}%
-%\newunit\newblock%
-\usebibmacro{publisher+location+date}%
-%\newunit\newblock %这里标点去掉
-\usebibmacro{chapter+pages}%
- \iffieldundef{url}{}{%当没有网址时也不输出
- \usebibmacro{modifydate}}%带括号的修改或更新日期,
-\usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。
- \newunit\newblock%
- \printfield{pagetotal}%
- \newunit\newblock%
- \iftoggle{bbx:isbn}
- {\printfield{isbn}}
- {}%
- \newunit\newblock
- %\usebibmacro{doi+eprint+url}%
- %\newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-
-
-
-%
-% 期刊文章,连续出版物中的析出文献的格式
-%
- \DeclareBibliographyDriver{article}{%
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author/translator+others}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
- \usebibmacro{title}%
- \iftoggle{bbx:gbstrict}{}{%
- \newunit%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}%
- \newunit\newblock
- \usebibmacro{bytranslator+others}%
- \newunit\newblock
- \printfield{version}}%
- \newunit\newblock
- %\usebibmacro{in:}% 不使用in来表示期刊等连续出版物
- \usebibmacro{journal+issuetitle}%
-% \newunit
-% \usebibmacro{byeditor+others}%
-% \newunit
- \usebibmacro{note+pages}%
- \iffieldequalstr{note}{news}{}{%当是新闻时不输出修改或更新日期
- \iffieldundef{url}{}{%当没有网址时也不输出
- \iftoggle{bbx:url}{%当url选项为false时,也不输出
- \usebibmacro{modifydate}}{}}}%带括号的修改或更新日期,
- \usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置
- \newunit\newblock
- \iftoggle{bbx:isbn}
- {\printfield{issn}}
- {}%
- \newunit\newblock
- %\usebibmacro{doi+eprint+url}%
- %\newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-
-%
-% 连续出版物的驱动
-%
- \DeclareBibliographyDriver{periodical}{%源来自standard.BBX
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{editor}%
- %\setunit{\labelnamepunct}\newblock
- \newunit\newblock %删除上面一行,添加这一行
- \usebibmacro{title+issuetitle}%
- \newunit\newblock%
- \usebibmacro{location+institution+date}%添加这一行用于输出地址,单位和时间
- \newunit\newblock%添加这一行
- \iftoggle{bbx:gbstrict}{}{%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byeditor}%
- \newunit\newblock
- \printfield{note}%
- \newunit\newblock}
- \iftoggle{bbx:isbn}
- {\printfield{issn}}
- {}%
- \newunit\newblock
- \usebibmacro{doi+eprint+url}%
- \newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-%
-% 专利文献驱动
-%
- \DeclareBibliographyDriver{patent}{%源来自standard.BBX
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
- %\usebibmacro{title}%
- \usebibmacro{patenttitle}%给出专利专用的标题输出
- \iftoggle{bbx:gbstrict}{}{%
- \newunit%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}}%
- \newunit\newblock
- \printfield{type}%
- \setunit*{\addspace}%
- %\printfield{number}%已放到patenttitle中处理
- \iflistundef{location}
- {}
- {\setunit*{\addspace}%
- \printtext{%[parens]
- \printlist[][-\value{listtotal}]{location}}}%
- \newunit\newblock
- \usebibmacro{byholder}%
- \newunit\newblock
- \printfield{note}%
- \newunit\newblock
- \usebibmacro{newsdate}%
- %\newunit\newblock
- \usebibmacro{doi+eprint+url}%
- \newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-
-%
-% 在线文献驱动
-%
-\DeclareBibliographyDriver{online}{%源来自standard.BBX
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author/editor+others/translator+others}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
- \usebibmacro{title}%
- \iftoggle{bbx:gbstrict}{}{%
- \newunit%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}%
- \newunit\newblock
- \usebibmacro{byeditor+others}%
- \newunit\newblock
- \printfield{note}}%
- \newunit
- \printfield{version}%
- \newunit\newblock
-% \printlist{organization}%
- \printlist{institution}%
- \newunit\newblock
-\ifboolexpr{%
-test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
-}{\usebibmacro{date}}%
-{\usebibmacro{modifydate}}%修改或更新日期,为带括号的时间
- \usebibmacro{url+urldate}%从下面移上来
- \newunit\newblock
- \iftoggle{bbx:eprint}
- {\usebibmacro{eprint}}
- {}%
- \newunit\newblock
- %\usebibmacro{url+urldate}%
- %\newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-
-
-
-%
-% 报告类型驱动
-% 当有网址无出版项时,用online输出
-%
-\DeclareBibliographyDriver{report}{%
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
- \usebibmacro{title}%
- \iftoggle{bbx:gbstrict}{}{%
- \newunit%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}}%
- \newunit\newblock
- \usebibmacro{byeditor+others}%增加的译者信息
- \newunit\newblock
- \printfield{type}%
- \setunit*{\addspace}%
- \printfield{number}%
- \newunit\newblock
- \printfield{version}%
- \newunit
- \printfield{note}%
- \newunit\newblock
- \usebibmacro{publisher+location+date}%
- %\newunit\newblock
- \usebibmacro{chapter+pages}%
- \usebibmacro{doi+eprint+url}%
- \newunit
- \printfield{pagetotal}%
- \newunit\newblock
- \iftoggle{bbx:isbn}
- {\printfield{isrn}}
- {}%
- \newunit\newblock
-% \usebibmacro{doi+eprint+url}%
-% \newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-%
-% 论文、手册类型驱动
-% 2016-11-11,增加了译者信息
-%
-\DeclareBibliographyDriver{manual}{%
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
- \usebibmacro{title}%
- \iftoggle{bbx:gbstrict}{}{%
- \newunit%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}}%
- \newunit\newblock
- \usebibmacro{byeditor+others}%增加的译者信息
- \newunit\newblock
- \iftoggle{bbx:gbfieldtype}{%
- \printfield{type}%
- \setunit*{\addspace}%
- }{}%
- \printfield{number}%
- \newunit\newblock
- \printfield{version}%
- \newunit
- \printfield{note}%
- \newunit\newblock
- \usebibmacro{institution+location+date}%
- %\newunit\newblock
- \usebibmacro{chapter+pages}%
- \iffieldundef{url}{}{%当没有网址时也不输出修改或更新日期
- \usebibmacro{modifydate}}%修改或更新日期为带括号的时间
- \usebibmacro{doi+eprint+url}%
- \newunit
- \printfield{pagetotal}%
- \newunit\newblock
- \iftoggle{bbx:isbn}
- {\printfield{isrn}}
- {}%
- \newunit\newblock
-% \usebibmacro{doi+eprint+url}%
-% \newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-%
-% 备选类型驱动
-%
-% 利用biblatex的misc驱动
-\DeclareBibliographyDriver{misc}{%
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author/editor+others/translator+others}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
- \usebibmacro{title}%
-\iftoggle{bbx:gbstrict}{}{%
- \newunit
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}%
- \newunit\newblock
- \usebibmacro{byeditor+others}}%
- \newunit\newblock
- \printfield{howpublished}%
- \newunit\newblock
- \printfield{type}%
- \newunit
- \printfield{version}%
- \newunit
- \printfield{note}%
- \newunit\newblock
- \usebibmacro{institution+location+date}%
- %\usebibmacro{organization+location+date}%
- %\newunit\newblock
- \usebibmacro{doi+eprint+url}%
- \newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-
-
-
-
-%
-% 专著中的析出文献的格式修改
-%
-\DeclareBibliographyDriver{inbook}{%源来自standard.bbx
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author/translator+others}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
-\usebibmacro{title}%
-\usebibmacro{in:}%
-%\printtext{\texttt{//}\addthinspace}%
- \usebibmacro{bybookauthor}%
- \ifnameundef{bookauthor}{%
- \ifnameundef{editor}{}{\newunit}%
- }{\newunit}%替换下一句
- %\newunit\newblock
-\iffieldundef{series}{}{\usebibmacro{series+number}\setunit{\addcolon\addspace}}%为处理一些存在series的情况而增加
- \usebibmacro{maintitle+booktitle}%
-\iffieldundef{volume}{}{\setunit{\addcolon\addspace}\printfield{volume}}%
-\iffieldundef{number}{}{\setunit{\addcolon\addspace}\printfield{number}}%增加卷和册信息
- \newunit\newblock%
-% \usebibmacro{byeditor+others}%
-% \newunit\newblock
- \printfield{edition}%
- \newunit
- \iftoggle{bbx:gbstrict}{}{%
-% \iffieldundef{maintitle}
-% {\printfield{volume}%
-% \printfield{part}}
-% {}%
-% \newunit
-% \printfield{volumes}%
-% \newunit\newblock
-% \usebibmacro{series+number}
- }%
- \newunit\newblock
- %\printfield{note}%
- %\newunit\newblock
- \usebibmacro{publisher+location+date}%
- %\newunit\newblock
- \usebibmacro{chapter+pages}%
- %\newunit\newblock
- \usebibmacro{doi+eprint+url}%移到上面来
- \newunit\newblock
- \iftoggle{bbx:isbn}
- {\printfield{isbn}}
- {}%
- \newunit\newblock
-% \usebibmacro{doi+eprint+url}%
-% \newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
+%%
+%% ---------------------------------------------------------------
+%% biblatex-gb7714-2015 --- A biblatex implementation of the
+%% GBT7714-2015 bibliography style,author year sequence
+%% Maintained by huzhenzhen
+%% E-mail: hzzmail at 163.com
+%% Released under the LaTeX Project Public License v1.3c or later
+%% ---------------------------------------------------------------
+%%
+%
+% 版本和时间信息
+%
+\def\versionofgbtstyle{2021/01/19 v1.0w}
+\def\versionofbiblatex{\abx at version}
+\ProvidesFile{gb7714-2015ay.bbx}[\versionofgbtstyle biblatex bibliography style]
+%\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求
+
+%=====================================================================
+%加载标准样式
+%=====================================================================
+\RequireBibliographyStyle{authoryear}
+\RequirePackage{xstring}%解决texlive2015的biblatex3.0不加载xstring包的问题
+
+
+%=====================================================================
+% 功能函数
+%=====================================================================
+ %
+ % biblatex版本判断
+ % 20180405,v1.0k,为兼容biblatexv3.11增加toggle:iftlnine,HU zhenzhen
+ % 20181020,v1.0n,为不再使用xstring宏包做的修改,hzz
+ %
+ % 原理方法:当版本继续更新时,增加一个新的toggle用以处理新的旧版,最新版和未判断出来的版本永远用iftlatest
+ \providetoggle{iftlfive}\togglefalse{iftlfive} %处理biblatex3.2之前版本,时间2016-03-01前
+ \providetoggle{iftlsix}\togglefalse{iftlsix} %处理biblatex3.3开始改变姓名机制后版本,时间2016-03-01及以后
+ \providetoggle{iftlseven}\togglefalse{iftlseven}%处理biblatex3.7的兼容性,时间2016-12-01后
+ \providetoggle{iftleight}\togglefalse{iftleight}%处理biblatex3.8到3.9的兼容性,时间2017-11-01后到2017-12-01前
+ \providetoggle{iftlnine}\togglefalse{iftlnine} %处理biblatex10的兼容性,时间2017-12-01后
+ \providetoggle{iftlatest}\toggletrue{iftlatest} %假设是最新版biblatex
+ \@ifpackagelater{biblatex}{2014/04/01}{
+ \@ifpackagelater{biblatex}{2016/03/01}{
+ \@ifpackagelater{biblatex}{2016/12/01}{
+ \@ifpackagelater{biblatex}{2017/11/01}{
+ \@ifpackagelater{biblatex}{2017/12/01}{
+ \@ifpackagelater{biblatex}{2018/02/19}{}
+ {\toggletrue{iftlnine}\togglefalse{iftlatest}}}
+ {\toggletrue{iftleight}\togglefalse{iftlatest}}}
+ {\toggletrue{iftlseven}\togglefalse{iftlatest}}}
+ {\toggletrue{iftlsix}\togglefalse{iftlatest}}}
+ {\toggletrue{iftlfive}\togglefalse{iftlatest}}}
+ {\PackageError{biblatex}{Outdated 'biblatex' package}
+ {Please update biblatex, This is a fatal error.}}
+
+ \newcommand\defversion[2]{\csdef{codeversion#1#2}}%定义不同版本的命令
+ \newcommand\switchversion[2]{\csuse{codeversion#1#2}}%使用不同版本的命令
+
+ %
+ % 判断CJK字符的函数,用于判断作者等信息是否由中文字符构成
+ % v1.0k,20180509,hzz
+ %
+ % 原理方法:用biber中的perl方法代替。因为利用tex函数对字符判断时,当字符在宏
+ % 中时,基于`的方法无法解决GBK编码的问题,基于CJKsymbol的方法无法解决utf-8
+ % 编码用xelatex编译的问题。
+ %
+ % 原理是:利用perl正则将中文标识记录到域中,
+ % 然后利用\iffieldundef和\iffieldequalstr进行判断
+ \providetoggle{ifCJKforgbt}
+ \def\testCJKfirst#1{%
+ \iffieldundef{#1}{\togglefalse{ifCJKforgbt}}{%
+ \iffieldequalstr{#1}{chinese}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}}}
+
+ %
+ % 2个卷的解析函数,用于连续出版物
+ %
+ % 原理方法: 范围起止间隔符号还是用-,而不是与date相同的/,因为有合期期刊的问题,需要用到/符号
+ \newcommand{\multivolparser}[1]{%
+ \IfSubStr{#1}{-}%
+ {\StrBefore{#1}{-}[\multivolfirst]\StrBehind{#1}{-}[\multivolsecond]}%
+ {\def\multivolfirst{#1}\def\multivolsecond{}}%
+ }
+
+ %
+ % 2个期的解析函数,用于连续出版物
+ %
+ \newcommand{\multinumberparser}[1]{%
+ \IfSubStr{#1}{-}%
+ {\StrBefore{#1}{-}[\multinumberfirst]\StrBehind{#1}{-}[\multinumbersecond]}%
+ {\def\multinumberfirst{#1}\def\multinumbersecond{}}%
+ }
+
+ % 对没有分隔符环境命令的低版本biblatex做增补,避免报错
+ %
+ \iftoggle{iftlfive}{
+
+ \def\blx at inf@delimdeclare#1#2{%
+ \blx at info{Delimiter '#1' in context '#2' already defined, overwriting}}
+
+ \def\blx at warn@delimuse#1#2{%
+ \blx at warning{Delimiter '#1' in context '#2' undefined}}
+ % Delimiter interface
+
+ % [<contextname, ...>]{<name, ...>}{<code>}
+ \newrobustcmd*{\DeclareDelimFormat}{%
+ \@ifstar
+ {\blx at declaredelimclear}
+ {\blx at declaredelim}}
+
+ \newrobustcmd*{\blx at declaredelimclear}[3][]{%
+ \ifcsvoid{blx at declaredelimcontexts@#2}
+ {}
+ {\def\do##1{\csundef{blx at printdelim@##1@#2}}%
+ \dolistcsloop{blx at declaredelimcontexts@#2}}%
+ \cslet{blx at declaredelimcontexts@#2}\@empty
+ \ifblank{#1}
+ {\blx at declaredelim{#2}{#3}}
+ {\blx at declaredelim[#1]{#2}{#3}}}
+
+ \newrobustcmd*{\blx at declaredelim}[3][]{%
+ \ifblank{#1}
+ {\blx at declaredelim@i{}{}{#2}{#3}}
+ {\def\do##1{%
+ \listcsadd{blx at declaredelimcontexts@#2}{##1}%
+ \blx at declaredelim@i{blx at printdelim@##1@}{##1}{#2}{#3}}%
+ \docsvlist{#1}}}%
+
+ \def\blx at declaredelim@i#1#2#3#4{%
+ \def\do at i##1{%
+ \ifcsdef{#1##1}
+ {\blx at inf@delimdeclare{##1}{#2}}
+ {}%
+ \csdef{#1##1}{#4}}%
+ \forcsvlist{\do at i}{#3}}
+
+ % *[<contextname, ...>]{<alias>}{<delim>}
+ \newrobustcmd*{\DeclareDelimAlias}{%
+ \@ifstar
+ {\blx at declaredelimalias}
+ {\blx at declaredelimaliasauto}}
+
+ \newrobustcmd*{\blx at declaredelimalias}[3][]{%
+ \ifblank{#1}
+ {\blx at declaredelimalias@i{}{#2}{#3}}
+ {\def\do##1{%
+ \blx at declaredelimalias@i{blx at printdelim@##1@}{#2}{#3}}%
+ \docsvlist{#1}}}
+
+ \newrobustcmd*{\blx at declaredelimaliasauto}[2]{%
+ \blx at declaredelimalias@i{}{#1}{#2}%
+ \ifcsvoid{blx at declaredelimcontexts@#2}
+ {}
+ {\def\do##1{%
+ \blx at declaredelimalias@i{blx at printdelim@##1@}{#1}{#2}}%
+ \dolistcsloop{blx at declaredelimcontexts@#2}}}
+
+ \def\blx at declaredelimalias@i#1#2#3{%
+ \ifcsdef{#1#2}
+ {\blx at inf@delimdeclare{#2}{#1}}
+ {}%
+ \csdef{#1#2}{\csuse{#1#3}}}
+
+ \def\blx at delimcontext{none}
+ \newcommand*{\printdelim}[2][]{%
+ \ifblank{#1}
+ {\ifcsdef{blx at printdelim@\blx at delimcontext @#2}
+ {\csuse{blx at printdelim@\blx at delimcontext @#2}}
+ {\ifcsdef{#2}% fall back on legacy macros
+ {\csuse{#2}}
+ {\blx at warn@delimuse{#2}{*}}}}
+ {\ifcsdef{blx at printdelim@#1@#2}
+ {\csuse{blx at printdelim@#1@#2}}
+ {\blx at warn@delimuse{#2}{#1}}}}
+
+ \newcommand*{\delimcontext}[1]{%
+ \edef\blx at delimcontext{\blx at delimcontextalias{#1}}}
+
+ \def\blx at delimcontextalias#1{%
+ \ifcsdef{blx at delimcontextalias@#1}
+ {\csuse{blx at delimcontextalias@#1}}
+ {#1}}
+
+ \newcommand*{\DeclareDelimcontextAlias}[2]{%
+ \csgdef{blx at delimcontextalias@#1}{#2}}
+ }{}
+
+
+%=====================================================================
+% 数据模型定义
+%=====================================================================
+ %定义类型和载体标识,从gb内容看载体基本属于介质。
+ %为与lee zeping的bst的样式统一,使用mark和medium这两域名
+ %为单个条目的姓名格式控制增加nameformat和namefmtid两个域
+ %为缩略信息文献表增加了shortbooktitle域
+ %为多语言排序增加了lansortorder域
+ \DeclareDatamodelFields[type=field,datatype=literal]{mark,medium,nameformat}
+ \DeclareDatamodelFields[type=field,datatype=integer]{namefmtid}
+ \DeclareDatamodelFields[type=field,datatype=literal]{shortbooktitle}
+ \DeclareDatamodelFields[type=field,datatype=literal]{lansortorder}
+
+ %因为biblatex更新3.14版本以后,biber对于为声明数据模型的条目类型
+ %不再默认读取,而是以空字符串作为条目类型名,自然在条目定义alias时
+ %就会出现问题,因此显式的声明一下newspaper,然后保留后面采用alias的方式
+ %而standard类型则是采用另一种方式直接在sourcemap中转换为其它类型。
+ \@ifpackagelater{biblatex}{2019/11/30}{%2019/12/01 v3.14
+ \DeclareDatamodelEntrytypes{newspaper}%
+ }{}
+
+%=====================================================================
+% 设置宏包选项
+%=====================================================================
+ %
+ % 增加一个控制是否输出文献载体的选项
+ % 20191125,v1,0s,hzz
+ \newtoggle{bbx:gbmedium}
+ \DeclareBibliographyOption{gbmedium}[true]{%biblatex低版本
+ \settoggle{bbx:gbmedium}{#1}}
+ \ExecuteBibliographyOptions{gbmedium}
+
+ %
+ % 增加一个控制是否输出annotation域的选项,该域可以用于在文献条目后面输出一些注释信息
+ % 20190509,v1,0s,hzz
+ \newtoggle{bbx:gbannote}
+ \DeclareBibliographyOption{gbannote}[false]{%biblatex低版本
+ \settoggle{bbx:gbannote}{#1}}
+ \ExecuteBibliographyOptions{gbannote}
+ %
+ %用于在文献条目后面输出注释信息的宏
+ %FieldFormat{annotation}用于设置注释信息的格式
+ \DeclareFieldFormat{annotation}{%
+ \printtext{\addspace(#1)}%
+ }
+ \renewbibmacro*{annotation}{%
+ \iftoggle{bbx:gbannote}%
+ {\iffieldundef{annotation}%
+ {\printfile[annotation]{\bibannotationprefix\thefield{entrykey}.tex}}%
+ {\printfield{annotation}}}%
+ {}%
+ }
+
+
+ %
+ % 增加一个控制是否输出type域的选项
+ % 20190212,v1,0q,hzz
+ \newtoggle{bbx:gbfieldtype}
+ \DeclareBibliographyOption{gbfieldtype}[false]{%biblatex低版本
+ \settoggle{bbx:gbfieldtype}{#1}}
+ \ExecuteBibliographyOptions{gbfieldtype}
+
+ %
+ % 增加一个控制是否根据页码重设脚注数字标号的选项
+ % 20190422,v1,0r,hzz
+ \newtoggle{bbx:gbfnperpage}
+ \DeclareBibliographyOption{gbfnperpage}[false]{%
+ \settoggle{bbx:gbfnperpage}{#1}}
+ \ExecuteBibliographyOptions{gbfnperpage}
+
+ %
+ % 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表
+ % 20190203,v1.0p,hzz
+ % 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签
+ % 当前面的脚注中已经存在当前文献,那么当前文献内容不再输出而用同(4)这样的方式
+ % 需要注意的是由于小页环境和表格中的脚注本身的问题,可能会有一些问题
+ \DeclareBibliographyOption{gbfootbib}[false]{%
+ \ifstrequal{#1}{false}{}{\execgbfootbib}}
+ \ExecuteBibliographyOptions{gbfootbib}
+
+ %%
+ \newlength{\footbibmargin}
+ \newlength{\footbiblabelsep}
+ \setlength{\footbibmargin}{1em}%脚注的段落左侧缩进距离
+ \setlength{\footbiblabelsep}{0.5em}%脚注中标记号与脚注段落的间距
+ \def\execgbfootbib%
+ {%
+ %开启引用跟踪计数器,为使用\ifciteseen等测试命令
+ \ExecuteBibliographyOptions{citetracker=true}
+ %
+ %利用footmisc宏包来实现脚注文献的悬挂对齐
+ \AtEndPreamble{
+ \@ifclassloaded{beamer}{}{
+ %beamer类因为其特殊性,为避免冲突不调footmisc。
+ %同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接
+ %如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。
+ %\PassOptionsToPackage{perpage,hang}{footmisc}%
+ %\RequirePackage{footmisc}%
+
+ %重新实现脚注的根据单页重设脚注号码
+ %重新实现脚注的悬挂对齐问题,不再使用footmisc,直接从latex核心代码和hyperref代码进行修改
+ %v1.0q 20190317 hzz
+ %v1.0r 20190422 hzz 根据gbfnperpage选项设置
+ \iftoggle{bbx:gbfnperpage}%
+ {\@addtoreset{footnote}{page}}{}%重设计数器
+
+\@ifpackageloaded{hyperref}{%加载hyperref则对\H@@footnotetext做重定义
+ \long\def\H@@footnotetext##1{\insert\footins{%
+ \reset at font\footnotesize
+ \interlinepenalty\interfootnotelinepenalty
+ \splittopskip\footnotesep
+ \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
+ \hsize\columnwidth \@parboxrestore
+ \protected at edef\@currentlabel{%
+ \csname p at footnote\endcsname\@thefnmark
+ }%
+ \color at begingroup
+ \leftskip \footbibmargin%增加的左侧缩进
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox%
+ }%
+ \color at endgroup}}%
+ \long\def\H@@mpfootnotetext##1{%
+ \global\setbox\@mpfootins\vbox{%
+ \unvbox\@mpfootins
+ \reset at font\footnotesize
+ \hsize\columnwidth
+ \@parboxrestore
+ \protected at edef\@currentlabel
+ {\csname p at mpfootnote\endcsname\@thefnmark}%
+ \leftskip \footbibmargin%增加的左侧缩进
+ \color at begingroup
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}%
+ \color at endgroup}}
+ }{%否则对latex核心代码中的\@footnotetext做重定义
+ \long\def\@footnotetext##1{\insert\footins{%
+ \reset at font\footnotesize
+ \interlinepenalty\interfootnotelinepenalty
+ \splittopskip\footnotesep
+ \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
+ \hsize\columnwidth \@parboxrestore
+ \protected at edef\@currentlabel{%
+ \csname p at footnote\endcsname\@thefnmark
+ }%
+ \color at begingroup
+ \leftskip \footbibmargin%增加的左侧缩进
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox%
+ }%
+ \color at endgroup}}%
+
+ \long\def\@mpfootnotetext##1{%
+ \global\setbox\@mpfootins\vbox{%
+ \unvbox\@mpfootins
+ \reset at font\footnotesize
+ \hsize\columnwidth
+ \@parboxrestore
+ \protected at edef\@currentlabel
+ {\csname p at mpfootnote\endcsname\@thefnmark}%
+ \leftskip \footbibmargin%增加的左侧缩进
+ \color at begingroup
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}%
+ \color at endgroup}}
+ }
+
+ \long\def\@makefntext##1{%增加了脚注标记与正文的间隔
+ \parindent 1em\noindent \hb at xt@ 0em{\hss \@makefnmark\makebox[\footbiblabelsep]{}}##1}
+
+ }
+
+ %
+ %使脚注标记加圈并设置数字的字体为tiny,不使用修改thefootnote的方式
+ \def\@makefnmark{\hbox{\@textsuperscript{\textcircled{\tiny\@thefnmark}}}}
+ %做patch使得脚注内容中的脚注数字标签不上标
+ \pretocmd{\@makefntext}{%
+ \def\@makefnmark{%
+ \hbox{\textcircled{\tiny\@thefnmark}}%
+ }%
+ }{}{}
+ }
+
+ %
+ %判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容)
+ %记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。
+ %v1.0q 20190309 区分使脚注标注适应minipage中的情况
+ \newbibmacro*{citesavefn}{%
+ \ifciteseen%当被引用过为true
+ {\ifcsdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%当已经定义过脚注序号信息
+ {\csgdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{%
+ \str at sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}%
+ \@makefnmark%
+ }}%
+ {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{%
+ \ifcsstring{@mpfn}{mpfootnote}{\@alph\c at mpfootnote}{\thefootnote}%
+ }}%
+ }%
+ {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{%
+ \ifcsstring{@mpfn}{mpfootnote}{\@alph\c at mpfootnote}{\thefootnote}%
+ %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断
+ }}%
+ }
+
+ %
+ %重定义\footfullcite使完成gb7714-2015的脚注文献要求
+ \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]%
+ {\defcounter{maxnames}{\blx at maxbibnames}%局部定义maxnames和minnames计数器
+ \defcounter{minnames}{\blx at minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。
+ \usebibmacro{prenote}%
+ \renewbibmacro*{postnote}{%
+ \iffieldundef{postnote}%
+ {}{\setunit{\addcolon\addspace}\printtext{\thefield{postnote}}}}%由于ay样式中没有修改postnote域,此处因为格式需要不使用默认域格式
+ }%
+ {\usebibmacro{citesavefn}%
+ \ifcsdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%
+ {\csuse{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}\nopunct}%
+ {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}%
+ }%
+ {\multicitedelim}%
+ {\usebibmacro{postnote}}
+
+ }
+
+ %
+ % 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式
+ % 20180814,v1.0m,hzz
+ % 原理方法:
+ % 只为兼容性考虑不做任何处理
+ \DeclareBibliographyOption{gbstyle}[true]{%biblatex低版本
+ }
+
+ %
+ % 增加一个控制是否输出文献类型和载体标识的选项
+ %
+ % 原理方法:
+ % 对于biblatex3.4以上版本DeclareBibliographyOption命令中的[datatype]如果是boolean,那么是可以省略的
+ % 所以用老版本的不用[datatype]的命令可以兼容所有biblatex版本
+ \newtoggle{bbx:gbtype}
+ %\DeclareBibliographyOption[boolean]{gbtype}[true]{%biblatex高版本
+ \DeclareBibliographyOption{gbtype}[true]{%biblatex低版本
+ \settoggle{bbx:gbtype}{#1}}
+ \ExecuteBibliographyOptions{gbtype}
+
+ %
+ % 增加一个源文件编码选择选项,当true时可以使用GBK编码。
+ % v1.0k, 2018.05.08, by hzz
+ %
+ % 原理方法:将需要输出的中文字符串用命令形式表示存储,采用utf8编码时采用bbx文档
+ % 内的定义即是utf8编码的中文字符串,但tex源文件是gbk编码时,利用gb7714-2015-gbk.def
+ % 文档内的gbk编码的字符串覆盖。这种覆盖只能在宏包末尾加载时成功实现,所以使用
+ % AtEndOfPackage。该解决思路源自biblatex-caspervector宏包。
+ % 另外注意:
+ % gbk编码的tex文档,利用pdflatex/latex能正确编译,利用xelatex能编译,但中文显示乱码
+ % 在源文档前面增加 XeTeX 原语:\XeTeXinputencoding "GBK" 后,显示正常
+ % utf-8编码的tex文档,利用xelatex能正确编译,而pdflatex/latex不能编译。
+ \newtoggle{bbx:codegbk}
+ \DeclareBibliographyOption{gbcodegbk}[false]{%
+ \settoggle{bbx:codegbk}{#1}}
+ \ExecuteBibliographyOptions{gbcodegbk}
+
+ \def\str at bibliography{参考文献}
+ \def\str at references{参考文献}
+ \def\str at bytranslator{译}
+ \def\str at andotherscn{等}
+ \def\str at andcn{和}
+ \def\str at backrefpage{引用页}
+ \def\str at backrefpages{引用页}
+ \def\str at noaddress{出版地不详}
+ \def\str at nopublisher{出版者不详}
+ \def\str at edition{版}
+ \def\str at volumecn{卷}
+ \def\str at numbercn{册}
+ \def\str at serialcn{第}
+ \def\str at sameentry{同}
+ \def\str at incn{见}
+ \def\str at mathesiscn{硕士学位论文}
+ \def\str at phdthesiscn{博士学位论文}
+ \def\str at editorcn{主编}
+
+ \AtEndOfPackage{%
+ \iftoggle{bbx:codegbk}{%
+ \ExecuteBibliographyOptions{texencoding = GBK}
+ \input{gb7714-2015-gbk.def}
+ }{}}
+
+ %
+ % 增加一个严格按GB/T 7714-2015给出著录格式控制域的输出的选项
+ % v1.0k, 2018.05.08, by hzz
+ %
+ % 原理方法:
+ % 默认设置该选项为真,进而不输出GB/T 7714-2015中没有的域的信息
+ % 这样可以避免因为bib文件带有多余的域的信息的输出,比如因为bibtex样式
+ % 可能需要用于中英文判断的language域的信息。
+ \newtoggle{bbx:gbstrict}
+ \DeclareBibliographyOption{gbstrict}[true]{%
+ \settoggle{bbx:gbstrict}{#1}}
+ \ExecuteBibliographyOptions{gbstrict}
+
+ %
+ % 增加一个控制标题域超链接设置的选项
+ % v1.0k, 2018.05.24, by hzz
+ %
+ % 原理方法:
+ % 利用标题域格式来实现,默认设置该选项为false,不做超链接。
+ % 设置为true,则标题设置超链接
+ \newtoggle{bbx:titlelink}
+ \DeclareBibliographyOption{gbtitlelink}[false]{%
+ \settoggle{bbx:titlelink}{#1}}
+ \ExecuteBibliographyOptions{gbtitlelink}
+
+ %
+ % 增加一个控制参考文献标题是否能够被ctex宏包设置的选项
+ % v1.0l, 2018.07.02, by hzz
+ %
+ % 原理方法:
+ % 重定义biblatex的宏,去除使用本地化字符串的方式,是的可以利用ctexset进行设置
+ \newtoggle{bbx:ctexset}
+ \DeclareBibliographyOption{gbctexset}[true]{%
+ \settoggle{bbx:ctexset}{#1}}
+ \ExecuteBibliographyOptions{gbctexset}
+
+ \AtEndOfPackage{%
+ \iftoggle{bbx:ctexset}{%
+ \def\blx at defbibstrings#1#2{%
+ \def\do##1{\csundef{abx at lstr@##1}\csundef{abx at sstr@##1}}%
+ \abx at dostrings
+ \csuse{abx at strings@#1}%
+ \setkeys{blx at lbx}{#2}%
+ \let\do\blx at defbibstrings@i
+ \csxdef{abx at strings@#1}{\abx at dostrings}%
+ }
+ }{}}
+
+ %
+ %增加一个处理佚名或noauthor的控制选项
+ \DeclareBibliographyOption{gbnoauthor}[true]{%
+ \ifstrequal{#1}{false}{}{\dealnoathor}}
+ %\ExecuteBibliographyOptions{gbnoauthor=true}%对于需要展开较早(展开层级优先)的选项,这一执行无效,只能用宏包加载时给出的选项。
+
+
+ %
+ % 增加一个恢复域格式为标准样式的控制选项
+ % v1.0k, 2018.05.15, by hzz
+ %
+ % 原理方法:
+ % 默认设置该选项为false,采用国标要求的域格式输出相关域
+ % 当设置该选项为true时,则重新利用标准样式的域格式输出相关的域
+ \newtoggle{bbx:gbfieldstd}
+ \DeclareBibliographyOption{gbfieldstd}[false]{%
+ \settoggle{bbx:gbfieldstd}{#1}%
+ \ifstrequal{#1}{false}{}{\execgbfdfmtstd}%
+ }
+ \ExecuteBibliographyOptions{gbfieldstd}
+
+ %
+ % 增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。
+ %
+ \newtoggle{bbx:gbpub}
+ \DeclareBibliographyOption{gbpub}[true]{%
+ %\settoggle{bbx:gbpub}{#1} %或采用下面这一句
+ \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}}
+ \ExecuteBibliographyOptions{gbpub}
+
+ %
+ % 增加控制析出文献来源前的标点符号//输出的选项
+ % v1.0k, 2018.04.20,added in by hzz
+ \newtoggle{bbx:gbpunctin}
+ \DeclareBibliographyOption{gbpunctin}[true]{%
+ \settoggle{bbx:gbpunctin}{#1}}
+ \ExecuteBibliographyOptions{gbpunctin}
+
+
+ % 选项设置
+ %
+ \ExecuteBibliographyOptions{
+ useprefix = true, %名字的信息包括前缀
+ date = year, %日期仅写到年
+ maxbibnames=3, %将文献列表和引用中最大名字数量区分开
+ minbibnames=3,
+ maxitems = 1,%设置列表最大数量
+ minitems = 1, %设置缩减后的列表最小数量
+ isbn=false,
+ sorting=gb7714-2015,
+ sortlocale=zh__pinyin,%zh__big5han,%zh__stroke,%zh__gb2312han,%zh__pinyin,
+ }
+
+ %
+ %为日期相关选项增加选项值gb7714-2015
+ %
+ \csdef{mkdaterangegb7714-2015}#1{%
+ \begingroup
+ \blx at metadateinfo{#1}%
+ \iffieldundef{#1year}
+ {}
+ {\printtext[#1date]{%
+ \blx at gbdate{#1}{}}}%
+ \endgroup}
+
+ \newrobustcmd*{\blx at gbdate}[3][]{%
+ \dateeraprintpre{#2#3year}%
+ \blx at imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}%
+ \iffieldundef{#2#3month}{}{\hyphen\blx at imc@forcezerosmdt{\thefield{#2#3month}}}%
+ \iffieldundef{#2#3day}{}{\hyphen\blx at imc@forcezerosmdt{\thefield{#2#3day}}}}
+
+ %为姓名格式选择增加的计数器
+ \newcounter{gbnamefmtcase}
+ \def\thegbnamefmtcase{\the\c at gbnamefmtcase}
+ %为引用标签标注/文献表中本地化字符串中英文选择增加的计数器/命令
+ \newcounter{gbcitelocalcase}
+ \newcounter{gbbiblocalcase}
+ \def\thegbcitelocalcase{\the\c at gbcitelocalcase}
+ \def\thegbbiblocalcase{\the\c at gbbiblocalcase}
+
+
+\@ifpackagelater{biblatex}{2016/03/27}
+ { % 针对biblatex>=3.3版本的选项设置
+
+ % 增加不同语言排序的切换选项
+ % gblanorder=chineseahead的顺序为cn,jp,kr,en,fr,ru
+ % gblanorder=englishahead的顺序为en,fr,ru,cn,jp,kr
+ % gblanorder=cn;en;ru;fr;jp;kr的顺序为指定的cn;en;ru;fr;jp;kr,自定义内容可以随意写以分号分隔
+ % v1.0q,20190307,hzz
+ %
+ \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{%
+ \ifstrequal{#1}{chineseahead}%%中文在前的顺序
+ {\gdef\lancnorder{1}\gdef\lanjporder{2}\gdef\lankrorder{3}%
+ \gdef\lanenorder{4}\gdef\lanfrorder{5}\gdef\lanruorder{6}}%
+ {%
+ \ifstrequal{#1}{englishahead}%
+ {\execlanodeah\dealsortlan}%
+ {\execlanodudf{#1}\dealsortlan}%
+ }%
+ }
+ \ExecuteBibliographyOptions{gblanorder}
+
+ \def\execlanodeah{%中文在后的顺序
+ \gdef\lancnorder{4}
+ \gdef\lanjporder{5}
+ \gdef\lankrorder{6}
+ \gdef\lanenorder{1}
+ \gdef\lanfrorder{2}
+ \gdef\lanruorder{3}}
+
+ \newcounter{lanordernum}
+ \newcommand{\execlanodudf}[1]{%like:cn;en;ru;fr;jp;kr
+ \setcounter{lanordernum}{0}
+ \DeclareListParser{\parsinglanorder}{;}
+ \renewcommand*{\do}[1]{\stepcounter{lanordernum}\csxdef{lan##1order}{\thelanordernum}}
+ \parsinglanorder{#1}
+ }
+
+ % 增加本地化字符串的中英文切换选项
+ % gbcitelocal指标注中的本地化字符串
+ % gbbiblocal 指文献表中的本地化字符串
+ % gblocal 指设置文献表和标注中的本地化字符串
+ % v1.0o,20190103,hzz
+ %
+ \DeclareBibliographyOption[string]{gbcitelocal}[gb7714-2015]{%
+ \ifstrequal{#1}{gb7714-2015}{\setcounter{gbcitelocalcase}{0}}{}%
+ \ifstrequal{#1}{chinese}{\setcounter{gbcitelocalcase}{1}}{}%
+ \ifstrequal{#1}{english}{\setcounter{gbcitelocalcase}{2}}{}%
+ }
+ \ExecuteBibliographyOptions{gbcitelocal}
+
+ \DeclareBibliographyOption[string]{gbbiblocal}[gb7714-2015]{%
+ \ifstrequal{#1}{gb7714-2015}{\setcounter{gbbiblocalcase}{0}}{}%
+ \ifstrequal{#1}{chinese}{\setcounter{gbbiblocalcase}{1}}{}%
+ \ifstrequal{#1}{english}{\setcounter{gbbiblocalcase}{2}}{}%
+ }
+ \ExecuteBibliographyOptions{gbbiblocal}
+
+ \DeclareBibliographyOption[string]{gblocal}[gb7714-2015]{%
+ \ExecuteBibliographyOptions{gbbiblocal=#1}%
+ \ExecuteBibliographyOptions{gbcitelocal=#1}%
+ }
+ %\ExecuteBibliographyOptions{gblocal} %默认值已经通过两个相关选项设置
+
+
+ %
+ % 增加序号标签格式处理选项,作者年制不做处理,给出只为兼容选项考虑
+ % v1.0l,20180623,hzz
+ %
+ \DeclareBibliographyOption[string]{gbbiblabel}[bracket]{}
+
+ %
+ % 增加姓名大小写格式处理选项
+ %
+ \DeclareBibliographyOption[string]{gbnamefmt}[uppercase]{%
+ \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}%
+ \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}%
+ \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family
+ \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{}%family-given
+ \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%
+ \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family
+ }
+ \ExecuteBibliographyOptions{gbnamefmt}
+
+ %
+ % 增加标签对齐选项
+ %
+ %因为在作者年制中,不需要使用,这里也增加,为了与顺序编码制的兼容性考虑。
+ \DeclareBibliographyOption[string]{gbalign}[right]{}%
+
+
+
+
+ }
+ {
+ % 增加不同语言排序的切换选项
+ % biblatex 3.4及以下版本不能使用多个stylesourcemap,所以不使用该选项
+ % 这里给出仅为兼容性考虑
+ % v1.0q,20190307,hzz
+ %
+ \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{}
+
+ %
+ % 增加序号标签格式处理选项,作者年制不做处理,给出只为兼容选项考虑
+ % v1.0l,20180623,hzz
+ %
+ \DeclareBibliographyOption{gbbiblabel}[bracket]{}
+
+ %
+ % 增加姓名大小写格式处理选项
+ %
+ \DeclareBibliographyOption{gbnamefmt}[uppercase]{%
+ \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}%
+ \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}%
+ \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family
+ \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{}
+ \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given
+ \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family
+ }
+ \ExecuteBibliographyOptions{gbnamefmt}
+
+ %
+ % 增加标签对齐选项
+ %
+ %因为在作者年制中,不需要使用,这里也增加,为了与顺序年制的兼容性考虑。
+ \DeclareBibliographyOption{gbalign}[right]{}%
+
+ }
+
+
+%
+% 针对biblatex<3.3版本的选项设置,比如texlive2015中的3.0版
+%
+\defversion{3.0}{opt}{
+ \ExecuteBibliographyOptions{
+ firstinits = true, %名字有缩写,参考3.1.2.3 Internal
+ }
+}
+%
+% 针对3.3<=biblatex<3.5版本的选项设置,比如texlive2016中的3.4版
+%
+\defversion{3.4}{opt}{
+ \ExecuteBibliographyOptions{
+ giveninits = true,
+ }
+}
+%
+% 针对3.7<=biblatex<=3.9版本的选项设置,比如texlive2017中的3.7版
+%
+\defversion{3.7}{opt}{
+ \ExecuteBibliographyOptions{
+ giveninits = true,
+ urldate =edtf,
+ eventdate =edtf,
+ }
+}
+%
+% 针对3.10<=biblatex版本的选项设置,比如texlive2018中的3.11版
+%
+\defversion{3.10}{opt}{
+ \ExecuteBibliographyOptions{
+ giveninits = true,
+ urldate =gb7714-2015,%iso
+ eventdate =gb7714-2015,%iso
+ }
+}
+
+%
+% 针对3.13<=biblatex版本的选项设置,因为内容有限,所以不再增加版本区分,而用时间直接判断
+%
+% 解决国标中“王临慧, 2010a.”和“王临慧, 等, 2010b.”的问题
+% 在没有这个选项之前无法加上a和b
+% v1.0s,20190828
+\@ifpackagelater{biblatex}{2019/08/16}{%
+ \ExecuteBibliographyOptions{%
+ nohashothers=true}}{}
+
+%
+% 根据biblatex版本信息,选择选项设置
+%
+% 原理方法:如下这种选择机制能自动兼容更新的版本,但对于老版本
+% 必须要把情况列全。
+\iftoggle{iftlfive}{\switchversion{3.0}{opt}}{}%biblatex<=3.2
+\iftoggle{iftlsix}{\switchversion{3.4}{opt}}{}%3.3<=biblatex<=3.6
+\iftoggle{iftlseven}{\switchversion{3.7}{opt}}{}%biblatex=3.7
+\iftoggle{iftleight}{\switchversion{3.7}{opt}}{}%3.8<=biblatex<=3.9
+\iftoggle{iftlnine}{\switchversion{3.10}{opt}}{}%biblatex=3.10
+\iftoggle{iftlatest}{\switchversion{3.10}{opt}}{}%biblatex最新3.11
+
+
+%=====================================================================
+%设置本地化字符串
+%=====================================================================
+ %
+ % 新建当地化字符串,用来记录“等”字符、“和”字符
+ %
+ \NewBibliographyString{andotherscn}
+ \NewBibliographyString{andothersincitecn}
+ \NewBibliographyString{andothersincite}
+ \NewBibliographyString{andcn}
+ \NewBibliographyString{andothersjp}
+ \NewBibliographyString{andotherskr}
+ \NewBibliographyString{andjp}
+ \NewBibliographyString{andkr}
+ \NewBibliographyString{andincitecn}
+ \NewBibliographyString{andincite}
+ \NewBibliographyString{volumecn}
+ \NewBibliographyString{numbercn}
+ \NewBibliographyString{serialcn}
+ \NewBibliographyString{incn}
+ \NewBibliographyString{mathesiscn}
+ \NewBibliographyString{phdthesiscn}
+ \NewBibliographyString{editorcn}
+ \NewBibliographyString{editorscn}
+
+ %
+ % 修改一些当地化字符串
+ %
+ % 原理方法:直接利用当地化格式english修改出一些中文的格式,具体修改内容参考english.lbx文件
+ % 当然也可以增加比如上面定义的andotherscn
+ % 注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别
+ \DefineBibliographyStrings{english}{
+ bibliography = {\str at bibliography},
+ references = {\str at references},
+ bytranslator= {\str at bytranslator\adddot}, %将trans. by 改成 译
+ and = {\addcomma},%将第2和3人名见的and符号改成 逗号,用\finalnamedelim命令也可以定义,参见3.9.1节
+ andcn = {\addcomma},%\str at andcn\ and本地化字符串的中文对应词
+ andincitecn = {\str at andcn},%将标注中的分开,便于与文献表中的区分
+ andincite = {\addcomma},
+ %andothers = {et al.}, %将超过3个人名的省略,et al.改成为 等
+ andotherscn = {\str at andotherscn},%将超过3个人名的省略,et al.改成为 等
+ andothersincitecn={\str at andotherscn},%将标注中的分开,便于与文献表中的区分
+ andothersincite={et al\adddot},
+ backrefpage = {\str at backrefpage:},
+ backrefpages = {\str at backrefpages:},
+ in={in\intitlepunct},
+ volumecn={\str at volumecn},
+ numbercn={\str at numbercn},
+ serialcn={\str at serialcn},
+ andothersjp={他},
+ andotherskr={외},
+ andjp={和},
+ andkr={和},
+ incn={\str at incn\addcolon\addspace},
+ mathesiscn={\str at mathesiscn},
+ phdthesiscn={\str at phdthesiscn},
+ editorscn={\str at editorcn},
+ editorcn={\str at editorcn},
+ }
+
+ %
+ % 增加两个命令用于临时的局部的修改本地化字符串
+ % 其中\setlocalbibstring修改缩写字符串,setlocalbiblstring修改长字符串
+ % 注意使用时因为是局部修改,因此要将其与需要修改的引用命令放在一个编组符号内
+ % v1.0t,hzz,20190525
+ \newcommand{\setlocalbibstring}[2]{%
+ \csdef{abx at sstr@#1}{#2}}
+ \newcommand{\setlocalbiblstring}[2]{%
+ \csdef{abx at lstr@#1}{#2}}
+
+%=====================================================================
+% 动态数据修改
+%=====================================================================
+%
+% 各层次的数据映射和动态修改
+%
+% 原理方法:
+% 1. 进行语言包括中英文判断,并设置和记录,比如记录到userf,usere中
+% 2. 增加文献标识符如[M],[J]等,对一些容易混淆的域进行设置以增强兼容性
+% 3. \DeclareSourcemap命令对于biblatex3.11以下版本只能出现一次,3.11版开始支持多个
+% 4. \DeclarestyleSourcemap在biblatex v3.7版开始可以支持出现多次
+% 5. 把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。
+% 注意:这里用userf,usere而不是namee,namef,是因为只有把name列表转成域,才能有效读取姓名中的字符,
+% 如果用namee,namef,name信息会自动解析,所以就不能为cjk判断提供需要的信息
+%
+% 不同的文献类型使用相同的驱动输出可以有5种方法:
+% 1. 是数据源层的映射,将其它类型转换为某一要使用驱动的类型
+% 2. 是样式层映射,也是将其它类型转换为某一要使用驱动的类型
+% 3. 是驱动层映射,也是将其它类型转换为某一要使用驱动的类型
+% 4. 定义驱动类型别名DeclareBibliographyAlias,将其它类型定义为某一要使用驱动的类型的别名
+% 驱动别名定义本质上是做了驱动层映射
+% 5. 直接定义不同的类型的驱动,但驱动内容相同。
+%
+% 关于数据映射和驱动使用的考虑如下:
+% 1. 为避免利用biber输出bib文件时的数据变动,尽量不在数据源层映射做类型转换
+% 2. 为减少代码量,尽量少做内容相同的不同类型驱动
+% 3. 因此类型相关的处理主要在样式层映射、驱动层映射、驱动别名
+% 4. 由于biblatex默认做的驱动别名处理可能增加一些信息比如masterthesis转thesis时增加的type
+% 可以在样式层映射做某些需要避免这种默认处置的转换
+% 5. 当没有避免默认行为的需求时,全部采用驱动别名的方式处理,等价于驱动层的映射
+%
+% 文献类型和驱动考虑如下:
+% 1. 连续出版物及析出文献有其特殊性,因此考虑两类periodical和article
+% newpaper映射为article,并以note域做区分特殊处理
+% 2. 专著和专著中的析出文献是主要的类型,因此考虑book和inbook
+% standard映射为book或inbook,并以note域做区分特殊处理
+% collection和proceedings基本与book类似,因此做book驱动别名处理
+% incollection和inproceedings基本与inbook类似,因此做inbook驱动别名处理
+% 3. 专利类型有其特殊性,考虑patent类型
+% 4. 电子资源类型有其特殊性,考虑online类型
+% 5. 报告类型与book有点类似,出版项处理与book一样,但有时又要有修改和更新日期
+% 因此考虑用一种类型来输出,使用report类型
+% 6. 手册/学位论文等类型与book有点类似,但对于出版项处理时,有缺省时,直接省略,
+% 同时有version和edition的区别,因此考虑用一种类型来输出,使用manual类型
+% 7. 包括报告,学位论文在内的其它所有的类型,都做一个判断,当没有出版项时,
+% 且存在网址信息时,将其转换为online类型输出,否则都做为manual类型输出。
+% 8. 备选类型misc当存在网址时直接转换为online,由于howpublished域可用于描述
+% 更多的信息,因此不存在网址时,独立做一个备选格式
+% 9. 出版项主要以如下方式处理:
+% (a) location+institution+date 仅用于连续出版物
+% (b)publisher+location+date 用于需要完整输出出版项的类型,比如book,collection,proceedings,in*,report
+% (c)institution+location+date 用于出版项缺失时不输出的类型,包括manual,thesis,archive等其他类型
+% (d)printlist{insitution} 用于电子资源,仅输出出版者或组织,为数据映射方便,本来默认的organization域转换为用insitution输出。
+% (e) 不输出,主要用于连续出版物析出的文献
+% 10. 日期以如下方式处理:
+% date 由于存在biblatex选项,因此通过选项控制,数据源为date解析数据或year
+% urldate 由于存在biblatex选项,因此通过选项控制,输出到日,且用[]包围,数据源为urldate
+% newsdate 用于公告日期,公开日期或新闻日期,输出到日,但无包围符号,数据源为date
+% modifydate 用于更新或修改日期,输出到日,且用()包围,数据源为date或enddate或eventdate
+
+\DeclareSourcemap{
+\maps[datatype=bibtex]{%
+ \map{%当没有作者时将editor转成author
+ \pernottype{inbook}%因为in系列中editor可能用来表示bookauthor,所以排除
+ \pernottype{inproceedings}
+ \pernottype{incollection}
+ \pernottype{periodical}%因为peridical直接使用editor,所以排除
+ %注意notfield在低版本biblatex中没有
+ %\step[notfield=author,final]%当author不存在,将editor复制给author
+ \step[fieldsource=editor,fieldtarget=author]%并删除editor
+ }
+ \map{%当没有作者时将translator转成author
+ \pernottype{inbook}
+ \pernottype{inproceedings}
+ \pernottype{incollection}
+ %\step[notfield=author,final]%当author不存在,将translator复制给author
+ \step[fieldsource=translator,fieldtarget=author]%并删除translator
+ }
+ \map{%让address和location同步,biblatex中address是location的别名
+ %因此输出的时候只有location信息,但处理过程中是可以存在address的。
+ %\step[notfield=address,final]
+ \step[fieldsource=location,final]
+ \step[fieldset=address,origfieldval]
+ }
+ \map{%让address和location同步
+ %\step[notfield=location,final]
+ \step[fieldsource=address,final]
+ \step[fieldset=location,origfieldval]
+ }
+ \map{%处理在bib文件用mark标记文献类型标识符的情况
+ \step[fieldsource=mark,final]
+ \step[fieldset=usera, origfieldval]
+ }
+ \map{%处理在bib文件中直接给出文献的姓名格式为lowercase的情况
+ \step[fieldsource=nameformat,match=lowercase,final]
+ \step[fieldset=namefmtid,fieldvalue={1}]
+ }
+ \map{%处理在bib文件中直接给出文献的姓名格式为givenahead的情况
+ \step[fieldsource=nameformat,match=givenahead,final]
+ \step[fieldset=namefmtid,fieldvalue={2}]
+ }
+ \map{%处理在bib文件中直接给出文献的姓名格式为familyahead的情况
+ \step[fieldsource=nameformat,match=familyahead,final]
+ \step[fieldset=namefmtid,fieldvalue={3}]
+ }
+ \map{%处理在bib文件中直接给出文献的姓名格式为pinyin的情况
+ \step[fieldsource=nameformat,match=pinyin,final]
+ \step[fieldset=namefmtid,fieldvalue={4}]
+ }
+ \map{%根据article确定文献类型标识符
+ \pertype{article}
+ \step[fieldset=usera, fieldvalue={J}]
+ }
+ \map{%根据periodical确定文献类型标识符
+ \pertype{periodical}
+ \step[fieldset=usera, fieldvalue={J}]
+ \step[fieldsource=author] %有时会把author和editor混淆,处理后使用editor
+ \step[fieldset=editor, origfieldval]
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{%根据增加一个新闻报纸的类型newspaper确定文献类型标识符
+ \pertype{newspaper}
+ \step[fieldset=usera, fieldvalue={N}]
+ \step[fieldset=note, fieldvalue=news]%因为没有专门的驱动,记录note方便映射为article后判断
+ }
+ \map{%对应增加的一个数据库类型database确定文献类型标识符
+ \pertype{database}
+ \step[fieldset=usera, fieldvalue={DB}]
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{%对应增加的一个数据集类型dataset确定文献类型标识符
+ \pertype{dataset}
+ \step[fieldset=usera, fieldvalue={DS}]%
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{%对应增加的一个软件类型software确定文献类型标识符
+ \pertype{software}
+ \step[fieldset=usera, fieldvalue={CP}]
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{%对应增加的一个舆图类型map确定文献类型标识符
+ \pertype{map}
+ \step[fieldset=usera, fieldvalue={CM}]%
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{%对应增加的一个档案类型archive确定文献类型标识符
+ \pertype{archive}
+ \step[fieldset=usera, fieldvalue={A}]
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{%因为misc类型本身就是没有类型,而不像其它文献有明确的类型,所以
+ %当misc类型带有网址时,直接将其转换为online类型
+ \pertype{misc}
+ \step[fieldsource=url,final]
+ \step[typesource=misc,typetarget=online]
+ }
+ \map{%对应增加的一个备选类型misc确定文献类型标识符
+ \pertype{misc}
+ \step[fieldset=usera, fieldvalue={Z}]%
+ }
+ \map{
+ \pertype{book}
+ \pertype{inbook}
+ \step[fieldset=usera, fieldvalue={M}]
+ \step[fieldsource=version] %有时会把version和edition混淆,处理后直接用edition
+ \step[fieldset=edition, origfieldval]
+ }
+ \map{%兼容老的standard类型,确定文献类型标识符
+ \pertype{standard}
+ \step[fieldset=usera, fieldvalue={S}]
+ \step[fieldset=note, fieldvalue=standard]%因为没有专门的驱动,记录note方便映射为book和inbook后判断
+ }
+ \map{
+ \pertype{patent}
+ \step[fieldset=usera, fieldvalue={P}]
+ }
+ \map{
+ \pertype{inproceedings}
+ \pertype{conference}%兼容老的conference类型
+ \step[fieldset=usera, fieldvalue={C}]
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
+ \step[fieldset=publisher, origfieldval]
+ }
+ \map{
+ \pertype{proceedings}
+ \step[fieldset=usera, fieldvalue={C}]
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
+ \step[fieldset=publisher, origfieldval]
+ }
+ \map{
+ \pertype{incollection}
+ \step[fieldset=usera, fieldvalue={G}]
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
+ \step[fieldset=publisher, origfieldval]
+ }
+ \map{
+ \pertype{collection}
+ \step[fieldset=usera, fieldvalue={G}]
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
+ \step[fieldset=publisher, origfieldval]
+ }
+ \map{
+ \pertype{report}
+ \pertype{techreport}%兼容老的techreport类型
+ \step[fieldset=usera, fieldvalue={R}]
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
+ \step[fieldset=publisher, origfieldval]
+ }
+ \map{
+ \pertype{thesis}
+ \pertype{mastersthesis}%兼容老的mastersthesis和phdthesis类型
+ \pertype{phdthesis}
+ \step[fieldset=usera, fieldvalue={D}]
+ \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{
+ \pertype{online}
+ \pertype{electronic}%兼容老的electronic类型
+ \pertype{www}%兼容老的www类型
+ \step[fieldset=usera, fieldvalue={EB}]
+ \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]%因为online的出版项处理类似手册
+ \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{
+ \pertype{manual}
+ \step[fieldset=usera, fieldvalue={A}]
+ \step[fieldsource=edition]%有时会把version和edition混淆,处理后使用version
+ \step[fieldset=version, origfieldval]
+ \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{
+ \pertype{unpublished}
+ \step[fieldset=usera, fieldvalue={Z}]
+ }
+ \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
+ \step[fieldsource={author}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
+ }%
+ \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
+ \step[fieldsource={editor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
+ }%
+ \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
+ \step[fieldsource={translator}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
+ }%
+ \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
+ \step[fieldsource={bookauthor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
+ }%
+ \map{%处理一些用year表示date的情况
+ %这样处理将会设置date域,并使得labeldatesource变为空,因为date的前缀为空(如果是urldate,那么labeldatesource就是url)。
+ %同时date域会被biblatex自动解析为year,month,day,并且覆盖原来的year信息
+ \step[fieldsource=year]
+ \step[fieldset=date, origfieldval]
+ }
+ \map{%将entrykey放入keywords中用于后期使用
+ \step[fieldsource=entrykey]
+ \step[fieldset=keywords, origfieldval]
+ }
+ \map{\step[fieldsource=title,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
+ \step[fieldset=userd,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
+ }
+ \map{%
+ \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final]
+ \step[fieldset=userd,fieldvalue={russian}]%俄语
+ }
+ \map{%
+ \step[fieldsource=title,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
+ \step[fieldset=userd,fieldvalue={japanese}]%日语
+ } %确定形式后可增加类似andotherscn这样的本地化字符串处理
+ \map{%
+ \step[fieldsource=title,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
+ \step[fieldset=userd,fieldvalue={korean}]%韩语
+ }
+ \map{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题
+ \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%
+ \step[fieldset=userd, fieldvalue={chinese}]
+ }
+ \map{%将没有设置userd,且存在title域的默认设置为英文
+ \step[fieldsource=title,final]
+ \step[fieldset=userd,fieldvalue={english}]
+ }
+ \map{\step[fieldsource=author,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
+ \step[fieldset=userf,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
+ }
+ \map{%
+ \step[fieldsource=author,match=\regexp{[\x{0400}-\x{052F}]},final]
+ \step[fieldset=userf,fieldvalue={russian}]%俄语
+ }
+ \map{%
+ \step[fieldsource=author,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
+ \step[fieldset=userf,fieldvalue={japanese}]%日语
+ } %确定形式后可增加类似andotherscn这样的本地化字符串处理
+ \map{%
+ \step[fieldsource=author,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
+ \step[fieldset=userf,fieldvalue={korean}]%韩语
+ }
+ \map{%作者的中文判断
+ \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
+ \step[fieldset=userf, fieldvalue={chinese}]
+ }
+ \map{%将没有设置userf,且存在author域的默认设置为英文
+ \step[fieldsource=author,final]
+ \step[fieldset=userf,fieldvalue={english}]
+ }
+ \map{\step[fieldsource=translator,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
+ \step[fieldset=usere,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
+ }
+ \map{%
+ \step[fieldsource=translator,match=\regexp{[\x{0400}-\x{052F}]},final]
+ \step[fieldset=usere,fieldvalue={russian}]%俄语
+ }
+ \map{%
+ \step[fieldsource=translator,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
+ \step[fieldset=usere,fieldvalue={japanese}]%日语
+ } %确定形式后可增加类似andotherscn这样的本地化字符串处理
+ \map{%
+ \step[fieldsource=translator,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
+ \step[fieldset=usere,fieldvalue={korean}]%韩语
+ }
+ \map{%译者的中文判断
+ \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
+ \step[fieldset=usere, fieldvalue={chinese}]
+ }
+ \map{%将没有设置usere,且存在translator域的默认设置为英文
+ \step[fieldsource=translator,final]
+ \step[fieldset=usere,fieldvalue={english}]
+ }
+ \map{\step[fieldsource=editor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
+ \step[fieldset=userc,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
+ }
+ \map{%
+ \step[fieldsource=editor,match=\regexp{[\x{0400}-\x{052F}]},final]
+ \step[fieldset=userc,fieldvalue={russian}]%俄语
+ }
+ \map{%
+ \step[fieldsource=editor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
+ \step[fieldset=userc,fieldvalue={japanese}]%日语
+ } %确定形式后可增加类似andotherscn这样的本地化字符串处理
+ \map{%
+ \step[fieldsource=editor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
+ \step[fieldset=userc,fieldvalue={korean}]%韩语
+ }
+ \map{%编者的中文判断
+ \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5
+ \step[fieldset=userc, fieldvalue={chinese}]
+ }
+ \map{%将没有设置userc,且存在editor域的默认设置为英文
+ \step[fieldsource=editor,final]
+ \step[fieldset=userc,fieldvalue={english}]
+ }
+ \map{\step[fieldsource=bookauthor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
+ \step[fieldset=userb,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
+ }
+ \map{%
+ \step[fieldsource=bookauthor,match=\regexp{[\x{0400}-\x{052F}]},final]
+ \step[fieldset=userb,fieldvalue={russian}]%俄语
+ }
+ \map{%
+ \step[fieldsource=bookauthor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
+ \step[fieldset=userb,fieldvalue={japanese}]%日语
+ } %确定形式后可增加类似andotherscn这样的本地化字符串处理
+ \map{%
+ \step[fieldsource=bookauthor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
+ \step[fieldset=userb,fieldvalue={korean}]%韩语
+ }
+ \map{%编者的中文判断
+ \step[fieldsource=bookauthor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5
+ \step[fieldset=userb, fieldvalue={chinese}]
+ }
+ \map{%将没有设置userc,且存在editor域的默认设置为英文
+ \step[fieldsource=bookauthor,final]
+ \step[fieldset=userb,fieldvalue={english}]
+ }
+ \map{\step[fieldsource=userd,final]%userd存在则用根据标题的语言设定language
+ \step[fieldset=language,origfieldval]%本身language存在则不设定
+ }
+ \map{\step[fieldsource=userf,final]%userd不存在,而userf存在则根据author的语言设定language
+ \step[fieldset=language,origfieldval]
+ }%如果没有作者和标题,那么剩下的最可能有意义的只有网址了,而网址通常是英文的,因此不用再进一步对其它域进行判断了。
+ \map{%将没有设置的language设置成en,即认为不是中文的就是英文的。
+ \step[fieldset=language,fieldvalue={english}]
+ }
+ \map{%一条文献的语言已经设定在language域中,由于出版项相关宏中使用userd判断,
+ %所以将一条文献的主体语言设定到userd中,本身前面userd已经设定,但没有处理无标题的情况,
+ %这里的处理等价于没有标题时,利用作者的语言设定userd,再没有作者,则默认用英文设定userd
+ \step[fieldsource=language]
+ \step[fieldset=userd,origfieldval]
+ }
+ \map{%当文献给出language域时,设置文献要使用的本地化字符串的语言
+ %biblatex 3.11及以下版本仅有match是区分大小写的,而3.12版开始用matchi来区分大小,而match不区分
+ %这里为兼容3.11及以下版本,所以用一个复杂一点的正则表达式
+ \step[fieldsource=language,match=\regexp{(e|E)(n|N)(g|G)(l|L)(i|I)(s|S)(h|H)},final]
+ \step[fieldset=langid,fieldvalue={english}]
+ \step[fieldset=lansortorder,fieldvalue=\lanenorder]
+ }
+ \map{
+ \step[fieldsource=language,match=\regexp{(r|R)(u|U)(s|S)(s|S)(i|I)(a|A)(n|N)},final]
+ \step[fieldset=langid,fieldvalue={russian}]
+ \step[fieldset=lansortorder,fieldvalue=\lanruorder]
+ }
+ \map{%
+ \step[fieldsource=language,match=\regexp{(f|F)(r|R)(e|E)(n|N)(c|C)(h|H)},final]
+ \step[fieldset=langid,fieldvalue={french}]
+ \step[fieldset=lansortorder,fieldvalue=\lanfrorder]
+ }
+ \map{%
+ \step[fieldsource=language,match=\regexp{(c|C)(h|H)(i|I)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english,
+ \step[fieldset=langid,fieldvalue={english}]
+ \step[fieldset=lansortorder,fieldvalue=\lancnorder]
+ }
+ \map{%
+ \step[fieldsource=language,match=\regexp{(j|J)(a|A)(p|P)(a|A)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english,
+ \step[fieldset=langid,fieldvalue={english}]
+ \step[fieldset=lansortorder,fieldvalue=\lanjporder]
+ }
+ \map{%
+ \step[fieldsource=language,match=\regexp{(k|K)(o|O)(r|R)(e|E)(a|A)(n|N)},final]%中日韩语目前都用english,
+ \step[fieldset=langid,fieldvalue={english}]
+ \step[fieldset=lansortorder,fieldvalue=\lankrorder]
+ }
+ \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook,
+ %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义
+ %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断
+ \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook
+ \step[typesource=standard, typetarget=inbook, final]
+ }
+ \map{%剩下的全部映射为book
+ \step[typesource=standard, typetarget=book, final]
+ }
+% \map{%先于标准样式的driver层映射,以取消type设置
+% \step[typesource=mastersthesis, typetarget=thesis, final]
+% %\step[fieldset=type, fieldvalue=mathesis]
+% }
+% \map{%先于标准样式的driver层映射,以取消type设置
+% \step[typesource=phdthesis, typetarget=thesis, final]
+% %\step[fieldset=type, fieldvalue=phdthesis]
+% }
+ \map{%先于标准样式的driver层映射,以取消type设置
+ \step[typesource=techreport, typetarget=report, final]
+ %\step[fieldset=type, fieldvalue=techreport]
+ }
+ \map{%
+ \pertype{report}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=report,typetarget=online]
+ \step[fieldset=note,fieldvalue={report}]
+ }
+ \map{%
+ \pertype{thesis}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=thesis,typetarget=online]
+ }
+ \map{%
+ \pertype{manual}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=manual,typetarget=online]
+ }
+ \map{%
+ \pertype{unpublished}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=unpublished,typetarget=online]
+ }
+ \map{%
+ \pertype{database}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=databasetypetarget=online]
+ }
+ \map{%
+ \pertype{dataset}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=dataset,typetarget=online]
+ }
+ \map{%
+ \pertype{software}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=software,typetarget=online]
+ }
+ \map{%
+ \pertype{map}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=map,typetarget=online]
+ }
+ \map{%
+ \pertype{archive}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=archive,typetarget=online]
+ }
+ \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确)
+ \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸
+ \step[fieldset=keywords, fieldvalue={,}, append]
+ \step[fieldset=keywords, origfieldval, append]
+ }
+ \map[overwrite]{%title,booktitle,journaltitle,journal,publisher,address,location,institution,organization
+ \step[fieldsource={title}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
+ }
+ \map[overwrite]{
+ \step[fieldsource={booktitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
+ }
+ \map[overwrite]{
+ \step[fieldsource={journaltitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
+ }
+ \map[overwrite]{
+ \step[fieldsource={journal}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
+ }
+ \map[overwrite]{
+ \step[fieldsource={publisher}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
+ }
+ \map[overwrite]{
+ \step[fieldsource={address}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
+ }
+ \map[overwrite]{
+ \step[fieldsource={location}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
+ }
+ \map[overwrite]{
+ \step[fieldsource={institution}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
+ }
+ \map[overwrite]{
+ \step[fieldsource={booktitle}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}]
+ }
+ \map[overwrite]{
+ \step[fieldsource={booktitle}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}]
+ }
+ %对于高版本(3.4以上)可以用下面这一段取代前面那一段,为了兼容gbnoauthor选项,这些代码只能在sourcemap中使用,所以只能选择前面那一段
+ %\map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{
+% \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}]
+% }
+% \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{
+% \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}]
+% }
+% \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,%
+% address,location,institution,organization}]{
+% \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
+% }
+ }
+}
+
+%
+% 佚名/noauthor的处理
+%
+% 原理方法:利用样式层的动态数据修改实现
+\def\dealnoathor{
+ \DeclareStyleSourcemap{
+ \maps[datatype=bibtex]{
+ \map{%默认情况下将空缺作者的中文文献设置为佚名
+ \step[fieldsource=language,match={chinese},final]
+ \step[fieldset=author, fieldvalue={佚名}]
+ }
+ \map{%默认情况下将空缺作者的英文文献设置为A{non}
+ \step[fieldsource=language,match={english},final]
+ \step[fieldset=author, fieldvalue={A{non}}]%noauthor换成Anon,同时为避免大写还加了{}
+ }
+ }
+ }
+}
+
+%
+% 不同语言分集调整的实现方式
+%
+% 原理方法:利用样式层的动态数据修改lansortorder域来实现排序
+\def\dealsortlan{
+ \DeclareStyleSourcemap{
+ \maps[datatype=bibtex]{
+ \map[overwrite]{%当文献给出language域时,设置文献要使用的本地化字符串的语言
+ \step[fieldsource=language,match=english,final]
+ \step[fieldset=lansortorder,fieldvalue=\lanenorder]
+ }
+ \map[overwrite]{
+ \step[fieldsource=language,match=russian,final]
+ \step[fieldset=lansortorder,fieldvalue=\lanruorder]
+ }
+ \map[overwrite]{%
+ \step[fieldsource=language,match=french,final]
+ \step[fieldset=lansortorder,fieldvalue=\lanfrorder]
+ }
+ \map[overwrite]{%
+ \step[fieldsource=language,match=chinese,final]%中日韩语目前都用english,
+ \step[fieldset=lansortorder,fieldvalue=\lancnorder]
+ }
+ \map[overwrite]{%
+ \step[fieldsource=language,match=japanese,final]%中日韩语目前都用english,
+ \step[fieldset=lansortorder,fieldvalue=\lanjporder]
+ }
+ \map[overwrite]{%
+ \step[fieldsource=language,match=korean,final]%中日韩语目前都用english,
+ \step[fieldset=lansortorder,fieldvalue=\lankrorder]
+ }
+ }
+ }
+}
+
+
+%
+%驱动别名等价于驱动层映射
+%
+\DeclareBibliographyAlias{newspaper}{article}%
+\DeclareBibliographyAlias{inproceedings}{inbook}%会议论文文献类型驱动
+\DeclareBibliographyAlias{conference}{inbook}%会议论文文献类型驱动
+\DeclareBibliographyAlias{incollection}{inbook}%文集中析出文献类型驱动
+\DeclareBibliographyAlias{collection}{book}%%文集类型驱动
+\DeclareBibliographyAlias{proceedings}{book}%会议论文集文献类型驱动
+\DeclareBibliographyAlias{thesis}{manual}%学位论文驱动
+\DeclareBibliographyAlias{unpublished}{manual}%其它类型驱动
+\DeclareBibliographyAlias{database}{manual}
+\DeclareBibliographyAlias{dataset}{manual}
+\DeclareBibliographyAlias{software}{manual}
+\DeclareBibliographyAlias{map}{manual}
+\DeclareBibliographyAlias{archive}{manual}
+
+%=====================================================================
+% 设置排序格式
+%=====================================================================
+%
+% 排序格式,用降序,及userb域,针对biblatex3.7及以下版本
+%
+\defversion{3.7}{sort}{%这是3.4版的,3.7版略有差异,但不大,后面有注释
+ \DeclareSortingScheme{gb7714-2015}{
+ \sort{
+ \field{presort}
+ }
+ %\sort[final]{
+ %\field{sortkey}
+ %}
+ \sort{
+ \field{lansortorder}%language
+ }
+ \sort{
+ \field{sortkey}
+ }
+ \sort{%[direction=descending]
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ }
+ \sort{
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume}
+ \literal{0000}%3.7版是\literal{0}
+ }
+ }
+
+ %降序的nyt
+ \DeclareSortingScheme{gbnytd}{
+ \sort{
+ \field{presort}
+ }
+ %\sort[final]{
+ %\field{sortkey}
+ %}
+ \sort{
+ \field{lansortorder}%language
+ }
+ \sort[direction=descending]{
+ \field{sortkey}
+ }
+ \sort[direction=descending]{
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ }
+ \sort{
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume}
+ \literal{0000}%3.7版是\literal{0}
+ }
+ }
+
+ %降序的ynt
+ \DeclareSortingScheme{gbyntd}{
+ \sort{
+ \field{presort}
+ }
+ %\sort[final]{
+ %\field{sortkey}
+ %}
+ \sort{
+ \field{lansortorder}%language
+ }
+ \sort[direction=descending]{
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sortkey}
+ }
+ \sort{
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume}
+ \literal{0000}%3.7版是\literal{0}
+ }
+ }
+
+ %升序的ynt
+ \DeclareSortingScheme{gbynta}{
+ \sort{
+ \field{presort}
+ }
+ %\sort[final]{
+ %\field{sortkey}
+ %}
+ \sort{
+ \field{lansortorder}%language
+ }
+ \sort{
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sortkey}
+ }
+ \sort{
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume}
+ \literal{0000}%3.7版是\literal{0}
+ }
+ }
+}
+
+
+%
+% 排序格式,用降序,及userb域,针对biblatex3.8及以上版本
+%
+\defversion{3.8}{sort}{
+ \DeclareSortingTemplate{gb7714-2015}{
+ \sort{
+ \field{presort}
+ }
+ %\sort[final]{
+ %\field{sortkey}
+ %}
+ \sort{
+ \field{lansortorder}%language
+ }
+ \sort{
+ \field{sortkey}
+ }
+ \sort{%[direction=descending]
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ }
+ \sort{
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field{volume}
+ \literal{0}
+ }
+ }
+
+ %降序的nyt
+ \DeclareSortingTemplate{gbnytd}{
+ \sort{
+ \field{presort}
+ }
+% \sort[final]{
+% \field{sortkey}
+% }
+ \sort{
+ \field{lansortorder}%language
+ }
+ \sort[direction=descending]{
+ \field{sortkey}
+ }
+ \sort[direction=descending]{%
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ }
+ \sort{
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field{volume}
+ \literal{0}
+ }
+ }
+
+ %降序的ynt
+ \DeclareSortingTemplate{gbyntd}{
+ \sort{
+ \field{presort}
+ }
+% \sort[final]{
+% \field{sortkey}
+% }
+ \sort{
+ \field{lansortorder}%language
+ }
+ \sort[direction=descending]{
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sortkey}
+ }
+ \sort{%
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field{volume}
+ \literal{0}
+ }
+ }
+
+ %升序的ynt
+ \DeclareSortingTemplate{gbynta}{
+ \sort{
+ \field{presort}
+ }
+% \sort[final]{
+% \field{sortkey}
+% }
+ \sort{
+ \field{lansortorder}%language
+ }
+ \sort{%[direction=ascending]
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sortkey}
+ }
+ \sort{%
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field{volume}
+ \literal{0}
+ }
+ }
+
+ %
+ % 定义命令\defdoublelangentry,用于biblatex>v3.8版利用related实现双语文献的处理
+ %
+ %为了实现v3.8以上版本的双语文献,采用related的方法代替set方法,因为set方法已经无法实现了,
+ %因为set不再复制其第一个成员的信息。于是定义一个命令,用于动态的修改数据,即添加related域的信息
+ %其中使用了\DeclareStyleSourcemap,但由于其只能出现在导言区中,因此\defdoublelangentry命令也只能出现在导言区中
+ \newcommand{\defdoublelangentry}[2]{%
+ \edef\entrykeya{##1}
+ \edef\entrykeyb{##2}
+ \DeclareStyleSourcemap{
+ \maps[datatype=bibtex]{
+ \map{
+ \step[fieldsource=entrykey, match=\entrykeya, final]
+ \step[fieldset=related, fieldvalue=\entrykeyb]
+ }
+ }
+ }
+ }
+}
+
+
+\ifboolexpr{
+test {\iftoggle{iftlfive}}
+or
+test {\iftoggle{iftlsix}}
+or
+test {\iftoggle{iftlseven}}%biblatex<=3.7
+}{\switchversion{3.7}{sort}}{\switchversion{3.8}{sort}}%3.8<=biblatex
+
+
+%=====================================================================
+%参考文献表环境
+%=====================================================================
+
+%
+% 列表格式
+%
+% 增加一个\bibitemindent尺寸用于控制list环境的itemindent
+% v1.0l,20180615,hzz
+\setlength{\bibhang}{1em}
+\newlength{\bibitemindent}
+\setlength{\bibitemindent}{-\bibhang}
+\setlength{\bibitemsep}{4.5pt}
+ \defbibenvironment{bibliography}
+ {\list
+ {}
+ {\setlength{\leftmargin}{\bibhang}%
+ \setlength{\itemindent}{\bibitemindent}%
+ \setlength{\itemsep}{\bibitemsep}%
+ \setlength{\parsep}{\bibparsep}}}
+ {\endlist}
+ {\item}
+
+
+%=====================================================================
+% 设置单元或块等的标点
+%=====================================================================
+\renewrobustcmd*{\bibinithyphendelim}{\addhighpenspace}%用于处理姓名中名部分存在-的情况,比如ZHANG Yu-xin
+\renewcommand*{\subtitlepunct}{\addcolon\space} %修改标题和其它标题信息间的标点%来源biblatex.def
+%
+% 利用set实现的多语言文献不同语言间的分隔符
+% 20170411,双语之间用newline替换par,避免采用gb7714-2015的项对齐方式第二语言间分段导致没有缩进
+%
+% 原理方法:set方法可以参考3.11.5 Entry Sets,4.11.1 Entry Sets
+% 这里调整一下两种语言参考文献的间隔,源来自biblatex.def
+\renewcommand*{\entrysetpunct}{\adddot\par\nobreak}%ay样式用par也可以,因为没有悬挂对齐问题
+\renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%%页码引用格式的修改,修改为用冒号
+%\renewcommand{\relateddelim}{}%\par
+
+%=====================================================================
+% 修改域的格式,重定义域的输出宏
+%=====================================================================
+%
+% 新增文献类型标识符的格式
+% []前的nobreak,从GB4.1节的例子看不应该加,所以去掉
+% 但因为考虑到cjk字符和[]之间可能添加空格,所以仍然加上
+% 而[]中间的内容,从4.6.2节的例子看也是可以分割的,因此内部的nobreak也可以去掉
+%
+\DeclareFieldFormat{gbtypeflag}{%
+\iftoggle{bbx:gbmedium}%
+{\iftoggle{bbx:url}%
+ {\iffieldundef{url}%当存在url时,增加一个OL标识符
+ {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}%
+ {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}%
+ }%
+ {\ifentrytype{online}%
+ {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}%
+ {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}%
+ }}%
+ {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}%
+}
+
+%
+% 新增用于报纸的文献类型标识符的格式
+%
+\DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper
+\iftoggle{bbx:gbmedium}%
+{\iftoggle{bbx:url}%
+ {\iffieldundef{url}%当存在url时,增加一个OL标识符
+ {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
+ {\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}%
+ }%
+ {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
+}{\nobreak\printtext{[}\nobreak N\printtext{]}\nobreak}%
+}
+
+%
+% 新增用于标准的文献类型标识符的格式
+%
+\DeclareFieldFormat{gbtypeflags}{%用于标准standard
+\iftoggle{bbx:gbmedium}%
+{\iftoggle{bbx:url}%
+ {\iffieldundef{url}%当存在url时,增加一个OL标识符
+ {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
+ {\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}%
+ }%
+ {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
+}{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}%
+}
+
+%
+% 重设title等参考文献信息的输出格式
+%
+% 原理方法:修改来自biblatex.def文件的原格式
+\newcommand{\bibtitlefont}{}
+\newcommand{\bibauthorfont}{}
+\newcommand{\bibpubfont}{}
+\DeclareFieldFormat{title}{#1\adddot\addthinspace}
+\DeclareFieldFormat{journaltitle}{#1\isdot}%添加\isdot,用于缩写名带点情况,将其转换为缩写点,便于标点的追踪
+\DeclareFieldFormat{issuetitle}{#1}
+\DeclareFieldFormat{maintitle}{#1}
+\DeclareFieldFormat{booktitle}{#1}
+\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉
+ [article,patent,thesis,unpublished]
+ {title}{#1\adddot\addthinspace}
+\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉
+ [inbook,incollection,inproceedings]
+ {title}{#1}%\nopunct\unspace
+\DeclareFieldFormat{url}{\url{#1}} %url域修改如本行%url相关输出,源来自biblatex.def
+\def\UrlFont{\rmfamily}%设置url字体为roman字体%\ttfamily
+%\urlstyle{rm} %使用这句也一样
+\setcounter{biburlnumpenalty}{100} %让url可以在数字后断行
+\setcounter{biburlucpenalty}{100} %让url可以在大写字母后断行
+\setcounter{biburllcpenalty}{100} %让url可以在小写字母后断行
+\DeclareFieldFormat{doi}{%
+ \rmfamily{DOI}\addcolon\space
+ \ifhyperref
+ {\href{https://doi.org/#1}{\nolinkurl{#1}}}
+ {\nolinkurl{#1}}}
+%
+% 标题的字母大小写格式修改
+%
+% 注意:修改标题的字母大小写,不能用前面的title的格式而要用titlecase
+% 因为titlecase is applied to the contents of the field directly,title is not
+%\DeclareFieldFormat{titlecase}{\MakeCapital#1}%重设标题格式,将其修改为首字母大写
+\DeclareFieldFormat{titlecase}{\iftoggle{bbx:titlelink}{%
+\iffieldundef{url}{\MakeCapital#1}{%
+\href{\thefield{url}}{#1}}}{\MakeCapital#1}}%重设标题格式,将其修改为首字母大写
+\DeclareFieldFormat{pages}{#1}%页码引用格式的修改%去掉前面引导页码的pp.等字符
+\DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{-}}
+\DefineBibliographyExtras{russian}{\renewcommand*{\bibrangedash}{-}}
+
+\def\execgbfdfmtstd{%恢复到标准样式的设置
+\DeclareFieldFormat{title}{\mkbibemph{##1}}
+\DeclareFieldFormat
+ [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
+ {title}{\mkbibquote{##1\isdot}}
+\DeclareFieldFormat
+ [suppbook,suppcollection,suppperiodical]
+ {title}{##1}
+\DeclareFieldFormat{journaltitle}{\mkbibemph{##1}}
+\DeclareFieldFormat{issuetitle}{\mkbibemph{##1}}
+\DeclareFieldFormat{maintitle}{\mkbibemph{##1}}
+\DeclareFieldFormat{booktitle}{\mkbibemph{##1}}
+\DeclareFieldFormat{url}{\mkbibacro{URL}\addcolon\space\url{##1}}
+\DeclareFieldFormat{titlecase}{##1}
+\DeclareFieldFormat{pages}{\mkpageprefix[bookpagination]{##1}}
+}
+
+%
+% 文献标题后的标点问题
+% v1.0k,20180405,为texlive2017以上版本中的beamer兼容性做的处理,Hu Zhenzhen
+%
+% 原理方法:如下代码处理texlive2017以上版本中,beamer中文献的标题后出现两个点的情况:
+% texlive2017以上的beamer中对macro{title}做了patch,正常情况下不会出现两个点的情况,但由于
+% 之前为了处理texlive2015,2016下的title格式添加了adddot,导致出现两个点的情况,而且也影响
+% 析出文献的//符号的输出,因此再次对macro{title}做patch消除beamer中做apptocmd时添加的\newunitpunct
+\ifboolexpr{%
+ test{\iftoggle{iftlfive}}
+ or
+ test{\iftoggle{iftlsix}}
+ }{}%
+ {%texlive 2017对应iftlseven以上版本
+ \@ifclassloaded{beamer}{
+ \DeclareFieldFormat{title}{#1}%
+ \DeclareFieldFormat[article,patent,thesis,unpublished]{title}{#1}
+ \AtBeginDocument{%
+ \patchcmd{\abx at macro@title}{\newunitpunct}{}{}{}}}{}
+ }
+
+
+%
+% 修改译者位置格式
+%
+% 原理方法:修改来自biblatex.def文件的bytranslator+others宏的格式
+\renewbibmacro*{bytranslator+others}{\bibauthorfont%
+ \ifnameundef{translator}
+ {}
+ {%\usebibmacro{bytranslator+othersstrg}
+ %\setunit{\addspace}%
+ \printnames[bytranslator]{translator}%
+ \clearname{translator}%
+ %从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理
+ %比如生成cotranslator等用于调用cotranslator所代表的当地化字符串
+ \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。
+ %\setunit{\addspace}%
+ \newunit}%
+ \usebibmacro{withothers}}
+
+
+
+%
+% 修改作者数量超过限定值,做省略时的处理格式
+% v1.0,20160701,hzz
+% v1.0O,20190103,hzz,修改利用新定义的一个分隔符strandothersdelim
+%
+% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。
+% \printnames由start-stop控制项数,默认是1和maxnames/minnames
+\renewbibmacro*{name:andothers}{\bibauthorfont%
+ \ifboolexpr{
+ test {\ifnumequal{\value{listcount}}{\value{liststop}}}
+ and
+ test \ifmorenames
+ }{\ifnumgreater{\value{liststop}}{1}%注意这里试图去区分姓名总数大于1的情况,当姓名总数大于1时,最后一个姓名后面先加入一个\finalandcomma
+ {\finalandcomma}%目前国标没有这样的区分要求,如果有需要也是可以这么去做的。
+ {}%
+\printdelim{andothersdelim}\printdelim{strandothersdelim}%
+}{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如:
+%袁训来, 陈哲, 肖书海, 等.
+%胡泳, 范海燕, 译.
+%潘惠霞, 魏婧, 杨艳, 等译.
+\ifcurrentname{translator}{\addcomma\addthinspace}{}%为了实现上述第二个示例情况做的处理
+}}
+
+% 修改省略作者后的本地化字符串,比如et al.
+% v1.0o,20190103,hzz
+%
+% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andotherscn=“等”,否则用andothers=“et al.”。
+% 非默认情况,根据选项信息,选择选择强制中文或英文
+% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了
+% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置
+\DeclareDelimFormat{strandothersdelim}{%
+ \edef\userfieldabcde{userd}%这里使用\iffieldequalstr{labelnamesource}替代ifcurrentname因为标注中使用ifcurrentname无效
+ \iffieldequalstr{labelnamesource}{translator}{\edef\userfieldabcde{usere}}{}%
+ \iffieldequalstr{labelnamesource}{editor}{\edef\userfieldabcde{userc}}{}%
+ \iffieldequalstr{labelnamesource}{author}{\edef\userfieldabcde{userf}}{}%
+ \iffieldequalstr{labelnamesource}{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbcitelocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\ifbibstring{andothersincitecn}{\bibstring{andothersincitecn}}{\bibstring{andothers}}}{}%中文已经通过english本地化字符串定义
+ \iffieldequalstr{\userfieldabcde}{korean}{\ifbibstring{andotherskr}{\bibstring{andotherskr}}{\bibstring{andothers}}}{}%韩语未定义,所以与bib中一致
+ \iffieldequalstr{\userfieldabcde}{japanese}{\ifbibstring{andothersjp}{\bibstring{andothersjp}}{\bibstring{andothers}}}{}%日与同韩语
+ \iffieldequalstr{\userfieldabcde}{english}{\ifbibstring{andothersincite}{\bibstring{andothersincite}}{\bibstring{andothers}}}{}%英语已定义
+ \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%法语未定义,若要定义需要针对french本地化字符串定义
+ \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%俄语未定义,若要定义需要针对russian本地化字符串定义
+ \or%
+ \bibstring{andothersincitecn}%
+ \or%
+ \bibstring{andothersincite}%
+ \fi}
+
+
+\DeclareDelimFormat[bib,biblist]{strandothersdelim}{%
+ \edef\userfieldabcde{userd}%
+ \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
+ \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
+ \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
+ \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbbiblocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}%
+ \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andothersjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}%
+ \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%
+ \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%
+ \or%
+ \bibstring{andotherscn}%
+ \or%
+ \bibstring{andothers}%
+ \fi}
+
+
+%
+% 修改最后一个作者前的字符串,比如 and
+% v1.0o,20190103,hzz
+%
+% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andcn=“和”,否则用and=“and”。
+% 非默认情况,根据选项信息,选择选择强制中文或英文
+% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了
+% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置
+\DeclareDelimFormat{finalnamedelim}{%
+ \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
+% \addspace%
+ \edef\userfieldabcde{userd}%
+ \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
+ \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
+ \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
+ \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbcitelocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andincitecn}}{}%
+ \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{english}{\space\bibstring{andincite}\space}{}%
+ \iffieldequalstr{\userfieldabcde}{french}{\space\bibstring{and}\space}{}%
+ \iffieldequalstr{\userfieldabcde}{russian}{\space\bibstring{and}\space}{}%
+%\space%
+ \or%
+ \bibstring{andincitecn}%\space%
+ \or%
+\space\bibstring{andincite}\space%
+ \fi}
+
+\DeclareDelimFormat[bib,biblist]{finalnamedelim}{%
+ \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
+ \addspace%
+ \edef\userfieldabcde{userd}%
+ \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
+ \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
+ \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
+ \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbbiblocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}%
+ \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}%
+ \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}%
+ \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}%
+\space%
+ \or%
+ \bibstring{andcn}\space%
+ \or%
+ \bibstring{and}\space%
+ \fi}
+
+
+
+%
+% 重设title的输出
+%
+% 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen
+% 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件
+% 利用toggle做标识符是否输出的判断
+\renewbibmacro*{title}{%
+ \ifboolexpr{%
+ test{\iffieldundef{title}}%
+ and
+ test{\iffieldundef{subtitle}}%
+ }%
+ {}%
+ {\printtext[title]{\bibtitlefont%增加字体控制命令
+ \printfield[titlecase]{title}%
+ \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
+ {}{\setunit{\subtitlepunct}%
+ \printfield[titlecase]{subtitle}}%
+ \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
+ {\setunit{\subtitlepunct}\printfield{titleaddon}}%
+ \iftoggle{bbx:gbtype}{%
+ \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准
+ {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准
+ {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸
+ {\printfield[gbtypeflag]{usera}}}%其它
+ }}{}%
+ %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
+ %\newunit
+ }%
+}}
+
+
+%
+% 作者信息的输出格式
+%
+% 20180425,v1.0k,为作者增加字体控制命令,Hu Zhenzhen
+% 20180603,v1.0l,增加使用nameformat域来选择姓名格式
+\DeclareNameFormat{namefmtselected}{%
+\iffieldundef{namefmtid}{}%
+{\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}%
+\ifcase\value{gbnamefmtcase}%
+ \ifgiveninits
+ {\usebibmacro{name:gbuppercase}
+ {\namepartfamily}
+ {\namepartgiveni}
+ {\namepartprefix}
+ {\namepartsuffix}}
+ {\usebibmacro{name:gbuppercase}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}}%
+\or
+ \ifgiveninits
+ {\usebibmacro{name:gblowercase}
+ {\namepartfamily}
+ {\namepartgiveni}
+ {\namepartprefix}
+ {\namepartsuffix}}
+ {\usebibmacro{name:gblowercase}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}}%
+\or
+ \ifgiveninits
+ {\usebibmacro{name:given-family}
+ {\namepartfamily}
+ {\namepartgiveni}
+ {\namepartprefix}
+ {\namepartsuffix}}
+ {\usebibmacro{name:given-family}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}}%
+\or
+ \ifgiveninits
+ {\usebibmacro{name:family-given}
+ {\namepartfamily}
+ {\namepartgiveni}
+ {\namepartprefix}
+ {\namepartsuffix}}
+ {\usebibmacro{name:family-given}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}}%
+\or
+\usebibmacro{name:gbpinyin}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}%
+\or
+ \ifnumequal{\value{listcount}}{1}
+ {\ifgiveninits
+ {\usebibmacro{name:family-given}
+ {\namepartfamily}
+ {\namepartgiveni}
+ {\namepartprefix}
+ {\namepartsuffix}}
+ {\usebibmacro{name:family-given}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}}%
+ \ifboolexpe{%
+ test {\ifdefvoid\namepartgiven}
+ and
+ test {\ifdefvoid\namepartprefix}}
+ {}
+ {\usebibmacro{name:revsdelim}}}
+ {\ifgiveninits
+ {\usebibmacro{name:given-family}
+ {\namepartfamily}
+ {\namepartgiveni}
+ {\namepartprefix}
+ {\namepartsuffix}}
+ {\usebibmacro{name:given-family}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}}}%
+\fi
+ \usebibmacro{name:andothers}}
+
+\DeclareNameAlias{default}{namefmtselected}%姓名的默认格式采用可选的模式
+\DeclareNameAlias{sortname}{default}% Used in the bibliography %family-given/given-family
+\DeclareNameAlias{citename}{default}% Default used by \citename
+
+\DeclareDelimFormat[bib,biblist]{andothersdelim}{\addcomma\addspace}
+%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}%
+
+%GB/T 7714-2015 风格,全部大写
+\newbibmacro*{name:gbuppercase}[4]{\bibauthorfont%
+\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
+\renewcommand*{\revsdnamepunct}{}%
+ \ifuseprefix%
+ {\usebibmacro{name:delim}{#3#1}%
+ \usebibmacro{name:hook}{#3#1}%
+ \ifdefvoid{#3}{}{%
+ \ifcapital%
+ {\mkbibnameprefix{\MakeCapital{#3}}\isdot}%
+ {\mkbibnameprefix{#3}\isdot}%
+ \ifprefchar{}{\bibnamedelimc}}%
+ \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
+ \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital
+ \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%
+ {\usebibmacro{name:delim}{#1}%
+ \usebibmacro{name:hook}{#1}%
+ \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
+ \ifboolexpe{%
+ test {\ifdefvoid{#2}}
+ and
+ test {\ifdefvoid{#3}}}
+ {}{\revsdnamepunct}%
+ \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital
+ \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
+ \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%
+}
+
+%GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出
+\newbibmacro*{name:gblowercase}[4]{\bibauthorfont%
+ \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
+ \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
+ \ifuseprefix
+ {\usebibmacro{name:delim}{#3#1}%
+ \usebibmacro{name:hook}{#3#1}%
+ \ifdefvoid{#3}{}{%
+ \ifcapital
+ {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
+ {\mkbibnameprefix{#3}\isdot}%
+ \ifprefchar{}{\bibnamedelimc}}%
+ \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot%
+ \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital
+ \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}
+ {\usebibmacro{name:delim}{#1}%
+ \usebibmacro{name:hook}{#1}%
+ \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot%
+ \ifboolexpe{%
+ test {\ifdefvoid{#2}}
+ and
+ test {\ifdefvoid{#3}}}
+ {}{\revsdnamepunct}%
+ \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital
+ \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}
+ \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%
+}
+
+%中文常见风格,汉语拼音全拼模式
+\newbibmacro*{name:gbpinyin}[4]{\bibauthorfont%
+\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY
+\renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
+\renewrobustcmd*{\bibnamedelima}{\mbox{-}}%
+ \ifuseprefix
+ {\usebibmacro{name:delim}{#3#1}%
+ \usebibmacro{name:hook}{#3#1}%
+ \ifdefvoid{#3}{}{%
+ \ifcapital
+ {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
+ {\mkbibnameprefix{#3}\isdot}%
+ \ifprefchar{}{\bibnamedelimc}}%
+ \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
+ \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamegiven{#2}}\isdot}%\MakeCapital
+ \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}
+ {\usebibmacro{name:delim}{#1}%
+ \usebibmacro{name:hook}{#1}%
+ \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
+ \ifboolexpe{%
+ test {\ifdefvoid{#2}}
+ and
+ test {\ifdefvoid{#3}}}
+ {}
+ {\revsdnamepunct}%
+ \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeCapital{#2}}\isdot}%\MakeCapital
+ \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}
+ \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%
+}
+
+
+\@ifpackagelater{biblatex}{2016/03/27}%biblatex<3.2版的情况
+ {}{
+ %GB/T 7714-2015 风格,全部大写
+ \renewbibmacro*{name:gbuppercase}[4]{\bibauthorfont%
+ \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
+ \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
+ \ifuseprefix
+ {\usebibmacro{name:delim}{#3#1}%
+ \usebibmacro{name:hook}{#3#1}%
+ \ifblank{#3}{}{%
+ \ifcapital
+ {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
+ {\mkbibnameprefix{#3}\isdot}%
+ \ifpunctmark{'}{}{\bibnamedelimc}}%
+ %\mkbibnamelast{#1}\isdot
+ \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase
+ %注意上一句\MakeCapital后面如果再跟一个{}包含#1,则没有效果,可能是包在里面少了一层展开
+ %因为机构名通常包括在{}内,所以要多展开一次才行,所以这里去掉#1外面的{}
+ %\mkbibnamelast{\MakeUppercase{#1}}\isdot
+ %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面
+ \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}%
+ \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}}
+ {\usebibmacro{name:delim}{#1}%
+ \usebibmacro{name:hook}{#1}%
+ %\mkbibnamelast{#1}\isdot %3.9.1 Generic Commands and Hooks,对姓重新处理,如下句: %\mkbibnamelast{\MakeUppercase{#1}}
+ \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase
+ %\mkbibnamelast{\MakeUppercase{#1}}\isdot
+ %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面
+ \ifblank{#2#3}{}{\revsdnamepunct}%
+ \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}%
+ \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
+ \addcomma\addspace%
+ \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}%
+ }%
+ }
+
+ %GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出
+ \renewbibmacro*{name:gblowercase}[4]{\bibauthorfont%
+ \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
+ \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
+ \ifuseprefix
+ {\usebibmacro{name:delim}{#3#1}%
+ \usebibmacro{name:hook}{#3#1}%
+ \ifblank{#3}{}{%
+ \ifcapital
+ {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
+ {\mkbibnameprefix{#3}\isdot}%
+ \ifpunctmark{'}{}{\bibnamedelimc}}%
+ \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase
+ \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{{#2}}\isdot}%
+ \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}}
+ {\usebibmacro{name:delim}{#1}%
+ \usebibmacro{name:hook}{#1}%
+ \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase
+ \ifblank{#2#3}{}{\revsdnamepunct}%
+ \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{{#2}}\isdot}%
+ \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
+ \addcomma\addspace%
+ \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}%
+ }%
+ }
+
+ %中文常见风格,汉语拼音全拼模式
+ \renewbibmacro*{name:gbpinyin}[4]{\bibauthorfont%
+ \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
+ \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
+ \renewrobustcmd*{\bibnamedelima}{\mbox{-}}%
+ \ifuseprefix
+ {\usebibmacro{name:delim}{#3#1}%
+ \usebibmacro{name:hook}{#3#1}%
+ \ifblank{#3}{}{%
+ \ifcapital
+ {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
+ {\mkbibnameprefix{#3}\isdot}%
+ \ifpunctmark{'}{}{\bibnamedelimc}}%
+ \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase
+ \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamefirst{#2}}\isdot}%
+ \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}}
+ {\usebibmacro{name:delim}{#1}%
+ \usebibmacro{name:hook}{#1}%
+ \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase
+ \ifblank{#2#3}{}{\revsdnamepunct}%
+ \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}%
+ \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
+ \addcomma\addspace%
+ \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}%
+ }%
+ }
+
+ %%biblatex<3.2版的情况,姓名的处理格式带参数
+ \DeclareNameFormat{namefmtselected}{%
+ \iffieldundef{namefmtid}{}%
+ {\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}%
+ \ifcase\value{gbnamefmtcase}%
+ \iffirstinits
+ {\usebibmacro{name:gbuppercase}{#1}{#4}{#5}{#7}}
+ {\usebibmacro{name:gbuppercase}{#1}{#3}{#5}{#7}}%
+ \or
+ \iffirstinits
+ {\usebibmacro{name:gblowercase}{#1}{#4}{#5}{#7}}
+ {\usebibmacro{name:gblowercase}{#1}{#3}{#5}{#7}}%
+ \or
+ \iffirstinits
+ {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}}
+ {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}%
+ \ifblank{#3#5}
+ {}
+ {\usebibmacro{name:revsdelim}}%
+ \or
+ \iffirstinits
+ {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}}
+ {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}%
+ \or
+ \usebibmacro{name:gbpinyin}{#1}{#3}{#5}{#7}%
+ \or
+ \ifnumequal{\value{listcount}}{1}
+ {\iffirstinits
+ {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}}
+ {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}%
+ \ifblank{#3#5}
+ {}
+ {\usebibmacro{name:revsdelim}}}
+ {\iffirstinits
+ {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}}
+ {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}}%
+ \fi
+ \usebibmacro{name:andothers}}
+}
+
+%
+% url和url日期格式
+%
+\renewbibmacro*{url+urldate}{%
+ %\usebibmacro{url}%%更换url的位置,放到下面
+ \iffieldundef{urlyear}%
+ {}{%\setunit*{\addspace}%
+ \usebibmacro{urldate}}%
+ \setunit{\addperiod\addspace}%
+ \usebibmacro{url}}
+\renewbibmacro*{url}{\printfield{url}}
+
+%
+% 日期信息的输出格式,针对biblatex<3.7版本
+%
+\defversion{3.4}{date}{
+ \renewbibmacro*{urldate}{%
+ \addthinspace\printtext{[}\printfield{urlyear}%
+ \iffieldundef{urlmonth}{}{\bibrangedash\printfield{urlmonth}}%
+ \iffieldundef{urlday}{}{\bibrangedash\printfield{urlday}}\printtext{]}}
+
+ \newbibmacro*{newsdate}{%%新增加一个公告日期,公开日期或新闻日期
+ \iffieldundef{year}{}{\printfield{year}%
+ \iffieldundef{month}{}{\bibrangedash\printtext{\thefield{month}}%
+ \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}%
+ }
+
+ \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式
+ \ifboolexpr{%
+ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
+ }%
+ {}%更新或修改日期通常有day信息
+ {\iffieldequalstr{year}{}{%替换\iffieldundef{year},因为year总是存在,但为空
+ \iffieldundef{endyear}{%
+ \iffieldundef{eventyear}{}{\printtext{\mkbibparens{\printtext{\printfield{eventyear}}%
+ \iffieldundef{eventmonth}{}{\bibrangedash\thefield{eventmonth}}%
+ \iffieldundef{eventday}{}{\bibrangedash\printfield{eventday}}}}%
+ }%
+ }{%
+ \iffieldundef{endyear}{}{\printtext{\mkbibparens{\printtext{\printfield{endyear}}%
+ \iffieldundef{endmonth}{}{\bibrangedash\thefield{endmonth}}%
+ \iffieldundef{endday}{}{\bibrangedash\printfield{endday}}}}%
+ }%
+ }%
+ }%
+ {%
+ \iffieldundef{year}{}{\printtext{\mkbibparens{\printtext{\printfield{year}}%
+ \iffieldundef{month}{}{\bibrangedash\thefield{month}}%
+ \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}%
+ }%
+ }%
+ }}%
+}
+
+%
+% 日期信息的输出格式,针对3.9>=biblatex>=3.7版本
+%
+\defversion{3.7}{date}{
+ \DeclareFieldFormat{urldate}{##1}
+ \renewbibmacro*{urldate}{%
+ \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx at edtfdate这种更底层的命令
+
+ %
+ % 专利的公告日期、或报纸的日期的输出宏
+ % 20160701,v1.0,新增加
+ % 20180405,v1.0k,为biblatexv3.7-3.9版本,出现多出点bug做处理,Hu Zhenzhen
+ %
+ % 原理方法:加上printtext避免破坏异步标点机制
+ %
+ \newbibmacro*{newsdate}{%
+ \printtext{\blx at edtfdate{}{}}%
+ }
+
+ \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式
+ \ifboolexpr{%
+ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
+ }%
+ {}%更新或修改日期通常有day信息
+ {\iffieldundef{year}{%
+ \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}%
+ {\printtext{(}\printenddate\printtext{)}}%
+ }{\iffieldequalstr{year}{}{%因为year存在,但为空
+ }{\printtext{(}\blx at edtfdate{}{}\printtext{)}}%
+ }%
+ }}%
+}
+
+%
+% 日期信息的输出格式,针对biblatex>=3.10版本
+%
+\defversion{3.10}{date}{
+ \DeclareFieldFormat{urldate}{##1}
+ \renewbibmacro*{urldate}{%
+ \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx at edtfdate这种更底层的命令
+
+ %
+ % 专利的公告日期、或报纸的日期的输出宏
+ % 20160701,v1.0,新增加
+ % 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen
+ %
+ % 原理方法:加上printtext避免破坏异步标点机制
+ % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份
+ % 所以无法再用选项设置的方法,印象需要用底层的命令
+ % 这里可以用\blx at isodate,但用\blx at gbdate试图避免版本判断
+ \newbibmacro*{newsdate}{%%
+ \printtext{\blx at gbdate{}{}}%%\blx at isodate{}{}%
+ }
+
+ \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式
+ \ifboolexpr{%
+ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
+ }%
+ {}%更新或修改日期通常有day信息
+ {\iffieldundef{year}{%
+ \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}%
+ {\printtext{(}\printenddate\printtext{)}}%
+ }{\iffieldequalstr{year}{}{%因为year存在,但为空
+ }{\printtext{(}\blx at gbdate{}{}\printtext{)}}%
+ }%
+ }}%
+}
+
+%
+% 关联文献的输出格式,针对3.9>=biblatex>=3.7版本
+%
+% 原理方法:因为related宏中带有##了,所以无法封装到defversion中了。所以直接做判断
+% 下面这一段主要针对v3.8-3.10,因为我提问后,biblatex作者为3.11版增加了一个钩子控制relatedblock前的分隔符。
+\ifboolexpr{
+test{\iftoggle{iftleight}}
+or
+test{\iftoggle{iftlnine}}
+}{\renewbibmacro*{related}{%standard.bbx
+ \ifboolexpr{ test {\iffieldundef{related}} or test {\ifrelatedloop} }
+ {}
+ {\usebibmacro{begrelated}%
+ \def\bbx at tempa{}%
+ \setcounter{bbx:relatedtotal}{0}%
+ \def\do##1{%
+ \entrydata{##1}{%
+ \ifrelatedloop
+ {}
+ {\stepcounter{bbx:relatedtotal}%
+ \gappto{\bbx at tempa}{##1,}}}}%
+ \docsvfield{related}%
+ \restorefield{related}{\bbx at tempa}%
+ \ifnumgreater{\value{bbx:relatedtotal}}{0}
+ {\listcsxadd{bbx:relatedloop}{\strfield{entrykey}}%
+ \iffieldundef{clonesourcekey}
+ {}
+ {\listcsxadd{bbx:relatedloop}{\strfield{clonesourcekey}}}%
+ \setcounter{bbx:relatedcount}{0}%
+ \def\do{%
+ \stepcounter{bbx:relatedcount}%
+ \ifnumgreater{\value{bbx:relatedcount}}{0}%这里从1改为0
+ {\ifcsundef{relateddelim\strfield{relatedtype}}
+ {\printtext{\relateddelim}}
+ {\printtext{\csuse{relateddelim\strfield{relatedtype}}}}}
+ {}}%
+ \ifbibmacroundef{related:\strfield{relatedtype}}
+ {\appto{\do}{\usebibmacro{related:default}}}
+ {\appto{\do}{\usebibmacro*{related:\strfield{relatedtype}}}}%
+ \iffieldformatundef{related:\strfield{relatedtype}}
+ {\def\bbx at tempa{related}}
+ {\def\bbx at tempa{related:\strfield{relatedtype}}}%
+ \iffieldformatundef{relatedstring:\strfield{relatedtype}}
+ {\def\bbx at tempb{relatedstring:default}}
+ {\def\bbx at tempb{relatedstring:\strfield{relatedtype}}}%
+ \printtext[\bbx at tempa]{%
+ \usebibmacro{begrelatedloop}%
+ \iffieldundef{relatedstring}
+ {\ifboolexpr{
+ test {\ifnumgreater{\value{bbx:relatedtotal}}{1}}
+ and
+ test {\ifbibxstring{\thefield{relatedtype}s}}
+ }
+ {\printtext[\bbx at tempb]{%
+ \bibstring[\mkrelatedstring]{\thefield{relatedtype}s}}}
+ {\iffieldbibstring{relatedtype}
+ {\printtext[\bbx at tempb]{%
+ \bibstring[\mkrelatedstring]{\thefield{relatedtype}}}}
+ {}}}
+ {\iffieldbibstring{relatedstring}
+ {\printtext[\bbx at tempb]{%
+ \bibstring[\mkrelatedstring]{\thefield{relatedstring}}}}
+ {\printfield[\bbx at tempb]{relatedstring}}}%
+ \docsvfield{related}%
+ \usebibmacro{endrelatedloop}}}%
+ {}%
+ \usebibmacro{endrelated}}}
+}{}
+
+%
+% 关联文献块前的分隔符,针对biblatex3.11
+%
+% 原理方法:因为增加了begrelateddelim钩子,所以不需要重定义related输出宏
+\defversion{3.11}{related}{
+\renewcommand{\begrelateddelim}{\adddot\newline\nobreak}
+}
+
+\iftoggle{iftlfive}{\switchversion{3.4}{date}}{}%biblatex<=3.2
+\iftoggle{iftlsix}{\switchversion{3.4}{date}}{}%3.3<=biblatex<=3.6
+\iftoggle{iftlseven}{\switchversion{3.7}{date}}{}%biblatex=3.7
+\iftoggle{iftleight}{\switchversion{3.7}{date}}{}%3.8<=biblatex<=3.9
+\iftoggle{iftlnine}{\switchversion{3.10}{date}}{}%biblatex3.10
+\iftoggle{iftlatest}{\switchversion{3.10}{date}\switchversion{3.11}{related}}{}%biblatex最新
+
+%
+% 调整doi+eprint+url格式
+%
+% 原理方法:源来自standard.bbx,因为页码后面直接跟引用日期,没有标点所以去掉其中的标点。
+\renewbibmacro*{doi+eprint+url}{%
+% \iftoggle{bbx:doi}%把doi的位置放到url后面
+% {\printfield{doi}}
+% {}%
+ %\newunit\newblock
+ \iftoggle{bbx:eprint}
+ {\iffieldundef{eprint}{}{\newunit\usebibmacro{eprint}}}%必须要做域判断否则容易产生多余的标点
+ {}%
+ %\newunit\newblock
+ \iftoggle{bbx:url}
+ {\usebibmacro{url+urldate}}
+ {}
+ \newunit\newblock
+ \iftoggle{bbx:doi}
+ {\printfield{doi}}
+ {}}
+
+%
+% 调整页码的格式,即chapter+pages格式
+%
+\renewbibmacro*{chapter+pages}{%
+\iftoggle{bbx:gbstrict}{}{%
+ \printfield{chapter}}%
+ \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出
+ \setunit{\bibpagespunct}%
+ \printfield{pages}}%
+ %\newunit %这里的标点去掉
+ }
+
+%
+% 当location等出版项超过maxitem缩减后不再输出etal
+%
+\DeclareListFormat{location}{%
+ \usebibmacro{list:delim}{#1}%
+ #1\isdot}
+\DeclareListAlias{institution}{location}
+\DeclareListAlias{publisher}{location}
+
+% 新增一个样式用于输出连续出版物的地址,单位,时间,
+% 用于periodical连续出版物的出版社和地址的处理
+%
+% v1.0k,20180425,为出版信息增加字体控制命令,hzz
+% %类似\newbibmacro*{publisher+location+date}
+\newbibmacro*{location+institution+date}{\bibpubfont%
+\iftoggle{bbx:gbpub}%
+{\testCJKfirst{userd}%
+\ifboolexpr{%
+test {\iflistundef{location}} and test {\iflistundef{institution}}%
+}{\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress}\space :\space\str at nopublisher]}%
+{\printtext{[S.l.\space :\space s.n.\adddot]}}%
+}{%
+\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress]}}{\printtext{[S.l.\adddot]}}}%
+ {\printlist{location}}%
+\addcolon\addspace%
+\iflistundef{institution}{%
+\iftoggle{ifCJKforgbt}{\printtext{[\str at nopublisher]}}{\printtext{\mkbibbrackets{s.n.}}}}% \bibstring{nopublisher}%[s.n.\adddot]
+{\printlist{institution}}}%
+\setunit{\addcomma\addspace}%
+ %\usebibmacro{date}%
+ \printfield{year}%
+ \bibrangedash%
+ \iffieldundef{endyear}{}{\printfield{endyear}}%
+ \newunit}%
+{ \printlist{location}%
+ \iflistundef{institution}%
+ {\setunit*{\addcomma\space}}
+ {\setunit*{\addcolon\space}}%
+ \printlist{institution}%
+ \setunit*{\addcomma\space}%
+ \usebibmacro{date}%
+ \newunit}%
+}
+%
+% 通用的出版社和地址的处理
+%
+% 原理方法:当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。
+% 事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。
+% 注意标准standard类型,因为当没有出版项时直接省略,所以做特殊处理
+\renewbibmacro*{publisher+location+date}{\bibpubfont%
+\iftoggle{bbx:gbpub}%
+{\testCJKfirst{userd}%
+ \ifboolexpr{ test {\iflistundef{location}} and test {\iflistundef{publisher}} }%
+ {\iffieldequalstr{note}{standard}{}{\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress}\space :\space\str at nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}%
+ {\iflistundef{location}{%\adddot
+ \iffieldequalstr{note}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。
+ {\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}}}% \bibstring{noaddress}
+ {\printlist{location}\addcolon\addspace}%%\addcolon\addspace%
+ \iflistundef{publisher}{%
+ \iffieldequalstr{note}{standard}{}%
+ {\iftoggle{ifCJKforgbt}{\printtext{[\str at nopublisher]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}%
+ {\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}}}%
+ {\printlist{publisher}}}%
+\setunit*{\addcomma\addspace}%\addcomma\addspace%
+\usebibmacro{date}%%\newunit %去掉这个标点
+}%
+{\printlist{location}%
+ \iflistundef{publisher}
+ {\setunit*{\addcomma\space}}
+ {\setunit*{\addcolon\space}}%
+ \printlist{publisher}%
+ \setunit*{\addcomma\space}%
+ \usebibmacro{date}%%\newunit
+ }%
+}
+
+%
+% 修改了一个institution+location+date用于manual、report、thesis等类型
+%
+% 20180425,v1.0k,增加了字体控制命令,hzz
+% 20190105,v1.0o,加了一个编组避免\usebibmacro{date}把month和day信息去掉
+\renewbibmacro*{institution+location+date}{\bibpubfont%当没有institution时不处理。
+{\printlist{location}%%加了一个编组避免\usebibmacro{date}把month和day信息去掉
+ \iflistundef{institution}
+ {\setunit*{\addcomma\space}}
+ {\setunit*{\addcolon\space}}%
+ \printlist{institution}%
+ \setunit*{\addcomma\space}%
+ \usebibmacro{date}%
+ %\newunit
+ }}
+
+%
+% 对volume卷信息格式做出修改
+% v1.0o,20190105,hzz
+%
+\DeclareFieldFormat{volume}{%
+\testCJKfirst{userd}%
+\iftoggle{ifCJKforgbt}%
+{\bibstring{serialcn}#1\bibstring{volumecn}}%
+{\bibstring{volume}~#1}%
+}% volume of a book
+\DeclareFieldFormat[article,periodical]{volume}{#1}% volume of a journal
+
+%
+% 对number册信息格式做出修改
+% v1.0o,20190105,hzz
+%
+\DeclareFieldFormat{number}{#1}%
+\DeclareFieldFormat[book,collection,inbook,%
+incollection,proceedings,inproceedings]{number}{%
+\testCJKfirst{userd}%
+\iftoggle{ifCJKforgbt}%
+{\bibstring{serialcn}#1\bibstring{numbercn}}%
+{#1}%
+}%
+
+%
+% 对edition版本信息格式做出修改
+%
+\DeclareFieldFormat{edition}{\bibtitlefont%源来自biblatex.DEF
+\testCJKfirst{userd}%
+\iftoggle{ifCJKforgbt}%
+{\ifinteger{#1}%
+{\printtext{#1\str at edition}}%
+{#1\isdot}}%
+{\ifinteger{#1}%
+{\mkbibordedition{#1}~\bibstring{edition}}%
+{#1\isdot}}}
+
+%
+% 对version的版本信息做出修改
+%
+\DeclareFieldFormat{version}{\bibtitlefont%源来自biblatex.DEF
+\testCJKfirst{userd}%
+ \ifinteger{#1}%
+ {\iftoggle{ifCJKforgbt}{\printtext{#1\str at edition}}%
+ {\mkbibordedition{#1}~\bibstring{version}}}%
+ {#1\isdot}}
+
+%
+% 作者域的输出控制宏
+%
+% 当两篇文献作者相同且连续时,标准样式是用-代替后面的文献的作者,这里取消这一设置
+\renewbibmacro*{author}{%author for biblatex version <=3.7
+ \ifboolexpr{
+ test \ifuseauthor
+ and
+ not test {\ifnameundef{author}}
+ }
+ {\usebibmacro{bbx:dashcheck}
+ {%\bibnamedash
+ \printnames{author}%
+ }%
+ {\usebibmacro{bbx:savehash}%
+ \printnames{author}%
+ \iffieldundef{authortype}
+ {\setunit{\addspace}}
+ {\setunit{\addcomma\space}}}%
+ \iffieldundef{authortype}
+ {}
+ {\usebibmacro{authorstrg}%
+ \setunit{\addspace}}}%
+ {\global\undef\bbx at lasthash
+ \usebibmacro{labeltitle}%
+ \setunit*{\addspace}}%
+ \setunit{\addcomma\space}%增加一个逗号
+ \usebibmacro{date+extrayear}
+ }
+
+%
+% 设置标注和文献表中作者和年份之间的分隔符
+%
+% 原理方法:注意3.4版已经有\nameyeardelim,上述修改的author宏虽然定义了著录表中的标点,但标注中的未定义
+% 设置因为mergedate默认为true时的情况,来自\bbx at opt@mergedate at compact
+% 去掉作者后面包围年份的圆括号
+% 这里因为biblatex版本的不同,做不同的处理,texlive2017版/2016等低版本分开处理
+\defversion{3.0}{dateextra}{
+\renewcommand*{\nameyeardelim}{\addcomma\space}
+ \renewbibmacro*{date+extrayear}{%%重设date+extrayear格式,源来自authoryear.BBX
+ \iffieldundef{\thefield{datelabelsource}year}
+ {}
+ {\printtext{%[parens]%这里把括号去掉
+ \iffieldsequal{year}{\thefield{datelabelsource}year}
+ {\printdateextralabel}%
+ {\printfield{labelyear}%
+ \printfield{extrayear}}}}}%
+ \newbibmacro{date+extradate}{\usebibmacro{date+extrayear}}
+}
+
+\defversion{3.4}{dateextra}{
+ \DeclareDelimFormat{nameyeardelim}{\addcomma\space}
+ \DeclareDelimFormat[bib,biblist]{nameyeardelim}{\addcomma\space}
+ \renewbibmacro*{date+extrayear}{%%重设date+extrayear格式,源来自authoryear.BBX
+ \iffieldundef{\thefield{datelabelsource}year}
+ {}
+ {\printtext{%[parens]%这里把括号去掉
+ \iffieldsequal{year}{\thefield{datelabelsource}year}
+ {\printdateextralabel}%
+ {\printfield{labelyear}%
+ \printfield{extrayear}}}}}%
+ \newbibmacro{date+extradate}{\usebibmacro{date+extrayear}}
+}
+\defversion{3.7}{dateextra}{
+ \DeclareDelimFormat{nameyeardelim}{\addcomma\space}
+ \DeclareDelimFormat[bib,biblist]{nameyeardelim}{\addcomma\space}
+ \renewbibmacro*{date+extrayear}{%以前的\printdateextralabel宏变为了\printlabeldateextra
+ \iffieldundef{labelyear}
+ {}
+ {\printtext{%[parens]
+ \iffieldsequal{year}{labelyear}
+ {\printlabeldateextra}%
+ {\printfield{labelyear}%
+ \printfield{extrayear}}}}}%
+
+\newbibmacro{date+extradate}{\usebibmacro{date+extrayear}}
+}
+\defversion{3.8}{dateextra}{
+ \DeclareDelimFormat{nameyeardelim}{\addcomma\space}
+ \DeclareDelimFormat[bib,biblist]{nameyeardelim}{\addcomma\space}
+%注意这里当没有作者只有标题时在年份之前的标点是否需要标准并未涉及,所以未做处理。
+\renewbibmacro*{author}{%以前的date+extrayear变为date+extradate,所以对3.8以上版本重定义一下author
+ \ifboolexpr{
+ test \ifuseauthor
+ and
+ not test {\ifnameundef{author}}
+ }
+ {\usebibmacro{bbx:dashcheck}
+ {%\bibnamedash %去掉相同作者用横线代替的处理
+ \printnames{author}\setunit{\printdelim{nameyeardelim}}%把标点也带上
+ }
+ {\usebibmacro{bbx:savehash}%
+ \printnames{author}%
+ \iffieldundef{authortype}
+ {\setunit{\printdelim{nameyeardelim}}}
+ {\setunit{\printdelim{authortypedelim}}}}%
+ \iffieldundef{authortype}
+ {}
+ {\usebibmacro{authorstrg}%
+ \setunit{\printdelim{nameyeardelim}}}}%
+ {\global\undef\bbx at lasthash
+ \usebibmacro{labeltitle}%
+ \setunit*{\printdelim{nonameyeardelim}}}%
+ \usebibmacro{date+extradate}}
+ \renewbibmacro*{date+extradate}{%
+ \iffieldundef{labelyear}
+ {}
+ {\printtext{%[parens]%这里去掉括号
+ \iflabeldateisdate
+ {\printdateextra}
+ {\printlabeldateextra}}}}%
+
+}
+
+
+%
+%为mergedate增加选项none,即实现年份不提前到作者后面的标签中
+%也不打印用于区分同作者同年份文献的标识符如(a,b,c)
+%目的是实现一些特殊的文献表样式比如ucas的作者年制
+%v1.0q,20190212,hzz
+\def\bbx at opt@mergedate at none{%
+ \renewbibmacro*{date+extradate}{%
+ \iffieldundef{labelyear}
+ {}
+ {}}%[parens]\printtext{\printlabeldateextra}
+\renewbibmacro*{bbx:ifmergeddate}{\@secondoftwo}%这一句用于3.12版本
+\renewbibmacro*{date}{\printdate}%这一句用于biblatex3.11以下版本
+\renewbibmacro*{issue+date}{%去掉括号
+\setunit{\addcomma\addspace}%
+ \printtext{%去掉了[parens]
+ \iffieldundef{issue}
+ {%\usebibmacro{date}
+ \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸
+ {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸
+ {\usebibmacro{date}}%
+ }}%
+ {\iftoggle{bbx:gbstrict}{}{\printfield{issue}%
+ \setunit*{\addspace}}%
+ %\usebibmacro{date}
+ \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸
+ {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸
+ {\usebibmacro{date}}%
+ }}}%
+ %\newunit
+ }%
+ }
+
+\iftoggle{iftlfive}{\switchversion{3.0}{dateextra}}{}%biblatex<=3.2
+\iftoggle{iftlsix}{\switchversion{3.4}{dateextra}}{}%3.3<=biblatex<=3.6
+\iftoggle{iftlseven}{\switchversion{3.7}{dateextra}}{}%biblatex=3.7
+\iftoggle{iftleight}{\switchversion{3.8}{dateextra}}{}%<=3.8biblatex<=3.9
+\iftoggle{iftlnine}{\switchversion{3.8}{dateextra}}{}%biblatex3.10
+\iftoggle{iftlatest}{\switchversion{3.8}{dateextra}}{}%biblatex最新3.11
+
+%
+% 修改析出文献的文集的标题与附加标题间的符号
+%
+\renewbibmacro*{booktitle}{%
+ \ifboolexpr{
+ test {\iffieldundef{booktitle}}
+ and
+ test {\iffieldundef{booksubtitle}}
+ }
+ {}
+ {\printtext[booktitle]{\bibtitlefont%
+ \printfield[titlecase]{booktitle}%
+ \setunit{\subtitlepunct}%
+ \printfield[titlecase]{booksubtitle}}%
+ \newunit%标点换成下一句
+ \setunit{\subtitlepunct}}%
+ \printfield{booktitleaddon}}
+
+%
+% 调整期刊名的格式
+%
+% 原理方法:因为作者年制年份提到前面,因此涉及到期刊名与后面的卷期的关系。
+% v1.0k,20180425,增加了字体控制命令,hzz
+\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx
+ \usebibmacro{journal}%
+ %\setunit*{\addspace}%
+ %\setunit*{\addcomma\addspace}%修改为增加一个逗号
+ \iffieldundef{series}%
+ {}%
+ {\newunit%
+ \printfield{series}%
+ \setunit{\addspace}}%
+ %\usebibmacro{volume+number+eid}%
+ %\setunit{\addspace}%
+ \usebibmacro{issue+date}%
+ %\setunit{\addcolon\space}%
+ \iffieldundef{volume}{}{\setunit{\addcomma\space}}%
+ %换成逗号和空格
+ \usebibmacro{issue}%
+ \usebibmacro{volume+number+eid}%把卷期放到年份后面
+ %\newunit
+ }
+
+%
+% 增加一个number带括号的格式,避免使用mkbibparens而引入一个不必要的空格
+%
+\DeclareFieldFormat{addnumflag}{%
+\nobreak\printtext{(}\nobreak #1\nobreak\printtext{)}}
+
+%
+% 调整journal输出
+%
+% 原理方法:首先判断子标题,然后再设置标点。
+% 避免直接设置标点后,当volume不存在时需要使用\nopuct去标点进而引入不必要的空格
+\renewbibmacro*{journal}{%
+ \iffieldundef{journaltitle}%
+ {}%
+ {\printtext[journaltitle]{%
+ \printfield[titlecase]{journaltitle}%
+ \iffieldundef{journalsubtitle}{}{\setunit{\subtitlepunct}%
+ \printfield[titlecase]{journalsubtitle}}}}}
+
+
+
+%
+% 调整期刊卷和期的格式
+%
+\renewbibmacro*{volume+number+eid}{%源来自standard.bbx
+\iftoggle{bbx:gbfieldstd}{%
+ \printfield{volume}%
+ \setunit*{\adddot}%
+ \printfield{number}%
+ \setunit{\addcomma\space}%
+ \printfield{eid}}{%
+ \printfield{volume}%
+ %\setunit*{\adddot}%去掉点号
+ %\printfield{number}%
+ \iffieldundef{number}{}{\printfield[addnumflag]{number}}%区别于顺序编码制
+ \iffieldundef{eid}{}{%
+ \setunit{\addcomma\space}%
+ \printfield{eid}}}}
+
+%
+% 调整期刊年份的格式
+%
+% 原理方法:原在authoryear.BBX中\bbx at opt@mergedate at compact中定义
+% 当issue存在时,才设置newunit。避免直接设置标点后,当volume不存在是需要使用\nopuct去标点进而引入不必要的空格
+ \renewbibmacro*{issue+date}{%
+ \iffieldundef{issue}%
+ {}%
+ {\iftoggle{bbx:gbstrict}{}{\printtext[parens]{\printfield{issue}}\newunit}}}
+
+
+
+%
+% 调整页码前的标点和去掉期刊文章等页码后面的标点
+%
+\renewbibmacro*{note+pages}{%源来自standard.bbx
+ %\printfield{note}%不要note,note用来判断是否是报纸newspaper
+ \iffieldundef{pages}{}{
+ \setunit{\bibpagespunct}%
+ \printfield{pages}}%
+ %\newunit
+ }
+
+%
+% 编者的符号修改一下
+% v1.0 2016-07-01
+% v1.0q 2019-03-01 hzz 修改editortype前的标点
+%
+\renewbibmacro*{editor}{%
+ \ifboolexpr{
+ test \ifuseeditor
+ and
+ not test {\ifnameundef{editor}}
+ }
+ {\usebibmacro{bbx:dashcheck}
+ {%\bibnamedash
+ \printnames{editor}%
+ }
+ {\printnames{editor}%
+ %\setunit{\printdelim{editortypedelim}}%
+ %\usebibmacro{bbx:savehash}
+ }%
+ \usebibmacro{editorstrg}%
+ %\clearname{editor}%
+ \setunit{\printdelim{nameyeardelim}}}%
+ {\global\undef\bbx at lasthash
+ \usebibmacro{labeltitle}%
+ \setunit*{\printdelim{nonameyeardelim}}}%
+ \ifboolexpr{%
+test {\ifentrytype{inbook}}
+or
+test {\ifentrytype{incollection}}
+or
+test {\ifentrytype{inproceedings}}
+or
+test {\ifentrytype{conference}}
+}%
+{}%
+{\usebibmacro{date+extradate}}}
+
+%
+% 编者类型做一修改
+% v1.0 2016-07-01
+% v1.0q 2019-03-01 hzz 修改editortype不同语言的不同本地化字符串
+%
+\renewbibmacro*{editorstrg}{%源来自biblatex.DEF
+ \printtext[editortype]{%
+ \iffieldundef{editortype}
+ {%
+% \ifboolexpr{ %这一段去掉,未定义编者类型情况下不处理
+% test {\ifnumgreater{\value{editor}}{1}}
+% or
+% test {\ifandothers{editor}}
+% }
+% {\bibstring{editors}}
+% {\bibstring{editor}}
+ }
+ {\ifbibxstring{\thefield{editortype}} %定义编者类型情况下处理,以后根据需要修改
+ {\ifboolexpr{
+ test {\ifnumgreater{\value{editor}}{1}}
+ or
+ test {\ifandothers{editor}}
+ }
+ {\printdelim{streditortypes}}
+ {\printdelim{streditortype}}}
+ {\thefield{editortype}}}%
+ }}
+
+%
+% 编者类型的本地化字符串输出
+% v1.0q 2019-03-01 hzz
+% 能对不同条目类型作格式设置的域格式,能对不同环境做格式设置的分隔符
+% 能对不同文境作设置的包括排序,标签等
+% 这里因为考虑可能标注和文献表中存在不同,所以用分隔符来输出本地化字符串
+%
+\DeclareDelimFormat{streditortypes}{%
+ \edef\userfieldabcde{userd}%
+ \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
+ \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbbiblocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}scn}}{}%
+ \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}skr}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}sjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}%
+ \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}%
+ \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}%
+ \or%
+ \bibstring{\thefield{editortype}scn}%
+ \or%
+ \addcomma\addthinspace\bibstring{\thefield{editortype}s}%
+ \fi}
+%
+\DeclareDelimFormat{streditortype}{%
+ \edef\userfieldabcde{userd}%
+ \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
+ \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbbiblocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}cn}}{}%
+ \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}kr}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}jp}}{}%
+ \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}%
+ \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}%
+ \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}%
+ \or%
+ \bibstring{\thefield{editortype}cn}%
+ \or%
+ \addcomma\addthinspace\bibstring{\thefield{editortype}}%
+ \fi}
+
+
+%
+% bookauthor域的输出,
+% v1.0q 2019-03-01 hzz
+% 不再对editor和bookauthor做sourcemap,而是下面的宏内逻辑代替,
+% 使得除使用bookauthor外也可以使用editor,便于在使用editor时使用editortype
+\renewbibmacro*{bybookauthor}{%
+ \ifnameundef{bookauthor}%
+ {\ifnameundef{editor}%
+ {}%
+ {\ifnamesequal{author}{editor}%
+ {}{\usebibmacro{editor}}}%
+ }%
+ {\ifnamesequal{author}{bookauthor}%
+ {}{\printnames{bookauthor}}%
+ }%
+}
+
+%
+% 修改期刊的标题
+%
+\renewbibmacro*{periodical}{%源来自biblatex.DEF
+ \iffieldundef{title}
+ {}
+ {\printtext[title]{\bibtitlefont%
+ \printfield[titlecase]{title}%
+ %\setunit{\subtitlepunct}%
+ \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
+ {}{\setunit{\subtitlepunct}
+ \printfield[titlecase]{subtitle}}%
+ %}%把编组结束移到后面去
+ \iftoggle{bbx:gbtype}{%
+ \iffieldundef{usera}{}{%在标题后直接给出文献标识字母
+ \printfield[gbtypeflag]{usera}}}{}
+ }}
+ }
+
+%
+% 期刊的标题做修改
+%
+\renewbibmacro*{title+issuetitle}{%源来自standard.BBX
+ \usebibmacro{periodical}%
+ %\setunit*{\addspace}%
+ \setunit*{\adddot\addspace}%标点修改为句点
+ \iffieldundef{series}
+ {}
+ {\newunit
+ \printfield{series}%
+ \setunit{\addspace}}%
+ \usebibmacro{periodical+issue}%将issue调整到上面来,并修改
+\iffieldundef{number}{}{%%进一步处理有范围的数字
+ \multinumberparser{\thefield{number}}}%
+ \iffieldundef{volume}%
+ {\printfield{year}%
+ \printtext{\mkbibparens{\multinumberfirst}}%
+ \bibrangedash%
+ \iffieldundef{endyear}{}{\printfield{endyear}\printtext{\mkbibparens{\multinumbersecond}}}%
+ }%
+ {\multivolparser{\thefield{volume}}%
+ \printfield{year}%
+ \setunit{\addcomma\space}%将冒号修改为逗号
+ \printtext{\multivolfirst}%
+ \printtext{\mkbibparens{\multinumberfirst}}%
+ \bibrangedash%
+ \iffieldundef{endyear}{}{%
+ \printfield{endyear}%
+ \setunit{\addcomma\space}%将冒号修改为逗号
+ \printtext{\multivolsecond}%
+ \printtext{\mkbibparens{\multinumbersecond}}}%
+ }%
+ \setunit{\addcomma\space}%
+ \printfield{eid}%
+ \setunit{\addspace}%
+ %\usebibmacro{issue+date}%
+ %\setunit{\addcolon\space}%
+ \usebibmacro{issue}%
+ \newunit}
+
+%
+% 新增一个样式用于调整期刊年份的格式,只打印年份
+%
+\newbibmacro*{periodical+issue}{%
+ \printtext{%去掉了[parens]
+ \iffieldundef{issue}
+ {%\usebibmacro{date}%修改为下一句
+ }%
+ {\printfield{issue}%
+ \setunit*{\addspace}%
+ %\usebibmacro{date}%修改为下一句
+ }%
+ }%
+ %\newunit
+}
+
+%
+% 重设专利title的输出,将文献类型标识符输出出去
+%
+\newbibmacro*{patenttitle}{%原输出来自biblatex.def文件
+ \ifboolexpr{%
+ test{\iffieldundef{title}}%
+ and%
+ test{\iffieldundef{subtitle}}%
+ }%
+ {}%
+ {\printtext[title]{\bibtitlefont%
+ \printfield[titlecase]{title}%
+ \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
+ {}{\setunit{\subtitlepunct}%
+ \printfield[titlecase]{subtitle}}%
+ \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
+ {\setunit{\subtitlepunct}\printfield{titleaddon}}%
+ \setunit{\subtitlepunct}\printfield{number}%写专利号
+ \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}%
+ %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
+ %\newunit
+ }%
+}%
+}
+
+
+
+%
+% 修改in:用于inbook、incollection、inproceedings等类型
+% 2018.04.20,v1.0k,renewed marco,by hzz
+% 20190212,v1.0q,增加中英文区分,by hzz
+%
+% 原理方法:使用bibmacro{in:}改变了以前在driver中直接输出//的方式,同时也简化了标点控制。
+\renewbibmacro*{in:}{%
+ \iftoggle{bbx:gbpunctin}{\printtext{\allowbreak\texttt{//}\allowbreak}}%\addthinspace
+ {\setunit{\adddot\addspace}%
+ \iffieldequalstr{userd}{chinese}%
+ {\printtext{\bibstring{incn}}}%
+ {\printtext{\bibstring{in}}}%
+ }}%\newunit\newblock\intitlepunct
+
+%
+% 修改type域的输出格式
+% 2019.02.12,v1.0q,byhzz
+% 使其可以区分中英文输出不同的格式,比如博士论文英文输出PHD thesis,中文则是博士学位论文
+\DeclareFieldFormat{type}%
+{\iffieldequalstr{userd}{chinese}%
+ {\ifbibxstring{#1cn}{\bibxstring{#1cn}}{#1}}%
+ {\ifbibstring{#1}{\bibstring{#1}}{#1}}%
+}
+
+
+%
+% 修改series域的输出格式
+% 2019.05.01,v1.0r,byhzz
+\renewbibmacro*{series+number}{%
+ \printfield{series}%
+ %\setunit*{\addspace}%
+ %\printfield{number}%
+ %\newunit
+ }
+
+%=====================================================================
+%设置驱动格式
+%=====================================================================
+%
+% book条目类的驱动
+%
+ \DeclareBibliographyDriver{book}{%源来自standard.bbx文件
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+\usebibmacro{author/editor+others/translator+others}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+\usebibmacro{maintitle+title}%
+\iftoggle{bbx:gbstrict}{}{%
+\newunit
+\printlist{language}%
+\newunit\newblock%
+\usebibmacro{byauthor}%
+\newunit\newblock}%
+\usebibmacro{byeditor+others}%
+\newunit
+\printfield{edition}%
+\newunit\newblock%%
+\iftoggle{bbx:gbstrict}{}{%
+\iffieldundef{maintitle}%
+{\printfield{volume}%
+\printfield{part}}%
+{}%
+\newunit%
+\printfield{volumes}%
+\newunit\newblock%
+\usebibmacro{series+number}}%
+\newunit\newblock%
+%\printfield{note}%
+%\newunit\newblock%
+\usebibmacro{publisher+location+date}%
+%\newunit\newblock %这里标点去掉
+\usebibmacro{chapter+pages}%
+ \iffieldundef{url}{}{%当没有网址时也不输出
+ \usebibmacro{modifydate}}%带括号的修改或更新日期,
+\usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。
+ \newunit\newblock%
+ \printfield{pagetotal}%
+ \newunit\newblock%
+ \iftoggle{bbx:isbn}
+ {\printfield{isbn}}
+ {}%
+ \newunit\newblock
+ %\usebibmacro{doi+eprint+url}%
+ %\newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+
+
+
+%
+% 期刊文章,连续出版物中的析出文献的格式
+%
+ \DeclareBibliographyDriver{article}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/translator+others}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ \usebibmacro{title}%
+ \iftoggle{bbx:gbstrict}{}{%
+ \newunit%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}%
+ \newunit\newblock
+ \usebibmacro{bytranslator+others}%
+ \newunit\newblock
+ \printfield{version}}%
+ \newunit\newblock
+ %\usebibmacro{in:}% 不使用in来表示期刊等连续出版物
+ \usebibmacro{journal+issuetitle}%
+% \newunit
+% \usebibmacro{byeditor+others}%
+% \newunit
+ \usebibmacro{note+pages}%
+ \iffieldequalstr{note}{news}{}{%当是新闻时不输出修改或更新日期
+ \iffieldundef{url}{}{%当没有网址时也不输出
+ \iftoggle{bbx:url}{%当url选项为false时,也不输出
+ \usebibmacro{modifydate}}{}}}%带括号的修改或更新日期,
+ \usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置
+ \newunit\newblock
+ \iftoggle{bbx:isbn}
+ {\printfield{issn}}
+ {}%
+ \newunit\newblock
+ %\usebibmacro{doi+eprint+url}%
+ %\newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+
+%
+% 连续出版物的驱动
+%
+ \DeclareBibliographyDriver{periodical}{%源来自standard.BBX
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{editor}%
+ %\setunit{\labelnamepunct}\newblock
+ \newunit\newblock %删除上面一行,添加这一行
+ \usebibmacro{title+issuetitle}%
+ \newunit\newblock%
+ \usebibmacro{location+institution+date}%添加这一行用于输出地址,单位和时间
+ \newunit\newblock%添加这一行
+ \iftoggle{bbx:gbstrict}{}{%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byeditor}%
+ \newunit\newblock
+ \printfield{note}%
+ \newunit\newblock}
+ \iftoggle{bbx:isbn}
+ {\printfield{issn}}
+ {}%
+ \newunit\newblock
+ \usebibmacro{doi+eprint+url}%
+ \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+%
+% 专利文献驱动
+%
+ \DeclareBibliographyDriver{patent}{%源来自standard.BBX
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ %\usebibmacro{title}%
+ \usebibmacro{patenttitle}%给出专利专用的标题输出
+ \iftoggle{bbx:gbstrict}{}{%
+ \newunit%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}}%
+ \newunit\newblock
+ \printfield{type}%
+ \setunit*{\addspace}%
+ %\printfield{number}%已放到patenttitle中处理
+ \iflistundef{location}
+ {}
+ {\setunit*{\addspace}%
+ \printtext{%[parens]
+ \printlist[][-\value{listtotal}]{location}}}%
+ \newunit\newblock
+ \usebibmacro{byholder}%
+ \newunit\newblock
+ \printfield{note}%
+ \newunit\newblock
+ \usebibmacro{newsdate}%
+ %\newunit\newblock
+ \usebibmacro{doi+eprint+url}%
+ \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+
+%
+% 在线文献驱动
+%
+\DeclareBibliographyDriver{online}{%源来自standard.BBX
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/editor+others/translator+others}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ \usebibmacro{title}%
+ \iftoggle{bbx:gbstrict}{}{%
+ \newunit%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}%
+ \newunit\newblock
+ \usebibmacro{byeditor+others}%
+ \newunit\newblock
+ \printfield{note}}%
+ \newunit
+ \printfield{version}%
+ \newunit\newblock
+% \printlist{organization}%
+ \printlist{institution}%
+ \newunit\newblock
+\ifboolexpr{%
+test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
+}{\usebibmacro{date}}%
+{\usebibmacro{modifydate}}%修改或更新日期,为带括号的时间
+ \usebibmacro{url+urldate}%从下面移上来
+ \newunit\newblock
+ \iftoggle{bbx:eprint}
+ {\usebibmacro{eprint}}
+ {}%
+ \newunit\newblock
+ %\usebibmacro{url+urldate}%
+ %\newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+
+
+
+%
+% 报告类型驱动
+% 当有网址无出版项时,用online输出
+%
+\DeclareBibliographyDriver{report}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ \usebibmacro{title}%
+ \iftoggle{bbx:gbstrict}{}{%
+ \newunit%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}}%
+ \newunit\newblock
+ \usebibmacro{byeditor+others}%增加的译者信息
+ \newunit\newblock
+ \printfield{type}%
+ \setunit*{\addspace}%
+ \printfield{number}%
+ \newunit\newblock
+ \printfield{version}%
+ \newunit
+ \printfield{note}%
+ \newunit\newblock
+ \usebibmacro{publisher+location+date}%
+ %\newunit\newblock
+ \usebibmacro{chapter+pages}%
+ \usebibmacro{doi+eprint+url}%
+ \newunit
+ \printfield{pagetotal}%
+ \newunit\newblock
+ \iftoggle{bbx:isbn}
+ {\printfield{isrn}}
+ {}%
+ \newunit\newblock
+% \usebibmacro{doi+eprint+url}%
+% \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+%
+% 论文、手册类型驱动
+% 2016-11-11,增加了译者信息
+%
+\DeclareBibliographyDriver{manual}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ \usebibmacro{title}%
+ \iftoggle{bbx:gbstrict}{}{%
+ \newunit%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}}%
+ \newunit\newblock
+ \usebibmacro{byeditor+others}%增加的译者信息
+ \newunit\newblock
+ \iftoggle{bbx:gbfieldtype}{%
+ \printfield{type}%
+ \setunit*{\addspace}%
+ }{}%
+ \printfield{number}%
+ \newunit\newblock
+ \printfield{version}%
+ \newunit
+ \printfield{note}%
+ \newunit\newblock
+ \usebibmacro{institution+location+date}%
+ %\newunit\newblock
+ \usebibmacro{chapter+pages}%
+ \iffieldundef{url}{}{%当没有网址时也不输出修改或更新日期
+ \usebibmacro{modifydate}}%修改或更新日期为带括号的时间
+ \usebibmacro{doi+eprint+url}%
+ \newunit
+ \printfield{pagetotal}%
+ \newunit\newblock
+ \iftoggle{bbx:isbn}
+ {\printfield{isrn}}
+ {}%
+ \newunit\newblock
+% \usebibmacro{doi+eprint+url}%
+% \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+%
+% 备选类型驱动
+%
+% 利用biblatex的misc驱动
+\DeclareBibliographyDriver{misc}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/editor+others/translator+others}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ \usebibmacro{title}%
+\iftoggle{bbx:gbstrict}{}{%
+ \newunit
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}%
+ \newunit\newblock
+ \usebibmacro{byeditor+others}}%
+ \newunit\newblock
+ \printfield{howpublished}%
+ \newunit\newblock
+ \printfield{type}%
+ \newunit
+ \printfield{version}%
+ \newunit
+ \printfield{note}%
+ \newunit\newblock
+ \usebibmacro{institution+location+date}%
+ %\usebibmacro{organization+location+date}%
+ %\newunit\newblock
+ \usebibmacro{doi+eprint+url}%
+ \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+
+
+
+
+%
+% 专著中的析出文献的格式修改
+%
+\DeclareBibliographyDriver{inbook}{%源来自standard.bbx
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/translator+others}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+\usebibmacro{title}%
+\usebibmacro{in:}%
+%\printtext{\texttt{//}\addthinspace}%
+ \usebibmacro{bybookauthor}%
+ \ifnameundef{bookauthor}{%
+ \ifnameundef{editor}{}{\newunit}%
+ }{\newunit}%替换下一句
+ %\newunit\newblock
+\iffieldundef{series}{}{\usebibmacro{series+number}\setunit{\addcolon\addspace}}%为处理一些存在series的情况而增加
+ \usebibmacro{maintitle+booktitle}%
+\iffieldundef{volume}{}{\setunit{\addcolon\addspace}\printfield{volume}}%
+\iffieldundef{number}{}{\setunit{\addcolon\addspace}\printfield{number}}%增加卷和册信息
+ \newunit\newblock%
+% \usebibmacro{byeditor+others}%
+% \newunit\newblock
+ \printfield{edition}%
+ \newunit
+ \iftoggle{bbx:gbstrict}{}{%
+% \iffieldundef{maintitle}
+% {\printfield{volume}%
+% \printfield{part}}
+% {}%
+% \newunit
+% \printfield{volumes}%
+% \newunit\newblock
+% \usebibmacro{series+number}
+ }%
+ \newunit\newblock
+ %\printfield{note}%
+ %\newunit\newblock
+ \usebibmacro{publisher+location+date}%
+ %\newunit\newblock
+ \usebibmacro{chapter+pages}%
+ %\newunit\newblock
+ \usebibmacro{doi+eprint+url}%移到上面来
+ \newunit\newblock
+ \iftoggle{bbx:isbn}
+ {\printfield{isbn}}
+ {}%
+ \newunit\newblock
+% \usebibmacro{doi+eprint+url}%
+% \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
Modified: trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.cbx
===================================================================
--- trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.cbx 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.cbx 2021-01-19 22:57:40 UTC (rev 57468)
@@ -1,345 +1,429 @@
-%%
-%% ---------------------------------------------------------------
-%% biblatex-gb7714-2015 --- A biblatex implementation of the
-%% GBT7714-2015 citation style,author year sequence
-%% Maintained by huzhenzhen
-%% E-mail: hzzmail at 163.com
-%% Released under the LaTeX Project Public License v1.3c or later
-%% ---------------------------------------------------------------
-%%
-\def\versionofgbtstyle{2020/07/21 v1.0v}
-\ProvidesFile{gb7714-2015ay.cbx}[\versionofgbtstyle biblatex citation style]
-
-%
-% 加载标准样式
-%
-\RequireCitationStyle{authoryear-comp}
-
-\ExecuteBibliographyOptions{
- %autocite = superscript ,
- %autopunct = true ,
- %sorting = none ,
- maxcitenames=1,
- mincitenames=1,
- uniquename=init,%因为使用了名字缩写选项,所以需要设置uniquename=init而不是full避免冲突
- uniquelist=minyear
-}
-
-%
-% 选项设置,针对3.7以下版本
-%
-% 原理方法:labeldate用于控制是否给引用标签提供日期的成分
-\defversion{3.4}{cbxopt}{
- \ExecuteBibliographyOptions{
- labeldate=true
- }
-}
-
-%
-% 选项设置,针对3.7以上版本
-%
-% 原理方法:labeldateparts用于控制是否给引用标签提供日期的成分
-\defversion{3.7}{cbxopt}{
- \ExecuteBibliographyOptions{
- labeldateparts=true
- }
-}
-
-\ifboolexpr{%选择选项设置
-test {\iftoggle{iftlfive}}%biblatex<=3.2
-or
-test {\iftoggle{iftlsix}}%3.3<=biblatex<=3.6
-}{\switchversion{3.4}{cbxopt}}{\switchversion{3.7}{cbxopt}}%else: biblatex>=3.7
-
-
-\ifboolexpr{%兼容cite:labelyear+extrayear
-test {\iftoggle{iftlfive}}%biblatex<=3.2
-or
-test {\iftoggle{iftlsix}}%3.3<=biblatex<=3.6
-or
-test {\iftoggle{iftlseven}}%3.7=biblatex
-}{\newbibmacro{cite:labeldate+extradate}{\usebibmacro{cite:labelyear+extrayear}}}{}%else: biblatex>3.7
-
-%textcite标注命令中的标点设置,注意只针对textcite命令。
-% v-old
-% v1.0t,20200320,hzz,修改如下
-% 在cbx中增加标注中的nameyeardelim标点定义,避免bbx使用其它样式时出现问题
-% 同时设置textcite的nameyeardelim为一个短空格,似乎原来直接连上去的不够美观
-\DeclareDelimFormat[cite,parencite,pagescite]{nameyeardelim}{\addcomma\space}%\addcomma\space
-\DeclareDelimFormat[textcite]{nameyeardelim}{\addthinspace}%\addcomma\space
-\DeclareDelimFormat[textcite]{andothersdelim}{\iffieldequalstr{userf}{chinese}{\addthinspace}{\addspace}}%
-\AtEveryCitekey{%
-\iffieldequalstr{userf}{chinese}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace
- {\renewcommand*{\andothersdelim}{\addspace}}%
-}
-
-
-%
-% 重定义cite:label,针对biblatex3.8以上版本set条目集的标注(引用)标签
-%
-% 原理方法:当条目是set时,v3.8以上版本,都没有有用的信息(区别于3.7以下版本set复制第一个成员的信息),
-% 于是利用entrykey来给出标签,那么就要set的条目关键字是需要的字符串,注意字符串中间不能有空格
-\renewbibmacro*{cite:label}{%
- \iffieldundef{label}%
- {\iffieldundef{labeltitle}{\printtext[bibhyperref]{\printfield{entrykey}}}%entrykey
- {\printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}}%
- {\printtext[bibhyperref]{\printfield{label}}}}
-
-%
-% 重定义cite命令
-%
-% 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode}
-% v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式
-\DeclareCiteCommand{\cite}
- {\usebibmacro{cite:init}%
- \renewbibmacro*{postnote}{%
- \iffieldundef{postnote}%
- {}%
- {\thefield{postnote}}}%
- (\usebibmacro{prenote}}%)
- {\usebibmacro{citeindex}%
- \usebibmacro{cite}}
- {}
- {%(
- )\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote}
- }
-
-%
-% 定义upcite命令
-% 20180604,v1.0l,hzz
-% 20190409,v1.0r,hzz
-% 方法:与cite命令相同
-\newrobustcmd*{\upcite}{%
- \cite}
-
-%
-% 重定义parencite命令
-%
-%\DeclareCiteCommand{\parencite}
-% {\usebibmacro{cite:init}%
-% \renewbibmacro*{postnote}{%
-% \iffieldundef{postnote}%
-% {}%
-% {\nopunct%
-% \printfield{postnote}}}%
-% (\usebibmacro{prenote}}%)
-% {\usebibmacro{citeindex}%
-% \usebibmacro{cite}}
-% {}
-% {%(
-% )\mkbibsuperscript{\usebibmacro{postnote}}}
-
-
-%
-% 新定义pagescite命令,以满足标签带页码的国标要求
-%
-% 原理方法:
-% 新增\pagescite引用命令
-\DeclareCiteCommand{\pagescite}
- {\usebibmacro{cite:init}%
- \renewbibmacro*{postnote}{%
- \iffieldundef{postnote}%
- {\thefield{pages}}%
- {\thefield{postnote}}}%
- (\usebibmacro{prenote}%)
- }%
- {\usebibmacro{citeindex}%
- \usebibmacro{cite}}
- {}
- {%(
- )\mkbibsuperscript{\usebibmacro{postnote}}}
-
-%
-% 定义yearpagescite,用于当文中作者已经存在,需要页码和年份的情况
-%
-% 原理:增加一个命令yearpagescite
-% 参考biblatex.DEF中的\DeclareCiteCommand*{\citeyear}命令
-\DeclareCiteCommand{\yearpagescite}
- {\usebibmacro{cite:init}%
- \renewbibmacro*{postnote}{%
- \iffieldundef{postnote}%
- {\thefield{pages}}%
- {\thefield{postnote}}}%
- \printtext{(}\usebibmacro{prenote}}%
- {\usebibmacro{cite:labeldate+extradate}}%\printfield{year}\printfield{extrayear}
- {\multicitedelim}%
- {\printtext{)}\textsuperscript{\usebibmacro{postnote}}}
-
-%
-% 定义yearcite,用于当文中作者已经存在,仅需要年份的情况
-%
-% 原理:增加一个命令yearcite
-\DeclareCiteCommand{\yearcite}%仅输出年份,不要页码
- {\usebibmacro{cite:init}%
- \printtext{(}\usebibmacro{prenote}}%
- {\usebibmacro{cite:labeldate+extradate}}%\printfield{year}\printfield{extrayear}
- {\multicitedelim}%
- {\printtext{)}}
-
-%
-% 定义\authornumcite命令,输出作者信息,然后在后面带上顺序编码
-% 20180427,v1.0k,增加,hzz
-% 20190409,v1.0r,hzz
-% 为与顺序编码制兼容,增加了命令,定义与citet相同
-\newbibmacro*{citeta}{%
- \iffieldundef{shorthand}
- {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
- {\usebibmacro{cite:label}%
- \setunit{\printdelim{nonameyeardelim}}%
- \usebibmacro{cite:labeldate+extradate}%
- \usebibmacro{cite:reinit}}
- {\iffieldequals{namehash}{\cbx at lasthash}
- {\ifthenelse{\iffieldequals{labelyear}{\cbx at lastyear}\AND
- \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
- {\setunit{\addcomma}%
- \usebibmacro{cite:extradate}}
- {\setunit{\compcitedelim}%
- \usebibmacro{cite:labeldate+extradate}%
- \savefield{labelyear}{\cbx at lastyear}}}
- {\printnames{labelname}%
- %\setunit{\printdelim{nameyeardelim}}%
- (\usebibmacro{cite:labeldate+extradate})%
- \savefield{namehash}{\cbx at lasthash}%
- \savefield{labelyear}{\cbx at lastyear}}}}
- {\usebibmacro{cite:shorthand}%
- \usebibmacro{cite:reinit}}%
- \setunit{\multicitedelim}}
-
-\DeclareCiteCommand{\authornumcite}%
- {\usebibmacro{cite:init}%
- \renewbibmacro*{postnote}{%
- \iffieldundef{postnote}%
- {}%
- {\thefield{postnote}}}%
- \usebibmacro{prenote}}%
- {\usebibmacro{citeindex}%
- \usebibmacro{citeta}}
- {}
- {\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote}
- }
-
-%
-% 增加如下多个命令
-% 20190409,v1.0r,hzz
-% 方法:利用newcommand或newrobustcmd命令进行定义
-% 注意\citet和\citep命令之所以不用newrobustcmd,是为避免加载natbib模块后产生冲突
-
-%同\authornumcite
-%\DeclareCiteCommand{\citet}%
-% {\usebibmacro{cite:init}%
-% \renewbibmacro*{postnote}{%
-% \iffieldundef{postnote}%
-% {}%
-% {\thefield{postnote}}}%
-% \usebibmacro{prenote}}%
-% {\usebibmacro{citeindex}%
-% \usebibmacro{citet}}
-% {}
-% {%(
-% )\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote}
-% }
-
-
-%
-% 重定义citet,因为前面与\authornumcite同定义的命令无法正确处理多个bibtexkey同时给出的压缩情况
-% 20200721,v1.0v,hzz
-% 方法:利用textcite命令进行定义
-% 基本利用textcite命令来写citet,仅利用bool{cbx:incitet}做判断,进而处理不同的页码形式
-\newbool{cbx:incitet}
-\newbibmacro*{citet:postnote}{%
- \ifthenelse{\value{multicitecount}=\value{multicitetotal}}
- {\setunit{}%
- \printtext{%
- \ifbool{cbx:parens}
- {\bibcloseparen\global\boolfalse{cbx:parens}}
- {}}}
- {\setunit{%
- \ifbool{cbx:parens}
- {\bibcloseparen\global\boolfalse{cbx:parens}}
- {}%
- \textcitedelim}}%
- \renewbibmacro*{postnote}{%
- \iffieldundef{postnote}%
- {}%
- {\thefield{postnote}}}%
- \mkbibsuperscript{\usebibmacro{postnote}}%
- }
-
-\DeclareCiteCommand{\cbx at textcite}
- {\usebibmacro{cite:init}}
- {\usebibmacro{citeindex}%
- \usebibmacro{textcite}}
- {}
- {\ifbool{cbx:incitet}{\usebibmacro{citet:postnote}}{\usebibmacro{textcite:postnote}}}
-
- \newrobustcmd{\cbx at citet@init}[2]{%
- \global\booltrue{cbx:incitet}%
- \setcounter{textcitetotal}{0}%
- \setcounter{textcitecount}{0}%
- \def\cbx at savedcites{#1}#2\cbx at savedcites\empty}
-
- \renewrobustcmd{\cbx at textcite@init}[2]{%
- \global\boolfalse{cbx:incitet}%
- \setcounter{textcitetotal}{0}%
- \setcounter{textcitecount}{0}%
- \def\cbx at savedcites{#1}#2\cbx at savedcites\empty}
-
-\DeclareCiteCommand{\citet}[\cbx at citet@init\cbx at textcite]
- {\gdef\cbx at savedkeys{}%
- \citetrackerfalse%
- \pagetrackerfalse%
- \DeferNextCitekeyHook%
- \usebibmacro{cite:init}}
- {\ifthenelse{\iffirstcitekey\AND\value{multicitetotal}>0}
- {\protected at xappto\cbx at savedcites{()(\thefield{multipostnote})}%
- \global\clearfield{multipostnote}}
- {}%
- \xappto\cbx at savedkeys{\thefield{entrykey},}%
- \iffieldequals{namehash}{\cbx at lasthash}
- {}
- {\stepcounter{textcitetotal}%
- \savefield{namehash}{\cbx at lasthash}}}
- {}
- {\protected at xappto\cbx at savedcites{%
- [\thefield{prenote}][\thefield{postnote}]{\cbx at savedkeys}}}
-
-\let\cbx at citets@init\cbx at citet@init
-\pretocmd{\cbx at citets@init}{\UseNextMultiCiteHook}{}{}
-\DeclareMultiCiteCommand{\citets}[\cbx at citets@init\cbx at textcites]{\citet}{}
-
-%同cite
-\DeclareCiteCommand{\citep}
- {\usebibmacro{cite:init}%
- \renewbibmacro*{postnote}{%
- \iffieldundef{postnote}%
- {}%
- {\thefield{postnote}}}%
- (\usebibmacro{prenote}}%)
- {\usebibmacro{citeindex}%
- \usebibmacro{cite}}
- {}
- {%(
- )\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote}
- }
-
-\newrobustcmd*{\citetns}%
- {\textcite}
-
-\newrobustcmd*{\citepns}%
- {\parencite}
-
-\newrobustcmd*{\inlinecite}%
- {\parencite}
-
-
-%
-% 增加如下复数的命令,以符合biblatex的复数命令习惯
-% 20190430,v1.0r,hzz
-% citec和citecs命令是为了兼容顺序编码制。
-% authornumcites是常用命令authornumcite的复数形式
-\newrobustcmd*{\citec}%
- {\cite}
-
-\DeclareMultiCiteCommand{\citecs}[]{\cite}{\multicitedelim}
-
-\DeclareMultiCiteCommand{\authornumcites}[]{\authornumcite}{\multicitedelim}
+%%
+%% ---------------------------------------------------------------
+%% biblatex-gb7714-2015 --- A biblatex implementation of the
+%% GBT7714-2015 citation style,author year sequence
+%% Maintained by huzhenzhen
+%% E-mail: hzzmail at 163.com
+%% Released under the LaTeX Project Public License v1.3c or later
+%% ---------------------------------------------------------------
+%%
+\def\versionofgbtstyle{2021/01/19 v1.0w}
+\ProvidesFile{gb7714-2015ay.cbx}[\versionofgbtstyle biblatex citation style]
+
+%
+% 加载标准样式
+%
+\RequireCitationStyle{authoryear-comp}
+
+
+%
+% 增加一个控制是否将标准标签中的作者加上超链接的选项
+% 20210119,v1.0v,hzz
+\newtoggle{bbx:gblabelref}
+\DeclareBibliographyOption{gblabelref}[true]{%biblatex低版本
+ \settoggle{bbx:gblabelref}{#1}}
+\ExecuteBibliographyOptions{gblabelref}
+
+
+\ExecuteBibliographyOptions{
+ %autocite = superscript ,
+ %autopunct = true ,
+ %sorting = none ,
+ maxcitenames=1,
+ mincitenames=1,
+ uniquename=init,%因为使用了名字缩写选项,所以需要设置uniquename=init而不是full避免冲突
+ uniquelist=minyear
+}
+
+%
+% 选项设置,针对3.7以下版本
+%
+% 原理方法:labeldate用于控制是否给引用标签提供日期的成分
+\defversion{3.4}{cbxopt}{
+ \ExecuteBibliographyOptions{
+ labeldate=true
+ }
+}
+
+%
+% 选项设置,针对3.7以上版本
+%
+% 原理方法:labeldateparts用于控制是否给引用标签提供日期的成分
+\defversion{3.7}{cbxopt}{
+ \ExecuteBibliographyOptions{
+ labeldateparts=true
+ }
+}
+
+\ifboolexpr{%选择选项设置
+test {\iftoggle{iftlfive}}%biblatex<=3.2
+or
+test {\iftoggle{iftlsix}}%3.3<=biblatex<=3.6
+}{\switchversion{3.4}{cbxopt}}{\switchversion{3.7}{cbxopt}}%else: biblatex>=3.7
+
+
+\ifboolexpr{%兼容cite:labelyear+extrayear
+test {\iftoggle{iftlfive}}%biblatex<=3.2
+or
+test {\iftoggle{iftlsix}}%3.3<=biblatex<=3.6
+or
+test {\iftoggle{iftlseven}}%3.7=biblatex
+}{\newbibmacro{cite:labeldate+extradate}{\usebibmacro{cite:labelyear+extrayear}}}{}%else: biblatex>3.7
+
+%textcite标注命令中的标点设置,注意只针对textcite命令。
+% v-old
+% v1.0t,20200320,hzz,修改如下
+% 在cbx中增加标注中的nameyeardelim标点定义,避免bbx使用其它样式时出现问题
+% 同时设置textcite的nameyeardelim为一个短空格,似乎原来直接连上去的不够美观
+\DeclareDelimFormat[cite,parencite,pagescite]{nameyeardelim}{\addcomma\space}%\addcomma\space
+\DeclareDelimFormat[textcite]{nameyeardelim}{\addthinspace}%\addcomma\space
+\DeclareDelimFormat[textcite]{andothersdelim}{\iffieldequalstr{userf}{chinese}{\addthinspace}{\addspace}}%
+\AtEveryCitekey{%
+\iffieldequalstr{userf}{chinese}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace
+ {\renewcommand*{\andothersdelim}{\addspace}}%
+}
+
+%
+% 修订使可用选项gblabelref来控制是否将标准标签中的作者加上超链接
+% 20210119,v1.0v,hzz
+\iftoggle{iftlatest}%
+{\renewbibmacro*{cite}{%
+ \iffieldundef{shorthand}
+ {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
+ {\usebibmacro{cite:label}%
+ \setunit{\printdelim{nonameyeardelim}}%
+ \usebibmacro{cite:labeldate+extradate}%
+ \usebibmacro{cite:reinit}}
+ {\iffieldequals{namehash}{\cbx at lasthash}
+ {\ifthenelse{\iffieldequals{labelyear}{\cbx at lastyear}\AND
+ \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
+ {\setunit{\addcomma}%
+ \usebibmacro{cite:extradate}}
+ {\setunit{\compcitedelim}%
+ \usebibmacro{cite:labeldate+extradate}%
+ \savefield{labelyear}{\cbx at lastyear}}}
+ {\iftoggle{bbx:gblabelref}{\printtext[bibhyperref]{\printnames{labelname}}}{\printnames{labelname}}%
+ \setunit{\printdelim{nameyeardelim}}%
+ \usebibmacro{cite:labeldate+extradate}%
+ \savefield{namehash}{\cbx at lasthash}%
+ \savefield{labelyear}{\cbx at lastyear}}}}
+ {\usebibmacro{cite:shorthand}%
+ \usebibmacro{cite:reinit}}%
+ \setunit{\multicitedelim}}
+\renewbibmacro*{textcite}{%
+ \iffieldequals{namehash}{\cbx at lasthash}
+ {\iffieldundef{shorthand}
+ {\ifthenelse{\iffieldequals{labelyear}{\cbx at lastyear}\AND
+ \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
+ {\setunit{\addcomma}%
+ \usebibmacro{cite:extradate}}
+ {\setunit{\compcitedelim}%
+ \usebibmacro{cite:labeldate+extradate}%
+ \savefield{labelyear}{\cbx at lastyear}}}
+ {\setunit{\compcitedelim}%
+ \usebibmacro{cite:shorthand}%
+ \global\undef\cbx at lastyear}}
+ {\ifnameundef{labelname}
+ {\iffieldundef{shorthand}
+ {\usebibmacro{cite:label}%
+ \setunit{%
+ \global\booltrue{cbx:parens}%
+ \printdelim{nonameyeardelim}\bibopenparen}%
+ \ifnumequal{\value{citecount}}{1}
+ {\usebibmacro{prenote}}
+ {}%
+ \usebibmacro{cite:labeldate+extradate}}
+ {\usebibmacro{cite:shorthand}}}
+ {\iftoggle{bbx:gblabelref}{\printtext[bibhyperref]{\printnames{labelname}}}{\printnames{labelname}}%
+ \setunit{%
+ \global\booltrue{cbx:parens}%
+ \printdelim{nameyeardelim}\bibopenparen}%
+ \ifnumequal{\value{citecount}}{1}
+ {\usebibmacro{prenote}}
+ {}%
+ \iffieldundef{shorthand}
+ {\iffieldundef{labelyear}
+ {\usebibmacro{cite:label}}
+ {\usebibmacro{cite:labeldate+extradate}}%
+ \savefield{labelyear}{\cbx at lastyear}}
+ {\usebibmacro{cite:shorthand}%
+ \global\undef\cbx at lastyear}}%
+ \stepcounter{textcitecount}%
+ \savefield{namehash}{\cbx at lasthash}}%
+ \setunit{%
+ \ifbool{cbx:parens}
+ {\bibcloseparen\global\boolfalse{cbx:parens}}
+ {}%
+ \textcitedelim}}}{}
+
+
+
+%
+% 重定义cite:label,针对biblatex3.8以上版本set条目集的标注(引用)标签
+%
+% 原理方法:当条目是set时,v3.8以上版本,都没有有用的信息(区别于3.7以下版本set复制第一个成员的信息),
+% 于是利用entrykey来给出标签,那么就要set的条目关键字是需要的字符串,注意字符串中间不能有空格
+\renewbibmacro*{cite:label}{%
+ \iffieldundef{label}%
+ {\iffieldundef{labeltitle}{\printtext[bibhyperref]{\printfield{entrykey}}}%entrykey
+ {\printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}}%
+ {\printtext[bibhyperref]{\printfield{label}}}}
+
+%
+% 重定义cite命令
+%
+% 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode}
+% v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式
+\DeclareCiteCommand{\cite}
+ {\usebibmacro{cite:init}%
+ \renewbibmacro*{postnote}{%
+ \iffieldundef{postnote}%
+ {}%
+ {\thefield{postnote}}}%
+ (\usebibmacro{prenote}}%)
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite}}
+ {}
+ {%(
+ )\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote}
+ }
+
+%
+% 定义upcite命令
+% 20180604,v1.0l,hzz
+% 20190409,v1.0r,hzz
+% 方法:与cite命令相同
+\newrobustcmd*{\upcite}{%
+ \cite}
+
+%
+% 重定义parencite命令
+%
+%\DeclareCiteCommand{\parencite}
+% {\usebibmacro{cite:init}%
+% \renewbibmacro*{postnote}{%
+% \iffieldundef{postnote}%
+% {}%
+% {\nopunct%
+% \printfield{postnote}}}%
+% (\usebibmacro{prenote}}%)
+% {\usebibmacro{citeindex}%
+% \usebibmacro{cite}}
+% {}
+% {%(
+% )\mkbibsuperscript{\usebibmacro{postnote}}}
+
+
+%
+% 新定义pagescite命令,以满足标签带页码的国标要求
+%
+% 原理方法:
+% 新增\pagescite引用命令
+\DeclareCiteCommand{\pagescite}
+ {\usebibmacro{cite:init}%
+ \renewbibmacro*{postnote}{%
+ \iffieldundef{postnote}%
+ {\thefield{pages}}%
+ {\thefield{postnote}}}%
+ (\usebibmacro{prenote}%)
+ }%
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite}}
+ {}
+ {%(
+ )\mkbibsuperscript{\usebibmacro{postnote}}}
+
+%
+% 定义yearpagescite,用于当文中作者已经存在,需要页码和年份的情况
+%
+% 原理:增加一个命令yearpagescite
+% 参考biblatex.DEF中的\DeclareCiteCommand*{\citeyear}命令
+\DeclareCiteCommand{\yearpagescite}
+ {\usebibmacro{cite:init}%
+ \renewbibmacro*{postnote}{%
+ \iffieldundef{postnote}%
+ {\thefield{pages}}%
+ {\thefield{postnote}}}%
+ \printtext{(}\usebibmacro{prenote}}%
+ {\usebibmacro{cite:labeldate+extradate}}%\printfield{year}\printfield{extrayear}
+ {\multicitedelim}%
+ {\printtext{)}\textsuperscript{\usebibmacro{postnote}}}
+
+%
+% 定义yearcite,用于当文中作者已经存在,仅需要年份的情况
+%
+% 原理:增加一个命令yearcite
+\DeclareCiteCommand{\yearcite}%仅输出年份,不要页码
+ {\usebibmacro{cite:init}%
+ \printtext{(}\usebibmacro{prenote}}%
+ {\usebibmacro{cite:labeldate+extradate}}%\printfield{year}\printfield{extrayear}
+ {\multicitedelim}%
+ {\printtext{)}}
+
+%
+% 定义\authornumcite命令,输出作者信息,然后在后面带上顺序编码
+% 20180427,v1.0k,增加,hzz
+% 20190409,v1.0r,hzz
+% 为与顺序编码制兼容,增加了命令,定义与citet相同
+\newbibmacro*{citeta}{%
+ \iffieldundef{shorthand}
+ {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
+ {\usebibmacro{cite:label}%
+ \setunit{\printdelim{nonameyeardelim}}%
+ \usebibmacro{cite:labeldate+extradate}%
+ \usebibmacro{cite:reinit}}
+ {\iffieldequals{namehash}{\cbx at lasthash}
+ {\ifthenelse{\iffieldequals{labelyear}{\cbx at lastyear}\AND
+ \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
+ {\setunit{\addcomma}%
+ \usebibmacro{cite:extradate}}
+ {\setunit{\compcitedelim}%
+ \usebibmacro{cite:labeldate+extradate}%
+ \savefield{labelyear}{\cbx at lastyear}}}
+ {\iftoggle{bbx:gblabelref}{\printtext[bibhyperref]{\printnames{labelname}}}{\printnames{labelname}}%%
+ %\setunit{\printdelim{nameyeardelim}}%
+ (\usebibmacro{cite:labeldate+extradate})%
+ \savefield{namehash}{\cbx at lasthash}%
+ \savefield{labelyear}{\cbx at lastyear}}}}
+ {\usebibmacro{cite:shorthand}%
+ \usebibmacro{cite:reinit}}%
+ \setunit{\multicitedelim}}
+
+\DeclareCiteCommand{\authornumcite}%
+ {\usebibmacro{cite:init}%
+ \renewbibmacro*{postnote}{%
+ \iffieldundef{postnote}%
+ {}%
+ {\thefield{postnote}}}%
+ \usebibmacro{prenote}}%
+ {\usebibmacro{citeindex}%
+ \usebibmacro{citeta}}
+ {}
+ {\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote}
+ }
+
+%
+% 增加如下多个命令
+% 20190409,v1.0r,hzz
+% 方法:利用newcommand或newrobustcmd命令进行定义
+% 注意\citet和\citep命令之所以不用newrobustcmd,是为避免加载natbib模块后产生冲突
+
+%同\authornumcite
+%\DeclareCiteCommand{\citet}%
+% {\usebibmacro{cite:init}%
+% \renewbibmacro*{postnote}{%
+% \iffieldundef{postnote}%
+% {}%
+% {\thefield{postnote}}}%
+% \usebibmacro{prenote}}%
+% {\usebibmacro{citeindex}%
+% \usebibmacro{citet}}
+% {}
+% {%(
+% )\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote}
+% }
+
+
+%
+% 重定义citet,因为前面与\authornumcite同定义的命令无法正确处理多个bibtexkey同时给出的压缩情况
+% 20200721,v1.0v,hzz
+% 方法:利用textcite命令进行定义
+% 基本利用textcite命令来写citet,仅利用bool{cbx:incitet}做判断,进而处理不同的页码形式
+\newbool{cbx:incitet}
+\newbibmacro*{citet:postnote}{%
+ \ifthenelse{\value{multicitecount}=\value{multicitetotal}}
+ {\setunit{}%
+ \printtext{%
+ \ifbool{cbx:parens}
+ {\bibcloseparen\global\boolfalse{cbx:parens}}
+ {}}}
+ {\setunit{%
+ \ifbool{cbx:parens}
+ {\bibcloseparen\global\boolfalse{cbx:parens}}
+ {}%
+ \textcitedelim}}%
+ \renewbibmacro*{postnote}{%
+ \iffieldundef{postnote}%
+ {}%
+ {\thefield{postnote}}}%
+ \mkbibsuperscript{\usebibmacro{postnote}}%
+ }
+
+\DeclareCiteCommand{\cbx at textcite}
+ {\usebibmacro{cite:init}}
+ {\usebibmacro{citeindex}%
+ \usebibmacro{textcite}}
+ {}
+ {\ifbool{cbx:incitet}{\usebibmacro{citet:postnote}}{\usebibmacro{textcite:postnote}}}
+
+ \newrobustcmd{\cbx at citet@init}[2]{%
+ \global\booltrue{cbx:incitet}%
+ \setcounter{textcitetotal}{0}%
+ \setcounter{textcitecount}{0}%
+ \def\cbx at savedcites{#1}#2\cbx at savedcites\empty}
+
+ \renewrobustcmd{\cbx at textcite@init}[2]{%
+ \global\boolfalse{cbx:incitet}%
+ \setcounter{textcitetotal}{0}%
+ \setcounter{textcitecount}{0}%
+ \def\cbx at savedcites{#1}#2\cbx at savedcites\empty}
+
+\DeclareCiteCommand{\citet}[\cbx at citet@init\cbx at textcite]
+ {\gdef\cbx at savedkeys{}%
+ \citetrackerfalse%
+ \pagetrackerfalse%
+ \DeferNextCitekeyHook%
+ \usebibmacro{cite:init}}
+ {\ifthenelse{\iffirstcitekey\AND\value{multicitetotal}>0}
+ {\protected at xappto\cbx at savedcites{()(\thefield{multipostnote})}%
+ \global\clearfield{multipostnote}}
+ {}%
+ \xappto\cbx at savedkeys{\thefield{entrykey},}%
+ \iffieldequals{namehash}{\cbx at lasthash}
+ {}
+ {\stepcounter{textcitetotal}%
+ \savefield{namehash}{\cbx at lasthash}}}
+ {}
+ {\protected at xappto\cbx at savedcites{%
+ [\thefield{prenote}][\thefield{postnote}]{\cbx at savedkeys}}}
+
+\let\cbx at citets@init\cbx at citet@init
+\pretocmd{\cbx at citets@init}{\UseNextMultiCiteHook}{}{}
+\DeclareMultiCiteCommand{\citets}[\cbx at citets@init\cbx at textcites]{\citet}{}
+
+%同cite
+\DeclareCiteCommand{\citep}
+ {\usebibmacro{cite:init}%
+ \renewbibmacro*{postnote}{%
+ \iffieldundef{postnote}%
+ {}%
+ {\thefield{postnote}}}%
+ (\usebibmacro{prenote}}%)
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite}}
+ {}
+ {%(
+ )\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote}
+ }
+
+\newrobustcmd*{\citetns}%
+ {\textcite}
+
+\newrobustcmd*{\citepns}%
+ {\parencite}
+
+\newrobustcmd*{\inlinecite}%
+ {\parencite}
+
+
+%
+% 增加如下复数的命令,以符合biblatex的复数命令习惯
+% 20190430,v1.0r,hzz
+% citec和citecs命令是为了兼容顺序编码制。
+% authornumcites是常用命令authornumcite的复数形式
+\newrobustcmd*{\citec}%
+ {\cite}
+
+\DeclareMultiCiteCommand{\citecs}[]{\cite}{\multicitedelim}
+
+\DeclareMultiCiteCommand{\authornumcites}[]{\authornumcite}{\multicitedelim}
Modified: trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.bbx
===================================================================
--- trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.bbx 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.bbx 2021-01-19 22:57:40 UTC (rev 57468)
@@ -1,2735 +1,2735 @@
-%%
-%% ---------------------------------------------------------------
-%% biblatex-gb7714-2015 --- A biblatex implementation of the
-%% GBT7714-2015 bibliography style,numerical sequence
-%% Maintained by huzhenzhen
-%% E-mail: hzzmail at 163.com
-%% Released under the LaTeX Project Public License v1.3c or later
-%% ---------------------------------------------------------------
-%%
-
-%
-% 版本和时间信息
-%
-\def\versionofgbtstyle{2020/07/21 v1.0v}
-\def\versionofbiblatex{\abx at version}
-\ProvidesFile{gb7714-2015ms.bbx}[\versionofgbtstyle biblatex bibliography style]
-%\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求
-
-
-%=====================================================================
-% 加载标准样式
-%=====================================================================
-\RequireBibliographyStyle{numeric-comp}
-\RequirePackage{xstring}%解决texlive2015的biblatex3.0不加载xstring包的问题
-
-%=====================================================================
-% 功能函数
-%=====================================================================
- %
- % biblatex版本判断
- % 20180629,v1.0k,hzz
- %
- % 原理方法:适用于3.10以上版本的biblatex,否则给出警告
- \@ifpackagelater{biblatex}{2017/12/28}{}{
- \blx at warning@noline{%
- biblatex version is too old for this style\MessageBreak
- if errors raised,Please update biblatex to the latest version.}
- }
-
-
- %
- % 判断CJK字符的函数,用于判断作者等信息是否由中文字符构成
- % v1.0k,20180509,hzz
- %
- % 原理方法:用biber中的perl方法代替。因为利用tex函数对字符判断时,当字符在宏
- % 中时,基于`的方法无法解决GBK编码的问题,基于CJKsymbol的方法无法解决utf-8
- % 编码用xelatex编译的问题。
- %
- % 原理是:利用perl正则将中文标识记录到域中,
- % 然后利用\iffieldundef和\iffieldequalstr进行判断
- \providetoggle{ifCJKforgbt}
- \def\testCJKfirst#1{%
- \iffieldundef{#1}{\togglefalse{ifCJKforgbt}}{%
- \iffieldequalstr{#1}{chinese}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}}}
-
- %
- % 2个卷的解析函数,用于连续出版物
- %
- % 原理方法: 范围起止间隔符号还是用-,而不是与date相同的/,因为有合期期刊的问题,需要用到/符号
- \newcommand{\multivolparser}[1]{%
- \IfSubStr{#1}{-}%
- {\StrBefore{#1}{-}[\multivolfirst]\StrBehind{#1}{-}[\multivolsecond]}%
- {\def\multivolfirst{#1}\def\multivolsecond{}}%
- }
-
-
- %
- % 2个期的解析函数,用于连续出版物
- %
- \newcommand{\multinumberparser}[1]{%
- \IfSubStr{#1}{-}%
- {\StrBefore{#1}{-}[\multinumberfirst]\StrBehind{#1}{-}[\multinumbersecond]}%
- {\def\multinumberfirst{#1}\def\multinumbersecond{}}%
- }
-
-
-%=====================================================================
-% 数据模型定义
-%=====================================================================
- %定义类型和载体标识,从gb内容看载体基本属于介质。
- %为与lee zeping的bst的样式统一,使用mark和medium这两域名
- %为单个条目的姓名格式控制增加nameformat和namefmtid两个域
- %为缩略信息文献表增加了shortbooktitle域
- %为多语言排序增加了lansortorder域
- \DeclareDatamodelFields[type=field,datatype=literal]{mark,medium,nameformat}
- \DeclareDatamodelFields[type=field,datatype=integer]{namefmtid}
- \DeclareDatamodelFields[type=field,datatype=literal]{shortbooktitle}
- \DeclareDatamodelFields[type=field,datatype=literal]{lansortorder}
-
- %因为biblatex更新3.14版本以后,biber对于为声明数据模型的条目类型
- %不再默认读取,而是以空字符串作为条目类型名,自然在条目定义alias时
- %就会出现问题,因此显式的声明一下newspaper,然后保留后面采用alias的方式
- %而standard类型则是采用另一种方式直接在sourcemap中转换为其它类型。
- \@ifpackagelater{biblatex}{2019/11/30}{%2019/12/01 v3.14
- \DeclareDatamodelEntrytypes{newspaper}%
- }{}
-
-%=====================================================================
-% 设置宏包选项
-%=====================================================================
- %
- % 增加一个控制是否输出文献载体的选项
- % 20191125,v1,0s,hzz
- \newtoggle{bbx:gbmedium}
- \DeclareBibliographyOption{gbmedium}[true]{%biblatex低版本
- \settoggle{bbx:gbmedium}{#1}}
- \ExecuteBibliographyOptions{gbmedium}
-
- %
- % 增加一个控制是否输出annotation域的选项,该域可以用于在文献条目后面输出一些注释信息
- % 20190509,v1,0s,hzz
- \newtoggle{bbx:gbannote}
- \DeclareBibliographyOption{gbannote}[false]{%biblatex低版本
- \settoggle{bbx:gbannote}{#1}}
- \ExecuteBibliographyOptions{gbannote}
- %
- %用于在文献条目后面输出注释信息的宏
- %FieldFormat{annotation}用于设置注释信息的格式
- \DeclareFieldFormat{annotation}{%
- \printtext{\addspace(#1)}%
- }
- \renewbibmacro*{annotation}{%
- \iftoggle{bbx:gbannote}%
- {\iffieldundef{annotation}%
- {\printfile[annotation]{\bibannotationprefix\thefield{entrykey}.tex}}%
- {\printfield{annotation}}}%
- {}%
- }
-
-
- %
- % 增加一个控制是否输出type域的选项
- % 20190212,v1,0q,hzz
- \newtoggle{bbx:gbfieldtype}
- \DeclareBibliographyOption{gbfieldtype}[false]{%biblatex低版本
- \settoggle{bbx:gbfieldtype}{#1}}
- \ExecuteBibliographyOptions{gbfieldtype}
-
- %
- % 增加一个控制是否根据页码重设脚注数字标号的选项
- % 20190422,v1,0r,hzz
- \newtoggle{bbx:gbfnperpage}
- \DeclareBibliographyOption{gbfnperpage}[false]{%
- \settoggle{bbx:gbfnperpage}{#1}}
- \ExecuteBibliographyOptions{gbfnperpage}
-
- %
- % 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表
- % 20190203,v1.0p,hzz
- % 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签
- % 当前面的脚注中已经存在当前文献,那么当前文献内容不再输出而用同(4)这样的方式
- % 需要注意的是由于小页环境和表格中的脚注本身的问题,可能会有一些问题
- \DeclareBibliographyOption{gbfootbib}[false]{%
- \ifstrequal{#1}{false}{}{\execgbfootbib}}
- \ExecuteBibliographyOptions{gbfootbib}
-
- %%
- \newlength{\footbibmargin}
- \newlength{\footbiblabelsep}
- \setlength{\footbibmargin}{1em}%脚注的段落左侧缩进距离
- \setlength{\footbiblabelsep}{0.5em}%脚注中标记号与脚注段落的间距
- \def\execgbfootbib%
- {%
- %开启引用跟踪计数器,为使用\ifciteseen等测试命令
- \ExecuteBibliographyOptions{citetracker=true}
- %
- %利用footmisc宏包来实现脚注文献的悬挂对齐
- \AtEndPreamble{
- \@ifclassloaded{beamer}{}{
- %beamer类因为其特殊性,为避免冲突不调footmisc。
- %同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接
- %如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。
- %\PassOptionsToPackage{perpage,hang}{footmisc}%
- %\RequirePackage{footmisc}%
-
- %重新实现脚注的根据单页重设脚注号码
- %重新实现脚注的悬挂对齐问题,不再使用footmisc,直接从latex核心代码和hyperref代码进行修改
- %v1.0q 20190317 hzz
- %v1.0r 20190422 hzz 根据gbfnperpage选项设置
- \iftoggle{bbx:gbfnperpage}%
- {\@addtoreset{footnote}{page}}{}%重设计数器
-
-\@ifpackageloaded{hyperref}{%加载hyperref则对\H@@footnotetext做重定义
- \long\def\H@@footnotetext##1{\insert\footins{%
- \reset at font\footnotesize
- \interlinepenalty\interfootnotelinepenalty
- \splittopskip\footnotesep
- \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
- \hsize\columnwidth \@parboxrestore
- \protected at edef\@currentlabel{%
- \csname p at footnote\endcsname\@thefnmark
- }%
- \color at begingroup
- \leftskip \footbibmargin%增加的左侧缩进
- \@makefntext{%
- \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox%
- }%
- \color at endgroup}}%
-
- \long\def\H@@mpfootnotetext##1{%
- \global\setbox\@mpfootins\vbox{%
- \unvbox\@mpfootins
- \reset at font\footnotesize
- \hsize\columnwidth
- \@parboxrestore
- \protected at edef\@currentlabel
- {\csname p at mpfootnote\endcsname\@thefnmark}%
- \leftskip \footbibmargin%增加的左侧缩进
- \color at begingroup
- \@makefntext{%
- \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}%
- \color at endgroup}}
- }{%否则对latex核心代码中的\@footnotetext做重定义
- \long\def\@footnotetext##1{\insert\footins{%
- \reset at font\footnotesize
- \interlinepenalty\interfootnotelinepenalty
- \splittopskip\footnotesep
- \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
- \hsize\columnwidth \@parboxrestore
- \protected at edef\@currentlabel{%
- \csname p at footnote\endcsname\@thefnmark
- }%
- \color at begingroup
- \leftskip \footbibmargin%增加的左侧缩进
- \@makefntext{%
- \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox%
- }%
- \color at endgroup}}%
-
- \long\def\@mpfootnotetext##1{%
- \global\setbox\@mpfootins\vbox{%
- \unvbox\@mpfootins
- \reset at font\footnotesize
- \hsize\columnwidth
- \@parboxrestore
- \protected at edef\@currentlabel
- {\csname p at mpfootnote\endcsname\@thefnmark}%
- \leftskip \footbibmargin%增加的左侧缩进
- \color at begingroup
- \@makefntext{%
- \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}%
- \color at endgroup}}
- }
-
- \long\def\@makefntext##1{%增加了脚注标记与正文的间隔
- \parindent 1em\noindent \hb at xt@ 0em{\hss \@makefnmark\makebox[\footbiblabelsep]{}}##1}
-
- }
-
- %
- %使脚注标记加圈并设置数字的字体为tiny,不使用修改thefootnote的方式
- \def\@makefnmark{\hbox{\@textsuperscript{\textcircled{\tiny\@thefnmark}}}}
- %做patch使得脚注内容中的脚注数字标签不上标
- \pretocmd{\@makefntext}{%
- \def\@makefnmark{%
- \hbox{\textcircled{\tiny\@thefnmark}}%
- }%
- }{}{}
- }
-
- %
- %判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容)
- %记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。
- %v1.0q 20190309 区分使脚注标注适应minipage中的情况
- \newbibmacro*{citesavefn}{%
- \ifciteseen%当被引用过为true
- {\ifcsdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%当已经定义过脚注序号信息
- {\csgdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{%
- \str at sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}%
- \@makefnmark%
- }}%
- {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{%
- \ifcsstring{@mpfn}{mpfootnote}{\@alph\c at mpfootnote}{\thefootnote}%
- }}%
- }%
- {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{%
- \ifcsstring{@mpfn}{mpfootnote}{\@alph\c at mpfootnote}{\thefootnote}%
- %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断
- }}%
- }
-
- %
- %重定义\footfullcite使完成gb7714-2015的脚注文献要求
- \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]%
- {\defcounter{maxnames}{\blx at maxbibnames}%局部定义maxnames和minnames计数器
- \defcounter{minnames}{\blx at minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。
- \usebibmacro{prenote}%
- \renewbibmacro*{postnote}{%
- \iffieldundef{postnote}%
- {}{\setunit{\addcolon\addspace}\printfield{postnote}}}%与ay样式不同,由于已修改postnote域格式,直接用printfield
- }%
- {\usebibmacro{citesavefn}%
- \ifcsdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%
- {\csuse{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}\nopunct}%
- {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}%
- }%
- {\multicitedelim}%
- {\usebibmacro{postnote}}
-
- }
-
- %
- % 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式
- % 20180814,v1.0m,hzz
- % 原理方法:
- % 当gbstyle=true,则所有的文献使用国标样式,否则仅中文文献使用国标样式
- \newtoggle{bbx:gbstyle}
- \DeclareBibliographyOption{gbstyle}[true]{%biblatex低版本
- \settoggle{bbx:gbstyle}{#1}}
-
- %
- % 增加一个控制是否输出文献类型和载体标识的选项
- %
- % 原理方法:
- % 对于biblatex3.4以上版本DeclareBibliographyOption命令中的[datatype]如果是boolean,那么是可以省略的
- % 所以用老版本的不用[datatype]的命令可以兼容所有biblatex版本
- \newtoggle{bbx:gbtype}
- %\DeclareBibliographyOption[boolean]{gbtype}[true]{%biblatex高版本
- \DeclareBibliographyOption{gbtype}[true]{%biblatex低版本
- \settoggle{bbx:gbtype}{#1}}
-
- %
- % 增加一个源文件编码选择选项,当true时可以使用GBK编码。
- % v1.0k, 2018.05.08, by hzz
- %
- % 原理方法:将需要输出的中文字符串用命令形式表示存储,采用utf8编码时采用bbx文档
- % 内的定义即是utf8编码的中文字符串,但tex源文件是gbk编码时,利用gb7714-2015-gbk.def
- % 文档内的gbk编码的字符串覆盖。这种覆盖只能在宏包末尾加载时成功实现,所以使用
- % AtEndOfPackage。该解决思路源自biblatex-caspervector宏包。
- % 另外注意:
- % gbk编码的tex文档,利用pdflatex/latex能正确编译,利用xelatex能编译,但中文显示乱码
- % 在源文档前面增加 XeTeX 原语:\XeTeXinputencoding "GBK" 后,显示正常
- % utf-8编码的tex文档,利用xelatex能正确编译,而pdflatex/latex不能编译。
- \newtoggle{bbx:codegbk}
- \DeclareBibliographyOption{gbcodegbk}[false]{%
- \settoggle{bbx:codegbk}{#1}}
-
- \def\str at bibliography{参考文献}
- \def\str at references{参考文献}
- \def\str at bytranslator{译}
- \def\str at andotherscn{等}
- \def\str at backrefpage{引用页}
- \def\str at backrefpages{引用页}
- \def\str at noaddress{出版地不详}
- \def\str at nopublisher{出版者不详}
- \def\str at edition{版}
- \def\str at volumecn{卷}
- \def\str at numbercn{册}
- \def\str at serialcn{第}
- \def\str at sameentry{同}
- \def\str at incn{见}
- \def\str at mathesiscn{硕士学位论文}
- \def\str at phdthesiscn{博士学位论文}
- \def\str at editorcn{主编}
-
- \AtEndOfPackage{%
- \iftoggle{bbx:codegbk}{%
- \ExecuteBibliographyOptions{texencoding = GBK}
- \input{gb7714-2015-gbk.def}
- }{}}
-
- %
- % 增加一个严格按GB/T 7714-2015给出著录格式控制域的输出的选项
- % v1.0k, 2018.05.08, by hzz
- %
- % 原理方法:
- % 默认设置该选项为真,进而不输出GB/T 7714-2015中没有的域的信息
- % 这样可以避免因为bib文件带有多余的域的信息的输出,比如因为bibtex样式
- % 可能需要用于中英文判断的language域的信息。
- \newtoggle{bbx:gbstrict}
- \DeclareBibliographyOption{gbstrict}[true]{%
- \settoggle{bbx:gbstrict}{#1}}
-
- %
- % 增加一个控制标题域超链接设置的选项
- % v1.0k, 2018.05.24, by hzz
- %
- % 原理方法:
- % 利用标题域格式来实现,默认设置该选项为false,不做超链接。
- % 设置为true,则标题设置超链接
- \newtoggle{bbx:titlelink}
- \DeclareBibliographyOption{gbtitlelink}[false]{%
- \settoggle{bbx:titlelink}{#1}}
-
- %
- % 增加一个控制参考文献标题是否能够被ctex宏包设置的选项
- % v1.0l, 2018.07.02, by hzz
- %
- % 原理方法:
- % 重定义biblatex的宏,去除使用本地化字符串的方式,是的可以利用ctexset进行设置
- \newtoggle{bbx:ctexset}
- \DeclareBibliographyOption{gbctexset}[true]{%
- \settoggle{bbx:ctexset}{#1}}
-
- \AtEndOfPackage{%
- \iftoggle{bbx:ctexset}{%
- \def\blx at defbibstrings#1#2{%
- \def\do##1{\csundef{abx at lstr@##1}\csundef{abx at sstr@##1}}%
- \abx at dostrings
- \csuse{abx at strings@#1}%
- \setkeys{blx at lbx}{#2}%
- \let\do\blx at defbibstrings@i
- \csxdef{abx at strings@#1}{\abx at dostrings}%
- }
- }{}}
-
- %
- % 增加一个恢复域格式为标准样式的控制选项
- % v1.0k, 2018.05.15, by hzz
- %
- % 原理方法:
- % 默认设置该选项为false,采用国标要求的域格式输出相关域
- % 当设置该选项为true时,则重新利用标准样式的域格式输出相关的域
- \newtoggle{bbx:gbfieldstd}
- \DeclareBibliographyOption{gbfieldstd}[false]{%
- \settoggle{bbx:gbfieldstd}{#1}%
- }
-
- %
- % 增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。
- %
- \newtoggle{bbx:gbpub}
- \DeclareBibliographyOption{gbpub}[true]{%
- %\settoggle{bbx:gbpub}{#1} %或采用下面这一句
- \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}}
-
- %
- % 增加控制析出文献来源前的标点符号//输出的选项
- % v1.0k, 2018.04.20,added in by hzz
- \newtoggle{bbx:gbpunctin}
- \DeclareBibliographyOption{gbpunctin}[true]{%
- \settoggle{bbx:gbpunctin}{#1}}
-
- %
- % 增加一个处理佚名或noauthor的控制选项
- %
- % 原理方法:在顺序编码制中不需要使用,为与作者年制的兼容性考虑,这里也增加避免报错
- \DeclareBibliographyOption{gbnoauthor}[true]{}%
-
-
- %
- %为日期控制格式增加一个gb7714-2015选项
- %
- \csdef{mkdaterangegb7714-2015}#1{%
- \begingroup
- \blx at metadateinfo{#1}%
- \iffieldundef{#1year}
- {}
- {\printtext[#1date]{%
- \blx at gbdate{#1}{}}}%
- \endgroup}
-
- \newrobustcmd*{\blx at gbdate}[3][]{%
- \dateeraprintpre{#2#3year}%
- \blx at imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}%
- \iffieldundef{#2#3month}{}{\hyphen\blx at imc@forcezerosmdt{\thefield{#2#3month}}}%
- \iffieldundef{#2#3day}{}{\hyphen\blx at imc@forcezerosmdt{\thefield{#2#3day}}}}
-
- %为姓名格式选择增加的计数器
- \newcounter{gbnamefmtcase}
- \def\thegbnamefmtcase{\the\c at gbnamefmtcase}
- %为数字标签格式选择增加的计数器/命令
- \newcommand{\mkgbnumlabel}[1]{\mkbibbrackets{#1}}
- \def\gbbiblabelopt at bracket{\renewcommand{\mkgbnumlabel}[1]{\mkbibbrackets{##1}}}
- \def\gbbiblabelopt at parens{\renewcommand{\mkgbnumlabel}[1]{\mkbibparens{##1}}}
- \def\gbbiblabelopt at dot{\renewcommand{\mkgbnumlabel}[1]{##1\adddot}}
- \def\gbbiblabelopt at plain{\renewcommand{\mkgbnumlabel}[1]{##1}}
- \def\gbbiblabelopt at box{\renewcommand{\mkgbnumlabel}[1]{\framebox{##1}}}
- \def\gbbiblabelopt at circle{\renewcommand{\mkgbnumlabel}[1]{\textcircled{##1}}}
- %为文献表中数字标签对齐方式选择增加的计数器/命令
- \newcounter{gbalignlabel}
- \def\thegbalignlabel{\the\c at gbalignlabel}
- %为引用标签标注/文献表中本地化字符串中英文选择增加的计数器/命令
- \newcounter{gbcitelocalcase}
- \newcounter{gbbiblocalcase}
- \def\thegbcitelocalcase{\the\c at gbcitelocalcase}
- \def\thegbbiblocalcase{\the\c at gbbiblocalcase}
-
- % 增加不同语言排序的切换选项
- % numeric样式,不使用该选项,这里给出仅为兼容性考虑
- % v1.0q,20190307,hzz
- %
- \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{}
-
-
- %
- % 增加本地化字符串的中英文切换选项
- % gbcitelocal指标注中的本地化字符串
- % gbbiblocal 指文献表中的本地化字符串
- % gblocal 指设置文献表和标注中的本地化字符串
- % v1.0o,20190103,hzz
- %
- \DeclareBibliographyOption[string]{gbcitelocal}[gb7714-2015]{%
- \ifstrequal{#1}{gb7714-2015}{\setcounter{gbcitelocalcase}{0}}{}%
- \ifstrequal{#1}{chinese}{\setcounter{gbcitelocalcase}{1}}{}%
- \ifstrequal{#1}{english}{\setcounter{gbcitelocalcase}{2}}{}%
- }
-
- \DeclareBibliographyOption[string]{gbbiblocal}[gb7714-2015]{%
- \ifstrequal{#1}{gb7714-2015}{\setcounter{gbbiblocalcase}{0}}{}%
- \ifstrequal{#1}{chinese}{\setcounter{gbbiblocalcase}{1}}{}%
- \ifstrequal{#1}{english}{\setcounter{gbbiblocalcase}{2}}{}%
- }
-
- \DeclareBibliographyOption[string]{gblocal}[gb7714-2015]{%
- \ExecuteBibliographyOptions{gbbiblocal=#1}%
- \ExecuteBibliographyOptions{gbcitelocal=#1}%
- }
-
- %
- % 增加序号标签格式处理选项
- % v1.0l,20180623,hzz
- %
- \DeclareBibliographyOption[string]{gbbiblabel}[bracket]{%
- \csuse{gbbiblabelopt@#1}
- }
-
- %
- % 增加姓名大小写格式处理选项
- %
- \DeclareBibliographyOption[string]{gbnamefmt}[uppercase]{%
- \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}%
- \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}%
- \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family
- \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{}
- \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given
- \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family
- }
-
-
- %
- % 增加标签对齐选项
- %
- % right是默认的右对齐,left是左对齐,gb7714-2015是项对齐方式
- \DeclareBibliographyOption[string]{gbalign}[right]{%
- \ifstrequal{#1}{right}{\setcounter{gbalignlabel}{0}}{}
- \ifstrequal{#1}{left}{\setcounter{gbalignlabel}{1}}{}
- \ifstrequal{#1}{center}{\setcounter{gbalignlabel}{2}}{}
- \ifstrequal{#1}{gb7714-2015}{\setaligngbstyle}{}
- }
-
-
- %
- % 选项设置
- %
- \ExecuteBibliographyOptions{
- %firstinits=true, 针对biblatex<3.3版本的选项设置,比如texlive2015中的3.0版
- giveninits=true, %针对3.3<=biblatex<3.5版本,比如texlive2016中的3.4版
- sorting=none,
- useprefix=true, %名字的信息包括前缀
- date = year, %日期仅写到年
- maxbibnames = 3,%设置名字最大数量
- minbibnames = 3, %设置缩减后的名字最小数量
- maxitems = 1,%设置列表最大数量
- minitems = 1, %设置缩减后的列表最小数量
- isbn=false,
- gbstyle=true,
- gbtype=true,
- gbcodegbk=false,
- gbstrict=true,
- gbtitlelink=false,
- gbfieldstd=false,
- gbpub=true,
- gbpunctin=true,
- gbbiblabel=bracket,
- gbnamefmt=uppercase,
- gbalign=right,
- gbctexset=true,
- %urldate =edtf, %针对3.7<=biblatex<=3.9版本的选项设置,比如texlive2017中的3.7版
- %eventdate =edtf,%针对3.7<=biblatex<=3.9版本的选项设置,比如texlive2017中的3.7版
- urldate =gb7714-2015, %iso,针对3.10<=biblatex版本的选项设置,比如texlive2018中的3.11版
- eventdate =gb7714-2015,
- gblocal=gb7714-2015,
- }
-
-
-%=====================================================================
-% 设置本地化字符串
-%=====================================================================
- %
- % 新建当地化字符串,用来记录“等”字符、“和”字符
- %
- \NewBibliographyString{andotherscn}
- \NewBibliographyString{andothersincitecn}
- \NewBibliographyString{andothersincite}
- \NewBibliographyString{andcn}
- \NewBibliographyString{andothersjp}
- \NewBibliographyString{andotherskr}
- \NewBibliographyString{andjp}
- \NewBibliographyString{andkr}
- \NewBibliographyString{andincitecn}
- \NewBibliographyString{andincite}
- \NewBibliographyString{volumecn}
- \NewBibliographyString{numbercn}
- \NewBibliographyString{serialcn}
- \NewBibliographyString{incn}
- \NewBibliographyString{mathesiscn}
- \NewBibliographyString{phdthesiscn}
- \NewBibliographyString{editorcn}
- \NewBibliographyString{editorscn}
-
-
- %
- % 修改一些当地化字符串
- %
- % 原理方法:直接利用当地化格式english修改出一些中文的格式,具体修改内容参考english.lbx文件
- % 当然也可以增加比如上面定义的andotherscn
- % 注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别
- \DefineBibliographyStrings{english}{
- bibliography = {\str at bibliography},
- references = {\str at references},
- bytranslator= {\str at bytranslator},%\addperiod,%将trans. by 改成 译
- and = {\addcomma},%将第2和3人名间的and符号改成逗号,用\finalnamedelim命令也可以定义,参见3.9.1节
- andcn = {\addcomma},%and本地化字符串的中文对应词
- andincitecn = {\addcomma},%将标注中的分开,便于与文献表中的区分
- andincite = {\addcomma},
- %andothers = {et al.}, %将超过3个人名的省略,et al.改成为 等
- andotherscn = {\str at andotherscn}, %将超过3个人名的省略,et al.改成为 等
- andothersincitecn={\str at andotherscn},%将标注中的分开,便于与文献表中的区分
- andothersincite={et al\adddot},
- backrefpage = {\str at backrefpage:},
- backrefpages = {\str at backrefpages:},
- in={in\intitlepunct},
- volumecn={\str at volumecn},
- numbercn={\str at numbercn},
- serialcn={\str at serialcn},
- andothersjp={他},
- andotherskr={외},
- andjp={和},
- andkr={和},
- incn={\str at incn\addcolon\addspace},
- mathesiscn={\str at mathesiscn},
- phdthesiscn={\str at phdthesiscn},
- editorscn={\str at editorcn},
- editorcn={\str at editorcn},
-}
-
- %
- % 增加两个命令用于临时的局部的修改本地化字符串
- % 其中\setlocalbibstring修改缩写字符串,setlocalbiblstring修改长字符串
- % 注意使用时因为是局部修改,因此要将其与需要修改的引用命令放在一个编组符号内
- % v1.0t,hzz,20190525
- \newcommand{\setlocalbibstring}[2]{%
- \csdef{abx at sstr@#1}{#2}}
- \newcommand{\setlocalbiblstring}[2]{%
- \csdef{abx at lstr@#1}{#2}}
-
-%=====================================================================
-% 动态数据修改
-%=====================================================================
-%
-% 各层次的数据映射和动态修改
-%
-% 原理方法:
-% 1. 进行语言包括中英文判断,并设置和记录,比如记录到userf,usere中
-% 2. 增加文献标识符如[M],[J]等,对一些容易混淆的域进行设置以增强兼容性
-% 3. \DeclareSourcemap命令对于biblatex3.11以下版本只能出现一次,3.11版开始支持多个
-% 4. \DeclarestyleSourcemap在biblatex v3.7版开始可以支持出现多次
-% 5. 把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。
-% 注意:这里用userf,usere而不是namee,namef,是因为只有把name列表转成域,才能有效读取姓名中的字符,
-% 如果用namee,namef,name信息会自动解析,所以就不能为cjk判断提供需要的信息
-%
-% 不同的文献类型使用相同的驱动输出可以有5种方法:
-% 1. 是数据源层的映射,将其它类型转换为某一要使用驱动的类型
-% 2. 是样式层映射,也是将其它类型转换为某一要使用驱动的类型
-% 3. 是驱动层映射,也是将其它类型转换为某一要使用驱动的类型
-% 4. 定义驱动类型别名DeclareBibliographyAlias,将其它类型定义为某一要使用驱动的类型的别名
-% 驱动别名定义本质上是做了驱动层映射
-% 5. 直接定义不同的类型的驱动,但驱动内容相同。
-%
-% 关于数据映射和驱动使用的考虑如下:
-% 1. 为避免利用biber输出bib文件时的数据变动,尽量不在数据源层映射做类型转换
-% 2. 为减少代码量,尽量少做内容相同的不同类型驱动
-% 3. 因此类型相关的处理主要在样式层映射、驱动层映射、驱动别名
-% 4. 由于biblatex默认做的驱动别名处理可能增加一些信息比如masterthesis转thesis时增加的type
-% 可以在样式层映射做某些需要避免这种默认处置的转换
-% 5. 当没有避免默认行为的需求时,全部采用驱动别名的方式处理,等价于驱动层的映射
-%
-% 文献类型和驱动考虑如下:
-% 1. 连续出版物及析出文献有其特殊性,因此考虑两类periodical和article
-% newpaper映射为article,并以note域做区分特殊处理
-% 2. 专著和专著中的析出文献是主要的类型,因此考虑book和inbook
-% standard映射为book或inbook,并以note域做区分特殊处理
-% collection和proceedings基本与book类似,因此做book驱动别名处理
-% incollection和inproceedings基本与inbook类似,因此做inbook驱动别名处理
-% 3. 专利类型有其特殊性,考虑patent类型
-% 4. 电子资源类型有其特殊性,考虑online类型
-% 5. 报告类型与book有点类似,出版项处理与book一样,但有时又要有修改和更细日期
-% 因此考虑用一种类型来输出,使用report类型
-% 6. 手册/学位论文等类型与book有点类似,但对于出版项处理时,有缺省时,直接省略,
-% 同时有version和edition的区别,因此考虑用一种类型来输出,使用manual类型
-% 7. 包括报告,学位论文在内的其它所有的类型,都做一个判断,当没有出版项时,
-% 且存在网址信息时,将其转换为online类型输出,否则都做为manual类型输出。
-% 8. 备选类型misc当存在网址时直接转换为online,由于howpublished域可用于描述
-% 更多的信息,因此不存在网址时,独立做一个备选格式
-% 9. 出版项主要以如下方式处理:
-% (a) location+institution+date 仅用于连续出版物
-% (b)publisher+location+date 用于需要完整输出出版项的类型,比如book,collection,proceedings,in*,report
-% (c)institution+location+date 用于出版项缺失时不输出的类型,包括manual,thesis,archive等其他类型
-% (d)printlist{insitution} 用于电子资源,仅输出出版者或组织,为数据映射方便,本来默认的organization域转换为用insitution输出。
-% (e) 不输出,主要用于连续出版物析出的文献
-% 10. 日期以如下方式处理:
-% date 由于存在biblatex选项,因此通过选项控制,数据源为date解析数据或year
-% urldate 由于存在biblatex选项,因此通过选项控制,输出到日,且用[]包围,数据源为urldate
-% newsdate 用于公告日期,公开日期或新闻日期,输出到日,但无包围符号,数据源为date
-% modifydate 用于更新或修改日期,输出到日,且用()包围,数据源为date或enddate或eventdate
-
-\DeclareSourcemap{%\perdatasource{examples.bib}
-\maps[datatype=bibtex]{%
- \map{%当没有作者时将editor转成author
- \pernottype{inbook}%因为in系列中editor可能用来表示bookauthor,所以排除
- \pernottype{inproceedings}
- \pernottype{incollection}
- \pernottype{periodical}%因为peridical直接使用editor,所以排除
- %注意notfield在低版本biblatex中没有
- %\step[notfield=author,final]%当author不存在,将editor复制给author
- \step[fieldsource=editor,fieldtarget=author]%并删除editor
- }
- \map{%当没有作者时将translator转成author
- \pernottype{inbook}
- \pernottype{inproceedings}
- \pernottype{incollection}
- %\step[notfield=author,final]%当author不存在,将translator复制给author
- \step[fieldsource=translator,fieldtarget=author]%并删除translator
- }
- \map{%让address和location同步,biblatex中address是location的别名
- %因此输出的时候只有location信息,但处理过程中是可以存在address的。
- \step[notfield=address,final]%
- \step[fieldsource=location,final]
- \step[fieldset=address,origfieldval]
- }
- \map{
- \step[notfield=location,final]%
- \step[fieldsource=address,final]
- \step[fieldset=location,origfieldval]
- }
- \map{%处理在bib文件用mark标记文献类型标识符的情况
- \step[fieldsource=mark,final]
- \step[fieldset=usera, origfieldval]
- }
- \map{%处理在bib文件中直接给出文献的姓名格式为lowercase的情况
- \step[fieldsource=nameformat,match=lowercase,final]
- \step[fieldset=namefmtid,fieldvalue={1}]
- }
- \map{%处理在bib文件中直接给出文献的姓名格式为givenahead的情况
- \step[fieldsource=nameformat,match=givenahead,final]
- \step[fieldset=namefmtid,fieldvalue={2}]
- }
- \map{%处理在bib文件中直接给出文献的姓名格式为familyahead的情况
- \step[fieldsource=nameformat,match=familyahead,final]
- \step[fieldset=namefmtid,fieldvalue={3}]
- }
- \map{%处理在bib文件中直接给出文献的姓名格式为pinyin的情况
- \step[fieldsource=nameformat,match=pinyin,final]
- \step[fieldset=namefmtid,fieldvalue={4}]
- }
- \map{%根据article确定文献类型标识符
- \pertype{article}
- \step[fieldset=usera, fieldvalue={J}]
- }
- \map{%根据periodical确定文献类型标识符
- \pertype{periodical}
- \step[fieldset=usera, fieldvalue={J}]
- \step[fieldsource=author] %有时会把author和editor混淆,处理后使用editor
- \step[fieldset=editor, origfieldval]
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{%根据增加一个新闻报纸的类型newspaper确定文献类型标识符
- \pertype{newspaper}
- \step[fieldset=usera, fieldvalue={N}]
- \step[fieldset=note, fieldvalue=news]%因为没有专门的驱动,记录note方便映射为article后判断
- }
- \map{%对应增加的一个数据库类型database确定文献类型标识符
- \pertype{database}
- \step[fieldset=usera, fieldvalue={DB}]
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{%对应增加的一个数据集类型dataset确定文献类型标识符
- \pertype{dataset}
- \step[fieldset=usera, fieldvalue={DS}]%
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{%对应增加的一个软件类型software确定文献类型标识符
- \pertype{software}
- \step[fieldset=usera, fieldvalue={CP}]
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{%对应增加的一个舆图类型map确定文献类型标识符
- \pertype{map}
- \step[fieldset=usera, fieldvalue={CM}]%
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{%对应增加的一个档案类型archive确定文献类型标识符
- \pertype{archive}
- \step[fieldset=usera, fieldvalue={A}]
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{%因为misc类型本身就是没有类型,而不像其它文献有明确的类型,所以
- %当misc类型带有网址时,直接将其转换为online类型
- \pertype{misc}
- \step[fieldsource=url,final]
- \step[typesource=misc,typetarget=online]
- }
- \map{%对应增加的一个备选类型misc确定文献类型标识符
- \pertype{misc}
- \step[fieldset=usera, fieldvalue={Z}]%
- }
- \map{
- \pertype{book}
- \pertype{inbook}
- \step[fieldset=usera, fieldvalue={M}]
- \step[fieldsource=version] %有时会把version和edition混淆,处理后直接用edition
- \step[fieldset=edition, origfieldval]
- }
- \map{%兼容老的standard类型,确定文献类型标识符
- \pertype{standard}
- \step[fieldset=usera, fieldvalue={S}]
- \step[fieldset=note, fieldvalue=standard]%因为没有专门的驱动,记录note方便映射为book和inbook后判断
- }
- \map{
- \pertype{patent}
- \step[fieldset=usera, fieldvalue={P}]
- }
- \map{
- \pertype{inproceedings}
- \pertype{conference}%兼容老的conference类型
- \step[fieldset=usera, fieldvalue={C}]
- \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=publisher, origfieldval]
- }
- \map{
- \pertype{proceedings}
- \step[fieldset=usera, fieldvalue={C}]
- \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
- \step[fieldset=publisher, origfieldval]
- }
- \map{
- \pertype{incollection}
- \step[fieldset=usera, fieldvalue={G}]
- \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=publisher, origfieldval]
- }
- \map{
- \pertype{collection}
- \step[fieldset=usera, fieldvalue={G}]
- \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
- \step[fieldset=publisher, origfieldval]
- }
- \map{
- \pertype{report}
- \pertype{techreport}%兼容老的techreport类型
- \step[fieldset=usera, fieldvalue={R}]
- \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
- \step[fieldset=publisher, origfieldval]
- }
- \map{
- \pertype{thesis}
- \pertype{mastersthesis}%兼容老的mastersthesis和phdthesis类型
- \pertype{phdthesis}
- \step[fieldset=usera, fieldvalue={D}]
- \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{
- \pertype{online}
- \pertype{electronic}%兼容老的electronic类型
- \pertype{www}%兼容老的www类型
- \step[fieldset=usera, fieldvalue={EB}]
- \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]%因为online的出版项处理类似手册
- \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性
- \step[fieldset=institution, origfieldval]
- }
- \map{
- \pertype{manual}
- \step[fieldset=usera, fieldvalue={A}]
- \step[fieldsource=edition]%有时会把version和edition混淆,处理后使用version
- \step[fieldset=version, origfieldval]
- \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性
- \step[fieldset=institution, origfieldval]
- }
- \map{
- \pertype{unpublished}
- \step[fieldset=usera, fieldvalue={Z}]
- }
- \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
- \step[fieldsource={author}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
- }
- \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
- \step[fieldsource={editor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
- }%
- \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
- \step[fieldsource={translator}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
- }%
- \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
- \step[fieldsource={bookauthor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
- }%
- \map{%处理一些用year表示date的情况
- %这样处理将会设置date域,并使得labeldatesource变为空,因为date的前缀为空(如果是urldate,那么labeldatesource就是url)。
- %同时date域会被biblatex自动解析为year,month,day,并且覆盖原来的year信息
- \step[fieldsource=year]
- \step[fieldset=date, origfieldval]
- }
- \map{%将entrykey放入keywords中用于后期使用
- \step[fieldsource=entrykey]
- \step[fieldset=keywords, origfieldval]
- }
- \map{\step[fieldsource=title,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
- \step[fieldset=userd,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
- }
- \map{%
- \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final]
- \step[fieldset=userd,fieldvalue={russian}]%俄语
- }
- \map{%
- \step[fieldsource=title,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
- \step[fieldset=userd,fieldvalue={japanese}]%日语
- } %确定形式后可增加类似andotherscn这样的本地化字符串处理
- \map{%
- \step[fieldsource=title,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
- \step[fieldset=userd,fieldvalue={korean}]%韩语
- }
- \map{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题
- \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%
- \step[fieldset=userd, fieldvalue={chinese}]
- }
- \map{%将没有设置userd,且存在title域的默认设置为英文
- \step[fieldsource=title,final]
- \step[fieldset=userd,fieldvalue={english}]
- }
- \map{\step[fieldsource=author,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
- \step[fieldset=userf,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
- }
- \map{%
- \step[fieldsource=author,match=\regexp{[\x{0400}-\x{052F}]},final]
- \step[fieldset=userf,fieldvalue={russian}]%俄语
- }
- \map{%
- \step[fieldsource=author,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
- \step[fieldset=userf,fieldvalue={japanese}]%日语
- } %确定形式后可增加类似andotherscn这样的本地化字符串处理
- \map{%
- \step[fieldsource=author,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
- \step[fieldset=userf,fieldvalue={korean}]%韩语
- }
- \map{%作者的中文判断
- \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
- \step[fieldset=userf, fieldvalue={chinese}]
- }
- \map{%将没有设置userf,且存在author域的默认设置为英文
- \step[fieldsource=author,final]
- \step[fieldset=userf,fieldvalue={english}]
- }
- \map{\step[fieldsource=translator,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
- \step[fieldset=usere,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
- }
- \map{%
- \step[fieldsource=translator,match=\regexp{[\x{0400}-\x{052F}]},final]
- \step[fieldset=usere,fieldvalue={russian}]%俄语
- }
- \map{%
- \step[fieldsource=translator,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
- \step[fieldset=usere,fieldvalue={japanese}]%日语
- } %确定形式后可增加类似andotherscn这样的本地化字符串处理
- \map{%
- \step[fieldsource=translator,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
- \step[fieldset=usere,fieldvalue={korean}]%韩语
- }
- \map{%译者的中文判断
- \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
- \step[fieldset=usere, fieldvalue={chinese}]
- }
- \map{%将没有设置usere,且存在translator域的默认设置为英文
- \step[fieldsource=translator,final]
- \step[fieldset=usere,fieldvalue={english}]
- }
- \map{\step[fieldsource=editor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
- \step[fieldset=userc,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
- }
- \map{%
- \step[fieldsource=editor,match=\regexp{[\x{0400}-\x{052F}]},final]
- \step[fieldset=userc,fieldvalue={russian}]%俄语
- }
- \map{%
- \step[fieldsource=editor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
- \step[fieldset=userc,fieldvalue={japanese}]%日语
- } %确定形式后可增加类似andotherscn这样的本地化字符串处理
- \map{%
- \step[fieldsource=editor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
- \step[fieldset=userc,fieldvalue={korean}]%韩语
- }
- \map{%编者的中文判断
- \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5
- \step[fieldset=userc, fieldvalue={chinese}]
- }
- \map{%将没有设置userc,且存在editor域的默认设置为英文
- \step[fieldsource=editor,final]
- \step[fieldset=userc,fieldvalue={english}]
- }
- \map{\step[fieldsource=bookauthor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
- \step[fieldset=userb,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
- }
- \map{%
- \step[fieldsource=bookauthor,match=\regexp{[\x{0400}-\x{052F}]},final]
- \step[fieldset=userb,fieldvalue={russian}]%俄语
- }
- \map{%
- \step[fieldsource=bookauthor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
- \step[fieldset=userb,fieldvalue={japanese}]%日语
- } %确定形式后可增加类似andotherscn这样的本地化字符串处理
- \map{%
- \step[fieldsource=bookauthor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
- \step[fieldset=userb,fieldvalue={korean}]%韩语
- }
- \map{%编者的中文判断
- \step[fieldsource=bookauthor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5
- \step[fieldset=userb, fieldvalue={chinese}]
- }
- \map{%将没有设置userc,且存在editor域的默认设置为英文
- \step[fieldsource=bookauthor,final]
- \step[fieldset=userb,fieldvalue={english}]
- }
- \map{\step[fieldsource=userd,final]%userd存在则用根据标题的语言设定language
- \step[fieldset=language,origfieldval]%本身language存在则不设定
- }
- \map{\step[fieldsource=userf,final]%userd不存在,而userf存在则根据author的语言设定language
- \step[fieldset=language,origfieldval]
- }%如果没有作者和标题,那么剩下的最可能有意义的只有网址了,而网址通常是英文的,因此不用再进一步对其它域进行判断了。
- \map{%将没有设置的language设置成en,即认为不是中文的就是英文的。
- \step[fieldset=language,fieldvalue={english}]
- }
- \map{%一条文献的语言已经设定在language域中,由于出版项相关宏中使用userd判断,
- %所以将一条文献的主体语言设定到userd中,本身前面userd已经设定,但没有处理无标题的情况,
- %这里的处理等价于没有标题时,利用作者的语言设定userd,再没有作者,则默认用英文设定userd
- \step[fieldsource=language]
- \step[fieldset=userd,origfieldval]
- }
- \map{%当文献给出language域时,设置文献要使用的本地化字符串的语言
- \step[fieldsource=language,match=\regexp{(e|E)(n|N)(g|G)(l|L)(i|I)(s|S)(h|H)},final]
- \step[fieldset=langid,fieldvalue={english}]
- }
- \map{
- \step[fieldsource=language,match=\regexp{(r|R)(u|U)(s|S)(s|S)(i|I)(a|A)(n|N)},final]
- \step[fieldset=langid,fieldvalue={russian}]
- }
- \map{%
- \step[fieldsource=language,match=\regexp{(f|F)(r|R)(e|E)(n|N)(c|C)(h|H)},final]
- \step[fieldset=langid,fieldvalue={french}]
- }
- \map{%
- \step[fieldsource=language,match=\regexp{(c|C)(h|H)(i|I)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english,
- \step[fieldset=langid,fieldvalue={english}]
- }
- \map{%
- \step[fieldsource=language,match=\regexp{(j|J)(a|A)(p|P)(a|A)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english,
- \step[fieldset=langid,fieldvalue={english}]
- }
- \map{%
- \step[fieldsource=language,match=\regexp{(k|K)(o|O)(r|R)(e|E)(a|A)(n|N)},final]%中日韩语目前都用english,
- \step[fieldset=langid,fieldvalue={english}]
- }
-}
-}
-
-
- %
- % 修改输入的参考文献数据,样式层的操作
- %
- % 原理方法:biblatex3.4以上版本map可使用foreach选项来处理特殊字符
- \DeclareStyleSourcemap{
- \maps[datatype=bibtex]{
- \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook,
- %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义
- %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断
- \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook
- \step[typesource=standard, typetarget=inbook, final]
- }
- \map{%尝试未定义数据模型的standard类型映射为book,standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义
- \step[typesource=standard, typetarget=book, final]%当不存在booktitle域是映射为book
- }
-% \map{%先于标准样式的driver层映射,将其先映射过来,并取消type设置
-% \step[typesource=mastersthesis, typetarget=thesis, final]
-% %\step[fieldset=type, fieldvalue=mathesis]
-% }
-% \map{%先于标准样式的driver层映射,将其先映射过来,并取消type设置
-% \step[typesource=phdthesis, typetarget=thesis, final]
-% %\step[fieldset=type, fieldvalue=phdthesis]
-% }
- \map{%先于标准样式的driver层映射,将其先映射过来,并取消type设置
- \step[typesource=techreport, typetarget=report, final]
- %\step[fieldset=type, fieldvalue=techreport]
- }
- \map{%
- \pertype{report}
- \step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=report,typetarget=online]
- \step[fieldset=note,fieldvalue={report}]
- }
- \map{%
- \pertype{thesis}
- \step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=thesis,typetarget=online]
- }
- \map{%
- \pertype{manual}
- \step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=manual,typetarget=online]
- }
- \map{%
- \pertype{unpublished}
- \step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=unpublished,typetarget=online]
- }
- \map{%
- \pertype{database}
- \step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=databasetypetarget=online]
- }
- \map{%
- \pertype{dataset}
- \step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=dataset,typetarget=online]
- }
- \map{%
- \pertype{software}
- \step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=software,typetarget=online]
- }
- \map{%
- \pertype{map}
- \step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=map,typetarget=online]
- }
- \map{%
- \pertype{archive}
- \step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=archive,typetarget=online]
- }
- \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确)
- \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸
- \step[fieldset=keywords, fieldvalue={,}, append]
- \step[fieldset=keywords, origfieldval, append]
- }
- \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{
- \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}]
- }
- \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{
- \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}]
- }
- \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,%
- address,location,institution,organization}]{
- \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
- }
- }
- }
-
-%
-%驱动别名等价于驱动层映射
-%
-\DeclareBibliographyAlias{newspaper}{article}%
-\DeclareBibliographyAlias{inproceedings}{inbook}%会议论文文献类型驱动
-\DeclareBibliographyAlias{conference}{inbook}%会议论文文献类型驱动
-\DeclareBibliographyAlias{incollection}{inbook}%文集中析出文献类型驱动
-\DeclareBibliographyAlias{collection}{book}%%文集类型驱动
-\DeclareBibliographyAlias{proceedings}{book}%会议论文集文献类型驱动
-\DeclareBibliographyAlias{thesis}{manual}%学位论文驱动
-\DeclareBibliographyAlias{unpublished}{manual}%其它类型驱动
-\DeclareBibliographyAlias{database}{manual}
-\DeclareBibliographyAlias{dataset}{manual}
-\DeclareBibliographyAlias{software}{manual}
-\DeclareBibliographyAlias{map}{manual}
-\DeclareBibliographyAlias{archive}{manual}
-
-
-%=====================================================================
-% 参考文献表环境
-%=====================================================================
-%
-% 列表格式
-%
-% 增加一个\bibitemindent尺寸用于控制list环境的itemindent
-% v1.0l,20180615,hzz
-% v1.0t,20200319,hzz,增加尺寸\biblabelextend使某些字体下标签宽度不足时可增加标签宽度
-\setlength{\bibhang}{\biblabelsep}%
-\newlength{\bibitemindent}
-\setlength{\bibitemindent}{0pt}
-\newlength{\biblabelextend}
-\setlength{\biblabelextend}{0pt}
-
-
-\defbibenvironment{bibliography}
- {\list
- {\printtext[labelnumberwidth]{%
- \printfield{labelprefix}%
- \printfield{labelnumber}}}
- {\addtolength{\labelnumberwidth}{\biblabelextend}%
- \setlength{\labelwidth}{\labelnumberwidth}%
- \setlength{\labelsep}{\biblabelsep}%
- \setlength{\leftmargin}{\bibhang}%
- \addtolength{\leftmargin}{\labelnumberwidth}%
- \setlength{\itemindent}{\bibitemindent}%
- \setlength{\itemsep}{\bibitemsep}%
- \setlength{\parsep}{\bibparsep}}%
- \renewcommand*{\makelabel}[1]{\hss##1}}
- {\endlist}
- {\item}
-
-%
-% 顺序编码制-标签对齐方式处理
-%
-% 原理方法:利用选项提供的计数器数值做选择
-% 左对齐,右对齐为list环境下的处理,此时list环境的\labelwidth只能设置一个,是最宽标签的宽度
-% 项对齐则是在段落环境下做的处理。
-% 左对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距可变
-% 右对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距相等,标签与页边距离可变
-% 项对齐时,序号标签贴在页边,序号标签与参考文献项内容的间距相等
-% 修改序号标签格式为:
-% \DeclareFieldFormat{shorthandwidth}{\mkbibbrackets{#1}} %源来自numeric.BBX
-% \DeclareFieldFormat{labelnumberwidth}{\ttfamily\mkbibbrackets{#1}\hfill}
-\DeclareFieldFormat{labelnumberwidth}{%
-\ifcase\value{gbalignlabel}%右对齐,整个标签为右对齐
- \mkgbnumlabel{#1}%
-\or%左对齐,整个标签为左对齐
- \mkgbnumlabel{#1}\hfill%
-\or%中间对齐,比如:序号数字居于[]中间
- \hfil\mkgbnumlabel{\hfill#1\hfill}\hfil%
-\fi}
-
-%
-% 修改序号标签格式为以各条参文献为基础进行对齐的方式,即序号与条目内容间隔相等的方式。
-\def\setaligngbstyle{%
-\def\blx at bibitem##1{%
- \blx at ifdata{##1}
- {\begingroup
- \blx at getdata{##1}%
- \blx at bibcheck
- \iftoggle{blx at skipentry}{}{%
- \blx at setdefaultrefcontext{##1}%
- \global\let\blx at noitem\@empty
- \blx at setoptions@type\abx at field@entrytype
- \blx at setoptions@entry
- \blx at thelabelnumber
- \addtocounter{instcount}\@ne
- \blx at initsep
- \blx at namesep
- \csuse{blx at item@\blx at theenv}\relax
-% \blx at initsep %移动到上面去,恢复bibnamesep等的作用机制
-% \blx at namesep
- \csuse{blx at hook@bibitem}%
- \blx at execute
- \blx at initunit
- \blx at anchor
- \blx at beglangbib
- \bibsentence
- \blx at pagetracker
- \blx at driver\abx at field@entrytype
- \blx at postpunct
- \blx at endlangbib}%
- \par\endgroup}%这里增加了一个\par
- {}}
-\newlength{\lengthid}
-\newlength{\lengthlw}
-\newcommand{\itemcmd}{%
-\settowidth{\lengthid}{\mkgbnumlabel{\printfield{labelnumber}}}
-\addtolength{\lengthid}{\biblabelsep}
-\setlength{\lengthlw}{\textwidth}
-\addtolength{\lengthlw}{-\lengthid}
-\addvspace{\bibitemsep}%恢复\bibitemsep的作用
-%\parshape 2 0em \textwidth \lengthid \lengthlw
-\hangindent\lengthid
-\mkgbnumlabel{\printfield{labelnumber}}%
-\hspace{\biblabelsep}}
-%
-% 简单的段落环境
-\defbibenvironment{bibliography}
-{\begingroup\setlength{\parindent}{0em}}
-{\endgroup}
-{\itemcmd}}
-
-
-%=====================================================================
-% 设置单元或块等的标点
-%=====================================================================
-\renewrobustcmd*{\bibinithyphendelim}{\addhighpenspace}%用于处理姓名中名部分存在-的情况,比如ZHANG Yu-xin
-\renewcommand*{\subtitlepunct}{\addcolon\addspace} %修改标题和其它标题信息间的标点,来源biblatex.def,
-%
-% 利用set实现的多语言文献不同语言间的分隔符
-% 20170411,双语之间用newline替换par,避免采用gb7714-2015的项对齐方式第二语言间分段导致没有缩进
-%
-% 原理方法:set方法可以参考3.11.5 Entry Sets,4.11.1 Entry Sets
-% 这里调整一下两种语言参考文献的间隔,源来自biblatex.def
-\renewcommand*{\entrysetpunct}{\adddot\newline\nobreak}
-\renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%%页码引用格式的修改,修改为用冒号
-%\renewcommand{\relateddelim}{}%\par
-
-%=====================================================================
-% 修改域的格式,重定义域的输出宏
-%=====================================================================
-%
-% 新增文献类型标识符的格式
-% []前的nobreak,从GB4.1节的例子看不应该加,所以去掉
-% 但因为考虑到cjk字符和[]之间可能添加空格,所以仍然加上
-% 而[]中间的内容,从4.6.2节的例子看也是可以分割的,因此内部的nobreak也可以去掉
-%
-\DeclareFieldFormat{gbtypeflag}{%
-\iftoggle{bbx:gbmedium}%
-{\iftoggle{bbx:url}%
- {\iffieldundef{url}%当存在url时,增加一个OL标识符
- {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}%
- {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}%
- }%
- {\ifentrytype{online}%
- {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}%
- {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}%
- }}%
- {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}%
-}
-
-%
-% 新增用于报纸的文献类型标识符的格式
-%
-\DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper
-\iftoggle{bbx:gbmedium}%
-{\iftoggle{bbx:url}%
- {\iffieldundef{url}%当存在url时,增加一个OL标识符
- {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
- {\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}%
- }%
- {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
-}{\nobreak\printtext{[}\nobreak N\printtext{]}\nobreak}%
-}
-
-%
-% 新增用于标准的文献类型标识符的格式
-%
-\DeclareFieldFormat{gbtypeflags}{%用于标准standard
-\iftoggle{bbx:gbmedium}%
-{\iftoggle{bbx:url}%
- {\iffieldundef{url}%当存在url时,增加一个OL标识符
- {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
- {\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}%
- }%
- {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
-}{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}%
-}
-
-%
-% 重设title等参考文献信息的输出格式
-%
-% 原理方法:修改来自biblatex.def文件的原格式
-\newcommand{\bibtitlefont}{}
-\newcommand{\bibauthorfont}{}
-\newcommand{\bibpubfont}{}
-
-%
-% 作者信息的输出格式
-%
-% 20180425,v1.0k,为作者增加字体控制命令,Hu Zhenzhen
-% 20180603,v1.0l,增加使用nameformat域来选择姓名格式
-\DeclareNameFormat{namefmtselected}{%
-\iffieldundef{namefmtid}{}%
-{\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}%
-\ifcase\value{gbnamefmtcase}%
- \ifgiveninits
- {\usebibmacro{name:gbuppercase}
- {\namepartfamily}
- {\namepartgiveni}
- {\namepartprefix}
- {\namepartsuffix}}
- {\usebibmacro{name:gbuppercase}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}}%
-\or
- \ifgiveninits
- {\usebibmacro{name:gblowercase}
- {\namepartfamily}
- {\namepartgiveni}
- {\namepartprefix}
- {\namepartsuffix}}
- {\usebibmacro{name:gblowercase}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}}%
-\or
- \ifgiveninits
- {\usebibmacro{name:given-family}
- {\namepartfamily}
- {\namepartgiveni}
- {\namepartprefix}
- {\namepartsuffix}}
- {\usebibmacro{name:given-family}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}}%
-\or
- \ifgiveninits
- {\usebibmacro{name:family-given}
- {\namepartfamily}
- {\namepartgiveni}
- {\namepartprefix}
- {\namepartsuffix}}
- {\usebibmacro{name:family-given}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}}%
-\or
-\usebibmacro{name:gbpinyin}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}%
-\or
- \ifnumequal{\value{listcount}}{1}
- {\ifgiveninits
- {\usebibmacro{name:family-given}
- {\namepartfamily}
- {\namepartgiveni}
- {\namepartprefix}
- {\namepartsuffix}}
- {\usebibmacro{name:family-given}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}}%
- \ifboolexpe{%
- test {\ifdefvoid\namepartgiven}
- and
- test {\ifdefvoid\namepartprefix}}
- {}
- {\usebibmacro{name:revsdelim}}}
- {\ifgiveninits
- {\usebibmacro{name:given-family}
- {\namepartfamily}
- {\namepartgiveni}
- {\namepartprefix}
- {\namepartsuffix}}
- {\usebibmacro{name:given-family}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}}}%
-\fi
- \usebibmacro{name:andothers}}
-
-\DeclareNameAlias{default}{namefmtselected}%姓名的默认格式采用可选的模式
-\DeclareNameAlias{sortname}{default}% Used in the bibliography %family-given/given-family
-\DeclareNameAlias{citename}{default}% Default used by \citename
-
-\DeclareDelimFormat[bib,biblist]{andothersdelim}{\addcomma\addspace}
-%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}%
-
-%GB/T 7714-2015 风格,全部大写
-\newbibmacro*{name:gbuppercase}[4]{\bibauthorfont%
-\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
-\renewcommand*{\revsdnamepunct}{}%
- \ifuseprefix%
- {\usebibmacro{name:delim}{#3#1}%
- \usebibmacro{name:hook}{#3#1}%
- \ifdefvoid{#3}{}{%
- \ifcapital%
- {\mkbibnameprefix{\MakeCapital{#3}}\isdot}%
- {\mkbibnameprefix{#3}\isdot}%
- \ifprefchar{}{\bibnamedelimc}}%
- \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
- \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号
- {\usebibmacro{name:delim}{#1}%
- \usebibmacro{name:hook}{#1}%
- \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
- \ifboolexpe{%
- test {\ifdefvoid{#2}}
- and
- test {\ifdefvoid{#3}}}
- {}{\revsdnamepunct}%
- \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
- \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号
-}
-
-%GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出
-\newbibmacro*{name:gblowercase}[4]{\bibauthorfont%
- \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
- \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
- \ifuseprefix
- {\usebibmacro{name:delim}{#3#1}%
- \usebibmacro{name:hook}{#3#1}%
- \ifdefvoid{#3}{}{%
- \ifcapital
- {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
- {\mkbibnameprefix{#3}\isdot}%
- \ifprefchar{}{\bibnamedelimc}}%
- \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot%
- \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号
- {\usebibmacro{name:delim}{#1}%
- \usebibmacro{name:hook}{#1}%
- \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot%
- \ifboolexpe{%
- test {\ifdefvoid{#2}}
- and
- test {\ifdefvoid{#3}}}
- {}{\revsdnamepunct}%
- \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}
- \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号
-}
-
-%中文常见风格,汉语拼音全拼模式
-\newbibmacro*{name:gbpinyin}[4]{\bibauthorfont%
-\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY
-\renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
-\renewrobustcmd*{\bibnamedelima}{\mbox{-}}%
- \ifuseprefix
- {\usebibmacro{name:delim}{#3#1}%
- \usebibmacro{name:hook}{#3#1}%
- \ifdefvoid{#3}{}{%
- \ifcapital
- {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
- {\mkbibnameprefix{#3}\isdot}%
- \ifprefchar{}{\bibnamedelimc}}%
- \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
- \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamegiven{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}
- {\usebibmacro{name:delim}{#1}%
- \usebibmacro{name:hook}{#1}%
- \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
- \ifboolexpe{%
- test {\ifdefvoid{#2}}
- and
- test {\ifdefvoid{#3}}}
- {}
- {\revsdnamepunct}%
- \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeCapital{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}
- \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%
-}
-
-
-\def\UrlFont{\rmfamily}%设置url字体为roman字体%\ttfamily
-%\urlstyle{rm} %使用这句也一样
-\setcounter{biburlnumpenalty}{100} %让url可以在数字后断行
-\setcounter{biburlucpenalty}{100} %让url可以在大写字母后断行
-\setcounter{biburllcpenalty}{100} %让url可以在小写字母后断行
-\DeclareFieldFormat{doi}{%
- \rmfamily{DOI}\addcolon\space
- \ifhyperref
- {\href{https://doi.org/#1}{\nolinkurl{#1}}}
- {\nolinkurl{#1}}}
-
-\DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{-}}%将页码间隔符替换会英文的短横线
-
-%
-% beamer中文献标题后的标点问题
-% v1.0k,20180405,为texlive2017以上版本中的beamer兼容性做的处理,Hu Zhenzhen
-%
-% 原理方法:如下代码处理texlive2017以上版本中,beamer中文献的标题后出现两个点的情况:
-% texlive2017以上的beamer中对macro{title}做了patch,正常情况下不会出现两个点的情况,但由于
-% 之前为了处理texlive2015,2016下的title格式添加了adddot,导致出现两个点的情况,而且也影响
-% 析出文献的//符号的输出,因此再次对macro{title}做patch消除beamer中做apptocmd时添加的\newunitpunct
-\@ifclassloaded{beamer}{
- \DeclareFieldFormat{title}{#1}%
- \DeclareFieldFormat[article,patent,thesis,unpublished]{title}{#1}
- \AtBeginDocument{%
- \patchcmd{\abx at macro@title}{\newunitpunct}{}{}{}}}{}
-
-
- %
- % 专利的公告日期、或报纸的日期的输出宏
- % 20160701,v1.0,新增加
- % 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen
- %
- % 原理方法:加上printtext避免破坏异步标点机制
- % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份
- % 所以无法再用选项设置的方法,印象需要用底层的命令
- % 这里可以用\blx at isodate,但用自定义的\blx at gbdate,以避免版本判断
- \newbibmacro*{newsdate}{%%
- \printtext{\blx at gbdate{}{}}%%\blx at isodate{}{}%
- }
-
- \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式
- \ifboolexpr{%
- test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
- }%
- {}%更新或修改日期通常有day信息
- {\iffieldundef{year}{%
- \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}%
- {\printtext{(}\printenddate\printtext{)}}%
- }{\iffieldequalstr{year}{}{%因为year存在,但为空
- }{\printtext{(}\blx at gbdate{}{}\printtext{)}}%
- }%
- }}%
-
-
- %
- % biblatex>v3.8版利用related实现双语文献的处理
- %
- %为了实现v3.8以上版本的双语文献,采用related的方法代替set方法,因为set方法已经无法实现了,
- %因为set不再复制其第一个成员的信息。于是定义一个命令,用于动态的修改数据,即添加related域的信息
- %其中使用了\DeclareStyleSourcemap,但由于其只能出现在导言区中,因此\defdoublelangentry命令也只能出现在导言区中
- \newcommand{\defdoublelangentry}[2]{%
- \edef\entrykeya{#1}
- \edef\entrykeyb{#2}
- \DeclareStyleSourcemap{
- \maps[datatype=bibtex]{
- \map{
- \step[fieldsource=entrykey, match=\entrykeya, final]
- \step[fieldset=related, fieldvalue=\entrykeyb]
- }
- }
- }
- }
-
- % 关联文献的输出格式
- %
- % 关联文献间的分隔符
- %
- \renewcommand{\relateddelim}{\adddot\newline\nobreak}%\par,而作者年样式不需要修改,因为没有项对齐的标签问题
- %
- % 关联文献块前的分隔符,针对biblatex>3.11
- %
- % 原理方法:因为增加了begrelateddelim钩子,所以不需要重定义related输出宏
- \ifdef{\begrelateddelim}{\renewcommand{\begrelateddelim}{\adddot\newline\nobreak}}{}
-
-
-
-%
-% 新增一个样式用于调整期刊年份的格式,只打印年份
-%
-\newbibmacro*{periodical+issue}{%
- \printtext{%去掉了[parens]
- \iffieldundef{issue}
- {%\usebibmacro{date}%修改为下一句
- }%
- {\printfield{issue}%
- \setunit*{\addspace}%
- %\usebibmacro{date}%修改为下一句
- }%
- }%
- %\newunit
-}
-
-%
-% 重设专利title的输出,将文献类型标识符输出出去
-%
-\renewbibmacro*{patenttitle}{%原输出来自biblatex.def文件
- \ifboolexpr{%
- test{\iffieldundef{title}}%
- and%
- test{\iffieldundef{subtitle}}%
- }%
- {}%
- {\printtext[title]{\bibtitlefont%
- \printfield[titlecase]{title}%
- \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
- {}{\setunit{\subtitlepunct}%
- \printfield[titlecase]{subtitle}}%
- \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
- {\setunit{\subtitlepunct}\printfield{titleaddon}}%
- \setunit{\subtitlepunct}\printfield{number}%写专利号
- \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}%
- %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
- %\newunit
- }%
-}%
-}
-
-%
-% 编者类型的本地化字符串输出
-% v1.0q 2019-03-01 hzz
-% 能对不同条目类型作格式设置的域格式,能对不同环境做格式设置的分隔符
-% 能对不同文境作设置的包括排序,标签等
-% 这里因为考虑可能标注和文献表中存在不同,所以用分隔符来输出本地化字符串
-%
-\DeclareDelimFormat{streditortypes}{%
- \edef\userfieldabcde{userd}%
- \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
- \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
- \ifcase\value{gbbiblocalcase}%
- \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}scn}}{}%
- \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}skr}}{}%
- \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}sjp}}{}%
- \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}%
- \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}%
- \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}%
- \or%
- \bibstring{\thefield{editortype}scn}%
- \or%
- \addcomma\addthinspace\bibstring{\thefield{editortype}s}%
- \fi}%
-%
-\DeclareDelimFormat{streditortype}{%
- \edef\userfieldabcde{userd}%
- \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
- \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
- \ifcase\value{gbbiblocalcase}%
- \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}cn}}{}%
- \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}kr}}{}%
- \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}jp}}{}%
- \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}%
- \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}%
- \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}%
- \or%
- \bibstring{\thefield{editortype}cn}%
- \or%
- \addcomma\addthinspace\bibstring{\thefield{editortype}}%
- \fi}%
-
-
-%
-% 修改series域的输出格式
-% 2019.05.01,v1.0r,byhzz
-\renewbibmacro*{series+number}{%
- \printfield{series}%
- %\setunit*{\addspace}%
- %\printfield{number}%
- %\newunit
- }
-
-%=====================================================================
-%设置驱动格式
-%=====================================================================
-
-%中文环境的局部化代码
-\def\localsetchinesecode{%
-\ifboolexpr{%
-togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}}%
-}%
-{%
-\iftoggle{bbx:gbfieldstd}{}{%
-\DeclareFieldFormat{title}{##1\adddot\addthinspace}%
-\DeclareFieldFormat{journaltitle}{##1\isdot}%添加\isdot用于缩写名带点情况,将其转换为缩写点,便于标点的追踪
-\DeclareFieldFormat{issuetitle}{##1}%
-\DeclareFieldFormat{maintitle}{##1}%
-\DeclareFieldFormat{booktitle}{##1}%
-\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉
- [article,patent,thesis,unpublished]%
- {title}{##1\adddot\addthinspace}%\mkbibquote{##1\isdot}
-\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉
- [inbook,incollection,inproceedings]%
- {title}{##1}%\nopunct\unspace
-\DeclareFieldFormat{url}{\url{##1}}%%url相关输出,url域修改如本行,源来自biblatex.def
-%
-% 标题的字母大小写格式修改
-%
-% 注意:修改标题的字母大小写,不能用前面的title的格式而要用titlecase
-% 因为titlecase is applied to the contents of the field directly,title is not
-%\DeclareFieldFormat{titlecase}{\MakeCapital##1}%重设标题格式,将其修改为首字母大写
-\DeclareFieldFormat{titlecase}{\iftoggle{bbx:titlelink}{%
-\iffieldundef{url}{\MakeCapital##1}{%
-\href{\thefield{url}}{##1}}}{\MakeCapital##1}}%重设标题格式,将其修改为首字母大写
-\DeclareFieldFormat{pages}{##1}%去掉前面引导页码的pp.等字符,\mkpageprefix[bookpagination]{##1}
-}%
-%
-% 修改译者位置格式
-%
-% 原理方法:修改来自biblatex.def文件的bytranslator+others宏的格式
-\renewbibmacro*{bytranslator+others}{%
- \ifnameundef{translator}%
- {}%
- {%\usebibmacro{bytranslator+othersstrg}
- %\setunit{\addspace}%
- \printnames[bytranslator]{translator}%
- \clearname{translator}%
- %从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理
- %比如生成cotranslator等用于调用cotranslator所代表的当地化字符串
- \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。
- %\setunit{\addspace}%
- \newunit}%
- \usebibmacro{withothers}}%
-%
-% 修改作者数量超过限定值,做省略时的处理格式
-% v1.0,20160701,hzz
-% v1.0O,20190103,hzz,修改利用新定义的一个分隔符strandothersdelim
-%
-% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。
-\renewbibmacro*{name:andothers}{%
- \ifboolexpr{%
- test {\ifnumequal{\value{listcount}}{\value{liststop}}}%
- and
- test \ifmorenames
- }{\ifnumgreater{\value{liststop}}{1}%
- {\finalandcomma}%
- {}%
-\printdelim{andothersdelim}\printdelim{strandothersdelim}%
-}{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如:
-%袁训来, 陈哲, 肖书海, 等.
-%胡泳, 范海燕, 译.
-%潘惠霞, 魏婧, 杨艳, 等译.
-\ifcurrentname{translator}{\addcomma\addthinspace}{}%为了实现上述第二个示例情况做的处理
-}}%
-%
-% 修改省略作者后的本地化字符串,比如et al.
-% v1.0o,20190103,hzz
-%
-% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andotherscn=“等”,否则用andothers=“et al.”。
-% 非默认情况,根据选项信息,选择选择强制中文或英文
-% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了
-% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置
-\DeclareDelimFormat{strandothersdelim}{%
- \edef\userfieldabcde{userd}%
- \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
- \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
- \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
- \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
- \ifcase\value{gbbiblocalcase}%
- \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}%
- \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}%
- \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andothersjp}}{}%
- \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}%
- \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%
- \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%
- \or%
- \bibstring{andotherscn}%
- \or%
- \bibstring{andothers}%
- \fi}%
-%
-% 修改最后一个作者前的字符串,比如 and
-% v1.0o,20190103,hzz
-%
-% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andcn=“和”,否则用and=“and”。
-% 非默认情况,根据选项信息,选择选择强制中文或英文
-% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了
-% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置
-\DeclareDelimFormat{finalnamedelim}{%
- \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
- \addspace%
- \edef\userfieldabcde{userd}%
- \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
- \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
- \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
- \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
- \ifcase\value{gbbiblocalcase}%
- \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}%
- \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
- \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}%
- \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}%
- \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}%
- \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}%
-\space%
- \or%
- \bibstring{andcn}\space%
- \or%
- \bibstring{and}\space%
- \fi}%
-%
-% url和url日期格式
-%
- \renewbibmacro*{url+urldate}{%
- %\usebibmacro{url}%%更换url的位置,放到下面
- \iffieldundef{urlyear}%
- {}{%\setunit*{\addspace}%
- \usebibmacro{urldate}}%
- \setunit{\addperiod\addspace}%
- \usebibmacro{url}}%
- \renewbibmacro*{url}{\printfield{url}}%
-%
-% 重设title的输出
-%
-% 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen
-% 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件
-% 利用toggle做标识符是否输出的判断
-\renewbibmacro*{title}{%
- \ifboolexpr{%
- test{\iffieldundef{title}}%
- and
- test{\iffieldundef{subtitle}}%
- }%
- {}%
- {\printtext[title]{\bibtitlefont%增加字体控制命令
- \printfield[titlecase]{title}%
- \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
- {}{\setunit{\subtitlepunct}%
- \printfield[titlecase]{subtitle}}%
- \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
- {\setunit{\subtitlepunct}\printfield{titleaddon}}%
- \iftoggle{bbx:gbtype}{%
- \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准
- {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准
- {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸
- {\printfield[gbtypeflag]{usera}}}%其它
- }}{}%
- %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
- %\newunit
-}%
-}}%
-%
-% 日期信息的输出格式,针对biblatex<3.7版本
-%
-\DeclareFieldFormat{urldate}{##1}%
-\renewbibmacro*{urldate}{%
-\addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx at edtfdate这种更底层的命令
-%
-% 调整doi+eprint+url格式
-%
-% 原理方法:源来自standard.bbx,因为页码后面直接跟引用日期,没有标点所以去掉其中的标点。
-\renewbibmacro*{doi+eprint+url}{%
-% \iftoggle{bbx:doi}%把doi的位置放到url后面
-% {\printfield{doi}}
-% {}%
- %\newunit\newblock
- \iftoggle{bbx:eprint}
- {\iffieldundef{eprint}{}{\newunit\usebibmacro{eprint}}}
- {}%
- %\newunit\newblock
- \iftoggle{bbx:url}
- {\usebibmacro{url+urldate}}
- {}
- \newunit\newblock
- \iftoggle{bbx:doi}
- {\printfield{doi}}
- {}}%
-%
-% 调整页码的格式,即chapter+pages格式
-%
-\renewbibmacro*{chapter+pages}{%
-\iftoggle{bbx:gbstrict}{}{%
- \printfield{chapter}}%
- \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出
- \setunit{\bibpagespunct}%
- \printfield{pages}}%
- %\newunit %这里的标点去掉
-}%
-%
-% 当location等出版项超过maxitem缩减后不再输出etal
-%
-\DeclareListFormat{location}{%
- \usebibmacro{list:delim}{##1}%
- ##1\isdot}%
-\DeclareListAlias{institution}{location}%
-\DeclareListAlias{publisher}{location}%
-% 新增一个样式用于输出连续出版物的地址,单位,时间,
-% 用于periodical连续出版物的出版社和地址的处理
-%
-% v1.0k,20180425,为出版信息增加字体控制命令,hzz
-% %类似\newbibmacro*{publisher+location+date}
-\newbibmacro*{location+institution+date}{\bibpubfont%
-\iftoggle{bbx:gbpub}%
-{\testCJKfirst{userd}%
-\ifboolexpr{%
-test {\iflistundef{location}} and test {\iflistundef{institution}}%
-}{\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress}\space :\space\str at nopublisher]}%
-{\printtext{[S.l.\space :\space s.n.\adddot]}}%
-}{%
-\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress]}}{\printtext{[S.l.\adddot]}}}%
- {\printlist{location}}%
-\addcolon\addspace%
-\iflistundef{institution}{%
-\iftoggle{ifCJKforgbt}{\printtext{[\str at nopublisher]}}{\printtext{\mkbibbrackets{s.n.}}}}% \bibstring{nopublisher}%[s.n.\adddot]
-{\printlist{institution}}}%
-\setunit{\addcomma\addspace}%
- %\usebibmacro{date}%
- \printfield{year}%
- \bibrangedash%
- \iffieldundef{endyear}{}{\printfield{endyear}}%
- \newunit}%
-{\printlist{location}%
- \iflistundef{institution}%
- {\setunit*{\addcomma\space}}
- {\setunit*{\addcolon\space}}%
- \printlist{institution}%
- \setunit*{\addcomma\space}%
- \usebibmacro{date}%
- \newunit}%
-}%
-%
-% 通用的出版社和地址的处理
-%
-% 原理方法:当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。
-% 事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。
-% 注意标准standard类型,因为当没有出版项时直接省略,所以做特殊处理
-\renewbibmacro*{publisher+location+date}{\bibpubfont%
-\iftoggle{bbx:gbpub}%
-{\testCJKfirst{userd}%
- \ifboolexpr{ test {\iflistundef{location}} and test {\iflistundef{publisher}} }%
- {\iffieldequalstr{note}{standard}{}{\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress}\space :\space\str at nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}%
- {\iflistundef{location}{%\adddot
- \iffieldequalstr{note}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。
- {\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}}}% \bibstring{noaddress}
- {\printlist{location}\addcolon\addspace}%%\addcolon\addspace%
- \iflistundef{publisher}{%
- \iffieldequalstr{note}{standard}{}%
- {\iftoggle{ifCJKforgbt}{\printtext{[\str at nopublisher]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}%
- {\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}}}%
- {\printlist{publisher}}}%
-\setunit*{\addcomma\addspace}%\addcomma\addspace%
-\usebibmacro{date}%%\newunit %去掉这个标点
-}%
-{\printlist{location}%
- \iflistundef{publisher}
- {\setunit*{\addcomma\space}}
- {\setunit*{\addcolon\space}}%
- \printlist{publisher}%
- \setunit*{\addcomma\space}%
- \usebibmacro{date}%%\newunit
- }%
-}%
-%
-% 修改了一个institution+location+date用于manual、report、thesis等类型
-%
-% 20180425,v1.0k,增加了字体控制命令,hzz
-% 20190105,v1.0o,加了一个编组避免\usebibmacro{date}把month和day信息去掉
-\renewbibmacro*{institution+location+date}{\bibpubfont%当没有institution时不处理。
-{\printlist{location}%%加了一个编组避免\usebibmacro{date}把month和day信息去掉
- \iflistundef{institution}
- {\setunit*{\addcomma\space}}
- {\setunit*{\addcolon\space}}%
- \printlist{institution}%
- \setunit*{\addcomma\space}%
- \usebibmacro{date}%
- %\newunit
- }}%
-%
-% 对volume卷信息格式做出修改
-% v1.0o,20190105,hzz
-%
-\DeclareFieldFormat{volume}{%
-\testCJKfirst{userd}%
-\iftoggle{ifCJKforgbt}%
-{\bibstring{serialcn}##1\bibstring{volumecn}}%
-{\bibstring{volume}~##1}%
-}% volume of a book
-\DeclareFieldFormat[article,periodical]{volume}{##1}% volume of a journal
-%
-% 对number册信息格式做出修改
-% v1.0o,20190105,hzz
-%
-\DeclareFieldFormat{number}{##1}%
-\DeclareFieldFormat[book,collection,inbook,%
-incollection,proceedings,inproceedings]{number}{%
-\testCJKfirst{userd}%
-\iftoggle{ifCJKforgbt}%
-{\bibstring{serialcn}##1\bibstring{numbercn}}%
-{##1}%
-}%
-%
-% 对edition版本信息格式做出修改
-%
-\DeclareFieldFormat{edition}{%源来自biblatex.DEF
-\testCJKfirst{userd}%
-\iftoggle{ifCJKforgbt}%
-{\ifinteger{##1}%
-{\printtext{##1\str at edition}}%
-{##1\isdot}}%
-{\ifinteger{##1}%
-{\mkbibordedition{##1}~\bibstring{edition}}%
-{##1\isdot}}}%
-%
-% 对version的版本信息做出修改
-%
-\DeclareFieldFormat{version}{%源来自biblatex.DEF
-\testCJKfirst{userd}%
-\ifinteger{##1}%
-{\iftoggle{ifCJKforgbt}{\printtext{##1\str at edition}}%
-{\mkbibordedition{##1}~\bibstring{version}}}%
-{##1\isdot}}%
-%
-% 修改析出文献的文集的标题与附加标题间的符号
-%
-\renewbibmacro*{booktitle}{%
- \ifboolexpr{%
- test {\iffieldundef{booktitle}}
- and
- test {\iffieldundef{booksubtitle}}
- }%
- {}%
- {\printtext[booktitle]{\bibtitlefont%
- \printfield[titlecase]{booktitle}%
- \setunit{\subtitlepunct}%
- \printfield[titlecase]{booksubtitle}}%
- \newunit%标点换成下一句
- \setunit{\subtitlepunct}}%
- \printfield{booktitleaddon}}%
-%
-% 调整期刊名的格式
-%
-% v1.0k,20180425,增加了字体控制命令,hzz
-\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx
- \usebibmacro{journal}%
- %\setunit*{\addspace}%
- \setunit*{\addcomma\addspace}%修改为增加一个逗号
- \iffieldundef{series}
- {}
- {\newunit
- \printfield{series}%
- \setunit{\addspace}}%
- %\usebibmacro{volume+number+eid}%
- %\setunit{\addspace}%
- \usebibmacro{issue+date}%
- %\setunit{\addcolon\space}%
- \iffieldundef{volume}{}{\setunit{\addcomma\space}}%
- %换成逗号和空格
- \usebibmacro{issue}%
- \usebibmacro{volume+number+eid}%把卷期放到年份后面
- %\newunit
- }%
-%
-% 调整期刊卷和期的格式
-%
-\renewbibmacro*{volume+number+eid}{%源来自standard.bbx
-\iftoggle{bbx:gbfieldstd}{%
- \printfield{volume}%
- \setunit*{\adddot}%
- \printfield{number}%
- \setunit{\addcomma\space}%
- \printfield{eid}}{%
- \printfield{volume}%
- %\setunit*{\adddot}%去掉点号
- %\printfield{number}%
- \iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号
- \iffieldundef{eid}{}{%
- \setunit{\addcomma\space}%
- \printfield{eid}}}}%
-%
-% 调整期刊年份的格式
-%
-\renewbibmacro*{issue+date}{%去掉括号
- \printtext{%去掉了[parens]
- \iffieldundef{issue}
- {%\usebibmacro{date}
- \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸
- {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸
- {\usebibmacro{date}}%
- }}%
- {\iftoggle{bbx:gbstrict}{}{\printfield{issue}%
- \setunit*{\addspace}}%
- %\usebibmacro{date}
- \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸
- {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸
- {\usebibmacro{date}}%
- }}}%
- %\newunit
- }%
-%
-% 调整页码前的标点和去掉期刊文章等页码后面的标点
-%
-\renewbibmacro*{note+pages}{%源来自standard.bbx
- %\printfield{note}%不要note,note用来判断是否是报纸newspaper
- \iffieldundef{pages}{}{%
- \setunit{\bibpagespunct}%
- \printfield{pages}}%
- %\newunit
- }%
-%
-% 编者的符号修改一下
-% v1.0 2016-07-01
-% v1.0q 2019-03-01 hzz 修改editortype前的标点
-%
-\renewbibmacro*{editor}{%源来自biblatex.DEF
- \ifboolexpr{%
- test \ifuseeditor
- and
- not test {\ifnameundef{editor}}%
- }%
- {\printnames{editor}%
- \iffieldundef{editortype}%增加一个类型判断,用于存在editortype的情况
- {\setunit\addspace}%当没有editortype时,直接用句点
- {%\setunit{\addcomma\space}%
- \usebibmacro{editorstrg}}%
- %\clearname{editor}
- }%
- {}}%
-%
-% 编者类型做一修改
-% v1.0 2016-07-01
-% v1.0q 2019-03-01 hzz 修改editortype不同语言的不同本地化字符串
-%
-\renewbibmacro*{editorstrg}{%源来自biblatex.DEF
- \printtext[editortype]{%
- \iffieldundef{editortype}%
- {%
-% \ifboolexpr{ %这一段去掉,未定义编者类型情况下不处理
-% test {\ifnumgreater{\value{editor}}{1}}
-% or
-% test {\ifandothers{editor}}
-% }
-% {\bibstring{editors}}
-% {\bibstring{editor}}
- }%
- {\ifbibxstring{\thefield{editortype}}%定义编者类型情况下处理,以后根据需要修改
- {\ifboolexpr{%
- test {\ifnumgreater{\value{editor}}{1}}%
- or
- test {\ifandothers{editor}}%
- }%
- {\printdelim{streditortypes}}%
- {\printdelim{streditortype}}}%
- {\thefield{editortype}}}%
- }}%
-%
-% bookauthor域的输出,
-% v1.0q 2019-03-01 hzz
-% 不再对editor和bookauthor做sourcemap,而是下面的宏内逻辑代替,
-% 使得除使用bookauthor外也可以使用editor,便于在使用editor时使用editortype
-\renewbibmacro*{bybookauthor}{%
- \ifnameundef{bookauthor}%
- {\ifnameundef{editor}%
- {}%
- {\ifnamesequal{author}{editor}%
- {}{\usebibmacro{editor}}}%
- }%
- {\ifnamesequal{author}{bookauthor}%
- {}{\printnames{bookauthor}}%
- }%
-}%
-%
-% 修改期刊的标题
-%
-\renewbibmacro*{periodical}{%源来自biblatex.DEF
- \iffieldundef{title}
- {}%
- {\printtext[title]{\bibtitlefont%
- \printfield[titlecase]{title}%
- %\setunit{\subtitlepunct}%
- \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
- {}{\setunit{\subtitlepunct}
- \printfield[titlecase]{subtitle}}%
- %}%把编组结束移到后面去
- \iftoggle{bbx:gbtype}{%
- \iffieldundef{usera}{}{%在标题后直接给出文献标识字母
- \printfield[gbtypeflag]{usera}}}{}%
- }}%
- }%
-%
-% 期刊的标题做修改
-%
-\renewbibmacro*{title+issuetitle}{%源来自standard.BBX
- \usebibmacro{periodical}%
- %\setunit*{\addspace}%
- \setunit*{\adddot\addspace}%标点修改为句点
- \iffieldundef{series}
- {}%
- {\newunit
- \printfield{series}%
- \setunit{\addspace}}%
- \usebibmacro{periodical+issue}%将issue调整到上面来,并修改
-\iffieldundef{number}{}{%%进一步处理有范围的数字
- \multinumberparser{\thefield{number}}}%
- \iffieldundef{volume}%
- {\printfield{year}%
- \printtext{\mkbibparens{\multinumberfirst}}%
- \bibrangedash%
- \iffieldundef{endyear}{}{\printfield{endyear}\printtext{\mkbibparens{\multinumbersecond}}}%
- }%
- {\multivolparser{\thefield{volume}}%
- \printfield{year}%
- \setunit{\addcomma\space}%将冒号修改为逗号
- \printtext{\multivolfirst}%
- \printtext{\mkbibparens{\multinumberfirst}}%
- \bibrangedash%
- \iffieldundef{endyear}{}{%
- \printfield{endyear}%
- \setunit{\addcomma\space}%将冒号修改为逗号
- \printtext{\multivolsecond}%
- \printtext{\mkbibparens{\multinumbersecond}}}%
- }%
- \setunit{\addcomma\space}%
- \printfield{eid}%
- \setunit{\addspace}%
- %\usebibmacro{issue+date}%
- %\setunit{\addcolon\space}%
- \usebibmacro{issue}%
- \newunit}%
-%
-% 修改in:用于inbook、incollection、inproceedings等类型
-% 2018.04.20,v1.0k,renewed marco,by hzz
-% 20190212,v1.0q,增加中英文区分,by hzz
-%
-% 原理方法:使用bibmacro{in:}改变了以前在driver中直接输出//的方式,同时也简化了标点控制。
-\renewbibmacro*{in:}{%
- \iftoggle{bbx:gbpunctin}{\printtext{\texttt{//}\allowbreak}}%\addthinspace
- {\setunit{\adddot\addspace}%
- \iffieldequalstr{userd}{chinese}%
- {\printtext{\bibstring{incn}}}%
- {\printtext{\bibstring{in}}}%
- }}%\newunit\newblock\intitlepunct
-%
-% 修改type域的输出格式
-% 2019.02.12,v1.0q,byhzz
-% 使其可以区分中英文输出不同的格式,比如博士论文英文输出PHD thesis,中文则是博士学位论文
-\DeclareFieldFormat{type}%
-{\iffieldequalstr{userd}{chinese}%
- {\ifbibxstring{##1cn}{\bibxstring{##1cn}}{##1}}%
- {\ifbibstring{##1}{\bibstring{##1}}{##1}}%
-}%
-%
-% book条目类的驱动
-%
-\csdef{blx at bbx@book}{%%源来自standard.bbx文件
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
-\usebibmacro{author/editor+others/translator+others}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
-\usebibmacro{maintitle+title}%
-\iftoggle{bbx:gbstrict}{}{%
-\newunit
-\printlist{language}%
-\newunit\newblock%
-\usebibmacro{byauthor}%
-\newunit\newblock}%
-\usebibmacro{byeditor+others}%
-\newunit
-\printfield{edition}%
-\newunit\newblock%%
-\iftoggle{bbx:gbstrict}{}{%
-\iffieldundef{maintitle}%
-{\printfield{volume}%
-\printfield{part}}%
-{}%
-\newunit%
-\printfield{volumes}%
-\newunit\newblock%
-\usebibmacro{series+number}}%
-\newunit\newblock%
-%\printfield{note}%
-%\newunit\newblock%
-\usebibmacro{publisher+location+date}%
-%\newunit\newblock %这里标点去掉
-\usebibmacro{chapter+pages}%
- \iffieldundef{url}{}{%当没有网址时也不输出
- \usebibmacro{modifydate}}%带括号的修改或更新日期,
-\usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。
- \newunit\newblock%
- \printfield{pagetotal}%
- \newunit\newblock%
- \iftoggle{bbx:isbn}
- {\printfield{isbn}}
- {}%
- \newunit\newblock
- %\usebibmacro{doi+eprint+url}%
- %\newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}%
-%
-% 期刊文章,连续出版物中的析出文献的格式
-%
-\csdef{blx at bbx@article}{%
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author/translator+others}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
- \usebibmacro{title}%
- \iftoggle{bbx:gbstrict}{}{%
- \newunit%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}%
- \newunit\newblock
- \usebibmacro{bytranslator+others}%
- \newunit\newblock
- \printfield{version}}%
- \newunit\newblock
- %\usebibmacro{in:}% 不使用in来表示期刊等连续出版物
- \usebibmacro{journal+issuetitle}%
- %\newunit
-% \usebibmacro{byeditor+others}%
-% \newunit
- \usebibmacro{note+pages}%
- \iffieldequalstr{note}{news}{}{%当是新闻时不输出修改或更新日期
- \iffieldundef{url}{}{%当没有网址时也不输出
- \iftoggle{bbx:url}{%当url选项为false时,也不输出
- \usebibmacro{modifydate}}{}}}%带括号的修改或更新日期,
- \usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置
- \newunit\newblock
- \iftoggle{bbx:isbn}
- {\printfield{issn}}
- {}%
- \newunit\newblock
- %\usebibmacro{doi+eprint+url}%
- %\newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}%
-%
-% 连续出版物的驱动
-%
-\csdef{blx at bbx@periodical}{%源来自standard.BBX
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{editor}%
- %\setunit{\labelnamepunct}\newblock
- \newunit\newblock %删除上面一行,添加这一行
- \usebibmacro{title+issuetitle}%
- \newunit\newblock%
- \usebibmacro{location+institution+date}%添加这一行用于输出地址,单位和时间
- \newunit\newblock%添加这一行
- \iftoggle{bbx:gbstrict}{}{%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byeditor}%
- \newunit\newblock
- \printfield{note}%
- \newunit\newblock}
- \iftoggle{bbx:isbn}
- {\printfield{issn}}
- {}%
- \newunit\newblock
- \usebibmacro{doi+eprint+url}%
- \newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}%
-%
-% 专利文献驱动
-%
-\csdef{blx at bbx@patent}{%源来自standard.BBX
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
- %\usebibmacro{title}%
- \usebibmacro{patenttitle}%给出专利专用的标题输出
- \iftoggle{bbx:gbstrict}{}{%
- \newunit%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}}%
- \newunit\newblock
- \printfield{type}%
- \setunit*{\addspace}%
- %\printfield{number}%已放到patenttitle中处理
- \iflistundef{location}
- {}
- {\setunit*{\addspace}%
- \printtext{%[parens]
- \printlist[][-\value{listtotal}]{location}}}%
- \newunit\newblock
- \usebibmacro{byholder}%
- \newunit\newblock
- \printfield{note}%
- \newunit\newblock
- \usebibmacro{newsdate}%
- %\newunit\newblock
- \usebibmacro{doi+eprint+url}%
- \newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}%
-%
-% 在线文献驱动
-%
-\csdef{blx at bbx@online}{%源来自standard.BBX
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author/editor+others/translator+others}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
- \usebibmacro{title}%
- \iftoggle{bbx:gbstrict}{}{%
- \newunit%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}%
- \newunit\newblock
- \usebibmacro{byeditor+others}%
- \newunit\newblock
- \printfield{note}}%
- \newunit
- \printfield{version}%
- \newunit\newblock
-%\printlist{organization}%
- \printlist{institution}%
- \newunit\newblock
-\ifboolexpr{%
-test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
-}{\usebibmacro{date}}%
-{\usebibmacro{modifydate}}%修改或更新日期,为带括号的时间
- \usebibmacro{url+urldate}%从下面移上来
- \newunit\newblock
- \iftoggle{bbx:eprint}
- {\usebibmacro{eprint}}
- {}%
- \newunit\newblock
- %\usebibmacro{url+urldate}%
- %\newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}%
-%
-% 报告类型驱动
-% 2016-11-11,增加了译者信息
-%
-\csdef{blx at bbx@report}{%
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
- \usebibmacro{title}%
- \iftoggle{bbx:gbstrict}{}{%
- \newunit%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}}%
- \newunit\newblock
- \usebibmacro{byeditor+others}%增加的译者信息
- \newunit\newblock
- \printfield{type}%
- \setunit*{\addspace}%
- \printfield{number}%
- \newunit\newblock
- \printfield{version}%
- \newunit
- \printfield{note}%
- \newunit\newblock
- \usebibmacro{publisher+location+date}%
- %\newunit\newblock
- \usebibmacro{chapter+pages}%
- \usebibmacro{doi+eprint+url}%
- \newunit
- \printfield{pagetotal}%
- \newunit\newblock
- \iftoggle{bbx:isbn}
- {\printfield{isrn}}
- {}%
- \newunit\newblock
-% \usebibmacro{doi+eprint+url}%
-% \newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}%
-%
-% 手册类型驱动
-% 2016-11-11,增加了译者信息
-%
-%
-\csdef{blx at bbx@manual}{%
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
- \usebibmacro{title}%
- \iftoggle{bbx:gbstrict}{}{%
- \newunit%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}}%
- \newunit\newblock
- \usebibmacro{byeditor+others}%增加的译者信息
- \newunit\newblock
- \iftoggle{bbx:gbfieldtype}{%
- \printfield{type}%
- \setunit*{\addspace}}{}%
- \printfield{number}%
- \newunit\newblock
- \printfield{version}%
- \newunit
- \printfield{note}%
- \newunit\newblock
- \usebibmacro{institution+location+date}%
- %\newunit\newblock
- \usebibmacro{chapter+pages}%
- \iffieldundef{url}{}{%当没有网址时也不输出修改或更新日期
- \usebibmacro{modifydate}}%修改或更新日期为带括号的时间
- \usebibmacro{doi+eprint+url}%
- \newunit
- \printfield{pagetotal}%
- \newunit\newblock
- \iftoggle{bbx:isbn}
- {\printfield{isrn}}
- {}%
- \newunit\newblock
-% \usebibmacro{doi+eprint+url}%
-% \newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}%
-%
-% 备选类型驱动
-%
-% 利用biblatex的misc驱动
-\csdef{blx at bbx@misc}{%
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author/editor+others/translator+others}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
- \usebibmacro{title}%
-\iftoggle{bbx:gbstrict}{}{%
- \newunit
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}%
- \newunit\newblock
- \usebibmacro{byeditor+others}}%
- \newunit\newblock
- \printfield{howpublished}%
- \newunit\newblock
- \printfield{type}%
- \newunit
- \printfield{version}%
- \newunit
- \printfield{note}%
- \newunit\newblock
- \usebibmacro{institution+location+date}%
- %\usebibmacro{organization+location+date}%
- %\newunit\newblock
- \usebibmacro{doi+eprint+url}%
- \newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}%
-%
-% 专著中的析出文献的格式修改
-%
-\csdef{blx at bbx@inbook}{%源来自standard.bbx
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author/translator+others}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
-\usebibmacro{title}%
-\usebibmacro{in:}%
-%\printtext{\texttt{//}\addthinspace}%
- \usebibmacro{bybookauthor}%
- \ifnameundef{bookauthor}{%
- \ifnameundef{editor}{}{\newunit}%
- }{\newunit}%替换下一句
- %\newunit\newblock
-\iffieldundef{series}{}{\usebibmacro{series+number}\setunit{\addcolon\addspace}}%为处理一些存在series的情况而增加
- \usebibmacro{maintitle+booktitle}%
-\iffieldundef{volume}{}{\setunit{\addcolon\addspace}\printfield{volume}}%
-\iffieldundef{number}{}{\setunit{\addcolon\addspace}\printfield{number}}%增加卷和册信息
- \newunit\newblock%
-% \usebibmacro{byeditor+others}%
-% \newunit\newblock
- \printfield{edition}%
- \newunit
- \iftoggle{bbx:gbstrict}{}{%
-% \iffieldundef{maintitle}
-% {\printfield{volume}%
-% \printfield{part}}
-% {}%
-% \newunit
-% \printfield{volumes}%
-% \newunit\newblock
-% \usebibmacro{series+number}
- }%
- \newunit\newblock
- %\printfield{note}%
- %\newunit\newblock
- \usebibmacro{publisher+location+date}%
-%\newunit\newblock
- \usebibmacro{chapter+pages}%
- %\newunit\newblock
- \usebibmacro{doi+eprint+url}%移到上面来
- \newunit\newblock
- \iftoggle{bbx:isbn}
- {\printfield{isbn}}
- {}%
- \newunit\newblock
- %\usebibmacro{doi+eprint+url}%
-% \newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}%
-}{}%
-}
-
-\AtEveryBibitem{\localsetchinesecode}%
-\AtEveryCite{\localsetchinesecode}%
-\AtEveryLositem{\localsetchinesecode}%
+%%
+%% ---------------------------------------------------------------
+%% biblatex-gb7714-2015 --- A biblatex implementation of the
+%% GBT7714-2015 bibliography style,numerical sequence
+%% Maintained by huzhenzhen
+%% E-mail: hzzmail at 163.com
+%% Released under the LaTeX Project Public License v1.3c or later
+%% ---------------------------------------------------------------
+%%
+
+%
+% 版本和时间信息
+%
+\def\versionofgbtstyle{2021/01/19 v1.0w}
+\def\versionofbiblatex{\abx at version}
+\ProvidesFile{gb7714-2015ms.bbx}[\versionofgbtstyle biblatex bibliography style]
+%\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求
+
+
+%=====================================================================
+% 加载标准样式
+%=====================================================================
+\RequireBibliographyStyle{numeric-comp}
+\RequirePackage{xstring}%解决texlive2015的biblatex3.0不加载xstring包的问题
+
+%=====================================================================
+% 功能函数
+%=====================================================================
+ %
+ % biblatex版本判断
+ % 20180629,v1.0k,hzz
+ %
+ % 原理方法:适用于3.10以上版本的biblatex,否则给出警告
+ \@ifpackagelater{biblatex}{2017/12/28}{}{
+ \blx at warning@noline{%
+ biblatex version is too old for this style\MessageBreak
+ if errors raised,Please update biblatex to the latest version.}
+ }
+
+
+ %
+ % 判断CJK字符的函数,用于判断作者等信息是否由中文字符构成
+ % v1.0k,20180509,hzz
+ %
+ % 原理方法:用biber中的perl方法代替。因为利用tex函数对字符判断时,当字符在宏
+ % 中时,基于`的方法无法解决GBK编码的问题,基于CJKsymbol的方法无法解决utf-8
+ % 编码用xelatex编译的问题。
+ %
+ % 原理是:利用perl正则将中文标识记录到域中,
+ % 然后利用\iffieldundef和\iffieldequalstr进行判断
+ \providetoggle{ifCJKforgbt}
+ \def\testCJKfirst#1{%
+ \iffieldundef{#1}{\togglefalse{ifCJKforgbt}}{%
+ \iffieldequalstr{#1}{chinese}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}}}
+
+ %
+ % 2个卷的解析函数,用于连续出版物
+ %
+ % 原理方法: 范围起止间隔符号还是用-,而不是与date相同的/,因为有合期期刊的问题,需要用到/符号
+ \newcommand{\multivolparser}[1]{%
+ \IfSubStr{#1}{-}%
+ {\StrBefore{#1}{-}[\multivolfirst]\StrBehind{#1}{-}[\multivolsecond]}%
+ {\def\multivolfirst{#1}\def\multivolsecond{}}%
+ }
+
+
+ %
+ % 2个期的解析函数,用于连续出版物
+ %
+ \newcommand{\multinumberparser}[1]{%
+ \IfSubStr{#1}{-}%
+ {\StrBefore{#1}{-}[\multinumberfirst]\StrBehind{#1}{-}[\multinumbersecond]}%
+ {\def\multinumberfirst{#1}\def\multinumbersecond{}}%
+ }
+
+
+%=====================================================================
+% 数据模型定义
+%=====================================================================
+ %定义类型和载体标识,从gb内容看载体基本属于介质。
+ %为与lee zeping的bst的样式统一,使用mark和medium这两域名
+ %为单个条目的姓名格式控制增加nameformat和namefmtid两个域
+ %为缩略信息文献表增加了shortbooktitle域
+ %为多语言排序增加了lansortorder域
+ \DeclareDatamodelFields[type=field,datatype=literal]{mark,medium,nameformat}
+ \DeclareDatamodelFields[type=field,datatype=integer]{namefmtid}
+ \DeclareDatamodelFields[type=field,datatype=literal]{shortbooktitle}
+ \DeclareDatamodelFields[type=field,datatype=literal]{lansortorder}
+
+ %因为biblatex更新3.14版本以后,biber对于为声明数据模型的条目类型
+ %不再默认读取,而是以空字符串作为条目类型名,自然在条目定义alias时
+ %就会出现问题,因此显式的声明一下newspaper,然后保留后面采用alias的方式
+ %而standard类型则是采用另一种方式直接在sourcemap中转换为其它类型。
+ \@ifpackagelater{biblatex}{2019/11/30}{%2019/12/01 v3.14
+ \DeclareDatamodelEntrytypes{newspaper}%
+ }{}
+
+%=====================================================================
+% 设置宏包选项
+%=====================================================================
+ %
+ % 增加一个控制是否输出文献载体的选项
+ % 20191125,v1,0s,hzz
+ \newtoggle{bbx:gbmedium}
+ \DeclareBibliographyOption{gbmedium}[true]{%biblatex低版本
+ \settoggle{bbx:gbmedium}{#1}}
+ \ExecuteBibliographyOptions{gbmedium}
+
+ %
+ % 增加一个控制是否输出annotation域的选项,该域可以用于在文献条目后面输出一些注释信息
+ % 20190509,v1,0s,hzz
+ \newtoggle{bbx:gbannote}
+ \DeclareBibliographyOption{gbannote}[false]{%biblatex低版本
+ \settoggle{bbx:gbannote}{#1}}
+ \ExecuteBibliographyOptions{gbannote}
+ %
+ %用于在文献条目后面输出注释信息的宏
+ %FieldFormat{annotation}用于设置注释信息的格式
+ \DeclareFieldFormat{annotation}{%
+ \printtext{\addspace(#1)}%
+ }
+ \renewbibmacro*{annotation}{%
+ \iftoggle{bbx:gbannote}%
+ {\iffieldundef{annotation}%
+ {\printfile[annotation]{\bibannotationprefix\thefield{entrykey}.tex}}%
+ {\printfield{annotation}}}%
+ {}%
+ }
+
+
+ %
+ % 增加一个控制是否输出type域的选项
+ % 20190212,v1,0q,hzz
+ \newtoggle{bbx:gbfieldtype}
+ \DeclareBibliographyOption{gbfieldtype}[false]{%biblatex低版本
+ \settoggle{bbx:gbfieldtype}{#1}}
+ \ExecuteBibliographyOptions{gbfieldtype}
+
+ %
+ % 增加一个控制是否根据页码重设脚注数字标号的选项
+ % 20190422,v1,0r,hzz
+ \newtoggle{bbx:gbfnperpage}
+ \DeclareBibliographyOption{gbfnperpage}[false]{%
+ \settoggle{bbx:gbfnperpage}{#1}}
+ \ExecuteBibliographyOptions{gbfnperpage}
+
+ %
+ % 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表
+ % 20190203,v1.0p,hzz
+ % 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签
+ % 当前面的脚注中已经存在当前文献,那么当前文献内容不再输出而用同(4)这样的方式
+ % 需要注意的是由于小页环境和表格中的脚注本身的问题,可能会有一些问题
+ \DeclareBibliographyOption{gbfootbib}[false]{%
+ \ifstrequal{#1}{false}{}{\execgbfootbib}}
+ \ExecuteBibliographyOptions{gbfootbib}
+
+ %%
+ \newlength{\footbibmargin}
+ \newlength{\footbiblabelsep}
+ \setlength{\footbibmargin}{1em}%脚注的段落左侧缩进距离
+ \setlength{\footbiblabelsep}{0.5em}%脚注中标记号与脚注段落的间距
+ \def\execgbfootbib%
+ {%
+ %开启引用跟踪计数器,为使用\ifciteseen等测试命令
+ \ExecuteBibliographyOptions{citetracker=true}
+ %
+ %利用footmisc宏包来实现脚注文献的悬挂对齐
+ \AtEndPreamble{
+ \@ifclassloaded{beamer}{}{
+ %beamer类因为其特殊性,为避免冲突不调footmisc。
+ %同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接
+ %如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。
+ %\PassOptionsToPackage{perpage,hang}{footmisc}%
+ %\RequirePackage{footmisc}%
+
+ %重新实现脚注的根据单页重设脚注号码
+ %重新实现脚注的悬挂对齐问题,不再使用footmisc,直接从latex核心代码和hyperref代码进行修改
+ %v1.0q 20190317 hzz
+ %v1.0r 20190422 hzz 根据gbfnperpage选项设置
+ \iftoggle{bbx:gbfnperpage}%
+ {\@addtoreset{footnote}{page}}{}%重设计数器
+
+\@ifpackageloaded{hyperref}{%加载hyperref则对\H@@footnotetext做重定义
+ \long\def\H@@footnotetext##1{\insert\footins{%
+ \reset at font\footnotesize
+ \interlinepenalty\interfootnotelinepenalty
+ \splittopskip\footnotesep
+ \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
+ \hsize\columnwidth \@parboxrestore
+ \protected at edef\@currentlabel{%
+ \csname p at footnote\endcsname\@thefnmark
+ }%
+ \color at begingroup
+ \leftskip \footbibmargin%增加的左侧缩进
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox%
+ }%
+ \color at endgroup}}%
+
+ \long\def\H@@mpfootnotetext##1{%
+ \global\setbox\@mpfootins\vbox{%
+ \unvbox\@mpfootins
+ \reset at font\footnotesize
+ \hsize\columnwidth
+ \@parboxrestore
+ \protected at edef\@currentlabel
+ {\csname p at mpfootnote\endcsname\@thefnmark}%
+ \leftskip \footbibmargin%增加的左侧缩进
+ \color at begingroup
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}%
+ \color at endgroup}}
+ }{%否则对latex核心代码中的\@footnotetext做重定义
+ \long\def\@footnotetext##1{\insert\footins{%
+ \reset at font\footnotesize
+ \interlinepenalty\interfootnotelinepenalty
+ \splittopskip\footnotesep
+ \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
+ \hsize\columnwidth \@parboxrestore
+ \protected at edef\@currentlabel{%
+ \csname p at footnote\endcsname\@thefnmark
+ }%
+ \color at begingroup
+ \leftskip \footbibmargin%增加的左侧缩进
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox%
+ }%
+ \color at endgroup}}%
+
+ \long\def\@mpfootnotetext##1{%
+ \global\setbox\@mpfootins\vbox{%
+ \unvbox\@mpfootins
+ \reset at font\footnotesize
+ \hsize\columnwidth
+ \@parboxrestore
+ \protected at edef\@currentlabel
+ {\csname p at mpfootnote\endcsname\@thefnmark}%
+ \leftskip \footbibmargin%增加的左侧缩进
+ \color at begingroup
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}%
+ \color at endgroup}}
+ }
+
+ \long\def\@makefntext##1{%增加了脚注标记与正文的间隔
+ \parindent 1em\noindent \hb at xt@ 0em{\hss \@makefnmark\makebox[\footbiblabelsep]{}}##1}
+
+ }
+
+ %
+ %使脚注标记加圈并设置数字的字体为tiny,不使用修改thefootnote的方式
+ \def\@makefnmark{\hbox{\@textsuperscript{\textcircled{\tiny\@thefnmark}}}}
+ %做patch使得脚注内容中的脚注数字标签不上标
+ \pretocmd{\@makefntext}{%
+ \def\@makefnmark{%
+ \hbox{\textcircled{\tiny\@thefnmark}}%
+ }%
+ }{}{}
+ }
+
+ %
+ %判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容)
+ %记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。
+ %v1.0q 20190309 区分使脚注标注适应minipage中的情况
+ \newbibmacro*{citesavefn}{%
+ \ifciteseen%当被引用过为true
+ {\ifcsdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%当已经定义过脚注序号信息
+ {\csgdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{%
+ \str at sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}%
+ \@makefnmark%
+ }}%
+ {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{%
+ \ifcsstring{@mpfn}{mpfootnote}{\@alph\c at mpfootnote}{\thefootnote}%
+ }}%
+ }%
+ {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{%
+ \ifcsstring{@mpfn}{mpfootnote}{\@alph\c at mpfootnote}{\thefootnote}%
+ %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断
+ }}%
+ }
+
+ %
+ %重定义\footfullcite使完成gb7714-2015的脚注文献要求
+ \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]%
+ {\defcounter{maxnames}{\blx at maxbibnames}%局部定义maxnames和minnames计数器
+ \defcounter{minnames}{\blx at minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。
+ \usebibmacro{prenote}%
+ \renewbibmacro*{postnote}{%
+ \iffieldundef{postnote}%
+ {}{\setunit{\addcolon\addspace}\printfield{postnote}}}%与ay样式不同,由于已修改postnote域格式,直接用printfield
+ }%
+ {\usebibmacro{citesavefn}%
+ \ifcsdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%
+ {\csuse{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}\nopunct}%
+ {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}%
+ }%
+ {\multicitedelim}%
+ {\usebibmacro{postnote}}
+
+ }
+
+ %
+ % 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式
+ % 20180814,v1.0m,hzz
+ % 原理方法:
+ % 当gbstyle=true,则所有的文献使用国标样式,否则仅中文文献使用国标样式
+ \newtoggle{bbx:gbstyle}
+ \DeclareBibliographyOption{gbstyle}[true]{%biblatex低版本
+ \settoggle{bbx:gbstyle}{#1}}
+
+ %
+ % 增加一个控制是否输出文献类型和载体标识的选项
+ %
+ % 原理方法:
+ % 对于biblatex3.4以上版本DeclareBibliographyOption命令中的[datatype]如果是boolean,那么是可以省略的
+ % 所以用老版本的不用[datatype]的命令可以兼容所有biblatex版本
+ \newtoggle{bbx:gbtype}
+ %\DeclareBibliographyOption[boolean]{gbtype}[true]{%biblatex高版本
+ \DeclareBibliographyOption{gbtype}[true]{%biblatex低版本
+ \settoggle{bbx:gbtype}{#1}}
+
+ %
+ % 增加一个源文件编码选择选项,当true时可以使用GBK编码。
+ % v1.0k, 2018.05.08, by hzz
+ %
+ % 原理方法:将需要输出的中文字符串用命令形式表示存储,采用utf8编码时采用bbx文档
+ % 内的定义即是utf8编码的中文字符串,但tex源文件是gbk编码时,利用gb7714-2015-gbk.def
+ % 文档内的gbk编码的字符串覆盖。这种覆盖只能在宏包末尾加载时成功实现,所以使用
+ % AtEndOfPackage。该解决思路源自biblatex-caspervector宏包。
+ % 另外注意:
+ % gbk编码的tex文档,利用pdflatex/latex能正确编译,利用xelatex能编译,但中文显示乱码
+ % 在源文档前面增加 XeTeX 原语:\XeTeXinputencoding "GBK" 后,显示正常
+ % utf-8编码的tex文档,利用xelatex能正确编译,而pdflatex/latex不能编译。
+ \newtoggle{bbx:codegbk}
+ \DeclareBibliographyOption{gbcodegbk}[false]{%
+ \settoggle{bbx:codegbk}{#1}}
+
+ \def\str at bibliography{参考文献}
+ \def\str at references{参考文献}
+ \def\str at bytranslator{译}
+ \def\str at andotherscn{等}
+ \def\str at backrefpage{引用页}
+ \def\str at backrefpages{引用页}
+ \def\str at noaddress{出版地不详}
+ \def\str at nopublisher{出版者不详}
+ \def\str at edition{版}
+ \def\str at volumecn{卷}
+ \def\str at numbercn{册}
+ \def\str at serialcn{第}
+ \def\str at sameentry{同}
+ \def\str at incn{见}
+ \def\str at mathesiscn{硕士学位论文}
+ \def\str at phdthesiscn{博士学位论文}
+ \def\str at editorcn{主编}
+
+ \AtEndOfPackage{%
+ \iftoggle{bbx:codegbk}{%
+ \ExecuteBibliographyOptions{texencoding = GBK}
+ \input{gb7714-2015-gbk.def}
+ }{}}
+
+ %
+ % 增加一个严格按GB/T 7714-2015给出著录格式控制域的输出的选项
+ % v1.0k, 2018.05.08, by hzz
+ %
+ % 原理方法:
+ % 默认设置该选项为真,进而不输出GB/T 7714-2015中没有的域的信息
+ % 这样可以避免因为bib文件带有多余的域的信息的输出,比如因为bibtex样式
+ % 可能需要用于中英文判断的language域的信息。
+ \newtoggle{bbx:gbstrict}
+ \DeclareBibliographyOption{gbstrict}[true]{%
+ \settoggle{bbx:gbstrict}{#1}}
+
+ %
+ % 增加一个控制标题域超链接设置的选项
+ % v1.0k, 2018.05.24, by hzz
+ %
+ % 原理方法:
+ % 利用标题域格式来实现,默认设置该选项为false,不做超链接。
+ % 设置为true,则标题设置超链接
+ \newtoggle{bbx:titlelink}
+ \DeclareBibliographyOption{gbtitlelink}[false]{%
+ \settoggle{bbx:titlelink}{#1}}
+
+ %
+ % 增加一个控制参考文献标题是否能够被ctex宏包设置的选项
+ % v1.0l, 2018.07.02, by hzz
+ %
+ % 原理方法:
+ % 重定义biblatex的宏,去除使用本地化字符串的方式,是的可以利用ctexset进行设置
+ \newtoggle{bbx:ctexset}
+ \DeclareBibliographyOption{gbctexset}[true]{%
+ \settoggle{bbx:ctexset}{#1}}
+
+ \AtEndOfPackage{%
+ \iftoggle{bbx:ctexset}{%
+ \def\blx at defbibstrings#1#2{%
+ \def\do##1{\csundef{abx at lstr@##1}\csundef{abx at sstr@##1}}%
+ \abx at dostrings
+ \csuse{abx at strings@#1}%
+ \setkeys{blx at lbx}{#2}%
+ \let\do\blx at defbibstrings@i
+ \csxdef{abx at strings@#1}{\abx at dostrings}%
+ }
+ }{}}
+
+ %
+ % 增加一个恢复域格式为标准样式的控制选项
+ % v1.0k, 2018.05.15, by hzz
+ %
+ % 原理方法:
+ % 默认设置该选项为false,采用国标要求的域格式输出相关域
+ % 当设置该选项为true时,则重新利用标准样式的域格式输出相关的域
+ \newtoggle{bbx:gbfieldstd}
+ \DeclareBibliographyOption{gbfieldstd}[false]{%
+ \settoggle{bbx:gbfieldstd}{#1}%
+ }
+
+ %
+ % 增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。
+ %
+ \newtoggle{bbx:gbpub}
+ \DeclareBibliographyOption{gbpub}[true]{%
+ %\settoggle{bbx:gbpub}{#1} %或采用下面这一句
+ \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}}
+
+ %
+ % 增加控制析出文献来源前的标点符号//输出的选项
+ % v1.0k, 2018.04.20,added in by hzz
+ \newtoggle{bbx:gbpunctin}
+ \DeclareBibliographyOption{gbpunctin}[true]{%
+ \settoggle{bbx:gbpunctin}{#1}}
+
+ %
+ % 增加一个处理佚名或noauthor的控制选项
+ %
+ % 原理方法:在顺序编码制中不需要使用,为与作者年制的兼容性考虑,这里也增加避免报错
+ \DeclareBibliographyOption{gbnoauthor}[true]{}%
+
+
+ %
+ %为日期控制格式增加一个gb7714-2015选项
+ %
+ \csdef{mkdaterangegb7714-2015}#1{%
+ \begingroup
+ \blx at metadateinfo{#1}%
+ \iffieldundef{#1year}
+ {}
+ {\printtext[#1date]{%
+ \blx at gbdate{#1}{}}}%
+ \endgroup}
+
+ \newrobustcmd*{\blx at gbdate}[3][]{%
+ \dateeraprintpre{#2#3year}%
+ \blx at imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}%
+ \iffieldundef{#2#3month}{}{\hyphen\blx at imc@forcezerosmdt{\thefield{#2#3month}}}%
+ \iffieldundef{#2#3day}{}{\hyphen\blx at imc@forcezerosmdt{\thefield{#2#3day}}}}
+
+ %为姓名格式选择增加的计数器
+ \newcounter{gbnamefmtcase}
+ \def\thegbnamefmtcase{\the\c at gbnamefmtcase}
+ %为数字标签格式选择增加的计数器/命令
+ \newcommand{\mkgbnumlabel}[1]{\mkbibbrackets{#1}}
+ \def\gbbiblabelopt at bracket{\renewcommand{\mkgbnumlabel}[1]{\mkbibbrackets{##1}}}
+ \def\gbbiblabelopt at parens{\renewcommand{\mkgbnumlabel}[1]{\mkbibparens{##1}}}
+ \def\gbbiblabelopt at dot{\renewcommand{\mkgbnumlabel}[1]{##1\adddot}}
+ \def\gbbiblabelopt at plain{\renewcommand{\mkgbnumlabel}[1]{##1}}
+ \def\gbbiblabelopt at box{\renewcommand{\mkgbnumlabel}[1]{\framebox{##1}}}
+ \def\gbbiblabelopt at circle{\renewcommand{\mkgbnumlabel}[1]{\textcircled{##1}}}
+ %为文献表中数字标签对齐方式选择增加的计数器/命令
+ \newcounter{gbalignlabel}
+ \def\thegbalignlabel{\the\c at gbalignlabel}
+ %为引用标签标注/文献表中本地化字符串中英文选择增加的计数器/命令
+ \newcounter{gbcitelocalcase}
+ \newcounter{gbbiblocalcase}
+ \def\thegbcitelocalcase{\the\c at gbcitelocalcase}
+ \def\thegbbiblocalcase{\the\c at gbbiblocalcase}
+
+ % 增加不同语言排序的切换选项
+ % numeric样式,不使用该选项,这里给出仅为兼容性考虑
+ % v1.0q,20190307,hzz
+ %
+ \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{}
+
+
+ %
+ % 增加本地化字符串的中英文切换选项
+ % gbcitelocal指标注中的本地化字符串
+ % gbbiblocal 指文献表中的本地化字符串
+ % gblocal 指设置文献表和标注中的本地化字符串
+ % v1.0o,20190103,hzz
+ %
+ \DeclareBibliographyOption[string]{gbcitelocal}[gb7714-2015]{%
+ \ifstrequal{#1}{gb7714-2015}{\setcounter{gbcitelocalcase}{0}}{}%
+ \ifstrequal{#1}{chinese}{\setcounter{gbcitelocalcase}{1}}{}%
+ \ifstrequal{#1}{english}{\setcounter{gbcitelocalcase}{2}}{}%
+ }
+
+ \DeclareBibliographyOption[string]{gbbiblocal}[gb7714-2015]{%
+ \ifstrequal{#1}{gb7714-2015}{\setcounter{gbbiblocalcase}{0}}{}%
+ \ifstrequal{#1}{chinese}{\setcounter{gbbiblocalcase}{1}}{}%
+ \ifstrequal{#1}{english}{\setcounter{gbbiblocalcase}{2}}{}%
+ }
+
+ \DeclareBibliographyOption[string]{gblocal}[gb7714-2015]{%
+ \ExecuteBibliographyOptions{gbbiblocal=#1}%
+ \ExecuteBibliographyOptions{gbcitelocal=#1}%
+ }
+
+ %
+ % 增加序号标签格式处理选项
+ % v1.0l,20180623,hzz
+ %
+ \DeclareBibliographyOption[string]{gbbiblabel}[bracket]{%
+ \csuse{gbbiblabelopt@#1}
+ }
+
+ %
+ % 增加姓名大小写格式处理选项
+ %
+ \DeclareBibliographyOption[string]{gbnamefmt}[uppercase]{%
+ \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}%
+ \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}%
+ \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family
+ \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{}
+ \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given
+ \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family
+ }
+
+
+ %
+ % 增加标签对齐选项
+ %
+ % right是默认的右对齐,left是左对齐,gb7714-2015是项对齐方式
+ \DeclareBibliographyOption[string]{gbalign}[right]{%
+ \ifstrequal{#1}{right}{\setcounter{gbalignlabel}{0}}{}
+ \ifstrequal{#1}{left}{\setcounter{gbalignlabel}{1}}{}
+ \ifstrequal{#1}{center}{\setcounter{gbalignlabel}{2}}{}
+ \ifstrequal{#1}{gb7714-2015}{\setaligngbstyle}{}
+ }
+
+
+ %
+ % 选项设置
+ %
+ \ExecuteBibliographyOptions{
+ %firstinits=true, 针对biblatex<3.3版本的选项设置,比如texlive2015中的3.0版
+ giveninits=true, %针对3.3<=biblatex<3.5版本,比如texlive2016中的3.4版
+ sorting=none,
+ useprefix=true, %名字的信息包括前缀
+ date = year, %日期仅写到年
+ maxbibnames = 3,%设置名字最大数量
+ minbibnames = 3, %设置缩减后的名字最小数量
+ maxitems = 1,%设置列表最大数量
+ minitems = 1, %设置缩减后的列表最小数量
+ isbn=false,
+ gbstyle=true,
+ gbtype=true,
+ gbcodegbk=false,
+ gbstrict=true,
+ gbtitlelink=false,
+ gbfieldstd=false,
+ gbpub=true,
+ gbpunctin=true,
+ gbbiblabel=bracket,
+ gbnamefmt=uppercase,
+ gbalign=right,
+ gbctexset=true,
+ %urldate =edtf, %针对3.7<=biblatex<=3.9版本的选项设置,比如texlive2017中的3.7版
+ %eventdate =edtf,%针对3.7<=biblatex<=3.9版本的选项设置,比如texlive2017中的3.7版
+ urldate =gb7714-2015, %iso,针对3.10<=biblatex版本的选项设置,比如texlive2018中的3.11版
+ eventdate =gb7714-2015,
+ gblocal=gb7714-2015,
+ }
+
+
+%=====================================================================
+% 设置本地化字符串
+%=====================================================================
+ %
+ % 新建当地化字符串,用来记录“等”字符、“和”字符
+ %
+ \NewBibliographyString{andotherscn}
+ \NewBibliographyString{andothersincitecn}
+ \NewBibliographyString{andothersincite}
+ \NewBibliographyString{andcn}
+ \NewBibliographyString{andothersjp}
+ \NewBibliographyString{andotherskr}
+ \NewBibliographyString{andjp}
+ \NewBibliographyString{andkr}
+ \NewBibliographyString{andincitecn}
+ \NewBibliographyString{andincite}
+ \NewBibliographyString{volumecn}
+ \NewBibliographyString{numbercn}
+ \NewBibliographyString{serialcn}
+ \NewBibliographyString{incn}
+ \NewBibliographyString{mathesiscn}
+ \NewBibliographyString{phdthesiscn}
+ \NewBibliographyString{editorcn}
+ \NewBibliographyString{editorscn}
+
+
+ %
+ % 修改一些当地化字符串
+ %
+ % 原理方法:直接利用当地化格式english修改出一些中文的格式,具体修改内容参考english.lbx文件
+ % 当然也可以增加比如上面定义的andotherscn
+ % 注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别
+ \DefineBibliographyStrings{english}{
+ bibliography = {\str at bibliography},
+ references = {\str at references},
+ bytranslator= {\str at bytranslator},%\addperiod,%将trans. by 改成 译
+ and = {\addcomma},%将第2和3人名间的and符号改成逗号,用\finalnamedelim命令也可以定义,参见3.9.1节
+ andcn = {\addcomma},%and本地化字符串的中文对应词
+ andincitecn = {\addcomma},%将标注中的分开,便于与文献表中的区分
+ andincite = {\addcomma},
+ %andothers = {et al.}, %将超过3个人名的省略,et al.改成为 等
+ andotherscn = {\str at andotherscn}, %将超过3个人名的省略,et al.改成为 等
+ andothersincitecn={\str at andotherscn},%将标注中的分开,便于与文献表中的区分
+ andothersincite={et al\adddot},
+ backrefpage = {\str at backrefpage:},
+ backrefpages = {\str at backrefpages:},
+ in={in\intitlepunct},
+ volumecn={\str at volumecn},
+ numbercn={\str at numbercn},
+ serialcn={\str at serialcn},
+ andothersjp={他},
+ andotherskr={외},
+ andjp={和},
+ andkr={和},
+ incn={\str at incn\addcolon\addspace},
+ mathesiscn={\str at mathesiscn},
+ phdthesiscn={\str at phdthesiscn},
+ editorscn={\str at editorcn},
+ editorcn={\str at editorcn},
+}
+
+ %
+ % 增加两个命令用于临时的局部的修改本地化字符串
+ % 其中\setlocalbibstring修改缩写字符串,setlocalbiblstring修改长字符串
+ % 注意使用时因为是局部修改,因此要将其与需要修改的引用命令放在一个编组符号内
+ % v1.0t,hzz,20190525
+ \newcommand{\setlocalbibstring}[2]{%
+ \csdef{abx at sstr@#1}{#2}}
+ \newcommand{\setlocalbiblstring}[2]{%
+ \csdef{abx at lstr@#1}{#2}}
+
+%=====================================================================
+% 动态数据修改
+%=====================================================================
+%
+% 各层次的数据映射和动态修改
+%
+% 原理方法:
+% 1. 进行语言包括中英文判断,并设置和记录,比如记录到userf,usere中
+% 2. 增加文献标识符如[M],[J]等,对一些容易混淆的域进行设置以增强兼容性
+% 3. \DeclareSourcemap命令对于biblatex3.11以下版本只能出现一次,3.11版开始支持多个
+% 4. \DeclarestyleSourcemap在biblatex v3.7版开始可以支持出现多次
+% 5. 把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。
+% 注意:这里用userf,usere而不是namee,namef,是因为只有把name列表转成域,才能有效读取姓名中的字符,
+% 如果用namee,namef,name信息会自动解析,所以就不能为cjk判断提供需要的信息
+%
+% 不同的文献类型使用相同的驱动输出可以有5种方法:
+% 1. 是数据源层的映射,将其它类型转换为某一要使用驱动的类型
+% 2. 是样式层映射,也是将其它类型转换为某一要使用驱动的类型
+% 3. 是驱动层映射,也是将其它类型转换为某一要使用驱动的类型
+% 4. 定义驱动类型别名DeclareBibliographyAlias,将其它类型定义为某一要使用驱动的类型的别名
+% 驱动别名定义本质上是做了驱动层映射
+% 5. 直接定义不同的类型的驱动,但驱动内容相同。
+%
+% 关于数据映射和驱动使用的考虑如下:
+% 1. 为避免利用biber输出bib文件时的数据变动,尽量不在数据源层映射做类型转换
+% 2. 为减少代码量,尽量少做内容相同的不同类型驱动
+% 3. 因此类型相关的处理主要在样式层映射、驱动层映射、驱动别名
+% 4. 由于biblatex默认做的驱动别名处理可能增加一些信息比如masterthesis转thesis时增加的type
+% 可以在样式层映射做某些需要避免这种默认处置的转换
+% 5. 当没有避免默认行为的需求时,全部采用驱动别名的方式处理,等价于驱动层的映射
+%
+% 文献类型和驱动考虑如下:
+% 1. 连续出版物及析出文献有其特殊性,因此考虑两类periodical和article
+% newpaper映射为article,并以note域做区分特殊处理
+% 2. 专著和专著中的析出文献是主要的类型,因此考虑book和inbook
+% standard映射为book或inbook,并以note域做区分特殊处理
+% collection和proceedings基本与book类似,因此做book驱动别名处理
+% incollection和inproceedings基本与inbook类似,因此做inbook驱动别名处理
+% 3. 专利类型有其特殊性,考虑patent类型
+% 4. 电子资源类型有其特殊性,考虑online类型
+% 5. 报告类型与book有点类似,出版项处理与book一样,但有时又要有修改和更细日期
+% 因此考虑用一种类型来输出,使用report类型
+% 6. 手册/学位论文等类型与book有点类似,但对于出版项处理时,有缺省时,直接省略,
+% 同时有version和edition的区别,因此考虑用一种类型来输出,使用manual类型
+% 7. 包括报告,学位论文在内的其它所有的类型,都做一个判断,当没有出版项时,
+% 且存在网址信息时,将其转换为online类型输出,否则都做为manual类型输出。
+% 8. 备选类型misc当存在网址时直接转换为online,由于howpublished域可用于描述
+% 更多的信息,因此不存在网址时,独立做一个备选格式
+% 9. 出版项主要以如下方式处理:
+% (a) location+institution+date 仅用于连续出版物
+% (b)publisher+location+date 用于需要完整输出出版项的类型,比如book,collection,proceedings,in*,report
+% (c)institution+location+date 用于出版项缺失时不输出的类型,包括manual,thesis,archive等其他类型
+% (d)printlist{insitution} 用于电子资源,仅输出出版者或组织,为数据映射方便,本来默认的organization域转换为用insitution输出。
+% (e) 不输出,主要用于连续出版物析出的文献
+% 10. 日期以如下方式处理:
+% date 由于存在biblatex选项,因此通过选项控制,数据源为date解析数据或year
+% urldate 由于存在biblatex选项,因此通过选项控制,输出到日,且用[]包围,数据源为urldate
+% newsdate 用于公告日期,公开日期或新闻日期,输出到日,但无包围符号,数据源为date
+% modifydate 用于更新或修改日期,输出到日,且用()包围,数据源为date或enddate或eventdate
+
+\DeclareSourcemap{%\perdatasource{examples.bib}
+\maps[datatype=bibtex]{%
+ \map{%当没有作者时将editor转成author
+ \pernottype{inbook}%因为in系列中editor可能用来表示bookauthor,所以排除
+ \pernottype{inproceedings}
+ \pernottype{incollection}
+ \pernottype{periodical}%因为peridical直接使用editor,所以排除
+ %注意notfield在低版本biblatex中没有
+ %\step[notfield=author,final]%当author不存在,将editor复制给author
+ \step[fieldsource=editor,fieldtarget=author]%并删除editor
+ }
+ \map{%当没有作者时将translator转成author
+ \pernottype{inbook}
+ \pernottype{inproceedings}
+ \pernottype{incollection}
+ %\step[notfield=author,final]%当author不存在,将translator复制给author
+ \step[fieldsource=translator,fieldtarget=author]%并删除translator
+ }
+ \map{%让address和location同步,biblatex中address是location的别名
+ %因此输出的时候只有location信息,但处理过程中是可以存在address的。
+ \step[notfield=address,final]%
+ \step[fieldsource=location,final]
+ \step[fieldset=address,origfieldval]
+ }
+ \map{
+ \step[notfield=location,final]%
+ \step[fieldsource=address,final]
+ \step[fieldset=location,origfieldval]
+ }
+ \map{%处理在bib文件用mark标记文献类型标识符的情况
+ \step[fieldsource=mark,final]
+ \step[fieldset=usera, origfieldval]
+ }
+ \map{%处理在bib文件中直接给出文献的姓名格式为lowercase的情况
+ \step[fieldsource=nameformat,match=lowercase,final]
+ \step[fieldset=namefmtid,fieldvalue={1}]
+ }
+ \map{%处理在bib文件中直接给出文献的姓名格式为givenahead的情况
+ \step[fieldsource=nameformat,match=givenahead,final]
+ \step[fieldset=namefmtid,fieldvalue={2}]
+ }
+ \map{%处理在bib文件中直接给出文献的姓名格式为familyahead的情况
+ \step[fieldsource=nameformat,match=familyahead,final]
+ \step[fieldset=namefmtid,fieldvalue={3}]
+ }
+ \map{%处理在bib文件中直接给出文献的姓名格式为pinyin的情况
+ \step[fieldsource=nameformat,match=pinyin,final]
+ \step[fieldset=namefmtid,fieldvalue={4}]
+ }
+ \map{%根据article确定文献类型标识符
+ \pertype{article}
+ \step[fieldset=usera, fieldvalue={J}]
+ }
+ \map{%根据periodical确定文献类型标识符
+ \pertype{periodical}
+ \step[fieldset=usera, fieldvalue={J}]
+ \step[fieldsource=author] %有时会把author和editor混淆,处理后使用editor
+ \step[fieldset=editor, origfieldval]
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{%根据增加一个新闻报纸的类型newspaper确定文献类型标识符
+ \pertype{newspaper}
+ \step[fieldset=usera, fieldvalue={N}]
+ \step[fieldset=note, fieldvalue=news]%因为没有专门的驱动,记录note方便映射为article后判断
+ }
+ \map{%对应增加的一个数据库类型database确定文献类型标识符
+ \pertype{database}
+ \step[fieldset=usera, fieldvalue={DB}]
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{%对应增加的一个数据集类型dataset确定文献类型标识符
+ \pertype{dataset}
+ \step[fieldset=usera, fieldvalue={DS}]%
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{%对应增加的一个软件类型software确定文献类型标识符
+ \pertype{software}
+ \step[fieldset=usera, fieldvalue={CP}]
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{%对应增加的一个舆图类型map确定文献类型标识符
+ \pertype{map}
+ \step[fieldset=usera, fieldvalue={CM}]%
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{%对应增加的一个档案类型archive确定文献类型标识符
+ \pertype{archive}
+ \step[fieldset=usera, fieldvalue={A}]
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{%因为misc类型本身就是没有类型,而不像其它文献有明确的类型,所以
+ %当misc类型带有网址时,直接将其转换为online类型
+ \pertype{misc}
+ \step[fieldsource=url,final]
+ \step[typesource=misc,typetarget=online]
+ }
+ \map{%对应增加的一个备选类型misc确定文献类型标识符
+ \pertype{misc}
+ \step[fieldset=usera, fieldvalue={Z}]%
+ }
+ \map{
+ \pertype{book}
+ \pertype{inbook}
+ \step[fieldset=usera, fieldvalue={M}]
+ \step[fieldsource=version] %有时会把version和edition混淆,处理后直接用edition
+ \step[fieldset=edition, origfieldval]
+ }
+ \map{%兼容老的standard类型,确定文献类型标识符
+ \pertype{standard}
+ \step[fieldset=usera, fieldvalue={S}]
+ \step[fieldset=note, fieldvalue=standard]%因为没有专门的驱动,记录note方便映射为book和inbook后判断
+ }
+ \map{
+ \pertype{patent}
+ \step[fieldset=usera, fieldvalue={P}]
+ }
+ \map{
+ \pertype{inproceedings}
+ \pertype{conference}%兼容老的conference类型
+ \step[fieldset=usera, fieldvalue={C}]
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=publisher, origfieldval]
+ }
+ \map{
+ \pertype{proceedings}
+ \step[fieldset=usera, fieldvalue={C}]
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
+ \step[fieldset=publisher, origfieldval]
+ }
+ \map{
+ \pertype{incollection}
+ \step[fieldset=usera, fieldvalue={G}]
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=publisher, origfieldval]
+ }
+ \map{
+ \pertype{collection}
+ \step[fieldset=usera, fieldvalue={G}]
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
+ \step[fieldset=publisher, origfieldval]
+ }
+ \map{
+ \pertype{report}
+ \pertype{techreport}%兼容老的techreport类型
+ \step[fieldset=usera, fieldvalue={R}]
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
+ \step[fieldset=publisher, origfieldval]
+ }
+ \map{
+ \pertype{thesis}
+ \pertype{mastersthesis}%兼容老的mastersthesis和phdthesis类型
+ \pertype{phdthesis}
+ \step[fieldset=usera, fieldvalue={D}]
+ \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{
+ \pertype{online}
+ \pertype{electronic}%兼容老的electronic类型
+ \pertype{www}%兼容老的www类型
+ \step[fieldset=usera, fieldvalue={EB}]
+ \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]%因为online的出版项处理类似手册
+ \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{
+ \pertype{manual}
+ \step[fieldset=usera, fieldvalue={A}]
+ \step[fieldsource=edition]%有时会把version和edition混淆,处理后使用version
+ \step[fieldset=version, origfieldval]
+ \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{
+ \pertype{unpublished}
+ \step[fieldset=usera, fieldvalue={Z}]
+ }
+ \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
+ \step[fieldsource={author}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
+ }
+ \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
+ \step[fieldsource={editor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
+ }%
+ \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
+ \step[fieldsource={translator}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
+ }%
+ \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
+ \step[fieldsource={bookauthor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
+ }%
+ \map{%处理一些用year表示date的情况
+ %这样处理将会设置date域,并使得labeldatesource变为空,因为date的前缀为空(如果是urldate,那么labeldatesource就是url)。
+ %同时date域会被biblatex自动解析为year,month,day,并且覆盖原来的year信息
+ \step[fieldsource=year]
+ \step[fieldset=date, origfieldval]
+ }
+ \map{%将entrykey放入keywords中用于后期使用
+ \step[fieldsource=entrykey]
+ \step[fieldset=keywords, origfieldval]
+ }
+ \map{\step[fieldsource=title,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
+ \step[fieldset=userd,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
+ }
+ \map{%
+ \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final]
+ \step[fieldset=userd,fieldvalue={russian}]%俄语
+ }
+ \map{%
+ \step[fieldsource=title,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
+ \step[fieldset=userd,fieldvalue={japanese}]%日语
+ } %确定形式后可增加类似andotherscn这样的本地化字符串处理
+ \map{%
+ \step[fieldsource=title,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
+ \step[fieldset=userd,fieldvalue={korean}]%韩语
+ }
+ \map{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题
+ \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%
+ \step[fieldset=userd, fieldvalue={chinese}]
+ }
+ \map{%将没有设置userd,且存在title域的默认设置为英文
+ \step[fieldsource=title,final]
+ \step[fieldset=userd,fieldvalue={english}]
+ }
+ \map{\step[fieldsource=author,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
+ \step[fieldset=userf,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
+ }
+ \map{%
+ \step[fieldsource=author,match=\regexp{[\x{0400}-\x{052F}]},final]
+ \step[fieldset=userf,fieldvalue={russian}]%俄语
+ }
+ \map{%
+ \step[fieldsource=author,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
+ \step[fieldset=userf,fieldvalue={japanese}]%日语
+ } %确定形式后可增加类似andotherscn这样的本地化字符串处理
+ \map{%
+ \step[fieldsource=author,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
+ \step[fieldset=userf,fieldvalue={korean}]%韩语
+ }
+ \map{%作者的中文判断
+ \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
+ \step[fieldset=userf, fieldvalue={chinese}]
+ }
+ \map{%将没有设置userf,且存在author域的默认设置为英文
+ \step[fieldsource=author,final]
+ \step[fieldset=userf,fieldvalue={english}]
+ }
+ \map{\step[fieldsource=translator,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
+ \step[fieldset=usere,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
+ }
+ \map{%
+ \step[fieldsource=translator,match=\regexp{[\x{0400}-\x{052F}]},final]
+ \step[fieldset=usere,fieldvalue={russian}]%俄语
+ }
+ \map{%
+ \step[fieldsource=translator,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
+ \step[fieldset=usere,fieldvalue={japanese}]%日语
+ } %确定形式后可增加类似andotherscn这样的本地化字符串处理
+ \map{%
+ \step[fieldsource=translator,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
+ \step[fieldset=usere,fieldvalue={korean}]%韩语
+ }
+ \map{%译者的中文判断
+ \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
+ \step[fieldset=usere, fieldvalue={chinese}]
+ }
+ \map{%将没有设置usere,且存在translator域的默认设置为英文
+ \step[fieldsource=translator,final]
+ \step[fieldset=usere,fieldvalue={english}]
+ }
+ \map{\step[fieldsource=editor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
+ \step[fieldset=userc,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
+ }
+ \map{%
+ \step[fieldsource=editor,match=\regexp{[\x{0400}-\x{052F}]},final]
+ \step[fieldset=userc,fieldvalue={russian}]%俄语
+ }
+ \map{%
+ \step[fieldsource=editor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
+ \step[fieldset=userc,fieldvalue={japanese}]%日语
+ } %确定形式后可增加类似andotherscn这样的本地化字符串处理
+ \map{%
+ \step[fieldsource=editor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
+ \step[fieldset=userc,fieldvalue={korean}]%韩语
+ }
+ \map{%编者的中文判断
+ \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5
+ \step[fieldset=userc, fieldvalue={chinese}]
+ }
+ \map{%将没有设置userc,且存在editor域的默认设置为英文
+ \step[fieldsource=editor,final]
+ \step[fieldset=userc,fieldvalue={english}]
+ }
+ \map{\step[fieldsource=bookauthor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
+ \step[fieldset=userb,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
+ }
+ \map{%
+ \step[fieldsource=bookauthor,match=\regexp{[\x{0400}-\x{052F}]},final]
+ \step[fieldset=userb,fieldvalue={russian}]%俄语
+ }
+ \map{%
+ \step[fieldsource=bookauthor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
+ \step[fieldset=userb,fieldvalue={japanese}]%日语
+ } %确定形式后可增加类似andotherscn这样的本地化字符串处理
+ \map{%
+ \step[fieldsource=bookauthor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
+ \step[fieldset=userb,fieldvalue={korean}]%韩语
+ }
+ \map{%编者的中文判断
+ \step[fieldsource=bookauthor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5
+ \step[fieldset=userb, fieldvalue={chinese}]
+ }
+ \map{%将没有设置userc,且存在editor域的默认设置为英文
+ \step[fieldsource=bookauthor,final]
+ \step[fieldset=userb,fieldvalue={english}]
+ }
+ \map{\step[fieldsource=userd,final]%userd存在则用根据标题的语言设定language
+ \step[fieldset=language,origfieldval]%本身language存在则不设定
+ }
+ \map{\step[fieldsource=userf,final]%userd不存在,而userf存在则根据author的语言设定language
+ \step[fieldset=language,origfieldval]
+ }%如果没有作者和标题,那么剩下的最可能有意义的只有网址了,而网址通常是英文的,因此不用再进一步对其它域进行判断了。
+ \map{%将没有设置的language设置成en,即认为不是中文的就是英文的。
+ \step[fieldset=language,fieldvalue={english}]
+ }
+ \map{%一条文献的语言已经设定在language域中,由于出版项相关宏中使用userd判断,
+ %所以将一条文献的主体语言设定到userd中,本身前面userd已经设定,但没有处理无标题的情况,
+ %这里的处理等价于没有标题时,利用作者的语言设定userd,再没有作者,则默认用英文设定userd
+ \step[fieldsource=language]
+ \step[fieldset=userd,origfieldval]
+ }
+ \map{%当文献给出language域时,设置文献要使用的本地化字符串的语言
+ \step[fieldsource=language,match=\regexp{(e|E)(n|N)(g|G)(l|L)(i|I)(s|S)(h|H)},final]
+ \step[fieldset=langid,fieldvalue={english}]
+ }
+ \map{
+ \step[fieldsource=language,match=\regexp{(r|R)(u|U)(s|S)(s|S)(i|I)(a|A)(n|N)},final]
+ \step[fieldset=langid,fieldvalue={russian}]
+ }
+ \map{%
+ \step[fieldsource=language,match=\regexp{(f|F)(r|R)(e|E)(n|N)(c|C)(h|H)},final]
+ \step[fieldset=langid,fieldvalue={french}]
+ }
+ \map{%
+ \step[fieldsource=language,match=\regexp{(c|C)(h|H)(i|I)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english,
+ \step[fieldset=langid,fieldvalue={english}]
+ }
+ \map{%
+ \step[fieldsource=language,match=\regexp{(j|J)(a|A)(p|P)(a|A)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english,
+ \step[fieldset=langid,fieldvalue={english}]
+ }
+ \map{%
+ \step[fieldsource=language,match=\regexp{(k|K)(o|O)(r|R)(e|E)(a|A)(n|N)},final]%中日韩语目前都用english,
+ \step[fieldset=langid,fieldvalue={english}]
+ }
+}
+}
+
+
+ %
+ % 修改输入的参考文献数据,样式层的操作
+ %
+ % 原理方法:biblatex3.4以上版本map可使用foreach选项来处理特殊字符
+ \DeclareStyleSourcemap{
+ \maps[datatype=bibtex]{
+ \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook,
+ %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义
+ %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断
+ \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook
+ \step[typesource=standard, typetarget=inbook, final]
+ }
+ \map{%尝试未定义数据模型的standard类型映射为book,standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义
+ \step[typesource=standard, typetarget=book, final]%当不存在booktitle域是映射为book
+ }
+% \map{%先于标准样式的driver层映射,将其先映射过来,并取消type设置
+% \step[typesource=mastersthesis, typetarget=thesis, final]
+% %\step[fieldset=type, fieldvalue=mathesis]
+% }
+% \map{%先于标准样式的driver层映射,将其先映射过来,并取消type设置
+% \step[typesource=phdthesis, typetarget=thesis, final]
+% %\step[fieldset=type, fieldvalue=phdthesis]
+% }
+ \map{%先于标准样式的driver层映射,将其先映射过来,并取消type设置
+ \step[typesource=techreport, typetarget=report, final]
+ %\step[fieldset=type, fieldvalue=techreport]
+ }
+ \map{%
+ \pertype{report}
+ \step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=report,typetarget=online]
+ \step[fieldset=note,fieldvalue={report}]
+ }
+ \map{%
+ \pertype{thesis}
+ \step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=thesis,typetarget=online]
+ }
+ \map{%
+ \pertype{manual}
+ \step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=manual,typetarget=online]
+ }
+ \map{%
+ \pertype{unpublished}
+ \step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=unpublished,typetarget=online]
+ }
+ \map{%
+ \pertype{database}
+ \step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=databasetypetarget=online]
+ }
+ \map{%
+ \pertype{dataset}
+ \step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=dataset,typetarget=online]
+ }
+ \map{%
+ \pertype{software}
+ \step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=software,typetarget=online]
+ }
+ \map{%
+ \pertype{map}
+ \step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=map,typetarget=online]
+ }
+ \map{%
+ \pertype{archive}
+ \step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=archive,typetarget=online]
+ }
+ \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确)
+ \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸
+ \step[fieldset=keywords, fieldvalue={,}, append]
+ \step[fieldset=keywords, origfieldval, append]
+ }
+ \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{
+ \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}]
+ }
+ \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{
+ \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}]
+ }
+ \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,%
+ address,location,institution,organization}]{
+ \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
+ }
+ }
+ }
+
+%
+%驱动别名等价于驱动层映射
+%
+\DeclareBibliographyAlias{newspaper}{article}%
+\DeclareBibliographyAlias{inproceedings}{inbook}%会议论文文献类型驱动
+\DeclareBibliographyAlias{conference}{inbook}%会议论文文献类型驱动
+\DeclareBibliographyAlias{incollection}{inbook}%文集中析出文献类型驱动
+\DeclareBibliographyAlias{collection}{book}%%文集类型驱动
+\DeclareBibliographyAlias{proceedings}{book}%会议论文集文献类型驱动
+\DeclareBibliographyAlias{thesis}{manual}%学位论文驱动
+\DeclareBibliographyAlias{unpublished}{manual}%其它类型驱动
+\DeclareBibliographyAlias{database}{manual}
+\DeclareBibliographyAlias{dataset}{manual}
+\DeclareBibliographyAlias{software}{manual}
+\DeclareBibliographyAlias{map}{manual}
+\DeclareBibliographyAlias{archive}{manual}
+
+
+%=====================================================================
+% 参考文献表环境
+%=====================================================================
+%
+% 列表格式
+%
+% 增加一个\bibitemindent尺寸用于控制list环境的itemindent
+% v1.0l,20180615,hzz
+% v1.0t,20200319,hzz,增加尺寸\biblabelextend使某些字体下标签宽度不足时可增加标签宽度
+\setlength{\bibhang}{\biblabelsep}%
+\newlength{\bibitemindent}
+\setlength{\bibitemindent}{0pt}
+\newlength{\biblabelextend}
+\setlength{\biblabelextend}{0pt}
+
+
+\defbibenvironment{bibliography}
+ {\list
+ {\printtext[labelnumberwidth]{%
+ \printfield{labelprefix}%
+ \printfield{labelnumber}}}
+ {\addtolength{\labelnumberwidth}{\biblabelextend}%
+ \setlength{\labelwidth}{\labelnumberwidth}%
+ \setlength{\labelsep}{\biblabelsep}%
+ \setlength{\leftmargin}{\bibhang}%
+ \addtolength{\leftmargin}{\labelnumberwidth}%
+ \setlength{\itemindent}{\bibitemindent}%
+ \setlength{\itemsep}{\bibitemsep}%
+ \setlength{\parsep}{\bibparsep}}%
+ \renewcommand*{\makelabel}[1]{\hss##1}}
+ {\endlist}
+ {\item}
+
+%
+% 顺序编码制-标签对齐方式处理
+%
+% 原理方法:利用选项提供的计数器数值做选择
+% 左对齐,右对齐为list环境下的处理,此时list环境的\labelwidth只能设置一个,是最宽标签的宽度
+% 项对齐则是在段落环境下做的处理。
+% 左对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距可变
+% 右对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距相等,标签与页边距离可变
+% 项对齐时,序号标签贴在页边,序号标签与参考文献项内容的间距相等
+% 修改序号标签格式为:
+% \DeclareFieldFormat{shorthandwidth}{\mkbibbrackets{#1}} %源来自numeric.BBX
+% \DeclareFieldFormat{labelnumberwidth}{\ttfamily\mkbibbrackets{#1}\hfill}
+\DeclareFieldFormat{labelnumberwidth}{%
+\ifcase\value{gbalignlabel}%右对齐,整个标签为右对齐
+ \mkgbnumlabel{#1}%
+\or%左对齐,整个标签为左对齐
+ \mkgbnumlabel{#1}\hfill%
+\or%中间对齐,比如:序号数字居于[]中间
+ \hfil\mkgbnumlabel{\hfill#1\hfill}\hfil%
+\fi}
+
+%
+% 修改序号标签格式为以各条参文献为基础进行对齐的方式,即序号与条目内容间隔相等的方式。
+\def\setaligngbstyle{%
+\def\blx at bibitem##1{%
+ \blx at ifdata{##1}
+ {\begingroup
+ \blx at getdata{##1}%
+ \blx at bibcheck
+ \iftoggle{blx at skipentry}{}{%
+ \blx at setdefaultrefcontext{##1}%
+ \global\let\blx at noitem\@empty
+ \blx at setoptions@type\abx at field@entrytype
+ \blx at setoptions@entry
+ \blx at thelabelnumber
+ \addtocounter{instcount}\@ne
+ \blx at initsep
+ \blx at namesep
+ \csuse{blx at item@\blx at theenv}\relax
+% \blx at initsep %移动到上面去,恢复bibnamesep等的作用机制
+% \blx at namesep
+ \csuse{blx at hook@bibitem}%
+ \blx at execute
+ \blx at initunit
+ \blx at anchor
+ \blx at beglangbib
+ \bibsentence
+ \blx at pagetracker
+ \blx at driver\abx at field@entrytype
+ \blx at postpunct
+ \blx at endlangbib}%
+ \par\endgroup}%这里增加了一个\par
+ {}}
+\newlength{\lengthid}
+\newlength{\lengthlw}
+\newcommand{\itemcmd}{%
+\settowidth{\lengthid}{\mkgbnumlabel{\printfield{labelnumber}}}
+\addtolength{\lengthid}{\biblabelsep}
+\setlength{\lengthlw}{\textwidth}
+\addtolength{\lengthlw}{-\lengthid}
+\addvspace{\bibitemsep}%恢复\bibitemsep的作用
+%\parshape 2 0em \textwidth \lengthid \lengthlw
+\hangindent\lengthid
+\mkgbnumlabel{\printfield{labelnumber}}%
+\hspace{\biblabelsep}}
+%
+% 简单的段落环境
+\defbibenvironment{bibliography}
+{\begingroup\setlength{\parindent}{0em}}
+{\endgroup}
+{\itemcmd}}
+
+
+%=====================================================================
+% 设置单元或块等的标点
+%=====================================================================
+\renewrobustcmd*{\bibinithyphendelim}{\addhighpenspace}%用于处理姓名中名部分存在-的情况,比如ZHANG Yu-xin
+\renewcommand*{\subtitlepunct}{\addcolon\addspace} %修改标题和其它标题信息间的标点,来源biblatex.def,
+%
+% 利用set实现的多语言文献不同语言间的分隔符
+% 20170411,双语之间用newline替换par,避免采用gb7714-2015的项对齐方式第二语言间分段导致没有缩进
+%
+% 原理方法:set方法可以参考3.11.5 Entry Sets,4.11.1 Entry Sets
+% 这里调整一下两种语言参考文献的间隔,源来自biblatex.def
+\renewcommand*{\entrysetpunct}{\adddot\newline\nobreak}
+\renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%%页码引用格式的修改,修改为用冒号
+%\renewcommand{\relateddelim}{}%\par
+
+%=====================================================================
+% 修改域的格式,重定义域的输出宏
+%=====================================================================
+%
+% 新增文献类型标识符的格式
+% []前的nobreak,从GB4.1节的例子看不应该加,所以去掉
+% 但因为考虑到cjk字符和[]之间可能添加空格,所以仍然加上
+% 而[]中间的内容,从4.6.2节的例子看也是可以分割的,因此内部的nobreak也可以去掉
+%
+\DeclareFieldFormat{gbtypeflag}{%
+\iftoggle{bbx:gbmedium}%
+{\iftoggle{bbx:url}%
+ {\iffieldundef{url}%当存在url时,增加一个OL标识符
+ {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}%
+ {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}%
+ }%
+ {\ifentrytype{online}%
+ {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}%
+ {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}%
+ }}%
+ {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}%
+}
+
+%
+% 新增用于报纸的文献类型标识符的格式
+%
+\DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper
+\iftoggle{bbx:gbmedium}%
+{\iftoggle{bbx:url}%
+ {\iffieldundef{url}%当存在url时,增加一个OL标识符
+ {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
+ {\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}%
+ }%
+ {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
+}{\nobreak\printtext{[}\nobreak N\printtext{]}\nobreak}%
+}
+
+%
+% 新增用于标准的文献类型标识符的格式
+%
+\DeclareFieldFormat{gbtypeflags}{%用于标准standard
+\iftoggle{bbx:gbmedium}%
+{\iftoggle{bbx:url}%
+ {\iffieldundef{url}%当存在url时,增加一个OL标识符
+ {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
+ {\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}%
+ }%
+ {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
+}{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}%
+}
+
+%
+% 重设title等参考文献信息的输出格式
+%
+% 原理方法:修改来自biblatex.def文件的原格式
+\newcommand{\bibtitlefont}{}
+\newcommand{\bibauthorfont}{}
+\newcommand{\bibpubfont}{}
+
+%
+% 作者信息的输出格式
+%
+% 20180425,v1.0k,为作者增加字体控制命令,Hu Zhenzhen
+% 20180603,v1.0l,增加使用nameformat域来选择姓名格式
+\DeclareNameFormat{namefmtselected}{%
+\iffieldundef{namefmtid}{}%
+{\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}%
+\ifcase\value{gbnamefmtcase}%
+ \ifgiveninits
+ {\usebibmacro{name:gbuppercase}
+ {\namepartfamily}
+ {\namepartgiveni}
+ {\namepartprefix}
+ {\namepartsuffix}}
+ {\usebibmacro{name:gbuppercase}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}}%
+\or
+ \ifgiveninits
+ {\usebibmacro{name:gblowercase}
+ {\namepartfamily}
+ {\namepartgiveni}
+ {\namepartprefix}
+ {\namepartsuffix}}
+ {\usebibmacro{name:gblowercase}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}}%
+\or
+ \ifgiveninits
+ {\usebibmacro{name:given-family}
+ {\namepartfamily}
+ {\namepartgiveni}
+ {\namepartprefix}
+ {\namepartsuffix}}
+ {\usebibmacro{name:given-family}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}}%
+\or
+ \ifgiveninits
+ {\usebibmacro{name:family-given}
+ {\namepartfamily}
+ {\namepartgiveni}
+ {\namepartprefix}
+ {\namepartsuffix}}
+ {\usebibmacro{name:family-given}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}}%
+\or
+\usebibmacro{name:gbpinyin}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}%
+\or
+ \ifnumequal{\value{listcount}}{1}
+ {\ifgiveninits
+ {\usebibmacro{name:family-given}
+ {\namepartfamily}
+ {\namepartgiveni}
+ {\namepartprefix}
+ {\namepartsuffix}}
+ {\usebibmacro{name:family-given}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}}%
+ \ifboolexpe{%
+ test {\ifdefvoid\namepartgiven}
+ and
+ test {\ifdefvoid\namepartprefix}}
+ {}
+ {\usebibmacro{name:revsdelim}}}
+ {\ifgiveninits
+ {\usebibmacro{name:given-family}
+ {\namepartfamily}
+ {\namepartgiveni}
+ {\namepartprefix}
+ {\namepartsuffix}}
+ {\usebibmacro{name:given-family}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}}}%
+\fi
+ \usebibmacro{name:andothers}}
+
+\DeclareNameAlias{default}{namefmtselected}%姓名的默认格式采用可选的模式
+\DeclareNameAlias{sortname}{default}% Used in the bibliography %family-given/given-family
+\DeclareNameAlias{citename}{default}% Default used by \citename
+
+\DeclareDelimFormat[bib,biblist]{andothersdelim}{\addcomma\addspace}
+%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}%
+
+%GB/T 7714-2015 风格,全部大写
+\newbibmacro*{name:gbuppercase}[4]{\bibauthorfont%
+\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
+\renewcommand*{\revsdnamepunct}{}%
+ \ifuseprefix%
+ {\usebibmacro{name:delim}{#3#1}%
+ \usebibmacro{name:hook}{#3#1}%
+ \ifdefvoid{#3}{}{%
+ \ifcapital%
+ {\mkbibnameprefix{\MakeCapital{#3}}\isdot}%
+ {\mkbibnameprefix{#3}\isdot}%
+ \ifprefchar{}{\bibnamedelimc}}%
+ \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
+ \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital
+ \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号
+ {\usebibmacro{name:delim}{#1}%
+ \usebibmacro{name:hook}{#1}%
+ \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
+ \ifboolexpe{%
+ test {\ifdefvoid{#2}}
+ and
+ test {\ifdefvoid{#3}}}
+ {}{\revsdnamepunct}%
+ \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital
+ \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
+ \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号
+}
+
+%GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出
+\newbibmacro*{name:gblowercase}[4]{\bibauthorfont%
+ \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
+ \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
+ \ifuseprefix
+ {\usebibmacro{name:delim}{#3#1}%
+ \usebibmacro{name:hook}{#3#1}%
+ \ifdefvoid{#3}{}{%
+ \ifcapital
+ {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
+ {\mkbibnameprefix{#3}\isdot}%
+ \ifprefchar{}{\bibnamedelimc}}%
+ \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot%
+ \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital
+ \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号
+ {\usebibmacro{name:delim}{#1}%
+ \usebibmacro{name:hook}{#1}%
+ \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot%
+ \ifboolexpe{%
+ test {\ifdefvoid{#2}}
+ and
+ test {\ifdefvoid{#3}}}
+ {}{\revsdnamepunct}%
+ \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital
+ \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}
+ \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号
+}
+
+%中文常见风格,汉语拼音全拼模式
+\newbibmacro*{name:gbpinyin}[4]{\bibauthorfont%
+\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY
+\renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
+\renewrobustcmd*{\bibnamedelima}{\mbox{-}}%
+ \ifuseprefix
+ {\usebibmacro{name:delim}{#3#1}%
+ \usebibmacro{name:hook}{#3#1}%
+ \ifdefvoid{#3}{}{%
+ \ifcapital
+ {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
+ {\mkbibnameprefix{#3}\isdot}%
+ \ifprefchar{}{\bibnamedelimc}}%
+ \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
+ \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamegiven{#2}}\isdot}%\MakeCapital
+ \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}
+ {\usebibmacro{name:delim}{#1}%
+ \usebibmacro{name:hook}{#1}%
+ \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
+ \ifboolexpe{%
+ test {\ifdefvoid{#2}}
+ and
+ test {\ifdefvoid{#3}}}
+ {}
+ {\revsdnamepunct}%
+ \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeCapital{#2}}\isdot}%\MakeCapital
+ \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}
+ \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%
+}
+
+
+\def\UrlFont{\rmfamily}%设置url字体为roman字体%\ttfamily
+%\urlstyle{rm} %使用这句也一样
+\setcounter{biburlnumpenalty}{100} %让url可以在数字后断行
+\setcounter{biburlucpenalty}{100} %让url可以在大写字母后断行
+\setcounter{biburllcpenalty}{100} %让url可以在小写字母后断行
+\DeclareFieldFormat{doi}{%
+ \rmfamily{DOI}\addcolon\space
+ \ifhyperref
+ {\href{https://doi.org/#1}{\nolinkurl{#1}}}
+ {\nolinkurl{#1}}}
+
+\DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{-}}%将页码间隔符替换会英文的短横线
+
+%
+% beamer中文献标题后的标点问题
+% v1.0k,20180405,为texlive2017以上版本中的beamer兼容性做的处理,Hu Zhenzhen
+%
+% 原理方法:如下代码处理texlive2017以上版本中,beamer中文献的标题后出现两个点的情况:
+% texlive2017以上的beamer中对macro{title}做了patch,正常情况下不会出现两个点的情况,但由于
+% 之前为了处理texlive2015,2016下的title格式添加了adddot,导致出现两个点的情况,而且也影响
+% 析出文献的//符号的输出,因此再次对macro{title}做patch消除beamer中做apptocmd时添加的\newunitpunct
+\@ifclassloaded{beamer}{
+ \DeclareFieldFormat{title}{#1}%
+ \DeclareFieldFormat[article,patent,thesis,unpublished]{title}{#1}
+ \AtBeginDocument{%
+ \patchcmd{\abx at macro@title}{\newunitpunct}{}{}{}}}{}
+
+
+ %
+ % 专利的公告日期、或报纸的日期的输出宏
+ % 20160701,v1.0,新增加
+ % 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen
+ %
+ % 原理方法:加上printtext避免破坏异步标点机制
+ % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份
+ % 所以无法再用选项设置的方法,印象需要用底层的命令
+ % 这里可以用\blx at isodate,但用自定义的\blx at gbdate,以避免版本判断
+ \newbibmacro*{newsdate}{%%
+ \printtext{\blx at gbdate{}{}}%%\blx at isodate{}{}%
+ }
+
+ \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式
+ \ifboolexpr{%
+ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
+ }%
+ {}%更新或修改日期通常有day信息
+ {\iffieldundef{year}{%
+ \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}%
+ {\printtext{(}\printenddate\printtext{)}}%
+ }{\iffieldequalstr{year}{}{%因为year存在,但为空
+ }{\printtext{(}\blx at gbdate{}{}\printtext{)}}%
+ }%
+ }}%
+
+
+ %
+ % biblatex>v3.8版利用related实现双语文献的处理
+ %
+ %为了实现v3.8以上版本的双语文献,采用related的方法代替set方法,因为set方法已经无法实现了,
+ %因为set不再复制其第一个成员的信息。于是定义一个命令,用于动态的修改数据,即添加related域的信息
+ %其中使用了\DeclareStyleSourcemap,但由于其只能出现在导言区中,因此\defdoublelangentry命令也只能出现在导言区中
+ \newcommand{\defdoublelangentry}[2]{%
+ \edef\entrykeya{#1}
+ \edef\entrykeyb{#2}
+ \DeclareStyleSourcemap{
+ \maps[datatype=bibtex]{
+ \map{
+ \step[fieldsource=entrykey, match=\entrykeya, final]
+ \step[fieldset=related, fieldvalue=\entrykeyb]
+ }
+ }
+ }
+ }
+
+ % 关联文献的输出格式
+ %
+ % 关联文献间的分隔符
+ %
+ \renewcommand{\relateddelim}{\adddot\newline\nobreak}%\par,而作者年样式不需要修改,因为没有项对齐的标签问题
+ %
+ % 关联文献块前的分隔符,针对biblatex>3.11
+ %
+ % 原理方法:因为增加了begrelateddelim钩子,所以不需要重定义related输出宏
+ \ifdef{\begrelateddelim}{\renewcommand{\begrelateddelim}{\adddot\newline\nobreak}}{}
+
+
+
+%
+% 新增一个样式用于调整期刊年份的格式,只打印年份
+%
+\newbibmacro*{periodical+issue}{%
+ \printtext{%去掉了[parens]
+ \iffieldundef{issue}
+ {%\usebibmacro{date}%修改为下一句
+ }%
+ {\printfield{issue}%
+ \setunit*{\addspace}%
+ %\usebibmacro{date}%修改为下一句
+ }%
+ }%
+ %\newunit
+}
+
+%
+% 重设专利title的输出,将文献类型标识符输出出去
+%
+\renewbibmacro*{patenttitle}{%原输出来自biblatex.def文件
+ \ifboolexpr{%
+ test{\iffieldundef{title}}%
+ and%
+ test{\iffieldundef{subtitle}}%
+ }%
+ {}%
+ {\printtext[title]{\bibtitlefont%
+ \printfield[titlecase]{title}%
+ \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
+ {}{\setunit{\subtitlepunct}%
+ \printfield[titlecase]{subtitle}}%
+ \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
+ {\setunit{\subtitlepunct}\printfield{titleaddon}}%
+ \setunit{\subtitlepunct}\printfield{number}%写专利号
+ \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}%
+ %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
+ %\newunit
+ }%
+}%
+}
+
+%
+% 编者类型的本地化字符串输出
+% v1.0q 2019-03-01 hzz
+% 能对不同条目类型作格式设置的域格式,能对不同环境做格式设置的分隔符
+% 能对不同文境作设置的包括排序,标签等
+% 这里因为考虑可能标注和文献表中存在不同,所以用分隔符来输出本地化字符串
+%
+\DeclareDelimFormat{streditortypes}{%
+ \edef\userfieldabcde{userd}%
+ \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
+ \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbbiblocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}scn}}{}%
+ \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}skr}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}sjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}%
+ \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}%
+ \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}%
+ \or%
+ \bibstring{\thefield{editortype}scn}%
+ \or%
+ \addcomma\addthinspace\bibstring{\thefield{editortype}s}%
+ \fi}%
+%
+\DeclareDelimFormat{streditortype}{%
+ \edef\userfieldabcde{userd}%
+ \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
+ \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbbiblocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}cn}}{}%
+ \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}kr}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}jp}}{}%
+ \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}%
+ \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}%
+ \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}%
+ \or%
+ \bibstring{\thefield{editortype}cn}%
+ \or%
+ \addcomma\addthinspace\bibstring{\thefield{editortype}}%
+ \fi}%
+
+
+%
+% 修改series域的输出格式
+% 2019.05.01,v1.0r,byhzz
+\renewbibmacro*{series+number}{%
+ \printfield{series}%
+ %\setunit*{\addspace}%
+ %\printfield{number}%
+ %\newunit
+ }
+
+%=====================================================================
+%设置驱动格式
+%=====================================================================
+
+%中文环境的局部化代码
+\def\localsetchinesecode{%
+\ifboolexpr{%
+togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}}%
+}%
+{%
+\iftoggle{bbx:gbfieldstd}{}{%
+\DeclareFieldFormat{title}{##1\adddot\addthinspace}%
+\DeclareFieldFormat{journaltitle}{##1\isdot}%添加\isdot用于缩写名带点情况,将其转换为缩写点,便于标点的追踪
+\DeclareFieldFormat{issuetitle}{##1}%
+\DeclareFieldFormat{maintitle}{##1}%
+\DeclareFieldFormat{booktitle}{##1}%
+\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉
+ [article,patent,thesis,unpublished]%
+ {title}{##1\adddot\addthinspace}%\mkbibquote{##1\isdot}
+\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉
+ [inbook,incollection,inproceedings]%
+ {title}{##1}%\nopunct\unspace
+\DeclareFieldFormat{url}{\url{##1}}%%url相关输出,url域修改如本行,源来自biblatex.def
+%
+% 标题的字母大小写格式修改
+%
+% 注意:修改标题的字母大小写,不能用前面的title的格式而要用titlecase
+% 因为titlecase is applied to the contents of the field directly,title is not
+%\DeclareFieldFormat{titlecase}{\MakeCapital##1}%重设标题格式,将其修改为首字母大写
+\DeclareFieldFormat{titlecase}{\iftoggle{bbx:titlelink}{%
+\iffieldundef{url}{\MakeCapital##1}{%
+\href{\thefield{url}}{##1}}}{\MakeCapital##1}}%重设标题格式,将其修改为首字母大写
+\DeclareFieldFormat{pages}{##1}%去掉前面引导页码的pp.等字符,\mkpageprefix[bookpagination]{##1}
+}%
+%
+% 修改译者位置格式
+%
+% 原理方法:修改来自biblatex.def文件的bytranslator+others宏的格式
+\renewbibmacro*{bytranslator+others}{%
+ \ifnameundef{translator}%
+ {}%
+ {%\usebibmacro{bytranslator+othersstrg}
+ %\setunit{\addspace}%
+ \printnames[bytranslator]{translator}%
+ \clearname{translator}%
+ %从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理
+ %比如生成cotranslator等用于调用cotranslator所代表的当地化字符串
+ \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。
+ %\setunit{\addspace}%
+ \newunit}%
+ \usebibmacro{withothers}}%
+%
+% 修改作者数量超过限定值,做省略时的处理格式
+% v1.0,20160701,hzz
+% v1.0O,20190103,hzz,修改利用新定义的一个分隔符strandothersdelim
+%
+% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。
+\renewbibmacro*{name:andothers}{%
+ \ifboolexpr{%
+ test {\ifnumequal{\value{listcount}}{\value{liststop}}}%
+ and
+ test \ifmorenames
+ }{\ifnumgreater{\value{liststop}}{1}%
+ {\finalandcomma}%
+ {}%
+\printdelim{andothersdelim}\printdelim{strandothersdelim}%
+}{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如:
+%袁训来, 陈哲, 肖书海, 等.
+%胡泳, 范海燕, 译.
+%潘惠霞, 魏婧, 杨艳, 等译.
+\ifcurrentname{translator}{\addcomma\addthinspace}{}%为了实现上述第二个示例情况做的处理
+}}%
+%
+% 修改省略作者后的本地化字符串,比如et al.
+% v1.0o,20190103,hzz
+%
+% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andotherscn=“等”,否则用andothers=“et al.”。
+% 非默认情况,根据选项信息,选择选择强制中文或英文
+% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了
+% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置
+\DeclareDelimFormat{strandothersdelim}{%
+ \edef\userfieldabcde{userd}%
+ \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
+ \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
+ \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
+ \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbbiblocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}%
+ \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andothersjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}%
+ \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%
+ \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%
+ \or%
+ \bibstring{andotherscn}%
+ \or%
+ \bibstring{andothers}%
+ \fi}%
+%
+% 修改最后一个作者前的字符串,比如 and
+% v1.0o,20190103,hzz
+%
+% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andcn=“和”,否则用and=“and”。
+% 非默认情况,根据选项信息,选择选择强制中文或英文
+% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了
+% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置
+\DeclareDelimFormat{finalnamedelim}{%
+ \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
+ \addspace%
+ \edef\userfieldabcde{userd}%
+ \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
+ \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
+ \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
+ \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbbiblocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}%
+ \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}%
+ \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}%
+ \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}%
+\space%
+ \or%
+ \bibstring{andcn}\space%
+ \or%
+ \bibstring{and}\space%
+ \fi}%
+%
+% url和url日期格式
+%
+ \renewbibmacro*{url+urldate}{%
+ %\usebibmacro{url}%%更换url的位置,放到下面
+ \iffieldundef{urlyear}%
+ {}{%\setunit*{\addspace}%
+ \usebibmacro{urldate}}%
+ \setunit{\addperiod\addspace}%
+ \usebibmacro{url}}%
+ \renewbibmacro*{url}{\printfield{url}}%
+%
+% 重设title的输出
+%
+% 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen
+% 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件
+% 利用toggle做标识符是否输出的判断
+\renewbibmacro*{title}{%
+ \ifboolexpr{%
+ test{\iffieldundef{title}}%
+ and
+ test{\iffieldundef{subtitle}}%
+ }%
+ {}%
+ {\printtext[title]{\bibtitlefont%增加字体控制命令
+ \printfield[titlecase]{title}%
+ \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
+ {}{\setunit{\subtitlepunct}%
+ \printfield[titlecase]{subtitle}}%
+ \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
+ {\setunit{\subtitlepunct}\printfield{titleaddon}}%
+ \iftoggle{bbx:gbtype}{%
+ \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准
+ {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准
+ {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸
+ {\printfield[gbtypeflag]{usera}}}%其它
+ }}{}%
+ %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
+ %\newunit
+}%
+}}%
+%
+% 日期信息的输出格式,针对biblatex<3.7版本
+%
+\DeclareFieldFormat{urldate}{##1}%
+\renewbibmacro*{urldate}{%
+\addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx at edtfdate这种更底层的命令
+%
+% 调整doi+eprint+url格式
+%
+% 原理方法:源来自standard.bbx,因为页码后面直接跟引用日期,没有标点所以去掉其中的标点。
+\renewbibmacro*{doi+eprint+url}{%
+% \iftoggle{bbx:doi}%把doi的位置放到url后面
+% {\printfield{doi}}
+% {}%
+ %\newunit\newblock
+ \iftoggle{bbx:eprint}
+ {\iffieldundef{eprint}{}{\newunit\usebibmacro{eprint}}}
+ {}%
+ %\newunit\newblock
+ \iftoggle{bbx:url}
+ {\usebibmacro{url+urldate}}
+ {}
+ \newunit\newblock
+ \iftoggle{bbx:doi}
+ {\printfield{doi}}
+ {}}%
+%
+% 调整页码的格式,即chapter+pages格式
+%
+\renewbibmacro*{chapter+pages}{%
+\iftoggle{bbx:gbstrict}{}{%
+ \printfield{chapter}}%
+ \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出
+ \setunit{\bibpagespunct}%
+ \printfield{pages}}%
+ %\newunit %这里的标点去掉
+}%
+%
+% 当location等出版项超过maxitem缩减后不再输出etal
+%
+\DeclareListFormat{location}{%
+ \usebibmacro{list:delim}{##1}%
+ ##1\isdot}%
+\DeclareListAlias{institution}{location}%
+\DeclareListAlias{publisher}{location}%
+% 新增一个样式用于输出连续出版物的地址,单位,时间,
+% 用于periodical连续出版物的出版社和地址的处理
+%
+% v1.0k,20180425,为出版信息增加字体控制命令,hzz
+% %类似\newbibmacro*{publisher+location+date}
+\newbibmacro*{location+institution+date}{\bibpubfont%
+\iftoggle{bbx:gbpub}%
+{\testCJKfirst{userd}%
+\ifboolexpr{%
+test {\iflistundef{location}} and test {\iflistundef{institution}}%
+}{\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress}\space :\space\str at nopublisher]}%
+{\printtext{[S.l.\space :\space s.n.\adddot]}}%
+}{%
+\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress]}}{\printtext{[S.l.\adddot]}}}%
+ {\printlist{location}}%
+\addcolon\addspace%
+\iflistundef{institution}{%
+\iftoggle{ifCJKforgbt}{\printtext{[\str at nopublisher]}}{\printtext{\mkbibbrackets{s.n.}}}}% \bibstring{nopublisher}%[s.n.\adddot]
+{\printlist{institution}}}%
+\setunit{\addcomma\addspace}%
+ %\usebibmacro{date}%
+ \printfield{year}%
+ \bibrangedash%
+ \iffieldundef{endyear}{}{\printfield{endyear}}%
+ \newunit}%
+{\printlist{location}%
+ \iflistundef{institution}%
+ {\setunit*{\addcomma\space}}
+ {\setunit*{\addcolon\space}}%
+ \printlist{institution}%
+ \setunit*{\addcomma\space}%
+ \usebibmacro{date}%
+ \newunit}%
+}%
+%
+% 通用的出版社和地址的处理
+%
+% 原理方法:当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。
+% 事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。
+% 注意标准standard类型,因为当没有出版项时直接省略,所以做特殊处理
+\renewbibmacro*{publisher+location+date}{\bibpubfont%
+\iftoggle{bbx:gbpub}%
+{\testCJKfirst{userd}%
+ \ifboolexpr{ test {\iflistundef{location}} and test {\iflistundef{publisher}} }%
+ {\iffieldequalstr{note}{standard}{}{\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress}\space :\space\str at nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}%
+ {\iflistundef{location}{%\adddot
+ \iffieldequalstr{note}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。
+ {\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}}}% \bibstring{noaddress}
+ {\printlist{location}\addcolon\addspace}%%\addcolon\addspace%
+ \iflistundef{publisher}{%
+ \iffieldequalstr{note}{standard}{}%
+ {\iftoggle{ifCJKforgbt}{\printtext{[\str at nopublisher]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}%
+ {\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}}}%
+ {\printlist{publisher}}}%
+\setunit*{\addcomma\addspace}%\addcomma\addspace%
+\usebibmacro{date}%%\newunit %去掉这个标点
+}%
+{\printlist{location}%
+ \iflistundef{publisher}
+ {\setunit*{\addcomma\space}}
+ {\setunit*{\addcolon\space}}%
+ \printlist{publisher}%
+ \setunit*{\addcomma\space}%
+ \usebibmacro{date}%%\newunit
+ }%
+}%
+%
+% 修改了一个institution+location+date用于manual、report、thesis等类型
+%
+% 20180425,v1.0k,增加了字体控制命令,hzz
+% 20190105,v1.0o,加了一个编组避免\usebibmacro{date}把month和day信息去掉
+\renewbibmacro*{institution+location+date}{\bibpubfont%当没有institution时不处理。
+{\printlist{location}%%加了一个编组避免\usebibmacro{date}把month和day信息去掉
+ \iflistundef{institution}
+ {\setunit*{\addcomma\space}}
+ {\setunit*{\addcolon\space}}%
+ \printlist{institution}%
+ \setunit*{\addcomma\space}%
+ \usebibmacro{date}%
+ %\newunit
+ }}%
+%
+% 对volume卷信息格式做出修改
+% v1.0o,20190105,hzz
+%
+\DeclareFieldFormat{volume}{%
+\testCJKfirst{userd}%
+\iftoggle{ifCJKforgbt}%
+{\bibstring{serialcn}##1\bibstring{volumecn}}%
+{\bibstring{volume}~##1}%
+}% volume of a book
+\DeclareFieldFormat[article,periodical]{volume}{##1}% volume of a journal
+%
+% 对number册信息格式做出修改
+% v1.0o,20190105,hzz
+%
+\DeclareFieldFormat{number}{##1}%
+\DeclareFieldFormat[book,collection,inbook,%
+incollection,proceedings,inproceedings]{number}{%
+\testCJKfirst{userd}%
+\iftoggle{ifCJKforgbt}%
+{\bibstring{serialcn}##1\bibstring{numbercn}}%
+{##1}%
+}%
+%
+% 对edition版本信息格式做出修改
+%
+\DeclareFieldFormat{edition}{%源来自biblatex.DEF
+\testCJKfirst{userd}%
+\iftoggle{ifCJKforgbt}%
+{\ifinteger{##1}%
+{\printtext{##1\str at edition}}%
+{##1\isdot}}%
+{\ifinteger{##1}%
+{\mkbibordedition{##1}~\bibstring{edition}}%
+{##1\isdot}}}%
+%
+% 对version的版本信息做出修改
+%
+\DeclareFieldFormat{version}{%源来自biblatex.DEF
+\testCJKfirst{userd}%
+\ifinteger{##1}%
+{\iftoggle{ifCJKforgbt}{\printtext{##1\str at edition}}%
+{\mkbibordedition{##1}~\bibstring{version}}}%
+{##1\isdot}}%
+%
+% 修改析出文献的文集的标题与附加标题间的符号
+%
+\renewbibmacro*{booktitle}{%
+ \ifboolexpr{%
+ test {\iffieldundef{booktitle}}
+ and
+ test {\iffieldundef{booksubtitle}}
+ }%
+ {}%
+ {\printtext[booktitle]{\bibtitlefont%
+ \printfield[titlecase]{booktitle}%
+ \setunit{\subtitlepunct}%
+ \printfield[titlecase]{booksubtitle}}%
+ \newunit%标点换成下一句
+ \setunit{\subtitlepunct}}%
+ \printfield{booktitleaddon}}%
+%
+% 调整期刊名的格式
+%
+% v1.0k,20180425,增加了字体控制命令,hzz
+\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx
+ \usebibmacro{journal}%
+ %\setunit*{\addspace}%
+ \setunit*{\addcomma\addspace}%修改为增加一个逗号
+ \iffieldundef{series}
+ {}
+ {\newunit
+ \printfield{series}%
+ \setunit{\addspace}}%
+ %\usebibmacro{volume+number+eid}%
+ %\setunit{\addspace}%
+ \usebibmacro{issue+date}%
+ %\setunit{\addcolon\space}%
+ \iffieldundef{volume}{}{\setunit{\addcomma\space}}%
+ %换成逗号和空格
+ \usebibmacro{issue}%
+ \usebibmacro{volume+number+eid}%把卷期放到年份后面
+ %\newunit
+ }%
+%
+% 调整期刊卷和期的格式
+%
+\renewbibmacro*{volume+number+eid}{%源来自standard.bbx
+\iftoggle{bbx:gbfieldstd}{%
+ \printfield{volume}%
+ \setunit*{\adddot}%
+ \printfield{number}%
+ \setunit{\addcomma\space}%
+ \printfield{eid}}{%
+ \printfield{volume}%
+ %\setunit*{\adddot}%去掉点号
+ %\printfield{number}%
+ \iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号
+ \iffieldundef{eid}{}{%
+ \setunit{\addcomma\space}%
+ \printfield{eid}}}}%
+%
+% 调整期刊年份的格式
+%
+\renewbibmacro*{issue+date}{%去掉括号
+ \printtext{%去掉了[parens]
+ \iffieldundef{issue}
+ {%\usebibmacro{date}
+ \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸
+ {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸
+ {\usebibmacro{date}}%
+ }}%
+ {\iftoggle{bbx:gbstrict}{}{\printfield{issue}%
+ \setunit*{\addspace}}%
+ %\usebibmacro{date}
+ \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸
+ {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸
+ {\usebibmacro{date}}%
+ }}}%
+ %\newunit
+ }%
+%
+% 调整页码前的标点和去掉期刊文章等页码后面的标点
+%
+\renewbibmacro*{note+pages}{%源来自standard.bbx
+ %\printfield{note}%不要note,note用来判断是否是报纸newspaper
+ \iffieldundef{pages}{}{%
+ \setunit{\bibpagespunct}%
+ \printfield{pages}}%
+ %\newunit
+ }%
+%
+% 编者的符号修改一下
+% v1.0 2016-07-01
+% v1.0q 2019-03-01 hzz 修改editortype前的标点
+%
+\renewbibmacro*{editor}{%源来自biblatex.DEF
+ \ifboolexpr{%
+ test \ifuseeditor
+ and
+ not test {\ifnameundef{editor}}%
+ }%
+ {\printnames{editor}%
+ \iffieldundef{editortype}%增加一个类型判断,用于存在editortype的情况
+ {\setunit\addspace}%当没有editortype时,直接用句点
+ {%\setunit{\addcomma\space}%
+ \usebibmacro{editorstrg}}%
+ %\clearname{editor}
+ }%
+ {}}%
+%
+% 编者类型做一修改
+% v1.0 2016-07-01
+% v1.0q 2019-03-01 hzz 修改editortype不同语言的不同本地化字符串
+%
+\renewbibmacro*{editorstrg}{%源来自biblatex.DEF
+ \printtext[editortype]{%
+ \iffieldundef{editortype}%
+ {%
+% \ifboolexpr{ %这一段去掉,未定义编者类型情况下不处理
+% test {\ifnumgreater{\value{editor}}{1}}
+% or
+% test {\ifandothers{editor}}
+% }
+% {\bibstring{editors}}
+% {\bibstring{editor}}
+ }%
+ {\ifbibxstring{\thefield{editortype}}%定义编者类型情况下处理,以后根据需要修改
+ {\ifboolexpr{%
+ test {\ifnumgreater{\value{editor}}{1}}%
+ or
+ test {\ifandothers{editor}}%
+ }%
+ {\printdelim{streditortypes}}%
+ {\printdelim{streditortype}}}%
+ {\thefield{editortype}}}%
+ }}%
+%
+% bookauthor域的输出,
+% v1.0q 2019-03-01 hzz
+% 不再对editor和bookauthor做sourcemap,而是下面的宏内逻辑代替,
+% 使得除使用bookauthor外也可以使用editor,便于在使用editor时使用editortype
+\renewbibmacro*{bybookauthor}{%
+ \ifnameundef{bookauthor}%
+ {\ifnameundef{editor}%
+ {}%
+ {\ifnamesequal{author}{editor}%
+ {}{\usebibmacro{editor}}}%
+ }%
+ {\ifnamesequal{author}{bookauthor}%
+ {}{\printnames{bookauthor}}%
+ }%
+}%
+%
+% 修改期刊的标题
+%
+\renewbibmacro*{periodical}{%源来自biblatex.DEF
+ \iffieldundef{title}
+ {}%
+ {\printtext[title]{\bibtitlefont%
+ \printfield[titlecase]{title}%
+ %\setunit{\subtitlepunct}%
+ \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
+ {}{\setunit{\subtitlepunct}
+ \printfield[titlecase]{subtitle}}%
+ %}%把编组结束移到后面去
+ \iftoggle{bbx:gbtype}{%
+ \iffieldundef{usera}{}{%在标题后直接给出文献标识字母
+ \printfield[gbtypeflag]{usera}}}{}%
+ }}%
+ }%
+%
+% 期刊的标题做修改
+%
+\renewbibmacro*{title+issuetitle}{%源来自standard.BBX
+ \usebibmacro{periodical}%
+ %\setunit*{\addspace}%
+ \setunit*{\adddot\addspace}%标点修改为句点
+ \iffieldundef{series}
+ {}%
+ {\newunit
+ \printfield{series}%
+ \setunit{\addspace}}%
+ \usebibmacro{periodical+issue}%将issue调整到上面来,并修改
+\iffieldundef{number}{}{%%进一步处理有范围的数字
+ \multinumberparser{\thefield{number}}}%
+ \iffieldundef{volume}%
+ {\printfield{year}%
+ \printtext{\mkbibparens{\multinumberfirst}}%
+ \bibrangedash%
+ \iffieldundef{endyear}{}{\printfield{endyear}\printtext{\mkbibparens{\multinumbersecond}}}%
+ }%
+ {\multivolparser{\thefield{volume}}%
+ \printfield{year}%
+ \setunit{\addcomma\space}%将冒号修改为逗号
+ \printtext{\multivolfirst}%
+ \printtext{\mkbibparens{\multinumberfirst}}%
+ \bibrangedash%
+ \iffieldundef{endyear}{}{%
+ \printfield{endyear}%
+ \setunit{\addcomma\space}%将冒号修改为逗号
+ \printtext{\multivolsecond}%
+ \printtext{\mkbibparens{\multinumbersecond}}}%
+ }%
+ \setunit{\addcomma\space}%
+ \printfield{eid}%
+ \setunit{\addspace}%
+ %\usebibmacro{issue+date}%
+ %\setunit{\addcolon\space}%
+ \usebibmacro{issue}%
+ \newunit}%
+%
+% 修改in:用于inbook、incollection、inproceedings等类型
+% 2018.04.20,v1.0k,renewed marco,by hzz
+% 20190212,v1.0q,增加中英文区分,by hzz
+%
+% 原理方法:使用bibmacro{in:}改变了以前在driver中直接输出//的方式,同时也简化了标点控制。
+\renewbibmacro*{in:}{%
+ \iftoggle{bbx:gbpunctin}{\printtext{\allowbreak\texttt{//}\allowbreak}}%\addthinspace
+ {\setunit{\adddot\addspace}%
+ \iffieldequalstr{userd}{chinese}%
+ {\printtext{\bibstring{incn}}}%
+ {\printtext{\bibstring{in}}}%
+ }}%\newunit\newblock\intitlepunct
+%
+% 修改type域的输出格式
+% 2019.02.12,v1.0q,byhzz
+% 使其可以区分中英文输出不同的格式,比如博士论文英文输出PHD thesis,中文则是博士学位论文
+\DeclareFieldFormat{type}%
+{\iffieldequalstr{userd}{chinese}%
+ {\ifbibxstring{##1cn}{\bibxstring{##1cn}}{##1}}%
+ {\ifbibstring{##1}{\bibstring{##1}}{##1}}%
+}%
+%
+% book条目类的驱动
+%
+\csdef{blx at bbx@book}{%%源来自standard.bbx文件
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+\usebibmacro{author/editor+others/translator+others}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+\usebibmacro{maintitle+title}%
+\iftoggle{bbx:gbstrict}{}{%
+\newunit
+\printlist{language}%
+\newunit\newblock%
+\usebibmacro{byauthor}%
+\newunit\newblock}%
+\usebibmacro{byeditor+others}%
+\newunit
+\printfield{edition}%
+\newunit\newblock%%
+\iftoggle{bbx:gbstrict}{}{%
+\iffieldundef{maintitle}%
+{\printfield{volume}%
+\printfield{part}}%
+{}%
+\newunit%
+\printfield{volumes}%
+\newunit\newblock%
+\usebibmacro{series+number}}%
+\newunit\newblock%
+%\printfield{note}%
+%\newunit\newblock%
+\usebibmacro{publisher+location+date}%
+%\newunit\newblock %这里标点去掉
+\usebibmacro{chapter+pages}%
+ \iffieldundef{url}{}{%当没有网址时也不输出
+ \usebibmacro{modifydate}}%带括号的修改或更新日期,
+\usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。
+ \newunit\newblock%
+ \printfield{pagetotal}%
+ \newunit\newblock%
+ \iftoggle{bbx:isbn}
+ {\printfield{isbn}}
+ {}%
+ \newunit\newblock
+ %\usebibmacro{doi+eprint+url}%
+ %\newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}%
+%
+% 期刊文章,连续出版物中的析出文献的格式
+%
+\csdef{blx at bbx@article}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/translator+others}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ \usebibmacro{title}%
+ \iftoggle{bbx:gbstrict}{}{%
+ \newunit%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}%
+ \newunit\newblock
+ \usebibmacro{bytranslator+others}%
+ \newunit\newblock
+ \printfield{version}}%
+ \newunit\newblock
+ %\usebibmacro{in:}% 不使用in来表示期刊等连续出版物
+ \usebibmacro{journal+issuetitle}%
+ %\newunit
+% \usebibmacro{byeditor+others}%
+% \newunit
+ \usebibmacro{note+pages}%
+ \iffieldequalstr{note}{news}{}{%当是新闻时不输出修改或更新日期
+ \iffieldundef{url}{}{%当没有网址时也不输出
+ \iftoggle{bbx:url}{%当url选项为false时,也不输出
+ \usebibmacro{modifydate}}{}}}%带括号的修改或更新日期,
+ \usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置
+ \newunit\newblock
+ \iftoggle{bbx:isbn}
+ {\printfield{issn}}
+ {}%
+ \newunit\newblock
+ %\usebibmacro{doi+eprint+url}%
+ %\newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}%
+%
+% 连续出版物的驱动
+%
+\csdef{blx at bbx@periodical}{%源来自standard.BBX
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{editor}%
+ %\setunit{\labelnamepunct}\newblock
+ \newunit\newblock %删除上面一行,添加这一行
+ \usebibmacro{title+issuetitle}%
+ \newunit\newblock%
+ \usebibmacro{location+institution+date}%添加这一行用于输出地址,单位和时间
+ \newunit\newblock%添加这一行
+ \iftoggle{bbx:gbstrict}{}{%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byeditor}%
+ \newunit\newblock
+ \printfield{note}%
+ \newunit\newblock}
+ \iftoggle{bbx:isbn}
+ {\printfield{issn}}
+ {}%
+ \newunit\newblock
+ \usebibmacro{doi+eprint+url}%
+ \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}%
+%
+% 专利文献驱动
+%
+\csdef{blx at bbx@patent}{%源来自standard.BBX
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ %\usebibmacro{title}%
+ \usebibmacro{patenttitle}%给出专利专用的标题输出
+ \iftoggle{bbx:gbstrict}{}{%
+ \newunit%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}}%
+ \newunit\newblock
+ \printfield{type}%
+ \setunit*{\addspace}%
+ %\printfield{number}%已放到patenttitle中处理
+ \iflistundef{location}
+ {}
+ {\setunit*{\addspace}%
+ \printtext{%[parens]
+ \printlist[][-\value{listtotal}]{location}}}%
+ \newunit\newblock
+ \usebibmacro{byholder}%
+ \newunit\newblock
+ \printfield{note}%
+ \newunit\newblock
+ \usebibmacro{newsdate}%
+ %\newunit\newblock
+ \usebibmacro{doi+eprint+url}%
+ \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}%
+%
+% 在线文献驱动
+%
+\csdef{blx at bbx@online}{%源来自standard.BBX
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/editor+others/translator+others}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ \usebibmacro{title}%
+ \iftoggle{bbx:gbstrict}{}{%
+ \newunit%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}%
+ \newunit\newblock
+ \usebibmacro{byeditor+others}%
+ \newunit\newblock
+ \printfield{note}}%
+ \newunit
+ \printfield{version}%
+ \newunit\newblock
+%\printlist{organization}%
+ \printlist{institution}%
+ \newunit\newblock
+\ifboolexpr{%
+test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
+}{\usebibmacro{date}}%
+{\usebibmacro{modifydate}}%修改或更新日期,为带括号的时间
+ \usebibmacro{url+urldate}%从下面移上来
+ \newunit\newblock
+ \iftoggle{bbx:eprint}
+ {\usebibmacro{eprint}}
+ {}%
+ \newunit\newblock
+ %\usebibmacro{url+urldate}%
+ %\newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}%
+%
+% 报告类型驱动
+% 2016-11-11,增加了译者信息
+%
+\csdef{blx at bbx@report}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ \usebibmacro{title}%
+ \iftoggle{bbx:gbstrict}{}{%
+ \newunit%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}}%
+ \newunit\newblock
+ \usebibmacro{byeditor+others}%增加的译者信息
+ \newunit\newblock
+ \printfield{type}%
+ \setunit*{\addspace}%
+ \printfield{number}%
+ \newunit\newblock
+ \printfield{version}%
+ \newunit
+ \printfield{note}%
+ \newunit\newblock
+ \usebibmacro{publisher+location+date}%
+ %\newunit\newblock
+ \usebibmacro{chapter+pages}%
+ \usebibmacro{doi+eprint+url}%
+ \newunit
+ \printfield{pagetotal}%
+ \newunit\newblock
+ \iftoggle{bbx:isbn}
+ {\printfield{isrn}}
+ {}%
+ \newunit\newblock
+% \usebibmacro{doi+eprint+url}%
+% \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}%
+%
+% 手册类型驱动
+% 2016-11-11,增加了译者信息
+%
+%
+\csdef{blx at bbx@manual}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ \usebibmacro{title}%
+ \iftoggle{bbx:gbstrict}{}{%
+ \newunit%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}}%
+ \newunit\newblock
+ \usebibmacro{byeditor+others}%增加的译者信息
+ \newunit\newblock
+ \iftoggle{bbx:gbfieldtype}{%
+ \printfield{type}%
+ \setunit*{\addspace}}{}%
+ \printfield{number}%
+ \newunit\newblock
+ \printfield{version}%
+ \newunit
+ \printfield{note}%
+ \newunit\newblock
+ \usebibmacro{institution+location+date}%
+ %\newunit\newblock
+ \usebibmacro{chapter+pages}%
+ \iffieldundef{url}{}{%当没有网址时也不输出修改或更新日期
+ \usebibmacro{modifydate}}%修改或更新日期为带括号的时间
+ \usebibmacro{doi+eprint+url}%
+ \newunit
+ \printfield{pagetotal}%
+ \newunit\newblock
+ \iftoggle{bbx:isbn}
+ {\printfield{isrn}}
+ {}%
+ \newunit\newblock
+% \usebibmacro{doi+eprint+url}%
+% \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}%
+%
+% 备选类型驱动
+%
+% 利用biblatex的misc驱动
+\csdef{blx at bbx@misc}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/editor+others/translator+others}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ \usebibmacro{title}%
+\iftoggle{bbx:gbstrict}{}{%
+ \newunit
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}%
+ \newunit\newblock
+ \usebibmacro{byeditor+others}}%
+ \newunit\newblock
+ \printfield{howpublished}%
+ \newunit\newblock
+ \printfield{type}%
+ \newunit
+ \printfield{version}%
+ \newunit
+ \printfield{note}%
+ \newunit\newblock
+ \usebibmacro{institution+location+date}%
+ %\usebibmacro{organization+location+date}%
+ %\newunit\newblock
+ \usebibmacro{doi+eprint+url}%
+ \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}%
+%
+% 专著中的析出文献的格式修改
+%
+\csdef{blx at bbx@inbook}{%源来自standard.bbx
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/translator+others}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+\usebibmacro{title}%
+\usebibmacro{in:}%
+%\printtext{\texttt{//}\addthinspace}%
+ \usebibmacro{bybookauthor}%
+ \ifnameundef{bookauthor}{%
+ \ifnameundef{editor}{}{\newunit}%
+ }{\newunit}%替换下一句
+ %\newunit\newblock
+\iffieldundef{series}{}{\usebibmacro{series+number}\setunit{\addcolon\addspace}}%为处理一些存在series的情况而增加
+ \usebibmacro{maintitle+booktitle}%
+\iffieldundef{volume}{}{\setunit{\addcolon\addspace}\printfield{volume}}%
+\iffieldundef{number}{}{\setunit{\addcolon\addspace}\printfield{number}}%增加卷和册信息
+ \newunit\newblock%
+% \usebibmacro{byeditor+others}%
+% \newunit\newblock
+ \printfield{edition}%
+ \newunit
+ \iftoggle{bbx:gbstrict}{}{%
+% \iffieldundef{maintitle}
+% {\printfield{volume}%
+% \printfield{part}}
+% {}%
+% \newunit
+% \printfield{volumes}%
+% \newunit\newblock
+% \usebibmacro{series+number}
+ }%
+ \newunit\newblock
+ %\printfield{note}%
+ %\newunit\newblock
+ \usebibmacro{publisher+location+date}%
+%\newunit\newblock
+ \usebibmacro{chapter+pages}%
+ %\newunit\newblock
+ \usebibmacro{doi+eprint+url}%移到上面来
+ \newunit\newblock
+ \iftoggle{bbx:isbn}
+ {\printfield{isbn}}
+ {}%
+ \newunit\newblock
+ %\usebibmacro{doi+eprint+url}%
+% \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}%
+}{}%
+}
+
+\AtEveryBibitem{\localsetchinesecode}%
+\AtEveryCite{\localsetchinesecode}%
+\AtEveryLositem{\localsetchinesecode}%
Modified: trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.cbx
===================================================================
--- trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.cbx 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.cbx 2021-01-19 22:57:40 UTC (rev 57468)
@@ -1,190 +1,190 @@
-%%
-%% ---------------------------------------------------------------
-%% biblatex-gb7714-2015 --- A biblatex implementation of the
-%% GBT7714-2015 citation style,numerical sequence
-%% Maintained by huzhenzhen
-%% E-mail: hzzmail at 163.com
-%% Released under the LaTeX Project Public License v1.3c or later
-%% ---------------------------------------------------------------
-%%
-\def\versionofgbtstyle{2020/07/21 v1.0v}
-\ProvidesFile{gb7714-2015ms.cbx}[\versionofgbtstyle biblatex citation style]
-
-%
-% 加载标准样式
-%
-\RequireCitationStyle{numeric-comp} %numeric
-
-
-%
-% 选项设置
-%
-\ExecuteBibliographyOptions{
- autocite = superscript ,
- autopunct = true ,
- %sorting = none ,
- maxcitenames=1,
- mincitenames=1,
-}
-
-%textcite标注命令中的标点设置
-%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}%
-
-%
-% 定义一个上标方括号wrapper
-%
-\newcommand*\mkbibsuperbracket[1]{%
- \mkbibsuperscript{\mkbibbrackets{#1}}%
-}
-
-% 修改postnote的输出格式
-\DeclareFieldFormat{postnote}{#1}
-
-%
-% 重定义cite命令
-%
-% 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode}
-% v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式
-\DeclareCiteCommand{\cite}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号
- {[\usebibmacro{cite:init}%
- \usebibmacro{prenote}}
- {\usebibmacro{citeindex}%
- \usebibmacro{cite:comp}}
- {}
- {\usebibmacro{cite:dump}]%
- \printfield{postnote}}
-% v1.0p 以前用的方式
-%\DeclareCiteCommand{\cite}[\mkbibsuperbracket]%利用mkbibsuperbracket添加方括号
-% {\usebibmacro{cite:init}%
-% \usebibmacro{prenote}}
-% {\usebibmacro{citeindex}%
-% \usebibmacro{cite:comp}}
-% {}
-% {\usebibmacro{cite:dump}%
-% \usebibmacro{postnote}}
-
-%
-% 定义upcite命令
-% 20180604,v1.0l,hzz
-% 20190409,v1.0r,hzz
-% 方法:对supercite增加[]
-\newrobustcmd*{\upcite}{%
- \cite}
-
-%
-% 重定义parencite命令,以满足标签带页码的国标要求
-%
-\DeclareCiteCommand{\parencite}%[\mkbibbrackets]
- {[\usebibmacro{cite:init}%]
- \usebibmacro{prenote}}%
- {\usebibmacro{citeindex}%
- \usebibmacro{cite:comp}}
- {}
- {%[
- \usebibmacro{cite:dump}]%
- \mkbibsuperscript{\printfield{postnote}}}
-
-%
-% 新定义pagescite命令,以满足标签带页码的国标要求
-%
-% 原理方法:
-% 1.新增页码输出宏
-\newbibmacro*{postpages}{%
- \iffieldundef{postnote}
- {\printfield[postnote]{pages}}
- {\printfield{postnote}}}
-% 2.新增\pagescite引用命令
-\DeclareCiteCommand{\pagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标
- {[\usebibmacro{cite:init}%]直接添加方括号
- \usebibmacro{prenote}%
- }
- {\usebibmacro{citeindex}%
- \usebibmacro{cite:comp}}
- {}
- {\usebibmacro{cite:dump}]%
- \usebibmacro{postpages}}
-
-%
-% 定义yearpagescite,为与ay样式兼容,等同于\pagescite
-%
-\DeclareCiteCommand{\yearpagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标
- {[\usebibmacro{cite:init}%]直接添加方括号
- \usebibmacro{prenote}%
- }
- {\usebibmacro{citeindex}%
- \usebibmacro{cite:comp}}
- {}
- {\usebibmacro{cite:dump}]%
- \usebibmacro{postpages}}
-
-
-
-%
-% 定义\yearcite命令,为与ay样式兼容,且提供不输出页码的标签格式,
-%
-% 原理方法:等同于\pagescite,但不要页码
-\DeclareCiteCommand{\yearcite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标
- {[\usebibmacro{cite:init}%]直接添加方括号
- \usebibmacro{prenote}%
- }
- {\usebibmacro{citeindex}%
- \usebibmacro{cite:comp}}
- {}
- {\usebibmacro{cite:dump}]}
-
-%
-% 定义\authornumcite命令,输出作者信息,然后在后面带上顺序编码
-% 20180427,v1.0k,增加,hzz
-% gb7714样式新定义的命令都把cite放到最后,比如前面的pagescite,yearcite,这里的\authornumcite
-% 区别于biblatex定义的命令都把cite放到前面,比如citeauthor等。
-%见numeric.CBX
-\newbibmacro*{cite}{%
- \printtext[bibhyperref]{%
- \printfield{labelprefix}%
- \printfield{labelnumber}%
- \ifbool{bbx:subentry}
- {\printfield{entrysetcount}}
- {}}}
-%见numeric.CBX,\DeclareCiteCommand{\cite},
-\DeclareCiteCommand{\authornumcite}%[\mkbibsuperscript]
- {\usebibmacro{prenote}}
- {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace
- {\renewcommand*{\andothersdelim}{\addspace}}%
- \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}%
- \usebibmacro{cite}}}}
- {\multicitedelim}
- {\mkbibsuperscript{\printfield{postnote}}}
-
-
-%
-% 增加如下多个命令
-% 20190409,v1.0r,hzz
-% 方法:利用newcommand或newrobustcmd命令进行定义
-% 注意\citet和\citep命令之所以不用newrobustcmd,是为避免加载natbib模块后产生冲突
-\DeclareCiteCommand{\citet}%
- {\usebibmacro{prenote}}
- {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace
- {\renewcommand*{\andothersdelim}{\addspace}}%
- \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}%
- \usebibmacro{cite}}}}
- {\multicitedelim}
- {\mkbibsuperscript{\printfield{postnote}}}
-
-
-\DeclareCiteCommand{\citep}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号
- {[\usebibmacro{cite:init}%
- \usebibmacro{prenote}}
- {\usebibmacro{citeindex}%
- \usebibmacro{cite:comp}}
- {}
- {\usebibmacro{cite:dump}]%
- \printfield{postnote}}
-
-\newrobustcmd*{\citetns}%
- {\textcite}
-
-\newrobustcmd*{\citepns}%
- {\parencite}
-
-\newrobustcmd*{\inlinecite}%
- {\parencite}
+%%
+%% ---------------------------------------------------------------
+%% biblatex-gb7714-2015 --- A biblatex implementation of the
+%% GBT7714-2015 citation style,numerical sequence
+%% Maintained by huzhenzhen
+%% E-mail: hzzmail at 163.com
+%% Released under the LaTeX Project Public License v1.3c or later
+%% ---------------------------------------------------------------
+%%
+\def\versionofgbtstyle{2021/01/19 v1.0w}
+\ProvidesFile{gb7714-2015ms.cbx}[\versionofgbtstyle biblatex citation style]
+
+%
+% 加载标准样式
+%
+\RequireCitationStyle{numeric-comp} %numeric
+
+
+%
+% 选项设置
+%
+\ExecuteBibliographyOptions{
+ autocite = superscript ,
+ autopunct = true ,
+ %sorting = none ,
+ maxcitenames=1,
+ mincitenames=1,
+}
+
+%textcite标注命令中的标点设置
+%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}%
+
+%
+% 定义一个上标方括号wrapper
+%
+\newcommand*\mkbibsuperbracket[1]{%
+ \mkbibsuperscript{\mkbibbrackets{#1}}%
+}
+
+% 修改postnote的输出格式
+\DeclareFieldFormat{postnote}{#1}
+
+%
+% 重定义cite命令
+%
+% 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode}
+% v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式
+\DeclareCiteCommand{\cite}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号
+ {[\usebibmacro{cite:init}%
+ \usebibmacro{prenote}}
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite:comp}}
+ {}
+ {\usebibmacro{cite:dump}]%
+ \printfield{postnote}}
+% v1.0p 以前用的方式
+%\DeclareCiteCommand{\cite}[\mkbibsuperbracket]%利用mkbibsuperbracket添加方括号
+% {\usebibmacro{cite:init}%
+% \usebibmacro{prenote}}
+% {\usebibmacro{citeindex}%
+% \usebibmacro{cite:comp}}
+% {}
+% {\usebibmacro{cite:dump}%
+% \usebibmacro{postnote}}
+
+%
+% 定义upcite命令
+% 20180604,v1.0l,hzz
+% 20190409,v1.0r,hzz
+% 方法:对supercite增加[]
+\newrobustcmd*{\upcite}{%
+ \cite}
+
+%
+% 重定义parencite命令,以满足标签带页码的国标要求
+%
+\DeclareCiteCommand{\parencite}%[\mkbibbrackets]
+ {[\usebibmacro{cite:init}%]
+ \usebibmacro{prenote}}%
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite:comp}}
+ {}
+ {%[
+ \usebibmacro{cite:dump}]%
+ \mkbibsuperscript{\printfield{postnote}}}
+
+%
+% 新定义pagescite命令,以满足标签带页码的国标要求
+%
+% 原理方法:
+% 1.新增页码输出宏
+\newbibmacro*{postpages}{%
+ \iffieldundef{postnote}
+ {\printfield[postnote]{pages}}
+ {\printfield{postnote}}}
+% 2.新增\pagescite引用命令
+\DeclareCiteCommand{\pagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标
+ {[\usebibmacro{cite:init}%]直接添加方括号
+ \usebibmacro{prenote}%
+ }
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite:comp}}
+ {}
+ {\usebibmacro{cite:dump}]%
+ \usebibmacro{postpages}}
+
+%
+% 定义yearpagescite,为与ay样式兼容,等同于\pagescite
+%
+\DeclareCiteCommand{\yearpagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标
+ {[\usebibmacro{cite:init}%]直接添加方括号
+ \usebibmacro{prenote}%
+ }
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite:comp}}
+ {}
+ {\usebibmacro{cite:dump}]%
+ \usebibmacro{postpages}}
+
+
+
+%
+% 定义\yearcite命令,为与ay样式兼容,且提供不输出页码的标签格式,
+%
+% 原理方法:等同于\pagescite,但不要页码
+\DeclareCiteCommand{\yearcite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标
+ {[\usebibmacro{cite:init}%]直接添加方括号
+ \usebibmacro{prenote}%
+ }
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite:comp}}
+ {}
+ {\usebibmacro{cite:dump}]}
+
+%
+% 定义\authornumcite命令,输出作者信息,然后在后面带上顺序编码
+% 20180427,v1.0k,增加,hzz
+% gb7714样式新定义的命令都把cite放到最后,比如前面的pagescite,yearcite,这里的\authornumcite
+% 区别于biblatex定义的命令都把cite放到前面,比如citeauthor等。
+%见numeric.CBX
+\newbibmacro*{cite}{%
+ \printtext[bibhyperref]{%
+ \printfield{labelprefix}%
+ \printfield{labelnumber}%
+ \ifbool{bbx:subentry}
+ {\printfield{entrysetcount}}
+ {}}}
+%见numeric.CBX,\DeclareCiteCommand{\cite},
+\DeclareCiteCommand{\authornumcite}%[\mkbibsuperscript]
+ {\usebibmacro{prenote}}
+ {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace
+ {\renewcommand*{\andothersdelim}{\addspace}}%
+ \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}%
+ \usebibmacro{cite}}}}
+ {\multicitedelim}
+ {\mkbibsuperscript{\printfield{postnote}}}
+
+
+%
+% 增加如下多个命令
+% 20190409,v1.0r,hzz
+% 方法:利用newcommand或newrobustcmd命令进行定义
+% 注意\citet和\citep命令之所以不用newrobustcmd,是为避免加载natbib模块后产生冲突
+\DeclareCiteCommand{\citet}%
+ {\usebibmacro{prenote}}
+ {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace
+ {\renewcommand*{\andothersdelim}{\addspace}}%
+ \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}%
+ \usebibmacro{cite}}}}
+ {\multicitedelim}
+ {\mkbibsuperscript{\printfield{postnote}}}
+
+
+\DeclareCiteCommand{\citep}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号
+ {[\usebibmacro{cite:init}%
+ \usebibmacro{prenote}}
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite:comp}}
+ {}
+ {\usebibmacro{cite:dump}]%
+ \printfield{postnote}}
+
+\newrobustcmd*{\citetns}%
+ {\textcite}
+
+\newrobustcmd*{\citepns}%
+ {\parencite}
+
+\newrobustcmd*{\inlinecite}%
+ {\parencite}
Modified: trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015mx.bbx
===================================================================
--- trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015mx.bbx 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015mx.bbx 2021-01-19 22:57:40 UTC (rev 57468)
@@ -1,3339 +1,3340 @@
-%%
-%% ---------------------------------------------------------------
-%% biblatex-gb7714-2015 --- A biblatex implementation of the
-%% GBT7714-2015 bibliography style,numerical sequence and authoryear mixed style
-%% Maintained by huzhenzhen
-%% E-mail: hzzmail at 163.com
-%% Released under the LaTeX Project Public License v1.3c or later
-%% ---------------------------------------------------------------
-%%
-
-%
-% 版本和时间信息
-%
-\def\versionofgbtstyle{2020/07/21 v1.0v}
-\def\versionofbiblatex{\abx at version}
-\ProvidesFile{gb7714-2015mx.bbx}[\versionofgbtstyle biblatex bibliography style]
-%\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求
-
-%=====================================================================
-% 加载标准样式
-%=====================================================================
-\RequireBibliographyStyle{numeric-comp}
-\RequirePackage{xstring}%解决texlive2015的biblatex3.0不加载xstring包的问题
-
-
-%=====================================================================
-% 功能函数
-%=====================================================================
- %
- % 增加一个控制是否输出文献载体的选项
- % 20191125,v1,0s,hzz
- \newtoggle{bbx:gbmedium}
- \DeclareBibliographyOption{gbmedium}[true]{%biblatex低版本
- \settoggle{bbx:gbmedium}{#1}}
- \ExecuteBibliographyOptions{gbmedium}
- %
- % 增加一个控制是否输出annotation域的选项,该域可以用于在文献条目后面输出一些注释信息
- % 20190509,v1,0s,hzz
- \newtoggle{bbx:gbannote}
- \DeclareBibliographyOption{gbannote}[false]{%biblatex低版本
- \settoggle{bbx:gbannote}{#1}}
- \ExecuteBibliographyOptions{gbannote}
- %
- %用于在文献条目后面输出注释信息的宏
- %FieldFormat{annotation}用于设置注释信息的格式
- \DeclareFieldFormat{annotation}{%
- \printtext{\addspace(#1)}%
- }
- \renewbibmacro*{annotation}{%
- \iftoggle{bbx:gbannote}%
- {\iffieldundef{annotation}%
- {\printfile[annotation]{\bibannotationprefix\thefield{entrykey}.tex}}%
- {\printfield{annotation}}}%
- {}%
- }
-
-
- %
- % biblatex版本判断
- % 20180629,v1.0k,hzz
- %
- % 原理方法:适用于3.10以上版本的biblatex,否则给出警告
- \@ifpackagelater{biblatex}{2017/12/28}{}{
- \blx at warning@noline{%
- biblatex version is too old for this style\MessageBreak
- if errors raised,Please update biblatex to the latest version.}
- }
-
- %
- % 判断CJK字符的函数,用于判断作者等信息是否由中文字符构成
- % v1.0k,20180509,hzz
- %
- % 原理方法:用biber中的perl方法代替。因为利用tex函数对字符判断时,当字符在宏
- % 中时,基于`的方法无法解决GBK编码的问题,基于CJKsymbol的方法无法解决utf-8
- % 编码用xelatex编译的问题。
- %
- % 原理是:利用perl正则将中文标识记录到域中,
- % 然后利用\iffieldundef和\iffieldequalstr进行判断
- \providetoggle{ifCJKforgbt}
- \def\testCJKfirst#1{%
- \iffieldundef{#1}{\togglefalse{ifCJKforgbt}}{%
- \iffieldequalstr{#1}{chinese}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}}}
-
- %
- % 2个卷的解析函数,用于连续出版物
- %
- % 原理方法: 范围起止间隔符号还是用-,而不是与date相同的/,因为有合期期刊的问题,需要用到/符号
- \newcommand{\multivolparser}[1]{%
- \IfSubStr{#1}{-}%
- {\StrBefore{#1}{-}[\multivolfirst]\StrBehind{#1}{-}[\multivolsecond]}%
- {\def\multivolfirst{#1}\def\multivolsecond{}}%
- }
-
-
- %
- % 2个期的解析函数,用于连续出版物
- %
- \newcommand{\multinumberparser}[1]{%
- \IfSubStr{#1}{-}%
- {\StrBefore{#1}{-}[\multinumberfirst]\StrBehind{#1}{-}[\multinumbersecond]}%
- {\def\multinumberfirst{#1}\def\multinumbersecond{}}%
- }
-
-%=====================================================================
-% 数据模型定义
-%=====================================================================
- %定义类型和载体标识,从gb内容看载体基本属于介质。
- %为与lee zeping的bst的样式统一,使用mark和medium这两域名
- %为单个条目的姓名格式控制增加nameformat和namefmtid两个域
- %为缩略信息文献表增加了shortbooktitle域
- %为多语言排序增加了lansortorder域
- \DeclareDatamodelFields[type=field,datatype=literal]{mark,medium,nameformat}
- \DeclareDatamodelFields[type=field,datatype=integer]{namefmtid}
- \DeclareDatamodelFields[type=field,datatype=literal]{shortbooktitle}
- \DeclareDatamodelFields[type=field,datatype=literal]{lansortorder}
- %为多样式文献表增加的stylesections、styleaysection域:
- \DeclareDatamodelFields[type=field,datatype=integer]{aysections}
- \DeclareDatamodelFields[type=field,datatype=literal]{styleaysection}
-
- %因为biblatex更新3.14版本以后,biber对于为声明数据模型的条目类型
- %不再默认读取,而是以空字符串作为条目类型名,自然在条目定义alias时
- %就会出现问题,因此显式的声明一下newspaper,然后保留后面采用alias的方式
- %而standard类型则是采用另一种方式直接在sourcemap中转换为其它类型。
- \@ifpackagelater{biblatex}{2019/11/30}{%2019/12/01 v3.14
- \DeclareDatamodelEntrytypes{newspaper}%
- }{}
-
-
-
-%=====================================================================
-% 设置宏包选项
-%=====================================================================
- %
- % 增加一个控制是否输出type域的选项
- % 20190212,v1,0q,hzz
- \newtoggle{bbx:gbfieldtype}
- \DeclareBibliographyOption{gbfieldtype}[false]{%biblatex低版本
- \settoggle{bbx:gbfieldtype}{#1}}
- \ExecuteBibliographyOptions{gbfieldtype}
-
- %
- % 增加一个控制是否根据页码重设脚注数字标号的选项
- % 20190422,v1,0r,hzz
- \newtoggle{bbx:gbfnperpage}
- \DeclareBibliographyOption{gbfnperpage}[false]{%
- \settoggle{bbx:gbfnperpage}{#1}}
- \ExecuteBibliographyOptions{gbfnperpage}
-
- %
- % 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表
- % 20190203,v1.0p,hzz
- % 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签
- % 当前面的脚注中已经存在当前文献,那么当前文献内容不再输出而用同(4)这样的方式
- % 需要注意的是由于小页环境和表格中的脚注本身的问题,可能会有一些问题
- \DeclareBibliographyOption{gbfootbib}[false]{%
- \ifstrequal{#1}{false}{}{\execgbfootbib}}
- \ExecuteBibliographyOptions{gbfootbib}
-
- %%
- \newlength{\footbibmargin}
- \newlength{\footbiblabelsep}
- \setlength{\footbibmargin}{1em}%脚注的段落左侧缩进距离
- \setlength{\footbiblabelsep}{0.5em}%脚注中标记号与脚注段落的间距
- \def\execgbfootbib%
- {%
- %开启引用跟踪计数器,为使用\ifciteseen等测试命令
- \ExecuteBibliographyOptions{citetracker=true}
- %
- %利用footmisc宏包来实现脚注文献的悬挂对齐
- \AtEndPreamble{
- \@ifclassloaded{beamer}{}{
- %beamer类因为其特殊性,为避免冲突不调footmisc。
- %同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接
- %如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。
- %\PassOptionsToPackage{perpage,hang}{footmisc}%
- %\RequirePackage{footmisc}%
-
- %重新实现脚注的根据单页重设脚注号码
- %重新实现脚注的悬挂对齐问题,不再使用footmisc,直接从latex核心代码和hyperref代码进行修改
- %v1.0q 20190317 hzz
- %v1.0r 20190422 hzz 根据gbfnperpage选项设置
- \iftoggle{bbx:gbfnperpage}%
- {\@addtoreset{footnote}{page}}{}%重设计数器
-
- \@ifpackageloaded{hyperref}{%加载hyperref则对\H@@footnotetext做重定义
- \long\def\H@@footnotetext##1{\insert\footins{%
- \reset at font\footnotesize
- \interlinepenalty\interfootnotelinepenalty
- \splittopskip\footnotesep
- \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
- \hsize\columnwidth \@parboxrestore
- \protected at edef\@currentlabel{%
- \csname p at footnote\endcsname\@thefnmark
- }%
- \color at begingroup
- \leftskip \footbibmargin%增加的左侧缩进
- \@makefntext{%
- \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox%
- }%
- \color at endgroup}}%
-
- \long\def\H@@mpfootnotetext##1{%
- \global\setbox\@mpfootins\vbox{%
- \unvbox\@mpfootins
- \reset at font\footnotesize
- \hsize\columnwidth
- \@parboxrestore
- \protected at edef\@currentlabel
- {\csname p at mpfootnote\endcsname\@thefnmark}%
- \leftskip \footbibmargin%增加的左侧缩进
- \color at begingroup
- \@makefntext{%
- \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}%
- \color at endgroup}}
- }{%否则对latex核心代码中的\@footnotetext做重定义
- \long\def\@footnotetext##1{\insert\footins{%
- \reset at font\footnotesize
- \interlinepenalty\interfootnotelinepenalty
- \splittopskip\footnotesep
- \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
- \hsize\columnwidth \@parboxrestore
- \protected at edef\@currentlabel{%
- \csname p at footnote\endcsname\@thefnmark
- }%
- \color at begingroup
- \leftskip \footbibmargin%增加的左侧缩进
- \@makefntext{%
- \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox%
- }%
- \color at endgroup}}%
-
- \long\def\@mpfootnotetext##1{%
- \global\setbox\@mpfootins\vbox{%
- \unvbox\@mpfootins
- \reset at font\footnotesize
- \hsize\columnwidth
- \@parboxrestore
- \protected at edef\@currentlabel
- {\csname p at mpfootnote\endcsname\@thefnmark}%
- \leftskip \footbibmargin%增加的左侧缩进
- \color at begingroup
- \@makefntext{%
- \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}%
- \color at endgroup}}
- }
-
- \long\def\@makefntext##1{%增加了脚注标记与正文的间隔
- \parindent 1em\noindent \hb at xt@ 0em{\hss \@makefnmark\makebox[\footbiblabelsep]{}}##1}
-
- }
-
- %
- %使脚注标记加圈并设置数字的字体为tiny,不使用修改thefootnote的方式
- \def\@makefnmark{\hbox{\@textsuperscript{\textcircled{\tiny\@thefnmark}}}}
- %做patch使得脚注内容中的脚注数字标签不上标
- \pretocmd{\@makefntext}{%
- \def\@makefnmark{%
- \hbox{\textcircled{\tiny\@thefnmark}}%
- }%
- }{}{}
- }
-
- %
- %判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容)
- %记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。
- %v1.0q 20190309 区分使脚注标注适应minipage中的情况
- \newbibmacro*{citesavefn}{%
- \ifciteseen%当被引用过为true
- {\ifcsdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%当已经定义过脚注序号信息
- {\csgdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{%
- \str at sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}%
- \@makefnmark%
- }}%
- {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{%
- \ifcsstring{@mpfn}{mpfootnote}{\@alph\c at mpfootnote}{\thefootnote}%
- }}%
- }%
- {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{%
- \ifcsstring{@mpfn}{mpfootnote}{\@alph\c at mpfootnote}{\thefootnote}%
- %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断
- }}%
- }
-
- %
- %重定义\footfullcite使完成gb7714-2015的脚注文献要求
- \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]%
- {\defcounter{maxnames}{\blx at maxbibnames}%局部定义maxnames和minnames计数器
- \defcounter{minnames}{\blx at minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。
- \usebibmacro{prenote}%
- \renewbibmacro*{postnote}{%
- \iffieldundef{postnote}%
- {}{\setunit{\addcolon\addspace}\printtext{\thefield{postnote}}}}%由于ay样式中没有修改postnote域,此处因为格式需要不使用默认域格式
- }%
- {\usebibmacro{citesavefn}%
- \ifcsdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%
- {\csuse{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}%\nopunct
- {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}%
- }%
- {\multicitedelim}%
- {\usebibmacro{postnote}}
-
- }
-
- %
- % 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式
- % 20180814,v1.0m,hzz
- % 原理方法:
- % 只为兼容性考虑不做任何处理
- \DeclareBibliographyOption{gbstyle}[true]{%biblatex低版本
- }
-
- %
- % 增加一个控制是否输出文献类型和载体标识的选项
- %
- % 原理方法:
- % 对于biblatex3.4以上版本DeclareBibliographyOption命令中的[datatype]如果是boolean,那么是可以省略的
- % 所以用老版本的不用[datatype]的命令可以兼容所有biblatex版本
- \newtoggle{bbx:gbtype}
- %\DeclareBibliographyOption[boolean]{gbtype}[true]{%biblatex高版本
- \DeclareBibliographyOption{gbtype}[true]{%biblatex低版本
- \settoggle{bbx:gbtype}{#1}}
- \ExecuteBibliographyOptions{gbtype}
-
- %
- % 增加一个源文件编码选择选项,当true时可以使用GBK编码。
- % v1.0k, 2018.05.08, by hzz
- %
- % 原理方法:将需要输出的中文字符串用命令形式表示存储,采用utf8编码时采用bbx文档
- % 内的定义即是utf8编码的中文字符串,但tex源文件是gbk编码时,利用gb7714-2015-gbk.def
- % 文档内的gbk编码的字符串覆盖。这种覆盖只能在宏包末尾加载时成功实现,所以使用
- % AtEndOfPackage。该解决思路源自biblatex-caspervector宏包。
- % 另外注意:
- % gbk编码的tex文档,利用pdflatex/latex能正确编译,利用xelatex能编译,但中文显示乱码
- % 在源文档前面增加 XeTeX 原语:\XeTeXinputencoding "GBK" 后,显示正常
- % utf-8编码的tex文档,利用xelatex能正确编译,而pdflatex/latex不能编译。
- \newtoggle{bbx:codegbk}
- \DeclareBibliographyOption{gbcodegbk}[false]{%
- \settoggle{bbx:codegbk}{#1}}
- \ExecuteBibliographyOptions{gbcodegbk}
-
- \def\str at bibliography{参考文献}
- \def\str at references{参考文献}
- \def\str at bytranslator{译}
- \def\str at andotherscn{等}
- \def\str at backrefpage{引用页}
- \def\str at backrefpages{引用页}
- \def\str at noaddress{出版地不详}
- \def\str at nopublisher{出版者不详}
- \def\str at edition{版}
- \def\str at volumecn{卷}
- \def\str at numbercn{册}
- \def\str at serialcn{第}
- \def\str at sameentry{同}
- \def\str at incn{见}
- \def\str at mathesiscn{硕士学位论文}
- \def\str at phdthesiscn{博士学位论文}
- \def\str at editorcn{主编}
-
- \AtEndOfPackage{%
- \iftoggle{bbx:codegbk}{%
- \ExecuteBibliographyOptions{texencoding = GBK}
- \input{gb7714-2015-gbk.def}
- }{}}
-
- %
- % 增加一个严格按GB/T 7714-2015给出著录格式控制域的输出的选项
- % v1.0k, 2018.05.08, by hzz
- %
- % 原理方法:
- % 默认设置该选项为真,进而不输出GB/T 7714-2015中没有的域的信息
- % 这样可以避免因为bib文件带有多余的域的信息的输出,比如因为bibtex样式
- % 可能需要用于中英文判断的language域的信息。
- \newtoggle{bbx:gbstrict}
- \DeclareBibliographyOption{gbstrict}[true]{%
- \settoggle{bbx:gbstrict}{#1}}
- \ExecuteBibliographyOptions{gbstrict}
-
- %
- % 增加一个控制标题域超链接设置的选项
- % v1.0k, 2018.05.24, by hzz
- %
- % 原理方法:
- % 利用标题域格式来实现,默认设置该选项为false,不做超链接。
- % 设置为true,则标题设置超链接
- \newtoggle{bbx:titlelink}
- \DeclareBibliographyOption{gbtitlelink}[false]{%
- \settoggle{bbx:titlelink}{#1}}
- \ExecuteBibliographyOptions{gbtitlelink}
-
- %
- % 增加一个控制参考文献标题是否能够被ctex宏包设置的选项
- % v1.0l, 2018.07.02, by hzz
- %
- % 原理方法:
- % 重定义biblatex的宏,去除使用本地化字符串的方式,是的可以利用ctexset进行设置
- \newtoggle{bbx:ctexset}
- \DeclareBibliographyOption{gbctexset}[true]{%
- \settoggle{bbx:ctexset}{#1}}
- \ExecuteBibliographyOptions{gbctexset}
-
- \AtEndOfPackage{%
- \iftoggle{bbx:ctexset}{%
- \def\blx at defbibstrings#1#2{%
- \def\do##1{\csundef{abx at lstr@##1}\csundef{abx at sstr@##1}}%
- \abx at dostrings
- \csuse{abx at strings@#1}%
- \setkeys{blx at lbx}{#2}%
- \let\do\blx at defbibstrings@i
- \csxdef{abx at strings@#1}{\abx at dostrings}%
- }
- }{}}
-
-
-
- %
- % 增加一个恢复域格式为标准样式的控制选项
- % v1.0k, 2018.05.15, by hzz
- %
- % 原理方法:
- % 默认设置该选项为false,采用国标要求的域格式输出相关域
- % 当设置该选项为true时,则重新利用标准样式的域格式输出相关的域
- \newtoggle{bbx:gbfieldstd}
- \DeclareBibliographyOption{gbfieldstd}[false]{%
- \settoggle{bbx:gbfieldstd}{#1}%
- \ifstrequal{#1}{false}{}{\execgbfdfmtstd}%
- }
- \ExecuteBibliographyOptions{gbfieldstd}
-
- %
- % 增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。
- %
- \newtoggle{bbx:gbpub}
- \DeclareBibliographyOption{gbpub}[true]{%
- %\settoggle{bbx:gbpub}{#1} %或采用下面这一句
- \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}}
- \ExecuteBibliographyOptions{gbpub}
-
- %
- % 增加控制析出文献来源前的标点符号//输出的选项
- % v1.0k, 2018.04.20,added in by hzz
- \newtoggle{bbx:gbpunctin}
- \DeclareBibliographyOption{gbpunctin}[true]{%
- \settoggle{bbx:gbpunctin}{#1}}
- \ExecuteBibliographyOptions{gbpunctin}
-
-
- %
- % 增加一个处理佚名或noauthor的控制选项
- %
- % 原理方法:顺序编码制中与作者年制都使用
- \DeclareBibliographyOption{gbnoauthor}[true]{%
- \ifstrequal{#1}{false}{}{\dealnoathor}}
- %\ExecuteBibliographyOptions{gbnoauthor=true}%对于需要展开较早(展开层级优先)的选项,这一执行无效,只能用宏包加载时给出的选项。
-
-
-
-
- %
- % 选项设置
- %
- \ExecuteBibliographyOptions{
- sorting=none,
- useprefix=true, %名字的信息包括前缀
- date = year, %日期仅写到年
- maxbibnames = 3,%设置名字最大数量
- minbibnames = 3, %设置缩减后的名字最小数量
- maxitems = 1,%设置列表最大数量
- minitems = 1, %设置缩减后的列表最小数量
- isbn=false,
- sortlocale=zh__pinyin,%zh__big5han,%zh__stroke,%zh__gb2312han,%zh__pinyin,
- }
-
- %
- %为日期相关选项增加选项值gb7714-2015
- %
- \csdef{mkdaterangegb7714-2015}#1{%
- \begingroup
- \blx at metadateinfo{#1}%
- \iffieldundef{#1year}
- {}
- {\printtext[#1date]{%
- \blx at gbdate{#1}{}}}%
- \endgroup}
-
- \newrobustcmd*{\blx at gbdate}[3][]{%
- \dateeraprintpre{#2#3year}%
- \blx at imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}%
- \iffieldundef{#2#3month}{}{\hyphen\blx at imc@forcezerosmdt{\thefield{#2#3month}}}%
- \iffieldundef{#2#3day}{}{\hyphen\blx at imc@forcezerosmdt{\thefield{#2#3day}}}}
-
-
- %为姓名格式选择增加的计数器
- \newcounter{gbnamefmtcase}
- \def\thegbnamefmtcase{\the\c at gbnamefmtcase}
- %为数字标签格式选择增加的计数器/命令
- \newcommand{\mkgbnumlabel}[1]{\mkbibbrackets{#1}}
- \def\gbbiblabelopt at bracket{\renewcommand{\mkgbnumlabel}[1]{\mkbibbrackets{##1}}}
- \def\gbbiblabelopt at parens{\renewcommand{\mkgbnumlabel}[1]{\mkbibparens{##1}}}
- \def\gbbiblabelopt at dot{\renewcommand{\mkgbnumlabel}[1]{##1\adddot}}
- \def\gbbiblabelopt at plain{\renewcommand{\mkgbnumlabel}[1]{##1}}
- \def\gbbiblabelopt at box{\renewcommand{\mkgbnumlabel}[1]{\framebox{##1}}}
- \def\gbbiblabelopt at circle{\renewcommand{\mkgbnumlabel}[1]{\textcircled{##1}}}
- %为文献表中数字标签对齐方式选择增加的计数器/命令
- \newcounter{gbalignlabel}
- \def\thegbalignlabel{\the\c at gbalignlabel}
- %为引用标签标注/文献表中本地化字符串中英文选择增加的计数器/命令
- \newcounter{gbcitelocalcase}
- \newcounter{gbbiblocalcase}
- \def\thegbcitelocalcase{\the\c at gbcitelocalcase}
- \def\thegbbiblocalcase{\the\c at gbbiblocalcase}
-
-
- %
- % 增加不同语言排序的切换选项,numeric样式,不使用该选项
- % gblanorder=chineseahead的顺序为cn,jp,kr,en,fr,ru
- % gblanorder=englishahead的顺序为en,fr,ru,cn,jp,kr
- % gblanorder=cn;en;ru;fr;jp;kr的顺序为指定的cn;en;ru;fr;jp;kr,自定义内容可以随意写以分号分隔
- % v1.0q,20190307,hzz
- %
- \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{%
- \ifstrequal{#1}{chineseahead}%%中文在前的顺序
- {\gdef\lancnorder{1}\gdef\lanjporder{2}\gdef\lankrorder{3}%
- \gdef\lanenorder{4}\gdef\lanfrorder{5}\gdef\lanruorder{6}}%
- {%
- \ifstrequal{#1}{englishahead}%
- {\execlanodeah\dealsortlan}%
- {\execlanodudf{#1}\dealsortlan}%
- }%
- }
- \ExecuteBibliographyOptions{gblanorder}
-
- \def\execlanodeah{%中文在后的顺序
- \gdef\lancnorder{4}
- \gdef\lanjporder{5}
- \gdef\lankrorder{6}
- \gdef\lanenorder{1}
- \gdef\lanfrorder{2}
- \gdef\lanruorder{3}}
-
- \newcounter{lanordernum}
- \newcommand{\execlanodudf}[1]{%like:cn;en;ru;fr;jp;kr
- \setcounter{lanordernum}{0}
- \DeclareListParser{\parsinglanorder}{;}
- \renewcommand*{\do}[1]{\stepcounter{lanordernum}\csxdef{lan##1order}{\thelanordernum}}
- \parsinglanorder{#1}
- }
-
- %
- % 增加本地化字符串的中英文切换选项
- % gbcitelocal指标注中的本地化字符串
- % gbbiblocal 指文献表中的本地化字符串
- % gblocal 指设置文献表和标注中的本地化字符串
- % v1.0o,20190103,hzz
- %
- \DeclareBibliographyOption[string]{gbcitelocal}[gb7714-2015]{%
- \ifstrequal{#1}{gb7714-2015}{\setcounter{gbcitelocalcase}{0}}{}%
- \ifstrequal{#1}{chinese}{\setcounter{gbcitelocalcase}{1}}{}%
- \ifstrequal{#1}{english}{\setcounter{gbcitelocalcase}{2}}{}%
- }
- \ExecuteBibliographyOptions{gbcitelocal}
-
- \DeclareBibliographyOption[string]{gbbiblocal}[gb7714-2015]{%
- \ifstrequal{#1}{gb7714-2015}{\setcounter{gbbiblocalcase}{0}}{}%
- \ifstrequal{#1}{chinese}{\setcounter{gbbiblocalcase}{1}}{}%
- \ifstrequal{#1}{english}{\setcounter{gbbiblocalcase}{2}}{}%
- }
- \ExecuteBibliographyOptions{gbbiblocal}
-
- \DeclareBibliographyOption[string]{gblocal}[gb7714-2015]{%
- \ExecuteBibliographyOptions{gbbiblocal=#1}%
- \ExecuteBibliographyOptions{gbcitelocal=#1}%
- }
- %\ExecuteBibliographyOptions{gblocal} %默认值已经通过两个相关选项设置
-
- %
- % 增加序号标签格式处理选项
- % v1.0l,20180623,hzz
- %
- \DeclareBibliographyOption[string]{gbbiblabel}[bracket]{%
- \csuse{gbbiblabelopt@#1}
- }
- \ExecuteBibliographyOptions{gbbiblabel}
-
- %
- % 增加姓名大小写格式处理选项
- %
- \DeclareBibliographyOption[string]{gbnamefmt}[uppercase]{%
- \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}%
- \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}%
- \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family
- \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{}
- \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given
- \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family
- }
- \ExecuteBibliographyOptions{gbnamefmt}
-
- %
- % 增加标签对齐选项
- %
- % right是默认的右对齐,left是左对齐,gb7714-2015是项对齐方式
- \DeclareBibliographyOption[string]{gbalign}[right]{%
- \ifstrequal{#1}{right}{\setcounter{gbalignlabel}{0}}{}
- \ifstrequal{#1}{left}{\setcounter{gbalignlabel}{1}}{}
- \ifstrequal{#1}{center}{\setcounter{gbalignlabel}{2}}{}
- \ifstrequal{#1}{gb7714-2015}{\setaligngbstyle}{}
- }
-
- \ExecuteBibliographyOptions{
- giveninits=true,
- urldate =gb7714-2015, %iso,iso8601,edtf
- eventdate =gb7714-2015,
- labeldateparts=true,
- }
-
-%
-% 针对3.13<=biblatex版本的选项设置,因为内容有限,所以不做版本区分,而用时间直接判断
-%
-% 解决国标中“王临慧, 2010a.”和“王临慧, 等, 2010b.”的问题
-% 在没有这个选项之前无法加上a和b
-% v1.0s,20190828
-\@ifpackagelater{biblatex}{2019/08/16}{%
- \ExecuteBibliographyOptions{%
- nohashothers=true}}{}
-
-%=====================================================================
-% 设置本地化字符串
-%=====================================================================
- %
- % 新建当地化字符串,用来记录“等”字符、“和”字符
- %
- \NewBibliographyString{andotherscn}
- \NewBibliographyString{andothersincitecn}
- \NewBibliographyString{andothersincite}
- \NewBibliographyString{andcn}
- \NewBibliographyString{andothersjp}
- \NewBibliographyString{andotherskr}
- \NewBibliographyString{andjp}
- \NewBibliographyString{andkr}
- \NewBibliographyString{andincitecn}
- \NewBibliographyString{andincite}
- \NewBibliographyString{volumecn}
- \NewBibliographyString{numbercn}
- \NewBibliographyString{serialcn}
- \NewBibliographyString{incn}
- \NewBibliographyString{mathesiscn}
- \NewBibliographyString{phdthesiscn}
- \NewBibliographyString{editorcn}
- \NewBibliographyString{editorscn}
-
-
-
- %
- % 修改一些当地化字符串
- %
- % 原理方法:直接利用当地化格式english修改出一些中文的格式,具体修改内容参考english.lbx文件
- % 当然也可以增加比如上面定义的andotherscn
- % 注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别
-
- \DefineBibliographyStrings{english}{
- bibliography = {\str at bibliography},
- references = {\str at references},
- bytranslator= {\str at bytranslator},%\addperiod,%将trans. by 改成 译\addcomma\
- and = {\addcomma},%将第2和3人名间的and符号改成逗号,用\finalnamedelim命令也可以定义,参见3.9.1节
- andcn = {\addcomma},%and本地化字符串的中文对应词
- andincitecn = {\addcomma},%将标注中的分开,便于与文献表中的区分
- andincite = {\addcomma},
- %andothers = {et al.},%将超过3个人名的省略,et al.改成为 等
- andotherscn = {\str at andotherscn},%将超过3个人名的省略,et al.改成为 等
- andothersincitecn={\str at andotherscn},%将标注中的分开,便于与文献表中的区分
- andothersincite={et al\adddot},
- backrefpage = {\str at backrefpage:},
- backrefpages = {\str at backrefpages:},
- in={in\intitlepunct},
- volumecn={\str at volumecn},
- numbercn={\str at numbercn},
- serialcn={\str at serialcn},
- andothersjp={他},
- andotherskr={외},
- andjp={和},
- andkr={和},
- incn={\str at incn\addcolon\addspace},
- mathesiscn={\str at mathesiscn},
- phdthesiscn={\str at phdthesiscn},
- editorscn={\str at editorcn},
- editorcn={\str at editorcn},
-}
-
- %
- % 增加两个命令用于临时的局部的修改本地化字符串
- % 其中\setlocalbibstring修改缩写字符串,setlocalbiblstring修改长字符串
- % 注意使用时因为是局部修改,因此要将其与需要修改的引用命令放在一个编组符号内
- % v1.0t,hzz,20190525
- \newcommand{\setlocalbibstring}[2]{%
- \csdef{abx at sstr@#1}{#2}}
- \newcommand{\setlocalbiblstring}[2]{%
- \csdef{abx at lstr@#1}{#2}}
-
-%=====================================================================
-% 动态数据修改
-%=====================================================================
-%
-% 各层次的数据映射和动态修改
-%
-% 原理方法:
-% 1. 进行语言包括中英文判断,并设置和记录,比如记录到userf,usere中
-% 2. 增加文献标识符如[M],[J]等,对一些容易混淆的域进行设置以增强兼容性
-% 3. \DeclareSourcemap命令对于biblatex3.11以下版本只能出现一次,3.11版开始支持多个
-% 4. \DeclarestyleSourcemap在biblatex v3.7版开始可以支持出现多次
-% 5. 把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。
-% 注意:这里用userf,usere而不是namee,namef,是因为只有把name列表转成域,才能有效读取姓名中的字符,
-% 如果用namee,namef,name信息会自动解析,所以就不能为cjk判断提供需要的信息
-%
-% 不同的文献类型使用相同的驱动输出可以有5种方法:
-% 1. 是数据源层的映射,将其它类型转换为某一要使用驱动的类型
-% 2. 是样式层映射,也是将其它类型转换为某一要使用驱动的类型
-% 3. 是驱动层映射,也是将其它类型转换为某一要使用驱动的类型
-% 4. 定义驱动类型别名DeclareBibliographyAlias,将其它类型定义为某一要使用驱动的类型的别名
-% 驱动别名定义本质上是做了驱动层映射
-% 5. 直接定义不同的类型的驱动,但驱动内容相同。
-%
-% 关于数据映射和驱动使用的考虑如下:
-% 1. 为避免利用biber输出bib文件时的数据变动,尽量不在数据源层映射做类型转换
-% 2. 为减少代码量,尽量少做内容相同的不同类型驱动
-% 3. 因此类型相关的处理主要在样式层映射、驱动层映射、驱动别名
-% 4. 由于biblatex默认做的驱动别名处理可能增加一些信息比如masterthesis转thesis时增加的type
-% 可以在样式层映射做某些需要避免这种默认处置的转换
-% 5. 当没有避免默认行为的需求时,全部采用驱动别名的方式处理,等价于驱动层的映射
-%
-% 文献类型和驱动考虑如下:
-% 1. 连续出版物及析出文献有其特殊性,因此考虑两类periodical和article
-% newpaper映射为article,并以note域做区分特殊处理
-% 2. 专著和专著中的析出文献是主要的类型,因此考虑book和inbook
-% standard映射为book或inbook,并以note域做区分特殊处理
-% collection和proceedings基本与book类似,因此做book驱动别名处理
-% incollection和inproceedings基本与inbook类似,因此做inbook驱动别名处理
-% 3. 专利类型有其特殊性,考虑patent类型
-% 4. 电子资源类型有其特殊性,考虑online类型
-% 5. 报告类型与book有点类似,出版项处理与book一样,但有时又要有修改和更新日期
-% 因此考虑用一种类型来输出,使用report类型
-% 6. 手册/学位论文等类型与book有点类似,但对于出版项处理时,有缺省时,直接省略,
-% 同时有version和edition的区别,因此考虑用一种类型来输出,使用manual类型
-% 7. 包括报告,学位论文在内的其它所有的类型,都做一个判断,当没有出版项时,
-% 且存在网址信息时,将其转换为online类型输出,否则都做为manual类型输出。
-% 8. 备选类型misc当存在网址时直接转换为online,由于howpublished域可用于描述
-% 更多的信息,因此不存在网址时,独立做一个备选格式
-% 9. 出版项主要以如下方式处理:
-% (a) location+institution+date 仅用于连续出版物
-% (b)publisher+location+date 用于需要完整输出出版项的类型,比如book,collection,proceedings,in*,report
-% (c)institution+location+date 用于出版项缺失时不输出的类型,包括manual,thesis,archive等其他类型
-% (d)printlist{insitution} 用于电子资源,仅输出出版者或组织,为数据映射方便,本来默认的organization域转换为用insitution输出。
-% (e) 不输出,主要用于连续出版物析出的文献
-% 10. 日期以如下方式处理:
-% date 由于存在biblatex选项,因此通过选项控制,数据源为date解析数据或year
-% urldate 由于存在biblatex选项,因此通过选项控制,输出到日,且用[]包围,数据源为urldate
-% newsdate 用于公告日期,公开日期或新闻日期,输出到日,但无包围符号,数据源为date
-% modifydate 用于更新或修改日期,输出到日,且用()包围,数据源为date或enddate或eventdate
-
-
-\DeclareSourcemap{
-\maps[datatype=bibtex]{%
- \map{%当没有作者时将editor转成author
- \pernottype{inbook}%因为in系列中editor可能用来表示bookauthor,所以排除
- \pernottype{inproceedings}
- \pernottype{incollection}
- \pernottype{periodical}%因为peridical直接使用editor,所以排除
- %注意notfield在低版本biblatex中没有
- %\step[notfield=author,final]%当author不存在,将editor复制给author
- \step[fieldsource=editor,fieldtarget=author]%并删除editor
- }
- \map{%当没有作者时将translator转成author
- \pernottype{inbook}
- \pernottype{inproceedings}
- \pernottype{incollection}
- %\step[notfield=author,final]%当author不存在,将translator复制给author
- \step[fieldsource=translator,fieldtarget=author]%并删除translator
- }
- \map{%让address和location同步,biblatex中address是location的别名
- %因此输出的时候只有location信息,但处理过程中是可以存在address的。
- %\step[notfield=address,final]
- \step[fieldsource=location,final]
- \step[fieldset=address,origfieldval]
- }
- \map{%让address和location同步
- %\step[notfield=location,final]
- \step[fieldsource=address,final]
- \step[fieldset=location,origfieldval]
- }
- \map{%处理在bib文件用mark标记文献类型标识符的情况
- \step[fieldsource=mark,final]
- \step[fieldset=usera, origfieldval]
- }
- \map{%处理在bib文件中直接给出文献的姓名格式为lowercase的情况
- \step[fieldsource=nameformat,match=lowercase,final]
- \step[fieldset=namefmtid,fieldvalue={1}]
- }
- \map{%处理在bib文件中直接给出文献的姓名格式为givenahead的情况
- \step[fieldsource=nameformat,match=givenahead,final]
- \step[fieldset=namefmtid,fieldvalue={2}]
- }
- \map{%处理在bib文件中直接给出文献的姓名格式为familyahead的情况
- \step[fieldsource=nameformat,match=familyahead,final]
- \step[fieldset=namefmtid,fieldvalue={3}]
- }
- \map{%处理在bib文件中直接给出文献的姓名格式为pinyin的情况
- \step[fieldsource=nameformat,match=pinyin,final]
- \step[fieldset=namefmtid,fieldvalue={4}]
- }
- \map{%根据article确定文献类型标识符
- \pertype{article}
- \step[fieldset=usera, fieldvalue={J}]
- }
- \map{%根据periodical确定文献类型标识符
- \pertype{periodical}
- \step[fieldset=usera, fieldvalue={J}]
- \step[fieldsource=author] %有时会把author和editor混淆,处理后使用editor
- \step[fieldset=editor, origfieldval]
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{%根据增加一个新闻报纸的类型newspaper确定文献类型标识符
- \pertype{newspaper}
- \step[fieldset=usera, fieldvalue={N}]
- \step[fieldset=note, fieldvalue=news]%因为没有专门的驱动,记录note方便映射为article后判断
- }
- \map{%对应增加的一个数据库类型database确定文献类型标识符
- \pertype{database}
- \step[fieldset=usera, fieldvalue={DB}]
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{%对应增加的一个数据集类型dataset确定文献类型标识符
- \pertype{dataset}
- \step[fieldset=usera, fieldvalue={DS}]%
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{%对应增加的一个软件类型software确定文献类型标识符
- \pertype{software}
- \step[fieldset=usera, fieldvalue={CP}]
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{%对应增加的一个舆图类型map确定文献类型标识符
- \pertype{map}
- \step[fieldset=usera, fieldvalue={CM}]%
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{%对应增加的一个档案类型archive确定文献类型标识符
- \pertype{archive}
- \step[fieldset=usera, fieldvalue={A}]
- \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{%因为misc类型本身就是没有类型,而不像其它文献有明确的类型,所以
- %当misc类型带有网址时,直接将其转换为online类型
- \pertype{misc}
- \step[fieldsource=url,final]
- \step[typesource=misc,typetarget=online]
- }
- \map{%对应增加的一个备选类型misc确定文献类型标识符
- \pertype{misc}
- \step[fieldset=usera, fieldvalue={Z}]%
- }
- \map{
- \pertype{book}
- \pertype{inbook}
- \step[fieldset=usera, fieldvalue={M}]
- \step[fieldsource=version] %有时会把version和edition混淆,处理后直接用edition
- \step[fieldset=edition, origfieldval]
- }
- \map{%兼容老的standard类型,确定文献类型标识符
- \pertype{standard}
- \step[fieldset=usera, fieldvalue={S}]
- \step[fieldset=note, fieldvalue=standard]%因为没有专门的驱动,记录note方便映射为book和inbook后判断
- }
- \map{
- \pertype{patent}
- \step[fieldset=usera, fieldvalue={P}]
- }
- \map{
- \pertype{inproceedings}
- \pertype{conference}%兼容老的conference类型
- \step[fieldset=usera, fieldvalue={C}]
- \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
- \step[fieldset=publisher, origfieldval]
- }
- \map{
- \pertype{proceedings}
- \step[fieldset=usera, fieldvalue={C}]
- \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
- \step[fieldset=publisher, origfieldval]
- }
- \map{
- \pertype{incollection}
- \step[fieldset=usera, fieldvalue={G}]
- \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
- \step[fieldset=publisher, origfieldval]
- }
- \map{
- \pertype{collection}
- \step[fieldset=usera, fieldvalue={G}]
- \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
- \step[fieldset=publisher, origfieldval]
- }
- \map{
- \pertype{report}
- \pertype{techreport}%兼容老的techreport类型
- \step[fieldset=usera, fieldvalue={R}]
- \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
- \step[fieldset=publisher, origfieldval]
- }
- \map{
- \pertype{thesis}
- \pertype{mastersthesis}%兼容老的mastersthesis和phdthesis类型
- \pertype{phdthesis}
- \step[fieldset=usera, fieldvalue={D}]
- \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- }
- \map{
- \pertype{online}
- \pertype{electronic}%兼容老的electronic类型
- \pertype{www}%兼容老的www类型
- \step[fieldset=usera, fieldvalue={EB}]
- \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]%因为online的出版项处理类似手册
- \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性
- \step[fieldset=institution, origfieldval]
- }
- \map{
- \pertype{manual}
- \step[fieldset=usera, fieldvalue={A}]
- \step[fieldsource=edition]%有时会把version和edition混淆,处理后使用version
- \step[fieldset=version, origfieldval]
- \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
- \step[fieldset=institution, origfieldval]
- \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性
- \step[fieldset=institution, origfieldval]
- }
- \map{
- \pertype{unpublished}
- \step[fieldset=usera, fieldvalue={Z}]
- }
- \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
- \step[fieldsource={author}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
- }%
- \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
- \step[fieldsource={editor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
- }%
- \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
- \step[fieldsource={translator}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
- }%
- \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
- \step[fieldsource={bookauthor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
- }%
- \map{%处理一些用year表示date的情况
- %这样处理将会设置date域,并使得labeldatesource变为空,因为date的前缀为空(如果是urldate,那么labeldatesource就是url)。
- %同时date域会被biblatex自动解析为year,month,day,并且覆盖原来的year信息
- \step[fieldsource=year]
- \step[fieldset=date, origfieldval]
- }
- \map{%将entrykey放入keywords中用于后期使用
- \step[fieldsource=entrykey]
- \step[fieldset=keywords, origfieldval]
- }
- \map{\step[fieldsource=title,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
- \step[fieldset=userd,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
- }
- \map{%
- \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final]
- \step[fieldset=userd,fieldvalue={russian}]%俄语
- }
- \map{%
- \step[fieldsource=title,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
- \step[fieldset=userd,fieldvalue={japanese}]%日语
- } %确定形式后可增加类似andotherscn这样的本地化字符串处理
- \map{%
- \step[fieldsource=title,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
- \step[fieldset=userd,fieldvalue={korean}]%韩语
- }
- \map{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题
- \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%
- \step[fieldset=userd, fieldvalue={chinese}]
- }
- \map{%将没有设置userd,且存在title域的默认设置为英文
- \step[fieldsource=title,final]
- \step[fieldset=userd,fieldvalue={english}]
- }
- \map{\step[fieldsource=author,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
- \step[fieldset=userf,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
- }
- \map{%
- \step[fieldsource=author,match=\regexp{[\x{0400}-\x{052F}]},final]
- \step[fieldset=userf,fieldvalue={russian}]%俄语
- }
- \map{%
- \step[fieldsource=author,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
- \step[fieldset=userf,fieldvalue={japanese}]%日语
- } %确定形式后可增加类似andotherscn这样的本地化字符串处理
- \map{%
- \step[fieldsource=author,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
- \step[fieldset=userf,fieldvalue={korean}]%韩语
- }
- \map{%作者的中文判断
- \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
- \step[fieldset=userf, fieldvalue={chinese}]
- }
- \map{%将没有设置userf,且存在author域的默认设置为英文
- \step[fieldsource=author,final]
- \step[fieldset=userf,fieldvalue={english}]
- }
- \map{\step[fieldsource=translator,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
- \step[fieldset=usere,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
- }
- \map{%
- \step[fieldsource=translator,match=\regexp{[\x{0400}-\x{052F}]},final]
- \step[fieldset=usere,fieldvalue={russian}]%俄语
- }
- \map{%
- \step[fieldsource=translator,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
- \step[fieldset=usere,fieldvalue={japanese}]%日语
- } %确定形式后可增加类似andotherscn这样的本地化字符串处理
- \map{%
- \step[fieldsource=translator,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
- \step[fieldset=usere,fieldvalue={korean}]%韩语
- }
- \map{%译者的中文判断
- \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
- \step[fieldset=usere, fieldvalue={chinese}]
- }
- \map{%将没有设置usere,且存在translator域的默认设置为英文
- \step[fieldsource=translator,final]
- \step[fieldset=usere,fieldvalue={english}]
- }
- \map{\step[fieldsource=editor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
- \step[fieldset=userc,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
- }
- \map{%
- \step[fieldsource=editor,match=\regexp{[\x{0400}-\x{052F}]},final]
- \step[fieldset=userc,fieldvalue={russian}]%俄语
- }
- \map{%
- \step[fieldsource=editor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
- \step[fieldset=userc,fieldvalue={japanese}]%日语
- } %确定形式后可增加类似andotherscn这样的本地化字符串处理
- \map{%
- \step[fieldsource=editor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
- \step[fieldset=userc,fieldvalue={korean}]%韩语
- }
- \map{%编者的中文判断
- \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5
- \step[fieldset=userc, fieldvalue={chinese}]
- }
- \map{%将没有设置userc,且存在editor域的默认设置为英文
- \step[fieldsource=editor,final]
- \step[fieldset=userc,fieldvalue={english}]
- }
- \map{\step[fieldsource=bookauthor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
- \step[fieldset=userb,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
- }
- \map{%
- \step[fieldsource=bookauthor,match=\regexp{[\x{0400}-\x{052F}]},final]
- \step[fieldset=userb,fieldvalue={russian}]%俄语
- }
- \map{%
- \step[fieldsource=bookauthor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
- \step[fieldset=userb,fieldvalue={japanese}]%日语
- } %确定形式后可增加类似andotherscn这样的本地化字符串处理
- \map{%
- \step[fieldsource=bookauthor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
- \step[fieldset=userb,fieldvalue={korean}]%韩语
- }
- \map{%编者的中文判断
- \step[fieldsource=bookauthor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5
- \step[fieldset=userb, fieldvalue={chinese}]
- }
- \map{%将没有设置userc,且存在editor域的默认设置为英文
- \step[fieldsource=bookauthor,final]
- \step[fieldset=userb,fieldvalue={english}]
- }
- \map{\step[fieldsource=userd,final]%userd存在则用根据标题的语言设定language
- \step[fieldset=language,origfieldval]%本身language存在则不设定
- }
- \map{\step[fieldsource=userf,final]%userd不存在,而userf存在则根据author的语言设定language
- \step[fieldset=language,origfieldval]
- }%如果没有作者和标题,那么剩下的最可能有意义的只有网址了,而网址通常是英文的,因此不用再进一步对其它域进行判断了。
- \map{%将没有设置的language设置成en,即认为不是中文的就是英文的。
- \step[fieldset=language,fieldvalue={english}]
- }
- \map{%一条文献的语言已经设定在language域中,由于出版项相关宏中使用userd判断,
- %所以将一条文献的主体语言设定到userd中,本身前面userd已经设定,但没有处理无标题的情况,
- %这里的处理等价于没有标题时,利用作者的语言设定userd,再没有作者,则默认用英文设定userd
- \step[fieldsource=language]
- \step[fieldset=userd,origfieldval]
- }
- \map{%当文献给出language域时,设置文献要使用的本地化字符串的语言
- %biblatex 3.11及以下版本仅有match是区分大小写的,而3.12版开始用matchi来区分大小,而match不区分
- %这里为兼容3.11及以下版本,所以用一个复杂一点的正则表达式
- \step[fieldsource=language,match=\regexp{(e|E)(n|N)(g|G)(l|L)(i|I)(s|S)(h|H)},final]
- \step[fieldset=langid,fieldvalue={english}]
- \step[fieldset=lansortorder,fieldvalue=\lanenorder]
- }
- \map{
- \step[fieldsource=language,match=\regexp{(r|R)(u|U)(s|S)(s|S)(i|I)(a|A)(n|N)},final]
- \step[fieldset=langid,fieldvalue={russian}]
- \step[fieldset=lansortorder,fieldvalue=\lanruorder]
- }
- \map{%
- \step[fieldsource=language,match=\regexp{(f|F)(r|R)(e|E)(n|N)(c|C)(h|H)},final]
- \step[fieldset=langid,fieldvalue={french}]
- \step[fieldset=lansortorder,fieldvalue=\lanfrorder]
- }
- \map{%
- \step[fieldsource=language,match=\regexp{(c|C)(h|H)(i|I)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english,
- \step[fieldset=langid,fieldvalue={english}]
- \step[fieldset=lansortorder,fieldvalue=\lancnorder]
- }
- \map{%
- \step[fieldsource=language,match=\regexp{(j|J)(a|A)(p|P)(a|A)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english,
- \step[fieldset=langid,fieldvalue={english}]
- \step[fieldset=lansortorder,fieldvalue=\lanjporder]
- }
- \map{%
- \step[fieldsource=language,match=\regexp{(k|K)(o|O)(r|R)(e|E)(a|A)(n|N)},final]%中日韩语目前都用english,
- \step[fieldset=langid,fieldvalue={english}]
- \step[fieldset=lansortorder,fieldvalue=\lankrorder]
- }
-}
-}
-
-
-%
-% 修改输入的参考文献数据,样式层的操作
-%
- \DeclareStyleSourcemap{
- \maps[datatype=bibtex]{
- \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook,
- %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义
- %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断
- \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook
- \step[typesource=standard, typetarget=inbook, final]
- }
- \map{%剩下的全部映射为book
- \step[typesource=standard, typetarget=book, final]
- }
-% \map{%先于标准样式的driver层映射,以取消type设置
-% \step[typesource=mastersthesis, typetarget=thesis, final]
-% %\step[fieldset=type, fieldvalue=mathesis]
-% }
-% \map{%先于标准样式的driver层映射,以取消type设置
-% \step[typesource=phdthesis, typetarget=thesis, final]
-% %\step[fieldset=type, fieldvalue=phdthesis]
-% }
- \map{%先于标准样式的driver层映射,以取消type设置
- \step[typesource=techreport, typetarget=report, final]
- %\step[fieldset=type, fieldvalue=techreport]
- }
- \map{%
- \pertype{report}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=report,typetarget=online]
- \step[fieldset=note,fieldvalue={report}]
- }
- \map{%
- \pertype{thesis}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=thesis,typetarget=online]
- }
- \map{%
- \pertype{manual}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=manual,typetarget=online]
- }
- \map{%
- \pertype{unpublished}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=unpublished,typetarget=online]
- }
- \map{%
- \pertype{database}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=databasetypetarget=online]
- }
- \map{%
- \pertype{dataset}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=dataset,typetarget=online]
- }
- \map{%
- \pertype{software}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=software,typetarget=online]
- }
- \map{%
- \pertype{map}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=map,typetarget=online]
- }
- \map{%
- \pertype{archive}
- %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
- \step[fieldset=location,fieldvalue={}]
- \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
- %3.7以上版本用notfield
- %\step[notfield=address,final]%当address不存在则继续
- \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
- \step[typesource=archive,typetarget=online]
- }
- \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确)
- \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸
- \step[fieldset=keywords, fieldvalue={,}, append]
- \step[fieldset=keywords, origfieldval, append]
- }
- \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{
- \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}]
- }
- \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{
- \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}]
- }
- \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,%
- address,location,institution,organization}]{
- \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
- }
- }
- }
-
-%
-% 佚名/noauthor的处理
-%
-% 原理方法:利用样式层的动态数据修改实现
-\def\dealnoathor{
- \DeclareStyleSourcemap{
- \maps[datatype=bibtex]{
- \map{%默认情况下将空缺作者的中文文献设置为佚名
- \step[fieldsource=language,match={chinese},final]
- \step[fieldset=author, fieldvalue={佚名}]
- }
- \map{%默认情况下将空缺作者的英文文献设置为A{non}
- \step[fieldsource=language,match={english},final]
- \step[fieldset=author, fieldvalue={A{non}}]%noauthor换成Anon,同时为避免大写还加了{}
- }
- }
- }
-}
-
-%
-% 不同语言分集调整的实现方式
-%
-% 原理方法:利用样式层的动态数据修改lansortorder域来实现排序
-\def\dealsortlan{
- \DeclareStyleSourcemap{
- \maps[datatype=bibtex]{
- \map[overwrite]{%当文献给出language域时,设置文献要使用的本地化字符串的语言
- \step[fieldsource=language,match=english,final]
- \step[fieldset=lansortorder,fieldvalue=\lanenorder]
- }
- \map[overwrite]{
- \step[fieldsource=language,match=russian,final]
- \step[fieldset=lansortorder,fieldvalue=\lanruorder]
- }
- \map[overwrite]{%
- \step[fieldsource=language,match=french,final]
- \step[fieldset=lansortorder,fieldvalue=\lanfrorder]
- }
- \map[overwrite]{%
- \step[fieldsource=language,match=chinese,final]%中日韩语目前都用english,
- \step[fieldset=lansortorder,fieldvalue=\lancnorder]
- }
- \map[overwrite]{%
- \step[fieldsource=language,match=japanese,final]%中日韩语目前都用english,
- \step[fieldset=lansortorder,fieldvalue=\lanjporder]
- }
- \map[overwrite]{%
- \step[fieldsource=language,match=korean,final]%中日韩语目前都用english,
- \step[fieldset=lansortorder,fieldvalue=\lankrorder]
- }
- }
- }
-}
-
-
-
-
-%
-%驱动别名等价于驱动层映射
-%
-\DeclareBibliographyAlias{newspaper}{article}%
-\DeclareBibliographyAlias{inproceedings}{inbook}%会议论文文献类型驱动
-\DeclareBibliographyAlias{conference}{inbook}%会议论文文献类型驱动
-\DeclareBibliographyAlias{incollection}{inbook}%文集中析出文献类型驱动
-\DeclareBibliographyAlias{collection}{book}%%文集类型驱动
-\DeclareBibliographyAlias{proceedings}{book}%会议论文集文献类型驱动
-\DeclareBibliographyAlias{thesis}{manual}%学位论文驱动
-\DeclareBibliographyAlias{unpublished}{manual}%其它类型驱动
-\DeclareBibliographyAlias{database}{manual}
-\DeclareBibliographyAlias{dataset}{manual}
-\DeclareBibliographyAlias{software}{manual}
-\DeclareBibliographyAlias{map}{manual}
-\DeclareBibliographyAlias{archive}{manual}
-
-
-%=====================================================================
-% 设置排序格式
-%=====================================================================
-%
-% 排序格式,用降序,及userb域,针对biblatex3.8及以上版本
-%
-\DeclareSortingTemplate{gb7714-2015}{
- \sort{
- \field{presort}
- }
- %\sort[final]{
- %\field{sortkey}
- %}
- \sort{
- \field{lansortorder}%language
- }
- \sort{
- \field{sortkey}
- }
- \sort{%[direction=descending]
- \field{sortname}
- \field{author}
- \field{editor}
- \field{translator}
- }
- \sort{
- \field{sortyear}
- \field{year}
- }
- \sort{
- \field{sorttitle}
- \field{title}
- }
- \sort{
- \field{volume}
- \literal{0}
- }
- }
-
- %降序的nyt
- \DeclareSortingTemplate{gbnytd}{
- \sort{
- \field{presort}
- }
-% \sort[final]{
-% \field{sortkey}
-% }
- \sort{
- \field{lansortorder}%language
- }
- \sort[direction=descending]{
- \field{sortkey}
- }
- \sort[direction=descending]{%
- \field{sortname}
- \field{author}
- \field{editor}
- \field{translator}
- }
- \sort{
- \field{sortyear}
- \field{year}
- }
- \sort{
- \field{sorttitle}
- \field{title}
- }
- \sort{
- \field{volume}
- \literal{0}
- }
- }
-
- %降序的ynt
- \DeclareSortingTemplate{gbyntd}{
- \sort{
- \field{presort}
- }
-% \sort[final]{
-% \field{sortkey}
-% }
- \sort{
- \field{lansortorder}%language
- }
- \sort[direction=descending]{
- \field{sortyear}
- \field{year}
- }
- \sort{
- \field{sortkey}
- }
- \sort{%
- \field{sortname}
- \field{author}
- \field{editor}
- \field{translator}
- }
- \sort{
- \field{sorttitle}
- \field{title}
- }
- \sort{
- \field{volume}
- \literal{0}
- }
- }
-
- %升序的ynt
- \DeclareSortingTemplate{gbynta}{
- \sort{
- \field{presort}
- }
-% \sort[final]{
-% \field{sortkey}
-% }
- \sort{
- \field{lansortorder}%language
- }
- \sort{%[direction=ascending]
- \field{sortyear}
- \field{year}
- }
- \sort{
- \field{sortkey}
- }
- \sort{%
- \field{sortname}
- \field{author}
- \field{editor}
- \field{translator}
- }
- \sort{
- \field{sorttitle}
- \field{title}
- }
- \sort{
- \field{volume}
- \literal{0}
- }
- }
-
-%=====================================================================
-% 参考文献表环境
-%=====================================================================
-%
-% 列表格式
-%
-% 增加一个\bibitemindent尺寸用于控制list环境的itemindent
-% v1.0l,20180615,hzz
-% v1.0t,20200319,hzz,增加尺寸\biblabelextend使某些字体下标签宽度不足时可增加标签宽度
-\setlength{\bibhang}{\biblabelsep}%
-\newlength{\bibitemindent}
-\setlength{\bibitemindent}{0pt}
-\newlength{\biblabelextend}
-\setlength{\biblabelextend}{0pt}
-
-
-\defbibenvironment{bibliography}
- {\list
- {\printtext[labelnumberwidth]{%
- \printfield{labelprefix}%
- \printfield{labelnumber}}}
- {\addtolength{\labelnumberwidth}{\biblabelextend}%
- \setlength{\labelwidth}{\labelnumberwidth}%
- \setlength{\labelsep}{\biblabelsep}%
- \setlength{\leftmargin}{\bibhang}%
- \addtolength{\leftmargin}{\labelnumberwidth}%
- \setlength{\itemindent}{\bibitemindent}%
- \setlength{\itemsep}{\bibitemsep}%
- \setlength{\parsep}{\bibparsep}}%
- \renewcommand*{\makelabel}[1]{\hss##1}}
- {\endlist}
- {\item}
-
-%
-% 顺序编码制-标签对齐方式处理
-%
-% 原理方法:利用选项提供的计数器数值做选择
-% 左对齐,右对齐为list环境下的处理,此时list环境的\labelwidth只能设置一个,是最宽标签的宽度
-% 项对齐则是在段落环境下做的处理。
-% 左对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距可变
-% 右对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距相等,标签与页边距离可变
-% 项对齐时,序号标签贴在页边,序号标签与参考文献项内容的间距相等
-% 修改序号标签格式为:
-% \DeclareFieldFormat{shorthandwidth}{\mkbibbrackets{#1}} %源来自numeric.BBX
-% \DeclareFieldFormat{labelnumberwidth}{\ttfamily\mkbibbrackets{#1}\hfill}
-\DeclareFieldFormat{labelnumberwidth}{%
-\ifcase\value{gbalignlabel}%右对齐,整个标签为右对齐
- \mkgbnumlabel{#1}%
-\or%左对齐,整个标签为左对齐
- \mkgbnumlabel{#1}\hfill%
-\or%中间对齐,比如:序号数字居于[]中间
- \hfil\mkgbnumlabel{\hfill#1\hfill}\hfil%
-\fi}
-
-%
-% 修改序号标签格式为以各条参文献为基础进行对齐的方式,即序号与条目内容间隔相等的方式。
-\def\setaligngbstyle{%
-\def\blx at bibitem##1{%
- \blx at ifdata{##1}
- {\begingroup
- \blx at getdata{##1}%
- \blx at bibcheck
- \iftoggle{blx at skipentry}{}{%
- \blx at setdefaultrefcontext{##1}%
- \global\let\blx at noitem\@empty
- \blx at setoptions@type\abx at field@entrytype
- \blx at setoptions@entry
- \blx at thelabelnumber
- \addtocounter{instcount}\@ne
- \blx at initsep
- \blx at namesep
- \csuse{blx at item@\blx at theenv}\relax
-% \blx at initsep %移动到上面去,恢复bibnamesep等的作用机制
-% \blx at namesep
- \csuse{blx at hook@bibitem}%
- \blx at execute
- \blx at initunit
- \blx at anchor
- \blx at beglangbib
- \bibsentence
- \blx at pagetracker
- \blx at driver\abx at field@entrytype
- \blx at postpunct
- \blx at endlangbib}%
- \par\endgroup}%这里增加了一个\par
- {}}
-\newlength{\lengthid}
-\newlength{\lengthlw}
-\newcommand{\itemcmd}{%
-\settowidth{\lengthid}{\mkgbnumlabel{\printfield{labelnumber}}}
-\addtolength{\lengthid}{\biblabelsep}
-\setlength{\lengthlw}{\textwidth}
-\addtolength{\lengthlw}{-\lengthid}
-\addvspace{\bibitemsep}%恢复\bibitemsep的作用
-%\parshape 2 0em \textwidth \lengthid \lengthlw
-\hangindent\lengthid
-\mkgbnumlabel{\printfield{labelnumber}}%
-\hspace{\biblabelsep}}
-%
-% 简单的段落环境
-\defbibenvironment{bibliography}
-{\begingroup\setlength{\parindent}{0em}}
-{\endgroup}
-{\itemcmd}}
-
-
-%=====================================================================
-% 设置单元或块等的标点
-%=====================================================================
-\renewrobustcmd*{\bibinithyphendelim}{\addhighpenspace}%用于处理姓名中名部分存在-的情况,比如ZHANG Yu-xin
-\renewcommand*{\subtitlepunct}{\addcolon\addspace} %修改标题和其它标题信息间的标点,来源biblatex.def,
-%
-% 利用set实现的多语言文献不同语言间的分隔符
-% 20170411,双语之间用newline替换par,避免采用gb7714-2015的项对齐方式第二语言间分段导致没有缩进
-%
-% 原理方法:set方法可以参考3.11.5 Entry Sets,4.11.1 Entry Sets
-% 这里调整一下两种语言参考文献的间隔,源来自biblatex.def
-\renewcommand*{\entrysetpunct}{\adddot\newline\nobreak}
-\renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%%页码引用格式的修改,修改为用冒号
-%\renewcommand{\relateddelim}{}%\par
-
-%=====================================================================
-% 修改域的格式,重定义域的输出宏
-%=====================================================================
-%
-% 新增文献类型标识符的格式
-% []前的nobreak,从GB4.1节的例子看不应该加,所以去掉
-% 但因为考虑到cjk字符和[]之间可能添加空格,所以仍然加上
-% 而[]中间的内容,从4.6.2节的例子看也是可以分割的,因此内部的nobreak也可以去掉
-%
-\DeclareFieldFormat{gbtypeflag}{%
-\iftoggle{bbx:gbmedium}%
-{\iftoggle{bbx:url}%
- {\iffieldundef{url}%当存在url时,增加一个OL标识符
- {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}%
- {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}%
- }%
- {\ifentrytype{online}%
- {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}%
- {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}%
- }}%
- {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}%
-}
-
-%
-% 新增用于报纸的文献类型标识符的格式
-%
-\DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper
-\iftoggle{bbx:gbmedium}%
-{\iftoggle{bbx:url}%
- {\iffieldundef{url}%当存在url时,增加一个OL标识符
- {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
- {\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}%
- }%
- {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
-}{\nobreak\printtext{[}\nobreak N\printtext{]}\nobreak}%
-}
-
-%
-% 新增用于标准的文献类型标识符的格式
-%
-\DeclareFieldFormat{gbtypeflags}{%用于标准standard
-\iftoggle{bbx:gbmedium}%
-{\iftoggle{bbx:url}%
- {\iffieldundef{url}%当存在url时,增加一个OL标识符
- {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
- {\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}%
- }%
- {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
-}{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}%
-}
-
-%
-% 重设title等参考文献信息的输出格式
-%
-% 原理方法:修改来自biblatex.def文件的原格式
-\newcommand{\bibtitlefont}{}
-\newcommand{\bibauthorfont}{}
-\newcommand{\bibpubfont}{}
-
-\DeclareFieldFormat{title}{#1\adddot\addthinspace}
-\DeclareFieldFormat{journaltitle}{#1\isdot}%添加\isdot用于缩写名带点情况,将其转换为缩写点,便于标点的追踪
-\DeclareFieldFormat{issuetitle}{#1}
-\DeclareFieldFormat{maintitle}{#1}
-\DeclareFieldFormat{booktitle}{#1}
-\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉
- [article,patent,thesis,unpublished]
- {title}{#1\adddot\addthinspace}%\mkbibquote{#1\isdot}
-\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉
- [inbook,incollection,inproceedings]
- {title}{#1}%\nopunct\unspace
-\DeclareFieldFormat{url}{\url{#1}} %%url相关输出,url域修改如本行,源来自biblatex.def
-\def\UrlFont{\rmfamily}%设置url字体为roman字体%\ttfamily
-%\urlstyle{rm} %使用这句也一样
-\setcounter{biburlnumpenalty}{100} %让url可以在数字后断行
-\setcounter{biburlucpenalty}{100} %让url可以在大写字母后断行
-\setcounter{biburllcpenalty}{100} %让url可以在小写字母后断行
-\DeclareFieldFormat{doi}{%
- \rmfamily{DOI}\addcolon\space
- \ifhyperref
- {\href{https://doi.org/#1}{\nolinkurl{#1}}}
- {\nolinkurl{#1}}}
-%
-% 标题的字母大小写格式修改
-%
-% 注意:修改标题的字母大小写,不能用前面的title的格式而要用titlecase
-% 因为titlecase is applied to the contents of the field directly,title is not
-%\DeclareFieldFormat{titlecase}{\MakeCapital#1}%重设标题格式,将其修改为首字母大写
-\DeclareFieldFormat{titlecase}{\iftoggle{bbx:titlelink}{%
-\iffieldundef{url}{\MakeCapital#1}{%
-\href{\thefield{url}}{#1}}}{\MakeCapital#1}}%重设标题格式,将其修改为首字母大写
-\DeclareFieldFormat{pages}{#1}%去掉前面引导页码的pp.等字符,\mkpageprefix[bookpagination]{#1}
-\DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{-}}%将页码间隔符替换会英文的短横线
-
-\def\execgbfdfmtstd{%恢复到标准样式的设置
-\DeclareFieldFormat{title}{\mkbibemph{##1}}
-\DeclareFieldFormat
- [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
- {title}{\mkbibquote{##1\isdot}}
-\DeclareFieldFormat
- [suppbook,suppcollection,suppperiodical]
- {title}{##1}
-\DeclareFieldFormat{journaltitle}{\mkbibemph{##1}}
-\DeclareFieldFormat{issuetitle}{\mkbibemph{##1}}
-\DeclareFieldFormat{maintitle}{\mkbibemph{##1}}
-\DeclareFieldFormat{booktitle}{\mkbibemph{##1}}
-\DeclareFieldFormat{url}{\mkbibacro{URL}\addcolon\space\url{##1}}
-\DeclareFieldFormat{titlecase}{##1}
-\DeclareFieldFormat{pages}{\mkpageprefix[bookpagination]{##1}}
-}
-
-%
-% 文献标题后的标点问题
-% v1.0k,20180405,为texlive2017以上版本中的beamer兼容性做的处理,Hu Zhenzhen
-%
-% 原理方法:如下代码处理texlive2017以上版本中,beamer中文献的标题后出现两个点的情况:
-% texlive2017以上的beamer中对macro{title}做了patch,正常情况下不会出现两个点的情况,但由于
-% 之前为了处理texlive2015,2016下的title格式添加了adddot,导致出现两个点的情况,而且也影响
-% 析出文献的//符号的输出,因此再次对macro{title}做patch消除beamer中做apptocmd时添加的\newunitpunct
- {%texlive 2017对应iftlseven以上版本
- \@ifclassloaded{beamer}{
- \DeclareFieldFormat{title}{#1}%
- \DeclareFieldFormat[article,patent,thesis,unpublished]{title}{#1}
- \AtBeginDocument{%
- \patchcmd{\abx at macro@title}{\newunitpunct}{}{}{}}}{}
- }
-
-
-%
-% 修改译者位置格式
-%
-% 原理方法:修改来自biblatex.def文件的bytranslator+others宏的格式
-\renewbibmacro*{bytranslator+others}{%
- \ifnameundef{translator}
- {}
- {%\usebibmacro{bytranslator+othersstrg}
- %\setunit{\addspace}%
- \printnames[bytranslator]{translator}%
- \clearname{translator}%
- %从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理
- %比如生成cotranslator等用于调用cotranslator所代表的当地化字符串
- \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。
- %\setunit{\addspace}%
- \newunit}%
- \usebibmacro{withothers}}
-
-
-%
-% 修改作者数量超过限定值,做省略时的处理格式
-% v1.0,20160701,hzz
-% v1.0O,20190103,hzz,修改利用新定义的一个分隔符strandothersdelim
-%
-% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。
-% \printnames由start-stop控制项数,默认是1和maxnames/minnames
-\renewbibmacro*{name:andothers}{%
- \ifboolexpr{
- test {\ifnumequal{\value{listcount}}{\value{liststop}}}
- and
- test \ifmorenames
- }{\ifnumgreater{\value{liststop}}{1}%注意这里试图去区分姓名总数大于1的情况,当姓名总数大于1时,最后一个姓名后面先加入一个\finalandcomma
- {\finalandcomma}%目前国标没有这样的区分要求,如果有需要也是可以这么去做的。
- {}%
-\printdelim{andothersdelim}\printdelim{strandothersdelim}%
-}{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如:
-%袁训来, 陈哲, 肖书海, 等.
-%胡泳, 范海燕, 译.
-%潘惠霞, 魏婧, 杨艳, 等译.
-\ifcurrentname{translator}{\addcomma\addthinspace}{}%为了实现上述第二个示例情况做的处理
-}}
-
-
-%
-% 修改省略作者后的本地化字符串,比如et al.
-% v1.0o,20190103,hzz
-%
-% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andotherscn=“等”,否则用andothers=“et al.”。
-% 非默认情况,根据选项信息,选择选择强制中文或英文
-% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了
-% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置
-\DeclareDelimFormat{strandothersdelim}{%
- \edef\userfieldabcde{userd}%这里使用\iffieldequalstr{labelnamesource}替代ifcurrentname因为标注中使用ifcurrentname无效
- \iffieldequalstr{labelnamesource}{translator}{\edef\userfieldabcde{usere}}{}%
- \iffieldequalstr{labelnamesource}{editor}{\edef\userfieldabcde{userc}}{}%
- \iffieldequalstr{labelnamesource}{author}{\edef\userfieldabcde{userf}}{}%
- \iffieldequalstr{labelnamesource}{bookauthor}{\edef\userfieldabcde{userb}}{}%
- \ifcase\value{gbcitelocalcase}%
- \iffieldequalstr{\userfieldabcde}{chinese}{\ifbibstring{andothersincitecn}{\bibstring{andothersincitecn}}{\bibstring{andothers}}}{}%中文已经通过english本地化字符串定义
- \iffieldequalstr{\userfieldabcde}{korean}{\ifbibstring{andotherskr}{\bibstring{andotherskr}}{\bibstring{andothers}}}{}%韩语未定义,所以与bib中一致
- \iffieldequalstr{\userfieldabcde}{japanese}{\ifbibstring{andothersjp}{\bibstring{andothersjp}}{\bibstring{andothers}}}{}%日与同韩语
- \iffieldequalstr{\userfieldabcde}{english}{\ifbibstring{andothersincite}{\bibstring{andothersincite}}{\bibstring{andothers}}}{}%英语已定义
- \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%法语未定义,若要定义需要针对french本地化字符串定义
- \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%俄语未定义,若要定义需要针对russian本地化字符串定义
- \or%
- \bibstring{andothersincitecn}%
- \or%
- \bibstring{andothersincite}%
- \fi}
-
-
-\DeclareDelimFormat[bib,biblist]{strandothersdelim}{%
- \edef\userfieldabcde{userd}%
- \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
- \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
- \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
- \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
- \ifcase\value{gbbiblocalcase}%
- \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}%
- \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}%
- \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andothersjp}}{}%
- \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}%
- \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%
- \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%
- \or%
- \bibstring{andotherscn}%
- \or%
- \bibstring{andothers}%
- \fi}
-
-%
-% 修改最后一个作者前的字符串,比如 and
-% v1.0o,20190103,hzz
-%
-% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andcn=“和”,否则用and=“and”。
-% 非默认情况,根据选项信息,选择选择强制中文或英文
-% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了
-% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置
-\DeclareDelimFormat{finalnamedelim}{%
- \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
- \addspace%
- \edef\userfieldabcde{userd}%
- \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
- \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
- \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
- \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
- \ifcase\value{gbcitelocalcase}%
- \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andincitecn}}{}%
- \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
- \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}%
- \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andincite}}{}%
- \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}%
- \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}%
-\space%
- \or%
- \bibstring{andincitecn}\space%
- \or%
- \bibstring{andincite}\space%
- \fi}
-
-\DeclareDelimFormat[bib,biblist]{finalnamedelim}{%
- \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
- \addspace%
- \edef\userfieldabcde{userd}%
- \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
- \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
- \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
- \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
- \ifcase\value{gbbiblocalcase}%
- \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}%
- \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
- \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}%
- \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}%
- \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}%
- \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}%
-\space%
- \or%
- \bibstring{andcn}\space%
- \or%
- \bibstring{and}\space%
- \fi}
-
-
-%
-% 重设title的输出
-%
-% 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen
-% 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件
-% 利用toggle做标识符是否输出的判断
-\renewbibmacro*{title}{%
- \ifboolexpr{%
- test{\iffieldundef{title}}%
- and
- test{\iffieldundef{subtitle}}%
- }%
- {}%
- {\printtext[title]{\bibtitlefont%增加字体控制命令
- \printfield[titlecase]{title}%
- \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
- {}{\setunit{\subtitlepunct}%
- \printfield[titlecase]{subtitle}}%
- \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
- {\setunit{\subtitlepunct}\printfield{titleaddon}}%
- \iftoggle{bbx:gbtype}{%
- \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准
- {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准
- {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸
- {\printfield[gbtypeflag]{usera}}}%其它
- }}{}%
- %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
- %\newunit
-}%
-}}
-
-%
-% 作者信息的输出格式
-%
-% 20180425,v1.0k,为作者增加字体控制命令,Hu Zhenzhen
-% 20180603,v1.0l,增加使用nameformat域来选择姓名格式
-\DeclareNameFormat{namefmtselected}{%
-\iffieldundef{namefmtid}{}%
-{\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}%
-\ifcase\value{gbnamefmtcase}%
- \ifgiveninits
- {\usebibmacro{name:gbuppercase}
- {\namepartfamily}
- {\namepartgiveni}
- {\namepartprefix}
- {\namepartsuffix}}
- {\usebibmacro{name:gbuppercase}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}}%
-\or
- \ifgiveninits
- {\usebibmacro{name:gblowercase}
- {\namepartfamily}
- {\namepartgiveni}
- {\namepartprefix}
- {\namepartsuffix}}
- {\usebibmacro{name:gblowercase}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}}%
-\or
- \ifgiveninits
- {\usebibmacro{name:given-family}
- {\namepartfamily}
- {\namepartgiveni}
- {\namepartprefix}
- {\namepartsuffix}}
- {\usebibmacro{name:given-family}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}}%
-\or
- \ifgiveninits
- {\usebibmacro{name:family-given}
- {\namepartfamily}
- {\namepartgiveni}
- {\namepartprefix}
- {\namepartsuffix}}
- {\usebibmacro{name:family-given}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}}%
-\or
-\usebibmacro{name:gbpinyin}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}%
-\or
- \ifnumequal{\value{listcount}}{1}
- {\ifgiveninits
- {\usebibmacro{name:family-given}
- {\namepartfamily}
- {\namepartgiveni}
- {\namepartprefix}
- {\namepartsuffix}}
- {\usebibmacro{name:family-given}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}}%
- \ifboolexpe{%
- test {\ifdefvoid\namepartgiven}
- and
- test {\ifdefvoid\namepartprefix}}
- {}
- {\usebibmacro{name:revsdelim}}}
- {\ifgiveninits
- {\usebibmacro{name:given-family}
- {\namepartfamily}
- {\namepartgiveni}
- {\namepartprefix}
- {\namepartsuffix}}
- {\usebibmacro{name:given-family}
- {\namepartfamily}
- {\namepartgiven}
- {\namepartprefix}
- {\namepartsuffix}}}%
-\fi
- \usebibmacro{name:andothers}}
-
-\DeclareNameAlias{default}{namefmtselected}%姓名的默认格式采用可选的模式
-\DeclareNameAlias{sortname}{default}% Used in the bibliography %family-given/given-family
-\DeclareNameAlias{citename}{default}% Default used by \citename
-
-\DeclareDelimFormat[bib,biblist]{andothersdelim}{\addcomma\addspace}
-%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}%
-
-%GB/T 7714-2015 风格,全部大写
-\newbibmacro*{name:gbuppercase}[4]{\bibauthorfont%
-\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
-\renewcommand*{\revsdnamepunct}{}%
- \ifuseprefix%
- {\usebibmacro{name:delim}{#3#1}%
- \usebibmacro{name:hook}{#3#1}%
- \ifdefvoid{#3}{}{%
- \ifcapital%
- {\mkbibnameprefix{\MakeCapital{#3}}\isdot}%
- {\mkbibnameprefix{#3}\isdot}%
- \ifprefchar{}{\bibnamedelimc}}%
- \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
- \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号
- {\usebibmacro{name:delim}{#1}%
- \usebibmacro{name:hook}{#1}%
- \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
- \ifboolexpe{%
- test {\ifdefvoid{#2}}
- and
- test {\ifdefvoid{#3}}}
- {}{\revsdnamepunct}%
- \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
- \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号
-}
-
-%GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出
-\newbibmacro*{name:gblowercase}[4]{\bibauthorfont%
- \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
- \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
- \ifuseprefix
- {\usebibmacro{name:delim}{#3#1}%
- \usebibmacro{name:hook}{#3#1}%
- \ifdefvoid{#3}{}{%
- \ifcapital
- {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
- {\mkbibnameprefix{#3}\isdot}%
- \ifprefchar{}{\bibnamedelimc}}%
- \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot%
- \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号
- {\usebibmacro{name:delim}{#1}%
- \usebibmacro{name:hook}{#1}%
- \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot%
- \ifboolexpe{%
- test {\ifdefvoid{#2}}
- and
- test {\ifdefvoid{#3}}}
- {}{\revsdnamepunct}%
- \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}
- \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号
-}
-
-%中文常见风格,汉语拼音全拼模式
-\newbibmacro*{name:gbpinyin}[4]{\bibauthorfont%
-\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY
-\renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
-\renewrobustcmd*{\bibnamedelima}{\mbox{-}}%
- \ifuseprefix
- {\usebibmacro{name:delim}{#3#1}%
- \usebibmacro{name:hook}{#3#1}%
- \ifdefvoid{#3}{}{%
- \ifcapital
- {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
- {\mkbibnameprefix{#3}\isdot}%
- \ifprefchar{}{\bibnamedelimc}}%
- \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
- \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamegiven{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}
- {\usebibmacro{name:delim}{#1}%
- \usebibmacro{name:hook}{#1}%
- \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
- \ifboolexpe{%
- test {\ifdefvoid{#2}}
- and
- test {\ifdefvoid{#3}}}
- {}
- {\revsdnamepunct}%
- \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeCapital{#2}}\isdot}%\MakeCapital
- \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}
- \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%
-}
-
-
-%
-% url和url日期格式
-%
-\renewbibmacro*{url+urldate}{%
- %\usebibmacro{url}%%更换url的位置,放到下面
- \iffieldundef{urlyear}%
- {}{%\setunit*{\addspace}%
- \usebibmacro{urldate}}%
- \setunit{\addperiod\addspace}%
- \usebibmacro{url}}
-\renewbibmacro*{url}{\printfield{url}}
-
-
-%
-% 日期信息的输出格式,针对biblatex>=3.10版本
-%
- \DeclareFieldFormat{urldate}{#1}
- \renewbibmacro*{urldate}{%
- \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx at edtfdate这种更底层的命令
-
- %
- % 专利的公告日期、或报纸的日期的输出宏
- % 20160701,v1.0,新增加
- % 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen
- %
- % 原理方法:加上printtext避免破坏异步标点机制
- % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份
- % 所以无法再用选项设置的方法,印象需要用底层的命令
- % 这里可以用\blx at isodate,但用\blx at gbdate试图避免版本判断
- \newbibmacro*{newsdate}{%%
- \printtext{\blx at gbdate{}{}}%%\blx at isodate{}{}%
- }
-
- %
- \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式
- \ifboolexpr{%
- test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
- }%
- {}%更新或修改日期通常有day信息
- {\iffieldundef{year}{%
- \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}%
- {\printtext{(}\printenddate\printtext{)}}%
- }{\iffieldequalstr{year}{}{%因为year存在,但为空
- }{\printtext{(}\blx at gbdate{}{}\printtext{)}}%
- }%
- }}%
-
-
-%
-% biblatex>v3.8版利用related实现双语文献的处理
-%
- %为了实现v3.8以上版本的双语文献,采用related的方法代替set方法,因为set方法已经无法实现了,
- %因为set不再复制其第一个成员的信息。于是定义一个命令,用于动态的修改数据,即添加related域的信息
- %其中使用了\DeclareStyleSourcemap,但由于其只能出现在导言区中,因此\defdoublelangentry命令也只能出现在导言区中
- \newcommand{\defdoublelangentry}[2]{%
- \edef\entrykeya{##1}
- \edef\entrykeyb{##2}
- \DeclareStyleSourcemap{
- \maps[datatype=bibtex]{
- \map{
- \step[fieldsource=entrykey, match=\entrykeya, final]
- \step[fieldset=related, fieldvalue=\entrykeyb]
- }
- }
- }
- }
-
-%
-% 关联文献间的分隔符
-%
-\renewcommand{\relateddelim}{\adddot\newline\nobreak}%\par,而作者年样式不需要修改,因为没有项对齐的标签问题
-
-%
-% 关联文献块前的分隔符,针对biblatex>=3.11
-%
-% 原理方法:因为增加了begrelateddelim钩子,所以不需要重定义related输出宏
-\renewcommand{\begrelateddelim}{\adddot\newline\nobreak}
-
-
-%
-% 调整doi+eprint+url格式
-%
-% 原理方法:源来自standard.bbx,因为页码后面直接跟引用日期,没有标点所以去掉其中的标点。
-\renewbibmacro*{doi+eprint+url}{%
-% \iftoggle{bbx:doi}%把doi的位置放到url后面
-% {\printfield{doi}}
-% {}%
- %\newunit\newblock
- \iftoggle{bbx:eprint}
- {\iffieldundef{eprint}{}{\newunit\usebibmacro{eprint}}}
- {}%
- %\newunit\newblock
- \iftoggle{bbx:url}
- {\usebibmacro{url+urldate}}
- {}
- \newunit\newblock
- \iftoggle{bbx:doi}
- {\printfield{doi}}
- {}}
-
-%
-% 调整页码的格式,即chapter+pages格式
-%
-\renewbibmacro*{chapter+pages}{%
-\iftoggle{bbx:gbstrict}{}{%
- \printfield{chapter}}%
- \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出
- \setunit{\bibpagespunct}%
- \printfield{pages}}%
- %\newunit %这里的标点去掉
-}
-
-%
-% 当location等出版项超过maxitem缩减后不再输出etal
-%
-\DeclareListFormat{location}{%
- \usebibmacro{list:delim}{#1}%
- #1\isdot}
-\DeclareListAlias{institution}{location}
-\DeclareListAlias{publisher}{location}
-
-% 新增一个样式用于输出连续出版物的地址,单位,时间,
-% 用于periodical连续出版物的出版社和地址的处理
-%
-% v1.0k,20180425,为出版信息增加字体控制命令,hzz
-% %类似\newbibmacro*{publisher+location+date}
-\newbibmacro*{location+institution+date}{\bibpubfont%
-\iftoggle{bbx:gbpub}%
-{\testCJKfirst{userd}%
-\ifboolexpr{%
-test {\iflistundef{location}} and test {\iflistundef{institution}}%
-}{\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress}\space :\space\str at nopublisher]}%
-{\printtext{[S.l.\space :\space s.n.\adddot]}}%
-}{%
-\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress]}}{\printtext{[S.l.\adddot]}}}%
- {\printlist{location}}%
-\addcolon\addspace%
-\iflistundef{institution}{%
-\iftoggle{ifCJKforgbt}{\printtext{[\str at nopublisher]}}{\printtext{\mkbibbrackets{s.n.}}}}%
-{\printlist{institution}}}%
-\setunit{\addcomma\addspace}%
- %\usebibmacro{date}%
- \printfield{year}%
- \bibrangedash%
- \iffieldundef{endyear}{}{\printfield{endyear}}%
- \newunit}%
-{\printlist{location}%
- \iflistundef{institution}%
- {\setunit*{\addcomma\space}}
- {\setunit*{\addcolon\space}}%
- \printlist{institution}%
- \setunit*{\addcomma\space}%
- \usebibmacro{date}%
- \newunit}%
-}
-%
-% 通用的出版社和地址的处理
-%
-% 原理方法:当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。
-% 事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。
-% 注意标准standard类型,因为当没有出版项时直接省略,所以做特殊处理
-\renewbibmacro*{publisher+location+date}{\bibpubfont%
-\iftoggle{bbx:gbpub}%
-{\testCJKfirst{userd}%
- \ifboolexpr{ test {\iflistundef{location}} and test {\iflistundef{publisher}} }%
- {\iffieldequalstr{note}{standard}{}{\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress}\space :\space\str at nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}%
- {\iflistundef{location}{%\adddot
- \iffieldequalstr{note}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。
- {\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}}}% \bibstring{noaddress}
- {\printlist{location}\addcolon\addspace}%%\addcolon\addspace%
- \iflistundef{publisher}{%
- \iffieldequalstr{note}{standard}{}%
- {\iftoggle{ifCJKforgbt}{\printtext{[\str at nopublisher]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}%
- {\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}}}%
- {\printlist{publisher}}}%
-\setunit*{\addcomma\addspace}%\addcomma\addspace%
-\usebibmacro{date}%%\newunit %去掉这个标点
-}%
-{\printlist{location}%
- \iflistundef{publisher}
- {\setunit*{\addcomma\space}}
- {\setunit*{\addcolon\space}}%
- \printlist{publisher}%
- \setunit*{\addcomma\space}%
- \usebibmacro{date}%%\newunit
- }%
-}
-
-%
-% 修改了一个institution+location+date用于manual、report、thesis等类型
-%
-% 20180425,v1.0k,增加了字体控制命令,hzz
-% 20190105,v1.0o,加了一个编组避免\usebibmacro{date}把month和day信息去掉
-\renewbibmacro*{institution+location+date}{\bibpubfont%当没有institution时不处理。
-{\printlist{location}%%加了一个编组避免\usebibmacro{date}把month和day信息去掉
- \iflistundef{institution}
- {\setunit*{\addcomma\space}}
- {\setunit*{\addcolon\space}}%
- \printlist{institution}%
- \setunit*{\addcomma\space}%
- \usebibmacro{date}%
- %\newunit
- }}
-
-%
-% 对volume卷信息格式做出修改
-% v1.0o,20190105,hzz
-%
-\DeclareFieldFormat{volume}{%
-\testCJKfirst{userd}%
-\iftoggle{ifCJKforgbt}%
-{\bibstring{serialcn}#1\bibstring{volumecn}}%
-{\bibstring{volume}~#1}%
-}% volume of a book
-\DeclareFieldFormat[article,periodical]{volume}{#1}% volume of a journal
-
-%
-% 对number册信息格式做出修改
-% v1.0o,20190105,hzz
-%
-\DeclareFieldFormat{number}{#1}%
-\DeclareFieldFormat[book,collection,inbook,%
-incollection,proceedings,inproceedings]{number}{%
-\testCJKfirst{userd}%
-\iftoggle{ifCJKforgbt}%
-{\bibstring{serialcn}#1\bibstring{numbercn}}%
-{#1}%
-}%
-
-%
-% 对edition版本信息格式做出修改
-%
-\DeclareFieldFormat{edition}{%源来自biblatex.DEF
-\testCJKfirst{userd}%
-\iftoggle{ifCJKforgbt}%
-{\ifinteger{#1}%
-{\printtext{#1\str at edition}}%
-{#1\isdot}}%
-{\ifinteger{#1}%
-{\mkbibordedition{#1}~\bibstring{edition}}%
-{#1\isdot}}}
-
-%
-% 对version的版本信息做出修改
-%
-\DeclareFieldFormat{version}{%源来自biblatex.DEF
-\testCJKfirst{userd}%
-\ifinteger{#1}%
-{\iftoggle{ifCJKforgbt}{\printtext{#1\str at edition}}%
-{\mkbibordedition{#1}~\bibstring{version}}}%
-{#1\isdot}}
-
-%
-% 修改析出文献的文集的标题与附加标题间的符号
-%
-\renewbibmacro*{booktitle}{%
- \ifboolexpr{
- test {\iffieldundef{booktitle}}
- and
- test {\iffieldundef{booksubtitle}}
- }
- {}
- {\printtext[booktitle]{\bibtitlefont%
- \printfield[titlecase]{booktitle}%
- \setunit{\subtitlepunct}%
- \printfield[titlecase]{booksubtitle}}%
- \newunit%标点换成下一句
- \setunit{\subtitlepunct}}%
- \printfield{booktitleaddon}}
-
-
-%
-% 调整期刊名的格式
-%
-% v1.0k,20180425,增加了字体控制命令,hzz
-\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx
- \usebibmacro{journal}%
- %\setunit*{\addspace}%
- \setunit*{\addcomma\addspace}%修改为增加一个逗号
- \iffieldundef{series}
- {}
- {\newunit
- \printfield{series}%
- \setunit{\addspace}}%
- %\usebibmacro{volume+number+eid}%
- %\setunit{\addspace}%
- \usebibmacro{issue+date}%
- %\setunit{\addcolon\space}%
- \iffieldundef{volume}{}{\setunit{\addcomma\space}}%
- %换成逗号和空格
- \usebibmacro{issue}%
- \usebibmacro{volume+number+eid}%把卷期放到年份后面
- %\newunit
- }
-
-
-
-%
-% 调整期刊卷和期的格式
-%
-\renewbibmacro*{volume+number+eid}{%源来自standard.bbx
-\iftoggle{bbx:gbfieldstd}{%
- \printfield{volume}%
- \setunit*{\adddot}%
- \printfield{number}%
- \setunit{\addcomma\space}%
- \printfield{eid}}{%
- \printfield{volume}%
- %\setunit*{\adddot}%去掉点号
- %\printfield{number}%
- \iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号
- \iffieldundef{eid}{}{%
- \setunit{\addcomma\space}%
- \printfield{eid}}}}
-
-%
-% 调整期刊年份的格式
-%
-\renewbibmacro*{issue+date}{%去掉括号
- \printtext{%去掉了[parens]
- \iffieldundef{issue}
- {%\usebibmacro{date}
- \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸
- {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸
- {\usebibmacro{date}}%
- }}%
- {\iftoggle{bbx:gbstrict}{}{\printfield{issue}%
- \setunit*{\addspace}}%
- %\usebibmacro{date}
- \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸
- {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸
- {\usebibmacro{date}}%
- }}}%
- %\newunit
- }
-
-%
-% 调整页码前的标点和去掉期刊文章等页码后面的标点
-%
-\renewbibmacro*{note+pages}{%源来自standard.bbx
- %\printfield{note}%不要note,note用来判断是否是报纸newspaper
- \iffieldundef{pages}{}{
- \setunit{\bibpagespunct}%
- \printfield{pages}}%
- %\newunit
- }
-
-
-%
-% 编者的符号修改一下
-% v1.0 2016-07-01
-% v1.0q 2019-03-01 hzz 修改editortype前的标点
-%
-\renewbibmacro*{editor}{%源来自biblatex.DEF
- \ifboolexpr{
- test \ifuseeditor
- and
- not test {\ifnameundef{editor}}
- }
- {\printnames{editor}%
- \iffieldundef{editortype}%增加一个类型判断,用于存在editortype的情况
- {\setunit\addspace}%当没有editortype时,直接用句点
- {%\setunit{\addcomma\space}%
- \usebibmacro{editorstrg}}%
- %\clearname{editor}
- }%
- {}}
-
-%
-% 编者类型做一修改
-% v1.0 2016-07-01
-% v1.0q 2019-03-01 hzz 修改editortype不同语言的不同本地化字符串
-%
-\renewbibmacro*{editorstrg}{%源来自biblatex.DEF
- \printtext[editortype]{%
- \iffieldundef{editortype}
- {%
-% \ifboolexpr{ %这一段去掉,未定义编者类型情况下不处理
-% test {\ifnumgreater{\value{editor}}{1}}
-% or
-% test {\ifandothers{editor}}
-% }
-% {\bibstring{editors}}
-% {\bibstring{editor}}
- }
- {\ifbibxstring{\thefield{editortype}} %定义编者类型情况下处理,以后根据需要修改
- {\ifboolexpr{
- test {\ifnumgreater{\value{editor}}{1}}
- or
- test {\ifandothers{editor}}
- }
- {\printdelim{streditortypes}}
- {\printdelim{streditortype}}}
- {\thefield{editortype}}}%
- }}
-
-%
-% 编者类型的本地化字符串输出
-% v1.0q 2019-03-01 hzz
-% 能对不同条目类型作格式设置的域格式,能对不同环境做格式设置的分隔符
-% 能对不同文境作设置的包括排序,标签等
-% 这里因为考虑可能标注和文献表中存在不同,所以用分隔符来输出本地化字符串
-%
-\DeclareDelimFormat{streditortypes}{%
- \edef\userfieldabcde{userd}%
- \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
- \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
- \ifcase\value{gbbiblocalcase}%
- \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}scn}}{}%
- \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}skr}}{}%
- \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}sjp}}{}%
- \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}%
- \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}%
- \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}%
- \or%
- \bibstring{\thefield{editortype}scn}%
- \or%
- \addcomma\addthinspace\bibstring{\thefield{editortype}s}%
- \fi}
-%
-\DeclareDelimFormat{streditortype}{%
- \edef\userfieldabcde{userd}%
- \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
- \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
- \ifcase\value{gbbiblocalcase}%
- \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}cn}}{}%
- \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}kr}}{}%
- \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}jp}}{}%
- \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}%
- \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}%
- \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}%
- \or%
- \bibstring{\thefield{editortype}cn}%
- \or%
- \addcomma\addthinspace\bibstring{\thefield{editortype}}%
- \fi}
-
-
-%
-% bookauthor域的输出,
-% v1.0q 2019-03-01 hzz
-% 不再对editor和bookauthor做sourcemap,而是下面的宏内逻辑代替,
-% 使得除使用bookauthor外也可以使用editor,便于在使用editor时使用editortype
-\renewbibmacro*{bybookauthor}{%
- \ifnameundef{bookauthor}%
- {\ifnameundef{editor}%
- {}%
- {\ifnamesequal{author}{editor}%
- {}{\usebibmacro{editor}}}%
- }%
- {\ifnamesequal{author}{bookauthor}%
- {}{\printnames{bookauthor}}%
- }%
-}
-
-%
-% 修改期刊的标题
-%
-\renewbibmacro*{periodical}{%源来自biblatex.DEF
- \iffieldundef{title}
- {}
- {\printtext[title]{\bibtitlefont%
- \printfield[titlecase]{title}%
- %\setunit{\subtitlepunct}%
- \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
- {}{\setunit{\subtitlepunct}
- \printfield[titlecase]{subtitle}}%
- %{}%把编组结束移到后面去
- \iftoggle{bbx:gbtype}{%
- \iffieldundef{usera}{}{%在标题后直接给出文献标识字母
- \printfield[gbtypeflag]{usera}}}{}
- }}
- }
-
-
-%
-% 期刊的标题做修改
-%
-\renewbibmacro*{title+issuetitle}{%源来自standard.BBX
- \usebibmacro{periodical}%
- %\setunit*{\addspace}%
- \setunit*{\adddot\addspace}%标点修改为句点
- \iffieldundef{series}
- {}
- {\newunit
- \printfield{series}%
- \setunit{\addspace}}%
- \usebibmacro{periodical+issue}%将issue调整到上面来,并修改
-\iffieldundef{number}{}{%%进一步处理有范围的数字
- \multinumberparser{\thefield{number}}}%
- \iffieldundef{volume}%
- {\printfield{year}%
- \printtext{\mkbibparens{\multinumberfirst}}%
- \bibrangedash%
- \iffieldundef{endyear}{}{\printfield{endyear}\printtext{\mkbibparens{\multinumbersecond}}}%
- }%
- {\multivolparser{\thefield{volume}}%
- \printfield{year}%
- \setunit{\addcomma\space}%将冒号修改为逗号
- \printtext{\multivolfirst}%
- \printtext{\mkbibparens{\multinumberfirst}}%
- \bibrangedash%
- \iffieldundef{endyear}{}{%
- \printfield{endyear}%
- \setunit{\addcomma\space}%将冒号修改为逗号
- \printtext{\multivolsecond}%
- \printtext{\mkbibparens{\multinumbersecond}}}%
- }%
- \setunit{\addcomma\space}%
- \printfield{eid}%
- \setunit{\addspace}%
- %\usebibmacro{issue+date}%
- %\setunit{\addcolon\space}%
- \usebibmacro{issue}%
- \newunit}
-
-%
-% 新增一个样式用于调整期刊年份的格式,只打印年份
-%
-\newbibmacro*{periodical+issue}{%
- \printtext{%去掉了[parens]
- \iffieldundef{issue}
- {%\usebibmacro{date}%修改为下一句
- }%
- {\printfield{issue}%
- \setunit*{\addspace}%
- %\usebibmacro{date}%修改为下一句
- }%
- }%
- %\newunit
-}
-
-%
-% 重设专利title的输出,将文献类型标识符输出出去
-%
-\newbibmacro*{patenttitle}{%原输出来自biblatex.def文件
- \ifboolexpr{%
- test{\iffieldundef{title}}%
- and%
- test{\iffieldundef{subtitle}}%
- }%
- {}%
- {\printtext[title]{\bibtitlefont%
- \printfield[titlecase]{title}%
- \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
- {}{\setunit{\subtitlepunct}%
- \printfield[titlecase]{subtitle}}%
- \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
- {\setunit{\subtitlepunct}\printfield{titleaddon}}%
- \setunit{\subtitlepunct}\printfield{number}%写专利号
- \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}%
- %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
- %\newunit
- }%
-}%
-}
-
-
-
-%
-% 修改in:用于inbook、incollection、inproceedings等类型
-% 2018.04.20,v1.0k,renewed marco,by hzz
-% 20190212,v1.0q,增加中英文区分,by hzz
-%
-% 原理方法:使用bibmacro{in:}改变了以前在driver中直接输出//的方式,同时也简化了标点控制。
-\renewbibmacro*{in:}{%
- \iftoggle{bbx:gbpunctin}{\printtext{\texttt{//}\allowbreak}}%\addthinspace
- {\setunit{\adddot\addspace}%
- \iffieldequalstr{userd}{chinese}%
- {\printtext{\bibstring{incn}}}%
- {\printtext{\bibstring{in}}}%
- }}%\newunit\newblock\intitlepunct
-
-%
-% 修改type域的输出格式
-% 2019.02.12,v1.0q,byhzz
-% 使其可以区分中英文输出不同的格式,比如博士论文英文输出PHD thesis,中文则是博士学位论文
-\DeclareFieldFormat{type}%
-{\iffieldequalstr{userd}{chinese}%
- {\ifbibxstring{#1cn}{\bibxstring{#1cn}}{#1}}%
- {\ifbibstring{#1}{\bibstring{#1}}{#1}}%
-}
-
-
-%
-% 修改series域的输出格式
-% 2019.05.01,v1.0r,byhzz
-\renewbibmacro*{series+number}{%
- \printfield{series}%
- %\setunit*{\addspace}%
- %\printfield{number}%
- %\newunit
- }
-
-%=====================================================================
-%设置驱动格式
-%=====================================================================
-%
-% book条目类的驱动
-%
- \DeclareBibliographyDriver{book}{%源来自standard.bbx文件
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
-\usebibmacro{author/editor+others/translator+others}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
-\usebibmacro{maintitle+title}%
-\iftoggle{bbx:gbstrict}{}{%
-\newunit
-\printlist{language}%
-\newunit\newblock%
-\usebibmacro{byauthor}%
-\newunit\newblock}%
-\usebibmacro{byeditor+others}%
-\newunit
-\printfield{edition}%
-\newunit\newblock%%
-\iftoggle{bbx:gbstrict}{}{%
-\iffieldundef{maintitle}%
-{\printfield{volume}%
-\printfield{part}}%
-{}%
-\newunit%
-\printfield{volumes}%
-\newunit\newblock%
-\usebibmacro{series+number}}%
-\newunit\newblock%
-%\printfield{note}%
-%\newunit\newblock%
-\usebibmacro{publisher+location+date}%
-%\newunit\newblock %这里标点去掉
-\usebibmacro{chapter+pages}%
- \iffieldundef{url}{}{%当没有网址时也不输出
- \usebibmacro{modifydate}}%带括号的修改或更新日期,
-\usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。
- \newunit\newblock%
- \printfield{pagetotal}%
- \newunit\newblock%
- \iftoggle{bbx:isbn}
- {\printfield{isbn}}
- {}%
- \newunit\newblock
- %\usebibmacro{doi+eprint+url}%
- %\newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-
-%
-% 期刊文章,连续出版物中的析出文献的格式
-%
- \DeclareBibliographyDriver{article}{%
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author/translator+others}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
- \usebibmacro{title}%
- \iftoggle{bbx:gbstrict}{}{%
- \newunit%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}%
- \newunit\newblock
- \usebibmacro{bytranslator+others}%
- \newunit\newblock
- \printfield{version}}%
- \newunit\newblock
- %\usebibmacro{in:}% 不使用in来表示期刊等连续出版物
- \usebibmacro{journal+issuetitle}%
- %\newunit
-% \usebibmacro{byeditor+others}%
-% \newunit
- \usebibmacro{note+pages}%
- \iffieldequalstr{note}{news}{}{%当是新闻时不输出修改或更新日期
- \iffieldundef{url}{}{%当没有网址时也不输出
- \iftoggle{bbx:url}{%当url选项为false时,也不输出
- \usebibmacro{modifydate}}{}}}%带括号的修改或更新日期,
- \usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置
- \newunit\newblock
- \iftoggle{bbx:isbn}
- {\printfield{issn}}
- {}%
- \newunit\newblock
- %\usebibmacro{doi+eprint+url}%
- %\newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-
-
-%
-% 连续出版物的驱动
-%
- \DeclareBibliographyDriver{periodical}{%源来自standard.BBX
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{editor}%
- %\setunit{\labelnamepunct}\newblock
- \newunit\newblock %删除上面一行,添加这一行
- \usebibmacro{title+issuetitle}%
- \newunit\newblock%
- \usebibmacro{location+institution+date}%添加这一行用于输出地址,单位和时间
- \newunit\newblock%添加这一行
- \iftoggle{bbx:gbstrict}{}{%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byeditor}%
- \newunit\newblock
- \printfield{note}%
- \newunit\newblock}
- \iftoggle{bbx:isbn}
- {\printfield{issn}}
- {}%
- \newunit\newblock
- \usebibmacro{doi+eprint+url}%
- \newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-%
-% 专利文献驱动
-%
- \DeclareBibliographyDriver{patent}{%源来自standard.BBX
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
- %\usebibmacro{title}%
- \usebibmacro{patenttitle}%给出专利专用的标题输出
- \iftoggle{bbx:gbstrict}{}{%
- \newunit%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}}%
- \newunit\newblock
- \printfield{type}%
- \setunit*{\addspace}%
- %\printfield{number}%已放到patenttitle中处理
- \iflistundef{location}
- {}
- {\setunit*{\addspace}%
- \printtext{%[parens]
- \printlist[][-\value{listtotal}]{location}}}%
- \newunit\newblock
- \usebibmacro{byholder}%
- \newunit\newblock
- \printfield{note}%
- \newunit\newblock
- \usebibmacro{newsdate}%
- %\newunit\newblock
- \usebibmacro{doi+eprint+url}%
- \newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-
-%
-% 在线文献驱动
-%
-\DeclareBibliographyDriver{online}{%源来自standard.BBX
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author/editor+others/translator+others}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
- \usebibmacro{title}%
- \iftoggle{bbx:gbstrict}{}{%
- \newunit%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}%
- \newunit\newblock
- \usebibmacro{byeditor+others}%
- \newunit\newblock
- \printfield{note}}%
- \newunit
- \printfield{version}%
- \newunit\newblock
- %\printlist{organization}%
- \printlist{institution}%
- \newunit\newblock
-\ifboolexpr{%
-test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
-}{\usebibmacro{date}}%
-{\usebibmacro{modifydate}}%修改或更新日期,为带括号的时间
- \usebibmacro{url+urldate}%从下面移上来
- \newunit\newblock
- \iftoggle{bbx:eprint}
- {\usebibmacro{eprint}}
- {}%
- \newunit\newblock
- %\usebibmacro{url+urldate}%
- %\newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-
-%
-% 报告类型驱动
-% 当有网址无出版项时,用online输出
-%
-\DeclareBibliographyDriver{report}{%
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
- \usebibmacro{title}%
- \iftoggle{bbx:gbstrict}{}{%
- \newunit%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}}%
- \newunit\newblock
- \usebibmacro{byeditor+others}%增加的译者信息
- \newunit\newblock
- \printfield{type}%
- \setunit*{\addspace}%
- \printfield{number}%
- \newunit\newblock
- \printfield{version}%
- \newunit
- \printfield{note}%
- \newunit\newblock
- \usebibmacro{publisher+location+date}%
- %\newunit\newblock
- \usebibmacro{chapter+pages}%
- \usebibmacro{doi+eprint+url}%
- \newunit
- \printfield{pagetotal}%
- \newunit\newblock
- \iftoggle{bbx:isbn}
- {\printfield{isrn}}
- {}%
- \newunit\newblock
-% \usebibmacro{doi+eprint+url}%
-% \newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-%
-% 论文、手册类型驱动
-% 2016-11-11,增加了译者信息
-%
-\DeclareBibliographyDriver{manual}{%
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
- \usebibmacro{title}%
- \iftoggle{bbx:gbstrict}{}{%
- \newunit%
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}}%
- \newunit\newblock
- \usebibmacro{byeditor+others}%增加的译者信息
- \newunit\newblock
- \iftoggle{bbx:gbfieldtype}{%
- \printfield{type}%
- \setunit*{\addspace}}{}%
- \printfield{number}%
- \newunit\newblock
- \printfield{version}%
- \newunit
- \printfield{note}%
- \newunit\newblock
- \usebibmacro{institution+location+date}%
- %\newunit\newblock
- \usebibmacro{chapter+pages}%
- \iffieldundef{url}{}{%当没有网址时也不输出修改或更新日期
- \usebibmacro{modifydate}}%修改或更新日期为带括号的时间
- \usebibmacro{doi+eprint+url}%
- \newunit
- \printfield{pagetotal}%
- \newunit\newblock
- \iftoggle{bbx:isbn}
- {\printfield{isrn}}
- {}%
- \newunit\newblock
-% \usebibmacro{doi+eprint+url}%
-% \newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-%
-% 备选类型驱动
-%
-% 利用biblatex的misc驱动
-\DeclareBibliographyDriver{misc}{%
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author/editor+others/translator+others}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
- \usebibmacro{title}%
-\iftoggle{bbx:gbstrict}{}{%
- \newunit
- \printlist{language}%
- \newunit\newblock
- \usebibmacro{byauthor}%
- \newunit\newblock
- \usebibmacro{byeditor+others}}%
- \newunit\newblock
- \printfield{howpublished}%
- \newunit\newblock
- \printfield{type}%
- \newunit
- \printfield{version}%
- \newunit
- \printfield{note}%
- \newunit\newblock
- \usebibmacro{institution+location+date}%
- %\usebibmacro{organization+location+date}%
- %\newunit\newblock
- \usebibmacro{doi+eprint+url}%
- \newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-
-%
-% 专著中的析出文献的格式修改
-%
-\DeclareBibliographyDriver{inbook}{%源来自standard.bbx
- \usebibmacro{bibindex}%
- \usebibmacro{begentry}%
- \usebibmacro{author/translator+others}%
-\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
-\usebibmacro{title}%
-\usebibmacro{in:}%
-%\printtext{\texttt{//}\addthinspace}%
- \usebibmacro{bybookauthor}%
- \ifnameundef{bookauthor}{%
- \ifnameundef{editor}{}{\newunit}%
- }{\newunit}%替换下一句
- %\newunit\newblock
-\iffieldundef{series}{}{\usebibmacro{series+number}\setunit{\addcolon\addspace}}%为处理一些存在series的情况而增加
- \usebibmacro{maintitle+booktitle}%
-\iffieldundef{volume}{}{\setunit{\addcolon\addspace}\printfield{volume}}%
-\iffieldundef{number}{}{\setunit{\addcolon\addspace}\printfield{number}}%增加卷和册信息
- \newunit\newblock%
-% \usebibmacro{byeditor+others}%
-% \newunit\newblock
- \printfield{edition}%
- \newunit
- \iftoggle{bbx:gbstrict}{}{%
-% \iffieldundef{maintitle}
-% {\printfield{volume}%
-% \printfield{part}}
-% {}%
-% \newunit
-% \printfield{volumes}%
-% \newunit\newblock
-% \usebibmacro{series+number}
- }%
- \newunit\newblock
- %\printfield{note}%
- %\newunit\newblock
- \usebibmacro{publisher+location+date}%
- %\newunit\newblock
- \usebibmacro{chapter+pages}%
- %\newunit\newblock
- \usebibmacro{doi+eprint+url}%移到上面来
- \newunit\newblock
- \iftoggle{bbx:isbn}
- {\printfield{isbn}}
- {}%
- \newunit\newblock
-% \usebibmacro{doi+eprint+url}%
-% \newunit\newblock
- \usebibmacro{addendum+pubstate}%
- \setunit{\bibpagerefpunct}\newblock
- \usebibmacro{pageref}%
- \newunit\newblock
- \iftoggle{bbx:related}
- {\usebibmacro{related:init}%
- \usebibmacro{related}}
- {}%
- \usebibmacro{finentry}\usebibmacro{annotation}}
-
-
-%
-%针对不同refsection做不同的格式处理的代码
-%
-
-%
-%默认采用顺序编码制,因此只需增加的是作者年制
-\newrobustcmd{\setaystylesection}[1]{\csxdef{gb at aystyle@section#1}{#1}}
-
-%
-%在AtBeginBibliography处已经无法重定义defbibenvironment{bibliographyay}
-%所以输出只能是用另外定义的环境来实现
-%可以在refsection后面做patch
-%为排序引入newrefcontext
-\apptocmd{\refsection}{
-\edef\gb at refsecnum{\number\c at refsection}%
-\ifcsdef{gb at aystyle@section\gb at refsecnum}%
-{
-\newrefcontext[sorting=gb7714-2015]
-
-\setlength{\bibhang}{1em}
-\setlength{\bibitemindent}{-\bibhang}
-\defbibenvironment{bibliography}
- {\list
- {}
- {\setlength{\leftmargin}{\bibhang}%
- \setlength{\itemindent}{\bibitemindent}%
- \setlength{\itemsep}{\bibitemsep}%
- \setlength{\parsep}{\bibparsep}}}
- {\endlist}
- {\item}
-}{}
-}{}{}
-
-%
-%为排序引入endrefcontext
-%
-\pretocmd{\endrefsection}{
-\edef\gb at refsecnum{\number\c at refsection}%
-\ifcsdef{gb at aystyle@section\gb at refsecnum}%
-{\endrefcontext}{}
-}{}{}
-
-%因为是整个文献表,在打印文献表的时候,增加钩子代码
-%因为下面的钩子是在defbibenvironment的begincode之后,所以对于defbibenvironment相关的设置都是无效的
-\AtBeginBibliography{
-
-\edef\gb at refsecnum{\number\c at refsection}%
-\ifcsdef{gb at aystyle@section\gb at refsecnum}%
-%\ifboolexpr{
-%not test {\ifcsundef{gb at aystyle@section\gb at refsecnum}}
-%and
-%test {\ifcsequal{gb at refsecnum}{gb at aystyle@section\gb at refsecnum}}
-%}
- {
-
- \DeclareDelimFormat{nameyeardelim}{\addcomma\space}
- \DeclareDelimFormat[bib,biblist]{nameyeardelim}{\addcomma\space}
-
- \renewbibmacro*{date}{%
- \iflabeldateisdate
- {}
- {\printdate}}%
-
- \renewbibmacro*{date+extradate}{%
- \iffieldundef{labelyear}
- {}
- {\printtext{%[parens]%这里去掉括号
- \iflabeldateisdate
- {\printdateextra}
- {\printlabeldateextra}}}}%
-
- \newbibmacro*{bbx:savehash}{%
- \savefield{fullhash}{\bbx at lasthash}}
-
- \newbibmacro*{bbx:dashcheck}[2]{}
-
- %注意这里当没有作者只有标题时在年份之前的标点是否需要标准并未涉及,所以未做处理。
- \renewbibmacro*{author}{%以前的date+extrayear变为date+extradate,所以对3.8以上版本重定义一下author
- \ifboolexpr{
- test \ifuseauthor
- and
- not test {\ifnameundef{author}}
- }
- {%
- \usebibmacro{bbx:savehash}%
- \printnames{author}%
- \iffieldundef{authortype}
- {\setunit{\printdelim{nameyeardelim}}}
- {\setunit{\printdelim{authortypedelim}}}%
- \iffieldundef{authortype}
- {}
- {\usebibmacro{authorstrg}%
- \setunit{\printdelim{nameyeardelim}}}
- }%
- {\global\undef\bbx at lasthash
- \usebibmacro{labeltitle}%
- \setunit*{\printdelim{nonameyeardelim}}}%
- \usebibmacro{date+extradate}}
-
- \newbibmacro*{labeltitle}{%
- \iffieldundef{label}
- {\iffieldundef{shorttitle}
- {\printfield{title}%
- \clearfield{title}}
- {\printfield[title]{shorttitle}}}
- {\printfield{label}}}
-
-%
-% 增加一个number带括号的格式,避免使用mkbibparens而引入一个不必要的空格
-%
-\DeclareFieldFormat{addnumflag}{%
-\nobreak\printtext{(}\nobreak #1\nobreak\printtext{)}}
-
-%
-% 调整journal输出
-%
-% 原理方法:首先判断子标题,然后再设置标点。
-% 避免直接设置标点后,当volume不存在时需要使用\nopuct去标点进而引入不必要的空格
-\renewbibmacro*{journal}{%
- \iffieldundef{journaltitle}%
- {}%
- {\printtext[journaltitle]{%
- \printfield[titlecase]{journaltitle}%
- \iffieldundef{journalsubtitle}{}{\setunit{\subtitlepunct}%
- \printfield[titlecase]{journalsubtitle}}}}}
-
-
-
-%
-% 调整期刊卷和期的格式
-%
-\renewbibmacro*{volume+number+eid}{%源来自standard.bbx
-\iftoggle{bbx:gbfieldstd}{%
- \printfield{volume}%
- \setunit*{\adddot}%
- \printfield{number}%
- \setunit{\addcomma\space}%
- \printfield{eid}}{%
- \printfield{volume}%
- %\setunit*{\adddot}%去掉点号
- %\printfield{number}%
- \iffieldundef{number}{}{\printfield[addnumflag]{number}}%区别于顺序编码制
- \iffieldundef{eid}{}{%
- \setunit{\addcomma\space}%
- \printfield{eid}}}}
-
-%
-% 调整期刊年份的格式
-%
-% 原理方法:原在authoryear.BBX中\bbx at opt@mergedate at compact中定义
-% 当issue存在时,才设置newunit。避免直接设置标点后,当volume不存在是需要使用\nopuct去标点进而引入不必要的空格
- \renewbibmacro*{issue+date}{%
- \iffieldundef{issue}%
- {}%
- {\iftoggle{bbx:gbstrict}{}{\printtext[parens]{\printfield{issue}}\newunit}}}
-
-%
-% 编者的符号修改一下
-% v1.0 2016-07-01
-% v1.0q 2019-03-01 hzz 修改editortype前的标点
-%
-\renewbibmacro*{editor}{%
- \ifboolexpr{
- test \ifuseeditor
- and
- not test {\ifnameundef{editor}}
- }
- {\usebibmacro{bbx:dashcheck}
- {%\bibnamedash
- \printnames{editor}%
- }
- {\printnames{editor}%
- %\setunit{\printdelim{editortypedelim}}%
- %\usebibmacro{bbx:savehash}
- }%
- \usebibmacro{editorstrg}%
- %\clearname{editor}%
- \setunit{\printdelim{nameyeardelim}}}%
- {\global\undef\bbx at lasthash
- \usebibmacro{labeltitle}%
- \setunit*{\printdelim{nonameyeardelim}}}%
- \ifboolexpr{%
- test {\ifentrytype{inbook}}
- or
- test {\ifentrytype{incollection}}
- or
- test {\ifentrytype{inproceedings}}
- or
- test {\ifentrytype{conference}}
- }%
- {}%
- {\usebibmacro{date+extradate}}}
-
-
- }{}
-
-
-
-}
-
-
-
-%
-%针对具体条目做处理时的特殊处理
-%
-%\def\localsetrefsectionstyle{%
-%}
-
-%\AtEveryBibitem{\localsetrefsectionstyle}%
-%\AtEveryCite{\localsetchinesecode}%
-%\AtEveryLositem{\localsetchinesecode}%
+%%
+%% ---------------------------------------------------------------
+%% biblatex-gb7714-2015 --- A biblatex implementation of the
+%% GBT7714-2015 bibliography style,numerical sequence and authoryear mixed style
+%% Maintained by huzhenzhen
+%% E-mail: hzzmail at 163.com
+%% Released under the LaTeX Project Public License v1.3c or later
+%% ---------------------------------------------------------------
+%%
+
+%
+% 版本和时间信息
+%
+\def\versionofgbtstyle{2021/01/19 v1.0w}
+\def\versionofbiblatex{\abx at version}
+\ProvidesFile{gb7714-2015mx.bbx}[\versionofgbtstyle biblatex bibliography style]
+%\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求
+
+%=====================================================================
+% 加载标准样式
+%=====================================================================
+\RequireBibliographyStyle{numeric-comp}
+\RequirePackage{xstring}%解决texlive2015的biblatex3.0不加载xstring包的问题
+
+
+%=====================================================================
+% 功能函数
+%=====================================================================
+ %
+ % 增加一个控制是否输出文献载体的选项
+ % 20191125,v1,0s,hzz
+ \newtoggle{bbx:gbmedium}
+ \DeclareBibliographyOption{gbmedium}[true]{%biblatex低版本
+ \settoggle{bbx:gbmedium}{#1}}
+ \ExecuteBibliographyOptions{gbmedium}
+ %
+ % 增加一个控制是否输出annotation域的选项,该域可以用于在文献条目后面输出一些注释信息
+ % 20190509,v1,0s,hzz
+ \newtoggle{bbx:gbannote}
+ \DeclareBibliographyOption{gbannote}[false]{%biblatex低版本
+ \settoggle{bbx:gbannote}{#1}}
+ \ExecuteBibliographyOptions{gbannote}
+ %
+ %用于在文献条目后面输出注释信息的宏
+ %FieldFormat{annotation}用于设置注释信息的格式
+ \DeclareFieldFormat{annotation}{%
+ \printtext{\addspace(#1)}%
+ }
+ \renewbibmacro*{annotation}{%
+ \iftoggle{bbx:gbannote}%
+ {\iffieldundef{annotation}%
+ {\printfile[annotation]{\bibannotationprefix\thefield{entrykey}.tex}}%
+ {\printfield{annotation}}}%
+ {}%
+ }
+
+
+ %
+ % biblatex版本判断
+ % 20180629,v1.0k,hzz
+ %
+ % 原理方法:适用于3.10以上版本的biblatex,否则给出警告
+ \@ifpackagelater{biblatex}{2017/12/28}{}{
+ \blx at warning@noline{%
+ biblatex version is too old for this style\MessageBreak
+ if errors raised,Please update biblatex to the latest version.}
+ }
+
+ %
+ % 判断CJK字符的函数,用于判断作者等信息是否由中文字符构成
+ % v1.0k,20180509,hzz
+ %
+ % 原理方法:用biber中的perl方法代替。因为利用tex函数对字符判断时,当字符在宏
+ % 中时,基于`的方法无法解决GBK编码的问题,基于CJKsymbol的方法无法解决utf-8
+ % 编码用xelatex编译的问题。
+ %
+ % 原理是:利用perl正则将中文标识记录到域中,
+ % 然后利用\iffieldundef和\iffieldequalstr进行判断
+ \providetoggle{ifCJKforgbt}
+ \def\testCJKfirst#1{%
+ \iffieldundef{#1}{\togglefalse{ifCJKforgbt}}{%
+ \iffieldequalstr{#1}{chinese}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}}}
+
+ %
+ % 2个卷的解析函数,用于连续出版物
+ %
+ % 原理方法: 范围起止间隔符号还是用-,而不是与date相同的/,因为有合期期刊的问题,需要用到/符号
+ \newcommand{\multivolparser}[1]{%
+ \IfSubStr{#1}{-}%
+ {\StrBefore{#1}{-}[\multivolfirst]\StrBehind{#1}{-}[\multivolsecond]}%
+ {\def\multivolfirst{#1}\def\multivolsecond{}}%
+ }
+
+
+ %
+ % 2个期的解析函数,用于连续出版物
+ %
+ \newcommand{\multinumberparser}[1]{%
+ \IfSubStr{#1}{-}%
+ {\StrBefore{#1}{-}[\multinumberfirst]\StrBehind{#1}{-}[\multinumbersecond]}%
+ {\def\multinumberfirst{#1}\def\multinumbersecond{}}%
+ }
+
+%=====================================================================
+% 数据模型定义
+%=====================================================================
+ %定义类型和载体标识,从gb内容看载体基本属于介质。
+ %为与lee zeping的bst的样式统一,使用mark和medium这两域名
+ %为单个条目的姓名格式控制增加nameformat和namefmtid两个域
+ %为缩略信息文献表增加了shortbooktitle域
+ %为多语言排序增加了lansortorder域
+ \DeclareDatamodelFields[type=field,datatype=literal]{mark,medium,nameformat}
+ \DeclareDatamodelFields[type=field,datatype=integer]{namefmtid}
+ \DeclareDatamodelFields[type=field,datatype=literal]{shortbooktitle}
+ \DeclareDatamodelFields[type=field,datatype=literal]{lansortorder}
+ %为多样式文献表增加的stylesections、styleaysection域:
+ \DeclareDatamodelFields[type=field,datatype=integer]{aysections}
+ \DeclareDatamodelFields[type=field,datatype=literal]{styleaysection}
+
+ %因为biblatex更新3.14版本以后,biber对于为声明数据模型的条目类型
+ %不再默认读取,而是以空字符串作为条目类型名,自然在条目定义alias时
+ %就会出现问题,因此显式的声明一下newspaper,然后保留后面采用alias的方式
+ %而standard类型则是采用另一种方式直接在sourcemap中转换为其它类型。
+ \@ifpackagelater{biblatex}{2019/11/30}{%2019/12/01 v3.14
+ \DeclareDatamodelEntrytypes{newspaper}%
+ }{}
+
+
+
+%=====================================================================
+% 设置宏包选项
+%=====================================================================
+ %
+ % 增加一个控制是否输出type域的选项
+ % 20190212,v1,0q,hzz
+ \newtoggle{bbx:gbfieldtype}
+ \DeclareBibliographyOption{gbfieldtype}[false]{%biblatex低版本
+ \settoggle{bbx:gbfieldtype}{#1}}
+ \ExecuteBibliographyOptions{gbfieldtype}
+
+ %
+ % 增加一个控制是否根据页码重设脚注数字标号的选项
+ % 20190422,v1,0r,hzz
+ \newtoggle{bbx:gbfnperpage}
+ \DeclareBibliographyOption{gbfnperpage}[false]{%
+ \settoggle{bbx:gbfnperpage}{#1}}
+ \ExecuteBibliographyOptions{gbfnperpage}
+
+ %
+ % 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表
+ % 20190203,v1.0p,hzz
+ % 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签
+ % 当前面的脚注中已经存在当前文献,那么当前文献内容不再输出而用同(4)这样的方式
+ % 需要注意的是由于小页环境和表格中的脚注本身的问题,可能会有一些问题
+ \DeclareBibliographyOption{gbfootbib}[false]{%
+ \ifstrequal{#1}{false}{}{\execgbfootbib}}
+ \ExecuteBibliographyOptions{gbfootbib}
+
+ %%
+ \newlength{\footbibmargin}
+ \newlength{\footbiblabelsep}
+ \setlength{\footbibmargin}{1em}%脚注的段落左侧缩进距离
+ \setlength{\footbiblabelsep}{0.5em}%脚注中标记号与脚注段落的间距
+ \def\execgbfootbib%
+ {%
+ %开启引用跟踪计数器,为使用\ifciteseen等测试命令
+ \ExecuteBibliographyOptions{citetracker=true}
+ %
+ %利用footmisc宏包来实现脚注文献的悬挂对齐
+ \AtEndPreamble{
+ \@ifclassloaded{beamer}{}{
+ %beamer类因为其特殊性,为避免冲突不调footmisc。
+ %同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接
+ %如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。
+ %\PassOptionsToPackage{perpage,hang}{footmisc}%
+ %\RequirePackage{footmisc}%
+
+ %重新实现脚注的根据单页重设脚注号码
+ %重新实现脚注的悬挂对齐问题,不再使用footmisc,直接从latex核心代码和hyperref代码进行修改
+ %v1.0q 20190317 hzz
+ %v1.0r 20190422 hzz 根据gbfnperpage选项设置
+ \iftoggle{bbx:gbfnperpage}%
+ {\@addtoreset{footnote}{page}}{}%重设计数器
+
+ \@ifpackageloaded{hyperref}{%加载hyperref则对\H@@footnotetext做重定义
+ \long\def\H@@footnotetext##1{\insert\footins{%
+ \reset at font\footnotesize
+ \interlinepenalty\interfootnotelinepenalty
+ \splittopskip\footnotesep
+ \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
+ \hsize\columnwidth \@parboxrestore
+ \protected at edef\@currentlabel{%
+ \csname p at footnote\endcsname\@thefnmark
+ }%
+ \color at begingroup
+ \leftskip \footbibmargin%增加的左侧缩进
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox%
+ }%
+ \color at endgroup}}%
+
+ \long\def\H@@mpfootnotetext##1{%
+ \global\setbox\@mpfootins\vbox{%
+ \unvbox\@mpfootins
+ \reset at font\footnotesize
+ \hsize\columnwidth
+ \@parboxrestore
+ \protected at edef\@currentlabel
+ {\csname p at mpfootnote\endcsname\@thefnmark}%
+ \leftskip \footbibmargin%增加的左侧缩进
+ \color at begingroup
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}%
+ \color at endgroup}}
+ }{%否则对latex核心代码中的\@footnotetext做重定义
+ \long\def\@footnotetext##1{\insert\footins{%
+ \reset at font\footnotesize
+ \interlinepenalty\interfootnotelinepenalty
+ \splittopskip\footnotesep
+ \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
+ \hsize\columnwidth \@parboxrestore
+ \protected at edef\@currentlabel{%
+ \csname p at footnote\endcsname\@thefnmark
+ }%
+ \color at begingroup
+ \leftskip \footbibmargin%增加的左侧缩进
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox%
+ }%
+ \color at endgroup}}%
+
+ \long\def\@mpfootnotetext##1{%
+ \global\setbox\@mpfootins\vbox{%
+ \unvbox\@mpfootins
+ \reset at font\footnotesize
+ \hsize\columnwidth
+ \@parboxrestore
+ \protected at edef\@currentlabel
+ {\csname p at mpfootnote\endcsname\@thefnmark}%
+ \leftskip \footbibmargin%增加的左侧缩进
+ \color at begingroup
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}%
+ \color at endgroup}}
+ }
+
+ \long\def\@makefntext##1{%增加了脚注标记与正文的间隔
+ \parindent 1em\noindent \hb at xt@ 0em{\hss \@makefnmark\makebox[\footbiblabelsep]{}}##1}
+
+ }
+
+ %
+ %使脚注标记加圈并设置数字的字体为tiny,不使用修改thefootnote的方式
+ \def\@makefnmark{\hbox{\@textsuperscript{\textcircled{\tiny\@thefnmark}}}}
+ %做patch使得脚注内容中的脚注数字标签不上标
+ \pretocmd{\@makefntext}{%
+ \def\@makefnmark{%
+ \hbox{\textcircled{\tiny\@thefnmark}}%
+ }%
+ }{}{}
+ }
+
+ %
+ %判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容)
+ %记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。
+ %v1.0q 20190309 区分使脚注标注适应minipage中的情况
+ \newbibmacro*{citesavefn}{%
+ \ifciteseen%当被引用过为true
+ {\ifcsdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%当已经定义过脚注序号信息
+ {\csgdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{%
+ \str at sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}%
+ \@makefnmark%
+ }}%
+ {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{%
+ \ifcsstring{@mpfn}{mpfootnote}{\@alph\c at mpfootnote}{\thefootnote}%
+ }}%
+ }%
+ {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{%
+ \ifcsstring{@mpfn}{mpfootnote}{\@alph\c at mpfootnote}{\thefootnote}%
+ %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断
+ }}%
+ }
+
+ %
+ %重定义\footfullcite使完成gb7714-2015的脚注文献要求
+ \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]%
+ {\defcounter{maxnames}{\blx at maxbibnames}%局部定义maxnames和minnames计数器
+ \defcounter{minnames}{\blx at minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。
+ \usebibmacro{prenote}%
+ \renewbibmacro*{postnote}{%
+ \iffieldundef{postnote}%
+ {}{\setunit{\addcolon\addspace}\printtext{\thefield{postnote}}}}%由于ay样式中没有修改postnote域,此处因为格式需要不使用默认域格式
+ }%
+ {\usebibmacro{citesavefn}%
+ \ifcsdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%
+ {\csuse{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}%\nopunct
+ {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}%
+ }%
+ {\multicitedelim}%
+ {\usebibmacro{postnote}}
+
+ }
+
+ %
+ % 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式
+ % 20180814,v1.0m,hzz
+ % 原理方法:
+ % 只为兼容性考虑不做任何处理
+ \DeclareBibliographyOption{gbstyle}[true]{%biblatex低版本
+ }
+
+ %
+ % 增加一个控制是否输出文献类型和载体标识的选项
+ %
+ % 原理方法:
+ % 对于biblatex3.4以上版本DeclareBibliographyOption命令中的[datatype]如果是boolean,那么是可以省略的
+ % 所以用老版本的不用[datatype]的命令可以兼容所有biblatex版本
+ \newtoggle{bbx:gbtype}
+ %\DeclareBibliographyOption[boolean]{gbtype}[true]{%biblatex高版本
+ \DeclareBibliographyOption{gbtype}[true]{%biblatex低版本
+ \settoggle{bbx:gbtype}{#1}}
+ \ExecuteBibliographyOptions{gbtype}
+
+ %
+ % 增加一个源文件编码选择选项,当true时可以使用GBK编码。
+ % v1.0k, 2018.05.08, by hzz
+ %
+ % 原理方法:将需要输出的中文字符串用命令形式表示存储,采用utf8编码时采用bbx文档
+ % 内的定义即是utf8编码的中文字符串,但tex源文件是gbk编码时,利用gb7714-2015-gbk.def
+ % 文档内的gbk编码的字符串覆盖。这种覆盖只能在宏包末尾加载时成功实现,所以使用
+ % AtEndOfPackage。该解决思路源自biblatex-caspervector宏包。
+ % 另外注意:
+ % gbk编码的tex文档,利用pdflatex/latex能正确编译,利用xelatex能编译,但中文显示乱码
+ % 在源文档前面增加 XeTeX 原语:\XeTeXinputencoding "GBK" 后,显示正常
+ % utf-8编码的tex文档,利用xelatex能正确编译,而pdflatex/latex不能编译。
+ \newtoggle{bbx:codegbk}
+ \DeclareBibliographyOption{gbcodegbk}[false]{%
+ \settoggle{bbx:codegbk}{#1}}
+ \ExecuteBibliographyOptions{gbcodegbk}
+
+ \def\str at bibliography{参考文献}
+ \def\str at references{参考文献}
+ \def\str at bytranslator{译}
+ \def\str at andotherscn{等}
+ \def\str at backrefpage{引用页}
+ \def\str at backrefpages{引用页}
+ \def\str at noaddress{出版地不详}
+ \def\str at nopublisher{出版者不详}
+ \def\str at edition{版}
+ \def\str at volumecn{卷}
+ \def\str at numbercn{册}
+ \def\str at serialcn{第}
+ \def\str at sameentry{同}
+ \def\str at incn{见}
+ \def\str at mathesiscn{硕士学位论文}
+ \def\str at phdthesiscn{博士学位论文}
+ \def\str at editorcn{主编}
+
+ \AtEndOfPackage{%
+ \iftoggle{bbx:codegbk}{%
+ \ExecuteBibliographyOptions{texencoding = GBK}
+ \input{gb7714-2015-gbk.def}
+ }{}}
+
+ %
+ % 增加一个严格按GB/T 7714-2015给出著录格式控制域的输出的选项
+ % v1.0k, 2018.05.08, by hzz
+ %
+ % 原理方法:
+ % 默认设置该选项为真,进而不输出GB/T 7714-2015中没有的域的信息
+ % 这样可以避免因为bib文件带有多余的域的信息的输出,比如因为bibtex样式
+ % 可能需要用于中英文判断的language域的信息。
+ \newtoggle{bbx:gbstrict}
+ \DeclareBibliographyOption{gbstrict}[true]{%
+ \settoggle{bbx:gbstrict}{#1}}
+ \ExecuteBibliographyOptions{gbstrict}
+
+ %
+ % 增加一个控制标题域超链接设置的选项
+ % v1.0k, 2018.05.24, by hzz
+ %
+ % 原理方法:
+ % 利用标题域格式来实现,默认设置该选项为false,不做超链接。
+ % 设置为true,则标题设置超链接
+ \newtoggle{bbx:titlelink}
+ \DeclareBibliographyOption{gbtitlelink}[false]{%
+ \settoggle{bbx:titlelink}{#1}}
+ \ExecuteBibliographyOptions{gbtitlelink}
+
+ %
+ % 增加一个控制参考文献标题是否能够被ctex宏包设置的选项
+ % v1.0l, 2018.07.02, by hzz
+ %
+ % 原理方法:
+ % 重定义biblatex的宏,去除使用本地化字符串的方式,是的可以利用ctexset进行设置
+ \newtoggle{bbx:ctexset}
+ \DeclareBibliographyOption{gbctexset}[true]{%
+ \settoggle{bbx:ctexset}{#1}}
+ \ExecuteBibliographyOptions{gbctexset}
+
+ \AtEndOfPackage{%
+ \iftoggle{bbx:ctexset}{%
+ \def\blx at defbibstrings#1#2{%
+ \def\do##1{\csundef{abx at lstr@##1}\csundef{abx at sstr@##1}}%
+ \abx at dostrings
+ \csuse{abx at strings@#1}%
+ \setkeys{blx at lbx}{#2}%
+ \let\do\blx at defbibstrings@i
+ \csxdef{abx at strings@#1}{\abx at dostrings}%
+ }
+ }{}}
+
+
+
+ %
+ % 增加一个恢复域格式为标准样式的控制选项
+ % v1.0k, 2018.05.15, by hzz
+ %
+ % 原理方法:
+ % 默认设置该选项为false,采用国标要求的域格式输出相关域
+ % 当设置该选项为true时,则重新利用标准样式的域格式输出相关的域
+ \newtoggle{bbx:gbfieldstd}
+ \DeclareBibliographyOption{gbfieldstd}[false]{%
+ \settoggle{bbx:gbfieldstd}{#1}%
+ \ifstrequal{#1}{false}{}{\execgbfdfmtstd}%
+ }
+ \ExecuteBibliographyOptions{gbfieldstd}
+
+ %
+ % 增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。
+ %
+ \newtoggle{bbx:gbpub}
+ \DeclareBibliographyOption{gbpub}[true]{%
+ %\settoggle{bbx:gbpub}{#1} %或采用下面这一句
+ \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}}
+ \ExecuteBibliographyOptions{gbpub}
+
+ %
+ % 增加控制析出文献来源前的标点符号//输出的选项
+ % v1.0k, 2018.04.20,added in by hzz
+ \newtoggle{bbx:gbpunctin}
+ \DeclareBibliographyOption{gbpunctin}[true]{%
+ \settoggle{bbx:gbpunctin}{#1}}
+ \ExecuteBibliographyOptions{gbpunctin}
+
+
+ %
+ % 增加一个处理佚名或noauthor的控制选项
+ %
+ % 原理方法:顺序编码制中与作者年制都使用
+ \DeclareBibliographyOption{gbnoauthor}[true]{%
+ \ifstrequal{#1}{false}{}{\dealnoathor}}
+ %\ExecuteBibliographyOptions{gbnoauthor=true}%对于需要展开较早(展开层级优先)的选项,这一执行无效,只能用宏包加载时给出的选项。
+
+
+
+
+ %
+ % 选项设置
+ %
+ \ExecuteBibliographyOptions{
+ sorting=none,
+ useprefix=true, %名字的信息包括前缀
+ date = year, %日期仅写到年
+ maxbibnames = 3,%设置名字最大数量
+ minbibnames = 3, %设置缩减后的名字最小数量
+ maxitems = 1,%设置列表最大数量
+ minitems = 1, %设置缩减后的列表最小数量
+ isbn=false,
+ sortlocale=zh__pinyin,%zh__big5han,%zh__stroke,%zh__gb2312han,%zh__pinyin,
+ }
+
+ %
+ %为日期相关选项增加选项值gb7714-2015
+ %
+ \csdef{mkdaterangegb7714-2015}#1{%
+ \begingroup
+ \blx at metadateinfo{#1}%
+ \iffieldundef{#1year}
+ {}
+ {\printtext[#1date]{%
+ \blx at gbdate{#1}{}}}%
+ \endgroup}
+
+ \newrobustcmd*{\blx at gbdate}[3][]{%
+ \dateeraprintpre{#2#3year}%
+ \blx at imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}%
+ \iffieldundef{#2#3month}{}{\hyphen\blx at imc@forcezerosmdt{\thefield{#2#3month}}}%
+ \iffieldundef{#2#3day}{}{\hyphen\blx at imc@forcezerosmdt{\thefield{#2#3day}}}}
+
+
+ %为姓名格式选择增加的计数器
+ \newcounter{gbnamefmtcase}
+ \def\thegbnamefmtcase{\the\c at gbnamefmtcase}
+ %为数字标签格式选择增加的计数器/命令
+ \newcommand{\mkgbnumlabel}[1]{\mkbibbrackets{#1}}
+ \def\gbbiblabelopt at bracket{\renewcommand{\mkgbnumlabel}[1]{\mkbibbrackets{##1}}}
+ \def\gbbiblabelopt at parens{\renewcommand{\mkgbnumlabel}[1]{\mkbibparens{##1}}}
+ \def\gbbiblabelopt at dot{\renewcommand{\mkgbnumlabel}[1]{##1\adddot}}
+ \def\gbbiblabelopt at plain{\renewcommand{\mkgbnumlabel}[1]{##1}}
+ \def\gbbiblabelopt at box{\renewcommand{\mkgbnumlabel}[1]{\framebox{##1}}}
+ \def\gbbiblabelopt at circle{\renewcommand{\mkgbnumlabel}[1]{\textcircled{##1}}}
+ %为文献表中数字标签对齐方式选择增加的计数器/命令
+ \newcounter{gbalignlabel}
+ \def\thegbalignlabel{\the\c at gbalignlabel}
+ %为引用标签标注/文献表中本地化字符串中英文选择增加的计数器/命令
+ \newcounter{gbcitelocalcase}
+ \newcounter{gbbiblocalcase}
+ \def\thegbcitelocalcase{\the\c at gbcitelocalcase}
+ \def\thegbbiblocalcase{\the\c at gbbiblocalcase}
+
+
+ %
+ % 增加不同语言排序的切换选项,numeric样式,不使用该选项
+ % gblanorder=chineseahead的顺序为cn,jp,kr,en,fr,ru
+ % gblanorder=englishahead的顺序为en,fr,ru,cn,jp,kr
+ % gblanorder=cn;en;ru;fr;jp;kr的顺序为指定的cn;en;ru;fr;jp;kr,自定义内容可以随意写以分号分隔
+ % v1.0q,20190307,hzz
+ %
+ \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{%
+ \ifstrequal{#1}{chineseahead}%%中文在前的顺序
+ {\gdef\lancnorder{1}\gdef\lanjporder{2}\gdef\lankrorder{3}%
+ \gdef\lanenorder{4}\gdef\lanfrorder{5}\gdef\lanruorder{6}}%
+ {%
+ \ifstrequal{#1}{englishahead}%
+ {\execlanodeah\dealsortlan}%
+ {\execlanodudf{#1}\dealsortlan}%
+ }%
+ }
+ \ExecuteBibliographyOptions{gblanorder}
+
+ \def\execlanodeah{%中文在后的顺序
+ \gdef\lancnorder{4}
+ \gdef\lanjporder{5}
+ \gdef\lankrorder{6}
+ \gdef\lanenorder{1}
+ \gdef\lanfrorder{2}
+ \gdef\lanruorder{3}}
+
+ \newcounter{lanordernum}
+ \newcommand{\execlanodudf}[1]{%like:cn;en;ru;fr;jp;kr
+ \setcounter{lanordernum}{0}
+ \DeclareListParser{\parsinglanorder}{;}
+ \renewcommand*{\do}[1]{\stepcounter{lanordernum}\csxdef{lan##1order}{\thelanordernum}}
+ \parsinglanorder{#1}
+ }
+
+ %
+ % 增加本地化字符串的中英文切换选项
+ % gbcitelocal指标注中的本地化字符串
+ % gbbiblocal 指文献表中的本地化字符串
+ % gblocal 指设置文献表和标注中的本地化字符串
+ % v1.0o,20190103,hzz
+ %
+ \DeclareBibliographyOption[string]{gbcitelocal}[gb7714-2015]{%
+ \ifstrequal{#1}{gb7714-2015}{\setcounter{gbcitelocalcase}{0}}{}%
+ \ifstrequal{#1}{chinese}{\setcounter{gbcitelocalcase}{1}}{}%
+ \ifstrequal{#1}{english}{\setcounter{gbcitelocalcase}{2}}{}%
+ }
+ \ExecuteBibliographyOptions{gbcitelocal}
+
+ \DeclareBibliographyOption[string]{gbbiblocal}[gb7714-2015]{%
+ \ifstrequal{#1}{gb7714-2015}{\setcounter{gbbiblocalcase}{0}}{}%
+ \ifstrequal{#1}{chinese}{\setcounter{gbbiblocalcase}{1}}{}%
+ \ifstrequal{#1}{english}{\setcounter{gbbiblocalcase}{2}}{}%
+ }
+ \ExecuteBibliographyOptions{gbbiblocal}
+
+ \DeclareBibliographyOption[string]{gblocal}[gb7714-2015]{%
+ \ExecuteBibliographyOptions{gbbiblocal=#1}%
+ \ExecuteBibliographyOptions{gbcitelocal=#1}%
+ }
+ %\ExecuteBibliographyOptions{gblocal} %默认值已经通过两个相关选项设置
+
+ %
+ % 增加序号标签格式处理选项
+ % v1.0l,20180623,hzz
+ %
+ \DeclareBibliographyOption[string]{gbbiblabel}[bracket]{%
+ \csuse{gbbiblabelopt@#1}
+ }
+ \ExecuteBibliographyOptions{gbbiblabel}
+
+ %
+ % 增加姓名大小写格式处理选项
+ %
+ \DeclareBibliographyOption[string]{gbnamefmt}[uppercase]{%
+ \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}%
+ \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}%
+ \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family
+ \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{}
+ \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given
+ \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family
+ }
+ \ExecuteBibliographyOptions{gbnamefmt}
+
+ %
+ % 增加标签对齐选项
+ %
+ % right是默认的右对齐,left是左对齐,gb7714-2015是项对齐方式
+ \DeclareBibliographyOption[string]{gbalign}[right]{%
+ \ifstrequal{#1}{right}{\setcounter{gbalignlabel}{0}}{}
+ \ifstrequal{#1}{left}{\setcounter{gbalignlabel}{1}}{}
+ \ifstrequal{#1}{center}{\setcounter{gbalignlabel}{2}}{}
+ \ifstrequal{#1}{gb7714-2015}{\setaligngbstyle}{}
+ }
+
+ \ExecuteBibliographyOptions{
+ giveninits=true,
+ urldate =gb7714-2015, %iso,iso8601,edtf
+ eventdate =gb7714-2015,
+ labeldateparts=true,
+ }
+
+%
+% 针对3.13<=biblatex版本的选项设置,因为内容有限,所以不做版本区分,而用时间直接判断
+%
+% 解决国标中“王临慧, 2010a.”和“王临慧, 等, 2010b.”的问题
+% 在没有这个选项之前无法加上a和b
+% v1.0s,20190828
+\@ifpackagelater{biblatex}{2019/08/16}{%
+ \ExecuteBibliographyOptions{%
+ nohashothers=true}}{}
+
+%=====================================================================
+% 设置本地化字符串
+%=====================================================================
+ %
+ % 新建当地化字符串,用来记录“等”字符、“和”字符
+ %
+ \NewBibliographyString{andotherscn}
+ \NewBibliographyString{andothersincitecn}
+ \NewBibliographyString{andothersincite}
+ \NewBibliographyString{andcn}
+ \NewBibliographyString{andothersjp}
+ \NewBibliographyString{andotherskr}
+ \NewBibliographyString{andjp}
+ \NewBibliographyString{andkr}
+ \NewBibliographyString{andincitecn}
+ \NewBibliographyString{andincite}
+ \NewBibliographyString{volumecn}
+ \NewBibliographyString{numbercn}
+ \NewBibliographyString{serialcn}
+ \NewBibliographyString{incn}
+ \NewBibliographyString{mathesiscn}
+ \NewBibliographyString{phdthesiscn}
+ \NewBibliographyString{editorcn}
+ \NewBibliographyString{editorscn}
+
+
+
+ %
+ % 修改一些当地化字符串
+ %
+ % 原理方法:直接利用当地化格式english修改出一些中文的格式,具体修改内容参考english.lbx文件
+ % 当然也可以增加比如上面定义的andotherscn
+ % 注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别
+
+ \DefineBibliographyStrings{english}{
+ bibliography = {\str at bibliography},
+ references = {\str at references},
+ bytranslator= {\str at bytranslator},%\addperiod,%将trans. by 改成 译\addcomma\
+ and = {\addcomma},%将第2和3人名间的and符号改成逗号,用\finalnamedelim命令也可以定义,参见3.9.1节
+ andcn = {\addcomma},%and本地化字符串的中文对应词
+ andincitecn = {\addcomma},%将标注中的分开,便于与文献表中的区分
+ andincite = {\addcomma},
+ %andothers = {et al.},%将超过3个人名的省略,et al.改成为 等
+ andotherscn = {\str at andotherscn},%将超过3个人名的省略,et al.改成为 等
+ andothersincitecn={\str at andotherscn},%将标注中的分开,便于与文献表中的区分
+ andothersincite={et al\adddot},
+ backrefpage = {\str at backrefpage:},
+ backrefpages = {\str at backrefpages:},
+ in={in\intitlepunct},
+ volumecn={\str at volumecn},
+ numbercn={\str at numbercn},
+ serialcn={\str at serialcn},
+ andothersjp={他},
+ andotherskr={외},
+ andjp={和},
+ andkr={和},
+ incn={\str at incn\addcolon\addspace},
+ mathesiscn={\str at mathesiscn},
+ phdthesiscn={\str at phdthesiscn},
+ editorscn={\str at editorcn},
+ editorcn={\str at editorcn},
+}
+
+ %
+ % 增加两个命令用于临时的局部的修改本地化字符串
+ % 其中\setlocalbibstring修改缩写字符串,setlocalbiblstring修改长字符串
+ % 注意使用时因为是局部修改,因此要将其与需要修改的引用命令放在一个编组符号内
+ % v1.0t,hzz,20190525
+ \newcommand{\setlocalbibstring}[2]{%
+ \csdef{abx at sstr@#1}{#2}}
+ \newcommand{\setlocalbiblstring}[2]{%
+ \csdef{abx at lstr@#1}{#2}}
+
+%=====================================================================
+% 动态数据修改
+%=====================================================================
+%
+% 各层次的数据映射和动态修改
+%
+% 原理方法:
+% 1. 进行语言包括中英文判断,并设置和记录,比如记录到userf,usere中
+% 2. 增加文献标识符如[M],[J]等,对一些容易混淆的域进行设置以增强兼容性
+% 3. \DeclareSourcemap命令对于biblatex3.11以下版本只能出现一次,3.11版开始支持多个
+% 4. \DeclarestyleSourcemap在biblatex v3.7版开始可以支持出现多次
+% 5. 把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。
+% 注意:这里用userf,usere而不是namee,namef,是因为只有把name列表转成域,才能有效读取姓名中的字符,
+% 如果用namee,namef,name信息会自动解析,所以就不能为cjk判断提供需要的信息
+%
+% 不同的文献类型使用相同的驱动输出可以有5种方法:
+% 1. 是数据源层的映射,将其它类型转换为某一要使用驱动的类型
+% 2. 是样式层映射,也是将其它类型转换为某一要使用驱动的类型
+% 3. 是驱动层映射,也是将其它类型转换为某一要使用驱动的类型
+% 4. 定义驱动类型别名DeclareBibliographyAlias,将其它类型定义为某一要使用驱动的类型的别名
+% 驱动别名定义本质上是做了驱动层映射
+% 5. 直接定义不同的类型的驱动,但驱动内容相同。
+%
+% 关于数据映射和驱动使用的考虑如下:
+% 1. 为避免利用biber输出bib文件时的数据变动,尽量不在数据源层映射做类型转换
+% 2. 为减少代码量,尽量少做内容相同的不同类型驱动
+% 3. 因此类型相关的处理主要在样式层映射、驱动层映射、驱动别名
+% 4. 由于biblatex默认做的驱动别名处理可能增加一些信息比如masterthesis转thesis时增加的type
+% 可以在样式层映射做某些需要避免这种默认处置的转换
+% 5. 当没有避免默认行为的需求时,全部采用驱动别名的方式处理,等价于驱动层的映射
+%
+% 文献类型和驱动考虑如下:
+% 1. 连续出版物及析出文献有其特殊性,因此考虑两类periodical和article
+% newpaper映射为article,并以note域做区分特殊处理
+% 2. 专著和专著中的析出文献是主要的类型,因此考虑book和inbook
+% standard映射为book或inbook,并以note域做区分特殊处理
+% collection和proceedings基本与book类似,因此做book驱动别名处理
+% incollection和inproceedings基本与inbook类似,因此做inbook驱动别名处理
+% 3. 专利类型有其特殊性,考虑patent类型
+% 4. 电子资源类型有其特殊性,考虑online类型
+% 5. 报告类型与book有点类似,出版项处理与book一样,但有时又要有修改和更新日期
+% 因此考虑用一种类型来输出,使用report类型
+% 6. 手册/学位论文等类型与book有点类似,但对于出版项处理时,有缺省时,直接省略,
+% 同时有version和edition的区别,因此考虑用一种类型来输出,使用manual类型
+% 7. 包括报告,学位论文在内的其它所有的类型,都做一个判断,当没有出版项时,
+% 且存在网址信息时,将其转换为online类型输出,否则都做为manual类型输出。
+% 8. 备选类型misc当存在网址时直接转换为online,由于howpublished域可用于描述
+% 更多的信息,因此不存在网址时,独立做一个备选格式
+% 9. 出版项主要以如下方式处理:
+% (a) location+institution+date 仅用于连续出版物
+% (b)publisher+location+date 用于需要完整输出出版项的类型,比如book,collection,proceedings,in*,report
+% (c)institution+location+date 用于出版项缺失时不输出的类型,包括manual,thesis,archive等其他类型
+% (d)printlist{insitution} 用于电子资源,仅输出出版者或组织,为数据映射方便,本来默认的organization域转换为用insitution输出。
+% (e) 不输出,主要用于连续出版物析出的文献
+% 10. 日期以如下方式处理:
+% date 由于存在biblatex选项,因此通过选项控制,数据源为date解析数据或year
+% urldate 由于存在biblatex选项,因此通过选项控制,输出到日,且用[]包围,数据源为urldate
+% newsdate 用于公告日期,公开日期或新闻日期,输出到日,但无包围符号,数据源为date
+% modifydate 用于更新或修改日期,输出到日,且用()包围,数据源为date或enddate或eventdate
+
+
+\DeclareSourcemap{
+\maps[datatype=bibtex]{%
+ \map{%当没有作者时将editor转成author
+ \pernottype{inbook}%因为in系列中editor可能用来表示bookauthor,所以排除
+ \pernottype{inproceedings}
+ \pernottype{incollection}
+ \pernottype{periodical}%因为peridical直接使用editor,所以排除
+ %注意notfield在低版本biblatex中没有
+ %\step[notfield=author,final]%当author不存在,将editor复制给author
+ \step[fieldsource=editor,fieldtarget=author]%并删除editor
+ }
+ \map{%当没有作者时将translator转成author
+ \pernottype{inbook}
+ \pernottype{inproceedings}
+ \pernottype{incollection}
+ %\step[notfield=author,final]%当author不存在,将translator复制给author
+ \step[fieldsource=translator,fieldtarget=author]%并删除translator
+ }
+ \map{%让address和location同步,biblatex中address是location的别名
+ %因此输出的时候只有location信息,但处理过程中是可以存在address的。
+ %\step[notfield=address,final]
+ \step[fieldsource=location,final]
+ \step[fieldset=address,origfieldval]
+ }
+ \map{%让address和location同步
+ %\step[notfield=location,final]
+ \step[fieldsource=address,final]
+ \step[fieldset=location,origfieldval]
+ }
+ \map{%处理在bib文件用mark标记文献类型标识符的情况
+ \step[fieldsource=mark,final]
+ \step[fieldset=usera, origfieldval]
+ }
+ \map{%处理在bib文件中直接给出文献的姓名格式为lowercase的情况
+ \step[fieldsource=nameformat,match=lowercase,final]
+ \step[fieldset=namefmtid,fieldvalue={1}]
+ }
+ \map{%处理在bib文件中直接给出文献的姓名格式为givenahead的情况
+ \step[fieldsource=nameformat,match=givenahead,final]
+ \step[fieldset=namefmtid,fieldvalue={2}]
+ }
+ \map{%处理在bib文件中直接给出文献的姓名格式为familyahead的情况
+ \step[fieldsource=nameformat,match=familyahead,final]
+ \step[fieldset=namefmtid,fieldvalue={3}]
+ }
+ \map{%处理在bib文件中直接给出文献的姓名格式为pinyin的情况
+ \step[fieldsource=nameformat,match=pinyin,final]
+ \step[fieldset=namefmtid,fieldvalue={4}]
+ }
+ \map{%根据article确定文献类型标识符
+ \pertype{article}
+ \step[fieldset=usera, fieldvalue={J}]
+ }
+ \map{%根据periodical确定文献类型标识符
+ \pertype{periodical}
+ \step[fieldset=usera, fieldvalue={J}]
+ \step[fieldsource=author] %有时会把author和editor混淆,处理后使用editor
+ \step[fieldset=editor, origfieldval]
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{%根据增加一个新闻报纸的类型newspaper确定文献类型标识符
+ \pertype{newspaper}
+ \step[fieldset=usera, fieldvalue={N}]
+ \step[fieldset=note, fieldvalue=news]%因为没有专门的驱动,记录note方便映射为article后判断
+ }
+ \map{%对应增加的一个数据库类型database确定文献类型标识符
+ \pertype{database}
+ \step[fieldset=usera, fieldvalue={DB}]
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{%对应增加的一个数据集类型dataset确定文献类型标识符
+ \pertype{dataset}
+ \step[fieldset=usera, fieldvalue={DS}]%
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{%对应增加的一个软件类型software确定文献类型标识符
+ \pertype{software}
+ \step[fieldset=usera, fieldvalue={CP}]
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{%对应增加的一个舆图类型map确定文献类型标识符
+ \pertype{map}
+ \step[fieldset=usera, fieldvalue={CM}]%
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{%对应增加的一个档案类型archive确定文献类型标识符
+ \pertype{archive}
+ \step[fieldset=usera, fieldvalue={A}]
+ \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{%因为misc类型本身就是没有类型,而不像其它文献有明确的类型,所以
+ %当misc类型带有网址时,直接将其转换为online类型
+ \pertype{misc}
+ \step[fieldsource=url,final]
+ \step[typesource=misc,typetarget=online]
+ }
+ \map{%对应增加的一个备选类型misc确定文献类型标识符
+ \pertype{misc}
+ \step[fieldset=usera, fieldvalue={Z}]%
+ }
+ \map{
+ \pertype{book}
+ \pertype{inbook}
+ \step[fieldset=usera, fieldvalue={M}]
+ \step[fieldsource=version] %有时会把version和edition混淆,处理后直接用edition
+ \step[fieldset=edition, origfieldval]
+ }
+ \map{%兼容老的standard类型,确定文献类型标识符
+ \pertype{standard}
+ \step[fieldset=usera, fieldvalue={S}]
+ \step[fieldset=note, fieldvalue=standard]%因为没有专门的驱动,记录note方便映射为book和inbook后判断
+ }
+ \map{
+ \pertype{patent}
+ \step[fieldset=usera, fieldvalue={P}]
+ }
+ \map{
+ \pertype{inproceedings}
+ \pertype{conference}%兼容老的conference类型
+ \step[fieldset=usera, fieldvalue={C}]
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
+ \step[fieldset=publisher, origfieldval]
+ }
+ \map{
+ \pertype{proceedings}
+ \step[fieldset=usera, fieldvalue={C}]
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
+ \step[fieldset=publisher, origfieldval]
+ }
+ \map{
+ \pertype{incollection}
+ \step[fieldset=usera, fieldvalue={G}]
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
+ \step[fieldset=publisher, origfieldval]
+ }
+ \map{
+ \pertype{collection}
+ \step[fieldset=usera, fieldvalue={G}]
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
+ \step[fieldset=publisher, origfieldval]
+ }
+ \map{
+ \pertype{report}
+ \pertype{techreport}%兼容老的techreport类型
+ \step[fieldset=usera, fieldvalue={R}]
+ \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
+ \step[fieldset=publisher, origfieldval]
+ }
+ \map{
+ \pertype{thesis}
+ \pertype{mastersthesis}%兼容老的mastersthesis和phdthesis类型
+ \pertype{phdthesis}
+ \step[fieldset=usera, fieldvalue={D}]
+ \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{
+ \pertype{online}
+ \pertype{electronic}%兼容老的electronic类型
+ \pertype{www}%兼容老的www类型
+ \step[fieldset=usera, fieldvalue={EB}]
+ \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]%因为online的出版项处理类似手册
+ \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{
+ \pertype{manual}
+ \step[fieldset=usera, fieldvalue={A}]
+ \step[fieldsource=edition]%有时会把version和edition混淆,处理后使用version
+ \step[fieldset=version, origfieldval]
+ \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution
+ \step[fieldset=institution, origfieldval]
+ \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性
+ \step[fieldset=institution, origfieldval]
+ }
+ \map{
+ \pertype{unpublished}
+ \step[fieldset=usera, fieldvalue={Z}]
+ }
+ \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
+ \step[fieldsource={author}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
+ }%
+ \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
+ \step[fieldsource={editor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
+ }%
+ \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
+ \step[fieldsource={translator}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
+ }%
+ \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况
+ \step[fieldsource={bookauthor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}]
+ }%
+ \map{%处理一些用year表示date的情况
+ %这样处理将会设置date域,并使得labeldatesource变为空,因为date的前缀为空(如果是urldate,那么labeldatesource就是url)。
+ %同时date域会被biblatex自动解析为year,month,day,并且覆盖原来的year信息
+ \step[fieldsource=year]
+ \step[fieldset=date, origfieldval]
+ }
+ \map{%将entrykey放入keywords中用于后期使用
+ \step[fieldsource=entrykey]
+ \step[fieldset=keywords, origfieldval]
+ }
+ \map{\step[fieldsource=title,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
+ \step[fieldset=userd,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
+ }
+ \map{%
+ \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final]
+ \step[fieldset=userd,fieldvalue={russian}]%俄语
+ }
+ \map{%
+ \step[fieldsource=title,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
+ \step[fieldset=userd,fieldvalue={japanese}]%日语
+ } %确定形式后可增加类似andotherscn这样的本地化字符串处理
+ \map{%
+ \step[fieldsource=title,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
+ \step[fieldset=userd,fieldvalue={korean}]%韩语
+ }
+ \map{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题
+ \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%
+ \step[fieldset=userd, fieldvalue={chinese}]
+ }
+ \map{%将没有设置userd,且存在title域的默认设置为英文
+ \step[fieldsource=title,final]
+ \step[fieldset=userd,fieldvalue={english}]
+ }
+ \map{\step[fieldsource=author,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
+ \step[fieldset=userf,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
+ }
+ \map{%
+ \step[fieldsource=author,match=\regexp{[\x{0400}-\x{052F}]},final]
+ \step[fieldset=userf,fieldvalue={russian}]%俄语
+ }
+ \map{%
+ \step[fieldsource=author,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
+ \step[fieldset=userf,fieldvalue={japanese}]%日语
+ } %确定形式后可增加类似andotherscn这样的本地化字符串处理
+ \map{%
+ \step[fieldsource=author,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
+ \step[fieldset=userf,fieldvalue={korean}]%韩语
+ }
+ \map{%作者的中文判断
+ \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
+ \step[fieldset=userf, fieldvalue={chinese}]
+ }
+ \map{%将没有设置userf,且存在author域的默认设置为英文
+ \step[fieldsource=author,final]
+ \step[fieldset=userf,fieldvalue={english}]
+ }
+ \map{\step[fieldsource=translator,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
+ \step[fieldset=usere,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
+ }
+ \map{%
+ \step[fieldsource=translator,match=\regexp{[\x{0400}-\x{052F}]},final]
+ \step[fieldset=usere,fieldvalue={russian}]%俄语
+ }
+ \map{%
+ \step[fieldsource=translator,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
+ \step[fieldset=usere,fieldvalue={japanese}]%日语
+ } %确定形式后可增加类似andotherscn这样的本地化字符串处理
+ \map{%
+ \step[fieldsource=translator,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
+ \step[fieldset=usere,fieldvalue={korean}]%韩语
+ }
+ \map{%译者的中文判断
+ \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]
+ \step[fieldset=usere, fieldvalue={chinese}]
+ }
+ \map{%将没有设置usere,且存在translator域的默认设置为英文
+ \step[fieldsource=translator,final]
+ \step[fieldset=usere,fieldvalue={english}]
+ }
+ \map{\step[fieldsource=editor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
+ \step[fieldset=userc,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
+ }
+ \map{%
+ \step[fieldsource=editor,match=\regexp{[\x{0400}-\x{052F}]},final]
+ \step[fieldset=userc,fieldvalue={russian}]%俄语
+ }
+ \map{%
+ \step[fieldsource=editor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
+ \step[fieldset=userc,fieldvalue={japanese}]%日语
+ } %确定形式后可增加类似andotherscn这样的本地化字符串处理
+ \map{%
+ \step[fieldsource=editor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
+ \step[fieldset=userc,fieldvalue={korean}]%韩语
+ }
+ \map{%编者的中文判断
+ \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5
+ \step[fieldset=userc, fieldvalue={chinese}]
+ }
+ \map{%将没有设置userc,且存在editor域的默认设置为英文
+ \step[fieldsource=editor,final]
+ \step[fieldset=userc,fieldvalue={english}]
+ }
+ \map{\step[fieldsource=bookauthor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF
+ \step[fieldset=userb,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪
+ }
+ \map{%
+ \step[fieldsource=bookauthor,match=\regexp{[\x{0400}-\x{052F}]},final]
+ \step[fieldset=userb,fieldvalue={russian}]%俄语
+ }
+ \map{%
+ \step[fieldsource=bookauthor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final]
+ \step[fieldset=userb,fieldvalue={japanese}]%日语
+ } %确定形式后可增加类似andotherscn这样的本地化字符串处理
+ \map{%
+ \step[fieldsource=bookauthor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final]
+ \step[fieldset=userb,fieldvalue={korean}]%韩语
+ }
+ \map{%编者的中文判断
+ \step[fieldsource=bookauthor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5
+ \step[fieldset=userb, fieldvalue={chinese}]
+ }
+ \map{%将没有设置userc,且存在editor域的默认设置为英文
+ \step[fieldsource=bookauthor,final]
+ \step[fieldset=userb,fieldvalue={english}]
+ }
+ \map{\step[fieldsource=userd,final]%userd存在则用根据标题的语言设定language
+ \step[fieldset=language,origfieldval]%本身language存在则不设定
+ }
+ \map{\step[fieldsource=userf,final]%userd不存在,而userf存在则根据author的语言设定language
+ \step[fieldset=language,origfieldval]
+ }%如果没有作者和标题,那么剩下的最可能有意义的只有网址了,而网址通常是英文的,因此不用再进一步对其它域进行判断了。
+ \map{%将没有设置的language设置成en,即认为不是中文的就是英文的。
+ \step[fieldset=language,fieldvalue={english}]
+ }
+ \map{%一条文献的语言已经设定在language域中,由于出版项相关宏中使用userd判断,
+ %所以将一条文献的主体语言设定到userd中,本身前面userd已经设定,但没有处理无标题的情况,
+ %这里的处理等价于没有标题时,利用作者的语言设定userd,再没有作者,则默认用英文设定userd
+ \step[fieldsource=language]
+ \step[fieldset=userd,origfieldval]
+ }
+ \map{%当文献给出language域时,设置文献要使用的本地化字符串的语言
+ %biblatex 3.11及以下版本仅有match是区分大小写的,而3.12版开始用matchi来区分大小,而match不区分
+ %这里为兼容3.11及以下版本,所以用一个复杂一点的正则表达式
+ \step[fieldsource=language,match=\regexp{(e|E)(n|N)(g|G)(l|L)(i|I)(s|S)(h|H)},final]
+ \step[fieldset=langid,fieldvalue={english}]
+ \step[fieldset=lansortorder,fieldvalue=\lanenorder]
+ }
+ \map{
+ \step[fieldsource=language,match=\regexp{(r|R)(u|U)(s|S)(s|S)(i|I)(a|A)(n|N)},final]
+ \step[fieldset=langid,fieldvalue={russian}]
+ \step[fieldset=lansortorder,fieldvalue=\lanruorder]
+ }
+ \map{%
+ \step[fieldsource=language,match=\regexp{(f|F)(r|R)(e|E)(n|N)(c|C)(h|H)},final]
+ \step[fieldset=langid,fieldvalue={french}]
+ \step[fieldset=lansortorder,fieldvalue=\lanfrorder]
+ }
+ \map{%
+ \step[fieldsource=language,match=\regexp{(c|C)(h|H)(i|I)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english,
+ \step[fieldset=langid,fieldvalue={english}]
+ \step[fieldset=lansortorder,fieldvalue=\lancnorder]
+ }
+ \map{%
+ \step[fieldsource=language,match=\regexp{(j|J)(a|A)(p|P)(a|A)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english,
+ \step[fieldset=langid,fieldvalue={english}]
+ \step[fieldset=lansortorder,fieldvalue=\lanjporder]
+ }
+ \map{%
+ \step[fieldsource=language,match=\regexp{(k|K)(o|O)(r|R)(e|E)(a|A)(n|N)},final]%中日韩语目前都用english,
+ \step[fieldset=langid,fieldvalue={english}]
+ \step[fieldset=lansortorder,fieldvalue=\lankrorder]
+ }
+}
+}
+
+
+%
+% 修改输入的参考文献数据,样式层的操作
+%
+ \DeclareStyleSourcemap{
+ \maps[datatype=bibtex]{
+ \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook,
+ %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义
+ %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断
+ \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook
+ \step[typesource=standard, typetarget=inbook, final]
+ }
+ \map{%剩下的全部映射为book
+ \step[typesource=standard, typetarget=book, final]
+ }
+% \map{%先于标准样式的driver层映射,以取消type设置
+% \step[typesource=mastersthesis, typetarget=thesis, final]
+% %\step[fieldset=type, fieldvalue=mathesis]
+% }
+% \map{%先于标准样式的driver层映射,以取消type设置
+% \step[typesource=phdthesis, typetarget=thesis, final]
+% %\step[fieldset=type, fieldvalue=phdthesis]
+% }
+ \map{%先于标准样式的driver层映射,以取消type设置
+ \step[typesource=techreport, typetarget=report, final]
+ %\step[fieldset=type, fieldvalue=techreport]
+ }
+ \map{%
+ \pertype{report}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=report,typetarget=online]
+ \step[fieldset=note,fieldvalue={report}]
+ }
+ \map{%
+ \pertype{thesis}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=thesis,typetarget=online]
+ }
+ \map{%
+ \pertype{manual}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=manual,typetarget=online]
+ }
+ \map{%
+ \pertype{unpublished}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=unpublished,typetarget=online]
+ }
+ \map{%
+ \pertype{database}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=databasetypetarget=online]
+ }
+ \map{%
+ \pertype{dataset}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=dataset,typetarget=online]
+ }
+ \map{%
+ \pertype{software}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=software,typetarget=online]
+ }
+ \map{%
+ \pertype{map}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=map,typetarget=online]
+ }
+ \map{%
+ \pertype{archive}
+ %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步
+ \step[fieldset=location,fieldvalue={}]
+ \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online
+ %3.7以上版本用notfield
+ %\step[notfield=address,final]%当address不存在则继续
+ \step[fieldsource=url,final]%地址不存在且存在url那么转变为online
+ \step[typesource=archive,typetarget=online]
+ }
+ \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确)
+ \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸
+ \step[fieldset=keywords, fieldvalue={,}, append]
+ \step[fieldset=keywords, origfieldval, append]
+ }
+ \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{
+ \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}]
+ }
+ \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{
+ \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}]
+ }
+ \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,%
+ address,location,institution,organization}]{
+ \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}]
+ }
+ }
+ }
+
+%
+% 佚名/noauthor的处理
+%
+% 原理方法:利用样式层的动态数据修改实现
+\def\dealnoathor{
+ \DeclareStyleSourcemap{
+ \maps[datatype=bibtex]{
+ \map{%默认情况下将空缺作者的中文文献设置为佚名
+ \step[fieldsource=language,match={chinese},final]
+ \step[fieldset=author, fieldvalue={佚名}]
+ }
+ \map{%默认情况下将空缺作者的英文文献设置为A{non}
+ \step[fieldsource=language,match={english},final]
+ \step[fieldset=author, fieldvalue={A{non}}]%noauthor换成Anon,同时为避免大写还加了{}
+ }
+ }
+ }
+}
+
+%
+% 不同语言分集调整的实现方式
+%
+% 原理方法:利用样式层的动态数据修改lansortorder域来实现排序
+\def\dealsortlan{
+ \DeclareStyleSourcemap{
+ \maps[datatype=bibtex]{
+ \map[overwrite]{%当文献给出language域时,设置文献要使用的本地化字符串的语言
+ \step[fieldsource=language,match=english,final]
+ \step[fieldset=lansortorder,fieldvalue=\lanenorder]
+ }
+ \map[overwrite]{
+ \step[fieldsource=language,match=russian,final]
+ \step[fieldset=lansortorder,fieldvalue=\lanruorder]
+ }
+ \map[overwrite]{%
+ \step[fieldsource=language,match=french,final]
+ \step[fieldset=lansortorder,fieldvalue=\lanfrorder]
+ }
+ \map[overwrite]{%
+ \step[fieldsource=language,match=chinese,final]%中日韩语目前都用english,
+ \step[fieldset=lansortorder,fieldvalue=\lancnorder]
+ }
+ \map[overwrite]{%
+ \step[fieldsource=language,match=japanese,final]%中日韩语目前都用english,
+ \step[fieldset=lansortorder,fieldvalue=\lanjporder]
+ }
+ \map[overwrite]{%
+ \step[fieldsource=language,match=korean,final]%中日韩语目前都用english,
+ \step[fieldset=lansortorder,fieldvalue=\lankrorder]
+ }
+ }
+ }
+}
+
+
+
+
+%
+%驱动别名等价于驱动层映射
+%
+\DeclareBibliographyAlias{newspaper}{article}%
+\DeclareBibliographyAlias{inproceedings}{inbook}%会议论文文献类型驱动
+\DeclareBibliographyAlias{conference}{inbook}%会议论文文献类型驱动
+\DeclareBibliographyAlias{incollection}{inbook}%文集中析出文献类型驱动
+\DeclareBibliographyAlias{collection}{book}%%文集类型驱动
+\DeclareBibliographyAlias{proceedings}{book}%会议论文集文献类型驱动
+\DeclareBibliographyAlias{thesis}{manual}%学位论文驱动
+\DeclareBibliographyAlias{unpublished}{manual}%其它类型驱动
+\DeclareBibliographyAlias{database}{manual}
+\DeclareBibliographyAlias{dataset}{manual}
+\DeclareBibliographyAlias{software}{manual}
+\DeclareBibliographyAlias{map}{manual}
+\DeclareBibliographyAlias{archive}{manual}
+
+
+%=====================================================================
+% 设置排序格式
+%=====================================================================
+%
+% 排序格式,用降序,及userb域,针对biblatex3.8及以上版本
+%
+\DeclareSortingTemplate{gb7714-2015}{
+ \sort{
+ \field{presort}
+ }
+ %\sort[final]{
+ %\field{sortkey}
+ %}
+ \sort{
+ \field{lansortorder}%language
+ }
+ \sort{
+ \field{sortkey}
+ }
+ \sort{%[direction=descending]
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ }
+ \sort{
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field{volume}
+ \literal{0}
+ }
+ }
+
+ %降序的nyt
+ \DeclareSortingTemplate{gbnytd}{
+ \sort{
+ \field{presort}
+ }
+% \sort[final]{
+% \field{sortkey}
+% }
+ \sort{
+ \field{lansortorder}%language
+ }
+ \sort[direction=descending]{
+ \field{sortkey}
+ }
+ \sort[direction=descending]{%
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ }
+ \sort{
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field{volume}
+ \literal{0}
+ }
+ }
+
+ %降序的ynt
+ \DeclareSortingTemplate{gbyntd}{
+ \sort{
+ \field{presort}
+ }
+% \sort[final]{
+% \field{sortkey}
+% }
+ \sort{
+ \field{lansortorder}%language
+ }
+ \sort[direction=descending]{
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sortkey}
+ }
+ \sort{%
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field{volume}
+ \literal{0}
+ }
+ }
+
+ %升序的ynt
+ \DeclareSortingTemplate{gbynta}{
+ \sort{
+ \field{presort}
+ }
+% \sort[final]{
+% \field{sortkey}
+% }
+ \sort{
+ \field{lansortorder}%language
+ }
+ \sort{%[direction=ascending]
+ \field{sortyear}
+ \field{year}
+ }
+ \sort{
+ \field{sortkey}
+ }
+ \sort{%
+ \field{sortname}
+ \field{author}
+ \field{editor}
+ \field{translator}
+ }
+ \sort{
+ \field{sorttitle}
+ \field{title}
+ }
+ \sort{
+ \field{volume}
+ \literal{0}
+ }
+ }
+
+%=====================================================================
+% 参考文献表环境
+%=====================================================================
+%
+% 列表格式
+%
+% 增加一个\bibitemindent尺寸用于控制list环境的itemindent
+% v1.0l,20180615,hzz
+% v1.0t,20200319,hzz,增加尺寸\biblabelextend使某些字体下标签宽度不足时可增加标签宽度
+\setlength{\bibhang}{\biblabelsep}%
+\newlength{\bibitemindent}
+\setlength{\bibitemindent}{0pt}
+\newlength{\biblabelextend}
+\setlength{\biblabelextend}{0pt}
+
+
+\defbibenvironment{bibliography}
+ {\list
+ {\printtext[labelnumberwidth]{%
+ \printfield{labelprefix}%
+ \printfield{labelnumber}}}
+ {\addtolength{\labelnumberwidth}{\biblabelextend}%
+ \setlength{\labelwidth}{\labelnumberwidth}%
+ \setlength{\labelsep}{\biblabelsep}%
+ \setlength{\leftmargin}{\bibhang}%
+ \addtolength{\leftmargin}{\labelnumberwidth}%
+ \setlength{\itemindent}{\bibitemindent}%
+ \setlength{\itemsep}{\bibitemsep}%
+ \setlength{\parsep}{\bibparsep}}%
+ \renewcommand*{\makelabel}[1]{\hss##1}}
+ {\endlist}
+ {\item}
+
+%
+% 顺序编码制-标签对齐方式处理
+%
+% 原理方法:利用选项提供的计数器数值做选择
+% 左对齐,右对齐为list环境下的处理,此时list环境的\labelwidth只能设置一个,是最宽标签的宽度
+% 项对齐则是在段落环境下做的处理。
+% 左对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距可变
+% 右对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距相等,标签与页边距离可变
+% 项对齐时,序号标签贴在页边,序号标签与参考文献项内容的间距相等
+% 修改序号标签格式为:
+% \DeclareFieldFormat{shorthandwidth}{\mkbibbrackets{#1}} %源来自numeric.BBX
+% \DeclareFieldFormat{labelnumberwidth}{\ttfamily\mkbibbrackets{#1}\hfill}
+\DeclareFieldFormat{labelnumberwidth}{%
+\ifcase\value{gbalignlabel}%右对齐,整个标签为右对齐
+ \mkgbnumlabel{#1}%
+\or%左对齐,整个标签为左对齐
+ \mkgbnumlabel{#1}\hfill%
+\or%中间对齐,比如:序号数字居于[]中间
+ \hfil\mkgbnumlabel{\hfill#1\hfill}\hfil%
+\fi}
+
+%
+% 修改序号标签格式为以各条参文献为基础进行对齐的方式,即序号与条目内容间隔相等的方式。
+\def\setaligngbstyle{%
+\def\blx at bibitem##1{%
+ \blx at ifdata{##1}
+ {\begingroup
+ \blx at getdata{##1}%
+ \blx at bibcheck
+ \iftoggle{blx at skipentry}{}{%
+ \blx at setdefaultrefcontext{##1}%
+ \global\let\blx at noitem\@empty
+ \blx at setoptions@type\abx at field@entrytype
+ \blx at setoptions@entry
+ \blx at thelabelnumber
+ \addtocounter{instcount}\@ne
+ \blx at initsep
+ \blx at namesep
+ \csuse{blx at item@\blx at theenv}\relax
+% \blx at initsep %移动到上面去,恢复bibnamesep等的作用机制
+% \blx at namesep
+ \csuse{blx at hook@bibitem}%
+ \blx at execute
+ \blx at initunit
+ \blx at anchor
+ \blx at beglangbib
+ \bibsentence
+ \blx at pagetracker
+ \blx at driver\abx at field@entrytype
+ \blx at postpunct
+ \blx at endlangbib}%
+ \par\endgroup}%这里增加了一个\par
+ {}}
+\newlength{\lengthid}
+\newlength{\lengthlw}
+\newcommand{\itemcmd}{%
+\settowidth{\lengthid}{\mkgbnumlabel{\printfield{labelnumber}}}
+\addtolength{\lengthid}{\biblabelsep}
+\setlength{\lengthlw}{\textwidth}
+\addtolength{\lengthlw}{-\lengthid}
+\addvspace{\bibitemsep}%恢复\bibitemsep的作用
+%\parshape 2 0em \textwidth \lengthid \lengthlw
+\hangindent\lengthid
+\mkgbnumlabel{\printfield{labelnumber}}%
+\hspace{\biblabelsep}}
+%
+% 简单的段落环境
+\defbibenvironment{bibliography}
+{\begingroup\setlength{\parindent}{0em}}
+{\endgroup}
+{\itemcmd}}
+
+
+%=====================================================================
+% 设置单元或块等的标点
+%=====================================================================
+\renewrobustcmd*{\bibinithyphendelim}{\addhighpenspace}%用于处理姓名中名部分存在-的情况,比如ZHANG Yu-xin
+\renewcommand*{\subtitlepunct}{\addcolon\addspace} %修改标题和其它标题信息间的标点,来源biblatex.def,
+%
+% 利用set实现的多语言文献不同语言间的分隔符
+% 20170411,双语之间用newline替换par,避免采用gb7714-2015的项对齐方式第二语言间分段导致没有缩进
+%
+% 原理方法:set方法可以参考3.11.5 Entry Sets,4.11.1 Entry Sets
+% 这里调整一下两种语言参考文献的间隔,源来自biblatex.def
+\renewcommand*{\entrysetpunct}{\adddot\newline\nobreak}
+\renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%%页码引用格式的修改,修改为用冒号
+%\renewcommand{\relateddelim}{}%\par
+
+%=====================================================================
+% 修改域的格式,重定义域的输出宏
+%=====================================================================
+%
+% 新增文献类型标识符的格式
+% []前的nobreak,从GB4.1节的例子看不应该加,所以去掉
+% 但因为考虑到cjk字符和[]之间可能添加空格,所以仍然加上
+% 而[]中间的内容,从4.6.2节的例子看也是可以分割的,因此内部的nobreak也可以去掉
+%
+\DeclareFieldFormat{gbtypeflag}{%
+\iftoggle{bbx:gbmedium}%
+{\iftoggle{bbx:url}%
+ {\iffieldundef{url}%当存在url时,增加一个OL标识符
+ {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}%
+ {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}%
+ }%
+ {\ifentrytype{online}%
+ {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}%
+ {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}%
+ }}%
+ {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}%
+}
+
+%
+% 新增用于报纸的文献类型标识符的格式
+%
+\DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper
+\iftoggle{bbx:gbmedium}%
+{\iftoggle{bbx:url}%
+ {\iffieldundef{url}%当存在url时,增加一个OL标识符
+ {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
+ {\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}%
+ }%
+ {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
+}{\nobreak\printtext{[}\nobreak N\printtext{]}\nobreak}%
+}
+
+%
+% 新增用于标准的文献类型标识符的格式
+%
+\DeclareFieldFormat{gbtypeflags}{%用于标准standard
+\iftoggle{bbx:gbmedium}%
+{\iftoggle{bbx:url}%
+ {\iffieldundef{url}%当存在url时,增加一个OL标识符
+ {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
+ {\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}%
+ }%
+ {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}%
+}{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}%
+}
+
+%
+% 重设title等参考文献信息的输出格式
+%
+% 原理方法:修改来自biblatex.def文件的原格式
+\newcommand{\bibtitlefont}{}
+\newcommand{\bibauthorfont}{}
+\newcommand{\bibpubfont}{}
+
+\DeclareFieldFormat{title}{#1\adddot\addthinspace}
+\DeclareFieldFormat{journaltitle}{#1\isdot}%添加\isdot用于缩写名带点情况,将其转换为缩写点,便于标点的追踪
+\DeclareFieldFormat{issuetitle}{#1}
+\DeclareFieldFormat{maintitle}{#1}
+\DeclareFieldFormat{booktitle}{#1}
+\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉
+ [article,patent,thesis,unpublished]
+ {title}{#1\adddot\addthinspace}%\mkbibquote{#1\isdot}
+\DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉
+ [inbook,incollection,inproceedings]
+ {title}{#1}%\nopunct\unspace
+\DeclareFieldFormat{url}{\url{#1}} %%url相关输出,url域修改如本行,源来自biblatex.def
+\def\UrlFont{\rmfamily}%设置url字体为roman字体%\ttfamily
+%\urlstyle{rm} %使用这句也一样
+\setcounter{biburlnumpenalty}{100} %让url可以在数字后断行
+\setcounter{biburlucpenalty}{100} %让url可以在大写字母后断行
+\setcounter{biburllcpenalty}{100} %让url可以在小写字母后断行
+\DeclareFieldFormat{doi}{%
+ \rmfamily{DOI}\addcolon\space
+ \ifhyperref
+ {\href{https://doi.org/#1}{\nolinkurl{#1}}}
+ {\nolinkurl{#1}}}
+%
+% 标题的字母大小写格式修改
+%
+% 注意:修改标题的字母大小写,不能用前面的title的格式而要用titlecase
+% 因为titlecase is applied to the contents of the field directly,title is not
+%\DeclareFieldFormat{titlecase}{\MakeCapital#1}%重设标题格式,将其修改为首字母大写
+\DeclareFieldFormat{titlecase}{\iftoggle{bbx:titlelink}{%
+\iffieldundef{url}{\MakeCapital#1}{%
+\href{\thefield{url}}{#1}}}{\MakeCapital#1}}%重设标题格式,将其修改为首字母大写
+\DeclareFieldFormat{pages}{#1}%去掉前面引导页码的pp.等字符,\mkpageprefix[bookpagination]{#1}
+\DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{-}}%将页码间隔符替换会英文的短横线
+\DefineBibliographyExtras{russian}{\renewcommand*{\bibrangedash}{-}}
+
+\def\execgbfdfmtstd{%恢复到标准样式的设置
+\DeclareFieldFormat{title}{\mkbibemph{##1}}
+\DeclareFieldFormat
+ [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
+ {title}{\mkbibquote{##1\isdot}}
+\DeclareFieldFormat
+ [suppbook,suppcollection,suppperiodical]
+ {title}{##1}
+\DeclareFieldFormat{journaltitle}{\mkbibemph{##1}}
+\DeclareFieldFormat{issuetitle}{\mkbibemph{##1}}
+\DeclareFieldFormat{maintitle}{\mkbibemph{##1}}
+\DeclareFieldFormat{booktitle}{\mkbibemph{##1}}
+\DeclareFieldFormat{url}{\mkbibacro{URL}\addcolon\space\url{##1}}
+\DeclareFieldFormat{titlecase}{##1}
+\DeclareFieldFormat{pages}{\mkpageprefix[bookpagination]{##1}}
+}
+
+%
+% 文献标题后的标点问题
+% v1.0k,20180405,为texlive2017以上版本中的beamer兼容性做的处理,Hu Zhenzhen
+%
+% 原理方法:如下代码处理texlive2017以上版本中,beamer中文献的标题后出现两个点的情况:
+% texlive2017以上的beamer中对macro{title}做了patch,正常情况下不会出现两个点的情况,但由于
+% 之前为了处理texlive2015,2016下的title格式添加了adddot,导致出现两个点的情况,而且也影响
+% 析出文献的//符号的输出,因此再次对macro{title}做patch消除beamer中做apptocmd时添加的\newunitpunct
+ {%texlive 2017对应iftlseven以上版本
+ \@ifclassloaded{beamer}{
+ \DeclareFieldFormat{title}{#1}%
+ \DeclareFieldFormat[article,patent,thesis,unpublished]{title}{#1}
+ \AtBeginDocument{%
+ \patchcmd{\abx at macro@title}{\newunitpunct}{}{}{}}}{}
+ }
+
+
+%
+% 修改译者位置格式
+%
+% 原理方法:修改来自biblatex.def文件的bytranslator+others宏的格式
+\renewbibmacro*{bytranslator+others}{%
+ \ifnameundef{translator}
+ {}
+ {%\usebibmacro{bytranslator+othersstrg}
+ %\setunit{\addspace}%
+ \printnames[bytranslator]{translator}%
+ \clearname{translator}%
+ %从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理
+ %比如生成cotranslator等用于调用cotranslator所代表的当地化字符串
+ \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。
+ %\setunit{\addspace}%
+ \newunit}%
+ \usebibmacro{withothers}}
+
+
+%
+% 修改作者数量超过限定值,做省略时的处理格式
+% v1.0,20160701,hzz
+% v1.0O,20190103,hzz,修改利用新定义的一个分隔符strandothersdelim
+%
+% 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。
+% \printnames由start-stop控制项数,默认是1和maxnames/minnames
+\renewbibmacro*{name:andothers}{%
+ \ifboolexpr{
+ test {\ifnumequal{\value{listcount}}{\value{liststop}}}
+ and
+ test \ifmorenames
+ }{\ifnumgreater{\value{liststop}}{1}%注意这里试图去区分姓名总数大于1的情况,当姓名总数大于1时,最后一个姓名后面先加入一个\finalandcomma
+ {\finalandcomma}%目前国标没有这样的区分要求,如果有需要也是可以这么去做的。
+ {}%
+\printdelim{andothersdelim}\printdelim{strandothersdelim}%
+}{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如:
+%袁训来, 陈哲, 肖书海, 等.
+%胡泳, 范海燕, 译.
+%潘惠霞, 魏婧, 杨艳, 等译.
+\ifcurrentname{translator}{\addcomma\addthinspace}{}%为了实现上述第二个示例情况做的处理
+}}
+
+
+%
+% 修改省略作者后的本地化字符串,比如et al.
+% v1.0o,20190103,hzz
+%
+% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andotherscn=“等”,否则用andothers=“et al.”。
+% 非默认情况,根据选项信息,选择选择强制中文或英文
+% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了
+% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置
+\DeclareDelimFormat{strandothersdelim}{%
+ \edef\userfieldabcde{userd}%这里使用\iffieldequalstr{labelnamesource}替代ifcurrentname因为标注中使用ifcurrentname无效
+ \iffieldequalstr{labelnamesource}{translator}{\edef\userfieldabcde{usere}}{}%
+ \iffieldequalstr{labelnamesource}{editor}{\edef\userfieldabcde{userc}}{}%
+ \iffieldequalstr{labelnamesource}{author}{\edef\userfieldabcde{userf}}{}%
+ \iffieldequalstr{labelnamesource}{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbcitelocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\ifbibstring{andothersincitecn}{\bibstring{andothersincitecn}}{\bibstring{andothers}}}{}%中文已经通过english本地化字符串定义
+ \iffieldequalstr{\userfieldabcde}{korean}{\ifbibstring{andotherskr}{\bibstring{andotherskr}}{\bibstring{andothers}}}{}%韩语未定义,所以与bib中一致
+ \iffieldequalstr{\userfieldabcde}{japanese}{\ifbibstring{andothersjp}{\bibstring{andothersjp}}{\bibstring{andothers}}}{}%日与同韩语
+ \iffieldequalstr{\userfieldabcde}{english}{\ifbibstring{andothersincite}{\bibstring{andothersincite}}{\bibstring{andothers}}}{}%英语已定义
+ \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%法语未定义,若要定义需要针对french本地化字符串定义
+ \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%俄语未定义,若要定义需要针对russian本地化字符串定义
+ \or%
+ \bibstring{andothersincitecn}%
+ \or%
+ \bibstring{andothersincite}%
+ \fi}
+
+
+\DeclareDelimFormat[bib,biblist]{strandothersdelim}{%
+ \edef\userfieldabcde{userd}%
+ \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
+ \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
+ \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
+ \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbbiblocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}%
+ \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andothersjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}%
+ \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%
+ \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%
+ \or%
+ \bibstring{andotherscn}%
+ \or%
+ \bibstring{andothers}%
+ \fi}
+
+%
+% 修改最后一个作者前的字符串,比如 and
+% v1.0o,20190103,hzz
+%
+% 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andcn=“和”,否则用and=“and”。
+% 非默认情况,根据选项信息,选择选择强制中文或英文
+% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了
+% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置
+\DeclareDelimFormat{finalnamedelim}{%
+ \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
+ \addspace%
+ \edef\userfieldabcde{userd}%
+ \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
+ \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
+ \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
+ \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbcitelocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andincitecn}}{}%
+ \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andincite}}{}%
+ \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}%
+ \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}%
+\space%
+ \or%
+ \bibstring{andincitecn}\space%
+ \or%
+ \bibstring{andincite}\space%
+ \fi}
+
+\DeclareDelimFormat[bib,biblist]{finalnamedelim}{%
+ \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
+ \addspace%
+ \edef\userfieldabcde{userd}%
+ \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
+ \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
+ \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}%
+ \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbbiblocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}%
+ \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}%
+ \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}%
+ \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}%
+\space%
+ \or%
+ \bibstring{andcn}\space%
+ \or%
+ \bibstring{and}\space%
+ \fi}
+
+
+%
+% 重设title的输出
+%
+% 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen
+% 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件
+% 利用toggle做标识符是否输出的判断
+\renewbibmacro*{title}{%
+ \ifboolexpr{%
+ test{\iffieldundef{title}}%
+ and
+ test{\iffieldundef{subtitle}}%
+ }%
+ {}%
+ {\printtext[title]{\bibtitlefont%增加字体控制命令
+ \printfield[titlecase]{title}%
+ \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
+ {}{\setunit{\subtitlepunct}%
+ \printfield[titlecase]{subtitle}}%
+ \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
+ {\setunit{\subtitlepunct}\printfield{titleaddon}}%
+ \iftoggle{bbx:gbtype}{%
+ \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准
+ {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准
+ {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸
+ {\printfield[gbtypeflag]{usera}}}%其它
+ }}{}%
+ %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
+ %\newunit
+}%
+}}
+
+%
+% 作者信息的输出格式
+%
+% 20180425,v1.0k,为作者增加字体控制命令,Hu Zhenzhen
+% 20180603,v1.0l,增加使用nameformat域来选择姓名格式
+\DeclareNameFormat{namefmtselected}{%
+\iffieldundef{namefmtid}{}%
+{\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}%
+\ifcase\value{gbnamefmtcase}%
+ \ifgiveninits
+ {\usebibmacro{name:gbuppercase}
+ {\namepartfamily}
+ {\namepartgiveni}
+ {\namepartprefix}
+ {\namepartsuffix}}
+ {\usebibmacro{name:gbuppercase}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}}%
+\or
+ \ifgiveninits
+ {\usebibmacro{name:gblowercase}
+ {\namepartfamily}
+ {\namepartgiveni}
+ {\namepartprefix}
+ {\namepartsuffix}}
+ {\usebibmacro{name:gblowercase}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}}%
+\or
+ \ifgiveninits
+ {\usebibmacro{name:given-family}
+ {\namepartfamily}
+ {\namepartgiveni}
+ {\namepartprefix}
+ {\namepartsuffix}}
+ {\usebibmacro{name:given-family}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}}%
+\or
+ \ifgiveninits
+ {\usebibmacro{name:family-given}
+ {\namepartfamily}
+ {\namepartgiveni}
+ {\namepartprefix}
+ {\namepartsuffix}}
+ {\usebibmacro{name:family-given}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}}%
+\or
+\usebibmacro{name:gbpinyin}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}%
+\or
+ \ifnumequal{\value{listcount}}{1}
+ {\ifgiveninits
+ {\usebibmacro{name:family-given}
+ {\namepartfamily}
+ {\namepartgiveni}
+ {\namepartprefix}
+ {\namepartsuffix}}
+ {\usebibmacro{name:family-given}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}}%
+ \ifboolexpe{%
+ test {\ifdefvoid\namepartgiven}
+ and
+ test {\ifdefvoid\namepartprefix}}
+ {}
+ {\usebibmacro{name:revsdelim}}}
+ {\ifgiveninits
+ {\usebibmacro{name:given-family}
+ {\namepartfamily}
+ {\namepartgiveni}
+ {\namepartprefix}
+ {\namepartsuffix}}
+ {\usebibmacro{name:given-family}
+ {\namepartfamily}
+ {\namepartgiven}
+ {\namepartprefix}
+ {\namepartsuffix}}}%
+\fi
+ \usebibmacro{name:andothers}}
+
+\DeclareNameAlias{default}{namefmtselected}%姓名的默认格式采用可选的模式
+\DeclareNameAlias{sortname}{default}% Used in the bibliography %family-given/given-family
+\DeclareNameAlias{citename}{default}% Default used by \citename
+
+\DeclareDelimFormat[bib,biblist]{andothersdelim}{\addcomma\addspace}
+%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}%
+
+%GB/T 7714-2015 风格,全部大写
+\newbibmacro*{name:gbuppercase}[4]{\bibauthorfont%
+\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
+\renewcommand*{\revsdnamepunct}{}%
+ \ifuseprefix%
+ {\usebibmacro{name:delim}{#3#1}%
+ \usebibmacro{name:hook}{#3#1}%
+ \ifdefvoid{#3}{}{%
+ \ifcapital%
+ {\mkbibnameprefix{\MakeCapital{#3}}\isdot}%
+ {\mkbibnameprefix{#3}\isdot}%
+ \ifprefchar{}{\bibnamedelimc}}%
+ \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
+ \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital
+ \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号
+ {\usebibmacro{name:delim}{#1}%
+ \usebibmacro{name:hook}{#1}%
+ \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
+ \ifboolexpe{%
+ test {\ifdefvoid{#2}}
+ and
+ test {\ifdefvoid{#3}}}
+ {}{\revsdnamepunct}%
+ \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital
+ \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}%
+ \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号
+}
+
+%GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出
+\newbibmacro*{name:gblowercase}[4]{\bibauthorfont%
+ \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉
+ \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
+ \ifuseprefix
+ {\usebibmacro{name:delim}{#3#1}%
+ \usebibmacro{name:hook}{#3#1}%
+ \ifdefvoid{#3}{}{%
+ \ifcapital
+ {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
+ {\mkbibnameprefix{#3}\isdot}%
+ \ifprefchar{}{\bibnamedelimc}}%
+ \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot%
+ \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital
+ \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号
+ {\usebibmacro{name:delim}{#1}%
+ \usebibmacro{name:hook}{#1}%
+ \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot%
+ \ifboolexpe{%
+ test {\ifdefvoid{#2}}
+ and
+ test {\ifdefvoid{#3}}}
+ {}{\revsdnamepunct}%
+ \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital
+ \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}
+ \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号
+}
+
+%中文常见风格,汉语拼音全拼模式
+\newbibmacro*{name:gbpinyin}[4]{\bibauthorfont%
+\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY
+\renewcommand*{\revsdnamepunct}{}%%来源biblatex.def
+\renewrobustcmd*{\bibnamedelima}{\mbox{-}}%
+ \ifuseprefix
+ {\usebibmacro{name:delim}{#3#1}%
+ \usebibmacro{name:hook}{#3#1}%
+ \ifdefvoid{#3}{}{%
+ \ifcapital
+ {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
+ {\mkbibnameprefix{#3}\isdot}%
+ \ifprefchar{}{\bibnamedelimc}}%
+ \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
+ \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamegiven{#2}}\isdot}%\MakeCapital
+ \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}
+ {\usebibmacro{name:delim}{#1}%
+ \usebibmacro{name:hook}{#1}%
+ \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot%
+ \ifboolexpe{%
+ test {\ifdefvoid{#2}}
+ and
+ test {\ifdefvoid{#3}}}
+ {}
+ {\revsdnamepunct}%
+ \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeCapital{#2}}\isdot}%\MakeCapital
+ \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}
+ \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%
+}
+
+
+%
+% url和url日期格式
+%
+\renewbibmacro*{url+urldate}{%
+ %\usebibmacro{url}%%更换url的位置,放到下面
+ \iffieldundef{urlyear}%
+ {}{%\setunit*{\addspace}%
+ \usebibmacro{urldate}}%
+ \setunit{\addperiod\addspace}%
+ \usebibmacro{url}}
+\renewbibmacro*{url}{\printfield{url}}
+
+
+%
+% 日期信息的输出格式,针对biblatex>=3.10版本
+%
+ \DeclareFieldFormat{urldate}{#1}
+ \renewbibmacro*{urldate}{%
+ \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx at edtfdate这种更底层的命令
+
+ %
+ % 专利的公告日期、或报纸的日期的输出宏
+ % 20160701,v1.0,新增加
+ % 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen
+ %
+ % 原理方法:加上printtext避免破坏异步标点机制
+ % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份
+ % 所以无法再用选项设置的方法,印象需要用底层的命令
+ % 这里可以用\blx at isodate,但用\blx at gbdate试图避免版本判断
+ \newbibmacro*{newsdate}{%%
+ \printtext{\blx at gbdate{}{}}%%\blx at isodate{}{}%
+ }
+
+ %
+ \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式
+ \ifboolexpr{%
+ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
+ }%
+ {}%更新或修改日期通常有day信息
+ {\iffieldundef{year}{%
+ \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}%
+ {\printtext{(}\printenddate\printtext{)}}%
+ }{\iffieldequalstr{year}{}{%因为year存在,但为空
+ }{\printtext{(}\blx at gbdate{}{}\printtext{)}}%
+ }%
+ }}%
+
+
+%
+% biblatex>v3.8版利用related实现双语文献的处理
+%
+ %为了实现v3.8以上版本的双语文献,采用related的方法代替set方法,因为set方法已经无法实现了,
+ %因为set不再复制其第一个成员的信息。于是定义一个命令,用于动态的修改数据,即添加related域的信息
+ %其中使用了\DeclareStyleSourcemap,但由于其只能出现在导言区中,因此\defdoublelangentry命令也只能出现在导言区中
+ \newcommand{\defdoublelangentry}[2]{%
+ \edef\entrykeya{##1}
+ \edef\entrykeyb{##2}
+ \DeclareStyleSourcemap{
+ \maps[datatype=bibtex]{
+ \map{
+ \step[fieldsource=entrykey, match=\entrykeya, final]
+ \step[fieldset=related, fieldvalue=\entrykeyb]
+ }
+ }
+ }
+ }
+
+%
+% 关联文献间的分隔符
+%
+\renewcommand{\relateddelim}{\adddot\newline\nobreak}%\par,而作者年样式不需要修改,因为没有项对齐的标签问题
+
+%
+% 关联文献块前的分隔符,针对biblatex>=3.11
+%
+% 原理方法:因为增加了begrelateddelim钩子,所以不需要重定义related输出宏
+\renewcommand{\begrelateddelim}{\adddot\newline\nobreak}
+
+
+%
+% 调整doi+eprint+url格式
+%
+% 原理方法:源来自standard.bbx,因为页码后面直接跟引用日期,没有标点所以去掉其中的标点。
+\renewbibmacro*{doi+eprint+url}{%
+% \iftoggle{bbx:doi}%把doi的位置放到url后面
+% {\printfield{doi}}
+% {}%
+ %\newunit\newblock
+ \iftoggle{bbx:eprint}
+ {\iffieldundef{eprint}{}{\newunit\usebibmacro{eprint}}}
+ {}%
+ %\newunit\newblock
+ \iftoggle{bbx:url}
+ {\usebibmacro{url+urldate}}
+ {}
+ \newunit\newblock
+ \iftoggle{bbx:doi}
+ {\printfield{doi}}
+ {}}
+
+%
+% 调整页码的格式,即chapter+pages格式
+%
+\renewbibmacro*{chapter+pages}{%
+\iftoggle{bbx:gbstrict}{}{%
+ \printfield{chapter}}%
+ \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出
+ \setunit{\bibpagespunct}%
+ \printfield{pages}}%
+ %\newunit %这里的标点去掉
+}
+
+%
+% 当location等出版项超过maxitem缩减后不再输出etal
+%
+\DeclareListFormat{location}{%
+ \usebibmacro{list:delim}{#1}%
+ #1\isdot}
+\DeclareListAlias{institution}{location}
+\DeclareListAlias{publisher}{location}
+
+% 新增一个样式用于输出连续出版物的地址,单位,时间,
+% 用于periodical连续出版物的出版社和地址的处理
+%
+% v1.0k,20180425,为出版信息增加字体控制命令,hzz
+% %类似\newbibmacro*{publisher+location+date}
+\newbibmacro*{location+institution+date}{\bibpubfont%
+\iftoggle{bbx:gbpub}%
+{\testCJKfirst{userd}%
+\ifboolexpr{%
+test {\iflistundef{location}} and test {\iflistundef{institution}}%
+}{\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress}\space :\space\str at nopublisher]}%
+{\printtext{[S.l.\space :\space s.n.\adddot]}}%
+}{%
+\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress]}}{\printtext{[S.l.\adddot]}}}%
+ {\printlist{location}}%
+\addcolon\addspace%
+\iflistundef{institution}{%
+\iftoggle{ifCJKforgbt}{\printtext{[\str at nopublisher]}}{\printtext{\mkbibbrackets{s.n.}}}}%
+{\printlist{institution}}}%
+\setunit{\addcomma\addspace}%
+ %\usebibmacro{date}%
+ \printfield{year}%
+ \bibrangedash%
+ \iffieldundef{endyear}{}{\printfield{endyear}}%
+ \newunit}%
+{\printlist{location}%
+ \iflistundef{institution}%
+ {\setunit*{\addcomma\space}}
+ {\setunit*{\addcolon\space}}%
+ \printlist{institution}%
+ \setunit*{\addcomma\space}%
+ \usebibmacro{date}%
+ \newunit}%
+}
+%
+% 通用的出版社和地址的处理
+%
+% 原理方法:当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。
+% 事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。
+% 注意标准standard类型,因为当没有出版项时直接省略,所以做特殊处理
+\renewbibmacro*{publisher+location+date}{\bibpubfont%
+\iftoggle{bbx:gbpub}%
+{\testCJKfirst{userd}%
+ \ifboolexpr{ test {\iflistundef{location}} and test {\iflistundef{publisher}} }%
+ {\iffieldequalstr{note}{standard}{}{\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress}\space :\space\str at nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}%
+ {\iflistundef{location}{%\adddot
+ \iffieldequalstr{note}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。
+ {\iftoggle{ifCJKforgbt}{\printtext{[\str at noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}}}% \bibstring{noaddress}
+ {\printlist{location}\addcolon\addspace}%%\addcolon\addspace%
+ \iflistundef{publisher}{%
+ \iffieldequalstr{note}{standard}{}%
+ {\iftoggle{ifCJKforgbt}{\printtext{[\str at nopublisher]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}%
+ {\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}}}%
+ {\printlist{publisher}}}%
+\setunit*{\addcomma\addspace}%\addcomma\addspace%
+\usebibmacro{date}%%\newunit %去掉这个标点
+}%
+{\printlist{location}%
+ \iflistundef{publisher}
+ {\setunit*{\addcomma\space}}
+ {\setunit*{\addcolon\space}}%
+ \printlist{publisher}%
+ \setunit*{\addcomma\space}%
+ \usebibmacro{date}%%\newunit
+ }%
+}
+
+%
+% 修改了一个institution+location+date用于manual、report、thesis等类型
+%
+% 20180425,v1.0k,增加了字体控制命令,hzz
+% 20190105,v1.0o,加了一个编组避免\usebibmacro{date}把month和day信息去掉
+\renewbibmacro*{institution+location+date}{\bibpubfont%当没有institution时不处理。
+{\printlist{location}%%加了一个编组避免\usebibmacro{date}把month和day信息去掉
+ \iflistundef{institution}
+ {\setunit*{\addcomma\space}}
+ {\setunit*{\addcolon\space}}%
+ \printlist{institution}%
+ \setunit*{\addcomma\space}%
+ \usebibmacro{date}%
+ %\newunit
+ }}
+
+%
+% 对volume卷信息格式做出修改
+% v1.0o,20190105,hzz
+%
+\DeclareFieldFormat{volume}{%
+\testCJKfirst{userd}%
+\iftoggle{ifCJKforgbt}%
+{\bibstring{serialcn}#1\bibstring{volumecn}}%
+{\bibstring{volume}~#1}%
+}% volume of a book
+\DeclareFieldFormat[article,periodical]{volume}{#1}% volume of a journal
+
+%
+% 对number册信息格式做出修改
+% v1.0o,20190105,hzz
+%
+\DeclareFieldFormat{number}{#1}%
+\DeclareFieldFormat[book,collection,inbook,%
+incollection,proceedings,inproceedings]{number}{%
+\testCJKfirst{userd}%
+\iftoggle{ifCJKforgbt}%
+{\bibstring{serialcn}#1\bibstring{numbercn}}%
+{#1}%
+}%
+
+%
+% 对edition版本信息格式做出修改
+%
+\DeclareFieldFormat{edition}{%源来自biblatex.DEF
+\testCJKfirst{userd}%
+\iftoggle{ifCJKforgbt}%
+{\ifinteger{#1}%
+{\printtext{#1\str at edition}}%
+{#1\isdot}}%
+{\ifinteger{#1}%
+{\mkbibordedition{#1}~\bibstring{edition}}%
+{#1\isdot}}}
+
+%
+% 对version的版本信息做出修改
+%
+\DeclareFieldFormat{version}{%源来自biblatex.DEF
+\testCJKfirst{userd}%
+\ifinteger{#1}%
+{\iftoggle{ifCJKforgbt}{\printtext{#1\str at edition}}%
+{\mkbibordedition{#1}~\bibstring{version}}}%
+{#1\isdot}}
+
+%
+% 修改析出文献的文集的标题与附加标题间的符号
+%
+\renewbibmacro*{booktitle}{%
+ \ifboolexpr{
+ test {\iffieldundef{booktitle}}
+ and
+ test {\iffieldundef{booksubtitle}}
+ }
+ {}
+ {\printtext[booktitle]{\bibtitlefont%
+ \printfield[titlecase]{booktitle}%
+ \setunit{\subtitlepunct}%
+ \printfield[titlecase]{booksubtitle}}%
+ \newunit%标点换成下一句
+ \setunit{\subtitlepunct}}%
+ \printfield{booktitleaddon}}
+
+
+%
+% 调整期刊名的格式
+%
+% v1.0k,20180425,增加了字体控制命令,hzz
+\renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx
+ \usebibmacro{journal}%
+ %\setunit*{\addspace}%
+ \setunit*{\addcomma\addspace}%修改为增加一个逗号
+ \iffieldundef{series}
+ {}
+ {\newunit
+ \printfield{series}%
+ \setunit{\addspace}}%
+ %\usebibmacro{volume+number+eid}%
+ %\setunit{\addspace}%
+ \usebibmacro{issue+date}%
+ %\setunit{\addcolon\space}%
+ \iffieldundef{volume}{}{\setunit{\addcomma\space}}%
+ %换成逗号和空格
+ \usebibmacro{issue}%
+ \usebibmacro{volume+number+eid}%把卷期放到年份后面
+ %\newunit
+ }
+
+
+
+%
+% 调整期刊卷和期的格式
+%
+\renewbibmacro*{volume+number+eid}{%源来自standard.bbx
+\iftoggle{bbx:gbfieldstd}{%
+ \printfield{volume}%
+ \setunit*{\adddot}%
+ \printfield{number}%
+ \setunit{\addcomma\space}%
+ \printfield{eid}}{%
+ \printfield{volume}%
+ %\setunit*{\adddot}%去掉点号
+ %\printfield{number}%
+ \iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号
+ \iffieldundef{eid}{}{%
+ \setunit{\addcomma\space}%
+ \printfield{eid}}}}
+
+%
+% 调整期刊年份的格式
+%
+\renewbibmacro*{issue+date}{%去掉括号
+ \printtext{%去掉了[parens]
+ \iffieldundef{issue}
+ {%\usebibmacro{date}
+ \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸
+ {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸
+ {\usebibmacro{date}}%
+ }}%
+ {\iftoggle{bbx:gbstrict}{}{\printfield{issue}%
+ \setunit*{\addspace}}%
+ %\usebibmacro{date}
+ \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸
+ {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸
+ {\usebibmacro{date}}%
+ }}}%
+ %\newunit
+ }
+
+%
+% 调整页码前的标点和去掉期刊文章等页码后面的标点
+%
+\renewbibmacro*{note+pages}{%源来自standard.bbx
+ %\printfield{note}%不要note,note用来判断是否是报纸newspaper
+ \iffieldundef{pages}{}{
+ \setunit{\bibpagespunct}%
+ \printfield{pages}}%
+ %\newunit
+ }
+
+
+%
+% 编者的符号修改一下
+% v1.0 2016-07-01
+% v1.0q 2019-03-01 hzz 修改editortype前的标点
+%
+\renewbibmacro*{editor}{%源来自biblatex.DEF
+ \ifboolexpr{
+ test \ifuseeditor
+ and
+ not test {\ifnameundef{editor}}
+ }
+ {\printnames{editor}%
+ \iffieldundef{editortype}%增加一个类型判断,用于存在editortype的情况
+ {\setunit\addspace}%当没有editortype时,直接用句点
+ {%\setunit{\addcomma\space}%
+ \usebibmacro{editorstrg}}%
+ %\clearname{editor}
+ }%
+ {}}
+
+%
+% 编者类型做一修改
+% v1.0 2016-07-01
+% v1.0q 2019-03-01 hzz 修改editortype不同语言的不同本地化字符串
+%
+\renewbibmacro*{editorstrg}{%源来自biblatex.DEF
+ \printtext[editortype]{%
+ \iffieldundef{editortype}
+ {%
+% \ifboolexpr{ %这一段去掉,未定义编者类型情况下不处理
+% test {\ifnumgreater{\value{editor}}{1}}
+% or
+% test {\ifandothers{editor}}
+% }
+% {\bibstring{editors}}
+% {\bibstring{editor}}
+ }
+ {\ifbibxstring{\thefield{editortype}} %定义编者类型情况下处理,以后根据需要修改
+ {\ifboolexpr{
+ test {\ifnumgreater{\value{editor}}{1}}
+ or
+ test {\ifandothers{editor}}
+ }
+ {\printdelim{streditortypes}}
+ {\printdelim{streditortype}}}
+ {\thefield{editortype}}}%
+ }}
+
+%
+% 编者类型的本地化字符串输出
+% v1.0q 2019-03-01 hzz
+% 能对不同条目类型作格式设置的域格式,能对不同环境做格式设置的分隔符
+% 能对不同文境作设置的包括排序,标签等
+% 这里因为考虑可能标注和文献表中存在不同,所以用分隔符来输出本地化字符串
+%
+\DeclareDelimFormat{streditortypes}{%
+ \edef\userfieldabcde{userd}%
+ \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
+ \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbbiblocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}scn}}{}%
+ \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}skr}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}sjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}%
+ \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}%
+ \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}%
+ \or%
+ \bibstring{\thefield{editortype}scn}%
+ \or%
+ \addcomma\addthinspace\bibstring{\thefield{editortype}s}%
+ \fi}
+%
+\DeclareDelimFormat{streditortype}{%
+ \edef\userfieldabcde{userd}%
+ \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
+ \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}%
+ \ifcase\value{gbbiblocalcase}%
+ \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}cn}}{}%
+ \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}kr}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}jp}}{}%
+ \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}%
+ \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}%
+ \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}%
+ \or%
+ \bibstring{\thefield{editortype}cn}%
+ \or%
+ \addcomma\addthinspace\bibstring{\thefield{editortype}}%
+ \fi}
+
+
+%
+% bookauthor域的输出,
+% v1.0q 2019-03-01 hzz
+% 不再对editor和bookauthor做sourcemap,而是下面的宏内逻辑代替,
+% 使得除使用bookauthor外也可以使用editor,便于在使用editor时使用editortype
+\renewbibmacro*{bybookauthor}{%
+ \ifnameundef{bookauthor}%
+ {\ifnameundef{editor}%
+ {}%
+ {\ifnamesequal{author}{editor}%
+ {}{\usebibmacro{editor}}}%
+ }%
+ {\ifnamesequal{author}{bookauthor}%
+ {}{\printnames{bookauthor}}%
+ }%
+}
+
+%
+% 修改期刊的标题
+%
+\renewbibmacro*{periodical}{%源来自biblatex.DEF
+ \iffieldundef{title}
+ {}
+ {\printtext[title]{\bibtitlefont%
+ \printfield[titlecase]{title}%
+ %\setunit{\subtitlepunct}%
+ \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
+ {}{\setunit{\subtitlepunct}
+ \printfield[titlecase]{subtitle}}%
+ %{}%把编组结束移到后面去
+ \iftoggle{bbx:gbtype}{%
+ \iffieldundef{usera}{}{%在标题后直接给出文献标识字母
+ \printfield[gbtypeflag]{usera}}}{}
+ }}
+ }
+
+
+%
+% 期刊的标题做修改
+%
+\renewbibmacro*{title+issuetitle}{%源来自standard.BBX
+ \usebibmacro{periodical}%
+ %\setunit*{\addspace}%
+ \setunit*{\adddot\addspace}%标点修改为句点
+ \iffieldundef{series}
+ {}
+ {\newunit
+ \printfield{series}%
+ \setunit{\addspace}}%
+ \usebibmacro{periodical+issue}%将issue调整到上面来,并修改
+\iffieldundef{number}{}{%%进一步处理有范围的数字
+ \multinumberparser{\thefield{number}}}%
+ \iffieldundef{volume}%
+ {\printfield{year}%
+ \printtext{\mkbibparens{\multinumberfirst}}%
+ \bibrangedash%
+ \iffieldundef{endyear}{}{\printfield{endyear}\printtext{\mkbibparens{\multinumbersecond}}}%
+ }%
+ {\multivolparser{\thefield{volume}}%
+ \printfield{year}%
+ \setunit{\addcomma\space}%将冒号修改为逗号
+ \printtext{\multivolfirst}%
+ \printtext{\mkbibparens{\multinumberfirst}}%
+ \bibrangedash%
+ \iffieldundef{endyear}{}{%
+ \printfield{endyear}%
+ \setunit{\addcomma\space}%将冒号修改为逗号
+ \printtext{\multivolsecond}%
+ \printtext{\mkbibparens{\multinumbersecond}}}%
+ }%
+ \setunit{\addcomma\space}%
+ \printfield{eid}%
+ \setunit{\addspace}%
+ %\usebibmacro{issue+date}%
+ %\setunit{\addcolon\space}%
+ \usebibmacro{issue}%
+ \newunit}
+
+%
+% 新增一个样式用于调整期刊年份的格式,只打印年份
+%
+\newbibmacro*{periodical+issue}{%
+ \printtext{%去掉了[parens]
+ \iffieldundef{issue}
+ {%\usebibmacro{date}%修改为下一句
+ }%
+ {\printfield{issue}%
+ \setunit*{\addspace}%
+ %\usebibmacro{date}%修改为下一句
+ }%
+ }%
+ %\newunit
+}
+
+%
+% 重设专利title的输出,将文献类型标识符输出出去
+%
+\newbibmacro*{patenttitle}{%原输出来自biblatex.def文件
+ \ifboolexpr{%
+ test{\iffieldundef{title}}%
+ and%
+ test{\iffieldundef{subtitle}}%
+ }%
+ {}%
+ {\printtext[title]{\bibtitlefont%
+ \printfield[titlecase]{title}%
+ \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
+ {}{\setunit{\subtitlepunct}%
+ \printfield[titlecase]{subtitle}}%
+ \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
+ {\setunit{\subtitlepunct}\printfield{titleaddon}}%
+ \setunit{\subtitlepunct}\printfield{number}%写专利号
+ \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}%
+ %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点
+ %\newunit
+ }%
+}%
+}
+
+
+
+%
+% 修改in:用于inbook、incollection、inproceedings等类型
+% 2018.04.20,v1.0k,renewed marco,by hzz
+% 20190212,v1.0q,增加中英文区分,by hzz
+%
+% 原理方法:使用bibmacro{in:}改变了以前在driver中直接输出//的方式,同时也简化了标点控制。
+\renewbibmacro*{in:}{%
+ \iftoggle{bbx:gbpunctin}{\printtext{\allowbreak\texttt{//}\allowbreak}}%\addthinspace
+ {\setunit{\adddot\addspace}%
+ \iffieldequalstr{userd}{chinese}%
+ {\printtext{\bibstring{incn}}}%
+ {\printtext{\bibstring{in}}}%
+ }}%\newunit\newblock\intitlepunct
+
+%
+% 修改type域的输出格式
+% 2019.02.12,v1.0q,byhzz
+% 使其可以区分中英文输出不同的格式,比如博士论文英文输出PHD thesis,中文则是博士学位论文
+\DeclareFieldFormat{type}%
+{\iffieldequalstr{userd}{chinese}%
+ {\ifbibxstring{#1cn}{\bibxstring{#1cn}}{#1}}%
+ {\ifbibstring{#1}{\bibstring{#1}}{#1}}%
+}
+
+
+%
+% 修改series域的输出格式
+% 2019.05.01,v1.0r,byhzz
+\renewbibmacro*{series+number}{%
+ \printfield{series}%
+ %\setunit*{\addspace}%
+ %\printfield{number}%
+ %\newunit
+ }
+
+%=====================================================================
+%设置驱动格式
+%=====================================================================
+%
+% book条目类的驱动
+%
+ \DeclareBibliographyDriver{book}{%源来自standard.bbx文件
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+\usebibmacro{author/editor+others/translator+others}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+\usebibmacro{maintitle+title}%
+\iftoggle{bbx:gbstrict}{}{%
+\newunit
+\printlist{language}%
+\newunit\newblock%
+\usebibmacro{byauthor}%
+\newunit\newblock}%
+\usebibmacro{byeditor+others}%
+\newunit
+\printfield{edition}%
+\newunit\newblock%%
+\iftoggle{bbx:gbstrict}{}{%
+\iffieldundef{maintitle}%
+{\printfield{volume}%
+\printfield{part}}%
+{}%
+\newunit%
+\printfield{volumes}%
+\newunit\newblock%
+\usebibmacro{series+number}}%
+\newunit\newblock%
+%\printfield{note}%
+%\newunit\newblock%
+\usebibmacro{publisher+location+date}%
+%\newunit\newblock %这里标点去掉
+\usebibmacro{chapter+pages}%
+ \iffieldundef{url}{}{%当没有网址时也不输出
+ \usebibmacro{modifydate}}%带括号的修改或更新日期,
+\usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。
+ \newunit\newblock%
+ \printfield{pagetotal}%
+ \newunit\newblock%
+ \iftoggle{bbx:isbn}
+ {\printfield{isbn}}
+ {}%
+ \newunit\newblock
+ %\usebibmacro{doi+eprint+url}%
+ %\newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+
+%
+% 期刊文章,连续出版物中的析出文献的格式
+%
+ \DeclareBibliographyDriver{article}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/translator+others}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ \usebibmacro{title}%
+ \iftoggle{bbx:gbstrict}{}{%
+ \newunit%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}%
+ \newunit\newblock
+ \usebibmacro{bytranslator+others}%
+ \newunit\newblock
+ \printfield{version}}%
+ \newunit\newblock
+ %\usebibmacro{in:}% 不使用in来表示期刊等连续出版物
+ \usebibmacro{journal+issuetitle}%
+ %\newunit
+% \usebibmacro{byeditor+others}%
+% \newunit
+ \usebibmacro{note+pages}%
+ \iffieldequalstr{note}{news}{}{%当是新闻时不输出修改或更新日期
+ \iffieldundef{url}{}{%当没有网址时也不输出
+ \iftoggle{bbx:url}{%当url选项为false时,也不输出
+ \usebibmacro{modifydate}}{}}}%带括号的修改或更新日期,
+ \usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置
+ \newunit\newblock
+ \iftoggle{bbx:isbn}
+ {\printfield{issn}}
+ {}%
+ \newunit\newblock
+ %\usebibmacro{doi+eprint+url}%
+ %\newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+
+
+%
+% 连续出版物的驱动
+%
+ \DeclareBibliographyDriver{periodical}{%源来自standard.BBX
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{editor}%
+ %\setunit{\labelnamepunct}\newblock
+ \newunit\newblock %删除上面一行,添加这一行
+ \usebibmacro{title+issuetitle}%
+ \newunit\newblock%
+ \usebibmacro{location+institution+date}%添加这一行用于输出地址,单位和时间
+ \newunit\newblock%添加这一行
+ \iftoggle{bbx:gbstrict}{}{%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byeditor}%
+ \newunit\newblock
+ \printfield{note}%
+ \newunit\newblock}
+ \iftoggle{bbx:isbn}
+ {\printfield{issn}}
+ {}%
+ \newunit\newblock
+ \usebibmacro{doi+eprint+url}%
+ \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+%
+% 专利文献驱动
+%
+ \DeclareBibliographyDriver{patent}{%源来自standard.BBX
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ %\usebibmacro{title}%
+ \usebibmacro{patenttitle}%给出专利专用的标题输出
+ \iftoggle{bbx:gbstrict}{}{%
+ \newunit%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}}%
+ \newunit\newblock
+ \printfield{type}%
+ \setunit*{\addspace}%
+ %\printfield{number}%已放到patenttitle中处理
+ \iflistundef{location}
+ {}
+ {\setunit*{\addspace}%
+ \printtext{%[parens]
+ \printlist[][-\value{listtotal}]{location}}}%
+ \newunit\newblock
+ \usebibmacro{byholder}%
+ \newunit\newblock
+ \printfield{note}%
+ \newunit\newblock
+ \usebibmacro{newsdate}%
+ %\newunit\newblock
+ \usebibmacro{doi+eprint+url}%
+ \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+
+%
+% 在线文献驱动
+%
+\DeclareBibliographyDriver{online}{%源来自standard.BBX
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/editor+others/translator+others}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ \usebibmacro{title}%
+ \iftoggle{bbx:gbstrict}{}{%
+ \newunit%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}%
+ \newunit\newblock
+ \usebibmacro{byeditor+others}%
+ \newunit\newblock
+ \printfield{note}}%
+ \newunit
+ \printfield{version}%
+ \newunit\newblock
+ %\printlist{organization}%
+ \printlist{institution}%
+ \newunit\newblock
+\ifboolexpr{%
+test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}%
+}{\usebibmacro{date}}%
+{\usebibmacro{modifydate}}%修改或更新日期,为带括号的时间
+ \usebibmacro{url+urldate}%从下面移上来
+ \newunit\newblock
+ \iftoggle{bbx:eprint}
+ {\usebibmacro{eprint}}
+ {}%
+ \newunit\newblock
+ %\usebibmacro{url+urldate}%
+ %\newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+
+%
+% 报告类型驱动
+% 当有网址无出版项时,用online输出
+%
+\DeclareBibliographyDriver{report}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ \usebibmacro{title}%
+ \iftoggle{bbx:gbstrict}{}{%
+ \newunit%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}}%
+ \newunit\newblock
+ \usebibmacro{byeditor+others}%增加的译者信息
+ \newunit\newblock
+ \printfield{type}%
+ \setunit*{\addspace}%
+ \printfield{number}%
+ \newunit\newblock
+ \printfield{version}%
+ \newunit
+ \printfield{note}%
+ \newunit\newblock
+ \usebibmacro{publisher+location+date}%
+ %\newunit\newblock
+ \usebibmacro{chapter+pages}%
+ \usebibmacro{doi+eprint+url}%
+ \newunit
+ \printfield{pagetotal}%
+ \newunit\newblock
+ \iftoggle{bbx:isbn}
+ {\printfield{isrn}}
+ {}%
+ \newunit\newblock
+% \usebibmacro{doi+eprint+url}%
+% \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+%
+% 论文、手册类型驱动
+% 2016-11-11,增加了译者信息
+%
+\DeclareBibliographyDriver{manual}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ \usebibmacro{title}%
+ \iftoggle{bbx:gbstrict}{}{%
+ \newunit%
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}}%
+ \newunit\newblock
+ \usebibmacro{byeditor+others}%增加的译者信息
+ \newunit\newblock
+ \iftoggle{bbx:gbfieldtype}{%
+ \printfield{type}%
+ \setunit*{\addspace}}{}%
+ \printfield{number}%
+ \newunit\newblock
+ \printfield{version}%
+ \newunit
+ \printfield{note}%
+ \newunit\newblock
+ \usebibmacro{institution+location+date}%
+ %\newunit\newblock
+ \usebibmacro{chapter+pages}%
+ \iffieldundef{url}{}{%当没有网址时也不输出修改或更新日期
+ \usebibmacro{modifydate}}%修改或更新日期为带括号的时间
+ \usebibmacro{doi+eprint+url}%
+ \newunit
+ \printfield{pagetotal}%
+ \newunit\newblock
+ \iftoggle{bbx:isbn}
+ {\printfield{isrn}}
+ {}%
+ \newunit\newblock
+% \usebibmacro{doi+eprint+url}%
+% \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+%
+% 备选类型驱动
+%
+% 利用biblatex的misc驱动
+\DeclareBibliographyDriver{misc}{%
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/editor+others/translator+others}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+ \usebibmacro{title}%
+\iftoggle{bbx:gbstrict}{}{%
+ \newunit
+ \printlist{language}%
+ \newunit\newblock
+ \usebibmacro{byauthor}%
+ \newunit\newblock
+ \usebibmacro{byeditor+others}}%
+ \newunit\newblock
+ \printfield{howpublished}%
+ \newunit\newblock
+ \printfield{type}%
+ \newunit
+ \printfield{version}%
+ \newunit
+ \printfield{note}%
+ \newunit\newblock
+ \usebibmacro{institution+location+date}%
+ %\usebibmacro{organization+location+date}%
+ %\newunit\newblock
+ \usebibmacro{doi+eprint+url}%
+ \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+
+%
+% 专著中的析出文献的格式修改
+%
+\DeclareBibliographyDriver{inbook}{%源来自standard.bbx
+ \usebibmacro{bibindex}%
+ \usebibmacro{begentry}%
+ \usebibmacro{author/translator+others}%
+\ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
+\usebibmacro{title}%
+\usebibmacro{in:}%
+%\printtext{\texttt{//}\addthinspace}%
+ \usebibmacro{bybookauthor}%
+ \ifnameundef{bookauthor}{%
+ \ifnameundef{editor}{}{\newunit}%
+ }{\newunit}%替换下一句
+ %\newunit\newblock
+\iffieldundef{series}{}{\usebibmacro{series+number}\setunit{\addcolon\addspace}}%为处理一些存在series的情况而增加
+ \usebibmacro{maintitle+booktitle}%
+\iffieldundef{volume}{}{\setunit{\addcolon\addspace}\printfield{volume}}%
+\iffieldundef{number}{}{\setunit{\addcolon\addspace}\printfield{number}}%增加卷和册信息
+ \newunit\newblock%
+% \usebibmacro{byeditor+others}%
+% \newunit\newblock
+ \printfield{edition}%
+ \newunit
+ \iftoggle{bbx:gbstrict}{}{%
+% \iffieldundef{maintitle}
+% {\printfield{volume}%
+% \printfield{part}}
+% {}%
+% \newunit
+% \printfield{volumes}%
+% \newunit\newblock
+% \usebibmacro{series+number}
+ }%
+ \newunit\newblock
+ %\printfield{note}%
+ %\newunit\newblock
+ \usebibmacro{publisher+location+date}%
+ %\newunit\newblock
+ \usebibmacro{chapter+pages}%
+ %\newunit\newblock
+ \usebibmacro{doi+eprint+url}%移到上面来
+ \newunit\newblock
+ \iftoggle{bbx:isbn}
+ {\printfield{isbn}}
+ {}%
+ \newunit\newblock
+% \usebibmacro{doi+eprint+url}%
+% \newunit\newblock
+ \usebibmacro{addendum+pubstate}%
+ \setunit{\bibpagerefpunct}\newblock
+ \usebibmacro{pageref}%
+ \newunit\newblock
+ \iftoggle{bbx:related}
+ {\usebibmacro{related:init}%
+ \usebibmacro{related}}
+ {}%
+ \usebibmacro{finentry}\usebibmacro{annotation}}
+
+
+%
+%针对不同refsection做不同的格式处理的代码
+%
+
+%
+%默认采用顺序编码制,因此只需增加的是作者年制
+\newrobustcmd{\setaystylesection}[1]{\csxdef{gb at aystyle@section#1}{#1}}
+
+%
+%在AtBeginBibliography处已经无法重定义defbibenvironment{bibliographyay}
+%所以输出只能是用另外定义的环境来实现
+%可以在refsection后面做patch
+%为排序引入newrefcontext
+\apptocmd{\refsection}{
+\edef\gb at refsecnum{\number\c at refsection}%
+\ifcsdef{gb at aystyle@section\gb at refsecnum}%
+{
+\newrefcontext[sorting=gb7714-2015]
+
+\setlength{\bibhang}{1em}
+\setlength{\bibitemindent}{-\bibhang}
+\defbibenvironment{bibliography}
+ {\list
+ {}
+ {\setlength{\leftmargin}{\bibhang}%
+ \setlength{\itemindent}{\bibitemindent}%
+ \setlength{\itemsep}{\bibitemsep}%
+ \setlength{\parsep}{\bibparsep}}}
+ {\endlist}
+ {\item}
+}{}
+}{}{}
+
+%
+%为排序引入endrefcontext
+%
+\pretocmd{\endrefsection}{
+\edef\gb at refsecnum{\number\c at refsection}%
+\ifcsdef{gb at aystyle@section\gb at refsecnum}%
+{\endrefcontext}{}
+}{}{}
+
+%因为是整个文献表,在打印文献表的时候,增加钩子代码
+%因为下面的钩子是在defbibenvironment的begincode之后,所以对于defbibenvironment相关的设置都是无效的
+\AtBeginBibliography{
+
+\edef\gb at refsecnum{\number\c at refsection}%
+\ifcsdef{gb at aystyle@section\gb at refsecnum}%
+%\ifboolexpr{
+%not test {\ifcsundef{gb at aystyle@section\gb at refsecnum}}
+%and
+%test {\ifcsequal{gb at refsecnum}{gb at aystyle@section\gb at refsecnum}}
+%}
+ {
+
+ \DeclareDelimFormat{nameyeardelim}{\addcomma\space}
+ \DeclareDelimFormat[bib,biblist]{nameyeardelim}{\addcomma\space}
+
+ \renewbibmacro*{date}{%
+ \iflabeldateisdate
+ {}
+ {\printdate}}%
+
+ \renewbibmacro*{date+extradate}{%
+ \iffieldundef{labelyear}
+ {}
+ {\printtext{%[parens]%这里去掉括号
+ \iflabeldateisdate
+ {\printdateextra}
+ {\printlabeldateextra}}}}%
+
+ \newbibmacro*{bbx:savehash}{%
+ \savefield{fullhash}{\bbx at lasthash}}
+
+ \newbibmacro*{bbx:dashcheck}[2]{}
+
+ %注意这里当没有作者只有标题时在年份之前的标点是否需要标准并未涉及,所以未做处理。
+ \renewbibmacro*{author}{%以前的date+extrayear变为date+extradate,所以对3.8以上版本重定义一下author
+ \ifboolexpr{
+ test \ifuseauthor
+ and
+ not test {\ifnameundef{author}}
+ }
+ {%
+ \usebibmacro{bbx:savehash}%
+ \printnames{author}%
+ \iffieldundef{authortype}
+ {\setunit{\printdelim{nameyeardelim}}}
+ {\setunit{\printdelim{authortypedelim}}}%
+ \iffieldundef{authortype}
+ {}
+ {\usebibmacro{authorstrg}%
+ \setunit{\printdelim{nameyeardelim}}}
+ }%
+ {\global\undef\bbx at lasthash
+ \usebibmacro{labeltitle}%
+ \setunit*{\printdelim{nonameyeardelim}}}%
+ \usebibmacro{date+extradate}}
+
+ \newbibmacro*{labeltitle}{%
+ \iffieldundef{label}
+ {\iffieldundef{shorttitle}
+ {\printfield{title}%
+ \clearfield{title}}
+ {\printfield[title]{shorttitle}}}
+ {\printfield{label}}}
+
+%
+% 增加一个number带括号的格式,避免使用mkbibparens而引入一个不必要的空格
+%
+\DeclareFieldFormat{addnumflag}{%
+\nobreak\printtext{(}\nobreak #1\nobreak\printtext{)}}
+
+%
+% 调整journal输出
+%
+% 原理方法:首先判断子标题,然后再设置标点。
+% 避免直接设置标点后,当volume不存在时需要使用\nopuct去标点进而引入不必要的空格
+\renewbibmacro*{journal}{%
+ \iffieldundef{journaltitle}%
+ {}%
+ {\printtext[journaltitle]{%
+ \printfield[titlecase]{journaltitle}%
+ \iffieldundef{journalsubtitle}{}{\setunit{\subtitlepunct}%
+ \printfield[titlecase]{journalsubtitle}}}}}
+
+
+
+%
+% 调整期刊卷和期的格式
+%
+\renewbibmacro*{volume+number+eid}{%源来自standard.bbx
+\iftoggle{bbx:gbfieldstd}{%
+ \printfield{volume}%
+ \setunit*{\adddot}%
+ \printfield{number}%
+ \setunit{\addcomma\space}%
+ \printfield{eid}}{%
+ \printfield{volume}%
+ %\setunit*{\adddot}%去掉点号
+ %\printfield{number}%
+ \iffieldundef{number}{}{\printfield[addnumflag]{number}}%区别于顺序编码制
+ \iffieldundef{eid}{}{%
+ \setunit{\addcomma\space}%
+ \printfield{eid}}}}
+
+%
+% 调整期刊年份的格式
+%
+% 原理方法:原在authoryear.BBX中\bbx at opt@mergedate at compact中定义
+% 当issue存在时,才设置newunit。避免直接设置标点后,当volume不存在是需要使用\nopuct去标点进而引入不必要的空格
+ \renewbibmacro*{issue+date}{%
+ \iffieldundef{issue}%
+ {}%
+ {\iftoggle{bbx:gbstrict}{}{\printtext[parens]{\printfield{issue}}\newunit}}}
+
+%
+% 编者的符号修改一下
+% v1.0 2016-07-01
+% v1.0q 2019-03-01 hzz 修改editortype前的标点
+%
+\renewbibmacro*{editor}{%
+ \ifboolexpr{
+ test \ifuseeditor
+ and
+ not test {\ifnameundef{editor}}
+ }
+ {\usebibmacro{bbx:dashcheck}
+ {%\bibnamedash
+ \printnames{editor}%
+ }
+ {\printnames{editor}%
+ %\setunit{\printdelim{editortypedelim}}%
+ %\usebibmacro{bbx:savehash}
+ }%
+ \usebibmacro{editorstrg}%
+ %\clearname{editor}%
+ \setunit{\printdelim{nameyeardelim}}}%
+ {\global\undef\bbx at lasthash
+ \usebibmacro{labeltitle}%
+ \setunit*{\printdelim{nonameyeardelim}}}%
+ \ifboolexpr{%
+ test {\ifentrytype{inbook}}
+ or
+ test {\ifentrytype{incollection}}
+ or
+ test {\ifentrytype{inproceedings}}
+ or
+ test {\ifentrytype{conference}}
+ }%
+ {}%
+ {\usebibmacro{date+extradate}}}
+
+
+ }{}
+
+
+
+}
+
+
+
+%
+%针对具体条目做处理时的特殊处理
+%
+%\def\localsetrefsectionstyle{%
+%}
+
+%\AtEveryBibitem{\localsetrefsectionstyle}%
+%\AtEveryCite{\localsetchinesecode}%
+%\AtEveryLositem{\localsetchinesecode}%
Modified: trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015mx.cbx
===================================================================
--- trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015mx.cbx 2021-01-19 22:51:51 UTC (rev 57467)
+++ trunk/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015mx.cbx 2021-01-19 22:57:40 UTC (rev 57468)
@@ -1,466 +1,466 @@
-%%
-%% ---------------------------------------------------------------
-%% biblatex-gb7714-2015 --- A biblatex implementation of the
-%% GBT7714-2015 citation style,numerical sequence
-%% Maintained by huzhenzhen
-%% E-mail: hzzmail at 163.com
-%% Released under the LaTeX Project Public License v1.3c or later
-%% ---------------------------------------------------------------
-%%
-\def\versionofgbtstyle{2020/07/21 v1.0v}
-\ProvidesFile{gb7714-2015mx.cbx}[\versionofgbtstyle biblatex citation style]
-
-%
-% 加载标准样式
-%
-\RequireCitationStyle{numeric-comp} %numeric
-
-
-%
-% 选项设置
-%
-\ExecuteBibliographyOptions{
- %autocite = superscript ,
- %autopunct = true ,
- %sorting = none ,
- maxcitenames=1,
- mincitenames=1,
- uniquename=init,%因为使用了名字缩写选项,所以需要设置uniquename=init而不是full避免冲突
- uniquelist=minyear,
- labeldateparts,
- sortcites,
-}
-
-
-
-%
-% 定义一个上标方括号wrapper
-%
-\newcommand*\mkbibsuperbracket[1]{%
- \mkbibsuperscript{\mkbibbrackets{#1}}%
-}
-
-% 修改postnote的输出格式
-\DeclareFieldFormat{postnote}{#1}
-
-%
-% 重定义cite命令
-%
-% 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode}
-% v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式
-\DeclareCiteCommand{\cite}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号
- {[\usebibmacro{cite:init}%
- \usebibmacro{prenote}}
- {\usebibmacro{citeindex}%
- \usebibmacro{cite:comp}}
- {}
- {\usebibmacro{cite:dump}]%
- \printfield{postnote}}
-% v1.0p 以前用的方式
-%\DeclareCiteCommand{\cite}[\mkbibsuperbracket]%利用mkbibsuperbracket添加方括号
-% {\usebibmacro{cite:init}%
-% \usebibmacro{prenote}}
-% {\usebibmacro{citeindex}%
-% \usebibmacro{cite:comp}}
-% {}
-% {\usebibmacro{cite:dump}%
-% \usebibmacro{postnote}}
-
-%
-% 定义upcite命令
-% 20180604,v1.0l,hzz
-% 20190409,v1.0r,hzz
-% 方法:对supercite增加[]
-\newrobustcmd*{\upcite}{%
- \cite}
-
-%
-% 重定义parencite命令,以满足标签带页码的国标要求
-%
-\DeclareCiteCommand{\parencite}%[\mkbibbrackets]
- {[\usebibmacro{cite:init}%]
- \usebibmacro{prenote}}%
- {\usebibmacro{citeindex}%
- \usebibmacro{cite:comp}}
- {}
- {%[
- \usebibmacro{cite:dump}]%
- \mkbibsuperscript{\printfield{postnote}}}
-
-%
-% 新定义pagescite命令,以满足标签带页码的国标要求
-%
-% 原理方法:
-% 1.新增页码输出宏
-\newbibmacro*{postpages}{%
- \iffieldundef{postnote}
- {\printfield[postnote]{pages}}
- {\printfield{postnote}}}
-% 2.新增\pagescite引用命令
-\DeclareCiteCommand{\pagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标
- {[\usebibmacro{cite:init}%]直接添加方括号
- \usebibmacro{prenote}%
- }
- {\usebibmacro{citeindex}%
- \usebibmacro{cite:comp}}
- {}
- {\usebibmacro{cite:dump}]%
- \usebibmacro{postpages}}
-
-%
-% 定义yearpagescite,为与ay样式兼容,等同于\pagescite
-%
-\DeclareCiteCommand{\yearpagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标
- {[\usebibmacro{cite:init}%]直接添加方括号
- \usebibmacro{prenote}%
- }
- {\usebibmacro{citeindex}%
- \usebibmacro{cite:comp}}
- {}
- {\usebibmacro{cite:dump}]%
- \usebibmacro{postpages}}
-
-%
-% 定义\yearcite命令,为与ay样式兼容,且提供不输出页码的标签格式,
-%
-% 原理方法:等同于\pagescite,但不要页码
-\DeclareCiteCommand{\yearcite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标
- {[\usebibmacro{cite:init}%]直接添加方括号
- \usebibmacro{prenote}%
- }
- {\usebibmacro{citeindex}%
- \usebibmacro{cite:comp}}
- {}
- {\usebibmacro{cite:dump}]}
-
-%
-% 定义\authornumcite命令,输出作者信息,然后在后面带上顺序编码
-% 20180427,v1.0k,增加,hzz
-% gb7714样式新定义的命令都把cite放到最后,比如前面的pagescite,yearcite,这里的\authornumcite
-% 区别于biblatex定义的命令都把cite放到前面,比如citeauthor等。
-%见numeric.CBX
-\newbibmacro*{cite}{%
- \printtext[bibhyperref]{%
- \printfield{labelprefix}%
- \printfield{labelnumber}%
- \ifbool{bbx:subentry}
- {\printfield{entrysetcount}}
- {}}}
-%见numeric.CBX,\DeclareCiteCommand{\cite},
-\DeclareCiteCommand{\authornumcite}%[\mkbibsuperscript]
- {\usebibmacro{prenote}}
- {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace
- {\renewcommand*{\andothersdelim}{\addspace}}%
- \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}%
- \usebibmacro{cite}}}}
- {\multicitedelim}
- {\mkbibsuperscript{\printfield{postnote}}}
-
-
-%
-% 增加如下多个命令
-% 20190409,v1.0r,hzz
-% 方法:利用newcommand或newrobustcmd命令进行定义
-% 注意\citet和\citep命令之所以不用newrobustcmd,是为避免加载natbib模块后产生冲突
-\DeclareCiteCommand{\citet}%
- {\usebibmacro{prenote}}
- {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace
- {\renewcommand*{\andothersdelim}{\addspace}}%
- \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}%
- \usebibmacro{cite}}}}
- {\multicitedelim}
- {\mkbibsuperscript{\printfield{postnote}}}
-
-
-\DeclareCiteCommand{\citep}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号
- {[\usebibmacro{cite:init}%
- \usebibmacro{prenote}}
- {\usebibmacro{citeindex}%
- \usebibmacro{cite:comp}}
- {}
- {\usebibmacro{cite:dump}]%
- \printfield{postnote}}
-
-\newrobustcmd*{\citetns}%
- {\textcite}
-
-\newrobustcmd*{\citepns}%
- {\parencite}
-
-\newrobustcmd*{\inlinecite}%
- {\parencite}
-
-
-%textcite标注命令中的标点设置
-%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}%
-
-%textcite标注命令中的标点设置,注意只针对textcite命令。
-\DeclareDelimFormat[textcite]{nameyeardelim}{}%\addcomma\space
-\DeclareDelimFormat[textcite]{andothersdelim}{\iffieldequalstr{userf}{chinese}{\addthinspace}{\addspace}}%
-\AtEveryCitekey{%
-\iffieldequalstr{userf}{chinese}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace
- {\renewcommand*{\andothersdelim}{\addspace}}%
-}
-
-%
-%
-%
-\apptocmd{\refsection}{
-
-%\edef\gb at refsecnum{\number\c at refsection}
-\edef\gb at refsecnum{\number\c at refsection}%
-\ifcsundef{gb at aystyle@section\gb at refsecnum}%
-{}%
-{
-
-\renewcommand*{\iffinalcitedelim}{%
- \ifnumequal{\value{textcitecount}}{\value{textcitetotal}-1}}
-
-\newbibmacro*{cite:init}{%
- \ifnumless{\value{multicitecount}}{2}
- {\global\boolfalse{cbx:parens}%
- \global\undef\cbx at lasthash
- \global\undef\cbx at lastyear}
- {\iffieldundef{prenote}
- {}
- {\global\undef\cbx at lasthash
- \global\undef\cbx at lastyear}}}
-
-\newbibmacro*{cite:reinit}{%
- \global\undef\cbx at lasthash
- \global\undef\cbx at lastyear}
-
-\newbibmacro*{cite}{%
- \iffieldundef{shorthand}
- {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
- {\usebibmacro{cite:label}%
- \setunit{\printdelim{nonameyeardelim}}%
- \usebibmacro{cite:labeldate+extradate}%
- \usebibmacro{cite:reinit}}
- {\iffieldequals{namehash}{\cbx at lasthash}
- {\ifthenelse{\iffieldequals{labelyear}{\cbx at lastyear}\AND
- \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
- {\setunit{\addcomma}%
- \usebibmacro{cite:extradate}}
- {\setunit{\compcitedelim}%
- \usebibmacro{cite:labeldate+extradate}%
- \savefield{labelyear}{\cbx at lastyear}}}
- {\printnames{labelname}%
- \setunit{\printdelim{nameyeardelim}}%
- \usebibmacro{cite:labeldate+extradate}%
- \savefield{namehash}{\cbx at lasthash}%
- \savefield{labelyear}{\cbx at lastyear}}}}
- {\usebibmacro{cite:shorthand}%
- \usebibmacro{cite:reinit}}%
- \setunit{\multicitedelim}}
-
-\newbibmacro*{citeyear}{%
- \iffieldundef{shorthand}
- {\iffieldundef{labelyear}
- {\usebibmacro{cite:label}%
- \usebibmacro{cite:reinit}}
- {\iffieldequals{namehash}{\cbx at lasthash}
- {\ifthenelse{\iffieldequals{labelyear}{\cbx at lastyear}\AND
- \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
- {\setunit{\addcomma}%
- \usebibmacro{cite:extradate}}
- {\setunit{\compcitedelim}%
- \usebibmacro{cite:labeldate+extradate}%
- \savefield{labelyear}{\cbx at lastyear}}}
- {\usebibmacro{cite:labeldate+extradate}%
- \savefield{namehash}{\cbx at lasthash}%
- \savefield{labelyear}{\cbx at lastyear}}}}
- {\usebibmacro{cite:shorthand}%
- \usebibmacro{cite:reinit}}%
- \setunit{\multicitedelim}}
-
-\newbibmacro*{textcite}{%
- \iffieldequals{namehash}{\cbx at lasthash}
- {\iffieldundef{shorthand}
- {\ifthenelse{\iffieldequals{labelyear}{\cbx at lastyear}\AND
- \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
- {\setunit{\addcomma}%
- \usebibmacro{cite:extradate}}
- {\setunit{\compcitedelim}%
- \usebibmacro{cite:labeldate+extradate}%
- \savefield{labelyear}{\cbx at lastyear}}}
- {\setunit{\compcitedelim}%
- \usebibmacro{cite:shorthand}%
- \global\undef\cbx at lastyear}}
- {\ifnameundef{labelname}
- {\iffieldundef{shorthand}
- {\usebibmacro{cite:label}%
- \setunit{%
- \global\booltrue{cbx:parens}%
- \printdelim{nonameyeardelim}\bibopenparen}%
- \ifnumequal{\value{citecount}}{1}
- {\usebibmacro{prenote}}
- {}%
- \usebibmacro{cite:labeldate+extradate}}
- {\usebibmacro{cite:shorthand}}}
- {\printnames{labelname}%
- \setunit{%
- \global\booltrue{cbx:parens}%
- \printdelim{nameyeardelim}\bibopenparen}%
- \ifnumequal{\value{citecount}}{1}
- {\usebibmacro{prenote}}
- {}%
- \iffieldundef{shorthand}
- {\iffieldundef{labelyear}
- {\usebibmacro{cite:label}}
- {\usebibmacro{cite:labeldate+extradate}}%
- \savefield{labelyear}{\cbx at lastyear}}
- {\usebibmacro{cite:shorthand}%
- \global\undef\cbx at lastyear}}%
- \stepcounter{textcitecount}%
- \savefield{namehash}{\cbx at lasthash}}%
- \setunit{%
- \ifbool{cbx:parens}
- {\bibcloseparen\global\boolfalse{cbx:parens}}
- {}%
- \textcitedelim}}
-
-\newbibmacro*{cite:shorthand}{%
- \printtext[bibhyperref]{\printfield{shorthand}}}
-
-%
-% 重定义cite:label,针对biblatex3.8以上版本set条目集的标注(引用)标签
-%
-% 原理方法:当条目是set时,v3.8以上版本,都没有有用的信息(区别于3.7以下版本set复制第一个成员的信息),
-% 于是利用entrykey来给出标签,那么就要set的条目关键字是需要的字符串,注意字符串中间不能有空格
-\renewbibmacro*{cite:label}{%
- \iffieldundef{label}%
- {\iffieldundef{labeltitle}{\printtext[bibhyperref]{\printfield{entrykey}}}%entrykey
- {\printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}}%
- {\printtext[bibhyperref]{\printfield{label}}}}
-
-\newbibmacro*{cite:labeldate+extradate}{%
- \iffieldundef{labelyear}
- {}
- {\printtext[bibhyperref]{\printlabeldateextra}}}
-
-\newbibmacro*{cite:extradate}{%
- \iffieldundef{extradate}
- {}
- {\printtext[bibhyperref]{\printfield{extradate}}}}
-
-
-
-%
-% 重定义cite:label,针对biblatex3.8以上版本set条目集的标注(引用)标签
-%
-% 原理方法:当条目是set时,v3.8以上版本,都没有有用的信息(区别于3.7以下版本set复制第一个成员的信息),
-% 于是利用entrykey来给出标签,那么就要set的条目关键字是需要的字符串,注意字符串中间不能有空格
-\renewbibmacro*{cite:label}{%
- \iffieldundef{label}%
- {\iffieldundef{labeltitle}{\printtext[bibhyperref]{\printfield{entrykey}}}%entrykey
- {\printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}}%
- {\printtext[bibhyperref]{\printfield{label}}}}
-
-%
-% 重定义cite命令
-%
-% 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode}
-% v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式
-\DeclareCiteCommand{\cite}
- {\usebibmacro{cite:init}%
- \renewbibmacro*{postnote}{%
- \iffieldundef{postnote}%
- {}%
- {\thefield{postnote}}}%
- (\usebibmacro{prenote}}%)
- {\usebibmacro{citeindex}%
- \usebibmacro{cite}}
- {}
- {%(
- )\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote}
- }
-
-\DeclareCiteCommand{\parencite}[\mkbibparens]
- {\usebibmacro{cite:init}%
- \usebibmacro{prenote}}
- {\usebibmacro{citeindex}%
- \usebibmacro{cite}}
- {}
- {\usebibmacro{postnote}}
-
-%
-% 定义\authornumcite命令,输出作者信息,然后在后面带上顺序编码
-% 20180427,v1.0k,增加,hzz
-% 20190409,v1.0r,hzz
-% 为与顺序编码制兼容,增加了命令,定义与citet相同
-\newbibmacro*{citet}{%
- \iffieldundef{shorthand}
- {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
- {\usebibmacro{cite:label}%
- \setunit{\printdelim{nonameyeardelim}}%
- \usebibmacro{cite:labeldate+extradate}%
- \usebibmacro{cite:reinit}}
- {\iffieldequals{namehash}{\cbx at lasthash}
- {\ifthenelse{\iffieldequals{labelyear}{\cbx at lastyear}\AND
- \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
- {\setunit{\addcomma}%
- \usebibmacro{cite:extradate}}
- {\setunit{\compcitedelim}%
- \usebibmacro{cite:labeldate+extradate}%
- \savefield{labelyear}{\cbx at lastyear}}}
- {\printnames{labelname}%
- %\setunit{\printdelim{nameyeardelim}}%
- (\usebibmacro{cite:labeldate+extradate})%
- \savefield{namehash}{\cbx at lasthash}%
- \savefield{labelyear}{\cbx at lastyear}}}}
- {\usebibmacro{cite:shorthand}%
- \usebibmacro{cite:reinit}}%
- \setunit{\multicitedelim}}
-
-\DeclareCiteCommand{\authornumcite}%
- {\usebibmacro{cite:init}%
- \renewbibmacro*{postnote}{%
- \iffieldundef{postnote}%
- {}%
- {\thefield{postnote}}}%
- \usebibmacro{prenote}}%
- {\usebibmacro{citeindex}%
- \usebibmacro{citet}}
- {}
- {\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote}
- }
-
-%
-% 增加如下多个命令
-% 20190409,v1.0r,hzz
-% 方法:利用newcommand或newrobustcmd命令进行定义
-% 注意\citet和\citep命令之所以不用newrobustcmd,是为避免加载natbib模块后产生冲突
-
-%同\authornumcite
-\DeclareCiteCommand{\citet}%
- {\usebibmacro{cite:init}%
- \renewbibmacro*{postnote}{%
- \iffieldundef{postnote}%
- {}%
- {\thefield{postnote}}}%
- \usebibmacro{prenote}}%
- {\usebibmacro{citeindex}%
- \usebibmacro{citet}}
- {}
- {\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote}
- }
-
-%同cite
-\DeclareCiteCommand{\citep}
- {\usebibmacro{cite:init}%
- \renewbibmacro*{postnote}{%
- \iffieldundef{postnote}%
- {}%
- {\thefield{postnote}}}%
- (\usebibmacro{prenote}}%)
- {\usebibmacro{citeindex}%
- \usebibmacro{cite}}
- {}
- {%(
- )\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote}
- }
-
-
-}
-}{}{}
+%%
+%% ---------------------------------------------------------------
+%% biblatex-gb7714-2015 --- A biblatex implementation of the
+%% GBT7714-2015 citation style,numerical sequence
+%% Maintained by huzhenzhen
+%% E-mail: hzzmail at 163.com
+%% Released under the LaTeX Project Public License v1.3c or later
+%% ---------------------------------------------------------------
+%%
+\def\versionofgbtstyle{2021/01/19 v1.0w}
+\ProvidesFile{gb7714-2015mx.cbx}[\versionofgbtstyle biblatex citation style]
+
+%
+% 加载标准样式
+%
+\RequireCitationStyle{numeric-comp} %numeric
+
+
+%
+% 选项设置
+%
+\ExecuteBibliographyOptions{
+ %autocite = superscript ,
+ %autopunct = true ,
+ %sorting = none ,
+ maxcitenames=1,
+ mincitenames=1,
+ uniquename=init,%因为使用了名字缩写选项,所以需要设置uniquename=init而不是full避免冲突
+ uniquelist=minyear,
+ labeldateparts,
+ sortcites,
+}
+
+
+
+%
+% 定义一个上标方括号wrapper
+%
+\newcommand*\mkbibsuperbracket[1]{%
+ \mkbibsuperscript{\mkbibbrackets{#1}}%
+}
+
+% 修改postnote的输出格式
+\DeclareFieldFormat{postnote}{#1}
+
+%
+% 重定义cite命令
+%
+% 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode}
+% v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式
+\DeclareCiteCommand{\cite}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号
+ {[\usebibmacro{cite:init}%
+ \usebibmacro{prenote}}
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite:comp}}
+ {}
+ {\usebibmacro{cite:dump}]%
+ \printfield{postnote}}
+% v1.0p 以前用的方式
+%\DeclareCiteCommand{\cite}[\mkbibsuperbracket]%利用mkbibsuperbracket添加方括号
+% {\usebibmacro{cite:init}%
+% \usebibmacro{prenote}}
+% {\usebibmacro{citeindex}%
+% \usebibmacro{cite:comp}}
+% {}
+% {\usebibmacro{cite:dump}%
+% \usebibmacro{postnote}}
+
+%
+% 定义upcite命令
+% 20180604,v1.0l,hzz
+% 20190409,v1.0r,hzz
+% 方法:对supercite增加[]
+\newrobustcmd*{\upcite}{%
+ \cite}
+
+%
+% 重定义parencite命令,以满足标签带页码的国标要求
+%
+\DeclareCiteCommand{\parencite}%[\mkbibbrackets]
+ {[\usebibmacro{cite:init}%]
+ \usebibmacro{prenote}}%
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite:comp}}
+ {}
+ {%[
+ \usebibmacro{cite:dump}]%
+ \mkbibsuperscript{\printfield{postnote}}}
+
+%
+% 新定义pagescite命令,以满足标签带页码的国标要求
+%
+% 原理方法:
+% 1.新增页码输出宏
+\newbibmacro*{postpages}{%
+ \iffieldundef{postnote}
+ {\printfield[postnote]{pages}}
+ {\printfield{postnote}}}
+% 2.新增\pagescite引用命令
+\DeclareCiteCommand{\pagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标
+ {[\usebibmacro{cite:init}%]直接添加方括号
+ \usebibmacro{prenote}%
+ }
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite:comp}}
+ {}
+ {\usebibmacro{cite:dump}]%
+ \usebibmacro{postpages}}
+
+%
+% 定义yearpagescite,为与ay样式兼容,等同于\pagescite
+%
+\DeclareCiteCommand{\yearpagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标
+ {[\usebibmacro{cite:init}%]直接添加方括号
+ \usebibmacro{prenote}%
+ }
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite:comp}}
+ {}
+ {\usebibmacro{cite:dump}]%
+ \usebibmacro{postpages}}
+
+%
+% 定义\yearcite命令,为与ay样式兼容,且提供不输出页码的标签格式,
+%
+% 原理方法:等同于\pagescite,但不要页码
+\DeclareCiteCommand{\yearcite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标
+ {[\usebibmacro{cite:init}%]直接添加方括号
+ \usebibmacro{prenote}%
+ }
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite:comp}}
+ {}
+ {\usebibmacro{cite:dump}]}
+
+%
+% 定义\authornumcite命令,输出作者信息,然后在后面带上顺序编码
+% 20180427,v1.0k,增加,hzz
+% gb7714样式新定义的命令都把cite放到最后,比如前面的pagescite,yearcite,这里的\authornumcite
+% 区别于biblatex定义的命令都把cite放到前面,比如citeauthor等。
+%见numeric.CBX
+\newbibmacro*{cite}{%
+ \printtext[bibhyperref]{%
+ \printfield{labelprefix}%
+ \printfield{labelnumber}%
+ \ifbool{bbx:subentry}
+ {\printfield{entrysetcount}}
+ {}}}
+%见numeric.CBX,\DeclareCiteCommand{\cite},
+\DeclareCiteCommand{\authornumcite}%[\mkbibsuperscript]
+ {\usebibmacro{prenote}}
+ {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace
+ {\renewcommand*{\andothersdelim}{\addspace}}%
+ \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}%
+ \usebibmacro{cite}}}}
+ {\multicitedelim}
+ {\mkbibsuperscript{\printfield{postnote}}}
+
+
+%
+% 增加如下多个命令
+% 20190409,v1.0r,hzz
+% 方法:利用newcommand或newrobustcmd命令进行定义
+% 注意\citet和\citep命令之所以不用newrobustcmd,是为避免加载natbib模块后产生冲突
+\DeclareCiteCommand{\citet}%
+ {\usebibmacro{prenote}}
+ {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace
+ {\renewcommand*{\andothersdelim}{\addspace}}%
+ \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}%
+ \usebibmacro{cite}}}}
+ {\multicitedelim}
+ {\mkbibsuperscript{\printfield{postnote}}}
+
+
+\DeclareCiteCommand{\citep}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号
+ {[\usebibmacro{cite:init}%
+ \usebibmacro{prenote}}
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite:comp}}
+ {}
+ {\usebibmacro{cite:dump}]%
+ \printfield{postnote}}
+
+\newrobustcmd*{\citetns}%
+ {\textcite}
+
+\newrobustcmd*{\citepns}%
+ {\parencite}
+
+\newrobustcmd*{\inlinecite}%
+ {\parencite}
+
+
+%textcite标注命令中的标点设置
+%\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}%
+
+%textcite标注命令中的标点设置,注意只针对textcite命令。
+\DeclareDelimFormat[textcite]{nameyeardelim}{}%\addcomma\space
+\DeclareDelimFormat[textcite]{andothersdelim}{\iffieldequalstr{userf}{chinese}{\addthinspace}{\addspace}}%
+\AtEveryCitekey{%
+\iffieldequalstr{userf}{chinese}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace
+ {\renewcommand*{\andothersdelim}{\addspace}}%
+}
+
+%
+%
+%
+\apptocmd{\refsection}{
+
+%\edef\gb at refsecnum{\number\c at refsection}
+\edef\gb at refsecnum{\number\c at refsection}%
+\ifcsundef{gb at aystyle@section\gb at refsecnum}%
+{}%
+{
+
+\renewcommand*{\iffinalcitedelim}{%
+ \ifnumequal{\value{textcitecount}}{\value{textcitetotal}-1}}
+
+\newbibmacro*{cite:init}{%
+ \ifnumless{\value{multicitecount}}{2}
+ {\global\boolfalse{cbx:parens}%
+ \global\undef\cbx at lasthash
+ \global\undef\cbx at lastyear}
+ {\iffieldundef{prenote}
+ {}
+ {\global\undef\cbx at lasthash
+ \global\undef\cbx at lastyear}}}
+
+\newbibmacro*{cite:reinit}{%
+ \global\undef\cbx at lasthash
+ \global\undef\cbx at lastyear}
+
+\newbibmacro*{cite}{%
+ \iffieldundef{shorthand}
+ {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
+ {\usebibmacro{cite:label}%
+ \setunit{\printdelim{nonameyeardelim}}%
+ \usebibmacro{cite:labeldate+extradate}%
+ \usebibmacro{cite:reinit}}
+ {\iffieldequals{namehash}{\cbx at lasthash}
+ {\ifthenelse{\iffieldequals{labelyear}{\cbx at lastyear}\AND
+ \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
+ {\setunit{\addcomma}%
+ \usebibmacro{cite:extradate}}
+ {\setunit{\compcitedelim}%
+ \usebibmacro{cite:labeldate+extradate}%
+ \savefield{labelyear}{\cbx at lastyear}}}
+ {\printnames{labelname}%
+ \setunit{\printdelim{nameyeardelim}}%
+ \usebibmacro{cite:labeldate+extradate}%
+ \savefield{namehash}{\cbx at lasthash}%
+ \savefield{labelyear}{\cbx at lastyear}}}}
+ {\usebibmacro{cite:shorthand}%
+ \usebibmacro{cite:reinit}}%
+ \setunit{\multicitedelim}}
+
+\newbibmacro*{citeyear}{%
+ \iffieldundef{shorthand}
+ {\iffieldundef{labelyear}
+ {\usebibmacro{cite:label}%
+ \usebibmacro{cite:reinit}}
+ {\iffieldequals{namehash}{\cbx at lasthash}
+ {\ifthenelse{\iffieldequals{labelyear}{\cbx at lastyear}\AND
+ \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
+ {\setunit{\addcomma}%
+ \usebibmacro{cite:extradate}}
+ {\setunit{\compcitedelim}%
+ \usebibmacro{cite:labeldate+extradate}%
+ \savefield{labelyear}{\cbx at lastyear}}}
+ {\usebibmacro{cite:labeldate+extradate}%
+ \savefield{namehash}{\cbx at lasthash}%
+ \savefield{labelyear}{\cbx at lastyear}}}}
+ {\usebibmacro{cite:shorthand}%
+ \usebibmacro{cite:reinit}}%
+ \setunit{\multicitedelim}}
+
+\newbibmacro*{textcite}{%
+ \iffieldequals{namehash}{\cbx at lasthash}
+ {\iffieldundef{shorthand}
+ {\ifthenelse{\iffieldequals{labelyear}{\cbx at lastyear}\AND
+ \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
+ {\setunit{\addcomma}%
+ \usebibmacro{cite:extradate}}
+ {\setunit{\compcitedelim}%
+ \usebibmacro{cite:labeldate+extradate}%
+ \savefield{labelyear}{\cbx at lastyear}}}
+ {\setunit{\compcitedelim}%
+ \usebibmacro{cite:shorthand}%
+ \global\undef\cbx at lastyear}}
+ {\ifnameundef{labelname}
+ {\iffieldundef{shorthand}
+ {\usebibmacro{cite:label}%
+ \setunit{%
+ \global\booltrue{cbx:parens}%
+ \printdelim{nonameyeardelim}\bibopenparen}%
+ \ifnumequal{\value{citecount}}{1}
+ {\usebibmacro{prenote}}
+ {}%
+ \usebibmacro{cite:labeldate+extradate}}
+ {\usebibmacro{cite:shorthand}}}
+ {\printnames{labelname}%
+ \setunit{%
+ \global\booltrue{cbx:parens}%
+ \printdelim{nameyeardelim}\bibopenparen}%
+ \ifnumequal{\value{citecount}}{1}
+ {\usebibmacro{prenote}}
+ {}%
+ \iffieldundef{shorthand}
+ {\iffieldundef{labelyear}
+ {\usebibmacro{cite:label}}
+ {\usebibmacro{cite:labeldate+extradate}}%
+ \savefield{labelyear}{\cbx at lastyear}}
+ {\usebibmacro{cite:shorthand}%
+ \global\undef\cbx at lastyear}}%
+ \stepcounter{textcitecount}%
+ \savefield{namehash}{\cbx at lasthash}}%
+ \setunit{%
+ \ifbool{cbx:parens}
+ {\bibcloseparen\global\boolfalse{cbx:parens}}
+ {}%
+ \textcitedelim}}
+
+\newbibmacro*{cite:shorthand}{%
+ \printtext[bibhyperref]{\printfield{shorthand}}}
+
+%
+% 重定义cite:label,针对biblatex3.8以上版本set条目集的标注(引用)标签
+%
+% 原理方法:当条目是set时,v3.8以上版本,都没有有用的信息(区别于3.7以下版本set复制第一个成员的信息),
+% 于是利用entrykey来给出标签,那么就要set的条目关键字是需要的字符串,注意字符串中间不能有空格
+\renewbibmacro*{cite:label}{%
+ \iffieldundef{label}%
+ {\iffieldundef{labeltitle}{\printtext[bibhyperref]{\printfield{entrykey}}}%entrykey
+ {\printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}}%
+ {\printtext[bibhyperref]{\printfield{label}}}}
+
+\newbibmacro*{cite:labeldate+extradate}{%
+ \iffieldundef{labelyear}
+ {}
+ {\printtext[bibhyperref]{\printlabeldateextra}}}
+
+\newbibmacro*{cite:extradate}{%
+ \iffieldundef{extradate}
+ {}
+ {\printtext[bibhyperref]{\printfield{extradate}}}}
+
+
+
+%
+% 重定义cite:label,针对biblatex3.8以上版本set条目集的标注(引用)标签
+%
+% 原理方法:当条目是set时,v3.8以上版本,都没有有用的信息(区别于3.7以下版本set复制第一个成员的信息),
+% 于是利用entrykey来给出标签,那么就要set的条目关键字是需要的字符串,注意字符串中间不能有空格
+\renewbibmacro*{cite:label}{%
+ \iffieldundef{label}%
+ {\iffieldundef{labeltitle}{\printtext[bibhyperref]{\printfield{entrykey}}}%entrykey
+ {\printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}}%
+ {\printtext[bibhyperref]{\printfield{label}}}}
+
+%
+% 重定义cite命令
+%
+% 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode}
+% v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式
+\DeclareCiteCommand{\cite}
+ {\usebibmacro{cite:init}%
+ \renewbibmacro*{postnote}{%
+ \iffieldundef{postnote}%
+ {}%
+ {\thefield{postnote}}}%
+ (\usebibmacro{prenote}}%)
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite}}
+ {}
+ {%(
+ )\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote}
+ }
+
+\DeclareCiteCommand{\parencite}[\mkbibparens]
+ {\usebibmacro{cite:init}%
+ \usebibmacro{prenote}}
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite}}
+ {}
+ {\usebibmacro{postnote}}
+
+%
+% 定义\authornumcite命令,输出作者信息,然后在后面带上顺序编码
+% 20180427,v1.0k,增加,hzz
+% 20190409,v1.0r,hzz
+% 为与顺序编码制兼容,增加了命令,定义与citet相同
+\newbibmacro*{citet}{%
+ \iffieldundef{shorthand}
+ {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
+ {\usebibmacro{cite:label}%
+ \setunit{\printdelim{nonameyeardelim}}%
+ \usebibmacro{cite:labeldate+extradate}%
+ \usebibmacro{cite:reinit}}
+ {\iffieldequals{namehash}{\cbx at lasthash}
+ {\ifthenelse{\iffieldequals{labelyear}{\cbx at lastyear}\AND
+ \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)}
+ {\setunit{\addcomma}%
+ \usebibmacro{cite:extradate}}
+ {\setunit{\compcitedelim}%
+ \usebibmacro{cite:labeldate+extradate}%
+ \savefield{labelyear}{\cbx at lastyear}}}
+ {\printnames{labelname}%
+ %\setunit{\printdelim{nameyeardelim}}%
+ (\usebibmacro{cite:labeldate+extradate})%
+ \savefield{namehash}{\cbx at lasthash}%
+ \savefield{labelyear}{\cbx at lastyear}}}}
+ {\usebibmacro{cite:shorthand}%
+ \usebibmacro{cite:reinit}}%
+ \setunit{\multicitedelim}}
+
+\DeclareCiteCommand{\authornumcite}%
+ {\usebibmacro{cite:init}%
+ \renewbibmacro*{postnote}{%
+ \iffieldundef{postnote}%
+ {}%
+ {\thefield{postnote}}}%
+ \usebibmacro{prenote}}%
+ {\usebibmacro{citeindex}%
+ \usebibmacro{citet}}
+ {}
+ {\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote}
+ }
+
+%
+% 增加如下多个命令
+% 20190409,v1.0r,hzz
+% 方法:利用newcommand或newrobustcmd命令进行定义
+% 注意\citet和\citep命令之所以不用newrobustcmd,是为避免加载natbib模块后产生冲突
+
+%同\authornumcite
+\DeclareCiteCommand{\citet}%
+ {\usebibmacro{cite:init}%
+ \renewbibmacro*{postnote}{%
+ \iffieldundef{postnote}%
+ {}%
+ {\thefield{postnote}}}%
+ \usebibmacro{prenote}}%
+ {\usebibmacro{citeindex}%
+ \usebibmacro{citet}}
+ {}
+ {\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote}
+ }
+
+%同cite
+\DeclareCiteCommand{\citep}
+ {\usebibmacro{cite:init}%
+ \renewbibmacro*{postnote}{%
+ \iffieldundef{postnote}%
+ {}%
+ {\thefield{postnote}}}%
+ (\usebibmacro{prenote}}%)
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite}}
+ {}
+ {%(
+ )\mkbibsuperscript{\usebibmacro{postnote}}%\usebibmacro{postnote}
+ }
+
+
+}
+}{}{}
More information about the tex-live-commits
mailing list.