diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015 |
Initial commit
Diffstat (limited to 'macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015')
29 files changed, 27529 insertions, 0 deletions
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/README.md b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/README.md new file mode 100644 index 0000000000..a0bb4f301c --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/README.md @@ -0,0 +1,929 @@ +<b>Date of last change: 2019-08-28 to version v1.0s</b> + + +# biblatex-gb7714-2015: a biblatex style package +--------------------------------------------------------- +[使用入门](#jumptotutorial) |==| [说明文档](biblatex-gb7714-2015.pdf) |==| [WIKI](https://github.com/hushidong/biblatex-gb7714-2015/wiki) + + +## Introduction + +Maintainer: huzhenzhen <hzzmail@163.com> + +Homepage: <https://github.com/hushidong/biblatex-gb7714-2015> + +ctan-pkg: <https://www.ctan.org/pkg/biblatex-gb7714-2015> + +License: LaTeX Project Public License 1.3 or later + + +A biblatex implementation of the `GB/T 7714-2015` bibliography style for Chinese users + +The biblatex-gb7714-2015 package provides an implementation of the bibliography style of the `GB/T 7714-2015` bibliography style. This implementation follows `GB/T 7714-2015` standard, and can be used simply by loading biblatex with the appropriate option + + +--------------------------------------------------------- + +## Need to do: + + * special characters in all fields? + * entry without author: the delimiter between title and year? + * TEST FOR texlive 2015,2016,2017 + + + +## Usage +* for numerical sequence style: gb7714-2015 + + `\usepackage[backend=biber,style=gb7714-2015]{biblatex}` + + - add an option `gbalign` to control the align style of the numerical label: + + `gbalign=right` for the label ragged left in a list environment, this is the default setting. + + `gbalign=center` for the same width label in a list environment with the number centered in a wrapper like bracket [] + + `gbalign=left` for the label ragged right in list environment + + `gbalign=gb7714-2015` for the label in paragraph with same separation space between label and content of the reference entry + + `\usepackage[backend=biber,style=gb7714-2015,gbalign=gb7714-2015]{biblatex}` + + - add an option `gbpub` for dealing publishing items (This option is also for author-year style): + + `gbpub = true` for gb7714 style, to print `[出版者不详]` and the like when publisher or address is absent, this is the default setting. + + `gbpub = false` for standard style, not to print the additional infomation. + + `\usepackage[backend=biber,style=gb7714-2015,gbpub=true]{biblatex}` + + - add an option `gbnamefmt` for dealing author name's letter case (This option is also for author-year style): + + `gbnamefmt = uppercase` for gb7714 style, to capitalize all the letters of the name, like: ZHANG M L, this is the default setting. + + `gbnamefmt = lowercase` for gb7714 style, do no case switch of the name, like: Zhang M L + + `gbnamefmt = givenahead` for standard style, given-family style, like: M. L. Zhang as the ieee style + + `gbnamefmt = familyahead` for standard style, family-given style, like: Zhang, M. L. as the apa style. + + `gbnamefmt = pinyin` for a common Chinese style, like: ZHANG Min-li, YI Shi-he and so on. + + `gbnamefmt = reserveorder` for standard style:family-given/given-family style + + the name format can be set per-entry using a field `nameformat`, add this field like `nameformat={pinyin}` to an entry in the bib file to set the entry's name format. + + `\usepackage[backend=biber,style=gb7714-2015,gbnamefmt=uppercase]{biblatex}` + + - add an option `gbbiblabel` to control the format of the numerical label: + + `gbbiblabel=bracket` for the numerical number in the label wrapped by bracket, like: [1], this is the default setting. + + `gbbiblabel=parens` for the numerical number in the label wrapped by parenthesis, like: (1) + + `gbbiblabel=plain` for the numerical number in the label wrapped by nothing, like: 1 + + `gbbiblabel=dot` for the numerical number in the label followed with dot, like: 1. + + `gbbiblabel=box` for the numerical number in the label wrapped by box which generated by `\framebox` + + `gbbiblabel=circle` for the numerical number in the label wrapped by circle which generated by `\textcircled` + + `\usepackage[backend=biber,style=gb7714-2015,gbbiblabel=bracket]{biblatex}` + + - add an option `gbtype` to control the output of the reference type and carrier identifier like [J/OL] (This option is also for author year style): + + `gbtype = true` for gb7714 style, print a title with the identifier, like: `an on-line article [J/OL]`, this is the default setting. + + `gbtype = false` for none identifier, print a title without identifier, like: `an on-line article` + + `\usepackage[backend=biber,style=gb7714-2015,gbtype=true]{biblatex}` + + - add an option `gbfieldtype` to control the output of field type: + + `gbfieldtype = true` to print type field, like the thesis type: `PHD thesis` or `博士学位论文`。please use `\DefineBibliographyStrings{english}{mathesis={str you want}}`,`\DefineBibliographyStrings{english}{phdthesis={str you want}}`, + `\DefineBibliographyStrings{english}{mathesiscn={str you want}}`,`\DefineBibliographyStrings{english}{phdthesiscn={str you want}}` to + define the output string, or set it in bibfile like: `type={str you want},` + + `gbfieldtype = false` not to print type field. + + `\usepackage[backend=biber,style=gb7714-2015,gbfieldtype=true]{biblatex}` + + + - add an option `gbpunctin` to control the output of `//` before bookauthor for entrytypes like inbook/incollection/inproceedings(This option is also for author year style): + + `gbpunctin=true` for gb7714 style, to output `//`, this is the default setting + + `gbpunctin=false` for standard style, to output a bibstring, for English it is `IN:`, If you want to eliminate it at all, please redefine the bibstring like `\DefineBibliographyStrings{english}{in={}}` and `\DefineBibliographyStrings{english}{incn={}}`in the preamble. + + `\usepackage[backend=biber,style=gb7714-2015,gbpunctin=true]{biblatex}` + + - add an option `gbctexset` to control the bibliography heading's setting method (This option is also for author year style): + + `gbctexset=true` , the bibliography heading can be set by `\bibname` or `\refname`, this is the default setting. + + `gbpunctin=false`, the heading can be set by bibstring like `\DefineBibliographyStrings{english}{bibliography={title you want}}` or `\DefineBibliographyStrings{english}{references={title you want}}` + + or alternatively, it can also be set through the printbibliography option `title`, like `printbibliography[title=title you want]`. + + `\usepackage[backend=biber,style=gb7714-2015,gbctexset=true]{biblatex}` + + - add an option `gbcodegbk` to deal the tex source file encoded with GBK (This option is also for author year style): + + `gbcodegbk=true` , if you want to compile the GBK encoded source file with pdflatex or latex + + `gbcodegbk=false`, if you want to compile the utf-8 endcoded source file with xelatex, this is the default setting. + + `\usepackage[backend=biber,style=gb7714-2015,gbcodegbk=true]{biblatex}` + + - add an option `gbtitlelink` to control the hyperlink of title field (This option is also for author year style): + + `gbtitlelink = false` not to add hyperlink, this is the default setting. + + `gbtitlelink = true` to set the title as a hyperlink. + + `\usepackage[backend=biber,style=gb7714-2015,gbtitlelink=true]{biblatex}` + + - add an option `gbfootbib` to control the bibliography in footnote (This option is also for author year style): + + `gbfootbib = true` make patches to match the standard, this is the default setting. + + `gbfootbib = false` not to patch. + + `\usepackage[backend=biber,style=gb7714-2015,gbtitlelink=true]{biblatex}` + + - add options `gbcitelocal` `gbbiblocal` to control the local strings in citation and bibliography respectively, the `gblocal` set the both options (These options are also for author year style): + + `gbcitelocal = gb7714-2015` to output local strings according to the reference's language, this is the default setting. + + `gbcitelocal = chinese` to output local strings with chinese language word like "等". + + `gbcitelocal = english` to output local strings with western language word like "et al.". + + `\usepackage[backend=biber,style=gb7714-2015,gbcitelocal = chinese]{biblatex}` + + - add an option `gbstrict` to control the output of some unnecessary fields for GB/T7714-2015 (This option is also for author year style). + + `gbstrict=true`, not to print those fields such as language, eprint, this is the default setting. + + `gbstrict=false`, to output them as the standard style + + `\usepackage[backend=biber,style=gb7714-2015,gbstrict=true]{biblatex}` + + - add an option `gbfieldstd` to control the format of some fields such as title, url and pages (This option is also for author year style): + + `gbfieldstd = false` for gb7714 style, format of the fields follows the GB/T7714-2015 standard, this is the default setting. + + `gbfieldstd = true` for standard style. + + `\usepackage[backend=biber,style=gb7714-2015,gbfieldstd=true]{biblatex}` + + + +* for multi-style: gb7714-2015ms + + In order to use two styles in a tex file, add a style gb7714-2015ms. option `gbstyle` is added to control the using mode. `gbstyle=true` means all references are printed with GB/T7714-2015 style, and `gbstyle=false` means the chinese references are printed with GB/T7714-2015 style while the other references are printed with standard style shipped by biblatex, and `gbstyle=true` is the default set. all the options for numerical sequence style gb7714-2015 can also be used in gb7714-2015ms. + + `\usepackage[backend=biber,style=gb7714-2015ms,gbstyle=false]{biblatex}` + +* for author year style: gb7714-2015ay + + `\usepackage[backend=biber,style=gb7714-2015ay,gbpub=true]{biblatex}` + + - add an option `gbnoauthor` for dealing undefined author: + + `gbnoauthor = true` for gb7714 style, to print `佚名` or `Anon` when the author of the entry is absent. + + `gbnoauthor = false` for standard style, not to pring anything, this is the default setting. + + `\usepackage[backend=biber,style=gb7714-2015ay,gbnoauthor=true]{biblatex}` + + - add an option value `mergedate=none` to control the date in bibliography: + + `mergedate=true` to output date only after author,like:LAMPORT L, (1986). Document Preparation System[M]. [S.l.]: Addison-Wesley Reading, MA. + + `mergedate=false` to output date after author and in publish items,like:LAMPORT L, (1986). Document Preparation System[M]. [S.l.]: Addison-Wesley Reading, MA, 1986. + + `mergedate=none` to output date only in publish items,like:LAMPORT L. Document Preparation System[M]. [S.l.]: Addison-Wesley Reading, MA, 1986. + + do not set mergedate output like:LAMPORT L, 1986. Document Preparation System[M]. [S.l.]: Addison-Wesley Reading, MA. + + `\usepackage[backend=biber,style=gb7714-2015ay,mergedate=none]{biblatex}` + + - add an option `gblanorder` to control sequence of reference groups of different languagesin the bibliography: + + `gblanorder=chineseahead` to set the sequence as: cn;jp;kr;en;fr;ru + + `gblanorder=englishahead` to set the sequence as: en;fr;ru;cn;jp;kr + + `gblanorder=user defined string like: cn;en;jp;kr;fr;ru` to set the sequence as: cn;en;jp;kr;fr;ru. + + `\usepackage[backend=biber,style=gb7714-2015ay,gblanorder=cn;en;jp;fr;kr;ru]{biblatex}` + +* for perl script transformation tool(only for the numerical style) + + `perl gb7714texttobib.pl in=textfilename out=bibfilename` + +A demonstration database is provided to show how to format input for the style. The biblatex-gb7714-2015 style works with texlive2014, texlive2015, texlive2016, texlive2017 , texlive2018 and so on. + +please see the file 'biblatex-gb7714-2015.pdf' for further information! + + +## Applications + +* [SJTUThesis(上海交通大学学位论文模板)](https://github.com/sjtug/SJTUThesis)(母校的论文模板,不得不说缘分真的很神奇) +* [fduthesis(复旦大学论文模板)](https://github.com/Stone-Zeng/fduthesis) +* [ECNU-Undergraduate-LaTeX(华东师范大学本科毕业论文模板)](https://github.com/YijunYuan/ECNU-Undergraduate-LaTeX) +* [UCASthesis(中国科学院大学学位论文模板**国科大新版标准**)](https://github.com/xiaoyao9933/UCASthesis) +* [Study-LaTeX(LaTeX学习笔记)](https://github.com/Zousiyu/Study-LaTeX) +* [Zhejiang University thesis(浙江大学毕业设计/论文模板)](https://github.com/TheNetAdmin/zjuthesis) +* [fjnu-bathesis (福建师范大学本科毕业论文LaTeX 模板)](https://github.com/fjnuer/fjnu-bathesis) +* [Thesis-Template-for-XJTU (西安交大毕业设计模板)](https://github.com/DXie123/Thesis-Template-for-XJTU) +* [CAUTemplate(中国农业大学课程论文模板)](https://github.com/Cdmium/CAUTemplate) +* [Yet anoter BUPT Thesis LaTeX class (北邮研究生学位设计的LaTeX文档类)](https://github.com/qcts33/BUPTthesis-ctex) +* [neuthesis (东北大学博士学位论文Latex模板)](https://github.com/mervin0502/neuthesis) +* [nwafuthesis (西北农林科技大学学位论文LaTeX文档类)](https://github.com/registor/nwafuthesis) +* [...] + + + + +## Related Links + +* [Biblatex 宏包](https://github.com/plk/biblatex) +* [Beamer 文档类](https://github.com/josephwright/beamer) +* [biblatex 宏包中文手册 ](https://github.com/hushidong/biblatex-zh-cn) +* [biblatex 简明使用手册](https://github.com/hushidong/biblatex-solution-to-latex-bibliography) +* [biblatex-tutorial 摘译](https://github.com/hushidong/biblatex-tutorial-cn) +* [biblatex-map bib文件修改工具](https://github.com/hushidong/biblatex-map/) +* [biblatex-check bib文件检查工具](https://github.com/Pezmc/BibLatex-Check) +* [biblatex-caspervector: caspervector 设计的中文参考文献样式](https://github.com/CasperVector/biblatex-caspervector) +* [gbt7714-bibtex-style: GB/T7714-2015 标准的bst实现版本](https://github.com/zepinglee/gbt7714-bibtex-style) +* [LaTeX学习网站](http://www.latexstudio.net/) +* [LaTeX交流论坛](http://www.ctex.org/) + +--------------------------------------------------------- + +<h2 id="jumptotutorial">Tutorial/使用入门</h2> + +[comment]: # (这里这种方式不适合可能主要是因为标题所导致,因此用上面的方式进行处理 +<span id="jumptotutorial">## Tutorial/使用入门</span>) + + +<h3 id="jumptotexsrcf">1. Tex source file/tex文档一般结构</h3> + +``` +\documentclass{article}%文档类%导言区开始: + +\usepackage{ctex}%加载ctex宏包,中文支持 + +\usepackage[left=20mm,right=20mm,top=25mm, bottom=15mm]{geometry}%加载geometry宏包,定义版面 + +\usepackage[colorlinks=true,pdfstartview=FitH,% +linkcolor=blue,anchorcolor=violet,citecolor=magenta]{hyperref}%加载hyperref宏包,使用超链接 + +\usepackage[backend=biber,bibstyle=gb7714-2015,%nature,%%加载biblatex宏包,使用参考文献 +citestyle=gb7714-2015%,backref=true%%其中后端backend使用biber +]{biblatex}%标注(引用)样式citestyle,著录样式bibstyle都采用gb7714-2015样式 + +\usepackage{filecontents} +\begin{filecontents}{egbibdata.bib} +@Book{Peebles2001-100-100, + Title = {Probability, random variable, and random signal Principles and \LaTeX{}}, + Address = {New York}, + Author = {von Peebles, Jr., P. Z.}, + Edition = {4}, + Pages = {100}, + Publisher = {McGraw-Hill}, + Year = {2001} +} + +@Book{蔡敏2006--, + Title = {UML基础和Rose建模教程}, + Address = {北京}, + Author = {蔡敏 and 徐慧慧 and 黄柄强}, + Publisher = {人民邮电出版社}, + Year = {2006}, + Month = {1} +} +\end{filecontents} + +\addbibresource[location=local]{egbibdata.bib}%biblatex宏包的参考文献数据源加载方式 + +\begin{document}%正文区开始: + +%正文内容,引用参考文献 + +1. 不带页码的引用(顺序编码制上标,方括号包围;作者年制行内,括号包围):\\ + 见文献\cite{Peebles2001-100-100}\\ + 见文献\upcite{Peebles2001-100-100}\\ + 见文献\supercite{Peebles2001-100-100} + +2. 不带页码的引用(顺序编码制非上标,方括号包围;作者年制行内,括号包围):\\ + 见文献\parencite{Peebles2001-100-100} + +3. 带页码的引用(标准命令,默认样式; 增加命令,GB/T 7714-2015样式):\\ + 见文献\cite[见][49页]{蔡敏2006--}\\ + 见文献\parencite[见][49页]{Peebles2001-100-100}\\ + 见文献\pagescite{Peebles2001-100-100}\\ + 见文献\pagescite[201-301]{Peebles2001-100-100} + +4. 顺序编码制中同时输出作者和顺序编码标签,比如:\\ + 见\citeauthor{蔡敏2006--}\cite{蔡敏2006--}\\ + 见\authornumcite{蔡敏2006--}\\ + 见\textcite{蔡敏2006--} (顺序编码标签不上标) + +5. 作者年制文中已有作者还需要年份和页码(顺序编码制与pagescite作用相同,作者年制年份行内页码上标):\\ + 见蔡敏\yearpagescite[][205]{蔡敏2006--}和Peebles\yearpagescite[][15]{Peebles2001-100-100} + +6. 作者年制文中已有作者只需要年份(顺序编码制与pagescite作用相同,作者年制年份行内):\\ + 见赵耀东\yearcite{蔡敏2006--}\\ + 见赵耀东(\cite*{蔡敏2006--})\\ + 见赵耀东(\citeyear{蔡敏2006--}) + +7. 作者年制中由标注命令给出作者年份信息,作者以主语方式作为正文内容:\\ + 见\textcite{蔡敏2006--} + +8. 在页脚中引用和打印文献表:\\ + 见文献\footnote{在脚注中引用\footcite{蔡敏2006--}}\\ + 见文献\footfullcite{蔡敏2006--} + + +%打印参考文献表 + \printbibliography[heading=bibliography,title=参考文献] +\end{document} +``` + +### 2. Compile method/文档编译方式 + +``` + xelatex jobname.tex + biber jobname + xelatex jobname.tex + xelatex jobname.tex +``` + +或者 + +``` + latexmk -xelatex jobname.tex +``` + +编译引擎使用lualatex也是可以的,只要该引擎编译时ctex宏包能够正确支持中文。 + + +### 3. Recommended environment/推荐使用环境 + +- Texlive+Winedt +- Texlive+Texstudio +- texlive及其它发行版安装见[安装指南](https://github.com/sjtug/SJTUThesis/wiki/%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97) + + +### 4. Common questions/常见问题 + +#### 4.1 Installation and use/安装和使用 + +* <b>怎么利用biblatex生成国标GB/T 7714-2015格式的参考文献表?</b> + +> (1)在导言区加载biblatex宏包,并使用gb7714-2015样式: + +```\usepackage[backend=biber,style=gb7714-2015]{biblatex}``` + +> (2)正文中引用参考文献: + +```见文献\cite{referencbibtexkey}``` + +> (3)在需要的地方打印参考文献表: + +```\printbibliography``` + +更直接的例子见前述的[tex源文档](#jumptotexsrcf) + + + +* <b>请问我应该怎么安装和更新biblatex-gb7714-2015宏包?</b> + +> biblatex-gb7714-2015宏包是基于biblatex的样式宏包,目前texlive,miktex都已收录,因此可以直接使用,一般不需要安装。如果使用时,系统提示找不gb7714-2015.bbx或gb7714-2015ay.bbx文件的错误,说明当前tex系统未安装biblatex-gb7714-2015样式包,这时需要安装它。最简单的方法是从本项目源码中下载 gb7714-2015.bbx, gb7714-2015ay.bbx, gb7714-2015.cbx, gb7714-2015ay.cbx 四个文件放到你要编译的主文档所在目录,如果需要使用gbk编码,则还需复制 gb7714-2015-gbk.def 文件。对于已经安装的用户需要更新到最新版,则可以下载这些文件替换系统已经安装的文件。 + + + +* <b>为什么我之前使用样式`style=caspervector`进行编译没有问题,换成`style=gb7714-2015`后,编译就出现错误?</b> + +> 可能有三个原因: + +> 1. 辅助文件没有清理导致,当采用caspervector样式时编译产生的辅助文件中可能带有该样式的一些特有信息,由此产生一些不兼容。因此需要的操作是,清除辅助文件,然后再进行编译。清除命令为(下面的命令是windows下的,linux下的是类似的只需把删除命令换成`rm -f`): + +```del /q *.aux *.bbl *.blg *.log *.out *.toc *.bcf *.xml *.synctex *.nlo *.nls *.bak *.ind *.idx *.ilg *.lof *.lot *.ent-x *.tmp *.ltx *.los *.lol *.loc *.listing *.gz *.synctex(busy) *.nav *.snm *.vrb *.fls *.xdv *.fdb_latexmk``` + +> 2. biblatex-gb7714-2015 版本过于陈旧,旧版本对于一些特殊情况可能考虑不全面。因此需要的操作是更新biblatex-gb7714-2015,方法见上一个问题。 + +> 3. 编译命令问题,通常情况下tex文档和bib文档是utf8编码的,因此最好采用xelatex编译,而不用pdflatex。因此如果编译时用pdflatex出现错误,请换成xelatex。 + + + +* <b>为什么利用 ctex2.9 套装进行编译时,出现错误?</b> + +> 由于ctex2.9套装多年未更新,其中的biblatex宏包过于陈旧,所以需要更新 biblatex。 + + + +* <b>请问除了利用xelatex进行编译外,能不能用pdflatex进行编译?</b> + +> 能用pdflatex进行编译,但要注意的是因为某些样式比如authoryear等使用了xstring宏包中的一些命令,所以会产生错误,但numeric类样式通常没有问题。这一问题在biblatex更新到3.12版本后取消xstring宏包后得以解决。 + +> 中文用户需要注意一些编码的问题。utf-8编码的文档,采用xelatex编译没有任何注意事项,但使用pdflatex编译时,需要给ctex宏包加载UTF8选项,比如`\usepackage[UTF8]{ctex}`或者在文档类加载时给出也可以比如`\documentclass[[UTF8]{article}`,同时引用文献时使用的引用关键词应使用英文。当文档使用其他编码时,xelatex编译通常需要指定一个文档编码,比如windows环境下的GB2312编码的文档需要指定`\XeTeXinputencoding "GBK"`, 否则显示乱码。使用pdflatex进行编译,如果biblatex不能正确的处理编码问题,那么需要为其明确的指定texencoding和bibencoding选项。比如windows环境下的GB2312编码的文档,需要指定`\usepackge[texencoding=GBK]{biblatex}`。 + + +* <b>请问使用backref=true选项后,某个反向超链接总是链接到封面页是怎么回事?</b> + +> 对页码进行正确超链接需要一个前提是,当前链接的页码是唯一的。当有两页具有相同的页码时,超链接总是链接到第一各具有该页码的页面上。比如封面页页码是1,正文第一页页码也是1,那么到正文第一页的反向超链接总会链接到封面页上。解决该问题就是要解决页码的唯一性问题。当页码的表示形式不是同一种时,那么也会得到正确的区分。比如封面页用罗马字母I表示,而正文第一页用阿拉伯数字1表示,那么就能得到正确的反向超链接。类似于: +``` +\pagenumbering{roman} +\title{title} +\maketitle +\clearpage + +\pagenumbering{arabic} +\section{文献表} +``` + + +* <b>我希望参考文献表中的文献不是按引用顺序而是以文献作者的字母顺序排序,怎么实现?</b> + +> 一般情况下文献表是按引用顺序进行排列,标签是顺序的数字,这种方式称为顺序编码制。 +> 如果要以文献作者字母顺序排列,那么可以换一种编制方式,称为作者年制: + +```\usepackage[backend=biber,style=gb7714-2015ay]{biblatex}``` + +> 如果要求使用顺序编码制文献表,又要以文献作者字母顺序排列,那么可以增加排序选项`sorting=nyt`: + +```\usepackage[backend=biber,style=gb7714-2015,sorting=nyt]{biblatex}``` + + + +* <b>作者年制中英文文献能按字母顺序排列,那么中文文献能否以拼音或者笔画进行排序呢?</b> + +> 能,可以通过编译时给biber设置选项来实现: + +``` +%按拼音排序,biber命令 +biber -l zh__pinyin jobname +%按笔画排序,biber命令 +biber -l zh__stroke jobname +``` + +> 或者,也可以通过增加 biblatex 选项来实现(此时biber编译无需另加选项),比如: + +```\usepackage[backend=biber,style=gb7714-2015ay,sortlocale=zh__pinyin]{biblatex}``` + + + +* <b>作者年制参考文献表目前的排序时升序排列,能不能改成降序排序?</b> + +> 能,这需要通过修改gb7714-2015ay.bbx中的代码来实现,找到: + +```\sort{%[direction=descending]``` + +> 修改为: + +```\sort[direction=descending]{%``` + + + +* <b>我希望文献表以阿拉伯数字编号,而正文中的引用标签使用作者和年份标注而不是数字,请问我该如何处理?</b> + +> 可以设置不同的标注和著录样式,比如标注样式用作者年制,而著录样式用顺序编码制,比如: + +```\usepackage[backend=biber,citestyle=gb7714-2015ay,bibstyle=gb7714-2015]{biblatex}``` + +> 参见:[issue:参考文献的顺序](https://github.com/sjtug/SJTUThesis/issues/300) + + + +* <b>如果我还希望顺序编码的文献著录表以拼音排序,请问该怎么操作?</b> + +> 顺序编码文献著录表默认是按引用顺序排序,但可以通过设置sorting选项进行调整,比如sorting=nyt表示按作者姓名年份以及文献标题进行排序。要使中文能按拼音排序,可以设置本地化排序调整方案,即sortlocale选项,比如: + +```\usepackage[backend=biber,citestyle=gb7714-2015ay,bibstyle=gb7714-2015,sorting=nyt,sortlocale=zh__pinyin]{biblatex}``` + + + +* <b>请问如果参考文献中存在一些特殊字符比如&或者一些特殊命令比如\LaTex{}等,是不是会出现问题?</b> + +> 通常不会出现问题,直接输入即可,当出现问题时可以手动调整比如修改为`\&`和`{\LaTex{}}` + + + +* <b>如果希望在参考文献中直接使用一些unicode字符比如希腊字母等而不想用数学环境中的命令,请问该怎么处理?</b> + +> 直接显示希腊字母等unicode字符需要字体的支持,比如CMU Serif等,可以在整个文档全局使用该字体,也可以仅在文献表中使用该字体,比如: + +``` +{ +\newcommand{\ftcmu}{\fontspec{CMU Serif}\selectfont} +\renewcommand{\bibfont}{\ftcmu}%设置英文字体不影响中文字体 +\printbibliography +} +``` + +> 当然字体设置需要fontspec宏包的支持。 + + + +* <b>我习惯用传统的bst文件来生成参考文献,有没有GB/T 7714-2015标准的实现版本?</b> + +> GB/T 7714-2015标准实现的bst版本,已经由[zeping lee](https://github.com/zepinglee/gbt7714-bibtex-style)开发完毕,直接使用即可。 + + + +* <b>我在使用过程中遇到了一些无法理解和无法解决的问题,怎么办?</b> + +> 请邮件联系hzzmail@163.com或在项目内发issue提问即可。 + + +#### 4.2 Bibliography format/文献表著录格式 + +* <b>请问可以在参考文献表中实现类似于word那样的与文献内容等间距标签对齐格式么?</b> + +> 可以,latex的列表通常用list来实现,因此一般列表的内容都是对齐的, +> 此时如果标签右对齐的,那么标签和内容等间距,但标签左侧是不对齐的。 +> 如果标签是左对齐的,那么标签和内容的间距不相等。 +> 如果要求标签左侧对齐,且标签与内容等间距必须放弃使用list。 +> biblatex-7714-2015的顺序编码制样式特别设计了这样的环境,以保持和word一致。通过设置选项gbalign来实现: + +```\usepackage[backend=biber,bibstyle=gb7714-2015,gbalign=gb7714-2015]{biblatex}``` + + + +* <b>如果不希望在参考文献表中出现类似“出版地不详”“出版者不详”等信息时,请问该怎么处理?</b> + +> 设置选项gbpub可以实现,当gbpub=false时,biblatex-gb7714-2015宏包会放弃国标的要求,不使用“出版地不详”等补充信息: + +```\usepackage[backend=biber,bibstyle=gb7714-2015,gbpub=false]{biblatex}``` + + + +* <b>我觉得文献表中英文作者全部用大写不好看,请问能换一种大小写方式么?</b> + +> 能,通过设置gbnamefmt可以实现,默认情况下gbnamefmt=uppercase,作者姓名字母全部大写。 +> 当设置gbnamefmt=lowercase时,biblatex-gb7714-2015宏包对于bib文件中的作者姓名的大小写不做改变, +> 这时可以在bib文件中手动设置想要的大小写方式。 +> 当要实现类似ZHAO Yu-xin这样的拼音方式,则可以设置gbnamefmt=pinyin: + +```\usepackage[backend=biber,bibstyle=gb7714-2015,gbnamefmt=lowercase]{biblatex}``` + + + +* <b>如果不希望在参考文献表中出现类似“[M]”“[J]”等文献类型标识符时,请问该怎么处理?</b> + +> 可通过设置选项gbtype=false实现: + +```\usepackage[backend=biber,bibstyle=gb7714-2015,gbtype=false]{biblatex}``` + + + +* <b>如果不希望在参考文献表中出现网址信息时,请问该怎么处理?</b> + +> 可通过设置选项url=false实现: + +```\usepackage[backend=biber,bibstyle=gb7714-2015,url=false]{biblatex}``` + + + +* <b>如果不希望在参考文献表中出现DOI信息时,请问该怎么处理?</b> + +> 可通过设置选项doi=false实现: + +```\usepackage[backend=biber,bibstyle=gb7714-2015,doi=false]{biblatex}``` + + + +* <b>如果对当前文献中的url或doi显示效果(包括间距和断行)不满意,能否进行调整?</b> + +> 能,可以通过设置三个计数器的值来调整,取值范围0到9999,计数器的值越大则越容易在相应的内容后断行: + +``` +\setcounter{biburlnumpenalty}{100}%大于0允许在数字后面断行 +\setcounter{biburlucpenalty}{100}%大于0允许在大写字母后面断行 +\setcounter{biburllcpenalty}{100}%大于0允许在小写字母后面断行 + +``` + + + +* <b>当参考文献没有作者时,希望用佚名或Anon代替作者时,请问该怎么处理?</b> + +> 可通过设置选项gbnoauthor=true实现,注意该处理主要用在作者年制中: + +```\usepackage[backend=biber,bibstyle=gb7714-2015,gbnoauthor=true]{biblatex}``` + + + +* <b>如果希望参考文献表中文献作者数量超过国标规定的3个时,请问该怎么处理?</b> + +> 可通过设置选项maxbibnames,minbibnames实现,比如下面的设置用于显示5个作者: + +```\usepackage[backend=biber,bibstyle=gb7714-2015,maxbibnames=5,minbibnames=5]{biblatex}``` + + +* <b>请问如何将作者之间的分隔符调整为and而不是用逗号?</b> + +> 可以通过重设两个分隔符来实现,分别是multinamedelim和finalnamedelim。低版本的biblatex直接重定义命令`\multinamedelim`和`\finalnamedelim`,高版本的biblatex可以使用分隔符环境,这样可以在标注、文献表等不同位置直接使用不同的分隔符,而不像低版本biblatex那样只能在不同的位置修改局部定义。比如: + +``` +\DeclareDelimFormat[bib]{multinamedelim}{\addspace and \addspace} +\DeclareDelimFormat[bib]{finalnamedelim}{\addspace and \addspace} +\DeclareDelimFormat[cite]{multinamedelim}{\addcomma\addspace} +\DeclareDelimFormat[cite]{finalnamedelim}{\addcomma\addspace} +``` + + + +* <b>请问如何使文献表中文献标题的是句首字母大写而其它所有字母均小写?</b> + +> 默认情况下,biblatex-gb7714-2015不对标题的字母大小写做处理,因此要得到想要的字母大小写格式, +> 需要在bib文件输入参考文献信息时给出需要的大小写格式。 + + + +* <b>请问如何使文献表中的期刊名是单词首字母大写的?</b> + +> 默认情况下,biblatex-gb7714-2015不对期刊名的字母大小写做处理, +> 因此需要在bib文件输入参考文献信息时给出需要的大小写格式。 + + + +* <b>我想得到中英文对照的双语参考文献,请问该如何处理?</b> + +> biblatex-gb7714-2015设计了两种多语言对照参考文献的实现方式, +> 一种是利用条目集的概念,另一种是利用关联条目的概念。 +> 因此有两种方法: + +> 方法一,动态定义条目集: +> 在导言区或正文中定义: +```\defbibentryset{易仕和,等,2013}{易仕和2013--,Yi2013--}``` + +> 在正文中引用: +``双语文献引用\cite{易仕和,等,2013}``` + +> 方法二,动态定义关联条目: +> 在导言区定义: +```\defdoublelangentry{易仕和2013--}{Yi2013--}``` + +> 在正文中引用: +```双语文献引用\cite{易仕和2013--}``` + + +* <b>我想修改文献条目的日期项诸如格式,请问该如何处理?</b> + +参考文献中日期格式主要有四种修改方式: +1. 利用biblatex选项全局的修改日期格式 +2. 修改日期输出宏,使根据条目类型输出不同的日期格式 +3. 修改日期输出宏,使根据具体条目输出不同的日期格式 +4. 修改参考文献信息,使当前条目原样输出需要的格式 + +具体示例见:[biblatex中如何修改参考文献中日期的著录格式](https://blog.csdn.net/xenonhu/article/details/86933525) + + + +#### 4.3 Citation format/正文引用的标注格式 + +* <b>我希望在正文中同时使用上标和非上标的引用标签,请问该怎么操作?</b> + +> 可以使用不同的命令来实现上标和非上标的标签, +> 上标标签的命令为`\cite{bibtexkey}`,非上标标签的命令为`\parencite{bibtexkey}`。 +> 当希望上标的标签也给出国标要求的页码时,则可以使用`\pagescite[50-55]{bibtexkey}`给出指定页码 +> 或者`\pagescite{bibtexkey}`直接使用bib文件中的页码。 + + + +* <b>我在引用文献时已经给出作者信息,希望引用标签仅包含年份和页码信息或者仅包含年份信息时,该怎么操作?</b> + +> 需要给出年份的标签是作者年制的标签,可以使用命令`\yearpagescite{bibtexkey}`给出包含年份和页码信息的标签, +> 使用命令`\yearcite{bibtexkey}`给出仅包含年份的标签。 + + + +* <b>在使用作者年制时,我希望文献表是按作者年份标题排序,而正文某处一个cite命令引用多个参考文献,且这些文献的标签是按年份作者标题排序,该怎么操作?</b> + +> 有两种方法: + +> 一是自动排序 + +> 宏包加载时使用: + +```\usepackage[backend=biber,style=gb7714-2015ay,sortcites,sorting=ynt]{biblatex}``` + +> 正文中引用: + +```\cite{refa2010,refb2008,refc2009}``` + +> 然后在文献打印前加 + +```\newrefcontext[sorting=nyt]``` + +> 二是手动给出排序 + +> 宏包加载时使用 + +```\usepackage[backend=biber,style=gb7714-2015ay]{biblatex}``` + +> 引用多个文献时按照年份顺序给出引用关键字,即正文中引用: + +```\cite{refb2008,refc2009,refa2010}``` + +> 参考:[issue:citation的顺序和bibliography的顺序如何不关联](https://github.com/hushidong/biblatex-gb7714-2015/issues/30) + + + +* <b>在使用作者年制时,我希望文献表同一位置引用同一作者的不同的文献实现作者姓名的压缩,该怎么操作?</b> + +> 可以通过将gb7714-2015ay.cbx 中的引用的基础样式authoryear更换成authoryear-comp。 + + + +* <b>请问希望正文中作者年制的标注(引用)标签中作者数量超过国标规定的1个时,该怎么处理?</b> + +> 可通过设置选项maxcitenames,mincitenames实现,比如下面的设置用于显示5个作者: + +```\usepackage[backend=biber,style=gb7714-2015ay,maxcitenames=5,mincitenames=5]{biblatex}``` + + + +* <b>请问希望正文中作者年制的标注(引用)标签中作者数量只能是1个,而不管是否存在歧义时,该怎么处理?</b> + +> 可通过设置选项uniquelist=false实现,该设置标签中的作者只会是指定的1个: + +```\usepackage[backend=biber,style=gb7714-2015ay,uniquelist=false]{biblatex}``` + + + +* <b>请问希望正文中作者年制的标注(引用)标签中作者数量只能是1个,且只用其作者的姓而不管是否存在歧义时,该怎么处理?</b> + +> 可通过设置选项uniquelist=false, uniquename=false实现,该设置标签中的作者只会是指定的1个且只用该作者的姓: + +```\usepackage[backend=biber,style=gb7714-2015ay,uniquelist=false,uniquename=false]{biblatex}``` + + + + +* <b>请问上标的标注(引用)标签过长导致行溢出,该怎么处理?</b> + +> 上标的标注与行内的标注不一样,因此采用了上标的处理,所以上标的标注无法自动断行,因此在页边附近的长标注很有可能会溢出。由于上标标注的断行国标中并没有什么明确要求和说明,因此只能按照自己的方式进行处理,通常是将一个长标注手动分成两个短的标注,比如将: + +```\cite{key1,key2,key3,key4,key5,key6,key7}``` + +变换成: + +```\cite{key1,key2,key3}\linebreak\cite{key4,key5,key6,key7}``` + +如果两个cite之间还需要增加一个上标的逗号,那么可以手动处理比如增加`\textsuperscript{,}` + + + +* <b>在顺序编码制标签中,希望数字编码从两个连续编码就开始压缩,比如[1,2]压缩成[1-2],该怎么处理?</b> + +> biblatex中处理顺序数字编码压缩的代码默认从3个连续编码开始压缩,比如[1,2,3]压缩成[1-3]。如果要修改为从2个连续编码开始压缩,只需要做一个很简单的修改即可: + +``` +%该宏的目的是抛弃压缩内部的编号,而仅输出最后一个编号,主要通过cbx@tempcnta来控制 +%一般情况下cbx@tempcnta为0,所以该宏不输出任何内容。当cbx@tempcnta在cite:comp:comp宏中更改变大后 +%说明开始进入需要压缩的范围,当到压缩终点时,cbx@tempcnta必然大于1,则输出内容。 +%修改第二行的数字1为0即可将默认的3个开始压缩变为2个开始压缩。 +\renewbibmacro*{cite:dump}{ + \ifnumgreater{\value{cbx@tempcnta}}{0} + {\ifnumgreater{\value{cbx@tempcnta}}{1}%1改为0,可以将压缩起始3个编号改为2个编号 + {\bibrangedash} + {\multicitedelim}% + \bibhyperref[\cbx@lastkey]{% + \ifdef\cbx@lastprefix + {\printtext[labelprefix]{\cbx@lastprefix}} + {}% + \printtext[labelnumber]{\cbx@lastnumber}}} + {}% + \setcounter{cbx@tempcnta}{0}% + \global\undef\cbx@lastprefix} +``` + + + +* <b>在正文中的某一部分,希望取消顺序编码标签中的压缩,而其他部分保持这种压缩,该怎么处理?</b> + +> 顺序数字编码压缩的代码,主要有cite:comp:comp宏控制,因此需要局部取消压缩,可以局部的修改该宏。修改很简单,只需要注释掉其中的一行,在需要取消压缩的环境中,重定义该宏,比如: + +``` +\renewbibmacro*{cite:comp:comp}{% + \ifboolexpr{ + ( test {\iffieldundef{labelprefix}} and test {\ifundef\cbx@lastprefix} ) + or + test {\iffieldequals{labelprefix}{\cbx@lastprefix}} + } + {\ifnumequal{\thefield{labelnumber}}{\value{cbx@tempcntb}} + {\savefield{entrykey}{\cbx@lastkey}% + \savefield{labelnumber}{\cbx@lastnumber}% + \addtocounter{cbx@tempcnta}{1}} + {\ifnumequal{\thefield{labelnumber}}{\value{cbx@tempcntb}-1} + {} + {\usebibmacro{cite:dump}% + \ifnumgreater{\value{cbx@tempcntb}}{-1} + {\multicitedelim} + {}% + \printtext[bibhyperref]{% + \printfield{labelprefix}% + \printfield{labelnumber}}}}} + {\usebibmacro{cite:comp:end}}% + %\setcounter{cbx@tempcntb}{\thefield{labelnumber}}%%注释该行,以取消压缩 + \savefield{labelprefix}{\cbx@lastprefix}} +``` + + + + + +### 5. Examples/著录和标注结果示例 +* 顺序编码制 + +![示例a](example/fig-style-numeric.png) + +* 作者年制 + +![示例b](example/fig-style-authoryear.png) + + +* 姓名的格式更改 + +对于bib文件中的如下条目,有: + + @Article{Zhang2007-500-503, + Title = {The design and experimental investigations of supersonic length shorted nozzle}, + Author = {Zhang, Min-li and Yi, Shi-he and Zhao, Yu-xin}, + Journal = {ACTA AERODYNAMICA SINICA}, + Number = {4}, + Pages = {500-503}, + Volume = {25}, + Year = {2007} + } + + @Book{Yi2013--, + Title = {Supersonic and hypersonic nozzle design}, + Address = {Beijing}, + Author = {Yi, Shi he and Zhao, Yu xin and He, Lin and Zhang, Min li}, + Publisher = {National Defense Industry Press}, + Year = {2013} + } + + @Book{LIAO2012--, + Title = {Electronic countermeasure techniques for missile penetration}, + Address = {Beijing}, + Author = {LIAO, ping and JIANG, qin bo}, + Publisher = {National Defense Industry Press}, + Year = {2013} + } + + @Book{LIU2003--, + Title = {Introduction of Ballistic Misille Techniques}, + Address = {Beijing}, + Author = {LIU, shi Qiu}, + Publisher = {China Astronautic Publishing House}, + Year = {2003} + } + +![示例c](example/fig-nameformat.png) + + + +--------------------------------------------------------- + +## Version history: + +* 2016/05/20 v1.0 +* 2016/10/23 v1.0a +* 2016/11/11 v1.0b +* 2016/11/14 v1.0c +* 2016/11/24 v1.0d +* 2016/12/07 v1.0e +* 2017/02/26 v1.0g +* 2017/04/11 v1.0h +* 2017/11/21 v1.0i +* 2018/01/20 v1.0j +* 2018/04/03 v1.0k +* 2018/06/01 v1.0l +* 2018/08/14 v1.0m,CTAN +* 2018/11/04 v1.0n +* 2018/12/22 v1.0o +* 2019/01/19 v1.0p +* 2019/02/11 v1.0q +* 2019/03/28 v1.0r +* 2019/03/29 v1.0rm,rename erj to chinese-erj,ctan +* 2019/08/28 v1.0s + + +--------------------------------------------------------- +## Update history: + +[update: tex](example/updatehistory.tex) + +[update: tex](example/updatehistoryold.tex) + + + diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015-preamble.tex b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015-preamble.tex new file mode 100644 index 0000000000..fbf92f0fea --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015-preamble.tex @@ -0,0 +1,427 @@ +\usepackage{expl3,etoolbox,ifthen,xstring} +\usepackage{xltxtra,mflogo,texnames,fontawesome} +%\usepackage{amstext} +\usepackage[zihao=-4]{ctex} +\ctexset{today=old} +\let\kaiti=\kaishu +\usepackage{xeCJKfntef} +%\setmainfont{CMU Serif} +\usepackage{fontspec} +%\usepackage{tgpagella} +\setmainfont[Ligatures=TeX]{TeX Gyre Pagella} +\setsansfont[Ligatures=TeX]{TeX Gyre Pagella} +\setmonofont[Ligatures=TeX]{TeX Gyre Pagella} +%\usepackage{unicode-math} +%\setmathfont[math-style=ISO,bold-style=ISO]{TeX Gyre Pagella Math} +\setCJKmainfont +[BoldFont=SourceHanSansSC-Regular.otf, ItalicFont=simkai.ttf]{SourceHanSerifSC-Regular.otf} + +\usepackage[dvipsnames]{xcolor} +\colorlet{examplefill}{yellow!80!black} +\definecolor{graphicbackground}{rgb}{0.96,0.96,0.8} +\definecolor{codebackground}{rgb}{0.9,0.9,1} +\definecolor{gbsteelblue}{RGB}{70,130,180} +\definecolor{gborange}{RGB}{255,138,88} +\definecolor{gbblue}{RGB}{23,74,117} +\definecolor{gbforestgreen}{RGB}{21,122,81} +\definecolor{gbyellow}{RGB}{255,185,88} +\definecolor{gbgrey}{RGB}{200,200,200} +\colorlet{gblabelcolor}{violet} +\colorlet{gbemphcolor}{blue!60!black} +%\colorlet{gbemphcolor}{violet} + +%定义版面,showframe, +\usepackage[paperwidth=210mm,paperheight=290mm,left=35mm,right=20mm,top=25mm, bottom=20mm,showcrop]{geometry}%,showframe +\renewcommand{\baselinestretch}{1.35} +%页面布局的标尺 +\usepackage[type=none]{fgruler} +%[unit=cm,type=lowerleft,showframe=true,hshift=3cm,vshift=2cm] +\rulerparams{}{}{gray!10}{}{0.2pt} +\fgrulerdefnum{}\fgrulercaptioncm{}%fgruler加数字后,导致基线对齐出现问题,所以这里去掉 + +\newlength{\skipheadrule} +\deflength{\skipheadrule}{3.5pt} +\newlength{\skipfootrule} +\deflength{\skipfootrule}{5.5pt} +\newlength{\ruletotalen} +\deflength{\ruletotalen}{\textheight} +\newlength{\ruleraised} +\deflength{\ruleraised}{\headsep+\textheight} +\usepackage{fancyhdr} +\fancyhf{} +\fancyhead[LO]{% +\raisebox{-\skipheadrule}{% +\raisebox{-\headsep}[0pt][0pt]{\makebox[0pt][l]{\ruler{rightup}{\linewidth}}}% +\raisebox{-\ruleraised}[0pt][0pt]{\makebox[0pt][r]{\ruler{upleft}{\ruletotalen}}}% +}%HEAD LEFT% +} +\fancyhead[LE]{% +\raisebox{-\skipheadrule}{% +\raisebox{-\headsep}[0pt][0pt]{\makebox[0pt][l]{\ruler{rightup}{\linewidth}}}% +\raisebox{-\ruleraised}[0pt][0pt]{\makebox[0pt][r]{\ruler{upleft}{\ruletotalen}}}% +}\leftmark%HEAD LEFT% +} +\fancyhead[RO]{% +%HEAD RIGHT% +\raisebox{-\skipheadrule}{% +\hfill\makebox[0pt][l]{\raisebox{-\ruleraised}[0pt][0pt]{\ruler{downright}{\ruletotalen}}\hss}% +}} +\fancyhead[RE]{% +\rightmark%HEAD RIGHT% +\raisebox{-\skipheadrule}{% +\hfill\makebox[0pt][l]{\raisebox{-\ruleraised}[0pt][0pt]{\ruler{downright}{\ruletotalen}}\hss}% +}} +\fancyhead[CO]{% +符合GB/T 7714-2015标准的biblatex参考文献样式%HEAD CENTER +} +\fancyfoot[L]{% +\raisebox{-\skipfootrule}{% +\raisebox{\footskip}[0pt][0pt]{\makebox[0pt][l]{\ruler{rightdown}{\linewidth}}} +}%FOOT LEFT +} +\fancyfoot[C]{% +\thepage%FOOT CENTER +} +\fancyfoot[R]{% +%FOOT RIGHT +} +\renewcommand{\headrulewidth}{0.4pt} +\renewcommand{\footrulewidth}{0pt} +\pagestyle{fancy} + + +%超链接书签功能,选项去掉链接红色方框 +\usepackage[colorlinks=true,% +pdfstartview=FitH,allcolors=gbemphcolor]{hyperref} +%linkcolor=gbblue,anchorcolor=gbblue,citecolor=gbblue +%linkcolor=black,linkcolor=green,blue,red,cyan, magenta, +%yellow, black, gray,white, darkgray, lightgray, brown, +%lime, olive, orange, red,purple, teal, violet. +%CJKbookmarks,bookmarksnumbered=true, +\usepackage{titleref} %标题引用 + +%标题格式设置 +\usepackage{titlesec} +%\titlespacing*{hcommandi}{hlefti}{hbefore-sepi}{hafter-sepi}[hright-sepi] +\titlespacing*{\section}{0pt}{\baselineskip}{0.5\baselineskip} +\titlespacing*{\subsection}{0pt}{0.5\baselineskip}{0.5\baselineskip} +\titlespacing*{\subsubsection}{0pt}{0.5\baselineskip}{0pt} +\titlespacing{\paragraph}{2em}{0.5\baselineskip}{1em} +%这里利用titleformat*简单做设置,也可以利用titleformat做详细设置 +\titleformat*{\section}{\zihao{-3}\bfseries\heiti} +\titleformat*{\subsection}{\zihao{4}\bfseries\songti} +\titleformat*{\subsubsection}{\zihao{-4}\bfseries\kaiti} + +%参考文献 +\usepackage[backend=biber,style=gb7714-2015,gbalign=center,gbfootbib=true%,gbtype=true% +]{biblatex}%,backref=true% +\addbibresource[location=local]{example.bib} +\setlength{\bibitemsep}{1pt} +%\defbibheading{bibliography}[\bibname]{% +%%\phantomsection%解决链接指引出错的问题,相当于加入了一个引导点 +%%\addcontentsline{toc}{subsection}{#1} +% \centering\subsubsection*{#1}}% + + +%目录,图/表/例目录,图表题注 +\usepackage{subfigure} +\usepackage[subfigure]{tocloft} %注意其与titletoc共用时分页会有问题 +\usepackage{ccaption} +\captiondelim{. } %图序图题中间的间隔符号 +\captionnamefont{\zihao{-5}\heiti} %图序样式 +\captiontitlefont{\zihao{-5}\heiti} %图题样式 +\captionwidth{0.8\linewidth} %标题宽度 +\changecaptionwidth +\captionstyle{\centering} %\captionstyle{<style>} style are: \centering, \raggedleft or \raggedright +%\precaption{\rule{\linewidth}{0.4pt}\par} +%\postcaption{\vspace{-1cm}} +\setlength{\belowcaptionskip}{2pt}%设置caption上下间距 +\setlength{\abovecaptionskip}{0pt} +%\setlength{\abovelegendskip}{0pt} %设置legend上下间距 +%\setlength{\belowlegendskip}{0pt} +%新的浮动体设置,\centerline{} +\newcommand{\listegcodename}{\zihao{4}示~~例\thispagestyle{plain}}%listegcodename,新环境目录的标题 +\newcommand{\egcodename}{例}%egcodename,新环境标题的图序 +\newfloatlist{egcode}{loc}{\listegcodename}{\egcodename}%loc,写入条目的文件的扩展名 +\newfixedcaption{\codecaption}{egcode}%egcode,环境名 +\newfixedcaption{\fixtabcaption}{table}%egcode,环境名 + +%目录命令 +\setlength{\cftbeforetoctitleskip}{\baselineskip} +\setlength{\cftaftertoctitleskip}{0.5\baselineskip} +\setlength{\cftbeforeloftitleskip}{\baselineskip} +\setlength{\cftafterloftitleskip}{0.5\baselineskip} +\setlength{\cftbeforelottitleskip}{\baselineskip} +\setlength{\cftafterlottitleskip}{0.5\baselineskip} +\setlength{\cftbeforeloctitleskip}{\baselineskip} +\setlength{\cftafterloctitleskip}{0.5\baselineskip} +%\renewcommand\contentsname{\hfill 目~~ 录 \hfill \hspace{1cm}} %用这一句也是一样的。 +\renewcommand{\cfttoctitlefont}{\heiti} +\renewcommand{\cftaftertoctitle}{} +\renewcommand{\cftloftitlefont}{\heiti} +\renewcommand{\cftafterloftitle}{} +\renewcommand{\cftlottitlefont}{\heiti} +\renewcommand{\cftafterlottitle}{} +\renewcommand{\cftloctitlefont}{\heiti} +\renewcommand{\cftafterloctitle}{} +\renewcommand{\contentsname}{\zihao{4}目~~录} +\renewcommand{\listfigurename}{\zihao{4}图~~片} +\renewcommand{\listtablename}{\zihao{4}表~~格} +\renewcommand{\cftsecfont}{\zihao{5}\heiti} %条目样式 +\renewcommand{\cftsubsecfont}{\zihao{-5}\songti} %条目样式\fangsong +\renewcommand{\cftsubsubsecfont}{\zihao{-5}\kaiti} %条目样式 +\renewcommand{\cftsecpagefont}{\bfseries\zihao{5}} %页码的样式 +\renewcommand{\cftsubsecpagefont}{\bfseries\zihao{-5}} %页码的样式 +\renewcommand{\cftsubsubsecpagefont}{\bfseries\zihao{-5}} %页码的样式 +%−−−−−−−−−−设置egcode条目样式−−−−−−−−−−−−−−−−−−−−−− +%\renewcommand{\cftegcodeleader}{\leaders\hbox to 1em{\hss.\hss}\hfill} +\setlength{\cftbeforeegcodeskip}{0.1ex} %条目前的间距 +\setlength{\cftegcodeindent}{0em} %条目缩进 +\setlength{\cftegcodenumwidth}{2.5em} %条目标签宽度 +\renewcommand{\cftegcodefont}{\color{gbemphcolor}\zihao{-5}}%条目样式\fangsong +\renewcommand{\cftegcodepresnum}{例} +\renewcommand{\cftegcodeaftersnum}{ } +\renewcommand{\cftegcodeaftersnumb}{~} +%\cftsetindents{egcode}{0em}{3em} +\renewcommand{\cftegcodepagefont}{\bfseries\zihao{-5}} +%−−−−−−−−−−设置figure条目样式−−−−−−−−−−−−−−−−−−−−−− +%\newcommand{\cftfigfill}{\renewcommand{\cftdot}{$\diamond$}\cftdotfill{\cftdotsep}} +\setlength{\cftbeforefigskip}{0.1ex} %条目前的间距 +\setlength{\cftfigindent}{0em} %条目缩进 +\setlength{\cftfignumwidth}{2.5em} %条目标签宽度 +\renewcommand{\cftfigfont}{\color{gbemphcolor}\zihao{-5}} %条目样式\heiti +\renewcommand{\cftfigpresnum}{图} %条目数字前的内容 +\renewcommand{\cftfigaftersnum}{ } %条目数字后的内容 +\renewcommand{\cftfigaftersnumb}{~} %条目数字后的第二个内容 +%\renewcommand{\cftfigdotsep}{\cftdotsep} %连接符之间的宽度 +%\renewcommand{\cftfigleader}{\bfseries\cftfigfill} %连接符粘连团 +%\renewcommand{\cftfigpagefont}{\color{red}\zihao{-5}$\diamond$\itshape} %页码的样式 +%\renewcommand{\cftfigafterpnum}{\color{red}$\diamond$} %页码后内容 +\renewcommand{\cftfigpagefont}{\bfseries\zihao{-5}} %页码的样式 +%−−−−−−−−−−设置table条目样式−−−−−−−−−−−−−−−−−−−−−− +%\newcommand{\cfttabfill}{\renewcommand{\cftdot}{$\infty$}\cftdotfill{\cftdotsep}} +\setlength{\cftbeforetabskip}{0.1ex} %条目前的间距 +\setlength{\cfttabindent}{0em} %条目缩进 +\setlength{\cfttabnumwidth}{2.5em} %条目标签宽度 +\renewcommand{\cfttabfont}{\color{gbemphcolor}\zihao{-5}} %条目样式 +\renewcommand{\cfttabpresnum}{表} %条目数字前的内容 +\renewcommand{\cfttabaftersnum}{ } %条目数字后的内容 +\renewcommand{\cfttabaftersnumb}{~} %条目数字后的第二个内容 +%\renewcommand{\cfttabdotsep}{\cftdotsep} %连接符之间的宽度 +%\renewcommand{\cfttableader}{\bfseries\cfttabfill} %连接符粘连团 +%\renewcommand{\cfttabpagefont}{\color{red}\zihao{-5}$\infty$\itshape} %页码的样式 +%\renewcommand{\cfttabafterpnum}{\color{red}$\infty$} %页码后内容 +\renewcommand{\cfttabpagefont}{\bfseries\zihao{-5}} %页码的样式 + +\usepackage{pdfpages}%直接插入pdf文件页 +\graphicspath{{egfigure/}{example/}} + +%代码环境设置 +\usepackage{listings} +\usepackage{tikz,pgf} +\usetikzlibrary{calc} + +\newenvironment{example}[3][{\large\faFileCodeO}]% +{\list{}{\begingroup\codecaption{#2}\label{#3}\endgroup +\setlength{\topsep}{0pt} +\setlength{\partopsep}{0pt} +\setlength{\itemsep}{0pt} +\setlength{\parsep}{0pt} +\setlength{\leftmargin}{0pt}% +\setlength{\itemindent}{0pt}% +%\renewcommand*{\makelabel}[1]{\hss\llap{\footnotesize\color{orange}\bfseries##1}} +}\item[\footnotesize\color{gblabelcolor}\bfseries#1]\relax} +{\endlist} + +\lstnewenvironment{texlist}% +{\lstset{% general command to set parameter(s) +%name=#1, +%label=#2, +%caption=\lstname, +linewidth=\linewidth, +breaklines=true, +%showspaces=true, +extendedchars=false, +columns=fullflexible,%flexible, +aboveskip=2pt, +boxpos=t, +rulesep=0pt, +frame=tb, +framesep=0pt, +rulecolor=\color{gblabelcolor}, +fontadjust=true, +language=[LaTeX]TeX, +backgroundcolor=\color{gbyellow!3},%\color{yellow}, %背景颜色 +%numbers=left, +numberstyle=\tiny\color{gblabelcolor}, +basicstyle=\footnotesize\ttfamily, % print whole listing small +keywordstyle=\bfseries\color{gbemphcolor},%\underbar, +% underlined bold black keywords +identifierstyle=, % nothing happens +commentstyle=\color{OliveGreen}, % white comments +stringstyle=\ttfamily\color{purple!50}, % typewriter type for strings +showstringspaces=false}% no special string spaces +} +{} + +%定理环境设置 +\usepackage[listings,theorems,most]{tcolorbox} +\tcbuselibrary{breakable} +\newcounter{myprop}\def\themyprop{\arabic{myprop}} +%一个强调显示 +\newcommand{\bibliofmt}[1]{\medskip\textcolor{gbforestgreen}{\heiti#1}} + +%序号如果带章节的话可以改为比如:\thesection.\arabic{myprop} +\tcbmaketheorem{property}{方法} +{enhanced jigsaw,breakable,pad at break*=1mm,left=2em,boxsep=0pt, +%colback=gray!5,colframe=gbforestgreen, + colback=gray!5,boxrule=0pt,frame hidden,coltitle=gborange, + borderline west={1.5mm}{-2mm}{gbforestgreen}, + theorem style=plain,fonttitle=\bfseries\heiti,arc=0mm, +%separator sign={\ $\blacktriangleright$},breakable, +%theorem style=plain,fonttitle=\bfseries\upshape, fontupper=\slshape,boxrule=0mm,arc=0mm, % +%coltitle=black,colback=green!50!yellow!15!white,colframe=blue!50,% +%description delimiters={}{}, +%terminator sign={\ } +}{myprop}{pp} +%最后一个必须参数是prefix用来做label比如这里是pp:加上给出的标签名 + +\newtcbtheorem[]{refentry}{条目类型} +{breakable,pad at break*=1mm,enhanced jigsaw,left=2em,boxsep=0pt, + colback=yellow!10!white,boxrule=0pt,frame hidden, + borderline west={1.5mm}{-2mm}{gbforestgreen}, +separator sign={\ $\blacktriangleright$},terminator sign={\ }, +theorem style=plain,fonttitle=\bfseries\heiti,coltitle=gbforestgreen +%fontupper=\normalsize,boxrule=0mm,arc=0mm,breakable, +%coltitle=green!35!black,colbacktitle=green!15!white, +%colback=green!50!yellow!15!white,terminator sign={\ } +}{rfeg} +%最后一个必须参数是prefix用来做label比如这里是rfeg:加上给出的标签名 + + +%标题区命令设置 +\newcommand{\titleformanual}[1]{\def\biaotiudf{#1}} +\newcommand{\authorformanual}[1]{\def\zuozheudf{#1}} +\newcommand{\dateformanual}[1]{\def\riqiudf{#1}} +%\ifthenelse{\equal{\youwuudf}{\temp}}{true}{false} +\def\temp{} +\makeatletter +\newcommand{\titleandauthor}{ +\begin{center} +\def\@makefnmark{\hbox{\@textsuperscript{\small\@thefnmark}}} +{\setlength{\baselineskip}{40pt}\renewcommand{\thefootnote}{\fnsymbol{footnote}} +\heiti{\zihao{-2}{\biaotiudf}}\par}% +%注意这里\par要放在花括号内才有效 +\setlength{\baselineskip}{0.1cm} +\rule{0pt}{0.5cm}\par +{\renewcommand{\thefootnote}{\arabic{footnote}} +\kaishu{\zihao{4}{\zuozheudf}}\par} +\rule{0pt}{0.3cm}\par +{\songti{\zihao{-4}{\riqiudf}}\par} +\end{center} +} +\makeatother +%脚注的数字带圈使用gb7714-2015中的重定义实现 +%\renewcommand{\thefootnote}{\textcircled{\tiny\arabic{footnote}}} + + +%--------------列表环境--------------------------------------------- +\usepackage[inline]{enumitem} %重设list环境 +\setlist[enumerate]{label=\bfseries\textcolor{gbemphcolor}{(\arabic*)},topsep=2pt,partopsep=0pt,parsep=0pt,% +align=left,leftmargin=0em,itemsep=0.5em,labelwidth=0.1em,itemindent=2.6em,listparindent=2em}%label=$\triangleright$,itemindent=1em +\setlist[itemize]{topsep=2pt,partopsep=0pt,parsep=0pt,% +leftmargin=3em,itemindent=0em} +\setlist[description]{font=\bfseries\textcolor{gblabelcolor},align=right,topsep=5pt,partopsep=0pt,parsep=0pt,% +itemsep=0pt,leftmargin=0em,itemindent=0em}%注意,font或format中的最后一个命令自动提取标签为其参数 + +\usepackage{longtable} + +%自定义下划红线和背景颜色 +\usepackage{ulem} +\newcommand\yellowback{\bgroup\markoverwith +{\textcolor{yellow}{\rule[-0.5ex]{2pt}{2.5ex}}}\ULon} +\newcommand\reduline{\bgroup\markoverwith +{\textcolor{red}{\rule[-0.5ex]{2pt}{0.4pt}}}\ULon} + +%一些字符串格式化命令 +\newcommand*{\verbatimfont}{\ttfamily} +\newrobustcmd*{\cnt}[1]{\mbox{\verbatimfont#1}} +\newrobustcmd*{\bibfield}[1]{\mbox{\verbatimfont#1}} +\newrobustcmd*{\opt}[1]{\mbox{\verbatimfont#1}} +\newrobustcmd*{\prm}[1]{% + \ifblank{#1} + {} + {\mbox{% + \ensuremath\langle + \normalfont\textit{#1}% + \ensuremath\rangle}}} + +\usepackage{amssymb} + +\newcommand{\HandRight}{$\bigstar$} +\newcommand{\zhongdian}[1]{\textcolor{gbemphcolor}{\HandRight\small\heiti#1}} +\newcommand{\pz}[1]{%定义pz为旁注命令 +\marginpar[\flushright\small\youyuan\color{gbemphcolor}\footnotesize #1]{\kaiti\color{gbemphcolor}\small #1}} +\newcommand{\PZ}[1]{%定义pz为旁注命令 +\marginpar[\flushright\small\youyuan\color{gbemphcolor}\footnotesize #1]{\kaiti\color{gbemphcolor}\small #1}} +\newcommand{\qd}[1]{%定义qd为强调命令 +\begin{quote} + \fangsong\color{gbemphcolor}#1%blue!50!black\fangsong +\end{quote}} +\newcommand{\QD}[1]{%定义qd为强调命令 +\begin{quote} + \fangsong\color{gbemphcolor}#1 +\end{quote}} + +\long\def\bc#1{%定义补充信息 +{\kaiti\color{gbemphcolor}#1}} %orange,brown,purple,teal,gbblue,olive,cyan +\long\def\BC#1{%定义补充信息 +{\youyuan\color{gbemphcolor}#1}} +\newcommand{\zd}[1]{%定义补充信息 +{\kaiti\color{gbemphcolor}#1}} %orange,brown,purple,teal,gbblue,olive,cyan +\newcommand{\ZD}[1]{%定义补充信息 +{\kaiti\color{gbemphcolor}#1}} + + +\newenvironment*{marglist} +{\list{}{\setlength{\topsep}{0pt} +\setlength{\partopsep}{0pt} +\setlength{\itemsep}{0pt} +\setlength{\parsep}{0pt} +\setlength{\leftmargin}{0pt}% +\setlength{\itemindent}{0pt}% +\renewcommand*{\makelabel}[1]{\hss\llap{\footnotesize\color{orange}\bfseries##1}}}} +{\endlist} + +\makeatletter +\newcommand{\updateinfo}[2][\@empty]{% +\par\small\addvspace{2ex plus 1ex}% +\noindent{\color{gbemphcolor}\rule{\linewidth}{2pt}} +\vskip -\parskip +\ifx\@empty#1 \begin{marglist} \item #2\end{marglist} +\else \begin{marglist} \item[#1] #2\end{marglist} \fi} +\makeatother + +%\usepackage{filecontents} + +%% 问答环境参考文献 +%\NewDocumentEnvironment { reference } { } +% { +% \skip_vertical:n { 2 ex } +% \small +% \noindent \textsf{ 参考文献 } \marginpar { \raggedleft \faBook } +% \enumerate [ topsep = 0pt ] +% % \ignorespaces +% } +% { \endenumerate } +% +%\NewDocumentEnvironment { note } { } +% { +% \skip_vertical:n { 2 ex } +% \small +% \noindent \textsf{ 注意 } \marginpar { \raggedleft \faWarning } +% \par +% % \ignorespaces +% } +% { } + diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf Binary files differnew file mode 100644 index 0000000000..6da5621607 --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.tex b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.tex new file mode 100644 index 0000000000..72ec1e17c6 --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-gb7714-2015.tex @@ -0,0 +1,2342 @@ +\documentclass[11pt]{article} %用draft选项找到badbox的位置 twoside, +\input{biblatex-gb7714-2015-preamble} %宏包和一些格式设置 +\begin{document} + +\hyphenpenalty=100 %断词阈值,值越大越不容易出现断词 +\tolerance=9000 %丑度,10000为最大无溢出盒子,参考the texbook 第6章 + + +%------------------------------------------------------------ +% 标题和目录 +%------------------------------------------------------------ +\pagestyle{plain} +\pagenumbering{Roman} + +\titleformanual{符合GB/T 7714-2015标准的biblatex参考文献样式 +\footnote{This Manual was created with biblatex v\versionofbiblatex, last revised at \today;\\% +Style Files (gb7714-2015*.*) have version number: \versionofgbtstyle.} +\footnote{repository address: \url{https://github.com/hushidong/biblatex-gb7714-2015}}} + +\authorformanual{胡振震\setcounter{footnote}{0}\footnote{Email: hzzmail@163.com}} + +\dateformanual{2016-07-01} + +\titleandauthor + +\begin{quotation} +biblatex-gb7714-2015 宏包是为满足《GB/T 7714-2015~~信息与文献~~参考文献著录规则》要求而开发的 biblatex 样式包。宏包提供两种编制样式: 一、顺序编码制(gb7714-2015);二、著者-出版年制(gb7714-2015ay),能够精确地实现国标提出的著录和标注格式,且具备易用、兼容、灵活等特点,能为国内\LaTeX{}用户提供一个可靠的参考文献生成工具。 +%old: +%biblatex-gb7714-2015 样式宏包提供了符合《GB/T 7714-2015 信息与文献 参考文献 +%著录规则》要求的 biblatex 参考文献样式。分为两种编制方式: 一、顺序编码制;二、著 +%者-出版年制。配合 biblatex 宏包使用具有较高的兼容性、易用性和灵活性。宏包提供了 +%详细的使用说明,为国内用户生成符合国标的参考文献表提供帮助。 +\end{quotation} +\phantomsection +%\addcontentsline{toc}{section}{目录} +\tableofcontents +%\renewcommand{\numberline}[1]{#1~} +%\phantomsection +%\addcontentsline{toc}{section}{示例} + +\listoffigures +\listoftables +\listofegcode +\newlength{\textparwd} +%------------------------------------------------------------ + +\newpage +\pagenumbering{arabic} +\pagestyle{fancy} +\section{概述} + +《GB/T 7714-2015~~信息与文献~~参考文献著录规则》是国内科技文档参考文献著录的一般标准,国内多数大学、出版社、期刊编辑部对于学位论文、出版物、期刊论文的参考文献要求通常都基于该标准。对于\LaTeX{}用户来说,参考文献生成是典型的自动化应用,通常有两种方法,一是基于bibtex的传统方法,二是基于biblatex的新方法。生成符合GB/T 7714 标准要求的参考文献,这两条路子都已经实践多年。 +基于biblatex的方法,早期有李志奇(icetea)的gbtstyle实现以及Casper Ti. Vector的caspervector样式,然而由于biblatex宏包升级、样式包维护和完善方面的问题,未能达到精确符合国标要求、且具备高可用性、兼容性和可维护性的理想状态。开发biblatex-gb7714-2015 样式包的初衷首先是基于当时这样的状态,其次也为解决很多实际应用中的问题,因此考虑如下原则: + +\subsection{设计原则} + +\begin{enumerate} + \item 兼容性 + +由于biblatex的持续升级,一些接口和功能的变化,会使得样式无法使用或者输出结果产生异变。因此biblatex-gb7714-2015宏包设计之初,就一直秉承兼容性原则,力图兼容各版本的biblatex,希望与biblatex v2.8 (in texlive2014) 以上所有版本适配(注意 ctex 2.9.4 的用户需升级 biblatex)。 + +出于兼容一些旧的bib文件的考虑,增加对传统参考文献条目类型比如www/electronic/conference/mastersthsis/phdthsis/techreport/standard等的支持。根据国标要求,考虑增加newspaper(报纸析出的文献)、database(数据库)、dataset(数据集)、 software(软件)、map(舆图)、archive(档案)等类型。也为兼容适用于不同样式的bib数据源,增加对一些自定义域的支持,比如gbt7714宏包的bst样式中mark和medium域。此外,也试图去完善样式在不同文档类包括beamer类中的使用问题。 + + \item 易用性 + +参考文献是\LaTeX{}自动化应用之一,尽可能让其自动完成,减少用户的人工干预,包括数据的准备、格式的调整等等。因此宏包试图减少用户对于bib文件的调整,只需要简单地输入文献本身的信息,或者从各类学术网站或利用zotero等工具下载参考文献数据即可,而不需要为了符合国标格式而去手动增添参考文献类型和载体标识等一些数据域,也不必为了文献语言分集、文献排序等去增加语言、排序关键字等数据域,这些所有工作都由宏包自动完成。 + +为了符合国标要求以及中文参考文献标注习惯,提供丰富的标注(引用)命令,用户只需熟悉几个命令的特性即能够完成两种编制样式下多样的标注格式,包括:顺序编码制的 \verb|\cite|(上标可设置页码)、 \verb|\parencite|(非上标可设置页码)、 \verb|\pagescite|(上标加自动页码)、 \verb|\textcite|(提供作者为主语加非上标编号)、 \verb|\authornumcite|(提供作者为主语加上标编号)、 \verb|\footfullcite|(脚注方式);著者-年份制的\verb|\cite|(作者加年份用括号包围可设置页码)、 \verb|\pagescite|(作者加年份用括号包围自动页码)、 +\verb|\yearcite|(提供年份用括号包围)、 \verb|\yearpagescite|(提供年份用括号包围自动页码)、 +\verb|\textcite|(提供主语作者加括号包围年份)、 \verb|\footfullcite|(脚注方式)。 + +习惯natbib的用户也可以直接使用 \verb|\citet| 和 \verb|\citep| 命令, +也提供一些习惯使用的命令,比如\verb|\citetns|、\verb|\citepns|、 +\verb|\upcite|、\verb|\inlinecite|等让用户可以无缝衔接从bibtex转到biblatex。 + +另外,增加并完善对多语言混合文献表、多语言对照文献表的支持。不同语言文献可按文献自身语言录入,宏包自动识别语言并通过autolang选项自动完成语言切换,针对多语言对照文献表提供了基于条目集和关联条目概念的两种实现方式。 + + + \item 灵活性 + +在考虑实现严格符合GB/T 7714-2015标准的格式外,也希望能够针对用户的特殊格式需求,提供方便灵活的定制方式,比如通过设置选项来达到格式的变化。为此,增加了多个方面的设置选项,使用户可以根据自己的需求灵活地调整。主要包括: + +著录表排序选项: +sorting选项值(gb7714-2015支持以语言著者-出版年标题升序排列,gbnytd支持以语言著者-出版年标题降序排列,gbynta支持以语言年份作者标题升序排列,gbyntd支持以语言年份作者标题降序排列)、gblanorder 选项(可以设置不同的文种(语言)文献的排列顺序)、sortlocale 选项(可以设置本地语言的排序调整方案,比如zh\_\_pinyin支持汉字字符以拼音排序,zh\_\_stroke以笔画排序,auto/zh以unicode编码排序,zh\_\_gb2312han 以gb2312编码排序)。使用拼音排序时遇到多音字也可以利用key域解决。 + + + +著录项格式选项: +姓名格式调整(gbnamefmt选项,可以设置大写、小写、西语习惯用法、拼音习惯用法)、 +出版项控制(gbpub选项,可设置出版项缺失时是否填补信息)、类型和载体标识控制(gbtype选项,可设置不输出)、 +析出文献标识符控制(gbpunctin选项,可设置\texttt{//}不输出或其它表示形式)、 +标题超链接控制(gbtitlelink选项,可设置标题超链接)、 +作者项处理(gbnoauthor选项,可设置作者缺失时是否填补信息); + +著录表格式选项和命令: +标签对齐控制(gbalign选项,可设置左、右、居中、项对齐方式)、 +标签格式控制(gbbiblabel选项,可设置标签数字不同的包围符号)、 +条目格式控制(gbstyle选项,利用gb7714-2015ms样式可实现中英文献分设不同格式)、 +编制样式设置命令(利用\verb|\setaystylesection|和gb7714-2015mx样式实现不同文献节不同的编制方式)、 +格式命令\verb|\bibauthorfont|可设置作者项字体、 +格式命令\verb|\bibtitlefont|可设置标题项字体、 +格式命令\verb|\bibpubfont|可设置出版项字体、 +格式尺寸\verb|\bibitemindent|和\verb|\bibhang|可设置文献表的缩进、 +文献标题控制(gbctexset选项,可设置标题内容由\verb|\bibname|或\verb|\refname|宏调整); + +编码设置选项: +GBK编码兼容(gbcodegbk选项,可设置GBK编码文档编译)等等。 + +配合biblatex提供的选项、\verb|\bibfont|命令、\verb|\bibitemsep|间距等可以实现丰富的格式,包括标注和文献表采用不同样式、url/doi/isbn输出控制、标注和文献表中作者数量控制、文献表拼音或笔画排序等等。 + + + \item 可维护性 + +宏包的长期使用价值体现在宏包的维护和更新上面,追求宏包具有高的可读性、可理解性、可维护性,可为宏包长期发挥作用提供帮助。由于biblatex已经是一个相当成熟完善的宏包,即便是在样式方面考虑也相当全面,这可能与西方出版界对于参考文献的多样且细致的要求有关。而国内只有一个通用标准就是GB/T 7714标准,且除了一些特殊需求要具体实现外,标准中大多数格式要求的实现完全可以借用biblatex提供的标准样式,因此既不需要重新造轮子,也可以使gb7714-2015样式与biblatex宏包的标准样式保持一致的结构、风格和习惯,这样可以大大增加代码可读性和可维护性。通过在biblatex原有样式基础上增加有限修改的方式,并且对代码加上详细注释,可以使得样式包维护者,只需通过学习biblatex,即可轻松理解gb7714-2015样式做的工作,比如做了哪些修改,为什么这么修改,实现了什么样的效果。 + + +另外,为方便用户,样式包提供了全面、详实的说明,包括 +GB/T 7714标准的理解和解释(\ref{sec:gbt:std}节)、 +条目类型和域的理解和录入方法(\ref{sec:bib:bibtex}节)、 +参考文献引用和文献表打印及其格式控制方法(\ref{sec:cbx:usage},\ref{sec:usage:bbx}节)、 +\href{https://github.com/hushidong/biblatex-gb7714-2015/wiki}{biblatex和样式包基本使用方法}、 +\href{https://github.com/hushidong/biblatex-solution-to-latex-bibliography/blob/master/biblatex-solution-to-latex-bibliography.pdf}% +{biblatex高级使用方法和样式包设计实现方法}等,可为用户快速入门和维护者深入理解提供有效帮助。 + +\end{enumerate} + +%具体来讲,完成了4个方面的工作: +%\begin{enumerate} +% \item 完成了GB/T 7714-2015标准的完整实现,包括两种编制方式下的各类型参考文献著录格式和标注格式等基本内容,还包括: 双语文献格式,带页码的标注格式,著者年份制下仅有年的标注格式和文献按语言集中并自动排序,起止卷期自动解析,增加gbnoauthor选项控制著者年份制责任者缺省的处理,增加gbpub选项控制出版信息缺省时的处理,增加gbalign选项控制顺序编码制文献表的标签对齐方式,提供右对齐、左对齐和项对齐三种方式。 +% \item 实现了用户文献数据录入优化,用户在录入参考文献数据时,只需要录入文献的实际信息即可,不需要录入文献标识符和载体标识符,无需录入language或者其它域信息来区分中英文参考文献,实现中英文自动判断并处理。支持一些特殊或老的条目类型,比如standard,newspaper,www,mastersthesis,phdthesis等。 +% \item 实现了对biblatex不同版本的兼容,能够应用于biblatex3.2以前的老版本,也能用于3.3版姓名处理方式改变后的版本。即可以与texlive2014/2015/2016/2017配合使用,无需升级biblatex情况下直接使用biblatex-gb7714-2015宏包(即本样式)。 +% \bc{当然 ctex2.9.4 的用户可能要升级一下biblatex,因为ctex多年没有更新,其中的biblatex版本过低}。 +% \item 测试了样式文件在book/report/article文档类以及beamer类下的适用性,结果表明均能满足要求。文档详细介绍了样式文件的使用方法和注意事项,说明了各条目类型的著录格式及其在biblatex 中对应信息域的构成,以及域信息的录入方法,并严格按照GB/T 7714-2015 标准测试了各种类型的文献。 +%\end{enumerate} + +\subsection{宏包结构} + +宏包文件结构如图\ref{fig:pkg:structure}所示: +\begin{figure}[!htb] +\begin{tcolorbox}[left skip=0pt,right skip=0pt,% +width=\linewidth,colframe=gblabelcolor,colback=white,arc=0pt,% +leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt] +\centering\footnotesize +\begin{tikzpicture}[node distance=1.5cm] +%\definecolor{bluea}{rgb}{0.05,0.62,0.94} +\ttfamily +\node[align=center,fill=gbyellow!15,text width=4cm,inner sep=8pt] (project) {\textcolor{black}{Biblatex-gb7714-2015}}; + +\node[align=center,below of=project,draw=red,thick,text width=3.5cm] (manual) {\textcolor{black}{Manual of Package}}; +\node[align=center,left of=manual,xshift=-3cm,draw=blue,thick,text width=3.5cm] (style) {\textcolor{black}{Style Files}}; +\node[align=center,right of=manual,xshift=3cm,draw=orange,thick,text width=3.5cm] (script) {\textcolor{black}{Compiling Scripts}}; +\draw[color=cyan,thick] (project.south) -- (manual.north) ; +\draw[color=cyan,thick] (style.north) -- ($(style.north)+(0mm,3mm)$) ; +\draw[color=cyan,thick] (script.north) -- ($(script.north)+(0mm,3mm)$) ; +\draw[color=cyan,thick] ($(style.north)+(0mm,3mm)$) -- ($(script.north)+(0mm,3mm)$); + +\node[below of=style,fill=gbgrey!20,yshift=0.5cm,xshift=2mm,text width=2cm] (numcbbx) {\tiny \textcolor{black}{gb7715-2015.c/bbx}}; +\node[below of=numcbbx,fill=gbgrey!20,yshift=8mm,text width=2cm] (aycbbx) {\tiny \textcolor{black}{gb7715-2015ay.c/bbx}}; +\node[below of=aycbbx,fill=gbgrey!20,yshift=8mm,text width=2cm] (mscbbx) {\tiny \textcolor{black}{gb7715-2015ms.c/bbx}}; +\node[below of=mscbbx,fill=gbgrey!20,yshift=8mm,text width=2cm] (mxcbbx) {\tiny \textcolor{black}{gb7715-2015mx.c/bbx}}; +\node[below of=mxcbbx,fill=gbgrey!20,yshift=8mm,text width=2cm] (gbkdef) {\tiny \textcolor{black}{gb7715-2015-gbk.def}}; +\node[below of=gbkdef,fill=gbgrey!20,yshift=8mm,text width=2cm] (erjcbbx) {\tiny \textcolor{black}{chinese-erj.c/bbx}}; +%\node[below of=msbbx,fill=gbgrey!20,yshift=8mm,text width=2cm] (mscbx) {\tiny \textcolor{black}{gb7715-2015ms.cbx}}; + +\draw[color=blue,semithick] (numcbbx.west) -- ($(numcbbx.west)+(-3mm,0mm)$) ; +\draw[color=blue,semithick] (aycbbx.west) -- ($(aycbbx.west)+(-3mm,0mm)$) ; +\draw[color=blue,semithick] (mscbbx.west) -- ($(mscbbx.west)+(-3mm,0mm)$) ; +\draw[color=blue,semithick] (mxcbbx.west) -- ($(mxcbbx.west)+(-3mm,0mm)$) ; +\draw[color=blue,semithick] (gbkdef.west) -- ($(gbkdef.west)+(-3mm,0mm)$) ; +\draw[color=blue,semithick] (erjcbbx.west) -- ($(erjcbbx.west)+(-3mm,0mm)$) ; +%\draw[color=blue,semithick] (mscbx.west) -- ($(mscbx.west)+(-3mm,0mm)$) ; + +\draw[color=blue,semithick] ($(erjcbbx.west)+(-3mm,0mm)$) -- ($(style.center)+(-12mm,-2.5mm)$) ; + +\node[below of=manual,fill=gbsteelblue!15,yshift=0.5cm,xshift=2mm,text width=2.8cm] (mtex) {\tiny \textcolor{black}{biblatex-gb7714-2015.tex}}; +\node[below of=mtex,fill=gbsteelblue!15,yshift=8mm,text width=2.8cm] (mpdf) {\tiny \textcolor{black}{biblatex-gb7714-2015.pdf}}; +\node[below of=mpdf,fill=gbsteelblue!15,yshift=8mm,text width=2.8cm] (egtex) {\tiny \textcolor{black}{example}}; +\node[below of=egtex,fill=gbsteelblue!15,yshift=8mm,text width=2.8cm] (egbib) {\tiny \textcolor{black}{egfigure}}; +\node[below of=egbib,fill=gbsteelblue!15,yshift=8mm,text width=2.8cm] (egthesis) {\tiny \textcolor{black}{egthesis}}; +\draw[color=red,semithick] (mtex.west) -- ($(mtex.west)+(-3mm,0mm)$) ; +\draw[color=red,semithick] (mpdf.west) -- ($(mpdf.west)+(-3mm,0mm)$) ; +\draw[color=red,semithick] (egtex.west) -- ($(egtex.west)+(-3mm,0mm)$) ; +\draw[color=red,semithick] (egbib.west) -- ($(egbib.west)+(-3mm,0mm)$) ; +\draw[color=red,semithick] (egthesis.west) -- ($(egthesis.west)+(-3mm,0mm)$) ; +\draw[color=red,semithick] ($(egthesis.west)+(-3mm,0mm)$) -- ($(manual.center)+(-16mm,-2.5mm)$) ; + +\node[below of=script,fill=gbblue!10,yshift=0.5cm,xshift=2mm,text width=2cm] (cpall) {\tiny \textcolor{black}{makeall.bat/sh}}; +\node[below of=cpall,fill=gbblue!10,yshift=8mm,text width=2cm] (cpfil) {\tiny \textcolor{black}{makefile.bat/sh}}; +\node[below of=cpfil,fill=gbblue!10,yshift=8mm,text width=2cm] (cpcln) {\tiny \textcolor{black}{makeclear.bat/sh}}; +\node[below of=cpcln,fill=gbblue!10,yshift=8mm,text width=2cm] (plspt) {\tiny \textcolor{black}{gb7714text*.pl/dat}}; +\draw[color=orange,semithick] (cpall.west) -- ($(cpall.west)+(-3mm,0mm)$) ; +\draw[color=orange,semithick] (cpfil.west) -- ($(cpfil.west)+(-3mm,0mm)$) ; +\draw[color=orange,semithick] (cpcln.west) -- ($(cpcln.west)+(-3mm,0mm)$) ; +\draw[color=orange,semithick] (plspt.west) -- ($(plspt.west)+(-3mm,0mm)$) ; +\draw[color=orange,semithick] ($(plspt.west)+(-3mm,0mm)$) -- ($(plspt.west)+(-3mm,28.1mm)$) ; +\end{tikzpicture} +\end{tcolorbox} +\caption{宏包文件结构}\label{fig:pkg:structure} +\end{figure} + + + +其中,\zd{gb7714-2015.bbx/cbx}、\zd{gb7714-2015ay.bbx/cbx}分别为顺序编码制和著者年份制样式文件。 +\zd{gb7714-2015ms.bbx/cbx}是混合样式,支持区分中英文语言分设不同标准的著录格式。 +\zd{gb7714-2015mx.bbx/cbx}是混合样式,支持在不同的参考文献分节中使用不同的编制样式,比如有的节使用顺序编码制,有的节使用著者年份制。 +\zd{gb7715-2015-gbk.def}为GBK编码文档编译所需的支撑文件。 +\zd{chinese-erj.bbx/cbx} 是经济学研究期刊的文献样式。后三者仅支持较新的biblatex版本。 +\zd{biblatex-gb7714-2015.tex} 为宏包说明文档,\zd{example}目录下为各种选项的测试用例, +\zd{egfigure}目录下为说明文档中的图例文档,\zd{egthesis}为国内一些大学学位论文文献样式的测试用例,包括完全按照国标的BUPT、CAU、ECNU、FDU、SJTU、THU、USTC、XJTU、ZJU,与国标略有差异的UCAS,以及与国标有较大差异的NWAFU、SEU等。\zd{*.bat}、\zd{*.sh}分别为windows和linux下说明文档的编译脚本。\zd{*.pl}为gb7714格式著录文献表到bib文件的perl转换脚本,\zd{*.dat}为转换测试文献表。 + +\subsection{最小示例} + +基于biblatex宏包的参考文献生成方法非常简单,例 \ref{code:doc:structrue} 是一个最小工作示例。示例代码中给出了详细注释,介绍了使用biblatex 的tex源文档基本结构,其中gb7714-2015 样式随biblatex宏包加载, +参考文献数据文件example.bib(bib文件需另外准备,详见\ref{sec:bib:bibtex}节)利用 \verb|\addbibresource|加载,文献表利用 \verb|\printbibliography| 命令输出(可在正文任意位置)。所有基于 biblatex 生成参考文献的文档无论大小万变不离其宗。 +若需更全面了解biblatex及参考文献生成高级功能另可参考: +\href{https://github.com/plk/biblatex}{biblatex宏包手册} +\footnote{地址:\url{https://github.com/plk/biblatex}}、 +\href{https://github.com/hushidong/biblatex-zh-cn}{中文版} +\footnote{地址:\url{https://github.com/hushidong/biblatex-zh-cn}} +或者 +\href{https://github.com/hushidong/biblatex-solution-to-latex-bibliography}{LaTeX 文档中文参考文献的biblatex解决方案} +\footnote{地址:% +\url{https://github.com/hushidong/biblatex-solution-to-latex-bibliography}}。 + +\begin{example}{biblatex参考文献生成的最小工作示例}{code:doc:structrue} +\begin{texlist} +\documentclass{article}%文档类 %导言区开始: +\usepackage{ctex}%加载ctex宏包,中文支持 + %加载geometry宏包,定义版面 +\usepackage[left=20mm,right=20mm,top=25mm, bottom=15mm]{geometry} + %加载hyperref宏包,使用超链接 +\usepackage[colorlinks=true,pdfstartview=FitH,linkcolor=blue,anchorcolor=violet,citecolor=magenta]{hyperref} + %参考文献工具,加载biblatex宏包,,其后端backend使用biber,%标注(引用)样式citestyle,著录样式bibstyle都采用gb7714-2015样式,两者相同时可以合并为一个选项style +\usepackage[backend=biber,style=gb7714-2015]{biblatex} + %biblatex宏包的参考文献数据源加载方式 +\addbibresource[location=local]{example.bib} +\begin{document}%正文区开始: + %正文内容,引用参考文献 +详见文献\cite{Peebles2001-100-100}\parencite{Babu2014--} +另见文献\cite[49]{于潇2012-1518-1523}\parencite[106]{Babu2014--} + %打印参考文献表 +\printbibliography[heading=bibliography,title=参考文献] +\end{document} +\end{texlist} +\end{example} + + + +\subsection{编译方式} + +与基于bibtex传统方法的四步编译不同,基于biblatex生成参考文献一般只需三步编译,第一遍xelatex,第二遍biber,第三遍xelatex。如若需要后向超链接,则除设置backref 选项外,还需第四遍 xelatex 编译。例\ref{eg:compile:cmd} 给出编译命令,其中\verb|--synctex=-1| 选项也可以是-synctex=1。另外四步命令可以用一条 latexmk 命令代替。 +关于非utf-8编码文档和使用pdflatex命令编译的细节另见第\ref{sec:pkg:hints}节。 + +\begin{example}{文档编译命令}{eg:compile:cmd} +\begin{texlist} +%四步编译命令 +xelatex --synctex=-1 jobname.tex +biber jobname +xelatex --synctex=-1 jobname.tex +xelatex --synctex=-1 jobname.tex +%或采用latexmk,则仅需一条命令 +latexmk -xelatex jobname.tex +\end{texlist} +\end{example} + +前述的最小工作示例的编译结果如图\ref{fig:eg:ref}所示。 + +\begin{refsection} +\begin{figure}[!htb] +\centering +\begin{tcolorbox}[left skip=0pt,right skip=0pt,% +width=\linewidth,colframe=gblabelcolor,colback=white,arc=0pt,% +leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt] +\deflength{\textparwd}{\linewidth-1cm} +\parbox{\textparwd}{%\raggedright +\hyphenpenalty=50 %断词阈值,值越大越不容易出现断词 +\tolerance=9500 %丑度,10000为最大无溢出盒子,参考the texbook 第6章 +详见文献\cite{Peebles2001-100-100}\parencite{Babu2014--} +另见文献\cite[49]{于潇2012-1518-1523}\parencite[106]{Babu2014--} +\renewcommand{\bibfont}{\zihao{-5}} +\printbibliography[heading=subbibliography,title=参考文献] +} +\end{tcolorbox} +\caption{最小工作示例编译生成的PDF文档}\label{fig:eg:ref} +\end{figure} +\end{refsection} + + +\section{使用说明} + +\subsection{样式及选项加载} + +例\ref{code:doc:structrue}中给出了宏包和样式的基本加载方式,选项的加载也类似。比如: + +\begin{example}{顺序编码制(gb7714-2015)加载方式}{eg:gb7714numeric} +\begin{texlist} +%简单方式: +\usepackage[backend=biber,style=gb7714-2015]{biblatex} +%设置gbalign选项以改变文献表序号标签对齐方式,设置gbpub=false取消缺省出版项自填补信息,比如: +\usepackage[backend=biber,style=gb7714-2015,gbalign=gb7714-2015,gbpub=false]{biblatex} +%当文档为GBK编码且用pdflatex/latex编译时,应设置选项gbcodegbk=true: +\usepackage[backend=biber,style=gb7714-2015,gbcodegbk=true]{biblatex} +\end{texlist} +\end{example} + +\begin{example}{著者-出版年制(gb7714-2015ay)加载方式}{eg:gb7714authoryear} +\begin{texlist} +%简单方式: +\usepackage[backend=biber,style=gb7714-2015ay]{biblatex} +%设置gbnoauthor=true以使用佚名或NOAUTHOR填补缺失的author信息: +\usepackage[backend=biber,style=gb7714-2015ay,gbnoauthor=true]{biblatex} +\end{texlist} +\end{example} + +\begin{example}{同一文献表中不同语言区分著录格式的样式(gb7714-2015ms)}{eg:gb7714ms} +\begin{texlist} +%默认方式,所有文献使用一种著录格式,即GB/T 7714-2015样式 +\usepackage[backend=biber,style=gb7714-2015ms]{biblatex} +%设置gbstyle=false,则中文文献使用GB/T 7714-2015著录格式,而其它语言文献使用biblatex标准样式 +\usepackage[backend=biber,style=gb7714-2015ms,gbstyle=false]{biblatex} +\end{texlist} +\end{example} + +\begin{example}{同一文档中不同文献分节区分不同著录格式的样式(gb7714-2015mx)}{eg:gb7714mx} +\begin{texlist} +%默认方式使用顺序编码制样式 +\usepackage[backend=biber,style=gb7714-2015mx]{biblatex} +%如需在某一参考文件分节使用著者年份制样式,比如第2个refsection中使用时,则在导言区设置: +\setaystylesection{2} +\end{texlist} +\end{example} + +\begin{example}{参考文献文本转换为bib文件perl脚本使用方式}{eg:transtobib} +\begin{texlist} +perl gb7714texttobib.pl in=textfilename out=bibfilename +\end{texlist} +\end{example} + +其中,v1.0m版本增加的gb7714-2015ms样式文件,主要是为了在一个文献表中针对不同语言使用不同多种样式,比如中文文献使用GB/T 7714-2015规定的著录格式,而其它语言文献使用biblatex提供的标准样式。v1.0r版本增加了gb7714-2015mx样式,主要是为了在一个文档中针对不同参考文献分节使用不同的参考文献样式,比如某些节使用著者年份制,某些节使用顺序编码制。尽管这些方式不常用,但偶尔也有需求,所以都做了实现。另外应ddswhu要求,v1.0r版本增加了chinese-erj样式用于生成经济研究期刊的文献。且在egthesis文件夹内,针对国内一些大学的学位论文文献要求,基于国标样式做了一些定制和测试。 + +\subsubsection{新增选项}\label{sec:added:opt} +样式包新增了一些选项,用于标签对齐方式、出版项缺省处理、责任者(作者)缺省处理等功能的控制,其使用方式与biblatex宏包选项完全相同: +\begin{description} + \item[gbalign]=\textbf{right},left,center,gb7714-2015. \hfill default is right + + 为顺序编码制增加的选项,用于选择参考文献表序号标签的对齐方式。 + \begin{itemize} + \item gbalign=right,默认的list环境中的标签右对齐; + \item gbalign=left,是list环境中的标签左对齐; + \item gbalign=center,是list环境中的等宽标签,数字在[]内居中; + \item gbalign=gb7714-2015,是项对齐方式,即段落环境中标签使用原始宽度,标签与条目内容等间距。 + \end{itemize} + 该选项对著者年份制无效。顺序编码制序号标签对齐方式测试, + 数字在标签内居中见: + \href{run:./example/opt-gbalign-center.tex}{opt-gbalign-center.tex}, + 标签左对齐见: + \href{run:./example/opt-gbalign-left.tex}{opt-gbalign-left.tex}, + 项对齐(标签与内容等间距)见: + \href{run:./example/opt-gbalign-gb.tex}{opt-gbalign-gb.tex}。 + + + \item[gbpub]=\textbf{true},false. \hfill default is true + + 为控制出版信息缺失处理增加的选项。 + \begin{itemize} + \item gbpub=true,自动利用:[出版地不详]、[出版者不详]、[S.l.]、[s.n.]等填补缺省信息; + \item gbpub=false 则取消自动处理,使用标准样式的方式取消相应项的输出。 + \end{itemize} + 顺序编码制测试(著者年份制类似)见: + \href{run:./example/opt-gbpub-true.tex}{opt-gbpub-true.tex}, + \href{run:./example/opt-gbpub-false.tex}{opt-gbpub-false.tex}。 + + + \item[gbbiblabel]=\textbf{bracket},parens,plain,dot,box,circle. \hfill default is bracket + + 为顺序编码制增加的选项,用于选择参考文献表序号数字的格式。 + \begin{itemize} + \item gbbiblabel=bracket,序号数字由方括号包围,比如[1]; + \item gbbiblabel=parens,序号数字由圆括号包围,比如(1); + \item gbbiblabel=dot,序号数字数字后面加点,比如1.; + \item gbbiblabel=plain,序号数字无装饰,比如1; + \item gbbiblabel=box,序号数字由方框包围,比如\framebox{1}; + \item gbbiblabel=circle,序号数字由圆圈包围,比如\textcircled{1}。 + \end{itemize} + + \item[gbnoauthor]=true,\textbf{false}. \hfill default is false + + 为著者年份制增加的选项,用于控制责任者缺失时的处理。 + \begin{itemize} + \item gbnoauthor=false,当作者信息缺失时默认不做处理,使用标准样式的处理方式; + \item gbnoauthor=true,则根据GB/T 7714-2015 的要求进行处理,中文文献使用“佚名”来代替author,英文文献用“Anon”来代替author。 + \end{itemize} + 测试结果见: + \href{run:./example/opt-gbnoauthor-true.tex}{opt-gbnoauthor-true.tex}, + \href{run:./example/opt-gbnoauthor-false.tex}{opt-gbnoauthor-false.tex}。 + + + \item[gbnamefmt]=\textbf{uppercase},lowercase,givenahead,familyahead,pinyin. \hfill default is uppercase + + 为姓名大小写格式控制增加的选项。 + \begin{itemize} + \item gbnamefmt=uppercase,使大小写符合GB/T 7714-2015 的要求; + \item gbnamefmt=lowercase,大小写由输入信息确定不做改变; + \item gbnamefmt=givenahead,姓名的格式与biblatex标准样式的given-family格式一致,即名在前姓在后,类似于ieee的样式; + \item gbnamefmt=familyahead时,姓名的格式与biblatex 标准样式的family-given格式一致,即姓在前名在后,类似于APA 的样式; + \item gbnamefmt=pinyin 时,姓名的格式采用一种常见的中文拼音方式,比如对于 Zhao, Yu Xin 或 Yu Xin Zhao 这个姓名拼音格式化为ZHAO Yu-xin。 + \item gbnamefmt=reverseorder 时,姓名的格式与biblatex 标准样式的family-given/ given-family格式一致,常用于经济学类的文献。 + \end{itemize} + \bc{注意:还可以利用 nameformat 域为某一具体条目设置该条目的姓名格式,比如:要在一个文献表中实现英文文献是givenahead 格式,而拼音的文献是pinyin风格,那么可以设置拼音文献的 nameformat 域为pinyin,而gbnamefmt设置为givenahead。条目中nameformat 域的局部设置优先于gbnamefmt的全局设置。}\par + \emph{注意:使用pinyin选项时,bib文件中文献的作者应给出完整的名而不是缩写,否则出来的效果未必令人满意}。 + 测试结果见: + \href{run:./example/opt-gbnamefmt.tex}{opt-gbnamefmt.tex}, + \href{run:./example/opt-gbnamefmt-default.tex}{opt-gbnamefmt-default.tex}。 + + + \item[gbtype]=\textbf{true},false. \hfill default is true + + 为控制是否输出题名后面的文献类型和载体标识符而增加的选项。 + \begin{itemize} + \item gbtype=true,根据GB/T 7714-2015 要求输出标识符,例如“在线的期刊析出文献题名[J/OL]”。 + \item gbtype=false,则不输出标识符,例如“在线的期刊析出文献题名”。 + \end{itemize} + + \item[gbfieldtype]=true,\textbf{false}. \hfill default is false + + 为控制是否输出type域而增加的选项。 + \begin{itemize} + \item gbfieldtype=true,输出type域,例如学位论文的phdthesis或博士学位论文。输出该域时做中英文区分。 + \item gbfieldtype=false,不输出type域。 + + 要设置博士或硕士学位论文的输出,有两种途径: 一是设置本地化字符串: \\ + \lstinline!\DefineBibliographyStrings{english}{mathesis={str you want ma thesis}}!, \\ + \lstinline!\DefineBibliographyStrings{english}{mathesiscn={硕士学位论文}}!, \\ + \lstinline!\DefineBibliographyStrings{english}{phdthesis={str you want for phd thesis}}!, \\ + \lstinline!\DefineBibliographyStrings{english}{phdthesiscn={博士学位论文}}!, \\ + 之所以用加cn的本地化字符串是为了适应某些样式对中英文文献的区别设置。 + + 二是设置type域,比如在bib文件直接设置需要输出的字符,比如type=\{[博士学位论文]\}。 + + \end{itemize} + + + \item[gbpunctin]=\textbf{true},false. \hfill default is true + + 为控制inbook,incollection,inproceedings中析出来源文献前的\texttt{//}符号而增加的选项。 + \begin{itemize} + \item gbpunctin=true,根据GB/T 7714-2015 要求输出\texttt{//}。 + \item gbpunctin=false,则输出默认的本地字符串, + 在英语中是\texttt{in:},若要完全去掉该符号则可以在导言区增加命令 + \lstinline!\DefineBibliographyStrings{english}{in={}}!,\lstinline!\DefineBibliographyStrings{english}{incn={}}!。 + 之所以用加cn的本地化字符串是为了适应某些样式对中英文文献的区别设置。 + \end{itemize} + + \item[gbctexset]=\textbf{true},false. \hfill default is true + + 为控制参考文献标题内容的设置方式增加的选项。 + \begin{itemize} + \item gbctexset=true,参考文献标题内容可以通过重定义 bibname 或 refname 宏设置。比如利用ctex宏包进行设置: + \lstinline[breaklines]!\ctexset{bibname={title you want}}! + \item gbctexset=false,参考文献标题内容可以通过重定义本地字符串设置,比如: + + \lstinline[breaklines=true]!\DefineBibliographyStrings{english}{bibliography={title you want}}! + + \lstinline[breaklines=true]!\DefineBibliographyStrings{english}{references={title you want}}!。 + \end{itemize} + 当然除此之外,利用 printbibliography 命令的 title 选项进行设置依然是最有效方式,比如: + \lstinline[breaklines=true]!\printbibliography[title=title you want]!。 + + + \item[gbcodegbk]=true,\textbf{false}. \hfill default is false + + 为兼容GBK编码的文档增加的选项。 + \begin{itemize} + \item gbcodegbk=false,即默认是utf-8编码的文档。 + \item gbcodegbk=true,为利用pdflatex/latex编译GBK编码文档时使用。 + \end{itemize} + 当在源文档前面增加 XeTeX 原语:\lstinline!\XeTeXinputencoding "GBK"! 后,GBK编码的文档也可以使用xelatex编译,这时应设置为false或不给出该选项。测试文件见: + \href{run:example/codeopt-gbcodegbk.tex}{codeopt-gbcodegbk.tex}。 + + \item[gbstrict]=\textbf{true},false. \hfill default is true + + 为避免输出bib文件中多余的域信息而增加选项,目的是为了兼容一些bib文件,因为某些bst样式文件进行中英文判断需要在bib文件中增加类似language这样的域作为支撑,而其中某些域在标准的biblatex样式文件中是默认输出的。 + \begin{itemize} + \item gbstrict=true,即默认不输出。 + \item gbstrict=false,需要还原标准样式的输出情况时使用。 + \end{itemize} + + + \item[gbfieldstd]=true,\textbf{false}. \hfill default is false + + 为控制一些域如标题,网址,卷域的格式而增加选项。目的是使用一些标准样式的处理来增加格式多样性。 + \begin{itemize} + \item gbfieldstd=false,即默认使用GB/T 7714-2015要求的样式。 + \item gbfieldstd=true,即还原使用标准样式的格式,比如使用引号,字体,加引导词等。当然要调整这些格式也可采用biblatex提供的更为直接的设置域格式的方式。 + \end{itemize} + + + \item[gbtitlelink]=true,\textbf{false}. \hfill default is false + + 为设置标题的超链接增加的选项。 + \begin{itemize} + \item gbtitlelink=false,即默认不给标题设置超链接。 + \item gbtitlelink=true,当文献存在url 域时为文献标题设置超链接。 + \end{itemize} + 测试文件见: + \href{run:example/opt-gbtitlelink.tex}{opt-gbtitlelink.tex}。 + + \item[gbstyle]=\textbf{true},false. \hfill default is true + + 为实现多种样式并存而增加的选项。 + \begin{itemize} + \item gbstyle=true,即默认全部文献使用gb7714-2015样式。 + \item gbstyle=false,仅中文文献使用gb7714-2015样式,其它语言文献使用biblatex默认样式。 + \end{itemize} + + 该选项的实现原理是把所有国标格式设置局部化到每一条文献打印时,处理时首先判断gbstyle 选项及文献的语言,当满足要求则使用这些局部化格式,否则使用默认的标准样式。这种实现为一篇文档内实现两种样式提供解决思路,尽管目前非中文语言文献的著录格式是标准样式,但只要对标准样式做进一步的修改就可以形成符合某种格式规范的样式,比如像ieee,nature等的样式。因此存在中文使用GB/T 7714-2015 著录格式,而英文文献使用ieee等著录格式的可能性。测试文档见:\href{run:./example/opt-gbstyle.tex}{opt-gbstyle.tex}。 + + \item[gblocal]=\textbf{gb7714-2015},chinese,english. \hfill default is gb7714-2015 + \item[gbcitelocal]=\textbf{gb7714-2015},chinese,english. \hfill default is gb7714-2015 + \item[gbbiblocal]=\textbf{gb7714-2015},chinese,english. \hfill default is gb7714-2015 + + 为设置引用标注标签和文献表中的本地化字符串而增加的选项。其中gbcitelocal 用于控制标注中的本地化字符串,而gbbiblocal用于控制文献表中的本地化字符串,gblocal选项等价于同时设置gbcitelocal 和 gbbiblocal。 + 配合\lstinline[breaklines=true]!\DefineBibliographyStrings!命令对本地化字符串进行设置可以实现一些特殊的效果。图\ref{fig:content:fmtc}就是该选项的一个使用示例。 + \begin{itemize} + \item gblocal=gb7714-2015,即默认区分中英文,不同语言采用不同的字符串比如中文使用“等”“和”,而英文使用“et al.”“and”。 + \item gblocal=chinese,强制设置所有的本地化字符串使用中文。 + \item gblocal=english,强制设置所有的本地化字符串使用英文。 + \end{itemize} + 测试文件见: + \href{run:egfigure/egcontentfmtc.tex}{egcontentfmtc.tex}。 + + + \item[gbfootbib]=true,\textbf{false}. \hfill default is false + + 为实现国标样式的脚注文献表格式而增加的选项。 + \begin{itemize} + \item gbfootbib=true,即默认做处理使脚注文献表满足国标要求。 + \item gbfootbib=false,不做任何附加处理。 + \end{itemize} + + 该选项的实现主要是两个方面: + + 一是实现国标要求的脚注标签和段落格式,利用对 + \verb|\@makefnmark|重定义实现正文脚注标签带圈上标, + 利用对\verb|\@makefntext|做patch局部化重设\verb|\@makefnmark|使得脚注中的标签不上标,利用对latex核心代码和hyperref宏包代码的重定义实现悬挂缩进的格式。 + + 二是实现国标要求的相同文献不输出内容,而是用标签代替,比如同\textcircled{4} ,主要利用citetracker 选项实现对文献引用的追踪,然后利用ifciteseen 判断和对footfullcite 命令做修改实现。 + 测试文档见:\href{run:./example/opt-gbfootbib.tex}{opt-gbfootbib.tex}。 + + 同时为了方便脚注的对齐格式控制增加了两个尺寸:\verb|\footbibmargin|和\verb|\footbiblabelsep|,分别表示脚注文本的左侧缩进距离和悬挂的脚注标记标签与脚注文本的间隔距离,默认分别是1em和0.5em。如果要修改悬挂对齐为其它对齐方式,那么需要重定义\verb|\@makefntext|宏,目前悬挂对齐的实现方式见bbx文件。比如示例中重定义这两个尺寸为2em 和1em: + + {\small + \vspace{1ex} + \centering + \fbox{ + \setlength{\footbibmargin}{2em}%脚注的段落左侧缩进距离 + \setlength{\footbiblabelsep}{1em}%脚注中标记号与脚注段落的间距 + \begin{minipage}{0.75\linewidth} + 脚注\footnote{中文脚注中文脚注中文脚注中文脚注中文脚注中文脚注中文脚注中文脚注中文脚注中文脚注} + 脚注\footnote{English footnote English footnote English footnote English footnote English footnote} + \end{minipage}} + \vspace{1ex} + + } + + + 需要注意的是,由于图表标题(caption)环境的特殊性,在其中使用footfullcite可能无法得到正常的脚注文献表。而通常的方法是利用footnotemark和footnotetext来实现脚注,对于文献表也是类似的,因此也不能简单使用footfullcite命令,而是要使用footnotemark和footnotetext以及fullcite命令配合来实现, 比如: + + \begin{example}{图表标题中产生的脚注文献表}{eg:footbib:incaption} + \begin{texlist} + \begin{figure}[h] + \centering + \fbox{abc} + \caption{示意图见文献\protect\footnotemark} + \end{figure} + + \footnotetext{\fullcite{bibtex-key}} + \end{texlist} + \end{example} + + 但要注意由于hyperref本身的原因,这种方式产生的脚注文献表可能没有超链接功能。 + 对于表格环境中的引用无法产生脚注文献表的问题,可以将其置于小页环境中实现或者采用前述图标标题中的类似处理方式。 + 注意:latex核心代码参考latex.ltx,而hyperref代码参考hyperref.STY。 + + + \item[gbfnperpage]=true,\textbf{false}. \hfill default is false + + 为脚注计数器根据页码更新而增加的选项。 + \begin{itemize} + \item gbfnperpage=true,每页更新脚注编号,即根据page计数器重设footnote计数器。 + \item gbfnperpage=false,不根据页码重设脚注计数器。 + \end{itemize} + + 注意,若要让脚注计数器与其它计数器比如chapter等关联,那么采用latex的常规方法就能解决,比如使用latex内核常用的\verb|\@addtoreset|命令。 + + + \item[mergedate]=true,false,none. + + 为著者年份制是否在文献表中作者后面输出日期信息而增加了选项值none。 + \begin{itemize} + \item mergedate=true,著者年份制文献表仅在作者后输出日期 + \item mergedate=false,著者年份制文献表在作者后和出版项中输出日期 + \item mergedate=none,著者年份制文献表仅在出版项中输出日期。该选项用于满足中科院大学的著者年份制格式要求。 + \item no mergedate,即不给出该选项,这是gb7714-2015ay默认的情况,仅在作者后输出日期且已经根据国标格式化。 + \end{itemize} + + \item[gblanorder]=\textbf{chineseahead},englishahead,userdefinedstr like:cn;en;ru;fr;jp;kr . \hfill default is chineseahead + + 为著者年份制文献不同文种分集排序而增加的选项。 + \begin{itemize} + \item gblanorder=chineseahead,即默认做中文文献在前英文文献在后的排序,各语言顺序为: cn;jp;kr;en;fr;ru。 + \item gblanorder=englishahead,做英文在前中文文献在后的排序,各语言顺序为: en;fr;ru;cn;jp;kr。 + \item gblanorder=自定义字符串,比如cn;en;ru;fr;jp;kr。这是一个用分号分隔的语言缩写名构成的字符串,缩写名的前后顺序代表文献表中文种分集的顺序。 + \end{itemize} + + 测试文档见:\href{run:./example/opt-gblanorder.tex}{opt-gblanorder.tex}。 + + \item[gbannote]=true,\textbf{false}. \hfill default is false + + 为控制是否在文献条目后面输出由annotation或annote域提供的注释信息而增加的选项。 + \begin{itemize} + \item gbannote=false,即默认不输出。 + \item gbannote=true,输出注释信息。 + \end{itemize} + + 测试文档见:\href{run:./example/opt-gbannote.tex}{opt-gbannote.tex}。 + +\end{description} + + +\subsubsection{兼容的标准选项}\label{sec:old:opt} +绝大部分biblatex标准样式选项可与gb7714-2015样式联合使用,下面给出一些经过兼容性测试的选项说明。需要注意的是:使用gb7714-2015样式时(即style=gb7714-2015),backend选择应指定为biber,还有一些选项已经在样式设计中固定,如果要严格使用国标样式,一般不应做修改,比如sorting,maxnames,minnames,date,useprefix,giveninits等,但如果用户有自己的其它需求,则可按需修改。 + +\begin{description} + \item[url]=true, false. \hfill default: true + + 该选项控制是否打印 url 域并获取日期。该选项只影响 url 信息是可选的那些条目类型。而 @online 条目的 url 域总是会打印出来。它是导言区选项,与样式相关,gb7714-2015样式做了特别支持,可以兼容使用。 + + \item[giveninits]=true, false. \hfill default: true + + 启用该选项时姓名中的名部分会用首字母表示。 + + \item[uniquelist]=true, false, minyear \hfill default: minyear + + 该选项用于著者-出版年制样式,用于正文中引用(标注)标签的作者列表控制(目的是消除歧义)。当uniquelist=true时,自动利用扩展作者姓名列表长度的方式消除labelname 列表的歧义; 当=false 时则禁用扩展,标签仅使用一个作者,消除歧义通过跟在年份后面的字母实现; 默认使用minyear,即当被截短的作者姓名列表存在歧义时,只有当年份相同,才会扩展列表长度以消除歧义。 + + 注意当使用uniquelist=false后标签只有一个作者,但文中可能有同姓作者的文献,这时根据uniquename选项的设置,biblatex会使用姓名的其它部分比如名来消除歧义,但如果想强制要求仅用姓作为文中的标注标签,那么可以设置uniquename=false,但此时标注是可能存在歧义的。 + + \item[maxnames]=整数 \hfill default: 3 + + 影响所有名称列表(\bibfield{author}、\bibfield{editor} 等)的阈值。如果某个列表超过了该阈值,即,它包含的姓名数量超过 \prm{integer},那么就会根据 \opt{minnames} 选项的设置进行自动截断。\opt{maxnames} 是设置 \opt{maxbibnames} 和 \opt{maxcitenames} 两个选项的支配选项。 + + \item[minnames]=整数 \hfill default: 3 + + 影响所有名称列表(\bibfield{author}、\bibfield{editor} 等)的限制值。如果某个列表包含的姓名数量超过 \prm{integer},那么就会自动截断至\opt{minnames}个姓名。\prm{minnames} 的值必须小于或等于 \prm{maxnames}。\opt{minnames} 是设置 \opt{minbibnames} 和 \opt{mincitenames} 两个选项的支配选项。 + + \item[maxbibnames]=整数 \hfill default: \prm{maxnames} + + 类似于 \opt{maxnames} 但只影响参考文献表。 + + \item[minbibnames]=整数 \hfill default: \prm{minnames} + + 类似于 \opt{minnames} 但只影响参考文献表。 + + \item[maxcitenames]=整数 \hfill default: \prm{maxnames} + + 类似于 \opt{maxnames} 但只影响正文中的标注(引用)。 + + \item[mincitenames]=整数 \hfill default: \prm{minnames} + + 类似于 \opt{minnames} 但只影响正文中的标注(引用)。 + + \item[hyperref]=true, false, auto. \hfill default: auto + + 是否将引用和后向引用转化为可点击的超链接。这是宏包的载入时选项,与样式无关,自然可以使用。 + + \item[backref]=true, false. \hfill default: false + + 是否在文献中打印出反向引用。这是宏包的载入时选项,与样式无关,自然可以使用。 + + \item[refsection]=none, part, chapter, section, subsection. \hfill default: none + + 该选项自动在文档分段处(例如一章或一节)开始一个新的参考文献分节。是宏包的载入时选项,与样式无关,自然可以使用。需要注意与titlesec宏包联用时,该选项会失效。 + + \item[refsegment]=none, part, chapter, section, subsection. \hfill default: none + + 类似于refsection选项,但开始的是一个新的参考文献片段。 + + \item[citereset]=none, part, chapter, section, subsection. \hfill default: none + + 该选项在文档分段处(例如一章或一节)自动执行citereset 命令。 + + \item[labeldate]=year, short, long, terse, comp, ymd, iso. \hfill default: year + + 类似于 date 选项,但控制的是由DeclareLabeldate 选择的日期域的格式。 + + \item[doi]=true,false. \hfill default: true + + 该选项控制是否打印 \bibfield{doi} 域。 + + \item[isbn]=true,false. \hfill default: true + + 该选项控制是否打印 \bibfield{isbn}\slash \bibfield{issn}\slash \bibfield{isrn} 等域。 + + \item[sortlocale]=auto, locale. \hfill default: auto + + 该选项控制排序的本地化调整方案。对于英文文献,该选项不需要设置。对于中文文献当有按拼音或笔划等进行排序的需求时,可以设置相应的本地化调整方案。主要的调整方案有: + \begin{itemize} + \item \verb|sortlocale=auto| 或者不设置该选项,为unicode编码顺序 + \item \verb|sortlocale=zh|,为unicode编码顺序 + \item \verb|sortlocale=zh__pinyin|,为拼音顺序 + \item \verb|sortlocale=zh__big5han|,为big5 编码顺序 + \item \verb|sortlocale=zh__gb2312han|,为GB-2312 顺序 + \item \verb|sortlocale=zh__stroke|,为笔划数顺序 + \item \verb|sortlocale=zh__zhuyin|,为注音顺序 + \end{itemize} + + \item[language]=autobib, autocite, auto, \prm{language}. \hfill default: autobib + + 详细说明见biblatex手册。 + + \item[autolang]=none, hyphen, other, other*, \prm{langname}. \hfill default: + + 结合langid/langidopts域,结合babel/polyglossia宏包,可以对西文做基于条目的本地化处理。详细说明见biblatex 手册。 + + \item[sortcites]=true, false. \hfill default: false + + 详细说明见biblatex手册。 + + \item[autocite]=plain, inline, footnote, superscript. \hfill default: plain + + 详细说明见biblatex手册。 + + \item[block]=none, space, par, nbpar, ragged. \hfill default: none + + 详细说明见biblatex手册。 + + \item[indexing]=true, false, cite, bib. \hfill default: false + + 详细说明见biblatex手册。 + + \item[其它]=下面还有很多选项,有些是宏包载入时选项,与样式无关,一般可以使用,但笔者没有做测试,各位用户可以测试使用。选项的作用可以参考biblatex 使用手册,以及文博与笔者翻译的中文版。 + \begin{itemize} + \item related=true, false. default: true + \item defernumbers=true, false default: false + \item maxitems=integer default: 3 + \item minitems=integer default: 1 + \item autopunct=true, false default: true + \item clearlang=true, false default: true + \item notetype=foot+end, footonly, endonly default: foot+end + \item backrefstyle=none, three, two, two+, three+, all+ default: three + \item backrefsetstyle=setonly, memonly, setormem, setandmem, memandset, setplusmem default: setonly + \item loadfiles=true, false default: false + \item abbreviate=true, false default: true + \item julian=true, false default: false + \item punctfont=true, false default: false + \item arxiv=abs, ps, pdf, format default: abs + \item mincrossrefs=integer default: 2 + \item minxrefs=integer default: 2 + \item eprint=true, false default: true + \end{itemize} + +\end{description} + + +\subsection{文献引用及标注格式}\label{sec:cbx:usage} + +要生成参考文献,第一步就是在正文中引用参考文献。正文中因引用文献所形成的标注的格式称为参考文献标注样式,也称引用样式或引用标签样式,分为两类: 顺序编码制和著者-出版年(作者年)制。引用文献的基本命令是\verb|\cite|,但为了在一篇文档中实现不同的标签效果,通常还需要使用其它命令, +比如\verb|\parencite|, \verb|\textcite|, \verb|\pagescite|,\verb|\footfullcite|等。此外为遵循biblatex对于复数形式标注命令的使用习惯,也提供上述命令的复数形式,比如\verb|\cite|命令的复数形式命令\verb|\cites|,便于输出单个文献的页码等前后注信息。 + +熟悉natbib的用户也可以直接使用使用\verb|\citet|, \verb|\citep|命令。 +另外也可以使用一些习惯命令比如\verb|\citetns|、\verb|\citepns|、 +\verb|\upcite|、\verb|\inlinecite|等。 + +\subsubsection{两种编制的标注格式} + +%顺序编码制的标注样式文件大体使用标准引用样式numeric-comp的内容 +\paragraph{\heiti 顺序编码制的标注样式} +为满足GB/T 7714-2015第10.1节的要求,考虑\verb|\cite| 命令为上标模式,\verb|\parencite|保留非上标模式。增加 \verb|\pagescite| 命令,用于输出上标顺序编号并自动加页码。 +为使用户免于输入文献作者,完善了\verb|\textcite|命令,提供作者为句子主语,并附带行内非上标的顺序编码, +并增加了\verb|\authornumcite|命令,以输出作者作为句子主语,并附带上标的顺序编码。 +增加了\verb|\citec|命令,输出另一种形式的编码压缩标签,比如\textsuperscript{[2]-[4]}区别于一般的\textsuperscript{[2-4]}。 + +其它命令\verb|\citet|、\verb|\citep|、\verb|\citetns|、\verb|\citepns|、 +\verb|\upcite|、\verb|\inlinecite|分别等价于 +\verb|\authornumcite|、\verb|\cite|、\verb|\textcite|、\verb|\parencite|、 +\verb|\cite|、\verb|\parencite|。 + +上述命令均可在{bibtexkey}前面的[]内或第二个[]内(当有两个[]时),指定页码用于输出。若不指定页码,则仅有\verb|\pagescite|命令默认提取参考文献的页码信息进行输出。 +各引用命令的使用方式如表\ref{tab:cite:num}所示。 +测试文档见\href{run:example/testallformat.tex}{testallformat.tex}。 + +%各命令使用方式如例\ref{eg:citefornumeric}所示。 +%各引用命令的效果如图\ref{fig:cite:num}所示。 + +\qd{对于一个引用命令中同时给出多个文献bibtexkey的压缩形式,页码只会应用到最后一个参考文献后面,这是不正确的,但这种情况其实本不应出现,因为指定页码本来就需要具体化指向某一文献。使用时请尽可能使用 +\textbackslash pagescite\{key1\}\textbackslash pagescite\{key2\}这种形式 +而不是\textbackslash pagescite\{key1,key2\}|。当然除了多次使用标注命令外,也可以使用对应标注命令的复数形式来为每篇文献提供相应的页码信息。} + + +%著者-出版年制的标注样式文件大体使用标准引用样式authoryear的内容。 +\paragraph{\heiti 著者-出版年制的标注样式} +为满足GB/T 7714-2015第10.2节的要求, +考虑\verb|\cite|和\verb|\parencite|命令将引用标签用圆括号括起来。增加了\verb|\pagescite|命令,用于自动加页码。增加了\verb|\yearpagescite|, \verb|\yearcite|命令用于处理文中已有作者信息只需要年份和页码的情况(为兼容性考虑,顺序编码制也给出该命令,但作用与 +\verb|\pagescite| 命令相同),也完善了 \verb|\textcite| 命令,提供作者为句子主语,并附带行内非上标的页码,增加了\verb|\authornumcite|命令,以输出作者作为句子主语,并附带上标的页码。 + +其它命令\verb|\citet|、\verb|\citep|、\verb|\citetns|、\verb|\citepns|、 +\verb|\upcite|、\verb|\inlinecite|分别等价于 +\verb|\authornumcite|、\verb|\cite|、\verb|\textcite|、\verb|\parencite|、 +\verb|\cite|、\verb|\parencite|。 + +%各命令使用方式如例\ref{eg:citeforauthoryear}所示。 +%各引用命令的效果如图\ref{fig:cite:ay}所示。 +各引用命令的使用方式如表\ref{tab:cite:authoryear}所示。 +测试文档见\href{run:example/testallformat.tex}{testallformat.tex}。 + +%\begin{table}[!htb] +\noindent\begin{minipage}{0.95\linewidth} +\begin{refsection} +\centering +\fixtabcaption{顺序编码制常用命令示例}\label{tab:cite:num} +\footnotesize +\begin{tabular}{l@{\quad$\Rightarrow$\quad}ll} +\hline +\heiti{命令} & \heiti{标注标签} & \heiti{说明} \\ \hline + \verb|\cite{Peebles2001-100-100}| & \cite{Peebles2001-100-100} & 不带页码上标 \\ + \verb|\upcite{Peebles2001-100-100}| & \upcite{Peebles2001-100-100} & 不带页码上标 \\ + \verb|\supercite{Peebles2001-100-100}| & \supercite{Peebles2001-100-100} & 不带页码上标 \\ + \verb|\parencite{Miroslav2004--}| & \parencite{Miroslav2004--} & 不带页码非上标 \\ + \verb|\cite[49]{蔡敏2006--}| & \cite[49]{蔡敏2006--} & 带页码上标 \\ + \verb|\pagescite{Peebles2001-100-100}| & \pagescite{Peebles2001-100-100} & 自动页码上标 \\ + \verb|\pagescite[150]{Peebles2001-100-100}| & \pagescite[150]{Peebles2001-100-100} & 带页码的上标 \\ + \verb|\parencite[49]{Miroslav2004--}| & \parencite[49]{Miroslav2004--} & 带页码非上标 \\ + \verb|\textcite{Miroslav2004--}| & \textcite{Miroslav2004--} & 提供主语非上标标签 \\ + \verb|\authornumcite{Miroslav2004--}| & \authornumcite{Miroslav2004--} & 提供主语上标标签 \\ + \verb|\citeauthor{蔡敏2006--}\cite{蔡敏2006--}| & \citeauthor{蔡敏2006--}\cite{蔡敏2006--} & 提供主语上标标签 \\ + \verb|\footfullcite{赵学功2001--}| & \footfullcite{赵学功2001--} & 脚注方式文献条目 \\ + 引用单篇文献: & 文献\cite{Peebles2001-100-100} & 国标示例 \\ + 同一处引用两篇文献: & 文献\cite{Peebles2001-100-100,Miroslav2004--} & 国标示例\\ + 同一处引用多篇文献: & 文献\cite{蔡敏2006--,Miroslav2004--,赵学功2001--} & 国标示例:三篇以上压缩\\ + 同一处引用多篇文献: & 文献\citec{蔡敏2006--,Miroslav2004--,赵学功2001--} & 另一种形式的压缩\\ + 多次引用同一作者的同一文献: & + 文献\cite[20-22]{Miroslav2004--}, + 文献\cite[55-60]{Miroslav2004--} & 国标示例 \\ + 多次引用同一作者的同一文献: & + 文献\footfullcite[20-22]{Miroslav2004--}, + 文献\footfullcite[55-60]{Miroslav2004--} & 国标示例:脚注方式 \\ \hline +\end{tabular} +\end{refsection} +\end{minipage} +%\end{table} + + + + + +\begin{table}[!htb] +\centering +\caption{著者年份制常用命令示例}\label{tab:cite:authoryear} +\hspace{-1cm}{\parbox{\linewidth}{\includegraphics[scale=0.95]{egciteaytab.pdf}}} +\end{table} + + +%\begin{example}{著者-出版年制引用命令}{eg:citeforauthoryear} +%\begin{texlist} +%不带页码的引用: +% \cite{Peebles2001-100-100} \parencite{Miroslav2004--} +%带页码的引用: +% \cite[49]{蔡敏2006--} \parencite[见][49页]{Miroslav2004--} +% \pagescite{Peebles2001-100-100}\pagescite[150]{Peebles2001-100-100} +% \pagescite[][201-301]{Peebles2001-100-100} +%著者-出版年制文中已有作者只需给出年份和页码的引用: +% 见赵学功\yearpagescite[][205]{赵学功2001--}和Miroslav\yearpagescite[][15]{Miroslav2004--} +%著者-出版年制文中已有作者只需给出年份的引用,三种方式: +% 见赵学功\yearcite{赵学功2001--} +% 见赵学功(\cite*{赵学功2001--}) +% 见赵学功(\citeyear{赵学功2001--})\par +%著者-出版年制文中无作者需要标注命令给出作者作为主语的引用: +% 见\textcite{赵学功2001--}\par +%在页脚中引用和打印文献表: +% \footnote{在脚注中引用\footcite{赵学功2001--}} \footfullcite{赵学功2001--} +% \end{texlist} +%\end{example} + +%\begin{figure}[!htb] +%\begin{tcolorbox}[left skip=0pt,right skip=0pt,% +%width=\linewidth,colframe=gblabelcolor,colback=white,arc=0pt,% +%leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt] +%\centering +%\deflength{\textparwd}{\linewidth-1cm} +%\parbox{\textparwd}{ +%\includegraphics{egciteay.pdf} +%} +%\end{tcolorbox} +%\caption{著者-出版年制标注格式}\label{fig:cite:ay} +%\end{figure} + +\subsubsection{标注格式局部调整} + +标注在同一个文档中是可能存在不同格式需求的,比如:有的地方需要用上标,有的地方需要用行内,有的地方需要给出作者,有的地方需要给出页码等。一般情况下,不同标注格式可以通过使用不同的标注命令来得到,比如上一小节给出的大量不同的命令,不同命令能够产生独特的标注标签。 + +除了利用命令来调整标注格式外,还有更多的方法来进行局部格式调整。这利用了tex的编组特性,编组内的局部格式不影响编组外的格式,所以可以利用编组内的局部设置来调整标注的格式,类似的,文献表的著录格式也是可以局部调整的,见下一节。 + +引用文献所产生标注标签的格式包括很多内容,包括作者数量,标点,本地化字符串等。最常见的局部调整需求是标点和本地化字符串。这里以双语图题中的引用标签的不同本地化字符串需求为例来展示局部调整的方法。 + +在中科院某类学位论文中,正文的标注标签要求两个英文作者之间用和而不是and连接,多个英文作者截断成一个作者时后面用等.而不是et al.表示。这可以容易通过设置本地化字符串来实现。然而对于双语的图题,英文图题中的出现等与和这样的字符实在不雅,所以又要求在这种全英文的环境中将和与等.更换为英文的表示符号,这就需要利用本地化字符串的局部调整。这种本地化字符串的局部调整其实已经是比较深入的内容,因为biblatex提供的接口DefineBibliographyStrings是全局的设置,如何进行局部调整并没有非常方便的接口,要解决这一需求,需要对biblatex以及gb7714-2015样式有比较深入的了解。 + +因为gb7714-2015通过gbcitelocalcase计数器来选择使用中文或英文的本地化字符串,因此通过局部设置gbcitelocalcase可以局部的选择不同语言的本地化字符串,然而因为本地化字符串的内容通常是全局设置的,所以当中文的或者英文的本地化字符串设置都不满足要求时,就需要局部的调整本地化字符串的内容,如\ref{eg:str:localset}所示,对本地化字符串andothersincite的内容做了调整,从全局设置的等.转换为et al.,和转换为and,这种局部设置是通过csdef对保存字符串信息的命令直接做的调整。比如\verb|\csdef{abx@sstr@andothersincite}{et al.}|就是将andothersincite本地化字符串的内容临时调整为et al.。 + +为方便用户使用,提供了 +\verb|\setlocalbibstring|命令来替代上述直接定义的csdef命令,比如: +\verb|\setlocalbibstring{andothersincite}{et al.}|,等价于与前面csdef那条命令。 +另外,如果要在本地化字符串的内容设置中使用biblatex提供的一些标点命令,比如adddot等,那么需要对其进行保护,避免直接展开导致命令未定义的错误,比如: +\verb|\setlocalbibstring{andothersincite}{et al\protect\adddot}| + +具体的测试见\href{egthesis/thesis-ucas-m.tex}{thesis-ucas-m.tex} + + \begin{example}{双语图题内的标注标签的本地化字符串局部设置}{eg:str:localset} + \begin{texlist} +\begin{figure}[!htbp] + \centering + \fbox{\parbox{5cm}{example fig\\在双语图题中强制使用某种语言的方式}} + \bicaption{中文图题具体见{\cite{walls2013drought}\cite{betts2005aging}}} + {English fig title See{\setlocalbibstring{andothersincite}{et al\protect\adddot}\setlocalbibstring{andincite}{and}\cite{walls2013drought} + \cite{betts2005aging}}}\label{fig:bi:lang} +\end{figure} + \end{texlist} + \end{example} + + + + + + + +\subsection{文献表输出及著录格式}\label{sec:usage:bbx} + +引用文献后,可以在文档需要的位置利用 \verb|\printbibliography| 命令输出文献表。文献表的输出格式称为参考文献著录样式,也称著录表样式或著录格式,也分两类: 顺序编码制和著者-出版年制(作者年制)。 + +%顺序编码制的参考文献样式基于标准样式numeric-comp/numeric +\paragraph{\heiti 顺序编码制样式} 中各条参考文献条目以数字序号按引用先后顺序组织。 +著录格式中序号格式见\ref{sec:bib:serialno}节, +各类型文献条目的著录格式见\ref{sec:numeric:data}节, +参考文献条目中各信息域及其录入方式见\ref{sec:bib:bibtex}节。 + +%著者-出版年制的参考文献样式则基于标准样式authoryear +\paragraph{\heiti 著者-出版年制样式} 中各条参考文献条目以作者-年为标签以一定的顺序排列。著者-出版年制的著录格式与顺序编码制基本相同,差别仅在于把年份提前到作者后面作为条目的标签。数据源bib文件中各条目的数据录入与顺序编码制完全一致。 + +\qd{著者-出版年制有文献按文种集中的要求,因此gb7714-2015ay样式设计了gblanorder选项来配合专用的排序模板,可以方便地设置不同文种的先后顺序,默认文种顺序是中日韩英法俄。如需其他顺序则可利用gblanorder选项重设,设置方法见第\ref{sec:added:opt}节。此外,由于排序需要根据文献所使用的语言判断,因此使用language域,该域由biblatex-gb7714-2015宏包自动判断处理,一般不需过多关注,如果当语言判断出现问题,可以在bib文件中手动设置language域为正确的语言,比如chinese,japanese,english,french等。} + +%前一段为20190331更新 +%\qd{著者-出版年制有分文种文献集中的要求,因此gb7714-2015排序模板以nyt模板为基础,增加 language 作为 name 前的排序域。默认情况下,本样式文件将标题(或作者)为中文的文献的 language 域设置成 chinese,英文的设置成 english。这一设置过程,在biber 处理时自动完成。当出现问题或者有更多文种分集且有特殊顺序时,可以在bib文件中为相应文种文献的 language 域手动设置适合排序的字符串。比如: 中文文献设置为 chinese,英文文献设置为 enlish,法文文献设置为 french,那么排序中,相应的中文文献排在最前面,英文文献在中间,法文文献最后,因为升序情况下字母顺序是c然后e然后f。} + +%上一段2016-1114更新,下面是以前的说法。 +%\qd{根据文种文献集中的要求,修改了nyt排序格式,增加了userb作为name前的排序域,当有需求进行多文种分集且有特殊顺序时,在bib文件中给相应文种的文献设置适合排序的字符串。比如中文文献设置为cn,英文文献设置为en,法文文献设置为fr,那么排序中,相应的中文文献排在最前面,英文文献在中间,法文文献最后,因为升序情况下字母顺序是c然后e然后f。} + +打印出的文献表主要有两个部分的格式需要控制,一是文献表的段落格式,二是文献表中各条文献的著录格式: + +\subsubsection{段落格式控制} + +\paragraph{\heiti 文献表字体、颜色、间距、缩进控制} 为方便用户改变文献表段落格式、内容字体和颜色等,在 biblatex 提供的 \verb|\bibfont| 命令基础上, +增加了\verb|\bibauthorfont|、\verb|\bibtitlefont|、\verb|\bibpubfont| 等命令用于控制文献不同部分的格式,比如作者,标题,出版项等。 +增加了尺寸\verb|\bibitemindent| 用于控制参考文献条目在文献表中的缩进, +其意义与 list 环境中 \verb|\itemindent| 相同。 +用法具体见例\ref{eg:biblist:fontset},结果如图\ref{fig:par:fmt}所示。 +测试用例见\href{run:example/testfontinbiblio.tex}{testfontinbiblio.tex}。 + +\begin{example}{文献表段落格式、字体、颜色、间距控制}{eg:biblist:fontset} +\begin{texlist} +% 换行的控制 + % 选项 block=none , space , par , nbpar , ragged + % 或\renewcommand*{\newblockpunct}{\par\nobreak} +% 字体的控制:\textit,sl,emph-楷体,\textbf,sf-黑体,\texttt-仿宋,\textsc,md,up-宋体 + % 全局字体 +\renewcommand{\bibfont}{\zihao{-5}}%\fangsong + % 题名字体 +\renewcommand{\bibauthorfont}{\bfseries\color{teal}}% +\renewcommand{\bibtitlefont}{\ttfamily\color{blue}}% +\renewcommand{\bibpubfont}{\itshape\color{violet}}% + % url和doi字体 +\def\UrlFont{\ttfamily} %\urlstyle{sf} %\def\UrlFont{\bfseries} + +% 间距的控制 +\setlength{\bibitemsep}{0ex}\setlength{\bibnamesep}{0ex}\setlength{\bibinitsep}{0ex} +% 文献表中各条文献的缩进控制 +%\setlength{\bibitemindent}{0em} % bibitemindent表示一条文献中第一行相对后面各行的缩进 +%\setlength{\bibhang}{0pt} % 著者-出版年制中 bibhang 表示的各行起始位置到页边的距离,顺序编码制中 bibhang+labelnumberwidth 表示各行起始位置到页边的距离 + +% 标点类型的控制(全局字体能控制标点的字体) +\end{texlist} +\end{example} + +\begin{figure}[!htb] +\begin{tcolorbox}[left skip=0pt,right skip=0pt,% +width=\linewidth,colframe=gblabelcolor,colback=white,arc=0pt,% +leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt] +\centering +\deflength{\textparwd}{\linewidth-1cm} +\includegraphics[width=\textparwd]{egparfmt.pdf} +\end{tcolorbox} +\caption{文献表段落格式示例}\label{fig:par:fmt} +\end{figure} + +\subsubsection{条目著录格式控制}\label{sec:entry:fmt} + +文献表输出的格式即参考文献著录样式,除了整体的段落格式外,还有条目内部的格式可以控制,条目内部的这些项称为著录项,这些著录项的格式通常可由选项控制。可用选项除了biblatex 提供的标准选项外,也包括样式包提供的选项。 +图\ref{fig:content:fmta}、\ref{fig:content:fmtb}、\ref{fig:content:fmtc}给出了一些选项设置后的格式控制效果, +更多选项的详细说明见第\ref{sec:added:opt}、\ref{sec:old:opt}小节。 + +图\ref{fig:content:fmta}给出了选项设置为 style=gb7714-2015, gbnamefmt=givenahead, +gbpub=false, gbbiblabel=dot, gbtitlelink=true 时的文献表,可以看到作者姓名、序号标签、标题超链接的设置。 + +\begin{figure}[!htb] +\begin{tcolorbox}[left skip=0pt,right skip=0pt,% +width=\linewidth,colframe=gblabelcolor,colback=white,arc=0pt,% +leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt] +\centering +\deflength{\textparwd}{\linewidth-1cm} +\includegraphics[width=\textparwd]{egcontentfmt.pdf} +\end{tcolorbox} +\caption{文献表条目著录格式示例一}\label{fig:content:fmta} +\end{figure} + +图\ref{fig:content:fmtb}给出了选项设置为 style=gb7714-2015ms, gbnamefmt=lowercase, +gbpub=false, gbtitlelink=true, gbstyle=false, sorting=nyt 时的文献表,可以看到作者姓名、标题超链接、中英文不同文献格式、文献排序的设置。 + +\begin{figure}[!htb] +\begin{tcolorbox}[left skip=0pt,right skip=0pt,% +width=\linewidth,colframe=gblabelcolor,colback=white,arc=0pt,% +leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt] +\centering +\deflength{\textparwd}{\linewidth-1cm} +\includegraphics[width=\textparwd]{egcontentfmtb.pdf} +\end{tcolorbox} +\caption{文献表条目著录格式示例二}\label{fig:content:fmtb} +\end{figure} + +图\ref{fig:content:fmtc}为选项和本地化字符串如例\ref{eg:localstr:diff}设置时的引用标注和文献表,注意其中引用标注和文献表中的不同本地化字符串输出效果,引用标注中英文作者和中文作者缩略词的不同。这是中科院大学资环类学位论文的要求格式,可以看到尽管有些特殊,但通过选项设置和本地化字符串设置也能实现。 + +\begin{example}{著者-出版年制标注和文献表不同本地字符串效果}{eg:localstr:diff} +\begin{texlist} +\usepackage[backend=biber,style=gb7714-2015ay,gbnamefmt=lowercase,maxcitenames=2,mincitenames=1, +sortcites=false,sorting=gbynta]{biblatex} + \renewcommand{\bibauthorfont}{\color{violet}}% +\DefineBibliographyStrings{english}{ + andincite = {和}, + andincitecn = {和}, + andothersincite = {等{\adddot}},%adddot才能避开标点追踪 + andothersincitecn = {等}, } +\end{texlist} +\end{example} + + +\begin{figure}[!htb] +\begin{tcolorbox}[left skip=0pt,right skip=0pt,% +width=\linewidth,colframe=gblabelcolor,colback=white,arc=0pt,% +leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt] +\centering +\deflength{\textparwd}{\linewidth-1cm} +\includegraphics[width=\textparwd]{egcontentfmtc.pdf} +\end{tcolorbox} +\caption{文献表条目著录格式示例三}\label{fig:content:fmtc} +\end{figure} + +\subsubsection{著录格式局部调整}\label{sec:entry:fmtlocal} + +得益于biblatex利用tex宏控制著录格式的特点,加上tex语言本身编组的局部化特性,所以在利用biblatex生成参考文献的过程中可以有丰富手段,来进行参考文献著录格式的局部调整。也正因为局部的格式调整,因此通常局部格式都是结合refsection或者refsegment来操作的。前面提到过的一个很简单的例子,当在学位论文的写作中需要正文部分的参考文献使用顺序编码制,而附录中研究成果部分使用作者年制这样的需求就是一个典型的局部化格式调整。这一问题的解决方式为在研究成果部分使用一个refsection将其局部化,并结合gb7714-2015mx样式,并利用setaystylesection命令设置该refsection为作者年制样式。 + +因为tex宏的局部化调整特性,因此几乎biblatex中所有格式设置都是可以做局部调整的,限于篇幅,这里仅介绍一些常见的简单的调整方式: + +\begin{enumerate} + \item 文献表标题 + + 局部重定义bibname、refname或者局部重设printbibliography命令的选项可以设置文献表标题。 + + \item 文献表段落格式 + + 局部重定义bibfont命令即可局部设置参考文献的字体颜色等,进一步重定义bibauthorfont、bibtitlefont、bibpubfont 等命令用于控制文献不同著录项的格式。 + + 局部重定义bibitemindent 尺寸可以设置文献表的缩进 + + 局部重定义bibitemsep、bibnamesep、bibinitsep可以设置文献表的各条目的间距 + + \item 文献表条目著录格式 + + biblatex中绝大部分的控制选项都是使用toggle的方式,比如url选项,gbtype选项,gbannote选项等,因此在局部设置选项对应的toggle 值可以局部设置选项控制的格式。 + 另外也有一些选项使用的是计数器,比如gbnamefmt选项,因此局部设置选项对应的计数器的值可以局部设置选项控制的格式。 + 当然由于一些选项的特殊性,它无法简单的进行利用toggle值或计数器值进行设置,而可能需要调整选项对应的宏的内容,因此复杂度会明显提升,如果不是非常必要,建议不要去局部化重设这些选项的所对应的格式。 + + 示例见\href{run:./example/opt-gbannote.tex}{opt-gbannote.tex}。 + + \item 文献表条目中域或标点的格式 + + biblatex中域和标点的格式设置其实是比较简单的,且设置命令不限制一定要在导言区中,因此做局部化调整也是合适的。比如在一个refsection中需要将期刊文献的volume域的格式设置为粗体,那么可以做设置为: + + \begin{example}{域格式的局部调整示例}{eg:bib:fieldsetlocal} + \begin{texlist} + \DeclareFieldFormat[article,periodical]{volume}{\textbf{#1}}% volume of a journal + \end{texlist} + \end{example} + +\end{enumerate} + +实施上格式的局部调整和全局调整本质上是一致的,文献样式中几乎所有格式设置,都可以做局部化处理。当然做全面的样式设计会稍微往深里去一点,考虑的问题也会更多,但局部格式调整是可以借鉴的,关于样式中的格式设置和说明请参考: +\href{https://github.com/hushidong/biblatex-solution-to-latex-bibliography/blob/master/biblatex-solution-to-latex-bibliography.pdf}% +{biblatex高级使用方法和样式包设计实现方法}。 + + + + + + +\subsection{文献表排序与调整} + +\subsubsection{国标要求的排序方式} + +排序是文献表格式的重要内容。国标的两种编制方式中,顺序编码制要求文献表中的文献按照正文中文献引用的先后顺序进行排序,而著者-出版年制则要求文献表首先按照文种对不同语言的文献进行分组,中文在前英文在后,分组内的中文文献则以拼音或笔画进行排序,而西文文献则按照字母顺序进行排列。在gb7714-2015国标样式中两种编制方式的排序分别以如下选项设置来实现: + +\begin{example}{两种编制方式的排序设置}{eg:bib:sorting} +\begin{texlist} +%顺序编码制: +sorting=none + +%著者-出版年制: +sorting=gb7714-2015,gblanorder=chineseahead,sortlocale=zh__pinyin +\end{texlist} +\end{example} + +这些设置是样式的默认设置,用户如果没有其他需求则无需调整,若需调整详见下一节。 + +\subsubsection{排序的逻辑和调整方法} + +文献表中文献的排序通常是由处理bib文件的后端程序实施的,比如bibtex或biber程序。通常biblatex选择biber作为后端程序来实现更灵活的排序机制。biber在处理过程中读取bib文件信息并根据biblatex宏包和文献样式在bcf文件中输出设置信息执行排序。而bibtex程序则在读取bib文件后根据bst样式进行排序,尽管可以让bibtex读入特殊格式bib文件来提供一些设置参数,但总的来说基于bibtex的文献排序是由bst样式决定的。而biber程序则是提供了一套工具,具体的排序方式是由biblatex宏包和样式文件中的设置决定的,biber根据这些设置执行特定的逻辑来实现排序。 + +biblatex通过sorting选项选择排序模板来进行排序,而排序模板是可以自定义的。 +gb7714-2015ay样式提供了gblanorder选项来选择文种的排列顺序,其本质是对排序模板中与语言相关的域进行设置,因此它是与sorting选项选择的排序模板密切相关的,biblatex提供的标准样式排序模板并不支持该选项。 +而sortlocale选项则是针对字符排序选择本地化调整方案,比如选项zh\_\_pinyin就是选择针对中文字符根据拼音进行排序。本地化调整方案是由perl模块提供,中文字符排序的可用选项值详见前面的sortlocale选项说明。需要注意的是本地化字符排序调整方案设置也可以通过biber命令行选项提供,biblatex设置和biber命令行设置两种方式见例\ref{eg:sort:opts}、例\ref{eg:sort:bibercmd}。 + +\begin{example}{中文字符排序调整可利用biblatex选项}{eg:sort:opts} +\begin{texlist} +%按拼音排序,biblatex加载选项 +\usepackage[backend=biber,style=gb7714-2015ay,sortlocale=zh__pinyin]{biblatex} +%按笔画排序,biblatex加载选项 +\usepackage[backend=biber,style=gb7714-2015ay,sortlocale=zh__stroke]{biblatex}% +%此时,biber则正常编译不需手动加选项,因为排序调整方案(sort tailoring)已由biblatex 给出。 +biber jobname +\end{texlist} +\end{example} + +\begin{example}{中文字符排序调整也可利用biber选项}{eg:sort:bibercmd} +\begin{texlist} +%biblatex正常加载,即不设置排序的本地化调整方案 +\usepackage[backend=biber,style=gb7714-2015ay]{biblatex} + +%此时需利用biber选项给出本地化排序调整方案: +%按拼音排序,则设置-l zh__pinyin +biber -l zh__pinyin jobname +%按笔画排序,则设置-l zh__pinyin +biber -l zh__stroke jobname +\end{texlist} +\end{example} + +对于sorting选项,biblatex提供了标准的排序模板包括: + +\begin{description} + \item[nty] 按照姓名、标题、年份排序。 + \item[nyt] 按照姓名、年份、标题排序。 + \item[nyvt] 按照姓名、年份、卷数、标题排序。 + \item[anyt] 按照字母标签、姓名、年份、标题排序。 + \item[anyvt] 按照字母标签、姓名、年份、卷数、标题排序。 + \item[ynt] 按照年份、姓名、标题排序。 + \item[ydnt] 按照年份(降序)、姓名、标题排序。 + \item[none] 不进行排序。所有的条目按照引用顺序处理。 +\end{description} + +而gb7741-2015ay样式提供了4个排序模板: + +\begin{description} + \item[gb7714-2015] 以语言、作者、年份、标题、升序排列 + \item[gbnytd] 以语言、作者、年份、标题、降序排列 + \item[gbynta] 以语言、年份、作者、标题、升序排列 + \item[gbyntd] 以语言、年份、作者、标题、降序排列 +\end{description} + +在使用gb7714-2015ay样式时可以使用上述排序模板。用户也可以增加自定义模板,比如为了处理多音字的问题,用户可以手动设置key域用来对中文文献进行排序,定义如下的排序模板: + +\begin{example}{针对多音字问题的排序模板}{eg:sort:multipinyin} +\begin{texlist} +\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} + } + } +\end{texlist} +\end{example} + +其中,排序模板优先使用persort域进行排序,接着是与文种相关的lansortorder域,接着是sortkey域(该域在biblatex中就是key域的别名),接着是sortname等作者姓名相关的域,要让文献根据多音字习惯音进行排序,那么就在key域中设置文献作者姓名的习惯音。比如三篇文献作者分别是[李四]、[J. B. Conway]、[曾三]。在设置sorting=multipinyin, gblanorder=chineseahead, sortlocale=zh\_\_pinyin的情况下,根据上述的multipinyin排序模板,首先根据文种和作者信息将中文文献[曾三][李四]排在前面,接着是[J. B. Conway],因为默认情况下,曾字考虑的读音是ceng2。但若对key域手动设置中文的拼音,比如[李四]文献设置key=\{li3si4\},而[曾三]文献设置key=\{zeng1san1\},那么中文文献仍然排在前面,但根据key域的设置会将[李四]文献排列在[曾三]前面。因此手动设置作者姓名的习惯拼音后,文献排列顺序为:[李四][曾三][J. B. Conway]。 + +其中,与文种相关的排序域lansortorder是由gblanorder选项设置的,当选项值为chineseahead时,语言顺序为cn;jp;kr;en;fr;ru,会将中文文献的lansortorder域设置为1,日语文献设置为2,韩语文献设置为3,英文文献设置为4,法语文献设置为5,俄语文献设置为6。排序过程中按升序排序,那么自然中文文献在前英文文献在后。若对gblanorder选择设置一个自定义的字符串如:cn;en;ru;fr;jp;kr,那么文种的排列顺序为中文、英文、俄语、法语、日语、韩语。 + +根据上述的排序逻辑可知,要做排序的调整首先可以考虑合理地设置选项,来选择合适的排序模板、文种顺序和本地化字符排序调整方案。当不满足要求时,可以自定义排序模板,并设置sorting选项为该模板,来实现用户需要的排序方式。 + + +\subsection{多语言支持} + + +\subsubsection{多语言混合文献表}\label{sec:multilan:combine} + +在国内的一般应用场景下,常见的多语言混合文献表是中英两种语言混合的文献表,但有时也可能会存在多种语言,比如存在中/英/日/俄等多种语言。图\ref{fig:multi:lan}给出了这样一个示例,其中不同语言的文献使用了不同的本地化字符串。 + +\begin{figure}[!htb] +\begin{tcolorbox}[left skip=0pt,right skip=0pt,% +width=\linewidth,colframe=gblabelcolor,colback=white,arc=0pt,% +leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt] +\centering +\deflength{\textparwd}{\linewidth-1cm} +\includegraphics[width=\textparwd]{egmultilan.pdf} +\end{tcolorbox} +\caption{多语言混合文献表}\label{fig:multi:lan} +\end{figure} + +\begin{enumerate} +\item 多语言混合文献表首先要解决的是多语言文献的字符显示问题。使用xelatex编译时,由于其原生支持unicode的特性,在tex文档内显示多语言字符比较容易实现,正确显示的关键在于合适的字体设置。一般情况下西文如英/法/俄可以利用fontspec宏包选择合适的字体来解决,而中/日/韩语可以利用ctex宏包可以解决,但仍需注意要正确的显示中/日/韩语也需要字体支持,windows下常见的中文字体可能不支持日/韩字符,而思源宋体是一个不错的选择。本文的多语言示例编译均采用思源宋体常规(SourceHanSerifSC-Regular.otf), +请从其\href{https://github.com/adobe-fonts/source-han-serif/tree/release}{官网}下载。 + +\item 除此之外,还要解决另外一个重要问题是本地化字符串问题。因为对于不同语言的文献,通常要求使用符合自身语言规范的本地化字符串。而且不同的语言,本地化字符串并不是一一对应的,特别是东亚语言,因此要考虑一个全面的解决方案: + +对于西方语言, biblatex基于 babel/polyglossia宏包,结合autolang/language等选项和langid/langidopt等域,提供了一套多语言解决方案。 + +\begin{itemize} +\item 首先,对不同语言的文献,设置langid域为文献所用语言,比如英文文献则设置langid域等于english,俄文文献则设置等于rassian。 + +\item 其次,在biblatex加载时设置 autolang选项,等于none则不做多语言处理,等于hyphen则仅做不同语言的断词处理,等于other或other*则处理不同语言的断词和本地化字符串,other*选项等价于使用babel的otherlanguage*环境,与other的差别在于不忽略环境后的空白。从实践看,当要使用条目集时,使用other*选项更为合适。 + +\item 再次,还可设置language选项,用于区分是否在标注或文献表中采用多语言处理方案。当language选项等于autobib时仅在文献表中自动切换语言,等于 autocite 时仅在标注中自动切换语言,等于 auto 时则在文献表和标注中同时切换。 + +\item 最后,需要在tex文档内加入babel宏包或polyglossia,并设置需要使用的语言。注意:需要使用本地化字符串的西语都要加入,否则无法自动切换。比如需要自动切换的西文语言有英文、法文和俄文, +那么需要将加入\verb|french,russian,english|。如例\ref{eg:multi:lanset}所示: + +\begin{example}{babel/polyglossia设置西方语言的多语言支持}{eg:multi:lanset} +\begin{texlist} + %使用babel的方式 + \usepackage[russian,french,english]{babel} + + %使用polyglossia的方式 + \usepackage{polyglossia} + \setdefaultlanguage{english} + \setotherlanguages{russian,french} +\end{texlist} +\end{example} + +\end{itemize} + +对于东亚语言,通常没有像西方语言那么多的本地化字符串的应用,只有有限几个字符串需要使用,而且习惯用法也与西文不同,因此无法与西文的本地化字符串一一对应,所以考虑的解决思路也不同于西文。即不使用类似西文的本地化字符串文件,而直接利用在英文本地化文件(english.lbx)基础上新增适用于东亚语言的本地化字符串的方式。在标注和著录格式处理过程中,根据当前处理的域或条目的语言做判断,然后使用对应语言的本地化字符串。如第\ref{sec:usage:bbx}节所述,本样式使用language域来标记文献的语言类型,langid域用来标记文献对应的本地化字符串文件,默认情况下都不需要人工输入,可由宏包根据文献信息自动判断,但也可以人工输入来指定。 + +\end{enumerate} + +因此考虑东亚语言的特殊性,针对西文和东亚语言,整体解决方案做如下: +\begin{itemize} + \item 如俄语/法语这样的西方语言,通过biblatex提供的方案自动解决。使用时,bib文件中的文献数据按文献本身的语言录入,在tex源文件中载入babel宏包并设置相应语言,然后设置biblatex的autolang和language选项。剩下所有工作比如自动语言判断和处理则交由gb7714-2015样式自动完成。 + + \item 日韩语采用类似中文的方式处理,即在英语本地化文件基础上通过增加新的本地化字符串实现处理,因此langid需设为english。在输出本地化字符串的宏中当做英文处理,但内部存在区分逻辑,当判断语言为中文时,则使用中文的本地化字符串比如andcn,andotherscn等, 当不是时,则判断不同的语言,是日文则输出本地化字符串如andjp,andothersjp,若是韩文则输出本地化字符串如andkr,andotherskr。而所有其它西文则输出本地化字符串比如and,andothers,由babel自动切换成对应语言的字符串。由于日文中作者这类信息通常用的汉字,因此常常判断为中文,所以可以使用符合中文习惯的字符串,但如果对日文有精确的判断,那么可以输出符合日文习惯的字符串。韩语由于大量使用表音的字符,所以通常使用专门的本地化字符串。中日韩语文献数据录入也不要特殊的处理,按文献本身语言输入即可,剩下所有其它工作均由gb7714-2015样式自动处理,用户无需过多关注。 + +\end{itemize} + +本样式对中日韩英俄法六种语言混合文献表做了测试,详见: +\href{run:example/opt-eg-multilan.tex}{opt-eg-multilan}, +\href{run:example/opt-autolang-multilan.tex}{opt-autolang-multilan}。 + + +\subsubsection{多语言对照的文献表}\label{sec:multilan:implement} + +国标GB/T 7714-2015有不同语言对照文献的要求(详见第6.1节),某些期刊也有类似的需求。 +多语言对照的文献表首先是多语言混合的文献表,所以本节的方法是在前一节基础上做的。 +对于biblatex宏包,多语言对照文献问题可以通过条目集类型(set)/或者条目关联(related)来解决,由于多语言对照的情况与双语言对照本质是一样的,因此下面主要讨论双语对照的情况。 +图\ref{fig:double:lana}和\ref{fig:double:lanb}给出中英双语对照文献示例,两个示例中英文文献的作者姓名做了不同的设置,前者为 gbnamefmt=uppercase,后者为gbnamefmt=pinyin,后者也是国内某期刊的参考文献样式。 +GB中的韩中两种语言对照文献见\href{run:./stdGBT7714-2015.pdf}{stdGBT7714-2015文件}第4页。 + +\begin{figure}[!htb] +\begin{tcolorbox}[left skip=0pt,right skip=0pt,% +width=\linewidth,colframe=gblabelcolor,colback=white,arc=0pt,% +leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt] +\centering +\deflength{\textparwd}{\linewidth-1cm} +\includegraphics[width=\textparwd]{egdoublelan.pdf} +\end{tcolorbox} +\caption{双语言对照文献表示例一}\label{fig:double:lana} +\end{figure} + +\begin{figure}[!htb] +\begin{tcolorbox}[left skip=0pt,right skip=0pt,% +width=\linewidth,colframe=gblabelcolor,colback=white,arc=0pt,% +leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt] +\centering +\deflength{\textparwd}{\linewidth-1cm} +\includegraphics[width=\textparwd]{egdoublelanb.pdf} +\end{tcolorbox} +\caption{双语言对照文献表示例二}\label{fig:double:lanb} +\end{figure} + +\paragraph{\heiti 利用条目集类型满足双语文献要求} + +设置条目集类型(set)有静态和动态两种方法。其中动态方法使用更为方便,只需在写文档时利用\verb|\defbibentryset|将两条文献不同语言的文献设置成一个set条目,然后引用set的bibtex键。比如: +\begin{example}{设置set条目集用于双语文献的动态方法}{eg:setforbilangentry} +\begin{texlist} +\defbibentryset{bilangyi2013}{易仕和2013--,Yi2013--} +专著,双语文献引用\cite{bilangyi2013} +\end{texlist} +\end{example} + +测试见文档\href{run:example/testallformat.tex}{testallformat.tex}。 + +\bc{需要注意:由于biblatex的升级,在著者-出版年制中应用动态条目集方法产生的标注标签存在版本差异。 +biblatex v3.7及之前版本,因为 set 带有第一个子条目的信息,所以会自动输出子条目信息作为标签。 +而biblatex v3.8及以上版本中,因为set条目类型除了子条目关键词信息外,并无其他信息,所以set的标注标签会存在问题。这个问题可以通过设置一个指定格式和内容且中间无空格无英文逗号的关键字来弥补,比如“易仕和,等,2013”,这时因为没有空格和英文逗号,该关键字会以一个整体字符串处理,而不会被分开解析,因此可以用它来作为标签}。比如: + +\begin{example}{设置set条目集用于双语文献动态方法}{eg:setforbilangentry} +\begin{texlist} +\defbibentryset{易仕和,等,2013}{易仕和2013--,Yi2013--} +专著,双语文献引用\cite{易仕和,等,2013} +\end{texlist} +\end{example} + +\bc{在biblatex3.8以上版本中,例{eg:setforbilangentry}的作者年制标注标签会是“易仕和,等,2013”,注意到其中的逗号是中文全角逗号,与其它标签的英文逗号的存在差异,正因为此,该方法并没有完美解决问题。} + +\bc{由于顺序编码制使用的时数字标签,前述的问题对于顺序编码制并不存在。而作者年制中的标签问题,可以采用下面的静态条目集方法和关联(related)方法来解决。} + +静态方法是在bib源文件中给出条目集(set)并使用biber后端进行解析,条目的域信息定义方法如下: + +%当使用bibtex后端时,则需要进一步设置,具体参考biblatex宏包说明文档。 +\begin{example}{设置set条目集用于双语文献的静态方法}{eg:set:static} +\begin{texlist} +@Set{set1, +entryset = {key1,key2,key3}, +} +%如果要达到上例动态设置set一样的结果,在bib文件中静态设置set条目如下: +@Set{bilangyi2013, +entryset = {易仕和2013--,Yi2013--}, +} +\end{texlist} +\end{example} + +然而例\ref{eg:set:static}这般简单的静态条目集设置,还存在两个小的问题: +\begin{enumerate} + \item 中文排序会出现问题,条目集会出现在文献表末尾,这是因为条目集没有设置language域用于排序,而其它常规条目都会利用动态数据修改设置language域,但因为静态条目集需要在biber运行时解析,所以无法对language域进行处理。而使用动态条目集方法则没有这一问题,因为其解析过程直接会利用第一个子条目的排序信息。 + \item 著者-出版年制中的标注标签问题,对于静态条目集,v3.8以上版本的biblatex同样不复制第一个子条目信息,因此著者- 出版年制中的引用也无法生成正确的标注标签,这也就是前面动态条目集方法中提到的问题 +\end{enumerate} + +但静态条目集方法有自己的解决方便,对于第一个问题,可以通过在set条目中手动设置language域来解决;第二个问题,也可以通过在set条目中手动设置label域来解决。比如: + +\begin{example}{在bib文件中正确设置set条目集的静态方法}{eg:set:staticright} +\begin{texlist} +%在bib文件中静态设置set条目如下,其中: +%手动设置userb域用于解决排序问题 +%手动设置label域用于解决标注标签问题 +@Set{bilangyi2013, +entryset = {易仕和2013--,Yi2013--}, +label={易仕和, 等, 2013}, +language={chinese} +} +\end{texlist} +\end{example} + +\bc{注意:由于动态set条目集设置等价于使用了 nocite命令,因此只要定义了动态条目集的文献都会出现在文献表中,因此如果不引用相应的文献,那么无需对其定义动态条目集}。 + +\bc{注意:biblatex提供的mcite模块提供了mcite类命令,其等价于定义动态条目集,因此除了使用上述defbibentryset方法外,也可以使用mcite类命令}。 + +\bc{注意:条目集方法本质上是将多个文献条目集合成一个组一起在文献表中输出,且仅有一个标注标签。无论是否是多语言对照都是可以使用的,这里的多语言对照实现只是条目集方法的一个具体应用}。 + +\paragraph{\heiti 利用条目关联满足双语文献要求} + +除上述给出的条目集方案外,关联条目方法则是另一种可行方案\footnote{Again about the \@ set label for authoryear style:\url{https://github.com/plk/biblatex/issues/681}}。该方案同样也有静态和动态两种方法,静态就是直接修改bib文件的内容,动态则是在tex源文档中做设置,然后通过biblatex的动态数据修改机制做临时修改。 + +静态方法很简单,bib文件中条目设置如例\ref{eg:related:staticright}所示,它能解决双语同时显示的问题,也能解决排序和标注标签问题,唯一的问题在于修改了bib文件后,当不需要双语文献时还需改回来,这会带来不便,因此可以考虑下面的动态方法。但要注意动态方法需要利用多个\verb|\DeclareStyleSourcemap|,因此该方法只适用于biblatex v3.7及以上版本。 + +\begin{example}{在bib文件中正确设置关联条目的静态方法}{eg:related:staticright} +\begin{texlist} +%在bib文件中静态设置条目如下,注意: +%易仕和2013--条目中增加了related域用于关联其对应的英文条目Yi2013-- +@Book{易仕和2013--, + Title = {超声速和高超声速喷管设计}, + Address = {北京}, + Author = {易仕和 and 赵玉新 and 何霖 and 张敏莉}, + Publisher = {国防工业出版社}, + Year = {2013} + related = {Yi2013--} +} +@Book{Yi2013--, + Title = {Supersonic and hypersonic nozzle design}, + Address = {BeiJing}, + Author = {Yi, S H and Zhao, Y X and He, L and Zhang, M L}, + Publisher = {National Defense Industry Press}, + Year = {2013} +} +\end{texlist} +\end{example} + +动态方法利用动态数据修改自动添加related域,避免对bib文件做直接修改。本样式中对该过程进行了封装,定义一个新的命令\verb|\defdoublelangentry|,例如: +\begin{example}{设置关联条目的动态方法}{eg:related:dynamic} +\begin{texlist} +\defdoublelangentry{易仕和2013--}{Yi2013--} +\end{texlist} +\end{example} + +使用该命令后,可以引用主条目“易仕和2013--”生成双语文献。但要注意由于\verb|\DeclareStyleSourcemap|命令只能在导言区中使用,因此\verb|\defdoublelangentry|命令也只能出现在导言区中,这也是相比条目集动态方法的唯一遗憾。 +实现的具体细节见 +\href{https://github.com/hushidong/biblatex-solution-to-latex-bibliography}% +{biblatex-solution-to-latex-bibliography}。 + +双语对照文献的两种动态方法基于set和related的方法测试,参见: +\href{run:./example/opt-eg-authoryear.tex}{opt-eg-authoryear.tex}。 + +\subsection{多样式支持} + +\subsubsection{一个文献表采用多种著录样式} + +一个文献表采用多种著录样式主要针对的是在一个tex文档生成参考文献表中,不同语言的文献采用不同的著录格式,比如中文文献采用GB/T 7714-2015 样式,而西文文献采用西文习惯的样式。这种情况目前由gb7714-2015ms样式解决,选项加载方式如例\ref{eg:gb7714ms}所示。 + +目前gb7714-2015ms样式中,有两种应用方式,一是全部文献都采用GB/T 7714-2015 标准样式,二是中文西文分别采用GB/T 7714-2015 标准样式和biblatex的默认样式。两种方式的选择通过gbstyle选项设置。区分语言使用不同样式的情况下,如有其它需要,完全可以通过定义中文和西文的格式做进一步的修改,比如将英文文献的样式修改为IEEE格式。图\ref{fig:eg:ms}展示了两种不同语言不同的著录格式。 + +\begin{figure}[!htb] +\begin{tcolorbox}[left skip=0pt,right skip=0pt,% +width=\linewidth,colframe=gblabelcolor,colback=white,arc=0pt,% +leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt] +\centering +\deflength{\textparwd}{\linewidth-1cm} +\includegraphics[width=\textparwd]{egmsinabiblio.pdf} +\end{tcolorbox} +\caption{一个文献表采用多种著录样式示例}\label{fig:eg:ms} +\end{figure} + +测试见文档\href{run:egfigure/egmsinabiblio.tex}{egmsinabiblio.tex}。 + + + +\subsubsection{不同参考文献分节采用不同著录样式} + +不同参考文献分节采用不同著录样式主要针对一个tex文档中存在多个参考文献表,且各参考文献表的格式需求不同。比如一些学位论文写作中,正文的参考文献表为著者-出版年制,而附录中的作者论著情况则用顺序编码制。这种情况目前由gb7714-2015mx样式解决,选项加载方式如例\ref{eg:gb7714mx}所示。 + +gb7714-2015mx样式默认使用顺序编码样式,当要使用著者-出版年制样式时,则利用命令 +\verb|\setaystylesection|进行设置,该命令有一个必选参数,表示采用著者-出版年制样式的参考文献节的编号。注意该命令一次只能设置一个文献节,因此设置多个参考文献节时,需要多次使用\verb|\setaystylesection|命令,比如节2节4都采用著者-出版年制样式,那么设置\verb|\setaystylesection{2}\setaystylesection{4}|。 + +目前gb7714-2015mx样式中的两种格式:顺序编码和著者-出版年制样式默认都是符合GB/T 7714-2015 标准的,如果需要做格式的修改,则完全可以通过自定义实现。图\ref{fig:eg:ms}展示了3个参考文献分节的文档,其中节2使用了著者-出版年制。 + +\begin{figure}[!htb] +\begin{tcolorbox}[left skip=0pt,right skip=0pt,% +width=\linewidth,colframe=gblabelcolor,colback=white,arc=0pt,% +leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt] +\centering +\deflength{\textparwd}{\linewidth-1cm} +\includegraphics[width=\textparwd]{egmsindfrefsec.pdf} +\end{tcolorbox} +\caption{不同参考文献分节采用不同著录样式}\label{fig:eg:ms} +\end{figure} + +测试见文档\href{run:egfigure/egmsindfrefsec.tex}{egmsindfrefsec.tex}。 + + +\subsubsection{完全自定义的条目内容样式} + +完全自定义的条目内容样式,针对不完全和不规范的文献表输出,主要用于输出部分参考文献信息。这时可以采用文献缩略信息打印的方法实现。具体的实现方法见\href{https://github.com/hushidong/biblatex-solution-to-latex-bibliography/blob/master/biblatex-solution-to-latex-bibliography.pdf}% +{biblatex-solution-to-latex-bibliography}中的第2.10节。 + +具体例子则可以参考\href{run:./stdgbT7714-2015.pdf}{stdgbT7714-2015.pdf}。其中第8节中大量使用这种方式。 + + + +\subsection{未分类说明} + +\subsubsection{biblatex 的优点} + +基于 biblatex 宏包的参考文献生成方法,具有很多明显的优点,读者可以从 +\href{https://github.com/CTeX-org/lshort-cn}{lshort-cn}、 +\href{https://github.com/latexstudio/LaTeXFAQ-cn}{LatexFAQ-CN}、 +\href{https://tex.stackexchange.com}{tex.stackexchange.com} +了解到更多。 + +笔者从最初开始学习latex时利用 thebibliography 环境生成参考文献,到对格式化有更多需求后开始寻求利用参考文献宏包,再到最后选择使用biblatex宏包,在不断实践过程中越发感觉到biblatex 在生成参考文献方面的巨大潜力。以笔者的观点其优点主要包括: + +%[也由于对bibtex语言不熟悉,偷懒不想学$( \hat{} \bot \hat{} )$] +\begin{enumerate} +\item 使用简单。代码结构很简单,格式控制很简单,功能设置很简单,编译方式很简单,编译命令无限制(xelatex、pdflatex等均可)。例\ref{eg:func:backref} 给出了后向超链接功能的设置。 + + \begin{example}{文献条目的后向超链接设置}{eg:func:backref} + \begin{texlist} + %加上后向超链接设置,需要4步编译。 + \usepackage[backend=biber,style=gb7714-2015,backref=true]{biblatex} + \end{texlist} + \end{example} + +%使用够方便 + +\item 划分自由。在一个文档中可以生成任意数量的文献表,无需用将分档划分成不同的文件来辅助生成分章参考文献。利用refsection 和refsegment方便划分,具有嵌套、遍历等多种灵活处理方式。 +%划分很自由,划分无限制 + +\item 定制方便。使用是tex命令(宏)控制格式,定制和修改相比 bibtex 语言更为容易。全面提供适用于自然学科、人文学科的多种不同类型的参考文献样式,参考、引用、移植、定制均很便捷。 +%定制很容易 + +%处理无限制,支持更全面 +\item 支持全面。后端处理程序biber处理大数据量毫无压力,不用担心内存不足问题,字符编码支持utf-8,完全支持中文的bibtex 键(引用关键字)。biber除了自身提供的大量功能,比如:动态数据修改、参考文献数据检查、引用文献数据的bib输出(例\ref{eg:bibercmd:outbibfile})等外,还可利用一些perl模块来实现一些特殊功能,比如: + 实现文件编码的转换(perl 的Encode::CN 模块), + 排序的本地化调整(perl的Unicode::Collation::locale 模块, + 中文字符的拼音和笔画排序见例\ref{eg:sort:opts}、例\ref{eg:sort:bibercmd})等。其中引用文献数据的bib输出常用于从一个大的bib文件中导出仅有引用文献信息的小的bib文件。 + + \begin{example}{输出引用文献数据时的biber选项}{eg:bibercmd:outbibfile} + \begin{texlist} + biber jobname --output-format=bibtex + \end{texlist} + \end{example} + +\end{enumerate} +%上述这些优点也是笔者决定编写符合GB/T 7714-2015标准的参考文献样式文件的原因之一。 + +\subsubsection{数据库bib文件和文献条目}\label{sec:bib:bibtex} + +参考文献数据以bibtex格式保存在bib文件中。生成参考文献除tex源文档外,还需创建参考文献数据源文件即bib文件。bib文件数据源准备完成后,在加载biblatex宏包后,使用addbibresource命令将其导入。\bc{注意:数据源可以加载多个,比如多个章节的参考文献放在不同的bib文件中,那么全部加载进来即可}。 + +bib文件中的参考文献信息是以条目形式组织,一篇文献创建一条记录即一个参考文献条目,一个条目由若干数据域(有的文档也称为字段)构成。GB/T 7714-2015标准中的文献类型与本样式中条目类型对应关系 +如表\ref{tab:entrytypes}所示, +各类条目具体的著录格式详见\ref{sec:numeric:data}节。 + +\begin{table}[!htb] +\centering +\caption{参考文献常用条目类型}\label{tab:entrytypes} +\footnotesize +\begin{tabular}{clc} +\hline + GB/T 7714-2015中的条目类型 & biblatex中的条目类型 & 类型标识代码\\ \hline + 专著& book & M\\ + 标准& standard/book or inbook with note=standard& S\\ + 专著中的析出文献& inbook & M\\ + 连续出版物& periodical& J\\ + 连续出版物的析出文献& article& J\\ + 报纸析出的文献& newspaper/article with note=news& N\\ + 专利& patent& P\\ + 电子资源或电子公告& online/www/electronic& EB\\ + 会议录或会议文集& proceedings& C\\ + 会议文集中析出的文献& inproceedings/conference& C\\ + 汇编或论文集& collection& G\\ + 汇编或论文集析出中的文献& incollection& G\\ + 学位论文& thesis/mastersthesis/phdthesis& D\\ + 报告& report/techreport& R\\ + 手册& manual& A\\ + 档案& archive/manual& A\\ + 数据库& database& DB\\ + 数据集& dataset& DS\\ + 软件& software& CP\\ + 舆图& map& CM\\ + 未出版物& unpublished& Z\\ + 其它& misc& Z\\ + \hline + \end{tabular} +\end{table} + + + +组成各个条目的不同数据域(字段)保存有参考文献的各部分信息,比如作者、标题、出版项、日期等,这些信息称为著录项目,录入文献信息时,各著录项目信息应录入到对应的数据域中。GB/T 7714-2015标准中的数据域与biblatex中的域的对应关系如表\ref{tab:entryfields}所示。 + +\begin{table}[!htb] +\centering +\caption{参考文献常用信息域(字段)}\label{tab:entryfields} +\footnotesize +\begin{tabular}{cl} +\hline + GB/T 7714-2015中的文献著录项目 & biblatex中的域\\ \hline + 责任者 & author/editor\\ + 题名 & title\\ + 译者 & translator\\ + 版本(主要用于出版物) & edition\\ + 版本(主要用于软件和手册) & version\\ + 出版地 & location/address\\ + 出版者 & publisher\\ + 出版者(大学和研究所) & institution/school\\ + 出版者(会议主办方、手册和电子资源出品方) & organization\\ + 日期 & date\\ + 日期(不可解析的日期) & year\\ + 页码 & pages\\ + 析出文献来源的责任者 & bookauthor/editor\\ + 析出文献来源的标题 & booktitle\\ + 连续出版物题名(期刊、报纸) & journal/journaltitle\\ + 期刊的卷 & volume\\ + 期刊的期/专利号等 & number\\ + 获取和访问路径 & url\\ + 引用日期 & urldate\\ + 数字对象标识符 & doi\\ + 杂项 & note\\ + 文献类型标识符 & usera/mark\\ + 文献载体标识符 & medium\\ + \hline + \end{tabular} +\end{table} + +需要注意的是, +\begin{itemize} + \item note域在本样式中也做特殊用途,即在book类型的note域中输入standard表示标准,在aritcle类型的note域中输入news表示报纸,当然也可以不做特殊用,而只是表示杂项信息,因为标准和报纸也可以用standard和newspaper类型表示,尽管这两种类型不是biblatex原生支持的条目类型。 + + \item usera域用于表示参考文献类型和载体标识符(为兼容Lee zeping 的bst样式使用的bib文件也可以用mark和medium 表示)。一般情况下usera,mark,medium这些域不用在bib文件中输入,而由样式文件自动处理得到,既为了使bib文件更纯粹,也为了兼容不同的样式。想象一下如果在bib文件中给出usera域,但另一样式需要使用usera域且用途不同,那么就会有兼容性问题。不用手动输入更重要的目的是为用户减负,因为用户可以直接使用从网络(各种学术网站)导出参考文献信息而不用再额外添加一个参考文献类型和载体标识符。 + + \item 本样式自动判断语言,用户一般不需要直接给出表示文献语言的域language,因为样式在处理过程中会对各个域的字符做语言判断,这对于一篇文献存在多种语言的情况非常有用,比如一本英文著作被翻译为中文,原作者仍用英文,而译者则使用中文。那么该文献无法用一个language 标识文献的语言,简单来说,标记language域更多的目的是用在多种语言混合的文档中,可以用language 来标记英语、中文、日语、法语和俄语等用于分文种排序。当然这种标记也是由样式自动处理的,用户仅需在自动判断出现问题时手动干预。 + +\end{itemize} + + +\subsubsection{文献条目的数据域及其录入方法}\label{sec:bib:field} + +各个数据域的录入应符合bib文件规范。需要注意: + +\bc{1. 有时直接从网络获取的参考文献信息中可能带有一些特殊字符比如\%,\&等,这些字符在 tex 中通常需要做转义处理,本样式中对像title,journal等常见域中出现的特殊字符已经做了转义,但是一些不常见的域比如 abstract 等没有考虑,所以用户需要手动处理,例如把\%改为\textbackslash \%,否则可能导致出错} + +\bc{2. 由于目前biber使用\href{https://github.com/ambs/Text-BibTeX/tree/master/btparse} +{btparse} +来解析bib文件,因此各条目中的引用关键词中不能出现圆括号作为其内容一部分比如\@misc\{Euclidean\_geometry(hi), 这样的写法是不允许的,需要去掉其中(),否则biber会报错。%} +} + +\bc{3. 由于url宏包的特点,在各个域中使用 \textbackslash url命令时,无法使用中文字符,如果要使用带中文字符的网址,那么可以利用 \textbackslash href命令代替 \textbackslash url命令。或者不使用这两个命令,而直接输入网址,超链接则在域格式中用 \textbackslash href 命令定义,比如:} +\verb|\DeclareFieldFormat{howpublished}{\href{#1}{#1}}|。 + +但要注意: 使用\verb|\href|命令形成的超链接文本,可以看做是普通的正文文本,当内部没有断行符存在时,断行可能会存在问题,因此需要手动处理,比如添加空格或者-字符。 +而当使用\verb|\url|和\verb|\nolinkurl|命令时,断行的问题则由url宏包提供的逻辑进行处理,因此往往能够得到适合的断行。所以是使用\verb|\href|还是\verb|\url|需要根据实际情况选择。 + +\bc{4. 需要表示范围类型的域,比如页码域,通常用一个或多个-符号表示范围值间的间隔符,间隔符在解析后会替换为一个\textbackslash bibrangedash。而日期域在biblatex中是作为日期类型来考虑的,尽管日期也有起止范围的问题,且由于单个日期内部已经存在-符号,因此起止日期间的间隔符用/符号。而卷和期在biblatex中是整数类型的域,本身不具备起止范围解析功能,但GB 7714-2015的连续出版物类型中存在这样的需求,所以特别设计了卷和期的解析,且由于合期常用(7/8)这样的方式表示,因此卷和期范围间隔符用-表示。这些在数据录入过程中是需要注意的。} + + +下面详细介绍本样式中使用的域及其数据录入方式: + +\begin{description} + \item[author] 在biblatex中author域属于name数据类型,输入数据时,各姓名间用and 连接,当姓名过多省略时,用others代替。 + + 单个姓名,对于中文作者直接输入中文姓名即可。比如: + + 于潇 and 刘义 and 柴跃廷 and others + + 对于英文作者,单个姓名有两种biblatex可以解析的输入方式: + + \textcircled{1}prefix lastname, suffix, firstname middlename + + \textcircled{2}firstname middlename lastname or firstname prefix lastname + + 比如: + + DES MARAIS, Jr., D J and H STRAUSS and SUMMONS, R. E. and others + + 其中第一个姓名输入为前缀,姓,后缀,名\ 中间名。第二个姓名输入为名\ 姓。第三个姓名输入为姓,名\ 中间名。 + + \bc{ 推荐使用第一种方式录入作者姓名,特别是存在前后缀的情况。对于第二种输入方式,姓名各个组成部分最好首字母是大写的,首字母非大写可能导致解析出错,比如姓名只有两个组成部分: firstname和lastname,如果firstname 小写的话,有可能会解析为prefix lastname。对于第一种输入方式,则至少需要lastname首字母大写,否则有可能将lastname 解析成prefix。 注意lastname也称familyname,firstname middlename 两者共称givenname} + + 对于中文的机构作者,不需要解析,直接输入机构名,比如: + + 中国企业投资协会 and 台湾并购与私募股权协会 and 汇盈国际投资集团 + + 对于英文的机构作者,由于机构名可能存在空格或and等字符串,因此最好用\{\}包起来,避免解析出错,比如: + + \{International Federation of Library Association and Institutions\} and NASA + + \item[title] 直接输入需要打印的内容,subtitle或titleaddon域类似 + \item[translator] 与author域类似,只是输入的是译者 + \item[edition] 直接输入整数,或者需要打印的内容 + \item[location] 直接输入需要打印的地址内容,而address域在biblatex中作为location别名,表示相同的内容。 + \item[publisher] 直接输入需要打印的出版者内容,institution,organization域类似 + \item[date] 日期可以格式化输入,格式化输入biblatex 会自动解析,如果无法解析会忽略该域。格式化的输入方式是: + + 年-月-日/年-月-日,数字格式为:yyyy-mm-dd/yyyy-mm-dd + + 比如: 2001-05-06/2001-08-01 + + \emph{特别要注意起止日期之间的分隔符为/而不是- ,因为年月日之间已经存在分隔符-。同时因为日期biber解析是严格按照iso标准处理,因此年、月、日数字需要写全,2001-05-06不能写为2001-5-5,否则不能解析},解析完成后第一个年- 月- 日会解析并存储到year,month,day域中,第二个会解析并存储到endyear,endmonth,endday域中。更多细节参考biblatex 手册的Table 8: Date Interface。 + + \item[year] year域的输入与date域类似,为了兼容一些老的bib文件,把year 直接用map 转换成date,所以在本样式的使用中输入year域与date域相同。 + + 但year与date存在一定的差异,即year可以处理仅有年的信息或者需要原样打印的内容。比如: + 1881(清光绪七年)。 + + 这一信息如果放在date中会被自动忽略,但放到year域中,本样式会先将其拷贝到date中进行解析,无法解析的话,date域忽略,但year 信息仍然存在,并原样打印。 + + + \item[urldate] urldate域与date域类似,只是解析时,存储到urlday,urlmonth,urlyear,urlendday,urlendmonth,urlendyear域中。origdate和eventdate与urldate情况类似。 + + \item[pages] 可以格式化输入或输入需要打印的内容。格式化输入时,页码用整数,当有范围时,用单个或多个短横线-隔开。比如:59-60或\verb|59--60|。 当无法解析时,输入内容被认为是需要完整打印的内容。 + + \item[url] 直接输入需要打印的网址内容。注意不需要在域内加上\verb|\url|命令来表示网址链接,仅需要输入网址本身即可,且特殊字符无需转义。即输入方式为: + + \verb|url={http://www.greenwood.com/can_b_b#abc},| + + 而不是: + + \verb|url={\url{http://www.greenwood.com/can_b_b#abc}},| + + 如果是在其它域比如howpublished等域中输入网址,也可以直接输入网址,但所有的特殊字符都需要转义,因为它就是一个普通文本,同时换行行为也与普通文本一致,当网址字符串中没有空格或-字符时,断行可能出现问题,因此需要手动处理。如果加入\verb|\url|命令,那么其中一些特殊字符可能不需要转义,比如\verb|_|等, + 且处理断行可以由\verb|\url|命令的内部逻辑处理,通过\verb|\UrlBreaks|设置可以自动实现比较合适的断行。当然因为biblatex已经做了进一步的处理,所以\verb|\url|中的文本断行是由三个计数器控制: biburlnumpenalty、biburlucpenalty、biburllcpenalty,合理设置这三个计数器,即可得到满意的断行效果。 + + \item[doi] 直接输入需要打印的DOI内容 + \item[note] 在本样式中note域有特殊功能,当其内容为standard或news 时,判断条目类型为标准和报纸析出的文献。 + \item[bookauthor] 用于析出文献时,作为析出文献来源文献的作者,其输入方式与author 相同。 + \item[editor] editor有时直接作为文献的责任者,比如连续出版物(periodical)类型。有时因为author缺失,editor被当做责任者。还有的时候bookauthor缺失,editor也被当做bookauthor,即析出文献来源文献的责任者。editor的输入方式与author相同。 + \item[editortype] editortype作为editor的类型或角色说明域,可以用来在editor后面加上适当的表示角色的字符串,比如“主编”或“eds.”等。常见的角色包括:editor、compiler、founder、continuator, redactor、reviser 和collaborator等。当然这是西文环境中的情况,足够细分,中文情况下可以不用这么细分,而仅对editortype={editor}时的本地化字符串做设置,当然如果一篇文档中存在多种不同的角色editor文献的情况,也需要做细分。 + \item[booktitle] 用于析出文献时,作为析出文献来源文献的题名,其输入方式与title 相同。booktitleaddon域输入方式也相同。 + \item[volume] 连续出版物的卷,格式化输入用整数,当有范围时中间用短横线连接,比如:1-4。当无法解析时,输入内容被认为是需要完整打印的内容。 + \item[number] 连续出版物的期或报纸的版次,输入与volume类似。或者是专利等的号时,直接输入需要打印的内容。 + \item[journal] 用于连续出版物析出文献,表示连续出版物的题名,比如期刊、报纸的提名,直接输入需要打印的内容。journaltitle,journalsubtitle域类似处理。 + \item[version] 用于report和manual的版本信息,直接输入需要打印的内容。 + \item[mark/usera] 不用输入,自动处理。也可以输入文献类型标识符比如M, J, DB, CP等。 + \item[medium] 不用输入,自动处理。也可以输入文献载体标识符比如MT, DK, CD, OL 等。 + \item[language] 不用输入,自动处理。也可以输入语言类型比如english, russian, french, japnese, korean, chinese等。主要用来标识文献的语言类型,用法详见\ref{sec:multilan:combine}节。 + \item[langid] 不用输入,自动处理。也可以输入语言名比如english, russian, french 等,中日韩语一般用english。主要用于配合babel等宏包进行文献的本地化字符串处理,用法详见\ref{sec:multilan:combine}节。 + \item[nameformat] 不用输入。当需要调整当前条目的作者姓名的格式时,可以输入格式名:uppercase, lowercase, givenahead, familyahead, pinyin 等。详见\ref{sec:added:opt}节。 + \item[namefmtid] 不用输入。 +\end{description} + +除了上述输入内容要求外,GB/T 7714-2015还有对数字、字母大小写等有一些格式要求,这些细节需要注意,请参考: +\begin{itemize} +\item 数字:\ref{sec:fmt:number}节 +\item 字母大小写:\ref{sec:fmt:lettercase}节 +\item 卷和期:\ref{sec:fmt:volnum}节 +\item 版次:\ref{sec:fmt:edition}节 +\item 出版项:\ref{sec:fmt:pubitem}节 +\item 页码:\ref{sec:fmt:pages}节 +\end{itemize} + +\subsubsection{其它注意事项}\label{sec:pkg:hints} + +\begin{enumerate} + + \item 本样式包的设计与实现方法以及涉及到的一些biblatex功能介绍,以项目示例的形式总结在 + \href{https://github.com/hushidong/biblatex-solution-to-latex-bibliography}{\LaTeX 文档中文参考文献的biblatex解决方案}中,本文档不再重复给出,有需要了解的用户可以参见其中的第3.1节。 + + \item tex源文档既可以用xelatex编译,也可以利用pdflatex或latex进行编译。但要注意的是pdflatex编译可能因为某些样式比如authoryear,使用了xstring宏包中的一些命令而导致错误,但numeric类样式通常没有问题。该问题在biblatex更新到3.12版本后取消xstring 宏包后得以解决。 + + 中文用户编译还需要注意编码问题。 + utf-8编码的文档,采用xelatex 编译没有任何注意事项,但使用pdflatex编译时,需要给ctex 宏包加载UTF8选项,比如 \verb|\usepackage[UTF8]{ctex}| 。 + + 该选项在文档类加载时给出也可,比如 \verb|\documentclass[UTF8]{article}| , + 同时\bc{文献引用时所用关键词应采用英文},比如 \verb|\cite{zhangml2008}| 而不能包含中文,比如 \verb|\cite{张敏莉2008}|。 + + 当文档使用其他编码时,可以利用notepad++ 或notepad2 等编辑器将其转换为UTF-8编码。若不进行转换,使用xelatex编译通常需要指定一个文档编码,比如windows 环境下的GB2312 编码的文档需要指定\verb|\XeTeXinputencoding "GBK"|,否则会显示乱码。使用pdflatex进行编译时,如果biblatex不能正确的处理编码问题,那么需要为其明确的指定texencoding和bibencoding 选项。比如windows环境下的GB2312编码的文档,需要指定\verb|\usepackge[texencoding=GBK]{biblatex}|。 + + %增加了对GBK支持的说明,2018-05-11 + + \item 当顺序编码和著者-出版年制切换,或者biblatex版本切换,或者不同样式切换时,如果编译出错,可先清理一下辅助文件,完成后再重新编译。 + + \item 当bibtex键中含有中文的时候,texlive2015中的biblatex3.0版的对参考文献条目的超链接会出现问题,而texlive2016中的biblatex3.4或以后的版本则没有问题。 + + \item GB/T 7714-2015中的著者-出版年制要求参考文献按文种集合,且中文在前英文在后。主要通过gblanorder选项、排序模板DeclareSortingScheme\{gb7714-2015\} (biblatex3.7 以前版本) 或 DeclareSortingTemplate\{gb7714-2015\} (biblatex3.8以后版本)、以及自动判断的language 域实现。一般情况下样式能够正确区分不同语言文献,如果出现错误,用户可以手动修改bib源文件,将language 域设置为正确的语言,详见\ref{sec:usage:bbx} 节的说明。 + +%上一段2016-1114更新,下面这段是旧的说法, +%通过定义DeclareSortingScheme\{nyt\},设置方向为direction=descending,可以实现中文在前英文在后但两个文种的文献各自也是降序的。还有一种变通的方法是,在录入bib文件时,在userb域填入用于排序的信息,比如需要排前面中文文献填cn,排后面的英文文献用en。这样因为修改后的排序格式nyt会在author域前先用userb进行排序,自然会把中文文献放在前面。 + + \item 对于出版地和出版者同时缺省的替换处理,GB/T 7714-2015中没有给出明确说明,但给出了一个英文文献示例(见GB/T 7714-2015 附录A.3),形式为: [S.l. : s.n.],尽管中文没有示例,这里也考虑类似的格式,比如: [出版地不详 : 出版者不详]。 + + %,这种形式本样式没有给出,而直接用两者分开的形式,[S.l.] : [s.n.] + + %事实上这里作者认为没有必要把s.l.和s.n. 合起来,不仅与缺省两者之一的情况不统一,样式处理起来也增加不必要的麻烦。 + + \item 目前符合 GB/T 7714-2005 或 GB/T 7714-2015 参考文献著录规则的biblatex 样式有多个实现,除本样式外,还有李志奇(icetea)\footnote{\url{http://bbs.ctex.org/forum.php?mod=viewthread&tid=74474}} 和沈周(szsdk)\footnote{\url{http://bbs.ctex.org/forum.php?mod=viewthread&tid=152561&extra=page\%3D1}} ,其效果是类似的。此外,Casper Ti. Vector提供的biblatex 样式caspervector 也是不错的中文参考文献样式 + \footnote{\url{https://gitlab.com/CasperVector/biblatex-caspervector}}。感谢各位作者的分享! + + \item 由于biblatex宏包的组成比较复杂,所以查找具体命令的代码会比较麻烦。总体来说,包括各种bbx,cbx文件,重点是biblatex.sty,biblatex.def,standard.bbx,还有blx-dm.def 等一些设置文件。另外不要忘记lbx文件,这里面也有一些语言相关的命令,比如\verb|\bibrangedash|,\verb|\finalandcomma|等。至于其它一些tex 原始命令可以从tex、xetex的相关书籍文档查找,latex 相关代码则可以从latex2e,etoolbox等说明文档或latex.ltx,etoolbox.STY等源代码文档中查找。注意多使用meaning命令来获取命令的定义。 + + +% \item 本文档根据GB/T 7714-2015提供的参考文献表著录格式示例做了测试和验证,详见第\ref{sec:eg:gb77142015}节。 +% 测试系统环境为: +% \begin{itemize} +% \item windows7x86+texlive 2014,采用xelatex编译; +% +% \item windows7x64+texlive 2015,采用xelatex编译; +% +% \item 虚拟机xp+texlive 2016,采用xelatex编译; +% +% \item Deepin linux-x64v15.3+texlive 2016,采用xelatex编译。 +% +% \item windows7x64+texlive 2017,采用xelatex编译; +% \end{itemize} + +\end{enumerate} + + + + +\section{参考文献著录格式示例}\label{sec:eg:gb77142015} + +%\subsection{GB/T 7714-2015 中的著录标准和顺序编码制示例} + +%\includepdf[pages={1-5}]{egfigure/eggbcitation.pdf} + + +%\subsection{GB/T 7714-2015 中的著者年份制示例} + +%\includepdf[pages={1-2}]{egfigure/eggbcitationay.pdf} + +%\subsection{GB/T 7714-2015 中的附录参考文献示例} + +%\includepdf[pages={1-4}]{egfigure/eggbbiblio.pdf} + + + +\subsection{GB/T 7714-2015 标准示例} + +详见文档:\href{run:./stdGBT7714-2015.pdf}{GBT7714-2015std} + +\subsection{多语言支持相关测试示例} + +详见文档:\href{run:./stdgbT7714-2015lan.pdf}{stdgbT7714-2015lan.pdf} + +\subsection{国内一些大学学位论文文献格式相关测试示例} + +详见文档:\href{run:./stdgbT7714-2015thesis.pdf}{stdgbT7714-2015thesis.pdf} + +\subsection{更多示例} + +\begin{itemize} + + \item 示例: beamer类中的参考文献示例 + + \item 示例: 专著book和专著中的析出文献inbook及标准standard文献 + + \item 示例: 连续出版物periodical和连续出版物中的析出文献article + + \item 示例: 电子资源或在线资源online + + \item 示例: 学位论文thesis、专利文献patent + + \item 示例: 报告report、手册manual和档案、未出版物unpublished + + \item 示例: 会议文集proceedings和会议文集中析出的文献inproceedings + + \item 示例: 汇编collection和汇编中的析出文献incollection + + \item 示例: online条目仅存url信息 + + \item 示例: 传统和新增条目类型的兼容性 + + \item 示例: 中英文判断信息中存在编组时的处理 + + \item 示例: 处理参考文献信息中\&等特殊字符 + + \item 示例: 处理著者-出版年制article中卷信息缺省的标点 + + \item 示例: 标题中有\textbackslash LaTeX\{\}等名称时的情况 + +\end{itemize} + +beamer类示例,参见: \href{run:./example/egbeamer.tex}{顺序编码制}; +\href{run:./example/egbeameray.tex}{著者-出版年制}。 + +其它示例,参见: +\href{run:./example/testallformat.tex}{testallformat.tex}。 + +详见文档: +\href{run:./example/stdGBT7714-2015eg.pdf}{GBT7714-2015egstd}, +\href{run:./example/stdgbT7714-2015fmt.pdf}{stdgbT7714-2015fmt.pdf}。 + + +\section{GB/T 7714-2015 标准说明与实现}\label{sec:gbt:std} + +\subsection{顺序编码制} + +\subsubsection{参考文献表}\label{sec:bib:serialno} + +GB/T 7714-2015规定采用顺序编码制组织参考文献时,各篇文献应按正文部分标注的序号依次列出。具体参考GB/T 7714-2015 第9.1节。 + +\subsubsection{文献标注法} +标注则根据在正文中引用的先后顺序连续编码,将序号置于方括号内。 + +同一处引用多篇文献,各篇序号间用逗号隔开,遇连续序号,起讫序号用短横线连接。 + +多次引用同一著者的同一文献时,可在序号的方括号外著录该文献引文页码,这一要求与引用(标注)样式无关,需要作者在写文档时使用相应的引用命令并在需要时输入页码信息。针对这一要求,在cite等常用命令基础上,新定义了一个引用命令pagescite,其使用方式详见第\ref{sec:cbx:usage}节。标注样式更详细要求参考GB/T 7714-2015 第10.1节。 + +如果顺序编码制采用脚注方式,则序号由计算机自动生成圈码。多次引用同一著者的同一文献时,若采用脚注方式应重复著录参考文献,但在参考文献表中的著录项目可以简化文献序号和页码,也就是说,每个文献引用都要对应的一个脚注,脚注的内容为文献条目,但条目的内容可以简化为文献序号和页码。 + +脚注方式的顺序编码制与一般的顺序编码制的主要差别在于: +一、正文每个文献需要引用均生成脚注文献,因此一个引用命令只能带一个文献引用关键字。且正文中引用的标注标签格式不同,是带圈的上标数字而不是[]包围的数字。 +二、脚注中的文献表即便是遇到相同文献也需要重复输出,但可以简化为序号和页码。 + +事实上如果不进行简化而只是简单重复输出,对于biblatex来说处理其实更方便,但为了与GB/T 7714-2015 标准给出的示例一致,biblatex-gb7714-2015也做了实现,注意:脚注方式文献表的引用命令为\verb|\footfullcite|,需要注意由于脚注本身表格中存在的问题,可能导致在其中使用该命令出现比较奇怪的现象,也要注意在图表标题中的使用情况。GB/T 7714-2015 标准中示例实现如图\ref{fig:numeric:footnote}所示: + +\begin{figure}[!htb] +\begin{tcolorbox}[left skip=0pt,right skip=0pt,% +width=\linewidth,colframe=gblabelcolor,colback=white,arc=0pt,% +leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt] +\centering +\deflength{\textparwd}{\linewidth-1cm} +\includegraphics[width=\textparwd]{egfootstyle.pdf} +\end{tcolorbox} +\caption{顺序编码制的脚注方式}\label{fig:numeric:footnote} +\end{figure} + + +\subsection{著者-出版年制} + +\subsubsection{参考文献表} + +GB/T 7714-2015规定采用著者-出版年制组织时,各篇文献首先按文种组织,可分为中文,日文,西文,俄文和其他文种等部分;然后按照著者字顺和出版年排列。中文文献可以按著者汉语拼音字顺排序,也可按笔画顺序排列。具体参考GB/T 7714-2015第9.2节。 + +%(因为需要根据语言进行划分,所以语言(language)域对于录入文献来说可能是必要的,因为作者的测试仅涉及中英文两种语言,没有遇到需要language域的情况。) + +\subsubsection{文献标注法} +各篇文献的标注内容由著者姓(lastname/family)和出版年构成,并置于()内。对于使用汉字的语言来说,整个姓名都是 lastname/family 所以标注的是全名。机构团体名也整体标注。 + +若正文中已有著者姓名,则()内只标注出版年,这一点样式文件无法判断,只能是文档作者自身把握,当然本样式提供了标签只有年份、附加年份和页码信息的引用命令yearpagescite/yearcite,方便文档作者使用,使用方法详见第\ref{sec:cbx:usage}节。当然文档作者还可以使用textcite命令同时给出满足格式要求的作者和年份信息,本样式已做支持。 + +引用多个著者的文献时,对西文只需标注第一著者的姓(而在参考文献列表中的作者按最大数量三个处理,这与顺序编码制一致,参考GB/T 7714-2015第8.1.2节),其后附“et al.”,对于中文著者,标注第一著者的姓名,其后附“等”。姓名与“et al.”“等”间留适当空隙。 + +\bc{注意到在GB/T 7714-2015第10.2.1节给出的例子中作者姓的大小写格式与参考文献表中的要求是不同的,这说明标注中的作者姓名是由写文档的作者来决定的,因此本样式文件原样输出bib源文件中作者姓的大小格式}。 + +引用同一著者同一年出版的多篇文献时,出版年后应采用小写字符a,b,c等区别。 + +多次引用同一著者的同一文献,在正常标注外,需在()外以角标形式著录引文页码,这一问题样式文件无法判断,只能提供可以形成该格式的引用命令,供文档作者使用,因此提供pagescite命令,使用方法详见第\ref{sec:cbx:usage}节。 + +标注要求具体参考GB/T 7714-2015第10.2节。 + +\qd{一般情况下,当文献作者缺省时,著者-出版年制就没有作者可以用,因此文献题名用来生成标签,这样会导致文献表中文献题名后的文献类型标识/文献载体标识消失(这是因为题名用于生成标签后,题名域会被清除,自然也就不输出题名相关的信息了,见后面的示例文献“\hyperlink{entrystdwithoutauthor}{Information and documentation-the Dublin core metadata element set}”)。此时可以用佚名替代缺省作者的方式避免这个问题,即可以使用样式文件提供的选项gbnoauthor=true,一旦设置该选项为true,则缺省的作者会根据文献语种填充为佚名或Anon。默认情况下,不进行这种处理,即相当于设置选项gbnoauthor=false。而顺序编码制因为标签是数字序号,所以不存在这个问题。} + +%本样式文件默认情况下采用佚名方式,如果不需要使用佚名,那么需要在样式文件中注释掉一段代码,这段代码在本文档末尾2016-11-14的更新历史中有说明,见\pageref{up:20161114}页。} + +\subsection{各类文献在biblatex中对应的条目和域}\label{sec:numeric:data} +biblatex-gb7714-2015宏包设计的重要原则是要符合GB/T 7714-2015标准。因此根据GB/T 7714-2015 的要求并结合biblatex的条目类型和数据域,对各类参考文献做如下考虑: +\subsubsection{专著/book} +\begin{refentry}{}{} +专著对应的biblatex的entrytype为:book,文献类型标识用M表示。 + +\bibliofmt{其著录格式为}(参考GB/T 7714-2015第4.1节):\\ +主要责任者.题名:其他题名信息[文献类型标识/文献载体标识].其他责任者.版本项.出版地:出版者,出版年:引文页码[引用日期].获取和访问路径.数字对象唯一标识符. +\end{refentry} + +其对应的biblatex数据域为: +\begin{example}{专著/book条目的域格式}{eg:bookfieldfmt} +\begin{texlist} +author.title[usera].translator.edition.location:publisher,date或year:pages[urldate].url.doi +\end{texlist} +\end{example} + +其中标题相关的附加信息除了可以直接在title域中录入外,还可以在subtitle或titleaddon域中添加,后面出现的booktitle,journaltitle,也有类似情况,可以在booktitleaddon或者journalsubtitle中附加信息。其中出版地用location域表示,也可以用传统的address表示,biblatex将address作为location的别名处理,使用两者中的任何一个都可以表示出版地信息。\bc{特别强调: usera域不用录入,该域内容由bbx样式文件根据条目类型自动处理得到。} + +\qd{由于biblatex不支持standard条目类型,所以“标准”类型可以用book或inbook替代,但使用note域等于standard作为一个区分,当note域数据存在且内容等于standard时,就将其作为“标准”文献进行处理,其文献类型标识用S表示。这里为什么使用note域而不是type域和keywords域,是因为考虑到note域一般情况下没有什么特殊意义,使用它不会导致冲突,而type域在biblatex标准样式中没有被book和article条目类型当作支持的域,对于支持该域的条目比如thesis,type域又有特殊的意义,是用来区分master和doctor的,而keywords域倒是可以使用,只是该域一般很少在jabref之类软件的默认域中,需要进一步设置,而且可能带来不通用的问题。} + +\subsubsection{标准/standard}\label{sec:standard} +“标准”(standard)作为一种文献条目类型biblatex并不支持,因此直接利用book或inbook类型加note域等于standard代替。当然为了兼容传统BIBTeX格式存在standard类型的情况,也可以直接使用standard类型。 +为此本样式对standard条目类型做了特别支持。著录格式的处理原理与前一节所述相同,只是利用动态数据将standard类型转换为book/inbook类型。在bib文件中直接使用standard类型时注意使用其它biblatex样式时可能存在移植障碍,因为其它样式可能不支持standard类型。 + +\begin{refentry}{}{} +标准对应的biblatex的entrytype为: standard。文献类型标识用S表示。 + +\bibliofmt{其著录格式为}(与book和inbook类型类似,其中圆括号内是与inbook类似时存在的内容,此外当出版地和出版者不存在时直接忽略,这是与book和inbook不同的地方。):\\ +主要责任者.文献题名[文献类型标识/文献载体标识].其他责任者(//所在文献集主要责任者.文献集题名:其他题名信息).版本项.出版地:出版者,出版年:文献的页码[引用日期].获取和访问路径.数字对象唯一标识符. +\end{refentry} + +其对应的biblatex数据域为: +\begin{example}{标准/standard条目的域格式}{eg:standardfieldfmt} +\begin{texlist} +author.title[usera](//bookauthor.booktitle).edition.location:publisher,date或year:pages[urldate].url.doi +\end{texlist} +\end{example} + +\emph{需要注意的是: 根据GB/T 7714-2015标准第19页的标准文献示例,当标准不存在出版项时,直接省略}。 + + +\subsubsection{专著中的析出文献/inbook} +\begin{refentry}{}{} +专著中的析出文献对应的biblatex的entrytype为: inbook。文献类型标识用M表示。 + +\bibliofmt{其著录格式为}(参考GB/T 7714-2015第4.2节):\\ +析出文献主要责任者.析出文献题名[文献类型标识/文献载体标识].析出文献其他责任者//专著主要责任者.专著题名:其他题名信息.版本项.出版地:出版者,出版年:析出文献的页码[引用日期].获取和访问路径.数字对象唯一标识符. +\end{refentry} + +其对应的biblatex数据域为: +\begin{example}{专著析出文献/inbook条目的域格式}{eg:inbookfieldfmt} +\begin{texlist} +author.title[usera]//bookauthor.booktitle.edition.location:publisher,date或year:pages[urldate].url.doi +\end{texlist} +\end{example} + +\subsubsection{连续出版物/periodical} +\begin{refentry}{}{} +连续出版物对应的biblatex的entrytype为: periodical。文献类型标识用J表示。 + +\bibliofmt{其著录格式为}(参考GB/T 7714-2015第4.3节):\\ +主要责任者.题名:其他题名信息[文献类型标识/文献载体标识].年,卷(期)-年,卷(期).出版地:出版者,出版年[引用日期].获取和访问路径.数字对象唯一标识符. +\end{refentry} + +其对应的biblatex数据域为: +\begin{example}{连续出版物/periodical条目的域格式}{eg:periodicalfieldfmt} +\begin{texlist} +author/editor.title[usera].year或date,volume(number)-endyear, endvolume(endnumber).location:institution,date 或year[urldate].url.doi +\end{texlist} +\end{example} + +其中连续出版物的出版者用institution表示。 +\qd{因为连续出版物可能用到两个日期,两个卷,两个期,所以录入数据时需要特别处理。不需要录入endyear等信息,只需要在到year或date域录入两个日期,由biber自动解析,两个日期之间用/分隔。而卷和期由于可能有合订模式,且合订卷期之间用/分隔(参考GB/T 7714-2015第8.8.3节),因此如果需要解析有起止范围的卷和期,录入到volume和number域的信息中起止值之间应用-分隔。} + +\subsubsection{连续出版物的析出文献/article} +\begin{refentry}{}{}%[break at=0.5cm/0pt] +连续出版物的析出文献对应的biblatex的entrytype为: article。文献类型标识用J表示。 + +\bibliofmt{其著录格式为}(参考GB/T 7714-2015第4.4节):\\ +析出文献主要责任者.析出文献题名[文献类型标识/文献载体标识].连续出版物题名:其他题名信息,年,卷(期):页码[引用日期].获取和访问路径.数字对象唯一标识符. + +注意:从GB/T 7714-2015第4.4.2节的示例可以看到对于带网址的article在引用日期前可以加上修改更新日期。 +\end{refentry} + +其对应的biblatex数据域为: +\begin{example}{连续出版物析出文献/article条目的域格式}{eg:articlefieldfmt} +\begin{texlist} +author.title[usera].journaltitle或journal,year,volume(number):pages[urldate].url.doi +\end{texlist} +\end{example} + +\qd{由于biblatex不支持newspaper 条目类型,所以条目类型报纸析出的文献用article表示,但使用note域等于news作为一个区分,当note域数据存在且内容等于news时,就将其作为报纸的析出文献进行处理。报纸文献类型标识用N表示,报纸的版次用number域描述。} + +\subsubsection{报纸析出的文献/newspaper}\label{sec:standard} +biblatex没有将报纸的析出文献(newspaper)作为一种文献条目类型,因此可以直接利用article类型加note域等于news代替,或者也可以直接使用newspaper类型。为方便使用考虑,本样式增加了对新条目类型newspaper的支持,这种支持通过类似于standard类型的方式实现,没有对数据模型进行改动或增加,而完全利用动态数据修改将newspaper类型转换为article类型。在bib文件中直接使用newspaper类型时需要注意可能存在移植障碍,因为其它biblatex样式可能不支持newspaper类型。 + +\begin{refentry}{}{} +报纸析出的文献对应一个新的entrytype为: newspaper。文献类型标识用N表示。 + +\bibliofmt{其著录格式为}(类似于article):\\ +析出文献主要责任者.析出文献题名[文献类型标识/文献载体标识].报纸题名:其他题名信息,日期(版号)[引用日期].获取和访问路径.数字对象唯一标识符. +\end{refentry} + +其对应的biblatex数据域为: +\begin{example}{报纸析出的文献/newspaper条目的域格式}{eg:newspaperfieldfmt} +\begin{texlist} +author.title[usera].journaltitle或journal,date(number)[urldate].url.doi +\end{texlist} +\end{example} + +\qd{newspaper类型与article类型的差别主要是(1)文献标识码不是J而是N;(2)报纸的日期需要表示到日。(3)报纸不需要修改和更新日期。注意:报纸名应用journal或journaltitle域录入,与article保持一致。} + +\subsubsection{专利/patent} +\begin{refentry}{}{}%[break at=3cm/0pt] +专利文献对应的biblatex的entrytype为: patent。文献类型标识用P表示。 + +\bibliofmt{其著录格式为}(参考GB/T 7714-2015第4.5节):\\ +专利申请者或所有者.专利题名:专利号[文献类型标识/文献载体标识].公告日期或公开日期[引用日期].获取和访问路径.数字对象唯一标识符. +\end{refentry} + +其对应的biblatex数据域为: +\begin{example}{专利文献/patent条目的域格式}{eg:patentfieldfmt} +\begin{texlist} +author.title:number[usera].date或year[urldate].url.doi +\end{texlist} +\end{example} + +\qd{需要注意:公告日期或公开日期需要表示到日。} + +\subsubsection{电子资源/online} +\begin{refentry}{}{}%[break at=0.4cm/0pt] +电子资源对应的biblatex的entrytype为: online或electronic或者www。文献类型标识用EB表示。 +\bc{(注意: biblatex将electronic或www作为online条目类型的别名,对于标准样式来说这两者出现在bib文件中等同于online,但这种等同标准样式是在驱动层进行处理的,而gb7714-2015样式还需要处理文献类型标识,本样式文件做了进一步支持。因此bib文件中也可以直接使用electronic和www。)} + +\bibliofmt{其著录格式为}(参考GB/T 7714-2015第4.6节):\\ +主要责任者.题名:其他题名信息[文献类型标识/文献载体标识].出版地:出版者,出版年:引文页码(更新或修改日期)[引用日期].获取和访问路径.数字对象唯一标识符. +\end{refentry} + +其对应的biblatex数据域为: +\begin{example}{电子资源/online/electronic/www条目的域格式}{eg:onlinefieldfmt} +\begin{texlist} +author.title[usera].organization/instiution,date或year:pages(date/enddate/eventdate)[urldate].url.doi +\end{texlist} +\end{example} + +\qd{尽管GB/T 7714-2015中给出的著录格式包含出版地和出版者,但通常情况下具有出版地和出版者的文献会归类到其它条目类型中,至于存在的url信息,只要标识文献载体即可,即一般情况下(出版地:出版者,出版年:引文页码)这些信息很少出现在online[EB]条目中。因此默认情况下,gb7714-2015样式只处理出现organization或instiution中的出版者信息,此外用date表示更新或修改日期,urldate表示引用(访问)日期。如果出现复杂情况,更新或修改日期还可以利用enddate/eventdate表示。注意修改日期需要表示到日} + +以上是GB/T 7714-2015直接给出著录格式的条目类型,还有一些类型并没有给出具体格式,但在例子中也有所体现,本样式文件根据这些例子,给出了著录格式。 + +\subsubsection{汇编或论文集/collection} + +\begin{refentry}{}{} +汇编文献对应的biblatex的entrytype为:collection。文献类型标识用G表示。 + +\bibliofmt{其著录格式为} 采用与book一致的格式。 +\end{refentry} + +\subsubsection{汇编或论文集析出中的文献/incollection} +\begin{refentry}{}{} +汇编中的析出文献对应的biblatex的entrytype为:incollection。文献类型标识用G表示。 + +\bibliofmt{其著录格式为} 采用与inbook一致的格式。 +\end{refentry} + +\subsubsection{会议录或会议文集/proceedings} +\begin{refentry}{}{} +会议文集的biblatex的entrytype为:proceedings。文献类型标识用C表示。 + +\paragraph{其著录格式为} 采用与book类似的格式。 +\end{refentry} + +\subsubsection{会议文集中析出的文献/inproceedings} +\begin{refentry}{}{} +会议文集中析出的文献对应的biblatex的entrytype为:inproceedings。文献类型标识用C表示。 +\bc{(注意: biblatex将conference作为inproceedings条目类型的别名,对于标准样式来说conference出现在bib文件中等同于inproceedings,但这种等同标准样式是在驱动层进行处理的,而gb7714-2015样式还需要处理文献类型标识,本样式文件做了进一步支持。因此bib文件中也可以直接使用conference。)} + +\bibliofmt{其著录格式为} 采用与inbook类似的格式。 +\end{refentry} + + +\subsubsection{报告/report} +\begin{refentry}{}{} +报告对应的biblatex的entrytype为: report。文献类型标识用R表示。\bc{(注意:biblatex将techreport作为report条目类型的别名,对于标准样式,techreport出现在bib文件中等同于report,但这种等同标准样式是在驱动层处理的,而gb7714-2015样式还需要处理文献类型标识,本样式文件做了进一步支持。因此bib文件中也能直接使用techreport类型。)} + +\bibliofmt{其著录格式为} (由biblatex的标准report格式修改得到,注意当出版地和出版者不存在时忽略这两项) + +主要责任者.题名:其他题名信息[文献类型标识/文献载体标识].其他责任者.类型.号码.版本项.出版地:出版者,出版年:引文页码[引用日期].获取和访问路径.数字对象唯一标识符. +\end{refentry} + +其对应的biblatex数据域为: +\begin{example}{报告/report/techreport条目的域格式}{eg:reportfieldfmt} +\begin{texlist} +author.title[usera].translator.type number.version.location:institution,date 或year:pages[urldate].url.doi +\end{texlist} +\end{example} + +\qd{因为有的报告文献可能存在类型和报告号信息,比如AIAA 9076或AD 730029等,所以著录格式需要有所体现,而这两个数据体现在type和number两个域中,或者在version域中体现也可,而对于标题中的出现的报告号,可以直接在标题或子标题或者附加标题中体现。report的版本信息放在version域中,而不是book等条目的edition域中。report类型出版项处理基本与book一样,但当出版项缺省时且存在网址时,直接省略出版项,且加上修改和更新日期,因此将其转换为online类型处理。从report开始,后面的所有类型,当不存在出版项且存在网址时,都以online的格式进行处理。} + +\subsubsection{手册或档案/manual/archive} +\begin{refentry}{}{} +手册和档案采用一种格式,对应的biblatex的entrytype为: manual或archive。文献类型标识用A表示。 + +\bibliofmt{其著录格式为} 借用thesis格式处理,而不是标准样式中的manual格式,这种方式下,当没有出版地和出版者时,完全省略。 +\end{refentry} + + \bc{manual出版者用institution域表示,体现的是机构而不是一般的出版社。注意:manual类型的出版项缺失时直接省略。} + +\subsubsection{学位论文/thesis} +\begin{refentry}{}{} +学位论文对应的biblatex的entrytype为: thesis。文献类型标识用D表示。\bc{(注意:biblatex将mastersthesis或phdthesis作为thesis条目类型的别名,对于标准样式来说这两者出现在bib文件中基本等同于thesis,但却会增加type信息。但这种等同,标准样式是在驱动层进行处理的,而gb7714-2015样式还需要处理文献类型标识并且不需要type信息,本样式文件做了进一步支持。因此bib文件中也可以使用mastersthesis和phdthesis)。} + +\bibliofmt{其著录格式为} 由biblatex的标准thesis格式修改得到。 + +主要责任者.题名:其他题名信息[文献类型标识/文献载体标识].其他责任者.出版地:出版者,出版年:引文页码[引用日期].获取和访问路径.数字对象唯一标识符. +\end{refentry} + +其对应的biblatex数据域为: +\begin{example}{学位论文/thesis/mastersthesis/phdthesis条目的域格式}{eg:thesisfieldfmt} +\begin{texlist} +author.title[usera].translator.location:institution,date或year:pages[urldate].url.doi +\end{texlist} +\end{example} + + \bc{由于thesis类型出版项缺失时直接省略,格式与manual一致,借用manual类型输出。} + + +\subsubsection{未出版物/unpublished} +\begin{refentry}{}{} +未出版物,对应的biblatex的entrytype为: unpublished。文献类型标识用Z表示。 + +\bibliofmt{其著录格式为} 借用manual格式处理。 +\end{refentry} + +\subsubsection{备选类型} +\begin{refentry}{}{} +备选/其它(misc),文献类型标识用Z表示。 + +\bibliofmt{其著录格式为} 当存在网址时直接转换为online类型,由于howpublished域可用于描述一些详细信息,因此不存在网址时,独立作为一种格式处理。 +\end{refentry} + +\subsubsection{更多类型} +\begin{refentry}{}{} +数据库(database)标识符(DB)、数据集(dataset)标识符(DS)、软件(software)标识符(CP)、舆图(map)标识符(CM)。 + +\bibliofmt{其著录格式为} 借用manual格式处理。 +\end{refentry} + + + +\subsection{标准的其它细节要求} + +除了第\ref{sec:numeric:data}节针对不同条目类型的著录格式要求外,GB/T 7714-2015 还有一些细节规定比如文字、符号等,biblatex-gb7714-2015宏包做如下考虑, +示例见文档\href{run:./stdGBT7714-2015.pdf}{stdGBT7714-2015}: + +\subsubsection{数字}\label{sec:fmt:number} + +\begin{property}{}{} +用户录入文献数据中包含数字时,gb7714-2015按照GB/T 7714-2015第6.2节要求输出阿拉伯数字。 +\end{property} + +\subsubsection{英文字母}\label{sec:fmt:lettercase} + +\begin{property}{}{} +为了符合西文文献责任者的字母大小写习惯,gb7714-2015通过判断是否存在givenname/firstname来确定是否是个人作者,当存在givenname/firstname 时认为是个人作者,不存在则是机构作者,当是个人作者时familyname/lastname按GB/T 7714-2015 要求全大写,是机构作者则仅大写首字母。所以为满足GB/T 7714-2015 第6.3节要求,对于仅有英文姓(lastname)的个人作者,用户录入时字母应全大写。 + +用户录入出版项、西文期刊名缩写以及西文文献的字母时,应按照GB/T 7714-2015第6.4节,第6.5节,6.6节要求,使用符合要求的习惯用法和大小写方式,gb7714-2015以原样打印的方式处理。 + +对于英文大小写问题,GB/T 7714-2015除了责任者的大写要求外,其它要求均比较模糊,但提到可参照ISO 4的要求。但实际上,不同的期刊可能会有各自不同的要求。从笔者的经验看,一般国内的期刊对于字母大小写通常要求: 责任者(全部大写); 题名(句首字母大写其它全部小写); 期刊名会议名(单词首字母大写); 出版项和其它(单词首字母大写)。所以用户在录入bib文件时可以按照这种常见方式来输入以减少后期修改。 +\end{property} + +\subsubsection{标点} + +\begin{property}{}{} +用户录入引文信息时不需要考虑域之间的标点符号,只需录入各数据域时考虑习惯的标点用法。gb7714-2015实现了GB/T 7714-2015第7节所给出的著录用符号要求。 +\end{property} + +\subsubsection{责任者} + +\begin{property}{}{} +用户录入引文的责任者信息时,当责任者为多级机关团体时,用户填入auther信息时,应按照GB/T 7714-2015第8.1.4节要求,用英文句点.号分隔。 + +当责任者是个人英文名,且具有名、姓、前缀和后缀,应按照第\ref{sec:bib:bibtex}节给出姓名录入方式处理才能正确解析,比如:von Peebles, Jr., P. Z.,其中von为姓前的前缀,Jr.为姓后的后缀,P. Z. 为缩写名(包括first name 和middle name)。 + +gb7714-2015实现了GB/T 7714-2015第8.1节要求的责任者样式,能自动判断责任者语言并分别处理,设置了全局选项useprefix=true以使用前缀,增加了gbnamefmt选项用于设置不同的姓名输出格式。 +\end{property} + +\subsubsection{文献类型标识和载体} + +\begin{property}{}{} +用户录入引文题名信息时,无需给出文献类型标识/文献载体标识。同一责任者的合订题名,应用户根据GB/T 7714-2015 第8.2.1节的要求,在多个题名间用英文分号分隔,并整体录入到title数据域中。而分卷号,卷次,册次等信息时,除了专利号用number域录入外,其它可以直接在title数据域或者subtitle/titleaddon等数据域中给出。 + +gb7714-2015实现了符合GB/T 7714-2015第8.2节要求的格式,能根据条目信息确定文献类型标识/文献载体标识,并在各类参考文献条目驱动中直接使用,也可以利用gbtype选项设置是否输出该信息。各不同类型文献的类型标识/文献载体标识,参考GB/T 7714-2015 表B.1和B.2。 +\end{property} + +\subsubsection{版次}\label{sec:fmt:edition} + +\begin{property}{}{} +用户在录入版次信息时,只要录入版次的整数数字比如2,或者录入需要打印的字符串比如明刻本。 + +gb7714-2015实现了GB/T 7714-2015第8.3节要求的格式,根据edition/version域输入信息分别处理,对于整数则解析后格式化,对于其它特殊版本说明,如新1版,明刻本等,直接在edition域录入后原样打印。 +\end{property} + +\subsubsection{出版项}\label{sec:fmt:pubitem} + +\begin{property}{}{} +用户在录入出版项信息时,当出版日期有其它形式的纪年时,将其置于公元纪年后面的()内,并整体录入到 year 数据域(注意不是date域)中,比如: 1845(清同治四年)。而引用/访问日期应录入到 urldate 数据域。当除了出版日期外还有修改/更新日期等时,可在year或date数据域录入第二个日期,并用/符号与前一个出版日期隔开。而专利的公告日期和其它条目类型的出版年应录入到 date 域中。 + +gb7714-2015实现了GB/T 7714-2015第8.4节要求的格式。当出版地和出版者缺省时,中英文自动区分处理。对于用/符号隔开的两个日期,biblatex后端biber能自动解析,后一个日期数据自动解析到endyear等域可作为修改日期等使用。 +\end{property} + +\subsubsection{页码}\label{sec:fmt:pages} +\begin{property}{}{} +用户在录入页码信息时,可以在pages域中根据需要录入可解析的页码(即用整数表示页码,起讫页码用-分隔),比如: 81-86。 也可以直接录入需要打印的信息,比如: 序2-3等。 + +gb7714-2015实现了GB/T 7714-2015第8.5,8.8.2节的要求,对于能解析的页码自动解析后格式化,对于不能解析的页码则原样输出。 +\end{property} + +\subsubsection{访问路径URL和DOI} +\begin{property}{}{} +用户在录入获取和访问路径、数字对象唯一标识符信息时,将访问路径录入到url域中,数字对象唯一标识符录入到doi域中即可。 + +gb7714-2015实现了GB/T 7714-2015第8.6,8.7节要求的格式。 +\end{property} + +\subsubsection{卷和期}\label{sec:fmt:volnum} +\begin{property}{}{}%[break at=0.4cm/0pt] +用户在录入卷、期等信息时,如\ref{sec:bib:bibtex}节中所述,合期的期号用/间隔,比如9/10,填入number域,报纸的版次也填入number域。 + +gb7714-2015实现了GB/T 7714-2015第8.8节要求的析出文献相关格式。 +\end{property} + + +\section{总结与致谢} + +通过对 GB/T 7714-2015 标准的分析,对 biblatex 的学习和理解,在 biblatex 标准样式基础上,设计完成了符合 GB/T 7714-2015 标准的biblatex参考文献样式。从测试实践看,基本能够满足使用要求,用户可以放心使用。遇到问题时,除了可以查看 +本文档说明外,也可以看样式文件代码,其中给出了详细注释,如果遇到无法解决的问题,请邮件联系作者。 + +%读者若查看样式文件内容可以看到作者对各目标要求所做的修改及,读者也可以根据自己的需求进行修改,作者设计样式文件的思路以及在设计过程中用到的一些biblatex宏包功能说明,详见第\ref{sec:biblatex:mech}节和LaTeX文档中文参考文献的biblatex解决方案的第2.7节。 + +最后要感谢如下各位师长和朋友,正是在各位的帮助建议下,本样式不断升级逐渐完善。包括: moewew (biblatex 现在的维护者之一,给予不少有益的建议和指导)、 李志奇(基于biblatex的符合GBT7714-2005的中文文献生成工具的作者,工具中的一些设计如usera域的使用/卷期范围解析等带来很多启发,本人之前一直使用该工具,之所以开发biblatex-gb7714-2015其实主要是因为该工具因biblatex升级而无法使用)、caspervector(虽然未曾真正交流,但从biblatex-caspervector样式包中学到很多,包括排序/GBK编码等问题的解决思路)、LeoLiu(刘海洋,给出的CJK字符判断函数 +\footnote{\url{http://bbs.ctex.org/forum.php?mod=viewthread&tid=152663&extra=page\%3D3}} 对本宏包非常有帮助)、chinatex(china tex版主,给了很多建议和帮助,并且一起合作)、Sheng wenbo(biblatex用户手册合作译者,LaTeX2e 插图指南第三版译者,我们一起翻译的过程相互激励相互促进)、zepinglee(gbt7714-2015 bst样式作者,给了很多建议和讨论)、Harry Chen(ctex套件维护者之一,给了不少好的建议)、liubenyuan(关于项目组织给出了很好的建议)、刘小涛(讨论了关于zotero的使用并提出了建议)、ghiclgi(讨论了GB中著者-出版年制标注标签的一些问题)、秀文工作组、leipility、qingkuan、湘厦人、秋平、任蒲军、fredericky123、qiuzhu、chaoxiaosu、Old Jack、Wu Nailong、Yibai Zhang、wayne508、 钟乙源、Xiaodong Yao、dsycircle、rpjshu、zjsdut、谢澜涛、Zutian Luo、海阔天空、zzqzyx、程晨、xmtangjun、蔡伟 等等。当然还有更多朋友提供了bug报告,提出了issue,提供了热心帮助,限于篇幅这里不再一一列举,在此一并表示感谢! + + +\section{存在的问题和下一步工作} + + +\subsection{存在的问题} + +\begin{enumerate} + + %\item 当作者多于3个需要添加等或et al.时,如果作者的姓名是用\{\}包起来的,可能判断会出错。 + %这个问题已经解决了,本来在\testCJKfirst中如果单靠edef加expandafter 组合,无法处理带编组的字符流。所以考虑利用xstring 宏包的\exploregroups函数来,提取字符到命令中,这一就能真正的获得域中的第一个字符,而不会把一个编组当成一个字符进行判断。2016-1223,详见修改历史1.0e中的说明。 + + %\item 顺序年制中当不存在著者信息时,如果用佚名或者no author,本样式文件中没有实现。怎么在数据进来后,给一些域添加信息?在biber处理过程中根据一些判断添加信息?(著者年制,没有作者,用佚名,英文怎么办?没有年怎么办?) + %这个问题解决了,2016-1114 + + %\item 著者-出版年制引用标签时,文中已经存在作者名的,标签只需要写年份,这个需要定义一个新的yearcite命令,是容易实现的,但这里没有实现。 + %这个问题解决了,2016-1114,增加了一个yearpagescite命令。 + + %\item backref的格式也可以修改一下。 + %没有要求处理,但修改了,2016-1114,修改英文本地化字符串为引用页面。 + + %\item shorthand的问题没有遇到,其应用可能需要进一步理解。,主要是获取参考文献的部分信息进行统计和打印。该问题已经解决,参见biblatex-solution-to-latex-bibliography(20180525)。 + + \item 当专著同时存在作者和编者的时候,GB/T 7714-2015没有明确的规定,所以目前样式文件中以biblatex标准样式的方式处理,这种处理因为与本地化相关,直接应用可能不好看的,也许需要修改。 + + \item 在各类文献的著录格式中,GB/T 7714-2015 对于出版项给出的就是出版地和出版者,但习惯上不同的类型还是存在差异的,比如专利文献出版项还应该再明确,比如在线资源常用organization表示而无出版地。这些有待进一步明确。 + + \item 当作者不明时,GB/T 7714-2015 给出的说法是用佚名和其它语言相应的词代替。英文给了一个例子是Anon,似乎是anonymity的缩写。这也有待进一步明确。v1.0l版后将之前用的noauthor换成Anon。 + + %\item 因为GB/T 7714-2015中给出的了一些著录格式,如果把这些著录格式作为一个严格标准,那么条目中只能出现其中规定的域,而往往在bib文件中可能存在一些另外的信息比如chapter等,而且从标准样式修改的驱动中也仍然带有这些域的处理,如果为了标准化规范化考虑,可以去掉国标中没有提到的域的信息,可能使得内容更为标准,这可以通过修改增加数据模型,数据源动态修改,驱动修改(驱动中目前存在较多的似乎用不到的域,而且意义不是非常明确,这个等到biblatex说明文档中文版完成后再结合它全面的进行梳理)三条路子做到,需要的话,可以在下一步实现(2017-0226)。添加了gbstrict选项后,该问题基本已经解决(20180525)。 +\end{enumerate} + +\subsection{下一步工作} + +\begin{enumerate} + \item 到1.0p版本,已经完全实现GB/T 7714-2015样式要求格式,并增加了更多的功能,剩下的问题主要是用户一些特殊需求实现以及可能存在的兼容性问题,需要广大用户发现和建议,非常感谢! + + %到目前,无论是基本功能还是附加功能,biblatex-gb7714-2015样式包已经基本够用,剩下的问题可能是一些特殊情况时带来的适应性问题,这需要经过大量的测试来发现问题。如果在使用过程中发现什么问题,请邮件联系作者,非常感谢! + + % 到1.0i版为止,进一步完善了: GB7714风格的文献表标签项对齐设计,编组内信息的中英文判断,特殊或老的bibtex 条目类型支持,改善空格设计以满足断行要求,支持了宏包选项(url等)应用,增加了宏包选项用于GB7714风格实现控制(gbpub 等),重新设计了版本兼容方式,以后的版本中将更容易兼容biblatex的升级。 + + %到1.0h版为止,进一步完善了样式宏包,该版本将是最后支持texlive2015的版本,以后版本的功能实现将基于最新texlive中biblatex 版本,而不再考虑texlive2015中3.0版的biblatex。 + + %1.0g版增加对mastersthesis,phdthesis,www,electronic,standard,techreport,conference,newspaper等条目类型的兼容,增加了对标准样式standard.bbx中url包选项的兼容性,增加了析出文献标识符//后面的短空格以支持著录表的断行机制,增加了特殊字符处理功能并实现对texlive2015 的兼容,给出了gb7714风格参考文献著录表文本转换为bib文件的perl脚本,与gb7714-2015 样式形成闭环。 + + %1.0f版完善了gbalign 选项(用于实现GB7714 风格的著录文献表标签,texlive2016 有效),带花括号的责任者的中英文判断等功能对texlive2015 的兼容性。 + + %到1.0e版为止,功能需求已经完全实现,剩下的问题可能是一些文献具有特殊信息或者特殊情况时带来的适应性问题,这需要经过大量的测试来发现问题。各位朋友如果发现什么问题,请邮件联系,作者会非常感谢! + + \item biblatex宏包的说明文档中文版,已经由Shen wenbo和我基本完成,下一步是完善,校对,以及增加新版的内容。如果有朋友觉得这个事情有意义,愿意一起来完成这个事情,非常欢迎,请email联系。 + + %\item 打算翻译biblatex宏包的说明文档和biber的说明文档,这个已经在进行中,完成了一部分,但因为只是业余时间做,可能最终完成的时间会比较长。如果有朋友觉得这个事情有意义,愿意一起来完成这个事情,非常欢迎,请email联系。 + +%\item 进一步完善上一节提到的问题。 +\end{enumerate} + +\section{更新历史} +\input{example/updatehistory.tex} % + +\input{example/updatehistoryold.tex} % + + +\end{document} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-map-test.bib b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-map-test.bib new file mode 100644 index 0000000000..a992cd3b13 --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-map-test.bib @@ -0,0 +1,114 @@ + +@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" +} + +@BOOK{Miroslav2003--, + AUTHOR = {Miroslav, D. L. and Dejan, V. T.}, + TRANSLATOR = {朱义胜 and 董辉}, + LANGUAGE = {chinese}, + LOCATION = {北京}, + PUBLISHER = {电子工业出版社}, + DATE = {2003-01}, + TITLE = {信号处理滤波器设计方法}, +} + +@ARTICLE{于潇2011-15-23, + AUTHOR = {于潇 and 刘义 and 柴跃廷 and others}, + DATE = {2011}, + JOURNALTITLE = {清华大学学报}, + NUMBER = {11}, + PAGES = {15--23}, + TITLE = {互联网药品可信交易环境中主体资质审核备案模式}, + VOLUME = {52}, +} + +@INBOOK{姚中秋2008--, + AUTHOR = {姚, 中秋}, + BOOKAUTHOR = {罗, 卫东 and 姚, 中秋}, + LOCATION = {杭州}, + PUBLISHER = {浙江大学出版社}, + BOOKTITLE = {中国转型的理论分析}, + DATE = {2008}, + PAGES = {44}, + TITLE = {一种制度变迁模式}, +} + +@Newspaper{张田勤2000--, + Title = {犯罪DNA库与生命伦理学计划}, + Author = {张田勤}, + year = {{2000-11-12}}, + Journaltitle = {大众科技报}, + Note = {news}, + Number = {7} +} + +@Www{萧钰2001--, + Title = {出版业信息化迈入快车道}, + Author = {萧钰}, + Url = {http://www.creader.com/news/20011219/200112190019.html}, + Urldate = {2002-04-15}, + Date = {2001-12-19} +} +@Patent{刘加林1993--, + Title = {多功能一次性压舌板}, + Author = {刘加林}, + year = {{1993-04-14}}, + Number = {92214985.2}, + Location = {中国发明专利} +} + +@PhdThesis{张若凌2004--, + Title = {高超声速非平衡流动的计算和实验研究}, + Author = {张若凌}, + School = {中国空气动力研究与发展中心}, + Year = {2004}, + Location = {绵阳} +} + + diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-map.py b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-map.py new file mode 100644 index 0000000000..ff6a76fbd7 --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex-map.py @@ -0,0 +1,2059 @@ +#!/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@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@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 diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex_check.py b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex_check.py new file mode 100644 index 0000000000..7493f8878c --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/biblatex_check.py @@ -0,0 +1,590 @@ +#!/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) diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/chinese-erj.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/chinese-erj.bbx new file mode 100644 index 0000000000..7a0646b562 --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/chinese-erj.bbx @@ -0,0 +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@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 }, + 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 表示各行起始位置 + % 到页边的距离 diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/chinese-erj.cbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/chinese-erj.cbx new file mode 100644 index 0000000000..7fd829a0ee --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/chinese-erj.cbx @@ -0,0 +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@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@textcite} +% {\usebibmacro{cite:init}} +% {\usebibmacro{citeindex}% +% \usebibmacro{textcite}} +% {} +% {\usebibmacro{textcite:postnote}\addspace} + +\newbibmacro*{textcite}{% + \iffieldequals{namehash}{\cbx@lasthash} + {\iffieldundef{shorthand} + {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND + \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)} + {\setunit{\addcomma}% + \usebibmacro{cite:extradate}} + {\setunit{\compcitedelim}% + \usebibmacro{cite:labeldate+extradate}% + \savefield{labelyear}{\cbx@lastyear}}} + {\setunit{\compcitedelim}% + \usebibmacro{cite:shorthand}% + \global\undef\cbx@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@lastyear}} + {\usebibmacro{cite:shorthand}% + \global\undef\cbx@lastyear}}% + \stepcounter{textcitecount}% + \savefield{namehash}{\cbx@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}}} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/example.bib b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/example.bib new file mode 100644 index 0000000000..56ce4a5794 --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/example.bib @@ -0,0 +1,3838 @@ +% Encoding: UTF-8 + + +@Other{易仕和,2013, + Entryset = {易仕和2013--,Yi2013--} +} + +@book{李时珍--, +author={李时珍} +} + +@book{乔纳斯--, +author={乔纳斯} +} + +@Book{昂温1988--, + Author = {昂温, S.}, +} + +@Book{GPS1988--, + Title = {外国出版史}, + Author = {{昂温, G} and {昂温, P S}}, + Publisher = {中国书籍出版社}, + Translator = {陈生诤}, + Year = {1988}, + Location = {北京} +} + +@Book{丸山敏秋--, + Author = {丸山敏秋}, +} + +@Book{凯西尔--, + Author = {凯西尔}, +} + +@book{Einstein--, + author = {Einstein, Albert} +} + +@book{Williams-ellis--, + author = {Williams-ellis, Amabel} +} + +@book{morgan--, + author = {De Morgan, Augustus} +} + +@book{lijianning--a, + author = {{LI Jiangning}} +} + +@book{lijianning--b, + author = {Li, Jiang Ning} +} + +@book{钱学森--, + author = {钱学森 and 刘再复} +} + +@book{李四光--, + author = {李四光 and 华罗庚 and 茅以升} +} + +@book{印森林--, + author = {印森林 and 吴胜和 and 李俊飞 and 冯文杰} +} + +@book{fordham--, + author = {Evenst W. Fordham and Amiad Ali and David A. Truner and John R. Charters} +} + +@Article{anon1981-628, + title = {Coffee drinking and cancer of the pancreas}, + journal = {Br Med J}, + year = {1981}, + volume = {283}, + number = {6292}, + pages = {628} +} + +@book{中国科学院物理研究所--, + author = {{中国科学院物理研究所}} +} + +@book{贵州省土穰普查办公室--, + author = {{贵州省土穰普查办公室}} +} + +@book{AmericanChemicalSociety--, + author = {{American Chemical Society}} +} + + +@book{StanfordUniversity--, + author = {{Stanford University. Department of Civil Eng ineering}} +} + + +@book{王夫之的诠释--, + title = {王夫之“乾坤并建”的诠释面向} +} + +@book{张子正蒙注--, + title = {张子正蒙注} +} + +@book{化学动力学和反应器原理--, + title = {化学动力学和反应器原理} +} + +@book{袖珍神学--, + title = {袖珍神学,或,简明基督教词典} +} + +@article{北京师范大学学报--, + Journaltitle = {北京师范大学学报(自然科学版)} +} + +@book{Gasesinsea--, + title = {Gases in sea ice 1975-1979} +} + +@article{jmath--, + Journaltitle = {J Math \& Phys} +} + +@book{为人民服务--, + title = {为人民服务;纪念白求恩;愚公移山} +} + +@book{编者1964--, + title = {为人民服务;纪念白求恩;愚公移山}, + address= {北京}, + publisher={人民出版社}, + date ={1964}, + pages= {1-3;7-11;31-35} +} + +@book{大趋势--, + title = {大趋势} +} + +@book{地壳运动--, + title = {地壳运动假说:从大陆漂移到板块构造} +} + +@book{三松堂--, + title = {三松堂全集:第4卷} +} + +@book{世界出版业--, + title = {世界出版业:美国卷} +} + +@book{ECL集成电路--, + title = {ECL集成电路:原理与设计} +} + +@book{中国科学技术史--, + title = {中国科学技术史:第2卷~~~~科学思想史} +} + +@article{商鞅战秋菊--, + title = {商鞅战秋菊:法治转型的一个思想实验} +} + +@article{中国科学--, + title = {中国科学:D辑~~~~地球科学} +} + +@Standard{信息与文献--, + title = {信息与文献---都柏林核心元数据元素集:GB/T 25100—2010} +} + +@Standard{全国信息与文献标准化技术委员会2010-2-3, + author = {全国信息与文献标准化技术委员会}, + title = {信息与文献\ \ \ \ 都柏林核心元数据元素集: GB/T 25100—2010}, + year = {2010}, + address = {北京}, + pages = {2--3}, + publisher = {中国标准出版社}, +} + +@report{中子反射--, + title = {中子反射数据分析技术:CNIC-01887} +} + +@article{AsianPacificjournal--, + Journaltitle = {Asian Pacific journal of eancer prevention: e-only} +} + + +@book{egbookeda--, + title = {中文书}, + edition={3} +} + +@book{egbookedb--, + title = {中文书}, + edition={新1版} +} + +@book{egbookedc--, + title = {中文书}, + edition={明刻本} +} + +@book{egbookedd--, + title = {english book}, + edition={5} +} + +@book{egbookede--, + title = {english book}, + edition={Rev. ed.} +} + +@book{egbookpuba--, + title = {中文书}, + date = {2013}, + address = {北京}, + publisher = {人民出版社}, +} + +@book{egbookpubb--, + title = {english book}, + date = {2012}, + address = {New York}, + publisher = {Academic Press}, +} + +@book{egbookpubaddressa--, + title = {english book}, + address = {Cambridge, Eng.}, + publisher = {Academic Press}, +} + +@book{egbookpubaddressb--, + title = {english book}, + address = {Cambridge, Mass.}, + publisher = {Academic Press}, +} + +@book{egbookpubaddressc--, + title = {中文书}, + date = {2013}, + address = {北京 and 上海}, + publisher = {科学出版社}, +} + +@book{egbookpubaddressd--, + title = {english book}, + date = {2000}, + address = {London and Boston and Durban and Syngapore and Sydney and Toronto and Wellington}, + publisher = {Butterworths}, +} + +@book{egbookpubaddresse--, + title = {中文书}, + date = {1990}, + publisher = {三户图书刊行社}, +} + +@book{egbookpubaddressf--, + title = {english book}, + date = {1975}, + publisher = {MacMillan}, +} + +@online{egbookpubaddressg--, + date = {2011}, + pages ={105}, + url={http://lib.myilibrary.com/Open.aspx?id=312377}, + urldate={2014-06-16}, + publisher = {Open University Press}, +} + + + +@book{egbookpubpublishera--, + title = {中文书}, + address = {北京}, + publisher = {中国标准出版社}, +} + +@book{egbookpubpublisherb--, + title = {english book}, + address = {Cambridge}, + publisher = {Elsevier Science Publishers}, +} + +@book{egbookpubpublisherc--, + title = {english book}, + address = {Cambridge}, + publisher = {IRRI}, +} + +@book{egbookpubpublisherd--, + title = {english book}, + address = {Chicago}, + publisher = {ALA and CLA}, + date ={1978} +} + +@book{egbookpubpublishere--, + title = {中文书}, + address = {哈尔滨}, + date ={2013} +} + +@book{egbookpubpublisherf--, + title = {english book}, + address = {Salt Lake City}, + date ={1964} +} + + +@book{egbookpubdatea--, + title = {中文书}, + year ={1947(民国三十六年)} +} + +@book{egbookpubdateb--, + title = {中文书}, + year ={1705(康熙四十四年)} +} + +@newspaper{egbookpubdatec--, + title = {中文书}, + date ={2013-01-08} +} + +@book{egbookpubdated--, + title = {中文书}, + year ={c1988} +} + +@book{egbookpubdatee--, + title = {中文书}, + year ={1985印刷} +} + +@book{egbookpubdatef--, + title = {中文书}, + year ={[1936]} +} + + +@online{egbookpubdateg--, + title = {english book}, + date = {2012-05-03}, + urldate={2013-11-12}, +} + +@Book{曹凌2011-19-, + author = {曹凌}, + title = {中国佛教疑伪经综录}, + year = {2011}, + publisher = {上海古籍出版社}, + address = {上海}, + pages ={19} +} + +@Book{钱学森2001--, + author = {钱学森}, + title = {创建系统学}, + year = {2001}, + publisher = {山西科学技术出版社}, + address = {太原}, + pages ={序2-3} +} + +@Book{冯友兰2008--, + author = {冯友兰}, + title = {冯友兰自选集}, + year = {2008}, + publisher = {北京大学出版社}, + address = {北京}, + edition ={2}, + pages ={第1版自序} +} + +@inbook{李约瑟1991--, + author = {李约瑟}, + title = {题词}, + bookauthor = {苏克福 and 管成学 and 邓明鲁}, + booktitle = {苏颂与《本草图经》研究}, + year = {1991}, + publisher = {长春出版社}, + address = {长春}, + pages = {扉页} +} + +@ARTICLE{DUBAR2013--, + author = {DUBAR, K L. AND MITCHELL, D A.}, + title = {Revealing nature's synthetic potential through the study of ribosomal natural product biosynthesis}, + Journaltitle = {ACS chemical biology}, + DATE = {2013}, + VOLUME = {8}, + pages = {473-487}, + url = {http://pubs.acs.org/doi/pdfplus/10.1021/cb3005325}, + urldate = {2013-10-16} +} + +@Book{周鲁卫2011--, + author = {周鲁卫}, + title = {软物质物理导论}, + year = {2011}, + publisher = {复旦大学出版社}, + address = {上海}, + pages = {1} +} + +@ARTICLE{常森2013--, + author = {常森}, + title = {《五行》学说与《荀子》}, + Journaltitle = {北京大学学报(哲学社会科学版)}, + DATE = {2013}, + VOLUME = {50}, + number = {1}, + pages = {75}, +} + +@Book{RUDDOCK2009--, + author = {RUDDOCK, L.}, + title = {Economics for the modern built environment}, + year = {2009}, + publisher = {Taylor & Francis}, + address = {London}, + pages = {12}, + url = {http://lib.mylib.com}, + urldate = {2010-06-15}, +} + +@book{kereanrefa, + AUTHOR = {김세훈 and others}, + TITLE = { 도서판및특서진흥업 개정안 연구}, + DATE = {2003}, + address={서울}, + PAGES = {15}, + publisher = {한국운화관팡정책연구원}, +} +%%김세훈, 외. 도서판및특서진흥업 개정안 연구〔M〕, 서울; 한국운화관팡정책연구원,2003: 15. + + +@book{kereanrefb, + AUTHOR = {이냉목 }, + TITLE = { 도서관꺾규총람: 세 1 권}, + DATE = {2005}, + address={서울}, + PAGES = {67-68}, + publisher = {구미무역 출판부}, +} +%%이냉목 도서관꺾규총람: 세 1 권[M〕. 서울: 구미무역 출판부,2005: 67-68. +%% + +@Book{李炳穆2005--, + author = {李炳穆}, + title = {图书馆法柜总览:第1卷}, + year = {2005}, + publisher = {九美贸易出版部}, + address = {首尔}, + pages = {67-68} +} + + +@article{kereanrefc, + DATE = {2007}, + volume={48}, + number={7}, + PAGES = {11-12}, + journaltitle={ 圖書館文化}, + TITLE = {도서관 정보정책위원회 설립식 및 도서관 정보정책기획단신성}, +} +%%도서관 정보정책위원회 설립식 및 도서관 정보정책기획단신성. 圖書館文化,2007 ,48(7): 11-12. + +@ARTICLE{图书馆信息政策委员会2007--, + title = {图书馆信息政策委员会成立仪式与图书馆信息政策规划团}, + Journaltitle = {图书馆文化}, + DATE = {2007}, + VOLUME = {48}, + number = {7}, + pages = {11-12}, +} + +@book{japaneserefc, + AUTHOR = {図書館用語辞典編集委員会}, + TITLE = { 最新図書館用語大辞典}, + DATE = {2004}, + address={東京}, + PAGES = {154}, + publisher = {柏書房株式会社}, +} +%% +%%図書館用語辞典編集委員会.最新図書館用語大辞典[M].東京:柏書房株式会社,2004:154. +%% + +@article{russianrefc, + author={Кочекоs, А Я}, + TITLE = {Молибден-медно-эолотопорфиооое месторождение Рябиноосе}, + DATE = {1993}, + number={7}, + PAGES = {50-58}, + journaltitle={ Отечестsенная гелогия} +} +%%Кочекоs А Я. Молибден-медно-эолотопорфиооое месторождение Рябиноосе[J/ОL]. ,1993(7):50-58 + +@ARTICLE{熊平2005--, + author = {熊平 and 吴颉}, + title = {从交易费用的角度谈如何构建药品流通的良性机制}, + Journaltitle = {中国物价}, + DATE = {2005}, + number = {8}, + pages = {42-45}, +} + +@ARTICLE{xiong2005--, + author = {Xiong, Ping and Wu, Xie}, + title = {Discussion on how to construct benign medicine circulantion mechanism fromtranaction cosperspective}, + Journaltitle = {China price}, + DATE = {2005}, + number = {8}, + pages = {42-45}, +} + +@ARTICLE{上海市食品药品监督管理局课题组2008--, + author = {上海市食品药品监督管理局课题组}, + title = {互联网药品经营现状和监管机制的研究}, + Journaltitle = {上海食品药品监管情报研究}, + DATE = {2008}, + number = {1}, + pages = {8-11}, +} + +@ARTICLE{Rgsfda2008--, + author = {{Research Group of Shanghai Food and Drug Administration}}, + title = {A study on online pharmaceutical operating situation and supervision mechanism}, + Journaltitle = {Shanghai food and drug information research}, + DATE = {2008}, + number = {1}, + pages = {8-11}, +} + + +@PhdThesis{刘乃安2000-17-18, + author = {刘乃安}, + title = {生物质材料热解失重动力学及其分析方法研究}, + year = {2000}, + pages = {17--18}, + doi = {10.7666/d.y351065}, + url = {http://wenku.baidu.com/link?url=GJDJxb4lxBUXnIPmq1XoEGSIr1H8TMLbidW_LjlYu33tpt707u62rKliypU_FBGUmox7ovPNaVIVBALAMd5yfwuKUUOAGYuB7cuZ-BYEhXa}, + urldate = {2014-08-29}, + address = {安徽}, + school = {中国科学技术大学}, +} + +@book{Deverell2013-21-22, + author = {Deverell, William and Igler, David}, + title = {A Companion to {California} History}, + year = {2013}, + date = {2013-11-15}, + pages = {21--22}, + doi = {10.1002/9781444305036.ch2}, + url = {http://onlinelibrary.wiley.com/doi/10.1002/9781444305036.ch2/summary}, + urldate = {2014-06-24}, + address = {New York}, + school = {John Wiley \& Sons}, +} + +@inbook{姚中秋2009--, + author = {姚中秋}, + title = {作为一种制度变迁模式的“转型”}, + bookauthor = {罗卫东 and 姚中秋}, + booktitle = {中国转型的理论分析:奥地利学派的视角}, + year = {2009}, + publisher = {浙江大学出版社}, + address = {杭州}, + pages = {44} +} + +@inbook{姚中秋2008--, + author = {姚中秋}, + title = {一种制度变迁模式}, + bookauthor = {罗, 卫东 and 姚, 中秋}, + booktitle = {中国转型的理论分析}, + year = {2008}, + publisher = {浙江大学出版社}, + address = {杭州}, + pages = {44} +} + + +@ARTICLE{关立哲2014--, + author = {关立哲 and 韩纪富 and 张晨延}, + title = {科技期刊编辑审读中要注重比较思维的科学运用}, + Journaltitle = {编辑学报}, + DATE = {2014}, + VOLUME = {26}, + number = {2}, + pages = {144-146} +} + +@ARTICLE{TENOPIR1987--, + author = {TENOPIR, C.}, + title = {Online databases, quality control}, + Journaltitle = {Library journal}, + DATE = {1987}, + VOLUME = {113}, + number = {2}, + pages = {124-125} +} + +@ARTICLE{egdatevolnumpagea--, + title = {article of journal}, + DATE = {2001}, + VOLUME = {1}, + number = {1}, + pages = {5-6} +} + +@ARTICLE{egdatevolnumpageb--, + title = {article of journal}, + DATE = {2014}, + VOLUME = {510}, + pages = {356-363} +} + +@ARTICLE{egdatevolnumpagec--, + title = {article of journal}, + DATE = {2010}, + number = {6}, + pages = {23} +} + +@ARTICLE{egdatevolnumpaged--, + title = {article of journal}, + DATE = {2012}, + VOLUME = {22}, + number = {增刊2}, + pages = {81-86} +} + +@ARTICLE{egdatevolnumpagee--, + title = {article of journal}, + DATE = {2001}, + number = {9/10}, + pages = {36-39} +} + +@ARTICLE{egdatevolnumpagef--, + title = {article of journal}, + year = {2011, 33(2):20-25;2011, 33(3):26-30}, +} + +@newspaper{egdatevolnumpageg--, + title = {article of journal}, + date = {2013-03-16}, + number = {1} +} + + +@Book{尼葛洛庞帝1996--, + author = {尼葛洛庞帝}, + title = {数字化生存}, + year = {1996}, + translator = {胡泳 and 范海燕}, + publisher = {海南出版社}, + address = {海口}, +} + +@Book{汪冰1997-16-16, + author = {汪冰}, + title = {电子图书馆理论与实践研究}, + year = {1997}, + publisher = {北京图书馆出版社}, + pages = {16}, + address = {北京}, +} + +@Article{杨宗英1996-24-29, + author = {杨宗英}, + title = {电子图书馆的现实模型}, + journal = {中国图书馆学报}, + year = {1996}, + number = {2}, + pages = {24--29}, +} + +@Book{Baker1995--, + author = {Baker, S K and Jackson, M E}, + title = {The future of resource sharing}, + year = {1995}, + publisher = {The Haworth Press}, + address = {New York}, +} + +@Book{Chernik1982--, + author = {Chernik, B E}, + title = {Introduction to library services for library technicians}, + year = {1982}, + publisher = {Libraries Unlimited, Inc.}, + address = {Littleton, Colo.}, +} + + +@Article{Dowler1995-5-26, + author = {Dowler, L}, + title = {The research university’s dilemma: resource sharing and research in a transinstitutional environment}, + journal = {Journal of library administration}, + year = {1995}, + volume = {21}, + number = {1/2}, + pages = {5--26}, +} + + +@Inproceedings{ref-replace-char, + Title = {Cognitive Radio and Cooperative Strategies for Power Saving in Multi-Standard Wireless Devices}, + Address = {Florence, Italy}, + Author = {Rodriguez, J. and P. Marques and A. Radwan and K. Moessner and R. Tafazolli and others}, + Booktitle = {Future % Network \& Mobile # Summit 2010}, + Date = {June 2010} +} + +@Online{olnoauthorcn, + Title = {如何在LaTeX写作中管理参考文献?}, + Date = {2016-08-12}, + Url = {http://www.latexstudio.net/archives/7131} +} + +@Online{Allianceurlonly, + Url = {www.wimedia.org} +} + +@Online{olnoauthoren, + Title = {Dublin Core metadata element set: version 1.1}, + Url = {http://dublincore.org}, + Urldate = {2014-06-11}, + Year = {2012-06-14} +} + +@Article{王临慧2010-147, + author = {王临慧 and others}, + title = {天津方言的源流关系刍议}, + journal = {山西师范大学学报(社会科学版)}, + year = {2010}, + volume = {37}, + number = {4}, + pages = {147}, +} + + +@InProceedings{王临慧2010-138, + author = {王临慧}, + title = {从几组声母的演变看天津方言形成的自然条件和历史条件}, + bookauthor= {曹志耘}, + booktitle = {汉语方言的地理语言学研究:首届中国地理语言学国际学术研讨会论文集}, + year = {2010}, + publisher = {北京语言大学出版社}, + pages = {138}, + address = {北京}, +} + +@Book{王夫之1845--, + Title = {宋论}, + Author = {王夫之}, + Edition = {刻本}, + Publisher = {曾氏}, + Year = {1845(清同治四年)}, + Location = {金陵} +} + +@Book{汪昂1881--, + Title = {增订本草备要:四卷}, + Address = {京都}, + Author = {汪昂}, + Edition = {刻本}, + Publisher = {老二酉堂}, + Year = {1881(清光绪七年)}, + Location = {京都} +} + +@Periodical{AAAS1883--, + Title = {Science}, + Date = {1883}, + Editor = {{American Association for the Advancement of Science}}, + Number = {1}, + Volume = {1}, + Location = {Washington, D.C.}, + Publisher = {American Association for the Advancement of Science} +} + +@Book{汪昂1912--, + Title = {(增补)本草备要}, + Author = {汪昂}, + Edition = {石印本}, + Publisher = {同文书局}, + Year = {1912}, + Location = {上海} +} + +@Periodical{中国地质学会1936--, + Title = {地质评论}, + Date = {1936}, + Editor = {中国地质学会}, + Number = {1}, + Volume = {1}, + Location = {北京}, + Publisher = {地质出版社} +} + + +@Book{1962-50-50, + Title = {康熙字典:已集上:水部}, + Address = {北京}, + Edition = {同文书局影印本}, + Pages = {50}, + Publisher = {中华书局}, + Year = {1962} +} + +@Proceedings{ROSENTHALL1963--, + Title = {Proceedings of the Fifth Canadian Mathematical Congress, University of Montreal, 1961}, + Date = {1963}, + Publisher = {University of Toronto Press}, + Editor = {E M ROSENTHALL}, + Location = {Toronto} +} + +@Thesis{CALMS1965--, + Title = {Infrared spectroscopic studies on solid oxygen}, + Author = {R B CALMS}, + Date = {1965}, + Institution = {Univ. of California}, + Location = {Berkeley} +} + +@Report{WHO1970--, + Title = {Factors regulating the immune response}, + Author = {{World Health Organization}}, + Date = {1970}, + Institution = {WHO}, + Location = {Geneva}, + Titleaddon = {report of WHO Scientific Group} +} + +@Inproceedings{FOURNEY1971-17-38, + Title = {Advances in holographic photoelasticity}, + Author = {M E FOURNEY}, + Booktitle = {Symposium on Applications of Holography in Mechanics, August 23-25, 1971, University of Southern California, Los Angeles, California}, + year = {c1971}, + Pages = {17-38}, + Publisher = {ASME}, + Location = {New York} +} + +@Inproceedings{FOURNEY1971-17-38a, + Title = {Advances in holographic photoelasticity}, + Author = {M E FOURNEY}, + Bookauthor = {{American Society of Mechanical Engineers.Applied Mechanics Division}}, + Booktitle = {Symposium on Applications of Holography in Mechanics, August 23-25, 1971. University of Southern California, Los Angeles, California}, + Date = {1971}, + Pages = {17-38}, + Publisher = {ASME}, + Location = {New York} +} + +@TechReport{Humphrey1971--, + Title = {The sonic throat method and real gas one-dimensional flow: an application to air and nitrogen}, + Author = {Humphrey, Richard L. and Wagner, Jerry L.}, + Year = {1971}, + Number = {730029}, + Type = {AD} +} + +@Book{CRANE1972--, + Title = {Invisible college}, + Author = {D. Crane}, + Date = {1972}, + Publisher = {Univ. of Chicago Press}, + Location = {Chicago} +} + + + +@Article{KENNEDY1975-311-386, + Title = {Morphology and genesis of nodular chalks and hardgrounds in the Upper + Cretacesous of southern England}, + Author = {W. J. KENNEDY and R. E. GARRISON}, + Date = {1975}, + Journaltitle = {Sedimentology}, + Pages = {311-386}, + Volume = {22} +} + +@Article{KENNEDY1975-339-360, + Title = {Morphology and genesis of nodular phosphates in the cenomanian of South-east England}, + Author = {W. J. KENNEDY and R. E. GARRISON}, + Date = {1975}, + Journaltitle = {Lethaia}, + Pages = {339-360}, + Volume = {8} +} + +@Inbook{1977-49-49, + Title = {宋史卷三:本纪第三}, + Address = {北京}, + Booktitle = {宋史:第1册}, + Pages = {49}, + Publisher = {中华书局}, + Year = {1977} +} + +@Book{IFLAI1977--, + Title = {Names of persons: national usages for entry in catalogues}, + Author = {{International Federation of Library Association and Institutions}}, + Edition = {3}, + Publisher = {IFLA International Office for UBC}, + Year = {1977}, + Location = {London} +} + + +@InProceedings{张忠智1997-33-34, + author = {张忠智}, + title = {科技书刊的总编(主编)的角色要求}, + booktitle = {中国科学技术期刊编辑学会建会十周年学术研讨会论文汇编}, + year = {1997}, + editor = {中国科学技术期刊编辑学会}, + publisher = {中国科学技术期刊编辑学会学术委员会}, + pages = {33--34}, + address = {北京}, +} + +@Book{中国社会科学院语言研究所词典编辑室1996--, + author = {中国社会科学院语言研究所词典编辑室}, + title = {现代汉语词典}, + year = {1996}, + edition = {修订本}, + publisher = {商务印书馆}, + address = {北京}, +} + + +@Article{刘彻东1998-38-39, + Title = {中国的青年刊物}, + Author = {刘彻东}, + Date = {1998}, + Journaltitle = {中国出版}, + Number = {5}, + Pages = {38-39}, + Titleaddon = {个性特色为本} +} + +@InProceedings{裴丽生1981-2-10, + author = {裴丽生}, + title = {在中国科协学术期刊编辑工作经验交流会上的讲话}, + booktitle = {中国科协学术期刊编辑工作经验交流会资料选}, + year = {1981}, + editor = {中国科学技术协会}, + publisher = {中国科学技术协会学会工作部}, + pages = {2--10}, + address = {北京}, +} + + +@Article{亚洲地质图编目组1978-194-208, + Title = {亚洲地层与地质历史概述}, + Author = {亚洲地质图编目组}, + Date = {1978}, + Journaltitle = {地质学报}, + Pages = {194-208}, + Volume = {3} +} + +@Inbook{BUSECK1980-117-211, + Title = {Subsolidus phenomena in pyroxenes}, + Author = {P R BUSECK and NORD, Jr., G L and D R VEBLEN}, + Bookauthor = {CT PREWITT}, + Booktitle = {Pyroxense}, + year = {c1980}, + Pages = {117-211}, + Publisher = {Mineralogical Society of America}, + Location = {Washington, D.C.} +} + +@Inbook{陈晋镳1980-56-114, + Title = {蓟县震旦亚界研究}, + Author = {陈晋镳 and 张惠民 and 朱士兴 and others}, + Bookauthor = {中国地质科学院天津地质矿产研究所}, + Booktitle = {中国震旦亚界}, + Pages = {56-114}, + Publisher = {天津科学出版社}, + Location = {天津}, + Year = {1980} +} + +@Article{Sunstein1996-903-903, + author = {Sunstein, Cass R.}, + title = {Social Norms and Social Roles}, + journal = {Columbia law review}, + year = {1996}, + volume = {96}, + pages = {903}, + url = {http://www.heinonline.org/HOL/Page?handle=hein.journals/clr96&id=913&collection=journals&index=journals/clr}, + urldate = {2012-01-26}, +} + +@Book{罗杰斯2011-15-16, + author = {罗杰斯}, + title = {西方文明史: 问题与源头}, + year = {2011}, + translator = {潘惠霞 and 魏婧 and 杨艳 and others}, + publisher = {东北财经大学出版社}, + pages = {15--16}, + address = {大连}, +} + +@Book{陈登原2000-29-29, + author = {陈登原}, + title = {国史旧闻: 第1卷}, + year = {2000}, + publisher = {中华书局}, + pages = {29}, + address = {北京}, +} + +@Book{哈里森沃尔德伦2012-235-236, + author = {哈里森·沃尔德伦}, + title = {经济数学与金融数学}, + year = {2012}, + translator = {谢远涛}, + publisher = {中国人民大学出版社}, + pages = {235--236}, + address = {北京}, +} + +@Book{北京市政协民族和宗教委员会2012-112-112, + author = {北京市政协民族和宗教委员会 and 北京联合大学民族与宗教研究所}, + title = {历代王朝与民族宗教}, + year = {2012}, + publisher = {民族出版社}, + pages = {112}, + address = {北京}, +} + + +@Book{徐光宪2010--, + author = {徐光宪 and 王祥云}, + title = {物质结构}, + year = {2010}, + publisher = {科学出版社}, + address = {北京}, +} + +@Book{顾炎武1992--, + author = {顾炎武}, + title = {昌平山水记:京东考古录}, + year = {1992}, + publisher = {北京古籍出版社}, + address = {北京}, +} + +@Book{王夫之1865--, + author = {王夫之}, + title = {宋论}, + year = {1865(清同治四年)}, + edition = {刻本}, + publisher = {湘乡曾国荃}, + address = {金陵}, +} + +@Proceedings{牛志明2012--, + title = {综合湿地管理国际研讨会论文集}, + year = {2012}, + editor = {牛志明 and 斯温兰德 and 雷光春}, + publisher = {海洋出版社}, + address = {北京}, +} + +@Archive{中国第一历史档案馆2001--, + author = {中国第一历史档案馆 and 辽宁省档案馆}, + title = {中国明朝档案总汇}, + year = {2001}, + address = {桂林}, + publisher = {广西师范大学出版社}, +} + +@PhdThesis{杨保军2012--, + author = {杨保军}, + title = {新闻道德论}, + year = {2010}, + url = {http://apabi.lib.pku.edu.cn/usp/pku/pub.mvc?pid=book.detail&metaid=m.20101104-BPO-889-1023&cult=CN}, + urldate = {2012-11-01}, + address = {北京}, + publisher = {中国人民大学出版社}, +} + +@Book{赵学功2001--, + author = {赵学功}, + title = {当代美国外交}, + year = {2001}, + publisher = {社会科学文献出版社}, + url = {http://www.cadal.zju.edu.cn/book/trySinglePage/33023884/1}, + urldate = {2014-06-11}, + address = {北京}, +} + +@Book{同济大学土木工程防灾国家重点实验室2011-5-6, + author = {同济大学土木工程防灾国家重点实验室}, + title = {汶川地震灾害研究}, + year = {2011}, + publisher = {同济大学出版社}, + pages = {5--6}, + url = {http://apabi.lib.pku.edu.cn/usp/pku/pub.mvc?pid=book.detail&metaid=m.20120406-YPT-889-0010}, + urldate = {2013-05-09}, + address = {上海}, +} + +@Book{中国造纸学会2003--, + author = {中国造纸学会}, + title = {中国造纸年鉴: 2003}, + year = {2003}, + publisher = {中国轻工业出版社}, + url = {http://www.cadal.zju.edu.cn/book/view/25010080}, + urldate = {2014-04-25}, + address = {北京}, +} + + +@Proceedings{Yufin2000--, + title = {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}}, + year = {2000}, + editor = {Yufin, Sergey A}, + publisher = {A. A. Balkema}, + address = {Rotterdam}, +} + +@Book{Baldock2011-105-105, + author = {Baldock, Peter}, + title = {Developing early childhood services: past, present and future}, + year = {2011}, + publisher = {Open University Press}, + pages = {105}, + url = {http://lib.myilibrary.com/Open.aspx?id=312377}, + urldate = {2012-11-27}, +} + +@Book{Fan2013-25-26, + author = {Fan, Xuetong and Sommers, Christopher H.}, + title = {Food irradiation research and technology}, + year = {2013}, + edition = {2}, + publisher = {Blackwell Publishing}, + pages = {25--26}, + url = {http://onlinelibrary.wiley.com/doi/10.1002/9781118422557.ch2/summary}, + urldate = {2014-06-26}, + address = {Ames, Iowa}, +} + + +@Inbook{王夫之2011-1109-1109, + title = {周易外传:卷 5}, + booktitle = {船山全书}, + year = {2011}, + editor = {王夫之}, + number = {6}, + publisher = {岳麓书社}, + pages = {1109}, + address = {长沙}, +} + +@Inbook{程根伟1999-32-36, + author = {程根伟}, + title = {1998 年长江洪水的成因与减灾对策}, + booktitle = {长江流域洪涝灾害与科技对策}, + year = {1999}, + editor = {许厚泽 and 赵其国}, + publisher = {科学出版社}, + pages = {32--36}, + address = {北京}, +} + +@Inbook{陈晋镳1980-56-114a, + author = {陈晋镳 and 张惠民 and 朱士兴 and 赵震 and 王振刚}, + title = {蓟县震旦亚界研究}, + booktitle = {中国震旦亚界}, + year = {1980}, + editor = {中国地质科学院天津地质矿产研究所}, + publisher = {天津科学技术出版社}, + pages = {56--114}, + address = {天津}, +} + +@Inbook{马克思2013-302-302, + author = {马克思}, + title = {政治经济学批判}, + booktitle = {马克思恩格斯全集}, + year = {2013}, + editor = {马克思 and 恩格斯}, + volume = {35}, + publisher = {人民出版社}, + pages = {302}, + address = {北京}, +} + + + + + +@InProceedings{贾东琴2011-45-52, + author = {贾东琴 and 柯平}, + title = {面向数字素养的高校图书馆数字服务体系研究}, + booktitle = {中国图书馆学会年会论文集: 2011年卷}, + year = {2011}, + editor = {中国图书馆学会}, + publisher = {国家图书馆出版社}, + pages = {45--52}, + address = {北京}, +} + +@Inbook{Weinstein1974-745-772, + author = {Weinstein, L and Swertz, M N}, + title = {Pathogenic properties of invading microorganism}, + booktitle = {Pathologic physiology: mechanisms of disease}, + year = {1974}, + editor = {Sodeman, Jr., William A and Sodeman, William A}, + publisher = {Saunders}, + pages = {745--772}, + address = {Philadelphia}, +} + +@InBOOK{Roberson2011-1-36, + author = {Roberson, J. Alan and Burneson, Eric G.}, + title = {Drinking water standards, regulations and goals}, + booktitle = {Water quality \& treatment: a handbook on drinking water}, + year = {2011}, + editor = {{American Water Works Association}}, + edition = {6}, + publisher = {McGraw-Hill}, + pages = {1.1--1.36}, + url = {http://lib.myilibrary.com/Open.aspx?id=291430}, + urldate = {2012-12-10}, + address = {New York}, +} + +@Periodical{中华医学会湖北分会1984----, + title = {临床内科杂志}, + year = {1984}, + volume = {1}, + number = {1}, + address = {武汉}, + author = {中华医学会湖北分会}, + publisher = {中华医学会湖北分会}, +} + +@Periodical{中国图书馆学会1957--1990--, + title = {图书馆学通讯}, + year = {1957/1990}, + number = {1-4}, + address = {北京}, + author = {中国图书馆学会}, + publisher = {北京图书馆}, +} + +@Periodical{中国图书馆学会1957--, + Title = {图书馆学通信}, + Address = {北京}, + Date = {1957/1990}, + Editor = {中国图书馆学会}, + Institution = {北京图书馆}, + Number = {1-4} +} + +@Periodical{中国图书馆学会1957a--, + Title = {图书馆学通信}, + Date = {1957/1990}, + Editor = {中国图书馆学会}, + Institution = {北京图书馆}, + Number = {1-4} +} + +@Periodical{中国图书馆学会1957b--, + Title = {图书馆学通信}, + Address = {北京}, + Date = {1957/1990}, + Editor = {中国图书馆学会}, + Number = {1-4} +} + +@Periodical{中国图书馆学会1957c--, + Title = {图书馆学通信}, + Date = {1957/1990}, + Editor = {中国图书馆学会}, + Number = {1-4} +} + +@Periodical{AAAS1883----, + title = {Science}, + year = {1883}, + volume = {1}, + number = {1}, + address = {Washington, D.C.}, + author = {{American Association for the Advancement of Science}}, + publisher = {American Association for the Advancement of Science}, +} + + +@Article{袁训来2012-3219-3219, + author = {袁训来 and 陈哲 and 肖书海 and others}, + title = {蓝田生物群: 一个认识多细胞生物起源和早期演化的新窗口}, + journal = {科学通报}, + year = {2012}, + volume = {55}, + number = {34}, + pages = {3219}, +} + +@Newspaper{余建斌2013--, + author = {余建斌}, + date = {2013-01-12}, + journal = {人民日报}, + number = {2}, + title = {我们的科技一直在追赶: 访中国工程院院长周济}, + url = {http://paper.people.com.cn/rmrb/html/2013-01/12/nw.D110000renmrb_20130112_5-02.htm}, + urldate = {2013-03-20}, + year = {2013}, +} + +@Article{李炳穆2008-6-12, + author = {李炳穆}, + title = {韩国图书馆法}, + journal = {图书情报工作}, + year = {2008}, + volume = {52}, + number = {6}, + pages = {6--12}, + url = {http://www.docin.com/p-400265742.html}, + urldate = {2013-10-25}, +} + +@Article{李幼平2010-225-228, + author = {李幼平 and 王莉}, + title = {循证医学研究方法: 附视频}, + journal = {中华移植杂志(电子版)}, + year = {2010}, + volume = {4}, + number = {3}, + pages = {225--228}, + url = {http://www.cqvip.com/Read/Read.aspx?id=36658332}, + urldate = {2014-06-09}, +} + +@Article{武丽丽2008-8-9, + author = {武丽丽 and 华一新 and 张亚军 and others}, + title = {“北斗一号”监控管理网设计与实现}, + journal = {测绘科学}, + year = {2008}, + volume = {33}, + number = {5}, + pages = {8--9}, + doi = {10.3771/j.issn.1009-2307.2008.05.002}, + url = {http://vip.calis.edu.cn/CSTJ/Sear.dll?OPAC_CreateDetail}, + urldate = {2009-10-25}, +} + +@Article{Kanamori1998-2063-2063, + author = {Kanamori, H}, + title = {Shaking without quaking}, + journal = {Science}, + year = {1998}, + volume = {279}, + number = {5359}, + pages = {2063}, +} + +@Article{Caplan1993-61-66, + author = {Caplan, P}, + title = {Cataloging internet resources}, + journal = {The public access computer systems review}, + year = {1993}, + volume = {4}, + number = {2}, + pages = {61--66}, +} + +@Article{Frese2013-378-398, + author = {Frese, Karen S. and Katus, Hugo A. and Meder, Benjamin}, + title = {Next-generation sequencing: from understanding biology to personalized medicine}, + journal = {Biology}, + year = {2013}, + volume = {2}, + number = {1}, + pages = {378--398}, + doi = {10.3390/biology2010378}, + url = {http://www.mdpi.com/2079-7737/2/1/378}, + urldate = {2013-03-19}, +} + +@Article{Myburg2014-356-362, + author = {Myburg, Alexander A. and Grattapaglia, Dario and Tuskan, Gerald A. and others}, + title = {The genome of Eucalyptus grandis}, + journal = {Nature}, + year = {2014}, + date = {2014-06-19}, + volume = {510}, + pages = {356--362}, + doi = {10.1038/nature13308}, + url = {http://www.nature.com/nature/journal/v510/n7505/pdf/nature13308.pdf}, + urldate = {2014-06-25}, +} + +@Patent{邓一刚2006--, + author = {邓一刚}, + title = {全智能节电器}, + number = {200610171314.3}, + year = {2006}, + date = {2006-12-13}, +} + +@Patent{西安电子科技大学2002--, + author = {西安电子科技大学}, + title = {光折变自适应光外差探测方法}, + number = {01128777.2}, + year = {2002}, + date = {2002-03-06}, + url = {http://211.152.9.47/sipoasp/zljs/hyjs-yx-new.asp?recid=01128777.2&leixin=0}, + urldate = {2002-05-28}, +} + +@Patent{Tachibana2005--, + author = {Tachibana, Ryuki and Shimizu, Shuhichi and Kobayshi, Seiji and Nakamura, Taiga}, + title = {Electronic watermarking method and system}, + number = {US6915001}, + year = {2005}, + date = {2005-07-05}, + url = {http://www.google.co.in/patents/US6915001}, + urldate = {2013-11-11}, +} + +@TechReport{中国互联网络信息中心2012--, + author = {中国互联网络信息中心}, + title = {第 29 次中国互联网络发展现状统计报告}, + year = {2012}, + date = {2012-01-16}, + url = {http://www.cnnic.net.cn/hlwfzyj/hlwxzbg/201201/P020120709345264469680}, + urldate = {2013-03-26}, +} + +@Archive{北京市人民政府办公厅2005--, + author = {北京市人民政府办公厅}, + title = {关于转发北京市企业投资项目核准暂行实施办法的通知: 京政办发[2005]37号}, + year = {2005}, + date = {2005-07-12}, + url = {http://china.findlaw.cn/fagui/p_1/39934.html}, + urldate = {2011-07-12}, +} + +@Online{Bawden2008--, + author = {Bawden, D}, + title = {Origins and Concepts of Digital Literacy}, + date = {2008-05-04}, + url = {http://www.soi.city.ac.uk/~dbawden/digital%20literacy%20chapter.pdf}, + urldate = {2013-03-08}, + year = {2008}, +} + +@Online{OCLC--, + author = {{Online Computer Library Center, Inc}}, + title = {About {OCLC}: History of Cooperation}, + url = {http://www.oclc.org/about/cooperation.en.html}, + urldate = {2012-03-27}, +} + +@Online{Hopkinson2009--, + author = {Hopkinson, A}, + title = {{UNIMARC} and Metadata: Dublin Core}, + date = {2009-04-22}, + url = {http://archive.ifla.org/IV/ifla64/138-161e.htm}, + urldate = {2013-03-27}, + year = {2009}, +} + +@PhdThesis{刘乃安2000-17-18a, + author = {刘乃安}, + title = {生物质材料热解失重动力学及其分析方法研究}, + year = {2000}, + pages = {17--18}, + doi = {10.7666/d.y351065}, + url = {http://wenku.baidu.com/link?url=GJDJxb4lxBUXnIPmq1XoEGSIr1H8TMLbidW_LjlYu33tpt707u62rKliypU_FBGUmox7ovPNaVIVBALAMd5yfwuKUUOAGYuB7cuZ-BYEhXa}, + urldate = {2014-08-29}, + address = {安徽}, + school = {中国科学技术大学}, +} + +@PhdThesis{Deverell2013-21-22a, + author = {Deverell, William and Igler, David}, + title = {A Companion to {California} History}, + year = {2013}, + date = {2013-11-15}, + pages = {21--22}, + doi = {10.1002/9781444305036.ch2}, + url = {http://onlinelibrary.wiley.com/doi/10.1002/9781444305036.ch2/summary}, + urldate = {2014-06-24}, + address = {New York}, + school = {John Wiley \& Sons}, +} + +@Book{Morri2010--, + author = {Morri, I}, + title = {Why the West Rules for Now: the Patterns of History, and What They Reveal about the Future}, + year = {2010}, + publisher = {{Farrar, Straus and Giroux}}, + address = {New York}, +} + + +@Article{STIEG1981-549-560, + Title = {The information needs of historians}, + Author = {M. F. STIEG}, + Date = {1981}, + Journaltitle = {College and Research Libraries}, + Number = {6}, + Pages = {549-560}, + Volume = {42} +} + + + +@Article{Milstein1982-436-446, + Title = {The effect of multiple-tone interfering signals on a direct sequence spread spectrum communication system}, + Author = {Milstein, L. B. and Davidovici,S. and Schilling,D. L.}, + Journal = {IEEE Trans. Commun.}, + Number = {3}, + Pages = {436-446}, + Volume = {30}, + Year = {1982} +} + +@Book{顾炎武1982--, + Title = {昌平山水记}, + Author = {顾炎武}, + Publisher = {北京古籍出版社}, + Year = {1982}, + Location = {北京}, + Titleaddon = {东京考古录} +} + +@Inbook{马克思1982-505-505, + Title = {关于《工资、价格和利润》的报告札记}, + Author = {马克思}, + Bookauthor = {马克思 and 恩格斯}, + Booktitle = {马克思恩格斯全集}, + Pages = {505}, + Publisher = {人民出版社}, + Booktitleaddon = {第44卷}, + Location = {北京}, + Year = {1982} +} + +@Article{HEWITT1984-205-218, + Title = {Technical services in 1983}, + Author = {J A HEWITT}, + Date = {1984}, + Journaltitle = {Library Resource Services}, + Number = {3}, + Pages = {205-218}, + Volume = {28} +} + +@Article{McEliece1984-44-53, + Title = {Channels with block interference}, + Author = {McEliece, R. J. and Stark, W. E.}, + Journal = {IEEE Trans. Inf. Theory}, + Number = {1}, + Pages = {44-53}, + Volume = {30}, + Year = {1984} +} + +@Article{陶仁骥1984-527-527, + Title = {密码学与数学}, + Author = {陶仁骥}, + Date = {1984}, + Journaltitle = {自然杂志}, + Number = {7}, + Pages = {527}, + Volume = {7} +} + +@Periodical{中华医学会湖北分会1984--, + Title = {临床内科杂志}, + Address = {武汉}, + Date = {1984}, + Editor = {中华医学会湖北分会}, + Institution = {中华医学会湖北分会}, + Number = {1}, + Volume = {1} +} + +@Incollection{韩吉人1985-90-99, + Title = {论职工教育的特点}, + Author = {韩吉人}, + Booktitle = {职工教育研究论文集}, + Date = {1985}, + Publisher = {人民教育出版社}, + Pages = {90-99}, + Bookauthor = {中国职工教育研究会}, + Location = {北京} +} + +@Collection{中国职工教育研究会1985--, + Title = {职工教育研究论文集}, + Author = {中国职工教育研究会}, + Location = {北京}, + Publisher = {人民教育出版社}, + Year = {1985} +} + +@Standard{全国文献工作标准化委员会第七分委员会1986--, + Title = {GB/T 5795--1986 中国标准书号}, + Author = {全国文献工作标准化委员会第七分委员会}, + Note = {standard}, + Year = {1986}, + Location = {北京}, + Publisher = {中国标准出版社} +} + +@Inbook{1988-590-590, + Title = {卷39 乞致任第一}, + Address = {北京}, + Booktitle = {苏魏公文集:下册}, + Pages = {590}, + Publisher = {中华书局}, + Year = {1988} +} + + + +@Standard{国家标准局信息分类编码研究所1988-59-92, + Title = {世界各国和地区名称代码 GB/T 2659-1986}, + Author = {国家标准局信息分类编码研究所}, + Date = {1988}, + Note = {standard}, + Bookauthor = {全国文献工作标准化技术委员会}, + Booktitle = {文献工作国家标准汇编}, + Booktitleaddon = {3}, + Location = {北京}, + Pages = {59-92}, + Publisher = {中国标准出版社} +} + +@Online{1989--, + Title = {PACS-L:the public-access computer systems forum}, + Date = {1989}, + Publisher = {Tex: University of Houston Libraries}, + Url = {http://info.lib.uh.edu/pacsl.html}, + Urldate = {1995-05-17}, + Location = {Houston} +} + +@Patent{姜锡洲1989--, + Title = {一种温热外敷药制备方案}, + Author = {姜锡洲}, + Date = {1989-07-26}, + Number = {88105607.3}, + Titleaddon = {中国} +} + +@Report{DTFHA1990--, + Title = {Guidelines for handling excavated acid-producing materials: PB 91-194001}, + Author = {{U.S. Department of Transportation Federal Highway Administration}}, + Institution = {U.S. Department of Commerce National Information Service}, + Location = {Springfield}, + Year = {1990} +} + +@Book{PIGGOT1990--, + Title = {The cataloguer's way through AACR2: from document receipt to document retrieval}, + Author = {T. M. PIGGOT}, + Publisher = {The Library Association}, + Year = {1990}, + Location = {London} +} + +@Article{DESMARAIS1992-605-609, + Title = {Carbon isotope evidence for the stepwise oxidation of the Proterozoic environment}, + Author = {DES MARAIS, D J and H STRAUSS and R E SUMMONS and others}, + Date = {1992}, + Journaltitle = {Nature}, + Pages = {605-609}, + Volume = {359} +} + +@Article{Holtzman1992-243-247, + Title = {On using perturbation analysis to do sensitivity analysis: derivatives versus differences}, + Author = {Holtzman, J. M.}, + Journal = {IEEE Trans. Autom. Control}, + Number = {2}, + Pages = {243-247}, + Volume = {37}, + Year = {1992} +} + +@Article{CAPLAN1993-61-66a, + Title = {Cataloging internet resources}, + Author = {P CAPLAN}, + Date = {1993}, + Journaltitle = {The public Access Computer Systems Review}, + Number = {2}, + Pages = {61-66}, + Volume = {4} +} + +@Book{广西壮族自治区林业厅1993--, + Title = {广西自然保护区}, + Author = {广西壮族自治区林业厅}, + Date = {1993}, + Publisher = {中国林业出版社}, + Location = {北京} +} + +@Patent{刘加林1993--, + Title = {多功能一次性压舌板}, + Author = {刘加林}, + Date = {1993-04-14}, + Number = {92214985.2}, + Location = {中国} +} + +@Book{OBRIEN1994--, + Title = {Introduction to information systems}, + Author = {J A O'BRIEN}, + Date = {1994}, + Edition = {7}, + Publisher = {Irwin}, + Location = {Burr Ridge, III} +} + +@Book{辛希孟1994--, + Title = {信息技术与信息服务国际研讨会论文集}, + Author = {辛希孟}, + Publisher = {中国社会科学出版社}, + Year = {1994}, + Location = {北京}, + Titleaddon = {A集} +} + +@Article{Andersen1995-42-49, + Title = {Propagation measurements and models for wireless communications channels}, + Author = {Andersen, J. B. and Rappaport, T. S. and Yoshida, S.}, + Journal = {IEEE Commun. Mag.}, + Number = {1}, + Pages = {42-49}, + Volume = {33}, + Year = {1995} +} + +@Book{CRAWFPRD1995--, + Title = {Future libraries: dreams, maddness, \& reality}, + Author = {W CRAWFPRD and M GORMAN}, + Date = {1995}, + Publisher = {American Library Association}, + Location = {Chicago} +} + +@Book{赵凯华1995--, + Title = {{新概念物理教程}}, + Address = {北京}, + Author = {赵凯华 and 罗蔚茵}, + Publisher = {高等教育出版社}, + Year = {1995} +} + +@Inbook{MARTIN1996-85-96, + Title = {Control of electronic resources in Australia}, + Author = {G MARTIN}, + Bookauthor = {L W PATTLE and B J COX}, + Booktitle = {Electronic resources}, + Date = {1996}, + Pages = {85-96}, + Publisher = {The Haworth Press}, + Booktitleaddon = {selection and bibliographic control}, + Location = {New York} +} + +@Book{国家环境保护局科技标准司1996-2-3, + Title = {土壤环境质量标准: GB 15616-1995}, + Address = {北京}, + Author = {国家环境保护局科技标准司}, + Note = {standard}, + Pages = {2-3}, + Publisher = {中国标准出版社}, + Url = {http://wenku.baidu.com}, + Urldate = {2013-10-14}, + Year = {1996} +} + + + +@Inbook{钟文发1996-468-471, + Title = {非线性规划在可燃毒物配置中的应用}, + Author = {钟文发}, + Bookauthor = {赵玮}, + Booktitle = {运筹学的理论和应用}, + Pages = {468-471}, + Publisher = {西安电子科技大学出版社}, + Booktitleon = {中国运筹学会第五届大会讨论文集}, + Location = {西安}, + Year = {1996} +} + +@Inproceedings{Nemec1997-209-214, + Title = {Force control of redundant robots}, + Author = {B Nemec}, + Booktitle = {Processings of Symposium on Robot Control}, + Pages = {209-214}, + Country = {Nantes France}, + Year = {1997} +} + + + +@Article{Andrisano1998-1383-1401, + Title = {Millimeter waves for short-range multimedia communication systems}, + Author = {Andrisano, O. and Tralli, V. and Verdone, R.}, + Journal = {Proc. IEEE}, + Number = {7}, + Pages = {1383-1401}, + Volume = {86}, + Year = {1998} +} + +@Article{Chiani1998-2998-3008, + Title = {Error probability for block codes over channels with block interference}, + Author = {Chiani, M.}, + Journal = {IEEE Trans. Inf. Theory}, + Number = {7}, + Pages = {2998-3008}, + Volume = {44}, + Year = {1998} +} + +@Article{CHRISTINE1998-331-332, + Title = {Plant physiology:plant biology in the Genome Era}, + Author = {M CHRISTINE}, + Date = {1998}, + Journaltitle = {Science}, + Pages = {331-332}, + Volume = {281}, + Url = {http://www.sciencemag.org/cgi/collection/anatmorp}, + Urldate = {1998-09-23} +} + +@Article{KANAMORI1998-2063-2064, + Title = {Shaking without quaking}, + Author = {H KANAMORI}, + Date = {1998}, + Journaltitle = {Science}, + Number = {5359}, + Pages = {2063-2064}, + Volume = {279} +} + +@Inbook{白书农1998-146-163, + Title = {植物开花研究}, + Author = {白书农}, + Bookauthor = {李承森}, + Booktitle = {植物科学进展}, + Pages = {146-163}, + Publisher = {高等教育出版社}, + Location = {北京}, + Year = {1998} +} + +@Book{蒋有绪1998--, + Title = {中国森林群落分类及其群落学特征 and \XeLaTeX{}}, + Address = {北京}, + Author = {蒋有绪 and 郭泉水 and 马娟 and others}, + Publisher = {科学出版社}, + Year = {1998} +} + + + +@Article{鲁明羽1998-290-295, + Title = {关于数据库系统数据词典的重要作用}, + Author = {鲁明羽 and 李纲民}, + Journal = {烟台大学学报自然科学与工程版}, + Number = {4}, + Pages = {290-295}, + Volume = {11}, + Year = {1998} +} + +@Mastersthesis{张志祥1998--, + Title = {间断动力系统的随机扰动及其在守恒律方程中的应用}, + Author = {张志祥}, + Date = {1998}, + Institution = {北京大学数学学院}, + Location = {北京} +} + +@Book{赵耀东1998--, + Title = {新时代的工业工程师}, + Author = {赵耀东}, + Publisher = {天下文化出版社}, + Url = {http://www.ie.nthu.edu.tw/info/ie.newie.htm(Big5)}, + Urldate = {1998-09-26}, + Year = {1998}, + Location = {台北} +} + +@Article{高光明1998-60-65, + Title = {信号情报接收机的发展现状及趋势}, + Author = {高光明}, + Journal = {电讯技术}, + Number = {2}, + Pages = {60-65}, + Volume = {38}, + Month = {4}, + Year = {1998} +} + +@Article{Dardari1999-1709-1721, + Title = {High-speed indoor wireless communications at 60 GHz with coded OFDM}, + Author = {Dardari, D. and Tralli,V.}, + Journal = {IEEE Trans. Commun.}, + Number = {11}, + Pages = {1709-1721}, + Volume = {47}, + Year = {1999} +} + +@InBook{程根伟1999-32-36a, + author = {程根伟}, + title = {1998年长江洪水的成因与减灾对策}, + booktitle = {长江流域洪涝灾害与科技对策}, + year = {1999}, + bookauthor = {许厚泽 and 赵其国}, + publisher = {科学出版社}, + location = {北京}, + pages = {32-36}, +} + +@Article{江向东1999-4-4, + Title = {互联网环境下的信息处理与图书管理系统解决方案}, + Author = {江向东}, + Date = {1999}, + Journaltitle = {情报学报}, + Number = {2}, + Pages = {4}, + Volume = {18}, + Url = {http://www.chinainfo.gov.cn/periodical/qbxb/qbxb99/qbxb990203}, + Urldate = {2000-01-18} +} + +@Article{李晓东1999-101-106, + Title = {气候学研究的若干理论问题}, + Author = {李晓东 and 张庆红 and 叶瑾琳}, + Date = {1999}, + Journaltitle = {北京大学学报}, + Number = {1}, + Pages = {101-106}, + Volume = {35}, + Journaltitleaddon = {自然科学版} +} + +@Article{梁振兴1999-24-32, + Title = {美军一体化{C\textsuperscript{4}ISR}系统的发展研究}, + Author = {梁振兴}, + Journal = {电子展望与决策}, + Pages = {24-32}, + Year = {1999} +} + +@Article{刘武1999-2481-2488, + Title = {元谋人牙齿测量数据的统计分析及其在分类研究上的意义}, + Author = {刘武 and 郑良 and 姜础}, + Date = {1999}, + Journaltitle = {科学通报}, + Number = {23}, + Pages = {2481-2488}, + Volume = {44} +} + +@Article{莫少强1999-1-6, + Title = {数字式中文全球文献格式的设计与研究}, + Author = {莫少强}, + Date = {1999}, + Journaltitle = {情报学报}, + Number = {4}, + Pages = {1-6}, + Volume = {18}, + Url = {http://periodical.wanfangdata.com.cn/periodical/qbxb/qbxb99/qbxb9904/990407.htm}, + Urldate = {2001-07-08} +} + +@Book{唐绪军1999-117-121, + Title = {报业经济与报业经营}, + Author = {唐绪军}, + Date = {1999}, + Pages = {117-121}, + Publisher = {新华出版社}, + Location = {北京} +} + +@Proceedings{中国力学学会1999--, + Title = {第3届全国实验流体力学学术会议论文集}, + Address = {天津}, + Year = {1999}, + Editor = {中国力学学会} +} + +@Article{杨友烈1999-60-65, + Title = {DII COE的基本概念和技术特征}, + Author = {杨友烈}, + Journal = {军事通信技术}, + Pages = {60-65}, + Volume = {72}, + Month = {12}, + Year = {1999} +} + +@Proceedings{GANZHA2000--, + Title = {Computer algebra in scientific computing:CASC 2000:proceedings of the Third +Workshop on Computer Algebra in Scientific Computing, Samarkand, October 5-9, 2000}, + Date = {2000}, + Publisher = {Springer}, + Editor = {V G GANZHA and E W MAYR and E V VOROZHTSOV}, + Location = {Berlin} +} + +@Book{Gradshteyn2000--, + Title = {Tables of Integrals, Series, and Products}, + Address = {San Diego}, + Author = {Gradshteyn, I. S. and Ryzhik,I. M.}, + Edition = {Sixth Edition}, + Publisher = {CA: Academic Press, Inc.}, + Year = {2000} +} + +@Book{Parsons2000--, + Title = {The Mobile Radio Propagation Channel}, + Address = {Hoboken}, + Author = {Parsons, J. D.}, + Edition = {2}, + Publisher = {John Wiley and Sons}, + Year = {2000} +} + +@Book{Parsons2000a--, + Title = {The Mobile Radio Propagation Channel}, + Address = {Hoboken}, + Author = {PARSONS}, + Edition = {2}, + Publisher = {John Wiley and Sons}, + Year = {2000} +} + +@Book{Parsons2000b--, + Title = {The Mobile Radio Propagation Channel}, + Address = {Hoboken}, + Author = {Parsons}, + Edition = {2}, + Publisher = {John Wiley and Sons}, + Year = {2000} +} + +@Book{Parsons2000noauthor--, + Title = {The Mobile Radio Propagation Channel}, + Address = {Hoboken}, + Edition = {2}, + Publisher = {John Wiley and Sons}, + Year = {2000} +} + +@Book{Parsons2000noloc--, + Title = {The Mobile Radio Propagation Channel}, + Author = {Parsons, J. D.}, + Edition = {2}, + Publisher = {John Wiley and Sons}, + Year = {2000} +} + +@Book{Parsons2000nopub--, + Title = {The Mobile Radio Propagation Channel}, + Address = {Hoboken}, + Author = {Parsons, J. D.}, + Edition = {2}, + Year = {2000} +} + +@Book{Parsons2000nopubpages--, + Title = {The Mobile Radio Propagation Channel}, + Address = {Hoboken}, + Author = {Parsons, J. D.}, + Edition = {2}, + Pages = {15-20}, + Year = {2000} +} + +@Book{YUFIN2000--a, + Title = {Geoecology and computers}, + Author = {S. A. YUFIN}, + Publisher = {A. A. Balkema}, + Year = {2000}, + Location = {Rotterdam}, + Titleaddon = {proceedings of the Third International Conference on Advances of + Computer Methods in Geotechnical and Geoenvironmental + Engineering, Moscow, Russia, February 1-4, 2000} +} + +@Article{李炳穆2000-5-8, + Title = {理想的图书管理员和信息专家的素养与形象}, + Author = {李炳穆}, + Date = {2000}, + Journaltitle = {图书情报工作}, + Number = {2}, + Pages = {5-8} +} + +@Book{孙玉文2000--, + Title = {汉语变调构词研究}, + Author = {孙玉文}, + Publisher = {北京大学出版社}, + Year = {2000}, + Location = {北京} +} + +@Article{傅刚2000--, + Title = {大风沙过后的思考}, + Author = {傅刚 and 赵承 and 李佳路}, + Date = {2000-04-12}, + Journaltitle = {北京青年报}, + Note = {news}, + Url = {http://www.bjyouth.com.cn/Bqb/20000412/GB/4216%5ED0412B1401.htm}, + Urldate = {2005-09-28} +}% Number = {14}, + +@Newspaper{张田勤2000--, + Title = {犯罪DNA库与生命伦理学计划}, + Author = {张田勤}, + Date = {2000-11-12}, + Journaltitle = {大众科技报}, + Note = {news}, + Number = {7} +} + +@Article{丁文祥2000--, + Title = {数字革命与竞争国际化}, + Author = {丁文祥}, + Date = {2000-11-20}, + Journaltitle = {中国青年报}, + Number = {15}, + Note = {news} +} + +@Book{booknoauthor, + Title = {出版集团研究}, + Date = {2001}, + Pages = {179-193}, + Publisher = {中国书籍出版社}, + Location = {北京} +} + +@Book{booknolocation, + Title = {出版集团研究}, + Author = {余敏}, + Date = {2001}, + Pages = {179-193}, + Publisher = {中国书籍出版社} +} + +@Book{booknopages, + Title = {出版集团研究}, + Author = {余敏}, + Date = {2001}, + Publisher = {中国书籍出版社}, + Url = {www.bla~bla.org}, + Location = {北京} +} + +@Book{booknopublisher, + Title = {出版集团研究}, + Author = {余敏}, + Date = {2001}, + Location = {北京} +} + +@Book{booknopublisherpage, + Title = {出版集团研究}, + Author = {余敏}, + Date = {2001}, + Pages = {20-30}, + Location = {北京} +} + +@Article{Moeneclaey2001-497-505, + Title = {Sensitivity of multiple-access techniques to narrowband interference}, + Author = {Moeneclaey, M. and Bladel,M. V. and Sari,H.}, + Journal = {IEEE Trans. Commun.}, + Number = {3}, + Pages = {497-505}, + Volume = {49}, + Year = {2001} +} + +@Book{PEEBLES2001--, + Title = {Probability, random variable and random signal principles}, + Author = {PEEBLES, Jr., P Z}, + Edition = {4}, + Publisher = {McGraw Hill}, + Year = {2001}, + Location = {New York} +} + +@Book{Peebles2001-100-100, + Title = {Probability, random variable, and random signal Principles and \LaTeX{}}, + Address = {New York}, + Author = {von Peebles, Jr., P. Z.}, + Edition = {4}, + Pages = {100}, + Publisher = {McGraw-Hill}, + Year = {2001} +} + +@Inproceedings{Piazzo2001--, + Title = {UWB EM compatibility and coexistence issues}, + Address = {Rome, Italy}, + Author = {Piazzo, L.}, + Booktitle = {Proc. 1st Int. Workshop on Networking with UWB}, + Year = {2001} +} + +@Book{ROOD2001--, + Title = {Logic and structured design for computer programmers}, + Author = {H J ROOD}, + Date = {2001}, + Edition = {3}, + Publisher = {Brooks/Cole-Thomson Learning} +} + +@Book{Simon2001--, + Title = {Spread Spectrum Communications Handbook}, + Address = {New York City}, + Author = {Simon, M. K. and Omura,J. K. and Scholtz,R. A. and Levitt,B. K.}, + Publisher = {McGraw-Hill, Inc.}, + Year = {2001} +} + +@Book{Stueber2001--, + Title = {Principles of Mobile Communication}, + Address = {Norwell}, + Author = {Stuber, G. L.}, + Edition = {Second Edition}, + Publisher = {MA: Kluwer Academic Publishers}, + Year = {2001} +} + +@Book{余敏2001-179-193, + Title = {出版集团研究}, + Author = {余敏}, + Date = {2001}, + Pages = {179-193}, + Publisher = {中国书籍出版社}, + Location = {北京} +} + +@Book{余敏2001-179-193a, + Title = {出版集团研究}, + Author = {余敏}, + Date = {2001}, + Edition = {3}, + Pages = {179-193}, + Publisher = {中国书籍出版社}, + Location = {北京} +} + +@Book{余敏2001-179-193b, + Title = {出版集团研究}, + Author = {余敏}, + Date = {2001}, + Edition = {2}, + Pages = {179-193}, + Publisher = {中国书籍出版社}, + Location = {北京} +} + +@Book{余敏2001-179-193c, + Title = {出版集团研究}, + Author = {余敏}, + Date = {2001}, + Pages = {179-193}, + Publisher = {中国书籍出版社}, + Url = {http://www.baidu.com}, + Urldate = {2001-08-04}, + Location = {北京} +} + +@Book{赵学功2001--a, + author = {赵学功}, + title = {当代美国外交}, + year = {2001}, + publisher = {社会科学文献出版社}, + url = {http://www.baidu.com}, + urldate = {2014-06-11}, +} + +@Manual{中国第一历史档案馆2001--a, + author = {中国第一历史档案馆 and 辽宁省档案馆}, + title = {中国明朝档案总汇}, + year = {2001}, + organization = {广西师范大学出版社}, + address = {桂林}, +} + +@Article{郜宪林2001-114-116, + Title = {DII COE研究与分析}, + Author = {郜宪林}, + Journal = {计算机工程与应用}, + Number = {19}, + Pages = {114-116}, + Year = {2001} +} + +@Patent{河北绿洲生态环境科技有限公司2001--, + Title = {一种荒漠化地区生态植被综合培育种植方法}, + Author = {河北绿洲生态环境科技有限公司}, + Date = {2001-10-24}, + Number = {01129210.5}, + Url = {http://211.152.9.47/sipoasp/zlijs/hyjs-yx-new.asp?recid=01129210.5&leixin}, + Urldate = {2002-05-28} +} + +@Article{陈金成2001-1861-1864, + Title = {一种开放式体系结构经济型数控装置的研制}, + Author = {陈金成 and 杨海威 and 钟廷修}, + Journal = {上海交通大学学报}, + Number = {12}, + Pages = {1861-1864}, + Volume = {35}, + Month = {12}, + Year = {2001} +} + +@Www{萧钰2001--, + Title = {出版业信息化迈入快车道}, + Author = {萧钰}, + Url = {http://www.creader.com/news/20011219/200112190019.html}, + Urldate = {2002-04-15}, + Date = {2001-12-19} +} + +@Inproceedings{Choi2002-1075-1080, + Title = {Performance analysis of ultra-wideband spread-spectrum communications in narrowband interference}, + Address = {Anaheim, CA}, + Author = {Choi, J. D. and Stark,W. E.}, + Booktitle = {Proc. IEEE Military Commun. Conf. (MILCOM)}, + Pages = {1075-1080}, + Volume = {2}, + Year = {2002} +} + +@Inproceedings{Dardari2002-201-206, + Title = {Simple and accurate models for error probability evaluation of IEEE802.11 DS-SS physical interface in the presence of Bluetooth interference}, + Address = {Taipei}, + Author = {Dardari, D. and Pasolini,G.}, + Booktitle = {Proc. IEEE Global Telecommun. Conf. (GLOBECOM)}, + Pages = {201-206}, + Volume = {1}, + Year = {2002} +} + +@Inproceedings{Foerster2002-1931-1935, + Title = {Interference modeling of pulse-based UWB waveforms on narrowband systems}, + Address = {Birmingham, AL}, + Author = {Foerster, J. R.}, + Booktitle = {Proc. IEEE Veh. Technol. Conf.}, + Pages = {1931-1935}, + Volume = {4}, + Year = {2002} +} + +@Inproceedings{Fontana2002-309-313, + Title = {An insight into UWB interference from a shot noise perspective}, + Address = {Baltimore, MD}, + Author = {Fontana, R. J.}, + Booktitle = {Proc. of IEEE Conference on Ultrawideband Systems and Technologies (UWBST)}, + Pages = {309-313}, + Year = {2002} +} + +@Article{Haemaelaeinen2002-1712-1721, + Title = {On the UWB system coexistence with GSM900, UMTS/WCDMA, and GPS}, + Author = {Hamalainen, M. M. and Hovinen,V. and Tesi,R. and Iinatti,J. H. J. and Latvaaho, M.}, + Journal = {IEEE J. Sel. Areas Commun.}, + Number = {9}, + Pages = {1712-1721}, + Volume = {20}, + Year = {2002} +} + +@Article{Zhao2002-1684-1691, + Title = {Performance of ultra-wideband communications in the presence of interference}, + Author = {Zhao, L. and Haimovich,A. M.}, + Journal = {IEEEJ. Sel. Areas Commun.}, + Number = {9}, + Pages = {1684-1691}, + Volume = {20}, + Year = {2002} +} + +@Inproceedings{汪学军2002-22-25, + Title = {中国农业转基因生物研发进展与安全管理}, + Address = {北京}, + Author = {汪学军}, + Bookauthor = {国家环境保护总局生物安全管理办公室}, + Booktitle = {中国国家生物安全框架实施国际合作项目研讨会论文集}, + Pages = {22-25}, + Publisher = {中国环境科学出版社}, + Year = {2002} +} + +@Book{张伯伟2002--, + Title = {全唐五代诗格会考}, + Address = {南京}, + Author = {张伯伟}, + Pages = {288}, + Publisher = {江苏古籍出版社}, + Year = {2002} +} + +@Patent{西安电子科技大学2002--a, + author = {西安电子科技大学}, + title = {光折变自适应光外差探测方法}, + number = {01128777.2}, + date = {2002-03-06}, + url = {http://211.152.9.47/sipoasp/zljs/hyjs-yx-new.asp?recid=01128777.2&leixin=0}, + urldate = {2002-05-28}, +} + +@Patent{TACHIBANA2002--, + Title = {Electronic watermarking method and system}, + Author = {R TACHIBANA and S SHIMIZU and S KOBAYSHI and others}, + Date = {2002-04-25}, + Number = {US6915001}, + Url = {http://patftuspto.gov/netacgi/nph-Parser?Seetl=PTO2&Sect2=HITOFF&=1&u=/netahhml/search-bool.html&r=1&f=G&1=50&col=AND&d=ptxt&sl=`Electronic+watermarking+method+system'.TTL.&OS=TTL/}, + Urldate = {2002-05-28} +} + +@Patent{KOSEKI2002--, + Title = {Compiler}, + Author = {A KOSEKI and H MOMOSE and M KAWAHITO and others}, + Date = {2002-05-25}, + Number = {US828402}, + Url = {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}, + Urldate = {2002-05-28} +} + +@Article{Chiani2003-840-845, + Title = {New exponential bounds and approximations for the computation of error probability in fading channels}, + Author = {Chiani, M. and Dardari, D. and Simon, M. K.}, + Journal = {IEEE Trans. Wireless Commun.}, + Number = {4}, + Pages = {840-845}, + Volume = {2}, + Year = {2003} +} + +@Inproceedings{Firoozbakhsh2003-473-477, + Title = {Analysis of IEEE 802.11a interference on UWB systems}, + Address = {Oulu, Finland}, + Author = {Firoozbakhsh, B. and Pratt,T. G. and Jayant,N.}, + Booktitle = {Proc. of IEEE Conference on Ultrawideband Systems and Technologies (UWBST)}, + Pages = {473-477}, + Year = {2003} +} + +@Electronic{OMG2003--, + Title = {Unified Modeling Language: Superstructure}, + Author = {{omg Inc.}}, + Url = {http://www.omg.org}, + Year = {2003} +} + +@Thesis{吴云芳2003--, + Title = {面向中文信息处理的现代汉语并列结构研究}, + Address = {北京}, + Author = {吴云芳}, + Institution = {北京大学}, + Url = {http://thesis.lib.pku.edu.cn/dlib/List.asp?lang=gb&type=Reader&DocGroupID=4&DoclD=6328}, + Urldate = {2013-10-14}, + Year = {2003} +} + +@Thesis{吴云芳2003a--, + Title = {面向中文信息处理的现代汉语并列结构研究}, + Address = {北京}, + Author = {吴云芳}, + Url = {http://thesis.lib.pku.edu.cn}, + Urldate = {2013-10-14}, + Year = {2003} +} + +@Thesis{吴云芳2003b--, + Title = {面向中文信息处理的现代汉语并列结构研究}, + Author = {吴云芳}, + Institution = {北京大学}, + Url = {http://thesis.lib.pku.edu.cn}, + Urldate = {2013-10-14}, + Year = {2003} +} + +@Thesis{吴云芳2003c--, + Title = {面向中文信息处理的现代汉语并列结构研究}, + Author = {吴云芳}, + Url = {http://thesis.lib.pku.edu.cn}, + Urldate = {2013-10-14}, + Year = {2003} +} + +@Article{Chiani2004-1312-1318, + Title = {Further results on convolutional code search for blockfading channels}, + Author = {M. Chiani and A. Conti and V. Tralli}, + Journal = {IEEE Trans. Inf. Theory}, + Number = {6}, + Pages = {1312-1318}, + Volume = {50}, + Year = {2004} +} + +@Article{Chiani2004-1312-1318a, + Title = {Further results on convolutional code search for blockfading channels-a}, + Author = {M. Chiani and A. Conti and V. Tralli}, + Pages = {1312-1318}, + Year = {2004} +} + +@Article{Chiani2004-1312-1318b, + Title = {Further results on convolutional code search for blockfading channels-b}, + Author = {M. Chiani and A. Conti and V. Tralli}, + Pages = {1312-1318}, + Year = {2004} +} + +@Article{Coulson2004-2277-2287, + Title = {Narrowband interference in pilot symbol assisted OFDM systems}, + Author = {Coulson, A. J.}, + Journal = {IEEE Trans. Wireless Commun.}, + Number = {6}, + Pages = {2277-2287}, + Volume = {3}, + Year = {2004} +} + +@Article{Dardari2004-1557-1567, + Title = {Layered video transmission on adaptive OFDM wireless systems}, + Author = {Dardari, D. and Martini,M. G. and Mazzotti, M. and Chiani,M.}, + Journal = {EURASIP Journal on Wireless Communications and Networking}, + Number = {10}, + Pages = {1557-1567}, + Year = {2004} +} + +@Book{Kopka2004--, + Title = {A Guide to LATEX and Electronic Publishing}, + Address = {Harlow, England}, + Author = {Helmut Kopka and Patrick W. Daly}, + Date = {2004}, + Edition = {4}, + Publisher = {Addison-Wesley} +} + +@Conference{Li2004-21-24, + Title = {Practical approaches to channel estimation and interference suppression for OFDM based UWB communications}, + Author = {Li, Y. and Molisch,A. F. and Zhang,J.}, + Booktitle = {Proc. of the IEEE 6th Circ. and Syst., Symp. on Emerging Technologies: Frontiers of Mobile and Wireless Communication}, + Pages = {21-24}, + Volume = {1}, + Year = {2004} +} + +@Book{Lin2004--, + Title = {Error Control Coding}, + Address = {Englewood Cliffs}, + Author = {Lin, S. and Daniel Costello,J.}, + Edition = {Second Edition}, + Publisher = {NJ:Prentice Hall}, + Year = {2004} +} + +@Book{Mittelbach2004--, + Title = {The LaTeX Companion}, + Address = {Boston}, + Author = {Frank Mittelbach and Michel Goossens and Johannes Braams and David Carlisle and Chris Rowley}, + Edition = {Second Edition}, + Publisher = {Addison-Wesley}, + Year = {2004} +} + +@Book{Simon2004--, + Title = {Digital Communication over Fading Channels}, + Address = {Hoboken}, + Author = {Simon, M. K. and Alouini,M. S.}, + Publisher = {NJ: Wiley-IEEE Press}, + Year = {2004} +} + +@PhdThesis{张若凌2004--, + Title = {高超声速非平衡流动的计算和实验研究}, + Author = {张若凌}, + School = {中国空气动力研究与发展中心}, + Year = {2004}, + Location = {绵阳} +} + +@Book{Miroslav2004--, + Title = {信号处理滤波器设计-基于matlab和mathematica的设计方法}, + Address = {北京}, + Author = {Miroslav, D. L. and Dejan, V. T. and Brian, L. E.}, + Publisher = {电子工业出版社}, + Translator = {朱义胜 and 董辉}, + Year = {2004}, + 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.}, + Journal = {Proc. IEEE Veh. Technol. Conf.}, + Pages = {1037-1042}, + Volume = {2}, + Year = {2005} +} + +@Article{Giorgetti2005-2139-2149, + Title = {The effect of narrowband interference on wideband wireless communication systems}, + Author = {Giorgetti, A. and Chiani, M. and Win, M. Z.}, + Journal = {IEEE Trans. Commun.}, + Number = {12}, + Pages = {2139-2149}, + Volume = {53}, + Year = {2005} +} + +@Article{Giorgetti2005-384-389, + Title = {Influence of fading on the Gaussian approximation for BPSK and QPSK with asynchronous cochannel interference}, + Author = {Giorgetti, A. and Chiani,M.}, + Journal = {IEEE Trans. Wireless Commun.}, + Number = {2}, + Pages = {384-389}, + Volume = {4}, + Year = {2005} +} + +@Inproceedings{Giorgetti2005-794-798, + Title = {Coexistence of UWB and narrowband systems in Nakagami/Rice channels}, + Address = {Aalborg, Denmark}, + Author = {Giorgetti, A.}, + Booktitle = {Proc. Int. Symp. on Wireless Personal Multimedia Commun. (WPMC)}, + Pages = {794-798}, + Year = {2005} +} + +@Book{Reed2005--, + Title = {An Introduction to Ultrawideband Communication Systems}, + Address = {Upper Saddle River}, + Author = {Reed, J. H.}, + Publisher = {NJ: Prentice Hall}, + Year = {2005} +} + +@Book{樊昌信2005--, + Title = {通信原理教程}, + Address = {北京}, + Author = {樊昌信}, + Publisher = {电子工业出版社}, + Year = {2005} +} + +@Article{Coulson2006-2484-2492, + Title = {Bit error rate performance of OFDM in narrowband interference with excision filtering}, + Author = {Coulson, A. J.}, + Journal = {IEEE Trans. Wireless Commun.}, + Number = {9}, + Pages = {2484-2492}, + Volume = {5}, + Year = {2006} +} + +@Inproceedings{Giorgetti2006--, + Title = {Coexistence issues in cognitive radios based on ultra-wide bandwidth systems}, + Address = {Mykonos, Greece}, + Author = {Giorgetti, A. and Chiani, M. and Dardari,D.}, + Booktitle = {Proc. IEEE Int. Conf. on Cognitive Radio Oriented Wireless Net. and Comm. (CROWNCOM)}, + Year = {2006} +} + +@Article{Hu2006-1720-1724, + Title = {Performance of an ultra-wideband communication system in the presence of narrowband BPSK-and QPSK-modulated OFDM interference}, + Author = {Hu, B. and Beaulieu,N. C.}, + Journal = {IEEE Trans. Commun.}, + Number = {10}, + Pages = {1720-1724}, + Volume = {54}, + Year = {2006} +} + +@Article{Molisch2006-3151-3166, + Title = {A comprehensive standardized model for ultrawideband propagation channels}, + Author = {Molisch, A. F. and Cassioli, D. and Chong, C. C. and Emami, S. and Fort, A.}, + Journal = {IEEE Trans. Antennas Propag.}, + Number = {11}, + Pages = {3151-3166}, + Volume = {54}, + Year = {2006} +} + +@Article{Saito2006-169-176, + Title = {jadeite-bearing metagabbro in serpentinite m\'elange of the ``kurosegawa belt" in Izumi Town,Yatsushiro city, kumamoto prefecture, central kyushu}, + Author = {Saito, M. and Miyazaki, k.}, + Journal = {bulletin of geological survey of japan}, + Number = {5/6}, + Pages = {169-176}, + Volume = {57}, + Year = {2006} +} + +@Book{郭文彬2006--, + Title = {通信原理--基于Matlab的计算机仿真}, + Address = {北京}, + Author = {郭文彬 and 桑林}, + Publisher = {北京邮电大学出版社}, + Year = {2006} +} + +@Book{蔡敏2006--, + Title = {UML基础和Rose建模教程}, + Address = {北京}, + Author = {蔡敏 and 徐慧慧 and 黄柄强}, + Publisher = {人民邮电出版社}, + Year = {2006}, + Month = {1} +} + +@Article{Nasri2007-4090-4100, + Title = {Analysis of narrowband communication systems impaired by MB-OFDM UWB interference}, + Author = {Nasri, A. and Schober, R. and Lampe, L.}, + Journal = {IEEE Trans. Wireless Commun.}, + Number = {11}, + Pages = {4090-4100}, + Volume = {6}, + Year = {2007} +} + +@Book{Proakis2007--, + Title = {Digital signal processing: Principles,algorithms, and applications}, + Address = {北京}, + Author = {Proakis, J. G. AND Manolakis, D. G.}, + Edition = {第4版}, + Publisher = {电子工业出版社}, + Year = {2007} +} + +@Article{Quek2007-2126-2139, + Title = {Unified analysis of UWB transmitted-reference schemes in the presence of narrowband interference}, + Author = {Quek, T. Q. S. and Win,M. Z. and Dardari,D.}, + Journal = {IEEE Trans. Wireless Commun.}, + Number = {6}, + Pages = {2126-2139}, + Volume = {6}, + Year = {2007} +} + +@Article{Shi2007-1118-1128, + Title = {Impact of narrowband interference on OFDM-UWB receivers: Analysis and mitigation}, + Author = {Shi, K. and Zhou,Y. and Kelleci,B. and Fischer, T. W. and Serpedin, E.E. and Ilker Karsilayan, A.}, + Journal = {IEEE Trans.Signal Process.}, + Number = {3}, + Pages = {1118-1128}, + Volume = {55}, + Year = {2007} +} + +@Article{Snow2007-1736-1746, + Title = {Error rate analysis for coded multicarrier systems over quasistatic fading channels}, + Author = {Snow, C. and Lampe, L. and Schober,R.}, + Journal = {IEEE Trans. Commun.}, + Number = {9}, + Pages = {1736-1746}, + Volume = {55}, + Year = {2007} +} + +@Book{全国广播电视标准化技术委员会2007-1-1, + Title = {广播电视音像资料编目规范:第2部分~ 广播资料:GY/T202.2-2007}, + Address = {北京}, + Author = {全国广播电视标准化技术委员会}, + Note = {standard}, + Pages = {1}, + Publisher = {国家广播电影电视局广播电视规划院}, + Year = {2007} +} + +@Article{张敏莉2007-500-503, + Title = {超声速短化喷管的设计和试验研究}, + Author = {张敏莉 and 易仕和 and 赵玉新}, + Journal = {空气动力学报}, + Number = {4}, + Pages = {500-503}, + Volume = {25}, + Year = {2007} +} + +@Book{庄钊文2007--, + Title = {军用目标雷达散射截面预估与测量}, + Address = {北京}, + Author = {庄钊文 and 袁乃昌 and 莫锦军 and 刘少斌}, + Publisher = {科学出版社}, + Year = {2007} +} + +@Article{刘晨2007-400-404, + Title = {体系对抗仿真模型形式规范研究}, + Author = {刘晨 and 王维平 and 朱一凡}, + Journal = {系统仿真学报}, + Number = {2}, + Pages = {400-404}, + Volume = {19}, + Month = {1}, + Year = {2007} +} + +@Manual{吴凌云2007--, + Title = {CTEX FAQ}, + Author = {吴凌云}, + Version = {version 0.4}, + Month = {1}, + Subtitle = {常见问题集}, + Year = {2007} +} + +@Article{articlemorenames, + Title = {Cooperation enforcement and learning for optimizing packet forwarding in autonomous wireless networks}, + Author = {Pandana, C. and Han, Z. and Liu, K.J.R. and others}, + Journal = {Wireless Communications, IEEE Transactions on}, + Number = {8}, + Pages = {3150--3163}, + Volume = {7}, + Publisher = {IEEE}, + Year = {2008} +} + +@Inproceedings{Nasri2008-3616-3621, + Title = {Performance Evaluation of BICM-OFDM Systems Impaired by UWB Interference}, + Address = {Beijing, China}, + Author = {Nasri, A. and Schober,R. and Lampe,L.}, + Booktitle = {Proc. IEEE Int. Conf. on Commun.}, + Pages = {3616-3621}, + Year = {2008} +} + +@Book{2009-155-155, + Title = {师伏堂日记:第4册}, + Address = {北京}, + Pages = {155}, + Publisher = {北京图书馆出版社}, + Year = {2009} +} + +@Article{Chiani2009-231-254, + Title = {Coexistence between UWB and narrow-band wireless communication systems}, + Author = {Chiani, M. and Giorgetti, A.}, + Journal = {Proc. IEEE, Special Issue on UWB Technology and Emerging Applications}, + Number = {2}, + Pages = {231-254}, + Volume = {97}, + Year = {2009} +} + +@Article{Pinto2009-1268-1282, + Title = {A stochastic geometry approach to coexistence in heterogeneous wireless networks}, + Author = {Pinto, P. and Giorgetti,A. and Win,M. Z. and Chiani,M.}, + Journal = {IEEE J. Sel. Areas Commun., Special Issue on Stochastic Geometry and Random Graphs for Wireless Networks}, + Number = {7}, + Pages = {1268-1282}, + Volume = {27}, + Year = {2009} +} + +@Book{罗斯基2009--, + Title = {战前中国经济的增长}, + Address = {杭州}, + Author = {罗斯基}, + Publisher = {浙江大学出版社}, + Translator = {唐巧天 and 毛立坤 and 姜修宪}, + Year = {2009} +} + +@Book{陈希孺2009--, + Title = {概率论与数理统计}, + Address = {合肥}, + Author = {陈希孺}, + Publisher = {中国科学技术大学出版社}, + Year = {2009}, + Month = {2} +} + +@Book{李云霞2009--, + Title = {光电对抗原理与应用}, + Address = {西安}, + Author = {李云霞 and 蒙文 and 马丽华 and 赵尚弘}, + Date = {2009-02}, + Publisher = {西安电子科技大学出版社} +} + +@Article{卢秋红2009-247-251, + Title = {基于开放式架构的反恐排爆机器人关键技术分析}, + Author = {卢秋红 and 蒋金鹏 and 付西光}, + Journal = {上海电机学院学报}, + Number = {3}, + Pages = {247-251}, + Volume = {12}, + Month = {9}, + Year = {2009} +} + +@Article{张庆杰2009-30-33, + Title = {支持无人机互操作的多数据链互连网关设计}, + Author = {张庆杰 and 王林 and 朱华勇 and 沈林成}, + Journal = {计算机工程}, + Number = {20}, + Pages = {30-33}, + Volume = {35}, + Month = {10}, + Year = {2009} +} + +@Article{Park2010-696-715, + Title = {metadata quality Control in Digital repositories and collections: criteria, semantics, and mechanisms}, + Author = {Park, J R and tosaka, Y.}, + Journal = {Cataloging \& classification quarterly}, + Number = {8}, + Pages = {696-715}, + Volume = {48}, + Url = {http://www.tandfonline.com}, + Urldate = {2013-09-05}, + Year = {2010} +} + +@Article{陈建军2010-93-93, + Title = {从数字地球到智慧地球}, + Author = {陈建军}, + Journal = {国图资源导刊}, + Number = {10}, + Pages = {93}, + Volume = {7}, + Doi = {10.3969/j.issn.1672-5603.2010.10.038}, + Url = {http://d.g.wanfangdata.com.cn}, + Urldate = {2013-03-20}, + Year = {2010} +} + +@Article{储大同2010-721-724, + Title = {恶性肿瘤个体化治疗靶向药物的临床表现}, + Author = {储大同}, + Journal = {中华肿瘤杂志}, + Number = {10}, + Pages = {721-724}, + Volume = {32}, + Url = {http://www.sohu.com}, + Urldate = {2014-06-25}, + Year = {2010} +} + +@book{weiner2010-38, + Title = {Microarchaeology: beyond the visible archaeological record}, + Author = {Weiner, S}, + Address = {Cambridge, Eng.}, + Date = {2010}, + Publisher = {Cambridge University Press Textbooks}, + Url = {http://lib.MYLIB.COM/OPEN.aspx?id=253897}, + Urldate = {2013-10-14}, + pages = {38} +} + +@Article{储大同2010-721-724m, + Title = {恶性肿瘤个体化治疗靶向药物的临床表现}, + Author = {储大同}, + Journal = {中华肿瘤杂志}, + Number = {9/10}, + Pages = {721-724}, + Volume = {32}, + Doi = {10.7666/d.y351065}, + Url = {http://www.sohu.com}, + Urldate = {2014-06-25}, + Year = {2010} +} + +@Book{候文顺2010-119-119, + Title = {高分子物理:高分子材料分析、选择与改性}, + Address = {北京}, + Author = {候文顺}, + Pages = {119}, + Publisher = {化学工业出版社}, + Url = {http://apabi.lib.pku.edu.cn}, + Urldate = {2012-11-27}, + Year = {2010} +} + +@Book{胡承正2010-112-112, + Title = {理论物理概论:上}, + Address = {武汉}, + Author = {胡承正 and 周详 and 缪灵}, + Pages = {112}, + Publisher = {武汉大学出版社}, + Year = {2010} +} + +@Book{美国妇产科医师学会2010-38-39, + Title = {新生儿脑病和脑性瘫痪发病机制与病理生理}, + Address = {北京}, + Author = {美国妇产科医师学会}, + Pages = {38-39}, + Publisher = {人民卫生出版社}, + Translator = {段涛 and 杨慧霞}, + Year = {2010} +} + +@Book{全国信息文献标准化技术委员会2010-3-3, + Title = {文献著录:第4部分~ 非书资料:GB/T3792.4-2009}, + Address = {北京}, + Author = {全国信息文献标准化技术委员会}, + Note = {standard}, + Pages = {3}, + Publisher = {中国标准出版社}, + Year = {2010} +} + +@Article{伍江华2010-70-74, + Title = {C4ISR互操作框架及信息关系模型研究}, + Author = {伍江华 and 潘小群}, + Journal = {舰船电子工程}, + Number = {1}, + Pages = {70-74}, + Volume = {30}, + Year = {2010} +} + +@Book{王雪松2010--, + Title = {现代雷达电子战系统建模与仿真}, + Address = {北京}, + Author = {王雪松 and 肖顺平 and 冯德军 and 赵锋}, + Date = {2010-03}, + Publisher = {电子工业出版社} +} + +@Book{Ross2010--, + Title = {概率论基础教程}, + Address = {北京}, + Author = {Ross, S. M.}, + Edition = {第8版}, + Publisher = {人民邮电出版社}, + Translator = {郑忠国 and 詹从赞}, + Year = {2010}, + Month = {4} +} + +@Book{陈志杰2006--, + Title = {LaTeX 入门与提高}, + Address = {北京}, + Author = {陈志杰 and 赵书钦 and 李树钧 and 万福永}, + Edition = {第二版}, + Publisher = {高等教育出版社}, + Year = {2010}, + Month = {5} +} + +@Manual{Umeki2010--, + Title = {The geometry package}, + Author = {Hideo Umeki}, + Version = {v5.6}, + Month = {09}, + Year = {2010} +} + +@Report{Calkin2011-8-9, + Title = {a comparative risk assessment framework for wildland fire management: the 2010 cohesive strategy Science report: RMRS-GTR-262}, + Author = {Calkin, D and Ager, a. and Thompson, m.}, + Pages = {8-9}, + Year = {2011} +} + +@Book{Praetzellis2011-13-13, + Title = {death by theory : a tale of mystery and archaeological theory}, + Author = {Praetzellis, A.}, + Edition = {Rev. ed.}, + Pages = {13}, + Publisher = {Rowman \& Littlefield Publishing Group, Inc.}, + Url = {http://lib.myilibrary.com}, + Urldate = {2012-07-26}, + Year = {2011} +} + +@Proceedings{陈志勇2011--, + Title = {中国财税文化价值研究:“中国财税文化国际学术研讨会”论文集}, + Address = {北京}, + Author = {陈志勇}, + Publisher = {经济科学出版社}, + Url = {http://apabi.lib.pku.edu.cn}, + Urldate = {2013-10-14}, + Year = {2011} +} + +@InProceedings{贾东琴2011-45-52a, + author = {贾东琴 and 柯平}, + title = {面向数字素养的高校图书馆数字服务体系研究}, + booktitle = {中国图书馆学会年会论文集:2011年卷}, + year = {2011}, + publisher = {国家图书馆出版社}, + pages = {45-52}, + address = {北京}, + bookauthor = {中国图书馆学会}, +} + +@Inbook{楼梦麟2011-11-12, + Title = {汶川地震基岩地震动特征分析}, + Address = {上海}, + Author = {楼梦麟 and 杨燕}, + Bookauthor = {同济大学土木工程防灾国家重点实验室}, + Booktitle = {汶川地震震害研究}, + Pages = {{011-012}}, + Publisher = {同济大学出版社}, + Url = {http://apabi.lib.pku.edu.cn}, + Urldate = {2013-05-09}, + Year = {2011} +} + +@Thesis{马欢2011-27-27, + Title = {人类活动影响下海河流域典型区水循环变化分析}, + Address = {北京}, + Author = {马欢}, + Institution = {清华大学}, + Pages = {27}, + Url = {http://www.cnki.net/kcms/detail/detail.aspx?dbcode=CDFD&QueryID=.O&CurRec=11&dbname=CDFDLAST2013&.filename=1012035905.nh&uid=WEEvREwSIJHSldTTGJhYIJRaEhGUXFQWVB6SGZXeisxdmVhV3Zy2kpoUnozeDElbOpaMONmMjZiQ3p4TUdmcw= }, + Urldate = {2013-10-14}, + Year = {2011} +} + +@InBook{2011-1109-1109, + title = {周易外传:卷5}, + booktitle = {船山全书:第6册}, + year = {2011}, + bookauthor = {王夫之}, + publisher = {岳麓书社}, + location = {长沙}, + pages = {1109}, +} + +@Book{胡伟2011--, + Title = {LaTeX2$\varepsilon$完全学习手册}, + Address = {北京}, + Author = {胡伟}, + Publisher = {清华大学出版社}, + Year = {2011}, + Month = {1} +} + +@Manual{Oetiker2011--, + Title = {The Not So Short Introduction to \LaTeXe{}}, + Author = {Tobias Oetiker and Hubert Partl and Irene Hyna and Elisabeth Schleg}, + Month = {4}, + Year = {2011} +} + +@Article{陈高峰2011-230-232, + Title = {基于开放式框架的交叉开发环境设计与实现}, + Author = {陈高峰}, + Journal = {煤炭技术}, + Number = {6}, + Pages = {230-232}, + Volume = {30}, + Month = {6}, + Year = {2011} +} + +@Manual{Robertson2011--, + Title = {The ccaption package}, + Author = {Will Robertson and Peter Wilson and Herries Press}, + Version = {v3.2c}, + Month = {8}, + Year = {2011} +} + +@Article{谭跃进2011-441-445, + Title = {体系工程的研究与发展}, + Author = {谭跃进 and 赵青松}, + Journal = {中国电子科学研究院学报}, + Number = {5}, + Pages = {441-445}, + Volume = {6}, + Month = {10}, + Year = {2011} +} + +@Manual{Sommerfeldt2011--, + Title = {Customizing captions of floating environments}, + Author = {Axel Sommerfeldt}, + Url = {http://sourceforge.net/projects/latex-caption/}, + Month = {11}, + Year = {2011} +} + +@Article{张晓琴2011--, + Title = {有重复组合公式的几种证明方法}, + Author = {张晓琴 and 王顺勇}, + Journal = {大学数学}, + Number = {6}, + Volume = {27}, + Month = {12}, + Year = {2011} +} + +@Book{Kinchy2012-50-50, + Title = {Seeds, Sciences, and struggle : the global politics of transgenic crops}, + Address = {Cambridge,Mass.}, + Author = {Kinchy, A.}, + Pages = {50}, + Publisher = {MIT Press}, + Url = {http://lib.myilibary.com}, + Urldate = {2013-07-14}, + Year = {2012} +} + +@Book{库恩2012--, + Title = {科学革命的结构:第4版}, + Address = {北京}, + Author = {库恩}, + Edition = {2}, + Publisher = {北京大学出版社}, + Translator = {金吾伦 and 胡新和}, + Year = {2012} +} + +@Proceedings{雷光春2012--, + Title = {综合湿地管理:综合湿地管理国际研讨会论文集}, + Address = {北京}, + Author = {雷光春}, + Publisher = {海洋出版社}, + Year = {2012} +} + +@Article{于潇2012-1518-1523, + Title = {互联网药品可信交易环境中主体资质审核备案模式}, + Author = {于潇 and 刘义 and 柴跃廷 and others}, + Journal = {清华大学学报(自然科学版)}, + Number = {11}, + Pages = {1518-1523}, + Volume = {52}, + 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 = {北京}, + Publisher = {九州出版社}, + Year = {2012}, + Editor = {中国社会科学院台湾史研究中心} +} + +@Book{埃伯哈德$ullet$蔡德勒等2012--, + Title = {数学指南-实用数学手册}, + Address = {北京}, + Author = {埃伯哈德$\bullet$蔡德勒等}, + Publisher = {科学出版社}, + Translator = {李文林等}, + Year = {2012}, + Month = {1} +} + +@Book{廖平2012--, + Title = {导弹突防中的电子对抗技术}, + Address = {北京}, + Author = {廖平 and 姜勤波}, + Date = {2012-01}, + Publisher = {国防工业出版社} +} + +@Patent{张凯军2012-04-05--, + Title = {轨道火车及高速轨道火车紧急安全制动辅助装置}, + Author = {张凯军}, + Number = {201220158825.2}, + Year = {2012-04-05} +} + +@Online{李强2012-05-03--, + Title = {化解医患矛盾需釜底抽薪}, + Author = {李强}, + Url = {http://wenku.baidu.com}, + Urldate = {2013-03-25}, + Year = {2012-05-03} +} + +@Online{Dublin2012-06-14--, + Title = {Dublin core metadata element set: version 1.1}, + Url = {http://dublincore.org}, + Urldate = {2014-06-11}, + Year = {2012-06-14} +} + +@Book{胡广书2012--, + Title = {数字信号处理—理论、算法与实现}, + Address = {北京}, + Author = {胡广书}, + Edition = {第三版}, + Publisher = {清华大学出版社}, + Year = {2012}, + Month = {10} +} + +@Article{Franz2013-1053-1062, + Title = {Phenotypic screening with oleaginous microalgae reveals modulators of lipid productivity}, + Author = {Franz,A.K. AND DANIELEWICZ, M. A. AND WONG, D. M. AND OTHERS}, + Journal = {ACS chemical biology}, + Pages = {1053-1062}, + Volume = {8}, + Url = {http://pubs.acs.org}, + Urldate = {2014-06-26}, + Year = {2013} +} + +@Article{Walls2013-399-418, + Title = {drought, deluge and declines: the impact of precipition extremes on amphibians in a changing climate}, + Author = {Walls, S C and barichivich, W. J. and BROWN, m. e.}, + Journal = {Biology}, + Number = {1}, + Pages = {399-418}, + Volume = {2}, + Url = {http://www.mdpi.com}, + Urldate = {2013-11-04}, + Year = {2013}, + doi = {10.3390/biology2010399} +} + +@Article{Zhang2007-500-503, + Title = {The design and experimental investigations of supersonic length shorted nozzle}, + Author = {Zhang, Min-li and Yi, Shi-he and Zhao, Yu-xin}, + Journal = {ACTA AERODYNAMICA SINICA}, + Number = {4}, + Pages = {500-503}, + Volume = {25}, + Year = {2007} +} + +@Book{Yi2013--, + Title = {Supersonic and hypersonic nozzle design}, + Address = {Beijing}, + Author = {Yi, Shi he and Zhao, Yu xin and He, Lin and Zhang, Min li}, + Publisher = {National Defense Industry Press}, + Year = {2013} +} + +@Book{LIAO2012--, + Title = {Electronic countermeasure techniques for missile penetration}, + Address = {Beijing}, + Author = {LIAO, ping and JIANG, qin bo}, + Publisher = {National Defense Industry Press}, + Year = {2013} +} + +@Book{LIU2003--, + Title = {Introduction of Ballistic Misille Techniques}, + Address = {Beijing}, + Author = {LIU, shi Qiu}, + Publisher = {China Astronautic Publishing House}, + Year = {2003} +} + +@InBook{马克思2013-302-302a, + author = {马克思}, + title = {政治经济学批判}, + booktitle = {马克思恩格斯全集:第35卷}, + year = {2013}, + bookauthor = {马克思 and 恩格斯}, + publisher = {人民出版社}, + pages = {302}, + address = {北京}, +} + +@Article{杨洪升2013-56-75, + Title = {四库馆私家抄校书考略}, + Author = {杨洪升}, + Journal = {文献}, + Number = {1}, + Pages = {56-75}, + Year = {2013} +} + +@Book{易仕和2013--, + Title = {超声速和高超声速喷管设计}, + Address = {北京}, + Author = {易仕和 and 赵玉新 and 何霖 and 张敏莉}, + Publisher = {国防工业出版社}, + Year = {2013} +} + +@Article{詹广平2013-8-10, + Title = {美海军宙斯盾系统开放式体系结构研究}, + Author = {詹广平}, + Journal = {舰船电子工程}, + Number = {11}, + Pages = {8-10}, + Volume = {33}, + Year = {2013} +} + +@Book{中国企业投资协会2013--, + Title = {投资台湾:大陆企业赴台投资指南}, + Address = {北京}, + Author = {中国企业投资协会 and 台湾并购与私募股权协会 and 汇盈国际投资集团}, + Publisher = {九州出版社}, + Year = {2013} +} + +@Article{周学武2013-49-52, + Title = {数据链技术的发展及其在空面导弹中的应用}, + Author = {周学武 and 邹敏怀 and 张邦楚 and 黄剑斌 and 刘涛}, + Journal = {教练机}, + Number = {2}, + Pages = {49-52}, + Year = {2013} +} + +@Book{Poisel2013--, + Title = {通信电子战原理}, + Address = {北京}, + Author = {Poisel, Richard A.}, + Edition = {2版}, + Pages = {23--26}, + Publisher = {电子工业出版社}, + Translator = {聂皞 and 王振华 and 陈少昌 and 吴利民}, + Url = {http://www.baidu.com}, + Urldate = {2013-08-01}, + Year = {2013}, + Month = {1} +} + +@Article{王雪峥2013-249-254, + Title = {基于DoDAF的靶场体系结构设计}, + Author = {王雪峥 and 许雪梅}, + Journal = {系统工程理论与实践}, + Number = {1}, + Pages = {249-254}, + Volume = {33}, + Month = {1}, + Year = {2013} +} + +@Book{阎毅2013--, + Title = {软件无线电与认知无线电概论}, + Address = {北京}, + Author = {阎毅 and 贺鹏飞}, + Publisher = {电子工业出版社}, + Year = {2013}, + Month = {1} +} + +@Article{刘裕国2013-01-12--, + Title = {雾霾来袭,如何突围}, + Author = {刘裕国 and 杨柳 and 张洋 and OTHERS}, + Journal = {人民日报}, + Note = {news}, + Url = {http://paper.people.com.cn}, + Urldate = {2013-11-06}, + Year = {2013-01-12} +} + +@Report{中华人民共和国国务院新闻办公室2013-04-16--, + Title = {国防白皮书:中国武装力量的多样化运用}, + Author = {中华人民共和国国务院新闻办公室}, + Url = {http://www.mod.gov.cn}, + Urldate = {2014-06-11}, + Year = {2013}, + date = {2013-04-16} +} + +@Book{刘海洋2013--, + Title = {LaTeX 入门}, + Address = {北京}, + Author = {刘海洋}, + Publisher = {电子工业出版社}, + Year = {2013}, + Month = {6} +} + +@Unpublished{包太雷2013--, + Title = {LaTeX Notes}, + Author = {包太雷}, + Edition = {第二版}, + Month = {9}, + Subtitle = {雷太赫排版系统简介}, + Year = {2013} +} + +@Report{汤万金2013-09-30--, + Title = {人体安全重要技术标准研制最终报告: 7178999X}, + Author = {汤万金 and 杨跃翔 and 刘文 and others}, + Url = {http://www.nstrs.org.cn}, + Urldate = {2014-06-24}, + date = {2013-09-30}, + Year = {2013} +} + +@Manual{Lehman2013--, + Title = {The biblatex Package}, + Author = {Philipp Lehman and Philip Kime and Audrey Boruvka and Joseph Wright}, + Version = {version 2.8a}, + Month = {11}, + Subtitle = {Programmable Bibliographies and Citations}, + Year = {2013} +} + +@Proceedings{Babu2014--, + Title = {Proceedings of the second international conference on soft computing for problem solving, December 28-30, 2012}, + Address = {New Delhi}, + Publisher = {Springer}, + Year = {2014}, + Editor = {Babu, B. V. and NAGAR, A. K. AND DEEP, K. and others} +} + +@Book{同济大学数学系2014--, + Title = {高等数学}, + Address = {北京}, + Author = {同济大学数学系}, + Publisher = {高等教育出版社}, + Year = {2014}, + Month = {7} +} + +@Book{杨林2015--, + Title = {面向对象软件工程与UML实践教程}, + Address = {北京}, + Author = {杨林 and 叶亚琴 and 方芳}, + Publisher = {科学出版社}, + Year = {2015}, + Month = {1} +} + +@Manual{Braams2015--, + Title = {The \LaTeXe{} Sources}, + Author = {Johannes Braams and David Carlisle and Alan Jeffrey and Leslie Lamport and Frank Mittelbach and Chris Rowley and Rainer Sch¨opf}, + Date = {2015-01-01} +} + +@Manual{Lehman2015, + Title = {The Biblatex Package: Programmable Bibliographies and Citations}, + Author = {Philipp Lehman and Philip Kime and Audrey Boruvka and Joseph Wright}, + Date = {2015-04-20}, + Version = {3.0} +} + +@Book{中华人民共和国国家质量监督检验检疫总局2015, + Title = {中华人民共和国国家标准 GB/T 7714-2015 信息与文献 参考文献著录规则}, + Author = {中华人民共和国国家质量监督检验检疫总局 and 中国国家标准化管理委员会}, + Date = {2015-05-15}, + Note = {standard} +} + +@Article{高翔2015-26-31, + Title = {复杂航电架构的开放式系统标准研究}, + Author = {高翔 and 李辰}, + Journal = {航空电子技术}, + Number = {2}, + Pages = {26-31}, + Volume = {46}, + Month = {6}, + Year = {2015} +} + +@Manual{Mittelbach2015--, + Title = {An environment for multicolumn output}, + Author = {Frank Mittelbach}, + Month = {12}, + Year = {2015} +} + +@Manual{Berry2016--, + Title = {TEX Live 指南—2016}, + Author = {Karl Berry}, + Date = {2016-06} +} + +@Manual{胡振震2016, + Title = {符合 GB7714-2015 标准的 biblatex 参考文献样式文件}, + Author = {胡振震}, + Date = {2016-07-01}, + Url = {https://ctan.org/pkg/biblatex-gb7714-2015}, + Urldate = {2018-04-23} +} + +@Online{Alliance--, + Title = {WiMedia Alliance}, + Url = {www.wimedia.org} +} + +@Book{booknodate, + Title = {出版集团研究}, + Author = {余敏}, + Pages = {179-193}, + Publisher = {中国书籍出版社}, + Location = {北京} +} + +@Book{booknopublishernoyear, + Title = {出版集团研究}, + Author = {余敏}, + Location = {北京} +} + +@Online{Commonwealth--, + Title = {Pennsylvania library laws}, + Author = {{Commonwealth libraries bureau of library development.Pennsylvania department of education office}}, + Url = {http://www.racc.edu}, + Urldate = {2013-03-24} +} + +@Report{Eggrers--, + Title = {One-dimensional flows of an imperfect diatomic gas}, + Author = {Eggrers, A. J.}, + Number = {959}, + Type = {NACA report} +} + +@Online{HOPKINSON--, + Title = {UNIMARC and metadata: Dublin Core}, + Author = {A HOPKINSON}, + Url = {http://www.rfla.org/IV/rfla64/13801613.htm}, + Urldate = {1999-12-08} +} + +@Online{JabRef中文手册--, + Title = {JabRef中文手册}, + Url = {http://blog.csdn.net/zd0303/article/details/7676807} +} + +@Online{JabRefManual--, + Title = {JabRef Manual}, + Url = {http://blog.csdn.net/zd0303/article/details/7676807} +} + +@Online{OCLC--a, + author = {{Online Computer Library Center, Inc.}}, + title = {History of OCLC}, + url = {http://www.oclc.org/about/history/default.htm}, + urldate = {2000-01-08}, +} + +@Book{Parsons2000nodate--, + Title = {The Mobile Radio Propagation Channel}, + Address = {Hoboken}, + Author = {Parsons, J. D.}, + Edition = {2}, + Publisher = {John Wiley and Sons} +} + +@Book{Parsons2000nopubnoyear--, + Title = {The Mobile Radio Propagation Channel}, + Address = {Hoboken}, + Author = {Parsons, J. D.}, + Edition = {2} +} + +@Book{standardinfoiso158, + Title = {Information and documentation-the Dublin core metadata element set:ISO 15836:2009}, + Note = {standard}, + Url = {http://www.iso.org}, + Urldate = {2013-03-24} +} + +@Book{鸟哥--, + Title = {鸟哥的linux私房菜}, + Author = {鸟哥}, + Edition = {3}, + Publisher = {人民邮电出版社} +} + +@Online{olqa2016--, + Title = {求助beamerposter制作海报时参考文献样式的问题}, + Date = {2016}, + Url = {http://bbs.ctex.org/forum.php?mod=viewthread&tid=153061&page=1&extra=#pid544787} +} + +@Online{北京交通大学研究生公众号2016--, + Title = {新学期定个小目标—学会在LaTeX中管理参考文献}, + Author = {北京交通大学研究生公众号}, + Date = {2016-09-17}, + Url = {http://www.latexstudio.net/archives/7488} +} + +@Online{olref2016--, + Title = {如何在LaTeX写作中管理参考文献?}, + Date = {2016-08-12}, + Url = {http://www.latexstudio.net/archives/7131} +} + +@Online{文献助手2016--, + Title = {参考文献格式搜索神器上线了}, + Author = {文献助手}, + Date = {2016-09-21}, + Url = {http://www.latexstudio.net/archives/7560} +} + +@Book{IFLAI1977b--, + Title = {Names of persons: national usages for entry in catalogues}, + Author = {{International Federation of Library Association and Institutions} and {FCC} and {FBI} and {CIA}}, + Edition = {3}, + Publisher = {IFLA International Office for UBC}, + Year = {1977}, + Location = {London} +} + +@Inproceedings{r27-BenHadjAlaya-FekiA.2008-1-5, + Title = {Interference cartography for hierarchical dynamic spectrum access}, + Address = {Chicago, IL}, + Author = {{Ben Hadj Alaya-Feki A.} and B. Sayrac and S. Ben Jemaa and E. Moulines}, + Booktitle = {Proc. IEEE Symp. on New Frontiers in Dynamic Spectrum Access Networks (DySPAN)}, + Date = {2008-10}, + Pages = {1-5} +} + +@Book{中国企业投资协会2014--, + Title = {投资台湾:大陆企业赴台投资指南}, + Address = {北京}, + Author = {{中国企业投资协会} and 台湾并购与私募股权协会 and 汇盈国际投资集团 and 国际投资集团}, + Publisher = {九州出版社}, + Year = {2014} +} + +@Book{中国企业投资协会2015--, + Title = {投资台湾:大陆企业赴台投资指南}, + Address = {北京}, + Author = {中国企业投资协会 and 台湾并购与私募股权协会 and 汇盈国际投资集团 and 国际投资集团}, + Publisher = {九州出版社}, + Year = {2015} +} + +@Manual{Tantau2015--, + Title = {The beamer class -- User Guide for version 3.36}, + Author = {Till Tantau and Joseph Wright and Vedran Miletić}, + Date = {2015-03-08}, + Url = {http://bitbucket.org/rivanvx/beamer} +} + +@Manual{Oetiker--, + Title = {一份不太简短的LATEX2ε介绍}, + Author = {Tobias Oetiker and Hubert Partl and Irene Hyna and Elisabeth Schlegl}, + Date = {2017-03}, + Translator = {ChinaTEX论坛}, + Url = {https://ctan.org/pkg/lshort-zh-cn}, + Urldate = {2018-04-23}, + Version = {5.10} +} + +@Manual{Daly2010--, + Title = {Natural Sciences Citations and References (package natbib)}, + Author = {Patrick W. Daly}, + Date = {2010-09-13}, + Url = {https://ctan.org/pkg/natbib}, + Urldate = {2018-04-27}, + Version = {8.31b} +} + +@Manual{Arseneau2010--, + Title = {chapterbib multiple bibliographies in LATEX}, + Author = {Donald Arseneau}, + Date = {2010-09-05}, + Url = {https://ctan.org/pkg/chapterbib}, + Urldate = {2018-04-23} +} + +@Manual{Shell2013--, + Title = {Mciteplus: Enhanced Multicitations}, + Author = {Michael Shell}, + Date = {2013-09-13}, + Url = {https://ctan.org/pkg/mciteplus}, + Urldate = {2018-04-23}, + Version = {1.2} +} + +@Online{Hansen2008--, + Title = {The multibib Package}, + Author = {Thorsten Hansen}, + Date = {2008-12-10}, + Url = {https://www.ctan.org/pkg/multibib}, + Urldate = {2018-05-04}, + Version = {v1.4} +} + +@Online{Seindal1994--, + Title = {Inline bibliography style}, + Author = {René Seindal}, + Date = {1994-12-06}, + Url = {https://www.ctan.org/pkg/inlinebib}, + Urldate = {2018-05-04} +} + +@Book{booknopubitems, + Title = {出版集团研究}, + Author = {余敏}, + Date = {2001}, + Pages = {50-63} +} + +@Comment{jabref-meta: databaseType:biblatex;} + +@Comment{jabref-entrytype: Newspaper: req[] opt[]} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015-gbk.def b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015-gbk.def new file mode 100644 index 0000000000..50b9a5c39c --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015-gbk.def @@ -0,0 +1,27 @@ +%% +%% --------------------------------------------------------------- +%% biblatex-gb7714-2015 --- A biblatex implementation of the +%% GBT7714-2015 bibliography style, GBK supported file +%% Maintained by huzhenzhen +%% E-mail: hzzmail@163.com +%% Released under the LaTeX Project Public License v1.3c or later +%% --------------------------------------------------------------- +%% + + \def\str@bibliography{ο} + \def\str@references{ο} + \def\str@bytranslator{} + \def\str@andotherscn{} + \def\str@backrefpage{ҳ} + \def\str@backrefpages{ҳ} + \def\str@noaddress{ز} + \def\str@nopublisher{߲} + \def\str@edition{} + \def\str@volumecn{} + \def\str@numbercn{} + \def\str@serialcn{} + \def\str@sameentry{ͬ} + \def\str@incn{} + \def\str@mathesiscn{˶ʿѧλ} + \def\str@phdthesiscn{ʿѧλ} + \def\str@editorcn{} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015.bbx new file mode 100644 index 0000000000..7bc20e9163 --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015.bbx @@ -0,0 +1,3462 @@ +%% +%% --------------------------------------------------------------- +%% biblatex-gb7714-2015 --- A biblatex implementation of the +%% GBT7714-2015 bibliography style,numerical sequence +%% Maintained by huzhenzhen +%% E-mail: hzzmail@163.com +%% Released under the LaTeX Project Public License v1.3c or later +%% --------------------------------------------------------------- +%% + +% +% 版本和时间信息 +% +\def\versionofgbtstyle{2019/08/28 v1.0s} +\def\versionofbiblatex{\abx@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@inf@delimdeclare#1#2{% + \blx@info{Delimiter '#1' in context '#2' already defined, overwriting}} + + \def\blx@warn@delimuse#1#2{% + \blx@warning{Delimiter '#1' in context '#2' undefined}} + % Delimiter interface + + % [<contextname, ...>]{<name, ...>}{<code>} + \newrobustcmd*{\DeclareDelimFormat}{% + \@ifstar + {\blx@declaredelimclear} + {\blx@declaredelim}} + + \newrobustcmd*{\blx@declaredelimclear}[3][]{% + \ifcsvoid{blx@declaredelimcontexts@#2} + {} + {\def\do##1{\csundef{blx@printdelim@##1@#2}}% + \dolistcsloop{blx@declaredelimcontexts@#2}}% + \cslet{blx@declaredelimcontexts@#2}\@empty + \ifblank{#1} + {\blx@declaredelim{#2}{#3}} + {\blx@declaredelim[#1]{#2}{#3}}} + + \newrobustcmd*{\blx@declaredelim}[3][]{% + \ifblank{#1} + {\blx@declaredelim@i{}{}{#2}{#3}} + {\def\do##1{% + \listcsadd{blx@declaredelimcontexts@#2}{##1}% + \blx@declaredelim@i{blx@printdelim@##1@}{##1}{#2}{#3}}% + \docsvlist{#1}}}% + + \def\blx@declaredelim@i#1#2#3#4{% + \def\do@i##1{% + \ifcsdef{#1##1} + {\blx@inf@delimdeclare{##1}{#2}} + {}% + \csdef{#1##1}{#4}}% + \forcsvlist{\do@i}{#3}} + + % *[<contextname, ...>]{<alias>}{<delim>} + \newrobustcmd*{\DeclareDelimAlias}{% + \@ifstar + {\blx@declaredelimalias} + {\blx@declaredelimaliasauto}} + + \newrobustcmd*{\blx@declaredelimalias}[3][]{% + \ifblank{#1} + {\blx@declaredelimalias@i{}{#2}{#3}} + {\def\do##1{% + \blx@declaredelimalias@i{blx@printdelim@##1@}{#2}{#3}}% + \docsvlist{#1}}} + + \newrobustcmd*{\blx@declaredelimaliasauto}[2]{% + \blx@declaredelimalias@i{}{#1}{#2}% + \ifcsvoid{blx@declaredelimcontexts@#2} + {} + {\def\do##1{% + \blx@declaredelimalias@i{blx@printdelim@##1@}{#1}{#2}}% + \dolistcsloop{blx@declaredelimcontexts@#2}}} + + \def\blx@declaredelimalias@i#1#2#3{% + \ifcsdef{#1#2} + {\blx@inf@delimdeclare{#2}{#1}} + {}% + \csdef{#1#2}{\csuse{#1#3}}} + + \def\blx@delimcontext{none} + \newcommand*{\printdelim}[2][]{% + \ifblank{#1} + {\ifcsdef{blx@printdelim@\blx@delimcontext @#2} + {\csuse{blx@printdelim@\blx@delimcontext @#2}} + {\ifcsdef{#2}% fall back on legacy macros + {\csuse{#2}} + {\blx@warn@delimuse{#2}{*}}}} + {\ifcsdef{blx@printdelim@#1@#2} + {\csuse{blx@printdelim@#1@#2}} + {\blx@warn@delimuse{#2}{#1}}}} + + \newcommand*{\delimcontext}[1]{% + \edef\blx@delimcontext{\blx@delimcontextalias{#1}}} + + \def\blx@delimcontextalias#1{% + \ifcsdef{blx@delimcontextalias@#1} + {\csuse{blx@delimcontextalias@#1}} + {#1}} + + \newcommand*{\DeclareDelimcontextAlias}[2]{% + \csgdef{blx@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} + + + +%===================================================================== +% 设置宏包选项 +%===================================================================== + % + % 增加一个控制是否输出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@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark + }% + \color@begingroup + \leftskip \footbibmargin%增加的左侧缩进 + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% + }% + \color@endgroup}}% + + \long\def\H@@mpfootnotetext##1{% + \global\setbox\@mpfootins\vbox{% + \unvbox\@mpfootins + \reset@font\footnotesize + \hsize\columnwidth + \@parboxrestore + \protected@edef\@currentlabel + {\csname p@mpfootnote\endcsname\@thefnmark}% + \leftskip \footbibmargin%增加的左侧缩进 + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% + \color@endgroup}} + }{%否则对latex核心代码中的\@footnotetext做重定义 + \long\def\@footnotetext##1{\insert\footins{% + \reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark + }% + \color@begingroup + \leftskip \footbibmargin%增加的左侧缩进 + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% + }% + \color@endgroup}}% + + \long\def\@mpfootnotetext##1{% + \global\setbox\@mpfootins\vbox{% + \unvbox\@mpfootins + \reset@font\footnotesize + \hsize\columnwidth + \@parboxrestore + \protected@edef\@currentlabel + {\csname p@mpfootnote\endcsname\@thefnmark}% + \leftskip \footbibmargin%增加的左侧缩进 + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% + \color@endgroup}} + } + + \long\def\@makefntext##1{%增加了脚注标记与正文的间隔 + \parindent 1em\noindent \hb@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@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@mpfootnote}{\thefootnote}% + }}% + }% + {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% + \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% + %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断 + }}% + } + + % + %重定义\footfullcite使完成gb7714-2015的脚注文献要求 + \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]% + {\defcounter{maxnames}{\blx@maxbibnames}%局部定义maxnames和minnames计数器 + \defcounter{minnames}{\blx@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@bibliography{参考文献} + \def\str@references{参考文献} + \def\str@bytranslator{译} + \def\str@andotherscn{等} + \def\str@backrefpage{引用页} + \def\str@backrefpages{引用页} + \def\str@noaddress{出版地不详} + \def\str@nopublisher{出版者不详} + \def\str@edition{版} + \def\str@volumecn{卷} + \def\str@numbercn{册} + \def\str@serialcn{第} + \def\str@sameentry{同} + \def\str@incn{见} + \def\str@mathesiscn{硕士学位论文} + \def\str@phdthesiscn{博士学位论文} + \def\str@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@defbibstrings#1#2{% + \def\do##1{\csundef{abx@lstr@##1}\csundef{abx@sstr@##1}}% + \abx@dostrings + \csuse{abx@strings@#1}% + \setkeys{blx@lbx}{#2}% + \let\do\blx@defbibstrings@i + \csxdef{abx@strings@#1}{\abx@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]{}% + + + % + % 选项设置 + % + \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@metadateinfo{#1}% + \iffieldundef{#1year} + {} + {\printtext[#1date]{% + \blx@gbdate{#1}{}}}% + \endgroup} + + \newrobustcmd*{\blx@gbdate}[3][]{% + \dateeraprintpre{#2#3year}% + \blx@imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}% + \iffieldundef{#2#3month}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3month}}}% + \iffieldundef{#2#3day}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3day}}}} + + + %为姓名格式选择增加的计数器 + \newcounter{gbnamefmtcase} + \def\thegbnamefmtcase{\the\c@gbnamefmtcase} + %为数字标签格式选择增加的计数器/命令 + \newcommand{\mkgbnumlabel}[1]{\mkbibbrackets{#1}} + \def\gbbiblabelopt@bracket{\renewcommand{\mkgbnumlabel}[1]{\mkbibbrackets{##1}}} + \def\gbbiblabelopt@parens{\renewcommand{\mkgbnumlabel}[1]{\mkbibparens{##1}}} + \def\gbbiblabelopt@dot{\renewcommand{\mkgbnumlabel}[1]{##1\adddot}} + \def\gbbiblabelopt@plain{\renewcommand{\mkgbnumlabel}[1]{##1}} + \def\gbbiblabelopt@box{\renewcommand{\mkgbnumlabel}[1]{\framebox{##1}}} + \def\gbbiblabelopt@circle{\renewcommand{\mkgbnumlabel}[1]{\textcircled{##1}}} + %为文献表中数字标签对齐方式选择增加的计数器/命令 + \newcounter{gbalignlabel} + \def\thegbalignlabel{\the\c@gbalignlabel} + %为引用标签标注/文献表中本地化字符串中英文选择增加的计数器/命令 + \newcounter{gbcitelocalcase} + \newcounter{gbbiblocalcase} + \def\thegbcitelocalcase{\the\c@gbcitelocalcase} + \def\thegbbiblocalcase{\the\c@gbbiblocalcase} + +\@ifpackagelater{biblatex}{2016/03/27} + { % 针对biblatex>=3.3版本的选项设置 + % 增加不同语言排序的切换选项 + % 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}}{}% + } + \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样式,不使用该选项,这里给出仅为兼容性考虑 + % 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@bibliography}, + references = {\str@references}, + bytranslator= {\str@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@andotherscn},%将超过3个人名的省略,et al.改成为 等 + andothersincitecn={\str@andotherscn},%将标注中的分开,便于与文献表中的区分 + andothersincite={et al\adddot}, + backrefpage = {\str@backrefpage:}, + backrefpages = {\str@backrefpages:}, + in={in\intitlepunct}, + volumecn={\str@volumecn}, + numbercn={\str@numbercn}, + serialcn={\str@serialcn}, + andothersjp={他}, + andotherskr={외}, + andjp={和}, + andkr={和}, + incn={\str@incn\addcolon\addspace}, + mathesiscn={\str@mathesiscn}, + phdthesiscn={\str@phdthesiscn}, + editorscn={\str@editorcn}, + editorcn={\str@editorcn}, +} + + % + % 增加两个命令用于临时的局部的修改本地化字符串 + % 其中\setlocalbibstring修改缩写字符串,setlocalbiblstring修改长字符串 + % 注意使用时因为是局部修改,因此要将其与需要修改的引用命令放在一个编组符号内 + % v1.0t,hzz,20190525 + \newcommand{\setlocalbibstring}[2]{% + \csdef{abx@sstr@#1}{#2}} + \newcommand{\setlocalbiblstring}[2]{% + \csdef{abx@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{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题 + \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]% + \step[fieldset=userd, fieldvalue={chinese}] + } + \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,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=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{%将没有设置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=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{%将没有设置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=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{%将没有设置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{\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.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版本时 + +% +%驱动别名等价于驱动层映射 +% +\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 +\setlength{\bibhang}{\biblabelsep}% +\newlength{\bibitemindent} +\setlength{\bibitemindent}{0pt} + + +\defbibenvironment{bibliography} + {\list + {\printtext[labelnumberwidth]{% + \printfield{labelprefix}% + \printfield{labelnumber}}} + {\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@bibitem##1{% + \blx@ifdata{##1} + {\begingroup + \blx@getdata{##1}% + \blx@bibcheck + \iftoggle{blx@skipentry}{}{% + \blx@setdefaultrefcontext{##1}% + \global\let\blx@noitem\@empty + \blx@setoptions@type\abx@field@entrytype + \blx@setoptions@entry + \blx@thelabelnumber + \addtocounter{instcount}\@ne + \blx@initsep + \blx@namesep + \csuse{blx@item@\blx@theenv}\relax +% \blx@initsep %移动到上面去,恢复bibnamesep等的作用机制 +% \blx@namesep + \csuse{blx@hook@bibitem}% + \blx@execute + \blx@initunit + \blx@anchor + \blx@beglangbib + \bibsentence + \blx@pagetracker + \blx@driver\abx@field@entrytype + \blx@postpunct + \blx@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: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}}]}}% + }% +} + +% +% 新增用于报纸的文献类型标识符的格式 +% +\DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper +\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}% +} + +% +% 新增用于标准的文献类型标识符的格式 +% +\DeclareFieldFormat{gbtypeflags}{%用于标准standard +\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}% +} + +% +% 重设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@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}% + \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} + + +% +% 重设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@edtfdate这种更底层的命令 + + % + % 专利的公告日期、或报纸的日期的输出宏 + % 20160701,v1.0,新增加 + % 20180405,v1.0k,为biblatexv3.7-3.9版本,出现多出点bug做处理,Hu Zhenzhen + % + % 原理方法:加上printtext避免破坏异步标点机制 + % + \newbibmacro*{newsdate}{% + \printtext{\blx@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@edtfdate{}{}\printtext{)}}% + }% + }}% +} + +% +% 日期信息的输出格式,针对biblatex>=3.10版本 +% +\defversion{3.10}{date}{ + \DeclareFieldFormat{urldate}{##1} + \renewbibmacro*{urldate}{% + \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令 + + % + % 专利的公告日期、或报纸的日期的输出宏 + % 20160701,v1.0,新增加 + % 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen + % + % 原理方法:加上printtext避免破坏异步标点机制 + % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份 + % 所以无法再用选项设置的方法,印象需要用底层的命令 + % 这里可以用\blx@isodate,但用\blx@gbdate试图避免版本判断 + \newbibmacro*{newsdate}{%% + \printtext{\blx@gbdate{}{}}%%\blx@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@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@tempa{}% + \setcounter{bbx:relatedtotal}{0}% + \def\do##1{% + \entrydata{##1}{% + \ifrelatedloop + {} + {\stepcounter{bbx:relatedtotal}% + \gappto{\bbx@tempa}{##1,}}}}% + \docsvfield{related}% + \restorefield{related}{\bbx@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@tempa{related}} + {\def\bbx@tempa{related:\strfield{relatedtype}}}% + \iffieldformatundef{relatedstring:\strfield{relatedtype}} + {\def\bbx@tempb{relatedstring:default}} + {\def\bbx@tempb{relatedstring:\strfield{relatedtype}}}% + \printtext[\bbx@tempa]{% + \usebibmacro{begrelatedloop}% + \iffieldundef{relatedstring} + {\ifboolexpr{ + test {\ifnumgreater{\value{bbx:relatedtotal}}{1}} + and + test {\ifbibxstring{\thefield{relatedtype}s}} + } + {\printtext[\bbx@tempb]{% + \bibstring[\mkrelatedstring]{\thefield{relatedtype}s}}} + {\iffieldbibstring{relatedtype} + {\printtext[\bbx@tempb]{% + \bibstring[\mkrelatedstring]{\thefield{relatedtype}}}} + {}}} + {\iffieldbibstring{relatedstring} + {\printtext[\bbx@tempb]{% + \bibstring[\mkrelatedstring]{\thefield{relatedstring}}}} + {\printfield[\bbx@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@noaddress}\space :\space\str@nopublisher]}% +{\printtext{[S.l.\space :\space s.n.\adddot]}}% +}{% +\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}}{\printtext{[S.l.\adddot]}}}% + {\printlist{location}}% +\addcolon\addspace% +\iflistundef{institution}{% +\iftoggle{ifCJKforgbt}{\printtext{[\str@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@noaddress}\space :\space\str@nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}% + {\iflistundef{location}{%\adddot + \iffieldequalstr{note}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。 + {\iftoggle{ifCJKforgbt}{\printtext{[\str@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@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@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@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}{}{%当没有网址时也不输出 + \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}} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015.cbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015.cbx new file mode 100644 index 0000000000..a62ca688b3 --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015.cbx @@ -0,0 +1,279 @@ +%% +%% --------------------------------------------------------------- +%% biblatex-gb7714-2015 --- A biblatex implementation of the +%% GBT7714-2015 citation style,numerical sequence +%% Maintained by huzhenzhen +%% E-mail: hzzmail@163.com +%% Released under the LaTeX Project Public License v1.3c or later +%% --------------------------------------------------------------- +%% +\def\versionofgbtstyle{2019/08/28 v1.0s} +\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}% + +% +% 定义一个上标方括号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的复数命令习惯 +% 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@lastprefix} ) + or + test {\iffieldequals{labelprefix}{\cbx@lastprefix}} + } + {\ifnumequal{\thefield{labelnumber}}{\value{cbx@tempcntb}} + {\savefield{entrykey}{\cbx@lastkey}% + \savefield{labelnumber}{\cbx@lastnumber}% + \addtocounter{cbx@tempcnta}{1}} + {\ifnumequal{\thefield{labelnumber}}{\value{cbx@tempcntb}-1} + {} + {\usebibmacro{citec:dump}% + \ifnumgreater{\value{cbx@tempcntb}}{-1} + {\multicitedelim} + {}% + \printtext[bibhyperref]{% + \printfield{labelprefix}% + \printtext[labelbracket]{\printfield{labelnumber}}}}}} + {\usebibmacro{cite:comp:end}}% + \setcounter{cbx@tempcntb}{\thefield{labelnumber}}% + \savefield{labelprefix}{\cbx@lastprefix}} + +\newbibmacro*{citec:comp}{% + \addtocounter{cbx@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@tempcnta}}{0} + {\ifnumgreater{\value{cbx@tempcnta}}{1} + {\bibrangedash} + {\multicitedelim}% + \bibhyperref[\cbx@lastkey]{% + \ifdef\cbx@lastprefix + {\printtext[labelprefix]{\cbx@lastprefix}} + {}% + \printtext[labelbracket]{\cbx@lastnumber}}}%labelnumber + {}% + \setcounter{cbx@tempcnta}{0}% + \global\undef\cbx@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} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.bbx new file mode 100644 index 0000000000..e0609f60a1 --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.bbx @@ -0,0 +1,3797 @@ +%% +%% --------------------------------------------------------------- +%% biblatex-gb7714-2015 --- A biblatex implementation of the +%% GBT7714-2015 bibliography style,author year sequence +%% Maintained by huzhenzhen +%% E-mail: hzzmail@163.com +%% Released under the LaTeX Project Public License v1.3c or later +%% --------------------------------------------------------------- +%% +% +% 版本和时间信息 +% +\def\versionofgbtstyle{2019/08/28 v1.0s} +\def\versionofbiblatex{\abx@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@inf@delimdeclare#1#2{% + \blx@info{Delimiter '#1' in context '#2' already defined, overwriting}} + + \def\blx@warn@delimuse#1#2{% + \blx@warning{Delimiter '#1' in context '#2' undefined}} + % Delimiter interface + + % [<contextname, ...>]{<name, ...>}{<code>} + \newrobustcmd*{\DeclareDelimFormat}{% + \@ifstar + {\blx@declaredelimclear} + {\blx@declaredelim}} + + \newrobustcmd*{\blx@declaredelimclear}[3][]{% + \ifcsvoid{blx@declaredelimcontexts@#2} + {} + {\def\do##1{\csundef{blx@printdelim@##1@#2}}% + \dolistcsloop{blx@declaredelimcontexts@#2}}% + \cslet{blx@declaredelimcontexts@#2}\@empty + \ifblank{#1} + {\blx@declaredelim{#2}{#3}} + {\blx@declaredelim[#1]{#2}{#3}}} + + \newrobustcmd*{\blx@declaredelim}[3][]{% + \ifblank{#1} + {\blx@declaredelim@i{}{}{#2}{#3}} + {\def\do##1{% + \listcsadd{blx@declaredelimcontexts@#2}{##1}% + \blx@declaredelim@i{blx@printdelim@##1@}{##1}{#2}{#3}}% + \docsvlist{#1}}}% + + \def\blx@declaredelim@i#1#2#3#4{% + \def\do@i##1{% + \ifcsdef{#1##1} + {\blx@inf@delimdeclare{##1}{#2}} + {}% + \csdef{#1##1}{#4}}% + \forcsvlist{\do@i}{#3}} + + % *[<contextname, ...>]{<alias>}{<delim>} + \newrobustcmd*{\DeclareDelimAlias}{% + \@ifstar + {\blx@declaredelimalias} + {\blx@declaredelimaliasauto}} + + \newrobustcmd*{\blx@declaredelimalias}[3][]{% + \ifblank{#1} + {\blx@declaredelimalias@i{}{#2}{#3}} + {\def\do##1{% + \blx@declaredelimalias@i{blx@printdelim@##1@}{#2}{#3}}% + \docsvlist{#1}}} + + \newrobustcmd*{\blx@declaredelimaliasauto}[2]{% + \blx@declaredelimalias@i{}{#1}{#2}% + \ifcsvoid{blx@declaredelimcontexts@#2} + {} + {\def\do##1{% + \blx@declaredelimalias@i{blx@printdelim@##1@}{#1}{#2}}% + \dolistcsloop{blx@declaredelimcontexts@#2}}} + + \def\blx@declaredelimalias@i#1#2#3{% + \ifcsdef{#1#2} + {\blx@inf@delimdeclare{#2}{#1}} + {}% + \csdef{#1#2}{\csuse{#1#3}}} + + \def\blx@delimcontext{none} + \newcommand*{\printdelim}[2][]{% + \ifblank{#1} + {\ifcsdef{blx@printdelim@\blx@delimcontext @#2} + {\csuse{blx@printdelim@\blx@delimcontext @#2}} + {\ifcsdef{#2}% fall back on legacy macros + {\csuse{#2}} + {\blx@warn@delimuse{#2}{*}}}} + {\ifcsdef{blx@printdelim@#1@#2} + {\csuse{blx@printdelim@#1@#2}} + {\blx@warn@delimuse{#2}{#1}}}} + + \newcommand*{\delimcontext}[1]{% + \edef\blx@delimcontext{\blx@delimcontextalias{#1}}} + + \def\blx@delimcontextalias#1{% + \ifcsdef{blx@delimcontextalias@#1} + {\csuse{blx@delimcontextalias@#1}} + {#1}} + + \newcommand*{\DeclareDelimcontextAlias}[2]{% + \csgdef{blx@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} + + + +%===================================================================== +% 设置宏包选项 +%===================================================================== + % + % 增加一个控制是否输出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@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark + }% + \color@begingroup + \leftskip \footbibmargin%增加的左侧缩进 + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% + }% + \color@endgroup}}% + \long\def\H@@mpfootnotetext##1{% + \global\setbox\@mpfootins\vbox{% + \unvbox\@mpfootins + \reset@font\footnotesize + \hsize\columnwidth + \@parboxrestore + \protected@edef\@currentlabel + {\csname p@mpfootnote\endcsname\@thefnmark}% + \leftskip \footbibmargin%增加的左侧缩进 + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% + \color@endgroup}} + }{%否则对latex核心代码中的\@footnotetext做重定义 + \long\def\@footnotetext##1{\insert\footins{% + \reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark + }% + \color@begingroup + \leftskip \footbibmargin%增加的左侧缩进 + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% + }% + \color@endgroup}}% + + \long\def\@mpfootnotetext##1{% + \global\setbox\@mpfootins\vbox{% + \unvbox\@mpfootins + \reset@font\footnotesize + \hsize\columnwidth + \@parboxrestore + \protected@edef\@currentlabel + {\csname p@mpfootnote\endcsname\@thefnmark}% + \leftskip \footbibmargin%增加的左侧缩进 + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% + \color@endgroup}} + } + + \long\def\@makefntext##1{%增加了脚注标记与正文的间隔 + \parindent 1em\noindent \hb@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@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@mpfootnote}{\thefootnote}% + }}% + }% + {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% + \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% + %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断 + }}% + } + + % + %重定义\footfullcite使完成gb7714-2015的脚注文献要求 + \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]% + {\defcounter{maxnames}{\blx@maxbibnames}%局部定义maxnames和minnames计数器 + \defcounter{minnames}{\blx@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@bibliography{参考文献} + \def\str@references{参考文献} + \def\str@bytranslator{译} + \def\str@andotherscn{等} + \def\str@backrefpage{引用页} + \def\str@backrefpages{引用页} + \def\str@noaddress{出版地不详} + \def\str@nopublisher{出版者不详} + \def\str@edition{版} + \def\str@volumecn{卷} + \def\str@numbercn{册} + \def\str@serialcn{第} + \def\str@sameentry{同} + \def\str@incn{见} + \def\str@mathesiscn{硕士学位论文} + \def\str@phdthesiscn{博士学位论文} + \def\str@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@defbibstrings#1#2{% + \def\do##1{\csundef{abx@lstr@##1}\csundef{abx@sstr@##1}}% + \abx@dostrings + \csuse{abx@strings@#1}% + \setkeys{blx@lbx}{#2}% + \let\do\blx@defbibstrings@i + \csxdef{abx@strings@#1}{\abx@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@metadateinfo{#1}% + \iffieldundef{#1year} + {} + {\printtext[#1date]{% + \blx@gbdate{#1}{}}}% + \endgroup} + + \newrobustcmd*{\blx@gbdate}[3][]{% + \dateeraprintpre{#2#3year}% + \blx@imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}% + \iffieldundef{#2#3month}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3month}}}% + \iffieldundef{#2#3day}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3day}}}} + + %为姓名格式选择增加的计数器 + \newcounter{gbnamefmtcase} + \def\thegbnamefmtcase{\the\c@gbnamefmtcase} + %为引用标签标注/文献表中本地化字符串中英文选择增加的计数器/命令 + \newcounter{gbcitelocalcase} + \newcounter{gbbiblocalcase} + \def\thegbcitelocalcase{\the\c@gbcitelocalcase} + \def\thegbbiblocalcase{\the\c@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@bibliography}, + references = {\str@references}, + bytranslator= {\str@bytranslator\adddot}, %将trans. by 改成 译 + and = {\addcomma},%将第2和3人名见的and符号改成 逗号,用\finalnamedelim命令也可以定义,参见3.9.1节 + andcn = {\addcomma},%\str@andcn\ and本地化字符串的中文对应词 + andincitecn = {\addcomma},%将标注中的分开,便于与文献表中的区分 + andincite = {\addcomma}, + %andothers = {et al.}, %将超过3个人名的省略,et al.改成为 等 + andotherscn = {\str@andotherscn},%将超过3个人名的省略,et al.改成为 等 + andothersincitecn={\str@andotherscn},%将标注中的分开,便于与文献表中的区分 + andothersincite={et al\adddot}, + backrefpage = {\str@backrefpage:}, + backrefpages = {\str@backrefpages:}, + in={in\intitlepunct}, + volumecn={\str@volumecn}, + numbercn={\str@numbercn}, + serialcn={\str@serialcn}, + andothersjp={他}, + andotherskr={외}, + andjp={和}, + andkr={和}, + incn={\str@incn\addcolon\addspace}, + mathesiscn={\str@mathesiscn}, + phdthesiscn={\str@phdthesiscn}, + editorscn={\str@editorcn}, + editorcn={\str@editorcn}, + } + + % + % 增加两个命令用于临时的局部的修改本地化字符串 + % 其中\setlocalbibstring修改缩写字符串,setlocalbiblstring修改长字符串 + % 注意使用时因为是局部修改,因此要将其与需要修改的引用命令放在一个编组符号内 + % v1.0t,hzz,20190525 + \newcommand{\setlocalbibstring}[2]{% + \csdef{abx@sstr@#1}{#2}} + \newcommand{\setlocalbiblstring}[2]{% + \csdef{abx@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混淆,处理后使用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{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题 + \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]% + \step[fieldset=userd, fieldvalue={chinese}] + } + \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,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=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{%将没有设置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=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{%将没有设置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=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{%将没有设置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{\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} + + +%===================================================================== +% 设置排序格式 +%===================================================================== +% +% 排序格式,用降序,及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{%[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{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{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{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{%[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{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{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{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} + \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} +\renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%页码引用格式的修改%修改为用冒号 +%\renewcommand{\relateddelim}{}%\par + +%===================================================================== +% 修改域的格式,重定义域的输出宏 +%===================================================================== +% +% 新增文献类型标识符的格式 +% []前的nobreak,从GB4.1节的例子看不应该加,所以去掉 +% 但因为考虑到cjk字符和[]之间可能添加空格,所以仍然加上 +% 而[]中间的内容,从4.6.2节的例子看也是可以分割的,因此内部的nobreak也可以去掉 +% +\DeclareFieldFormat{gbtypeflag}{% +\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}}]}}% + }% +} + + +% +% 新增用于报纸的文献类型标识符的格式 +% +\DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper +\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}% +} + + +% +% 新增用于标准的文献类型标识符的格式 +% +\DeclareFieldFormat{gbtypeflags}{%用于标准standard +\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}% +} + +% +% 重设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 +\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@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}{\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@edtfdate这种更底层的命令 + + % + % 专利的公告日期、或报纸的日期的输出宏 + % 20160701,v1.0,新增加 + % 20180405,v1.0k,为biblatexv3.7-3.9版本,出现多出点bug做处理,Hu Zhenzhen + % + % 原理方法:加上printtext避免破坏异步标点机制 + % + \newbibmacro*{newsdate}{% + \printtext{\blx@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@edtfdate{}{}\printtext{)}}% + }% + }}% +} + +% +% 日期信息的输出格式,针对biblatex>=3.10版本 +% +\defversion{3.10}{date}{ + \DeclareFieldFormat{urldate}{##1} + \renewbibmacro*{urldate}{% + \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令 + + % + % 专利的公告日期、或报纸的日期的输出宏 + % 20160701,v1.0,新增加 + % 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen + % + % 原理方法:加上printtext避免破坏异步标点机制 + % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份 + % 所以无法再用选项设置的方法,印象需要用底层的命令 + % 这里可以用\blx@isodate,但用\blx@gbdate试图避免版本判断 + \newbibmacro*{newsdate}{%% + \printtext{\blx@gbdate{}{}}%%\blx@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@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@tempa{}% + \setcounter{bbx:relatedtotal}{0}% + \def\do##1{% + \entrydata{##1}{% + \ifrelatedloop + {} + {\stepcounter{bbx:relatedtotal}% + \gappto{\bbx@tempa}{##1,}}}}% + \docsvfield{related}% + \restorefield{related}{\bbx@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@tempa{related}} + {\def\bbx@tempa{related:\strfield{relatedtype}}}% + \iffieldformatundef{relatedstring:\strfield{relatedtype}} + {\def\bbx@tempb{relatedstring:default}} + {\def\bbx@tempb{relatedstring:\strfield{relatedtype}}}% + \printtext[\bbx@tempa]{% + \usebibmacro{begrelatedloop}% + \iffieldundef{relatedstring} + {\ifboolexpr{ + test {\ifnumgreater{\value{bbx:relatedtotal}}{1}} + and + test {\ifbibxstring{\thefield{relatedtype}s}} + } + {\printtext[\bbx@tempb]{% + \bibstring[\mkrelatedstring]{\thefield{relatedtype}s}}} + {\iffieldbibstring{relatedtype} + {\printtext[\bbx@tempb]{% + \bibstring[\mkrelatedstring]{\thefield{relatedtype}}}} + {}}} + {\iffieldbibstring{relatedstring} + {\printtext[\bbx@tempb]{% + \bibstring[\mkrelatedstring]{\thefield{relatedstring}}}} + {\printfield[\bbx@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@noaddress}\space :\space\str@nopublisher]}% +{\printtext{[S.l.\space :\space s.n.\adddot]}}% +}{% +\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}}{\printtext{[S.l.\adddot]}}}% + {\printlist{location}}% +\addcolon\addspace% +\iflistundef{institution}{% +\iftoggle{ifCJKforgbt}{\printtext{[\str@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@noaddress}\space :\space\str@nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}% + {\iflistundef{location}{%\adddot + \iffieldequalstr{note}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。 + {\iftoggle{ifCJKforgbt}{\printtext{[\str@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@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@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@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@lasthash + \usebibmacro{labeltitle}% + \setunit*{\addspace}}% + \setunit{\addcomma\space}%增加一个逗号 + \usebibmacro{date+extrayear} + } + +% +% 设置标注和文献表中作者和年份之间的分隔符 +% +% 原理方法:注意3.4版已经有\nameyeardelim,上述修改的author宏虽然定义了著录表中的标点,但标注中的未定义 +% 设置因为mergedate默认为true时的情况,来自\bbx@opt@mergedate@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@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@opt@mergedate@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@opt@mergedate@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@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}{}{%当没有网址时也不输出 + \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}} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.cbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.cbx new file mode 100644 index 0000000000..9b9adf9b14 --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ay.cbx @@ -0,0 +1,271 @@ +%% +%% --------------------------------------------------------------- +%% biblatex-gb7714-2015 --- A biblatex implementation of the +%% GBT7714-2015 citation style,author year sequence +%% Maintained by huzhenzhen +%% E-mail: hzzmail@163.com +%% Released under the LaTeX Project Public License v1.3c or later +%% --------------------------------------------------------------- +%% +\def\versionofgbtstyle{2019/08/28 v1.0s} +\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命令。 +\DeclareDelimFormat[textcite]{nameyeardelim}{}%\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*{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@lasthash} + {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND + \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)} + {\setunit{\addcomma}% + \usebibmacro{cite:extradate}} + {\setunit{\compcitedelim}% + \usebibmacro{cite:labeldate+extradate}% + \savefield{labelyear}{\cbx@lastyear}}} + {\printnames{labelname}% + %\setunit{\printdelim{nameyeardelim}}% + (\usebibmacro{cite:labeldate+extradate})% + \savefield{namehash}{\cbx@lasthash}% + \savefield{labelyear}{\cbx@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} + } + +\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} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.bbx new file mode 100644 index 0000000000..13d158fd93 --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.bbx @@ -0,0 +1,2710 @@ +%% +%% --------------------------------------------------------------- +%% biblatex-gb7714-2015 --- A biblatex implementation of the +%% GBT7714-2015 bibliography style,numerical sequence +%% Maintained by huzhenzhen +%% E-mail: hzzmail@163.com +%% Released under the LaTeX Project Public License v1.3c or later +%% --------------------------------------------------------------- +%% + +% +% 版本和时间信息 +% +\def\versionofgbtstyle{2019/08/28 v1.0s} +\def\versionofbiblatex{\abx@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@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} + + + +%===================================================================== +% 设置宏包选项 +%===================================================================== + % + % 增加一个控制是否输出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@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark + }% + \color@begingroup + \leftskip \footbibmargin%增加的左侧缩进 + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% + }% + \color@endgroup}}% + + \long\def\H@@mpfootnotetext##1{% + \global\setbox\@mpfootins\vbox{% + \unvbox\@mpfootins + \reset@font\footnotesize + \hsize\columnwidth + \@parboxrestore + \protected@edef\@currentlabel + {\csname p@mpfootnote\endcsname\@thefnmark}% + \leftskip \footbibmargin%增加的左侧缩进 + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% + \color@endgroup}} + }{%否则对latex核心代码中的\@footnotetext做重定义 + \long\def\@footnotetext##1{\insert\footins{% + \reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark + }% + \color@begingroup + \leftskip \footbibmargin%增加的左侧缩进 + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% + }% + \color@endgroup}}% + + \long\def\@mpfootnotetext##1{% + \global\setbox\@mpfootins\vbox{% + \unvbox\@mpfootins + \reset@font\footnotesize + \hsize\columnwidth + \@parboxrestore + \protected@edef\@currentlabel + {\csname p@mpfootnote\endcsname\@thefnmark}% + \leftskip \footbibmargin%增加的左侧缩进 + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% + \color@endgroup}} + } + + \long\def\@makefntext##1{%增加了脚注标记与正文的间隔 + \parindent 1em\noindent \hb@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@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@mpfootnote}{\thefootnote}% + }}% + }% + {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% + \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% + %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断 + }}% + } + + % + %重定义\footfullcite使完成gb7714-2015的脚注文献要求 + \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]% + {\defcounter{maxnames}{\blx@maxbibnames}%局部定义maxnames和minnames计数器 + \defcounter{minnames}{\blx@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@bibliography{参考文献} + \def\str@references{参考文献} + \def\str@bytranslator{译} + \def\str@andotherscn{等} + \def\str@backrefpage{引用页} + \def\str@backrefpages{引用页} + \def\str@noaddress{出版地不详} + \def\str@nopublisher{出版者不详} + \def\str@edition{版} + \def\str@volumecn{卷} + \def\str@numbercn{册} + \def\str@serialcn{第} + \def\str@sameentry{同} + \def\str@incn{见} + \def\str@mathesiscn{硕士学位论文} + \def\str@phdthesiscn{博士学位论文} + \def\str@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@defbibstrings#1#2{% + \def\do##1{\csundef{abx@lstr@##1}\csundef{abx@sstr@##1}}% + \abx@dostrings + \csuse{abx@strings@#1}% + \setkeys{blx@lbx}{#2}% + \let\do\blx@defbibstrings@i + \csxdef{abx@strings@#1}{\abx@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@metadateinfo{#1}% + \iffieldundef{#1year} + {} + {\printtext[#1date]{% + \blx@gbdate{#1}{}}}% + \endgroup} + + \newrobustcmd*{\blx@gbdate}[3][]{% + \dateeraprintpre{#2#3year}% + \blx@imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}% + \iffieldundef{#2#3month}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3month}}}% + \iffieldundef{#2#3day}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3day}}}} + + %为姓名格式选择增加的计数器 + \newcounter{gbnamefmtcase} + \def\thegbnamefmtcase{\the\c@gbnamefmtcase} + %为数字标签格式选择增加的计数器/命令 + \newcommand{\mkgbnumlabel}[1]{\mkbibbrackets{#1}} + \def\gbbiblabelopt@bracket{\renewcommand{\mkgbnumlabel}[1]{\mkbibbrackets{##1}}} + \def\gbbiblabelopt@parens{\renewcommand{\mkgbnumlabel}[1]{\mkbibparens{##1}}} + \def\gbbiblabelopt@dot{\renewcommand{\mkgbnumlabel}[1]{##1\adddot}} + \def\gbbiblabelopt@plain{\renewcommand{\mkgbnumlabel}[1]{##1}} + \def\gbbiblabelopt@box{\renewcommand{\mkgbnumlabel}[1]{\framebox{##1}}} + \def\gbbiblabelopt@circle{\renewcommand{\mkgbnumlabel}[1]{\textcircled{##1}}} + %为文献表中数字标签对齐方式选择增加的计数器/命令 + \newcounter{gbalignlabel} + \def\thegbalignlabel{\the\c@gbalignlabel} + %为引用标签标注/文献表中本地化字符串中英文选择增加的计数器/命令 + \newcounter{gbcitelocalcase} + \newcounter{gbbiblocalcase} + \def\thegbcitelocalcase{\the\c@gbcitelocalcase} + \def\thegbbiblocalcase{\the\c@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@bibliography}, + references = {\str@references}, + bytranslator= {\str@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@andotherscn}, %将超过3个人名的省略,et al.改成为 等 + andothersincitecn={\str@andotherscn},%将标注中的分开,便于与文献表中的区分 + andothersincite={et al\adddot}, + backrefpage = {\str@backrefpage:}, + backrefpages = {\str@backrefpages:}, + in={in\intitlepunct}, + volumecn={\str@volumecn}, + numbercn={\str@numbercn}, + serialcn={\str@serialcn}, + andothersjp={他}, + andotherskr={외}, + andjp={和}, + andkr={和}, + incn={\str@incn\addcolon\addspace}, + mathesiscn={\str@mathesiscn}, + phdthesiscn={\str@phdthesiscn}, + editorscn={\str@editorcn}, + editorcn={\str@editorcn}, +} + + % + % 增加两个命令用于临时的局部的修改本地化字符串 + % 其中\setlocalbibstring修改缩写字符串,setlocalbiblstring修改长字符串 + % 注意使用时因为是局部修改,因此要将其与需要修改的引用命令放在一个编组符号内 + % v1.0t,hzz,20190525 + \newcommand{\setlocalbibstring}[2]{% + \csdef{abx@sstr@#1}{#2}} + \newcommand{\setlocalbiblstring}[2]{% + \csdef{abx@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{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题 + \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]% + \step[fieldset=userd, fieldvalue={chinese}] + } + \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,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=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{%将没有设置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=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{%将没有设置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=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{%将没有设置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{\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 +\setlength{\bibhang}{\biblabelsep}% +\newlength{\bibitemindent} +\setlength{\bibitemindent}{0pt} + + +\defbibenvironment{bibliography} + {\list + {\printtext[labelnumberwidth]{% + \printfield{labelprefix}% + \printfield{labelnumber}}} + {\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@bibitem##1{% + \blx@ifdata{##1} + {\begingroup + \blx@getdata{##1}% + \blx@bibcheck + \iftoggle{blx@skipentry}{}{% + \blx@setdefaultrefcontext{##1}% + \global\let\blx@noitem\@empty + \blx@setoptions@type\abx@field@entrytype + \blx@setoptions@entry + \blx@thelabelnumber + \addtocounter{instcount}\@ne + \blx@initsep + \blx@namesep + \csuse{blx@item@\blx@theenv}\relax +% \blx@initsep %移动到上面去,恢复bibnamesep等的作用机制 +% \blx@namesep + \csuse{blx@hook@bibitem}% + \blx@execute + \blx@initunit + \blx@anchor + \blx@beglangbib + \bibsentence + \blx@pagetracker + \blx@driver\abx@field@entrytype + \blx@postpunct + \blx@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: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}}]}}% + }% +} + +% +% 新增用于报纸的文献类型标识符的格式 +% +\DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper +\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}% +} + +% +% 新增用于标准的文献类型标识符的格式 +% +\DeclareFieldFormat{gbtypeflags}{%用于标准standard +\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}% +} + +% +% 重设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@macro@title}{\newunitpunct}{}{}{}}}{} + + + % + % 专利的公告日期、或报纸的日期的输出宏 + % 20160701,v1.0,新增加 + % 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen + % + % 原理方法:加上printtext避免破坏异步标点机制 + % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份 + % 所以无法再用选项设置的方法,印象需要用底层的命令 + % 这里可以用\blx@isodate,但用自定义的\blx@gbdate,以避免版本判断 + \newbibmacro*{newsdate}{%% + \printtext{\blx@gbdate{}{}}%%\blx@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@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@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@noaddress}\space :\space\str@nopublisher]}% +{\printtext{[S.l.\space :\space s.n.\adddot]}}% +}{% +\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}}{\printtext{[S.l.\adddot]}}}% + {\printlist{location}}% +\addcolon\addspace% +\iflistundef{institution}{% +\iftoggle{ifCJKforgbt}{\printtext{[\str@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@noaddress}\space :\space\str@nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}% + {\iflistundef{location}{%\adddot + \iffieldequalstr{note}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。 + {\iftoggle{ifCJKforgbt}{\printtext{[\str@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@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@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@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@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@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}{}{%当没有网址时也不输出 + \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@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@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@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@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@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@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@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}% diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.cbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.cbx new file mode 100644 index 0000000000..8c19244e17 --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015ms.cbx @@ -0,0 +1,190 @@ +%% +%% --------------------------------------------------------------- +%% biblatex-gb7714-2015 --- A biblatex implementation of the +%% GBT7714-2015 citation style,numerical sequence +%% Maintained by huzhenzhen +%% E-mail: hzzmail@163.com +%% Released under the LaTeX Project Public License v1.3c or later +%% --------------------------------------------------------------- +%% +\def\versionofgbtstyle{2019/08/28 v1.0s} +\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} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.bbx new file mode 100644 index 0000000000..d92ac1daf9 --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.bbx @@ -0,0 +1,3311 @@ +%% +%% --------------------------------------------------------------- +%% biblatex-gb7714-2015 --- A biblatex implementation of the +%% GBT7714-2015 bibliography style,numerical sequence and authoryear mixed style +%% Maintained by huzhenzhen +%% E-mail: hzzmail@163.com +%% Released under the LaTeX Project Public License v1.3c or later +%% --------------------------------------------------------------- +%% + +% +% 版本和时间信息 +% +\def\versionofgbtstyle{2019/08/28 v1.0s} +\def\versionofbiblatex{\abx@version} +\ProvidesFile{gb7714-2015mx.bbx}[\versionofgbtstyle biblatex bibliography style] +%\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求 + +%===================================================================== +% 加载标准样式 +%===================================================================== +\RequireBibliographyStyle{numeric-comp} +\RequirePackage{xstring}%解决texlive2015的biblatex3.0不加载xstring包的问题 + + +%===================================================================== +% 功能函数 +%===================================================================== + % + % 增加一个控制是否输出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@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} + + + + + +%===================================================================== +% 设置宏包选项 +%===================================================================== + % + % 增加一个控制是否输出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@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark + }% + \color@begingroup + \leftskip \footbibmargin%增加的左侧缩进 + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% + }% + \color@endgroup}}% + + \long\def\H@@mpfootnotetext##1{% + \global\setbox\@mpfootins\vbox{% + \unvbox\@mpfootins + \reset@font\footnotesize + \hsize\columnwidth + \@parboxrestore + \protected@edef\@currentlabel + {\csname p@mpfootnote\endcsname\@thefnmark}% + \leftskip \footbibmargin%增加的左侧缩进 + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% + \color@endgroup}} + }{%否则对latex核心代码中的\@footnotetext做重定义 + \long\def\@footnotetext##1{\insert\footins{% + \reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark + }% + \color@begingroup + \leftskip \footbibmargin%增加的左侧缩进 + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% + }% + \color@endgroup}}% + + \long\def\@mpfootnotetext##1{% + \global\setbox\@mpfootins\vbox{% + \unvbox\@mpfootins + \reset@font\footnotesize + \hsize\columnwidth + \@parboxrestore + \protected@edef\@currentlabel + {\csname p@mpfootnote\endcsname\@thefnmark}% + \leftskip \footbibmargin%增加的左侧缩进 + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% + \color@endgroup}} + } + + \long\def\@makefntext##1{%增加了脚注标记与正文的间隔 + \parindent 1em\noindent \hb@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@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@mpfootnote}{\thefootnote}% + }}% + }% + {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% + \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% + %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断 + }}% + } + + % + %重定义\footfullcite使完成gb7714-2015的脚注文献要求 + \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]% + {\defcounter{maxnames}{\blx@maxbibnames}%局部定义maxnames和minnames计数器 + \defcounter{minnames}{\blx@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@bibliography{参考文献} + \def\str@references{参考文献} + \def\str@bytranslator{译} + \def\str@andotherscn{等} + \def\str@backrefpage{引用页} + \def\str@backrefpages{引用页} + \def\str@noaddress{出版地不详} + \def\str@nopublisher{出版者不详} + \def\str@edition{版} + \def\str@volumecn{卷} + \def\str@numbercn{册} + \def\str@serialcn{第} + \def\str@sameentry{同} + \def\str@incn{见} + \def\str@mathesiscn{硕士学位论文} + \def\str@phdthesiscn{博士学位论文} + \def\str@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@defbibstrings#1#2{% + \def\do##1{\csundef{abx@lstr@##1}\csundef{abx@sstr@##1}}% + \abx@dostrings + \csuse{abx@strings@#1}% + \setkeys{blx@lbx}{#2}% + \let\do\blx@defbibstrings@i + \csxdef{abx@strings@#1}{\abx@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@metadateinfo{#1}% + \iffieldundef{#1year} + {} + {\printtext[#1date]{% + \blx@gbdate{#1}{}}}% + \endgroup} + + \newrobustcmd*{\blx@gbdate}[3][]{% + \dateeraprintpre{#2#3year}% + \blx@imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}% + \iffieldundef{#2#3month}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3month}}}% + \iffieldundef{#2#3day}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3day}}}} + + + %为姓名格式选择增加的计数器 + \newcounter{gbnamefmtcase} + \def\thegbnamefmtcase{\the\c@gbnamefmtcase} + %为数字标签格式选择增加的计数器/命令 + \newcommand{\mkgbnumlabel}[1]{\mkbibbrackets{#1}} + \def\gbbiblabelopt@bracket{\renewcommand{\mkgbnumlabel}[1]{\mkbibbrackets{##1}}} + \def\gbbiblabelopt@parens{\renewcommand{\mkgbnumlabel}[1]{\mkbibparens{##1}}} + \def\gbbiblabelopt@dot{\renewcommand{\mkgbnumlabel}[1]{##1\adddot}} + \def\gbbiblabelopt@plain{\renewcommand{\mkgbnumlabel}[1]{##1}} + \def\gbbiblabelopt@box{\renewcommand{\mkgbnumlabel}[1]{\framebox{##1}}} + \def\gbbiblabelopt@circle{\renewcommand{\mkgbnumlabel}[1]{\textcircled{##1}}} + %为文献表中数字标签对齐方式选择增加的计数器/命令 + \newcounter{gbalignlabel} + \def\thegbalignlabel{\the\c@gbalignlabel} + %为引用标签标注/文献表中本地化字符串中英文选择增加的计数器/命令 + \newcounter{gbcitelocalcase} + \newcounter{gbbiblocalcase} + \def\thegbcitelocalcase{\the\c@gbcitelocalcase} + \def\thegbbiblocalcase{\the\c@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@bibliography}, + references = {\str@references}, + bytranslator= {\str@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@andotherscn},%将超过3个人名的省略,et al.改成为 等 + andothersincitecn={\str@andotherscn},%将标注中的分开,便于与文献表中的区分 + andothersincite={et al\adddot}, + backrefpage = {\str@backrefpage:}, + backrefpages = {\str@backrefpages:}, + in={in\intitlepunct}, + volumecn={\str@volumecn}, + numbercn={\str@numbercn}, + serialcn={\str@serialcn}, + andothersjp={他}, + andotherskr={외}, + andjp={和}, + andkr={和}, + incn={\str@incn\addcolon\addspace}, + mathesiscn={\str@mathesiscn}, + phdthesiscn={\str@phdthesiscn}, + editorscn={\str@editorcn}, + editorcn={\str@editorcn}, +} + + % + % 增加两个命令用于临时的局部的修改本地化字符串 + % 其中\setlocalbibstring修改缩写字符串,setlocalbiblstring修改长字符串 + % 注意使用时因为是局部修改,因此要将其与需要修改的引用命令放在一个编组符号内 + % v1.0t,hzz,20190525 + \newcommand{\setlocalbibstring}[2]{% + \csdef{abx@sstr@#1}{#2}} + \newcommand{\setlocalbiblstring}[2]{% + \csdef{abx@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{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题 + \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]% + \step[fieldset=userd, fieldvalue={chinese}] + } + \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,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=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{%将没有设置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=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{%将没有设置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=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{%将没有设置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{\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{%[direction=descending] + \field{sortname} + \field{author} + \field{editor} + \field{translator} + \field{sorttitle} + \field{title} + } + \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{sortname} + \field{author} + \field{editor} + \field{translator} + \field{sorttitle} + \field{title} + } + \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{sortname} + \field{author} + \field{editor} + \field{translator} + \field{sorttitle} + \field{title} + } + \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{sortname} + \field{author} + \field{editor} + \field{translator} + \field{sorttitle} + \field{title} + } + \sort{ + \field{sorttitle} + \field{title} + } + \sort{ + \field{volume} + \literal{0} + } + } + +%===================================================================== +% 参考文献表环境 +%===================================================================== +% +% 列表格式 +% +% 增加一个\bibitemindent尺寸用于控制list环境的itemindent +% v1.0l,20180615,hzz +\setlength{\bibhang}{\biblabelsep}% +\newlength{\bibitemindent} +\setlength{\bibitemindent}{0pt} + + +\defbibenvironment{bibliography} + {\list + {\printtext[labelnumberwidth]{% + \printfield{labelprefix}% + \printfield{labelnumber}}} + {\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@bibitem##1{% + \blx@ifdata{##1} + {\begingroup + \blx@getdata{##1}% + \blx@bibcheck + \iftoggle{blx@skipentry}{}{% + \blx@setdefaultrefcontext{##1}% + \global\let\blx@noitem\@empty + \blx@setoptions@type\abx@field@entrytype + \blx@setoptions@entry + \blx@thelabelnumber + \addtocounter{instcount}\@ne + \blx@initsep + \blx@namesep + \csuse{blx@item@\blx@theenv}\relax +% \blx@initsep %移动到上面去,恢复bibnamesep等的作用机制 +% \blx@namesep + \csuse{blx@hook@bibitem}% + \blx@execute + \blx@initunit + \blx@anchor + \blx@beglangbib + \bibsentence + \blx@pagetracker + \blx@driver\abx@field@entrytype + \blx@postpunct + \blx@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: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}}]}}% + }% +} + +% +% 新增用于报纸的文献类型标识符的格式 +% +\DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper +\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}% +} + +% +% 新增用于标准的文献类型标识符的格式 +% +\DeclareFieldFormat{gbtypeflags}{%用于标准standard +\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}% +} + +% +% 重设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@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@edtfdate这种更底层的命令 + + % + % 专利的公告日期、或报纸的日期的输出宏 + % 20160701,v1.0,新增加 + % 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen + % + % 原理方法:加上printtext避免破坏异步标点机制 + % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份 + % 所以无法再用选项设置的方法,印象需要用底层的命令 + % 这里可以用\blx@isodate,但用\blx@gbdate试图避免版本判断 + \newbibmacro*{newsdate}{%% + \printtext{\blx@gbdate{}{}}%%\blx@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@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@noaddress}\space :\space\str@nopublisher]}% +{\printtext{[S.l.\space :\space s.n.\adddot]}}% +}{% +\iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}}{\printtext{[S.l.\adddot]}}}% + {\printlist{location}}% +\addcolon\addspace% +\iflistundef{institution}{% +\iftoggle{ifCJKforgbt}{\printtext{[\str@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@noaddress}\space :\space\str@nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}% + {\iflistundef{location}{%\adddot + \iffieldequalstr{note}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。 + {\iftoggle{ifCJKforgbt}{\printtext{[\str@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@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@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@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}{}{%当没有网址时也不输出 + \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@aystyle@section#1}{#1}} + +% +%在AtBeginBibliography处已经无法重定义defbibenvironment{bibliographyay} +%所以输出只能是用另外定义的环境来实现 +%可以在refsection后面做patch +%为排序引入newrefcontext +\apptocmd{\refsection}{ +\edef\gb@refsecnum{\number\c@refsection}% +\ifcsdef{gb@aystyle@section\gb@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@refsecnum{\number\c@refsection}% +\ifcsdef{gb@aystyle@section\gb@refsecnum}% +{\endrefcontext}{} +}{}{} + +%因为是整个文献表,在打印文献表的时候,增加钩子代码 +%因为下面的钩子是在defbibenvironment的begincode之后,所以对于defbibenvironment相关的设置都是无效的 +\AtBeginBibliography{ + +\edef\gb@refsecnum{\number\c@refsection}% +\ifcsdef{gb@aystyle@section\gb@refsecnum}% +%\ifboolexpr{ +%not test {\ifcsundef{gb@aystyle@section\gb@refsecnum}} +%and +%test {\ifcsequal{gb@refsecnum}{gb@aystyle@section\gb@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@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@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@opt@mergedate@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@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}% diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.cbx b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.cbx new file mode 100644 index 0000000000..bf2e591f0c --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714-2015mx.cbx @@ -0,0 +1,466 @@ +%% +%% --------------------------------------------------------------- +%% biblatex-gb7714-2015 --- A biblatex implementation of the +%% GBT7714-2015 citation style,numerical sequence +%% Maintained by huzhenzhen +%% E-mail: hzzmail@163.com +%% Released under the LaTeX Project Public License v1.3c or later +%% --------------------------------------------------------------- +%% +\def\versionofgbtstyle{2019/08/28 v1.0s} +\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@refsecnum{\number\c@refsection} +\edef\gb@refsecnum{\number\c@refsection}% +\ifcsundef{gb@aystyle@section\gb@refsecnum}% +{}% +{ + +\renewcommand*{\iffinalcitedelim}{% + \ifnumequal{\value{textcitecount}}{\value{textcitetotal}-1}} + +\newbibmacro*{cite:init}{% + \ifnumless{\value{multicitecount}}{2} + {\global\boolfalse{cbx:parens}% + \global\undef\cbx@lasthash + \global\undef\cbx@lastyear} + {\iffieldundef{prenote} + {} + {\global\undef\cbx@lasthash + \global\undef\cbx@lastyear}}} + +\newbibmacro*{cite:reinit}{% + \global\undef\cbx@lasthash + \global\undef\cbx@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@lasthash} + {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND + \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)} + {\setunit{\addcomma}% + \usebibmacro{cite:extradate}} + {\setunit{\compcitedelim}% + \usebibmacro{cite:labeldate+extradate}% + \savefield{labelyear}{\cbx@lastyear}}} + {\printnames{labelname}% + \setunit{\printdelim{nameyeardelim}}% + \usebibmacro{cite:labeldate+extradate}% + \savefield{namehash}{\cbx@lasthash}% + \savefield{labelyear}{\cbx@lastyear}}}} + {\usebibmacro{cite:shorthand}% + \usebibmacro{cite:reinit}}% + \setunit{\multicitedelim}} + +\newbibmacro*{citeyear}{% + \iffieldundef{shorthand} + {\iffieldundef{labelyear} + {\usebibmacro{cite:label}% + \usebibmacro{cite:reinit}} + {\iffieldequals{namehash}{\cbx@lasthash} + {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND + \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)} + {\setunit{\addcomma}% + \usebibmacro{cite:extradate}} + {\setunit{\compcitedelim}% + \usebibmacro{cite:labeldate+extradate}% + \savefield{labelyear}{\cbx@lastyear}}} + {\usebibmacro{cite:labeldate+extradate}% + \savefield{namehash}{\cbx@lasthash}% + \savefield{labelyear}{\cbx@lastyear}}}} + {\usebibmacro{cite:shorthand}% + \usebibmacro{cite:reinit}}% + \setunit{\multicitedelim}} + +\newbibmacro*{textcite}{% + \iffieldequals{namehash}{\cbx@lasthash} + {\iffieldundef{shorthand} + {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND + \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)} + {\setunit{\addcomma}% + \usebibmacro{cite:extradate}} + {\setunit{\compcitedelim}% + \usebibmacro{cite:labeldate+extradate}% + \savefield{labelyear}{\cbx@lastyear}}} + {\setunit{\compcitedelim}% + \usebibmacro{cite:shorthand}% + \global\undef\cbx@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@lastyear}} + {\usebibmacro{cite:shorthand}% + \global\undef\cbx@lastyear}}% + \stepcounter{textcitecount}% + \savefield{namehash}{\cbx@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@lasthash} + {\ifthenelse{\iffieldequals{labelyear}{\cbx@lastyear}\AND + \(\value{multicitecount}=0\OR\iffieldundef{postnote}\)} + {\setunit{\addcomma}% + \usebibmacro{cite:extradate}} + {\setunit{\compcitedelim}% + \usebibmacro{cite:labeldate+extradate}% + \savefield{labelyear}{\cbx@lastyear}}} + {\printnames{labelname}% + %\setunit{\printdelim{nameyeardelim}}% + (\usebibmacro{cite:labeldate+extradate})% + \savefield{namehash}{\cbx@lasthash}% + \savefield{labelyear}{\cbx@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} + } + + +} +}{}{} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714texteg.dat b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714texteg.dat new file mode 100644 index 0000000000..6fb3ef1a4a --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714texteg.dat @@ -0,0 +1,214 @@ +[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 diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714texttobib.pl b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714texttobib.pl new file mode 100644 index 0000000000..1b8dc7be36 --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gb7714texttobib.pl @@ -0,0 +1,1670 @@ +##% +##% --------------------------------------------------------------- +##% 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@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"; + +@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 '@_=',@_,"\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=',@names,"\n"; + $author=""; + $j=0; + foreach $name(@names){#一个姓名一个姓名处理 + + $j=$j+1; + #print $name,"\n"; + @nameparts=split(' ',$name); + #print 'nameparts=',@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=',@nameparts[$family],"\n"; + + $namefmt=""; + for($i=0;$i<=$family;$i++){ + $namefmt=$namefmt.@nameparts[$i].' '; + print $i,$family,$namefmt,"\n"; + } + if($suffix){ + $namefmt=$namefmt.@nameparts[-1].' '; + } + for($i=$family+1;$i<=$given;$i++){ + $namefmt=$namefmt.@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=',@names,"\n"; + $bookauthor=""; + $j=0; + foreach $name(@names){ + $j=$j+1; + #print $name,"\n"; + @nameparts=split(' ',$name); + #print 'nameparts=',@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.@nameparts[$i].' '; + #print $i,$family,$namefmt,"\n"; + } + if($suffix){ + $namefmt=$namefmt.@nameparts[-1].' '; + } + for($i=$family+1;$i<=$given;$i++){ + $namefmt=$namefmt.@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 diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015.tex b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015.tex new file mode 100644 index 0000000000..06a16f4e33 --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015.tex @@ -0,0 +1,13 @@ +\documentclass{article} +\usepackage{pdfpages}%直接插入pdf文件页 +\graphicspath{{egfigure/}{example/}} + +\begin{document} + +\includepdf[pages=-]{egfigure/tgbcitation.pdf} + +\includepdf[pages=-]{egfigure/tgbcitationay.pdf} + +\includepdf[pages=-]{egfigure/tgbbiblio.pdf} + +\end{document} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015eg.tex b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015eg.tex new file mode 100644 index 0000000000..f64360b40f --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015eg.tex @@ -0,0 +1,114 @@ +\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} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015fmt.tex b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015fmt.tex new file mode 100644 index 0000000000..e3cd6eaa29 --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015fmt.tex @@ -0,0 +1,13 @@ +\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} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015lan.tex b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015lan.tex new file mode 100644 index 0000000000..637fc0c293 --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015lan.tex @@ -0,0 +1,45 @@ +\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} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015ms.tex b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015ms.tex new file mode 100644 index 0000000000..2a53a7ed9f --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015ms.tex @@ -0,0 +1,13 @@ +\documentclass{article} +\usepackage{pdfpages}%直接插入pdf文件页 +\graphicspath{{egfigure/}{example/}} + +\begin{document} + +\includepdf[pages=-]{egfigure/tgbcitationms.pdf} + +\includepdf[pages=-]{egfigure/tgbcitationay.pdf} + +\includepdf[pages=-]{egfigure/tgbbiblioms.pdf} + +\end{document} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015thesis.tex b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015thesis.tex new file mode 100644 index 0000000000..7c12dc47a9 --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/gbT7714-2015thesis.tex @@ -0,0 +1,68 @@ +\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}{UCAS} +\includepdf[pages=-,addtotoc={1,section,1,UCAS-x,eg:UCASx}]{egthesis/thesis-ucas-x.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} diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/readme-BibLatex-Check.md b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/readme-BibLatex-Check.md new file mode 100644 index 0000000000..d441c64790 --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/readme-BibLatex-Check.md @@ -0,0 +1,27 @@ +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. + + + diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/readme-BibLatex-map.md b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/readme-BibLatex-map.md new file mode 100644 index 0000000000..9209550fc7 --- /dev/null +++ b/macros/latex/contrib/biblatex-contrib/biblatex-gb7714-2015/readme-BibLatex-map.md @@ -0,0 +1,152 @@ +# 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@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 + + + + + + |