From 48975ec7f19deae0658421bccce2ab9617e6a5e7 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 11 Feb 2019 22:05:25 +0000 Subject: biblatex-gb7714-2015 (11feb19) git-svn-id: svn://tug.org/texlive/trunk@50004 c570f23f-e606-0410-a88d-b1316a301751 --- .../doc/latex/biblatex-gb7714-2015/README.md | 17 +- .../biblatex-gb7714-2015/biblatex-gb7714-2015.pdf | Bin 1175128 -> 1176525 bytes .../biblatex-gb7714-2015/biblatex-gb7714-2015.tex | 2 +- .../biblatex-gb7714-2015/biblatex-map-test.bib | 53 +++ .../doc/latex/biblatex-gb7714-2015/biblatex-map.py | 370 +++++++++++++++++++++ .../doc/latex/biblatex-gb7714-2015/example.bib | 31 ++ .../tex/latex/biblatex-gb7714-2015/gb7714-2015.bbx | 264 ++++++++++----- .../tex/latex/biblatex-gb7714-2015/gb7714-2015.cbx | 2 +- .../latex/biblatex-gb7714-2015/gb7714-2015ay.bbx | 309 +++++++++++------ .../latex/biblatex-gb7714-2015/gb7714-2015ay.cbx | 3 +- .../latex/biblatex-gb7714-2015/gb7714-2015ms.bbx | 271 ++++++++++----- .../latex/biblatex-gb7714-2015/gb7714-2015ms.cbx | 2 +- 12 files changed, 1034 insertions(+), 290 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map-test.bib create mode 100644 Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map.py (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/README.md b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/README.md index ccb4c0cea64..83c8e1eef2f 100644 --- a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/README.md +++ b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/README.md @@ -1,4 +1,4 @@ -Date of last change: 2019-02-07 to version v1.0q +Date of last change: 2019-02-11 to version v1.0q # biblatex-gb7714-2015: a biblatex style package @@ -631,7 +631,18 @@ biber -l zh__stroke jobname > 在正文中引用: ```双语文献引用\cite{易仕和2013--}``` - + + +* 我想修改文献条目的日期项诸如格式,请问该如何处理? + +参考文献中日期格式主要有四种修改方式: +1. 利用biblatex选项全局的修改日期格式 +2. 修改日期输出宏,使根据条目类型输出不同的日期格式 +3. 修改日期输出宏,使根据具体条目输出不同的日期格式 +4. 修改参考文献信息,使当前条目原样输出需要的格式 + +具体示例见:[biblatex中如何修改参考文献中日期的著录格式](https://blog.csdn.net/xenonhu/article/details/86933525) + #### 4.3 Citation format/正文引用的标注格式 @@ -860,7 +871,7 @@ biber -l zh__stroke jobname * 2018/11/04 v1.0n * 2018/12/22 v1.0o * 2019/01/19 v1.0p -* 2019/02/07 v1.0q +* 2019/02/11 v1.0q --------------------------------------------------------- diff --git a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf index e4aa64808e1..14dc623e3be 100644 Binary files a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf and b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf differ diff --git a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015.tex b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015.tex index 3e5ab746768..c7c61b15712 100644 --- a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015.tex +++ b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015.tex @@ -394,7 +394,7 @@ perl gb7714texttobib.pl in=textfilename out=bibfilename \begin{table}[!htb] \centering \caption{著者年份制常用命令示例}\label{tab:cite:authoryear} -\includegraphics[scale=0.9]{egciteaytab.pdf} +\includegraphics[scale=0.8]{egciteaytab.pdf} \end{table} diff --git a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map-test.bib b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map-test.bib new file mode 100644 index 00000000000..920ee7af21d --- /dev/null +++ b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map-test.bib @@ -0,0 +1,53 @@ + +@NEWSPAPER{CITATION_NEWSPAPER, + author = "吴刚", + title = "立陶宛进入欧元时代", + journaltitle = "人民日报", + date = "2015-1-2", + language = "chs", + note = "" +} + +@BOOK{SANGUOYANYI, + author = "罗贯中", + title = "三国演义", + edition = "1", + address = "山西太原", + year = "元末明初", + language = "chs" +} + +@ELECTRONIC{BUPT_Thesis_Format_2004, + title = "关于研究生学位论文格式的统一要求", + author = "北京邮电大学研究生院培养与学位办公室", + etype = "EB", + ehowpublished = "OL", + date = "2004", + url = "http://www.bupt.edu.cn/", + language = "chs" +} + +@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" +} + +@ELECTRONIC{buptthesis, + author = "张煜", + title = "北京邮电大学研究生学位论文 \LaTeX{} 文档类", + year = "2009", + dhowpublished = "online", + urldate = "2013-7-6", + source = "http://code.google.com/p/buptthesis/", + language = "chs" +} + + + + diff --git a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map.py b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map.py new file mode 100644 index 00000000000..4ab2325fcd8 --- /dev/null +++ b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map.py @@ -0,0 +1,370 @@ +#!/usr/bin/env python + +""" +python script to modify bib data + +features: +1. souce map of biblatex +2. generalize date + +history: +v1.0 2019/02/09 + +biblatex source map opts: + +已实现的选项: +typesource=⟨entrytype⟩ +typetarget=⟨entrytype⟩ +fieldsource=⟨entryfield⟩ +fieldtarget=⟨entryfield⟩ +match=⟨regexp⟩ +matchi=⟨regexp⟩ +notmatch=⟨regexp⟩ +notmatchi=⟨regexp⟩ +replace=⟨regexp⟩ + +未实现的选项 +notfield=⟨entryfield⟩ +fieldset=⟨entryfield⟩ +fieldvalue=⟨string⟩ +entryclone=⟨clonekey⟩ +entrynew=⟨entrynewkey⟩ +entrynewtype=⟨string⟩ +entrytarget=⟨string⟩ +entrynocite=true, false default: false +entrynull=true, false default: false +append=true, false default: false +final=true, false default: false +null=true, false default: false +origfield=true, false default: false +origfieldval=true, false default: false +origentrytype=true, false default: false +""" + +__author__ = "Hu zhenzhen" +__version__ = "1.0" +__license__ = "MIT" +__email__ = "hzzmail@163.com" + +import string +import re +import sys +import datetime +import copy + + +# +# 为数据map设置参数 +#[]=maps +#[[],[]]=map in maps +#[[[]],[]]=step in map in mpas +#[[[{optionkey: }]],[]]=step in map in mpas +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'}]#step1 + ], + [#map5:将refdate域转换为urldate域 + [{"fieldsource":"refdate","fieldtarget":"urldate"}]#step1 + ], + +] + +# +# +#打开bib文件 +def readfilecontents(bibFile): + print("INFO: Reading references from '" + bibFile + "'") + try: + fIn = open(bibFile, 'r', encoding="utf8") + global bibfilecontents + bibfilecontents=fIn.readlines() + fIn.close() + 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): + biboutfile="new"+bibFile + print("INFO: writing references from '" + biboutfile + "'") + try: + fout = open(biboutfile, 'w', encoding="utf8") + fout.write("%% \n") + fout.write("%% bib file modified by bibmap.py\n") + print(datetime.datetime.now().isoformat(timespec='seconds')) + fout.write("%% "+datetime.datetime.now().isoformat(timespec='seconds')+"\n") + fout.write("%% \n\n\n") + for bibentry in bibentries: + fout.write('@'+bibentry["entrytype"]+'{'+bibentry["entrykey"]+',\n') + for k,v in bibentry.items(): + if k=="entrytype" or k=="entrykey" or v=='""': + pass + else: + fout.write('\t'+k+' = '+v+',\n') + fout.write('}\n\n') + + fout.close() + except IOError: + print("ERROR: Input bib file '" + bibFile + + "' doesn't exist or is not readable") + sys.exit(-1) + +# +#将条目解析放到bibentries列表中 +#每个条目是一个dict字典 +def bibentryparsing(): + global bibentries + bibentries=[] + bibentry={} + entrysn=0 + for line in bibfilecontents: + #print(line) + if line.startswith("@"):#条目开始行 + entrysn=entrysn+1 + entrynow=line.lstrip('@').split(sep='{', maxsplit=1) + #print(entrynow) + entrytype=entrynow[0] + bibentry['entrytype']=entrytype + entrykey=entrynow[1].split(sep=',', maxsplit=1)[0] + bibentry['entrykey']=entrykey + else: + if '=' in line:#条目域信息行 + entryline=line.lstrip() + entrynow=entryline.split(sep='=', maxsplit=1) + #print(entrynow) + entryfield=entrynow[0].strip().lstrip() + #print(entrynow[1]) + entryfieldline=entrynow[1].split(sep=',', maxsplit=1) + entryfieldvalue=entryfieldline[0].lstrip() + if entryfieldvalue=='': + pass + else: + bibentry[entryfield]=entryfieldvalue.strip() + elif '}' in line:#条目结束行 + print('entrysn=',entrysn) + global bibentryglobal + bibentryglobal=copy.deepcopy(bibentry) + bibentries.append(bibentryglobal) + bibentry={} + else: + pass + bibentrycounter=len(bibentries) + print('entrytotal=',bibentrycounter) + for bibentryi in bibentries: + print(bibentryi) + +def printbibentries(): + for bibentryi in bibentries: + print(bibentryi) + + + +# +# 执行数据映射操作 +# 还有很多选项没有实现,20190209 +# 实现的选项中也需要和未实现的选项进行数据传递 +def execsourcemap(): + for map in sourcemaps:#every map in maps,每个map逐步开始 + for bibentry in bibentries:#每个映射都需要遍历所有条目,对每个条目做map + + mapcontinue=1#大于0表示正常,继续当前条目的map + fieldsrcinfo={}#用于接收fieldsource相关处理的结果 + print("map info=",map) + for step in map:#every step in map + if mapcontinue>0: + 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)#coef is dict + elif k=="fieldsource":#域查找或设置 + mapcontinue=mapfieldsource(keyvals,bibentry,fieldsrcinfo)#coef is dict + pass + elif k=="fieldset":#域设置 + pass + elif k=="pertype":#类型限制 + pass + elif k=="pernottype":#类型限制 + pass + elif k=="notfield":#域限制 + pass + else: + pass + +# +#条目类型转换 +def maptypesource(keyvals,bibentry): + retrunval=1 + for k,v in keyvals.items(): + #print(k,v) + if k=='typesource': + typesource=v + elif k=='typetarget': + typetarget=v + elif k=='final': + retrunval=0 + else: + pass + + if bibentry['entrytype']==typesource: + bibentry['entrytype']=typetarget + return 1 + else: + return retrunval #存在final时,且不匹配则终止map + +# +#域名转换或判断域是否存在或match +def mapfieldsource(keyvals,bibentry,fieldsrcinfo): + mapfieldtype=0 #域名map的类型设置 + fieldmatch=''#匹配模式默认为空 + fieldmatchi=''#匹配模式默认为空 + + for k,v in keyvals.items(): + #print(k,v) + if k=='fieldsource': + fieldsource=v + elif k=='fieldtarget': + fieldtarget=v + mapfieldtype=1 #域map类型1,直接做域名转换 + elif k=='replace': + fieldreplace=v + mapfieldtype=2 #域map类型2,直接做域信息转换 + elif k=='final': + if v=='false': + fieldfinal=v + else: + fieldfinal='true' + mapfieldtype=3 #域map类型3,做final判断可以终止map + elif k=='match':#不区分大小写的match + fieldmatch=v + elif k=='matchi':#区分大小写的match + fieldmatchi=v + elif k=='notmatch':#区分大小写的match + fieldnotmatch=v + else: + pass + + + 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,直接做域信息转换 + print('fieldsource=',fieldsource) + print('fieldmatch=',fieldmatch) + print('fieldreplace=',fieldreplace) + 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] + 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 + + + + + + + +#运行脚本测试 +if __name__=="__main__": + print('hello') + print(b'hello') + readfilecontents("biblatex-map-test.bib") + + printfilecontents() + + bibentryparsing() + + printbibentries() + + execsourcemap() + + printbibentries() + + writefilenewbib("biblatex-map-test.bib") + + + \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/example.bib b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/example.bib index 8ed8e7098dc..56ce4a57948 100644 --- a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/example.bib +++ b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/example.bib @@ -579,6 +579,17 @@ author={乔纳斯} pages = {44} } +@inbook{姚中秋2008--, + author = {姚中秋}, + title = {一种制度变迁模式}, + bookauthor = {罗, 卫东 and 姚, 中秋}, + booktitle = {中国转型的理论分析}, + year = {2008}, + publisher = {浙江大学出版社}, + address = {杭州}, + pages = {44} +} + @ARTICLE{关立哲2014--, author = {关立哲 and 韩纪富 and 张晨延}, @@ -2615,6 +2626,16 @@ Workshop on Computer Algebra in Scientific Computing, Samarkand, October 5-9, 20 Month = {1} } +@Book{Miroslav2003--, + Title = {信号处理滤波器设计方法}, + Address = {北京}, + Author = {Miroslav, D. L. and Dejan, V. T.}, + Publisher = {电子工业出版社}, + Translator = {朱义胜 and 董辉}, + Year = {2003}, + Month = {1} +} + @Article{Giorgetti2005-1037-1042, Title = {The impact of OFDM interference on TH-PPM/BPAM transmission systems}, Author = {Giorgetti, A. and Dardari,D.}, @@ -3251,6 +3272,16 @@ Workshop on Computer Algebra in Scientific Computing, Samarkand, October 5-9, 20 Year = {2012} } +@Article{于潇2011-15-23, + Title = {互联网药品可信交易环境中主体资质审核备案模式}, + Author = {于, 潇 and 刘, 义 and 柴, 跃廷 and others}, + Journal = {清华大学学报}, + Number = {11}, + Pages = {15-23}, + Volume = {52}, + Year = {2011} +} + @Proceedings{中国社会科学院台湾史研究中心2012--, Title = {台湾光复六十五周年暨抗战史实学术研讨会论文集}, Address = {北京}, diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.bbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.bbx index 38970eecc52..cc8c75d3e7e 100644 --- a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.bbx +++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.bbx @@ -11,7 +11,7 @@ % % 版本和时间信息 % -\def\versionofgbtstyle{2019/02/07 v1.0q} +\def\versionofgbtstyle{2019/02/11 v1.0q} \def\versionofbiblatex{\abx@version} \ProvidesFile{gb7714-2015.bbx}[\versionofgbtstyle biblatex bibliography style] \RequireBiber[3]%显式指定用biber后端 @@ -258,14 +258,18 @@ \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]% {\defcounter{maxnames}{\blx@maxbibnames}%局部定义maxnames和minnames计数器 \defcounter{minnames}{\blx@minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。 - \usebibmacro{prenote}}% + \usebibmacro{prenote}% + \renewbibmacro*{postnote}{% + \iffieldundef{postnote}% + {}{\setunit{\addcolon\addspace}\printfield{postnote}}}%与ay样式不同,由于已修改postnote域格式,直接用printfield + }% {\usebibmacro{citesavefn}% \ifcsdef{labelsec\arabic{refsection}et\thefield{entrykey}}% - {\csuse{labelsec\arabic{refsection}et\thefield{entrykey}}\nopunct}% + {\csuse{labelsec\arabic{refsection}et\thefield{entrykey}}}%\nopunct {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}% }% {\multicitedelim}% - {\addcolon\usebibmacro{postnote}} + {\usebibmacro{postnote}} } @@ -731,16 +735,17 @@ \DeclareSourcemap{ \maps[datatype=bibtex]{% - \map{ - \pernottype{inbook} + \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{ - \pernottype{inbook} + \map{%当没有作者时将translator转成author + \pernottype{inbook} \pernottype{inproceedings} \pernottype{incollection} %\step[notfield=author,final]%当author不存在,将translator复制给author @@ -757,9 +762,6 @@ \step[fieldsource=address,final] \step[fieldset=location,origfieldval] } - \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 - \step[fieldsource={author}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] - }%\perdatasource{examples.bib} \map{%处理在bib文件用mark标记文献类型标识符的情况 \step[fieldsource=mark,final] \step[fieldset=usera, origfieldval] @@ -926,99 +928,182 @@ \pertype{unpublished} \step[fieldset=usera, fieldvalue={Z}] } - \map{%作者的中文判断 - \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] - \step[fieldset=userf, fieldvalue={chinese}] - } - \map{%译者的中文判断 - \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] - \step[fieldset=usere, fieldvalue={chinese}] - } - \map{%编者的中文判断 - \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] - \step[fieldset=userc, fieldvalue={chinese}] - } + \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{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题 \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]% \step[fieldset=userd, fieldvalue={chinese}] } - \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{%当文献给出language域时,设置文献要使用的本地化字符串的语言 - \step[fieldsource=language,match=english,final] - \step[fieldset=langid,fieldvalue={english}] + \map{% + \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userd,fieldvalue={russian}]%俄语 } - \map{ - \step[fieldsource=language,match=russian,final] - \step[fieldset=langid,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,final] + \step[fieldset=userd,fieldvalue={english}] + } + \map{%作者的中文判断 + \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] + \step[fieldset=userf, fieldvalue={chinese}] + } + \map{\step[fieldsource=author,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=userf,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 } \map{% - \step[fieldsource=language,match=french,final] - \step[fieldset=langid,fieldvalue={french}] + \step[fieldsource=author,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userf,fieldvalue={russian}]%俄语 } \map{% - \step[fieldsource=language,match=chinese,final] - \step[fieldset=langid,fieldvalue={english}] + \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{%将没有设置userf,且存在author域的默认设置为英文 + \step[fieldsource=author,final] + \step[fieldset=userf,fieldvalue={english}] + } + \map{%译者的中文判断 + \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] + \step[fieldset=usere, fieldvalue={chinese}] + } + \map{\step[fieldsource=translator,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=usere,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 } \map{% - \step[fieldsource=language,match=japnese,final] - \step[fieldset=langid,fieldvalue={english}] + \step[fieldsource=translator,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=usere,fieldvalue={russian}]%俄语 } \map{% - \step[fieldsource=language,match=korean,final] - \step[fieldset=langid,fieldvalue={english}] + \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{%当没有language域信息给出时,根据title域来自动判断语言并设置本地化字符串语言 - %把语言信息设置language域内,而不再用userb域(20180525) - %接着根据信息域字符的unicode码判断 - \step[fieldsource=title,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF - \step[fieldset=language,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 - \step[fieldset=langid,fieldvalue={french}] + \map{%将没有设置usere,且存在translator域的默认设置为英文 + \step[fieldsource=translator,final] + \step[fieldset=usere,fieldvalue={english}] + } + \map{%编者的中文判断 + \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 + \step[fieldset=userc, fieldvalue={chinese}] + } + \map{\step[fieldsource=editor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=userc,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 } \map{% - \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final] - \step[fieldset=language,fieldvalue={russian}]%俄语 - \step[fieldset=langid,fieldvalue={russian}] + \step[fieldsource=editor,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userc,fieldvalue={russian}]%俄语 } \map{% - \step[fieldsource=title,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] - \step[fieldset=language,fieldvalue={japanese}]%日语 - \step[fieldset=langid,fieldvalue={english}]%中日韩语目前都用english, + \step[fieldsource=editor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] + \step[fieldset=userc,fieldvalue={japanese}]%日语 } %确定形式后可增加类似andotherscn这样的本地化字符串处理 \map{% - \step[fieldsource=title,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] - \step[fieldset=language,fieldvalue={korean}]%韩语 - \step[fieldset=langid,fieldvalue={english}] + \step[fieldsource=editor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] + \step[fieldset=userc,fieldvalue={korean}]%韩语 + } + \map{%将没有设置userc,且存在editor域的默认设置为英文 + \step[fieldsource=editor,final] + \step[fieldset=userc,fieldvalue={english}] } - \map{%因为无法进行cjk字符判断,所以用反的思路,判断没有英文字符,没有空格,没有逗号等字符情况下 - %认为是中文的,将文献language设置成chinese,用于排序 - %参考4.5.8 姓名首字母生成控制 - %\step[fieldsource=author,match=\regexp{[^a-zA-Z\s\.\,\'\{\}\\\/\-\x22\x26\:0-9\p{IsP}\p{PosixPunct}\x{2bf}\x{2018}\xE9\p{IsASCII}]},final] - %对于带重音符号的字符似乎无法匹配。比如\'e - %最后选择直接匹配cjk字符,unicode编码位置从2FF0到9FA5 - \step[fieldsource=author,match=\regexp{[\x{2FF0}-\x{9FA5}]},final] - \step[fieldset=language,fieldvalue={chinese}] - } - \map{\step[fieldsource=title,match=\regexp{[\x{2FF0}-\x{9FA5}]},final] - \step[fieldset=language,fieldvalue={chinese}] + \map{%编者的中文判断 + \step[fieldsource=bookauthor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 + \step[fieldset=userb, fieldvalue={chinese}] + } + \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{%将没有设置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}] - \step[fieldset=langid,fieldvalue={english}] } - \map{%将一条文献的主体语言放入userd中,以便进行多语言处理 - %之所以这么说,是因为一条文献可能是混合语言的,比如作者用的是英文 + \map{%一条文献的语言已经设定在language域中,由于出版项相关宏中使用userd判断, + %所以将一条文献的主体语言设定到userd中,本身前面userd已经设定,但没有处理无标题的情况, + %这里的处理等价于没有标题时,利用作者的语言设定userd,再没有作者,则默认用英文设定userd \step[fieldsource=language] \step[fieldset=userd,origfieldval] } + \map{%当文献给出language域时,设置文献要使用的本地化字符串的语言 + \step[fieldsource=language,match=english,final] + \step[fieldset=langid,fieldvalue={english}] + } + \map{ + \step[fieldsource=language,match=russian,final] + \step[fieldset=langid,fieldvalue={russian}] + } + \map{% + \step[fieldsource=language,match=french,final] + \step[fieldset=langid,fieldvalue={french}] + } + \map{% + \step[fieldsource=language,match=chinese,final]%中日韩语目前都用english, + \step[fieldset=langid,fieldvalue={english}] + } + \map{% + \step[fieldsource=language,match=japnese,final]%中日韩语目前都用english, + \step[fieldset=langid,fieldvalue={english}] + } + \map{% + \step[fieldsource=language,match=korean,final]%中日韩语目前都用english, + \step[fieldset=langid,fieldvalue={english}] + } } } @@ -1626,16 +1711,18 @@ \DeclareDelimFormat{strandothersdelim}{% \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% \addspace% - \ifcurrentname{translator}{\testCJKfirst{usere}}{\testCJKfirst{userf}}% - \ifcurrentname{editor}{\testCJKfirst{userc}}{\testCJKfirst{userf}}% + \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}% - \iftoggle{ifCJKforgbt}{\bibstring{andotherscn}}{% - \iffieldequalstr{userd}{korean}{\bibstring{andotherskr}}{}% -\iffieldequalstr{userd}{japnese}{\bibstring{andothersjp}}{}% -\iffieldequalstr{userd}{english}{\bibstring{andothers}}{}% -\iffieldequalstr{userd}{french}{\bibstring{andothers}}{}% -\iffieldequalstr{userd}{russian}{\bibstring{andothers}}{}% -}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}% + \iffieldequalstr{\userfieldabcde}{japnese}{\bibstring{andothersjp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}% \or% \bibstring{andotherscn}% \or% @@ -1653,16 +1740,19 @@ \DeclareDelimFormat{finalnamedelim}{% \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% \addspace% - \ifcurrentname{translator}{\testCJKfirst{usere}}{\testCJKfirst{userf}}% - \ifcurrentname{editor}{\testCJKfirst{userc}}{\testCJKfirst{userf}}% + \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}% - \iftoggle{ifCJKforgbt}{\bibstring{andcn}}{% -\iffieldequalstr{userd}{korean}{\bibstring{andkr}}{}% -\iffieldequalstr{userd}{japnese}{\bibstring{andjp}}{}% -\iffieldequalstr{userd}{english}{\bibstring{and}}{}% -\iffieldequalstr{userd}{french}{\bibstring{and}}{}% -\iffieldequalstr{userd}{russian}{\bibstring{and}}{}% -}\space% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% + \iffieldequalstr{\userfieldabcde}{japnese}{\bibstring{andjp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}% +\space% \or% \bibstring{andcn}\space% \or% diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.cbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.cbx index 7802151895d..5aa650816e4 100644 --- a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.cbx +++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.cbx @@ -7,7 +7,7 @@ %% Released under the LaTeX Project Public License v1.3c or later %% --------------------------------------------------------------- %% -\def\versionofgbtstyle{2019/02/07 v1.0q} +\def\versionofgbtstyle{2019/02/11 v1.0q} \ProvidesFile{gb7714-2015.cbx}[\versionofgbtstyle biblatex citation style] % diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx index dc5407b7a7a..23517c5562b 100644 --- a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx +++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx @@ -10,7 +10,7 @@ % % 版本和时间信息 % -\def\versionofgbtstyle{2019/02/07 v1.0q} +\def\versionofgbtstyle{2019/02/11 v1.0q} \def\versionofbiblatex{\abx@version} \ProvidesFile{gb7714-2015ay.bbx}[\versionofgbtstyle biblatex bibliography style] \RequireBiber[3]%显式指定用biber后端 @@ -255,14 +255,18 @@ \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]% {\defcounter{maxnames}{\blx@maxbibnames}%局部定义maxnames和minnames计数器 \defcounter{minnames}{\blx@minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。 - \usebibmacro{prenote}}% + \usebibmacro{prenote}% + \renewbibmacro*{postnote}{% + \iffieldundef{postnote}% + {}{\setunit{\addcolon\addspace}\printtext{\thefield{postnote}}}}%由于ay样式中没有修改postnote域,此处因为格式需要不使用默认域格式 + }% {\usebibmacro{citesavefn}% \ifcsdef{labelsec\arabic{refsection}et\thefield{entrykey}}% {\csuse{labelsec\arabic{refsection}et\thefield{entrykey}}\nopunct}% {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}% }% {\multicitedelim}% - {\addcolon\usebibmacro{postnote}} + {\usebibmacro{postnote}} } @@ -700,15 +704,17 @@ \DeclareSourcemap{ \maps[datatype=bibtex]{ - \map{ - \pernottype{inbook} + \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{ - \pernottype{inbook} + \map{%当没有作者时将translator转成author + \pernottype{inbook} \pernottype{inproceedings} \pernottype{incollection} %\step[notfield=author,final]%当author不存在,将translator复制给author @@ -725,9 +731,6 @@ \step[fieldsource=address,final] \step[fieldset=location,origfieldval] } - \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 - \step[fieldsource={author}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] - }%\perdatasource{examples.bib} \map{%处理在bib文件用mark标记文献类型标识符的情况 \step[fieldsource=mark,final] \step[fieldset=usera, origfieldval] @@ -894,100 +897,182 @@ \pertype{unpublished} \step[fieldset=usera, fieldvalue={Z}] } - \map{%作者的中文判断 - \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] - \step[fieldset=userf, fieldvalue={chinese}] - } - \map{%译者的中文判断 - \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] - \step[fieldset=usere, fieldvalue={chinese}] - } - \map{%编者的中文判断 - \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] - \step[fieldset=userc, fieldvalue={chinese}] - } + \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{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题 \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]% \step[fieldset=userd, fieldvalue={chinese}] } - \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{%当文献给出language域时,设置文献要使用的本地化字符串的语言 - \step[fieldsource=language,match=english,final] - \step[fieldset=langid,fieldvalue={english}] + \map{% + \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userd,fieldvalue={russian}]%俄语 } - \map{ - \step[fieldsource=language,match=russian,final] - \step[fieldset=langid,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,final] + \step[fieldset=userd,fieldvalue={english}] + } + \map{%作者的中文判断 + \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] + \step[fieldset=userf, fieldvalue={chinese}] + } + \map{\step[fieldsource=author,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=userf,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 } \map{% - \step[fieldsource=language,match=french,final] - \step[fieldset=langid,fieldvalue={french}] + \step[fieldsource=author,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userf,fieldvalue={russian}]%俄语 } \map{% - \step[fieldsource=language,match=chinese,final] - \step[fieldset=langid,fieldvalue={english}] + \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{%将没有设置userf,且存在author域的默认设置为英文 + \step[fieldsource=author,final] + \step[fieldset=userf,fieldvalue={english}] + } + \map{%译者的中文判断 + \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] + \step[fieldset=usere, fieldvalue={chinese}] + } + \map{\step[fieldsource=translator,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=usere,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 } \map{% - \step[fieldsource=language,match=japnese,final] - \step[fieldset=langid,fieldvalue={english}] + \step[fieldsource=translator,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=usere,fieldvalue={russian}]%俄语 } \map{% - \step[fieldsource=language,match=korean,final] - \step[fieldset=langid,fieldvalue={english}] + \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{%当没有language域信息给出时,根据title域来自动判断语言并设置本地化字符串语言 - %把语言信息设置language域内,而不再用userb域(20180525) - %接着根据信息域字符的unicode码判断 - \step[fieldsource=title,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF - \step[fieldset=language,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 - \step[fieldset=langid,fieldvalue={french}] + \map{%将没有设置usere,且存在translator域的默认设置为英文 + \step[fieldsource=translator,final] + \step[fieldset=usere,fieldvalue={english}] + } + \map{%编者的中文判断 + \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 + \step[fieldset=userc, fieldvalue={chinese}] + } + \map{\step[fieldsource=editor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=userc,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 } \map{% - \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final] - \step[fieldset=language,fieldvalue={russian}]%俄语 - \step[fieldset=langid,fieldvalue={russian}] + \step[fieldsource=editor,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userc,fieldvalue={russian}]%俄语 } \map{% - \step[fieldsource=title,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] - \step[fieldset=language,fieldvalue={japanese}]%日语 - \step[fieldset=langid,fieldvalue={english}]%中日韩语目前都用english, + \step[fieldsource=editor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] + \step[fieldset=userc,fieldvalue={japanese}]%日语 } %确定形式后可增加类似andotherscn这样的本地化字符串处理 \map{% - \step[fieldsource=title,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] - \step[fieldset=language,fieldvalue={korean}]%韩语 - \step[fieldset=langid,fieldvalue={english}] + \step[fieldsource=editor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] + \step[fieldset=userc,fieldvalue={korean}]%韩语 } - \map{%因为无法进行cjk字符判断,所以用反的思路,判断没有英文字符,没有空格,没有逗号等字符情况下 - %认为是中文的,将文献language设置成chinese,用于排序 - %参考4.5.8 姓名首字母生成控制 - %\step[fieldsource=author,match=\regexp{[^a-zA-Z\s\.\,\'\{\}\\\/\-\x22\x26\:0-9\p{IsP}\p{PosixPunct}\x{2bf}\x{2018}\xE9\p{IsASCII}]},final] - %对于带重音符号的字符似乎无法匹配。比如\'e - %最后选择直接匹配cjk字符,unicode编码位置从2FF0到9FA5 - \step[fieldsource=author,match=\regexp{[\x{2FF0}-\x{9FA5}]},final] - \step[fieldset=language,fieldvalue={chinese}] + \map{%将没有设置userc,且存在editor域的默认设置为英文 + \step[fieldsource=editor,final] + \step[fieldset=userc,fieldvalue={english}] } - \map{ - \step[fieldsource=title,match=\regexp{[\x{2FF0}-\x{9FA5}]},final] - \step[fieldset=language,fieldvalue={chinese}] + \map{%编者的中文判断 + \step[fieldsource=bookauthor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 + \step[fieldset=userb, fieldvalue={chinese}] + } + \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{%将没有设置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}] - \step[fieldset=langid,fieldvalue={english}] } - \map{%将一条文献的主体语言放入userd中,以便进行多语言处理 - %之所以这么说,是因为一条文献可能是混合语言的,比如作者用的是英文 + \map{%一条文献的语言已经设定在language域中,由于出版项相关宏中使用userd判断, + %所以将一条文献的主体语言设定到userd中,本身前面userd已经设定,但没有处理无标题的情况, + %这里的处理等价于没有标题时,利用作者的语言设定userd,再没有作者,则默认用英文设定userd \step[fieldsource=language] \step[fieldset=userd,origfieldval] } + \map{%当文献给出language域时,设置文献要使用的本地化字符串的语言 + \step[fieldsource=language,match=english,final] + \step[fieldset=langid,fieldvalue={english}] + } + \map{ + \step[fieldsource=language,match=russian,final] + \step[fieldset=langid,fieldvalue={russian}] + } + \map{% + \step[fieldsource=language,match=french,final] + \step[fieldset=langid,fieldvalue={french}] + } + \map{% + \step[fieldsource=language,match=chinese,final]%中日韩语目前都用english, + \step[fieldset=langid,fieldvalue={english}] + } + \map{% + \step[fieldsource=language,match=japnese,final]%中日韩语目前都用english, + \step[fieldset=langid,fieldvalue={english}] + } + \map{% + \step[fieldsource=language,match=korean,final]%中日韩语目前都用english, + \step[fieldset=langid,fieldvalue={english}] + } \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook, %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义 %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断 @@ -1691,41 +1776,47 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 % 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置 \DeclareDelimFormat{strandothersdelim}{% \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% - \addspace%%做一个判断是在处理author还是translator,用于两者是不同语言的情况 - \ifcurrentname{translator}{\testCJKfirst{usere}}{\testCJKfirst{userf}}% - \ifcurrentname{editor}{\testCJKfirst{userc}}{\testCJKfirst{userf}}% + \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}% - \iftoggle{ifCJKforgbt}{\bibstring{andothersincitecn}}{% -\iffieldequalstr{userd}{korean}{\bibstring{andotherskr}}{}% -\iffieldequalstr{userd}{japnese}{\bibstring{andothersjp}}{}% -\iffieldequalstr{userd}{english}{\bibstring{andothersincite}}{}% -\iffieldequalstr{userd}{french}{\bibstring{andothers}}{}% -\iffieldequalstr{userd}{russian}{\bibstring{andothers}}{}% -}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andothersincitecn}}{}%中文已经通过english本地化字符串定义 + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}%韩语未定义,所以与bib中一致 + \iffieldequalstr{\userfieldabcde}{japnese}{\bibstring{andothersjp}}{}%日与同韩语 + \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothersincite}}{}%英语已定义 + \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%法语未定义,若要定义需要针对french本地化字符串定义 + \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%俄语未定义,若要定义需要针对russian本地化字符串定义 \or% \bibstring{andothersincitecn}% \or% \bibstring{andothersincite}% \fi} + \DeclareDelimFormat[bib,biblist]{strandothersdelim}{% \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% \addspace% - \ifcurrentname{translator}{\testCJKfirst{usere}}{\testCJKfirst{userf}}% - \ifcurrentname{editor}{\testCJKfirst{userc}}{\testCJKfirst{userf}}% + \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}% - \iftoggle{ifCJKforgbt}{\bibstring{andotherscn}}{% -\iffieldequalstr{userd}{korean}{\bibstring{andotherskr}}{}% -\iffieldequalstr{userd}{japnese}{\bibstring{andothersjp}}{}% -\iffieldequalstr{userd}{english}{\bibstring{andothers}}{}% -\iffieldequalstr{userd}{french}{\bibstring{andothers}}{}% -\iffieldequalstr{userd}{russian}{\bibstring{andothers}}{}% -}% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}% + \iffieldequalstr{\userfieldabcde}{japnese}{\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 @@ -1737,34 +1828,41 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 \DeclareDelimFormat{finalnamedelim}{% \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% \addspace% - \ifcurrentname{translator}{\testCJKfirst{usere}}{\testCJKfirst{userf}}% - \ifcurrentname{editor}{\testCJKfirst{userc}}{\testCJKfirst{userf}}% + \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}% - \iftoggle{ifCJKforgbt}{\bibstring{andincitecn}}{% -\iffieldequalstr{userd}{korean}{\bibstring{andkr}}{}% -\iffieldequalstr{userd}{japnese}{\bibstring{andjp}}{}% -\iffieldequalstr{userd}{english}{\bibstring{andincite}}{}% -\iffieldequalstr{userd}{french}{\bibstring{and}}{}% -\iffieldequalstr{userd}{russian}{\bibstring{and}}{}% - }\space% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andincitecn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% + \iffieldequalstr{\userfieldabcde}{japnese}{\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% - \ifcurrentname{translator}{\testCJKfirst{usere}}{\testCJKfirst{userf}}% - \ifcurrentname{editor}{\testCJKfirst{userc}}{\testCJKfirst{userf}}% + \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}% - \iftoggle{ifCJKforgbt}{\bibstring{andcn}}{% -\iffieldequalstr{userd}{korean}{\bibstring{andkr}}{}% -\iffieldequalstr{userd}{japnese}{\bibstring{andjp}}{}% -\iffieldequalstr{userd}{english}{\bibstring{and}}{}% -\iffieldequalstr{userd}{french}{\bibstring{and}}{}% -\iffieldequalstr{userd}{russian}{\bibstring{and}}{}% -}\space% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% + \iffieldequalstr{\userfieldabcde}{japnese}{\bibstring{andjp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}% +\space% \or% \bibstring{andcn}\space% \or% @@ -1772,6 +1870,7 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7 \fi} + % % 重设title的输出 % diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.cbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.cbx index 04ba5093130..133d4a727ab 100644 --- a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.cbx +++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.cbx @@ -7,7 +7,7 @@ %% Released under the LaTeX Project Public License v1.3c or later %% --------------------------------------------------------------- %% -\def\versionofgbtstyle{2019/02/07 v1.0q} +\def\versionofgbtstyle{2019/02/11 v1.0q} \ProvidesFile{gb7714-2015ay.cbx}[\versionofgbtstyle biblatex citation style] % @@ -69,7 +69,6 @@ test {\iftoggle{iftlseven}}%3.7=biblatex } - % % 重定义cite:label,针对biblatex3.8以上版本set条目集的标注(引用)标签 % diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.bbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.bbx index 4db440f8671..9b652a900e0 100644 --- a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.bbx +++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.bbx @@ -11,7 +11,7 @@ % % 版本和时间信息 % -\def\versionofgbtstyle{2019/02/07 v1.0q} +\def\versionofgbtstyle{2019/02/11 v1.0q} \def\versionofbiblatex{\abx@version} \ProvidesFile{gb7714-2015ms.bbx}[\versionofgbtstyle biblatex bibliography style] \RequireBiber[3]%显式指定用biber后端 @@ -145,14 +145,18 @@ \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]% {\defcounter{maxnames}{\blx@maxbibnames}%局部定义maxnames和minnames计数器 \defcounter{minnames}{\blx@minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。 - \usebibmacro{prenote}}% + \usebibmacro{prenote}% + \renewbibmacro*{postnote}{% + \iffieldundef{postnote}% + {}{\setunit{\addcolon\addspace}\printfield{postnote}}}%与ay样式不同,由于已修改postnote域格式,直接用printfield + }% {\usebibmacro{citesavefn}% \ifcsdef{labelsec\arabic{refsection}et\thefield{entrykey}}% {\csuse{labelsec\arabic{refsection}et\thefield{entrykey}}\nopunct}% {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}% }% {\multicitedelim}% - {\addcolon\usebibmacro{postnote}} + {\usebibmacro{postnote}} } @@ -530,17 +534,19 @@ % newsdate 用于公告日期,公开日期或新闻日期,输出到日,但无包围符号,数据源为date % modifydate 用于更新或修改日期,输出到日,且用()包围,数据源为date或enddate或eventdate -\DeclareSourcemap{ +\DeclareSourcemap{%\perdatasource{examples.bib} \maps[datatype=bibtex]{% - \map{ - \pernottype{inbook} + \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{ - \pernottype{inbook} + \map{%当没有作者时将translator转成author + \pernottype{inbook} \pernottype{inproceedings} \pernottype{incollection} %\step[notfield=author,final]%当author不存在,将translator复制给author @@ -557,9 +563,6 @@ \step[fieldsource=address,final] \step[fieldset=location,origfieldval] } - \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 - \step[fieldsource={author}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] - }%\perdatasource{examples.bib} \map{%处理在bib文件用mark标记文献类型标识符的情况 \step[fieldsource=mark,final] \step[fieldset=usera, origfieldval] @@ -726,99 +729,182 @@ \pertype{unpublished} \step[fieldset=usera, fieldvalue={Z}] } - \map{%作者的中文判断 - \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] - \step[fieldset=userf, fieldvalue={chinese}] - } - \map{%译者的中文判断 - \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] - \step[fieldset=usere, fieldvalue={chinese}] - } - \map{%编者的中文判断 - \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] - \step[fieldset=userc, fieldvalue={chinese}] - } + \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{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题 \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]% \step[fieldset=userd, fieldvalue={chinese}] } - \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{%当文献给出language域时,设置文献要使用的本地化字符串的语言 - \step[fieldsource=language,match=english,final] - \step[fieldset=langid,fieldvalue={english}] + \map{% + \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userd,fieldvalue={russian}]%俄语 } - \map{ - \step[fieldsource=language,match=russian,final] - \step[fieldset=langid,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,final] + \step[fieldset=userd,fieldvalue={english}] + } + \map{%作者的中文判断 + \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] + \step[fieldset=userf, fieldvalue={chinese}] + } + \map{\step[fieldsource=author,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=userf,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 } \map{% - \step[fieldsource=language,match=french,final] - \step[fieldset=langid,fieldvalue={french}] + \step[fieldsource=author,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userf,fieldvalue={russian}]%俄语 } \map{% - \step[fieldsource=language,match=chinese,final] - \step[fieldset=langid,fieldvalue={english}] + \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{%将没有设置userf,且存在author域的默认设置为英文 + \step[fieldsource=author,final] + \step[fieldset=userf,fieldvalue={english}] + } + \map{%译者的中文判断 + \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] + \step[fieldset=usere, fieldvalue={chinese}] + } + \map{\step[fieldsource=translator,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=usere,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 } \map{% - \step[fieldsource=language,match=japnese,final] - \step[fieldset=langid,fieldvalue={english}] + \step[fieldsource=translator,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=usere,fieldvalue={russian}]%俄语 } \map{% - \step[fieldsource=language,match=korean,final] - \step[fieldset=langid,fieldvalue={english}] + \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{%当没有language域信息给出时,根据title域来自动判断语言并设置本地化字符串语言 - %把语言信息设置language域内,而不再用userb域(20180525) - %接着根据信息域字符的unicode码判断 - \step[fieldsource=title,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF - \step[fieldset=language,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 - \step[fieldset=langid,fieldvalue={french}] + \map{%将没有设置usere,且存在translator域的默认设置为英文 + \step[fieldsource=translator,final] + \step[fieldset=usere,fieldvalue={english}] + } + \map{%编者的中文判断 + \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 + \step[fieldset=userc, fieldvalue={chinese}] + } + \map{\step[fieldsource=editor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF + \step[fieldset=userc,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 } \map{% - \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final] - \step[fieldset=language,fieldvalue={russian}]%俄语 - \step[fieldset=langid,fieldvalue={russian}] + \step[fieldsource=editor,match=\regexp{[\x{0400}-\x{052F}]},final] + \step[fieldset=userc,fieldvalue={russian}]%俄语 } \map{% - \step[fieldsource=title,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] - \step[fieldset=language,fieldvalue={japanese}]%日语 - \step[fieldset=langid,fieldvalue={english}]%中日韩语目前都用english, + \step[fieldsource=editor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] + \step[fieldset=userc,fieldvalue={japanese}]%日语 } %确定形式后可增加类似andotherscn这样的本地化字符串处理 \map{% - \step[fieldsource=title,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] - \step[fieldset=language,fieldvalue={korean}]%韩语 - \step[fieldset=langid,fieldvalue={english}] + \step[fieldsource=editor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] + \step[fieldset=userc,fieldvalue={korean}]%韩语 + } + \map{%将没有设置userc,且存在editor域的默认设置为英文 + \step[fieldsource=editor,final] + \step[fieldset=userc,fieldvalue={english}] + } + \map{%编者的中文判断 + \step[fieldsource=bookauthor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 + \step[fieldset=userb, fieldvalue={chinese}] + } + \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{%将没有设置userc,且存在editor域的默认设置为英文 + \step[fieldsource=bookauthor,final] + \step[fieldset=userb,fieldvalue={english}] + } + \map{\step[fieldsource=userd,final]%userd存在则用根据标题的语言设定language + \step[fieldset=language,origfieldval]%本身language存在则不设定 } - \map{%因为无法进行cjk字符判断,所以用反的思路,判断没有英文字符,没有空格,没有逗号等字符情况下 - %认为是中文的,将文献language设置成chinese,用于排序 - %参考4.5.8 姓名首字母生成控制 - %\step[fieldsource=author,match=\regexp{[^a-zA-Z\s\.\,\'\{\}\\\/\-\x22\x26\:0-9\p{IsP}\p{PosixPunct}\x{2bf}\x{2018}\xE9\p{IsASCII}]},final] - %对于带重音符号的字符似乎无法匹配。比如\'e - %最后选择直接匹配cjk字符,unicode编码位置从2FF0到9FA5 - \step[fieldsource=author,match=\regexp{[\x{2FF0}-\x{9FA5}]},final] - \step[fieldset=language,fieldvalue={chinese}] - } - \map{\step[fieldsource=title,match=\regexp{[\x{2FF0}-\x{9FA5}]},final] - \step[fieldset=language,fieldvalue={chinese}] + \map{\step[fieldsource=userf,final]%userd不存在,而userf存在则根据author的语言设定language + \step[fieldset=language,origfieldval] }%如果没有作者和标题,那么剩下的最可能有意义的只有网址了,而网址通常是英文的,因此不用再进一步对其它域进行判断了。 \map{%将没有设置的language设置成en,即认为不是中文的就是英文的。 \step[fieldset=language,fieldvalue={english}] - \step[fieldset=langid,fieldvalue={english}] } - \map{%将一条文献的主体语言放入userd中,以便进行多语言处理 - %之所以这么说,是因为一条文献可能是混合语言的,比如作者用的是英文 + \map{%一条文献的语言已经设定在language域中,由于出版项相关宏中使用userd判断, + %所以将一条文献的主体语言设定到userd中,本身前面userd已经设定,但没有处理无标题的情况, + %这里的处理等价于没有标题时,利用作者的语言设定userd,再没有作者,则默认用英文设定userd \step[fieldsource=language] \step[fieldset=userd,origfieldval] } + \map{%当文献给出language域时,设置文献要使用的本地化字符串的语言 + \step[fieldsource=language,match=english,final] + \step[fieldset=langid,fieldvalue={english}] + } + \map{ + \step[fieldsource=language,match=russian,final] + \step[fieldset=langid,fieldvalue={russian}] + } + \map{% + \step[fieldsource=language,match=french,final] + \step[fieldset=langid,fieldvalue={french}] + } + \map{% + \step[fieldsource=language,match=chinese,final]%中日韩语目前都用english, + \step[fieldset=langid,fieldvalue={english}] + } + \map{% + \step[fieldsource=language,match=japnese,final]%中日韩语目前都用english, + \step[fieldset=langid,fieldvalue={english}] + } + \map{% + \step[fieldsource=language,match=korean,final]%中日韩语目前都用english, + \step[fieldset=langid,fieldvalue={english}] + } } } @@ -1470,16 +1556,18 @@ togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}}% \DeclareDelimFormat{strandothersdelim}{% \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% \addspace% - \ifcurrentname{translator}{\testCJKfirst{usere}}{\testCJKfirst{userf}}% - \ifcurrentname{editor}{\testCJKfirst{userc}}{\testCJKfirst{userf}}% + \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}% - \iftoggle{ifCJKforgbt}{\bibstring{andotherscn}}{% -\iffieldequalstr{userd}{korean}{\bibstring{andotherskr}}{}% -\iffieldequalstr{userd}{japnese}{\bibstring{andothersjp}}{}% -\iffieldequalstr{userd}{english}{\bibstring{andothers}}{}% -\iffieldequalstr{userd}{french}{\bibstring{andothers}}{}% -\iffieldequalstr{userd}{russian}{\bibstring{andothers}}{}% - }% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}% + \iffieldequalstr{\userfieldabcde}{japnese}{\bibstring{andothersjp}}{}% + \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}% + \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}% + \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}% \or% \bibstring{andotherscn}% \or% @@ -1496,24 +1584,27 @@ togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}}% \DeclareDelimFormat{finalnamedelim}{% \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% \addspace% - \ifcurrentname{translator}{\testCJKfirst{usere}}{\testCJKfirst{userf}}% - \ifcurrentname{editor}{\testCJKfirst{userc}}{\testCJKfirst{userf}}% + \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}% - \iftoggle{ifCJKforgbt}{\bibstring{andcn}}{% -\iffieldequalstr{userd}{korean}{\bibstring{andkr}}{}% -\iffieldequalstr{userd}{japnese}{\bibstring{andjp}}{}% -\iffieldequalstr{userd}{english}{\bibstring{and}}{}% -\iffieldequalstr{userd}{french}{\bibstring{and}}{}% -\iffieldequalstr{userd}{russian}{\bibstring{and}}{}% - }\space% + \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}% + \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% + \iffieldequalstr{\userfieldabcde}{japnese}{\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日期格式 - % +% +% url和url日期格式 +% \renewbibmacro*{url+urldate}{% %\usebibmacro{url}%%更换url的位置,放到下面 \iffieldundef{urlyear}% diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.cbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.cbx index e97013f79a1..ffdfccf7e42 100644 --- a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.cbx +++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.cbx @@ -7,7 +7,7 @@ %% Released under the LaTeX Project Public License v1.3c or later %% --------------------------------------------------------------- %% -\def\versionofgbtstyle{2019/02/07 v1.0q} +\def\versionofgbtstyle{2019/02/11 v1.0q} \ProvidesFile{gb7714-2015.cbx}[\versionofgbtstyle biblatex citation style] % -- cgit v1.2.3