summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-03-30 21:24:58 +0000
committerKarl Berry <karl@freefriends.org>2019-03-30 21:24:58 +0000
commitdd6bb2ce98e55e005893bdd5c6736725697db748 (patch)
treef771db65e9ad0b4cd83dde4c6a42fb6838edd07b
parent968b54c01ec82d717f37b6f3175b95da1029cf32 (diff)
biblatex-gb7714-2015 (30mar19)
git-svn-id: svn://tug.org/texlive/trunk@50661 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/biblatex-gb7714-2015/BibLatex-Check-readme.md43
-rw-r--r--Master/texmf-dist/doc/latex/biblatex-gb7714-2015/README.md48
-rw-r--r--Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015-preamble.tex19
-rw-r--r--Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015.pdfbin1176525 -> 1405717 bytes
-rw-r--r--Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015.tex875
-rw-r--r--Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map-test.bib61
-rw-r--r--Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map.py2059
-rw-r--r--Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex_check.py23
-rw-r--r--Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015.tex6
-rw-r--r--Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015eg.tex94
-rw-r--r--Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015fmt.tex13
-rw-r--r--Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015lan.tex37
-rw-r--r--Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015ms.tex6
-rw-r--r--Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015thesis.tex8
-rw-r--r--Master/texmf-dist/doc/latex/biblatex-gb7714-2015/readme-BibLatex-Check.md27
-rw-r--r--Master/texmf-dist/doc/latex/biblatex-gb7714-2015/readme-BibLatex-map.md152
-rw-r--r--Master/texmf-dist/tex/latex/biblatex-gb7714-2015/chinese-erj.bbx237
-rw-r--r--Master/texmf-dist/tex/latex/biblatex-gb7714-2015/chinese-erj.cbx151
-rw-r--r--Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015-gbk.def4
-rw-r--r--Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.bbx371
-rw-r--r--Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.cbx2
-rw-r--r--Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx568
-rw-r--r--Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.cbx2
-rw-r--r--Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.bbx361
-rw-r--r--Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.cbx2
-rw-r--r--Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015mx.bbx3247
-rw-r--r--Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015mx.cbx367
27 files changed, 7895 insertions, 888 deletions
diff --git a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/BibLatex-Check-readme.md b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/BibLatex-Check-readme.md
deleted file mode 100644
index 986d2eb8dff..00000000000
--- a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/BibLatex-Check-readme.md
+++ /dev/null
@@ -1,43 +0,0 @@
-BibLatex-Check
-==============
-
-*A python2/3 script for checking BibLatex .bib files*
-
-BibTeX Check is a small Python script that goes through a list of references and checks if certain required fields are available, for instance, if each publication is assigned a year or if a journal article has a volume and issue number.
-
-Additionally, it allows for consistency checks of names of conference proceedings and could easily be extended to other needs.
-
-The results of the check are printed to an html file, which includes links to Google Scholar, DBLP, etc. for each flawed reference. These links help retrieving missing information and correcting the entries efficiently.
-
-Please note that it is **not a BibLaTeX validator**. And in the current version, it might not yet be able to parse every valid bib file. The software targets the specific needs of Computer Scientist, but may be applicable in other fields as well.
-
-For use in automated environments, BibLaTeX-Check returns errors on the console (can be disabled).
-Further, it returns an exit code depending on whether problems have been found.
-
-The html output is tested with Firefox and Chrome, but the current version does not properly work with Internet Explorer.
-
-## Getting Started
-
-Just copy the file into a directory with write permission, then run the script
-
- ./biblatex_check.py <-b input.bib> [-a input.aux] [-o output.html]
-
-If you provide the additional aux file (created when compiling a tex document), then the check of the bib file is restricted to only those entries that are really cited in the tex document.
-
-## Options
-
-Specify these when calling the script.
-
-- -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.
-
-## Help
-
-See `./biblatex_check.py -h` for basic help.
-
-If your getting an environment error, try using `python ./biblatex_check.py` or `python3 ./biblatex_check.py` depending on your OS.
-
-
diff --git a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/README.md b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/README.md
index 83c8e1eef2f..d23d872e727 100644
--- a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/README.md
+++ b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/README.md
@@ -1,4 +1,4 @@
-<b>Date of last change: 2019-02-11 to version v1.0q</b>
+<b>Date of last change: 2019-03-29 to version v1.0rm</b>
# biblatex-gb7714-2015: a biblatex style package
@@ -70,6 +70,8 @@ The biblatex-gb7714-2015 package provides an implementation of the bibliography
`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}`
@@ -98,11 +100,22 @@ The biblatex-gb7714-2015 package provides an implementation of the bibliography
`\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={}}` in the preamble.
+ `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}`
@@ -186,6 +199,28 @@ The biblatex-gb7714-2015 package provides an implementation of the bibliography
`\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`
@@ -207,6 +242,8 @@ please see the file 'biblatex-gb7714-2015.pdf' for further information!
* [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)
* [...]
@@ -218,6 +255,9 @@ please see the file 'biblatex-gb7714-2015.pdf' for further information!
* [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/)
@@ -330,6 +370,8 @@ citestyle=gb7714-2015%,backref=true%%其中后端backend使用biber
latexmk -xelatex jobname.tex
```
+编译引擎使用lualatex也是可以的,只要该引擎编译时ctex宏包能够正确支持中文。
+
### 3. Recommended environment/推荐使用环境
@@ -872,6 +914,8 @@ biber -l zh__stroke jobname
* 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
---------------------------------------------------------
diff --git a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015-preamble.tex b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015-preamble.tex
index 67ba0c490e9..2486c238feb 100644
--- a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015-preamble.tex
+++ b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015-preamble.tex
@@ -1,6 +1,6 @@
\usepackage{expl3,etoolbox,ifthen,xstring}
\usepackage{xltxtra,mflogo,texnames}
-\usepackage[zihao=5]{ctex}
+\usepackage[zihao=-4]{ctex}
\ctexset{today=old}
\let\kaiti=\kaishu
\usepackage{xeCJKfntef}
@@ -21,12 +21,12 @@
\colorlet{gbemphcolor}{blue!60!black}
%定义版面,showframe,
-\usepackage[paperwidth=210mm,paperheight=290mm,left=25mm,right=25mm,top=25mm, bottom=20mm,showcrop]{geometry}%,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!50}{}{0.4pt}
+\rulerparams{}{}{gray!10}{}{0.2pt}
\fgrulerdefnum{}\fgrulercaptioncm{}%fgruler加数字后,导致基线对齐出现问题,所以这里去掉
\newlength{\skipheadrule}
@@ -254,8 +254,10 @@ showstringspaces=false}% no special string spaces
%序号如果带章节的话可以改为比如:\thesection.\arabic{myprop}
\tcbmaketheorem{property}{方法}
{enhanced jigsaw,breakable,pad at break*=1mm,left=2em,boxsep=0pt,
- colback=black!5,colframe=gborange,coltitle=gborange,
- theorem style=plain,fonttitle=\bfseries,arc=0mm,
+%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,%
@@ -269,7 +271,7 @@ showstringspaces=false}% no special string spaces
colback=yellow!10!white,boxrule=0pt,frame hidden,
borderline west={1.5mm}{-2mm}{gbforestgreen},
separator sign={\ $\blacktriangleright$},terminator sign={\ },
-theorem style=plain,fonttitle=\bfseries,coltitle=gbforestgreen
+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={\ }
@@ -349,9 +351,10 @@ itemsep=0pt,leftmargin=0em,itemindent=0em}%注意,font或format中的最后一
\begin{quote}
\small\youyuan\color{gbemphcolor}#1
\end{quote}}
-\newcommand{\bc}[1]{%定义补充信息
+
+\long\def\bc#1{%定义补充信息
{\small\youyuan\color{gbemphcolor}#1}} %orange,brown,purple,teal,gbblue,olive,cyan
-\newcommand{\BC}[1]{%定义补充信息
+\long\def\BC#1{%定义补充信息
{\small\youyuan\color{gbemphcolor}#1}}
\newcommand{\zd}[1]{%定义补充信息
{\small\youyuan\color{gbemphcolor}#1}} %orange,brown,purple,teal,gbblue,olive,cyan
diff --git a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf
index 14dc623e3be..f4b4d54a3c2 100644
--- a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf
+++ b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015.tex b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015.tex
index c7c61b15712..70af97529d6 100644
--- a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015.tex
+++ b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-gb7714-2015.tex
@@ -1,15 +1,17 @@
-\documentclass[twoside,11pt]{article} %用draft选项找到badbox的位置
+\documentclass[11pt]{article} %用draft选项找到badbox的位置 twoside,
\input{biblatex-gb7714-2015-preamble} %宏包和一些格式设置
\begin{document}
%------------------------------------------------------------
% 标题和目录
%------------------------------------------------------------
+\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.}}
+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}}
@@ -31,15 +33,16 @@ biblatex-gb7714-2015 宏包是为满足《GB/T 7714-2015~~信息与文献~~参
%\renewcommand{\numberline}[1]{#1~}
%\phantomsection
%\addcontentsline{toc}{section}{示例}
+
\listoffigures
\listoftables
\listofegcode
\newlength{\textparwd}
%------------------------------------------------------------
-\thispagestyle{plain}
\newpage
\pagenumbering{arabic}
+\pagestyle{fancy}
\section{概述}
《GB/T 7714-2015~~信息与文献~~参考文献著录规则》是国内科技文档参考文献著录的一般标准,国内大多数期刊、大学、出版社对于期刊论文、学位论文、出版物参考文献的要求通常都基于该标准。对于\LaTeX{}用户来说,参考文献生成是典型的自动化应用,通常有两种方法,一是基于bibtex的传统方法,二基于biblatex的新方法。生成符合GB/T 7714标准要求的参考文献,这两条路子都已经实践多年。
@@ -110,7 +113,7 @@ GB/T 7714标准的理解和解释(\ref{sec:gbt:std}节)、
\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
+\centering\footnotesize
\begin{tikzpicture}[node distance=1.5cm]
%\definecolor{bluea}{rgb}{0.05,0.62,0.94}
\ttfamily
@@ -277,7 +280,7 @@ leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt]
\end{texlist}
\end{example}
-\begin{example}{不同著录格式共存的样式(gb7714-2015ms)加载方式}{eg:gb7714ms}
+\begin{example}{同一文献表中不同语言区分著录格式的样式(gb7714-2015ms)}{eg:gb7714ms}
\begin{texlist}
%默认方式,所有文献使用一种著录格式,即GB/T 7714-2015样式
\usepackage[backend=biber,style=gb7714-2015ms]{biblatex}
@@ -286,285 +289,22 @@ leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt]
\end{texlist}
\end{example}
-\begin{example}{参考文献文本转换为bib文件perl脚本使用方式}{eg:transtobib}
+\begin{example}{同一文档中不同文献分节区分不同著录格式的样式(gb7714-2015mx)}{eg:gb7714mx}
\begin{texlist}
-perl gb7714texttobib.pl in=textfilename out=bibfilename
-\end{texlist}
-\end{example}
-
-其中,v1.0m版本增加的gb7714-2015ms样式文件,主要是为了在一个文档中使用多种样式,比如中文文献使用GB/T 7714-2015规定的著录格式,而其它语言文献使用biblatex提供的标准样式。这种方式尽管不很常用,但偶尔也有需求。
-
-\subsection{文献引用及其标注格式}\label{sec:cbx:usage}
-
-要生成参考文献,第一步就是在正文中引用参考文献。引用参考文献在正文中所形成标注的格式称为参考文献标注样式,也称引用样式或引用标签样式,分为两类: 顺序编码制和著者年份(作者年)制。引用文献的基本命令\verb|\cite|,但为了一篇文档中实现不同的标签效果,通常还需要使用其它命令,
-比如\verb|\parencite|, \verb|\textcite|, \verb|\pagescite|,\verb|\footfullcite|等。习惯natbib的用户也可以在加载natbib选项后,
-可使用\verb|\citet|, \verb|\citep|命令。
-
-%顺序编码制的标注样式文件大体使用标准引用样式numeric-comp的内容
-\paragraph{\heiti 顺序编码制的标注样式}
-
-\verb|\cite| 命令为上标模式,\verb|\parencite|保留非上标模式。为满足GB/T 7714-2015第10.1.3节的要求,增加了 \verb|\pagescite| 命令。为使用户免于输入文献作者来作为句子主语,完善了\verb|\textcite|命令格式,
-并增加了\verb|\authornumcite|命令以同时输出作者和顺序编码。
-%各命令使用方式如例\ref{eg:citefornumeric}所示。
-%各引用命令的效果如图\ref{fig:cite:num}所示。
-各引用命令的使用方式如表\ref{tab:cite:num}所示。
-测试文档见\href{run:example/testallformat.tex}{testallformat.tex}。
-
-\begin{refsection}
-\begin{table}[!htb]
-\centering
-\caption{顺序编码制常用命令示例}\label{tab:cite:num}
-\small
-\begin{tabular}{l@{\quad$\Rightarrow$\quad}ll}
-\hline
-命令 & 标注标签 & 说明 \\ \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}| & \parencite[49]{Miroslav2004--} & 带页码非上标 \\
- \verb|\parencite[49]{Miroslav2004--}| & \cite[49]{蔡敏2006--} & 带页码的上标 \\
- \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--} & 国标示例:三篇以上压缩\\
- 多次引用同一作者的同一文献: &
- 文献\cite[20-22]{Miroslav2004--},
- 文献\cite[55-60]{Miroslav2004--} & 国标示例 \\
- 多次引用同一作者的同一文献: &
- 文献\footfullcite[20-22]{Miroslav2004--},
- 文献\footfullcite[55-60]{Miroslav2004--} & 国标示例:脚注方式 \\ \hline
-\end{tabular}
-\end{table}
-\end{refsection}
-
-%\begin{example}{顺序编码制引用命令}{eg:citefornumeric}
-%\begin{texlist}
-%不带页码的引用(上标,方括号包围):
-% \cite{Peebles2001-100-100}\upcite{Peebles2001-100-100}
-% \supercite{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}
-%同时输出作者和顺序编码的三种引用方式:
-% (a)直接的方法:见\citeauthor{refb}\cite{refb}, \citeauthor{refc}\cite{refc}
-% (b)定义新的标注命令:见\authornumcite{refb,refc}
-% (c)用textcite但没有上标:见\textcite{refb,refc}
-%在页脚中引用和打印文献表:
-% \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{egcitenum.pdf}
-%}
-%\end{tcolorbox}
-%\caption{顺序编码制标注格式}\label{fig:cite:num}
-%\end{figure}
-
-其中,当不指定页码时,\verb|\pagescite|命令默认调用参考文献的页码数据进行输出,如果需要指定页码,那么需要在[]内或第二个[]内(当有两个[]时)输入页码。
-
-\qd{对于多个文献一起的压缩形式,指定页码只会应用最后一个参考文献的页码,这是不正确的,但这种情况其实本不应出现,因为指定页码本来就需要具体化指某一文献。使用时请尽可能使用
-\textbackslash pagescite\{key1\}\textbackslash pagescite\{key2\}这种形式
-而不是\textbackslash pagescite\{key1,key2\}|。}
-
-%作者年制的标注样式文件大体使用标准引用样式authoryear的内容。
-\paragraph{\heiti 作者年制的标注样式} \verb|\cite|和\verb|\parencite|命令将引用标签用圆括号括起来。为满足GB/T 7714-2015第10.2.4节的要求,增加了\verb|\pagescite|命令。
-为满足GB/T 7714-2015第10.2.1节的要求,增加了\verb|\yearpagescite|, \verb|\yearcite|命令用于处理文中已有作者信息只需要年份和页码的情况(为兼容性考虑,顺序编码制也给出该命令,但作用与
-\verb|\pagescite| 命令相同),也完善了 \verb|\textcite| 命令为句子提供主语。
-%各命令使用方式如例\ref{eg:citeforauthoryear}所示。
-%各引用命令的效果如图\ref{fig:cite:ay}所示。
-各引用命令的使用方式如表\ref{tab:cite:authoryear}所示。
-测试文档见\href{run:example/testallformat.tex}{testallformat.tex}。
-
-\begin{table}[!htb]
-\centering
-\caption{著者年份制常用命令示例}\label{tab:cite:authoryear}
-\includegraphics[scale=0.8]{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}
-
-\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-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。}
-
-\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 表示各行起始位置到页边的距离
-
-% 标点类型的控制(全局字体能控制标点的字体)
+%默认方式使用顺序编码制样式
+\usepackage[backend=biber,style=gb7714-2015mx]{biblatex}
+%如果需要在某一参考文件分节使用作者年制样式,比如第2个refsection使用时,则在导言区设置:
+\setaystylesection{2}
\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{egparfmt.pdf}
-}
-\end{tcolorbox}
-\caption{文献表段落格式示例}\label{fig:par:fmt}
-\end{figure}
-
-\subsection{文献表条目著录格式控制}\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=box, 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}
-\parbox{\textparwd}{
-\includegraphics{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}
-\parbox{\textparwd}{
-\includegraphics{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{example}{参考文献文本转换为bib文件perl脚本使用方式}{eg:transtobib}
\begin{texlist}
-\usepackage[backend=biber,style=gb7714-2015ay,gbnamefmt=lowercase,maxcitenames=2,mincitenames=1,
-gbbiblocal,sortcites,sorting=gbyntd]{biblatex}
-\DefineBibliographyStrings{english}{
- andincite = {和},
- andincitecn = {和},
- andothersincitecn = {等},
- andothersincite = {等{\adddot}},%adddot才能避开标点追踪
-}
+perl gb7714texttobib.pl in=textfilename out=bibfilename
\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{egcontentfmtc.pdf}
-}
-\end{tcolorbox}
-\caption{文献表条目著录格式示例三}\label{fig:content:fmtc}
-\end{figure}
+其中,v1.0m版本增加的gb7714-2015ms样式文件,主要是为了在一个文献表中针对不同语言使用不同多种样式,比如中文文献使用GB/T 7714-2015规定的著录格式,而其它语言文献使用biblatex提供的标准样式。v1.0r版本增加了gb7714-2015mx样式,主要是为了在一个文档中针对不同参考文献分节使用不同的参考文献样式,比如某些节使用作者年制,某些节使用顺序编码制。尽管这些方式不很常用,但偶尔也有需求,所以都做了实现。应ddswhu要求,v1.0r版本增加了erj样式用于生成经济类期刊文献表。另外在egthesis文件夹内,针对国内一些大学的学位论文文献要求,基于gb样式做了一些定制和测试。
\subsubsection{新增选项}\label{sec:added:opt}
样式包新增了一些选项,用于标签对齐方式、出版项缺省处理、责任者(作者)缺省处理等功能的控制,其使用方式与biblatex宏包选项完全相同:
@@ -632,6 +372,7 @@ leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt]
\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文件中文献的作者应给出完整的名而不是缩写,否则出来的效果未必令人满意}。
@@ -648,6 +389,23 @@ leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt]
\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的本地化字符串是为了某些样式需要区分中英文分别设置。
+
+ 另一种设置方式是在bib文件直接设置type域为需要输出的字符,比如type={[博士学位论文]}。
+
+ \end{itemize}
\item[gbpunctin]=\textbf{true},false. \hfill default is true
@@ -657,7 +415,8 @@ leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt]
\item gbpunctin=true,根据GB/T 7714-2015 要求输出\texttt{//}。
\item gbpunctin=false,则输出默认的本地字符串,
在英语中是\texttt{in:},若要完全去掉该符号则可以在导言区增加命令
- \lstinline!\DefineBibliographyStrings{english}{in={}}!。
+ \lstinline!\DefineBibliographyStrings{english}{in={}}!,\lstinline!\DefineBibliographyStrings{english}{incn={}}!。
+ 之所以用加cn的本地化字符串是为了某些样式需要区分中英文分别设置。
\end{itemize}
\item[gbctexset]=\textbf{true},false. \hfill default is true
@@ -732,7 +491,7 @@ leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt]
为设置引用标注标签和文献表中的本地化字符串而增加的选项。其中gbcitelocal 用于控制标注中的本地化字符串,而gbbiblocal用于控制文献表中的本地化字符串,gblocal选项等价于同时设置gbcitelocal 和 gbbiblocal。
配合\lstinline[breaklines=true]!\DefineBibliographyStrings!命令对本地化字符串进行设置可以实现一些特殊的效果。图\ref{fig:content:fmtc}就是该选项的一个使用示例。
\begin{itemize}
- \item gblocal=gb7714-2015,即默认区分中英文,不同语言采用不同的字符串比如中文使用“等”“和”,而英文使用“etal”“and”。
+ \item gblocal=gb7714-2015,即默认区分中英文,不同语言采用不同的字符串比如中文使用“等”“和”,而英文使用“et al.”“and”。
\item gblocal=chinese,强制设置所有的本地化字符串使用中文。
\item gblocal=english,强制设置所有的本地化字符串使用英文。
\end{itemize}
@@ -748,11 +507,71 @@ leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt]
\item gbstyle=false,不做任何附加处理。
\end{itemize}
- 该选项的实现主要是两个方面:一是实现国标要求的脚注标签和段落格式,利用对
+ 该选项的实现主要是两个方面:
+
+ 一是实现国标要求的脚注标签和段落格式,利用对
\verb|\@makefnmark|重定义实现正文脚注标签带圈上标,
- 利用对\verb|\@makefntext|做patch局部化重设\verb|\@makefnmark|使得脚注中的标签不上标,利用footmisc宏包实现对脚注的悬挂对齐,需要注意由于footmisc的问题,使用该宏包会导致脚注的超链接失效,如果不需要悬挂格式,那么可以在bbx文件中将footmisc注释掉,此外对于beamer类该包也并不兼容,所以当加载beamer类则直接注释掉;二是实现国标要求的相同的文献不输出,而是简化输出,比如同\textcircled{4} 等,主要利用citetracker 选项实现对文献引用的追踪,然后利用ifciteseen 判断和对footfullcite 命令做修改实现。
+ 利用对\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[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}。
+
\end{description}
@@ -891,11 +710,201 @@ leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt]
\end{description}
+\subsection{文献引用及其标注格式}\label{sec:cbx:usage}
+要生成参考文献,第一步就是在正文中引用参考文献。引用参考文献在正文中所形成标注的格式称为参考文献标注样式,也称引用样式或引用标签样式,分为两类: 顺序编码制和著者年份(作者年)制。引用文献的基本命令\verb|\cite|,但为了一篇文档中实现不同的标签效果,通常还需要使用其它命令,
+比如\verb|\parencite|, \verb|\textcite|, \verb|\pagescite|,\verb|\footfullcite|等。习惯natbib的用户也可以在加载natbib选项后,
+可使用\verb|\citet|, \verb|\citep|命令。
-\subsection{多语言混合文献表}\label{sec:multilan:combine}
+%顺序编码制的标注样式文件大体使用标准引用样式numeric-comp的内容
+\paragraph{\heiti 顺序编码制的标注样式}
-一般情况下在国内应用环境下,多语言混合不太会超过两种语言,比如仅有中英两种语言混合。但有时可能也会存在多种语言,比如存在中/英/日/俄这种多语言环境。图\ref{fig:multi:lan}给出了这样一个示例,其中不同的语言使用了不同的本地化字符串。
+\verb|\cite| 命令为上标模式,\verb|\parencite|保留非上标模式。为满足GB/T 7714-2015第10.1.3节的要求,增加了 \verb|\pagescite| 命令。为使用户免于输入文献作者来作为句子主语,完善了\verb|\textcite|命令格式,
+并增加了\verb|\authornumcite|命令以同时输出作者和顺序编码。
+%各命令使用方式如例\ref{eg:citefornumeric}所示。
+%各引用命令的效果如图\ref{fig:cite:num}所示。
+各引用命令的使用方式如表\ref{tab:cite:num}所示。
+测试文档见\href{run:example/testallformat.tex}{testallformat.tex}。
+
+\begin{refsection}
+\begin{table}[!htb]
+\centering
+\caption{顺序编码制常用命令示例}\label{tab:cite:num}
+\small
+\begin{tabular}{l@{\quad$\Rightarrow$\quad}ll}
+\hline
+命令 & 标注标签 & 说明 \\ \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--} & 国标示例:三篇以上压缩\\
+ 多次引用同一作者的同一文献: &
+ 文献\cite[20-22]{Miroslav2004--},
+ 文献\cite[55-60]{Miroslav2004--} & 国标示例 \\
+ 多次引用同一作者的同一文献: &
+ 文献\footfullcite[20-22]{Miroslav2004--},
+ 文献\footfullcite[55-60]{Miroslav2004--} & 国标示例:脚注方式 \\ \hline
+\end{tabular}
+\end{table}
+\end{refsection}
+
+%\begin{example}{顺序编码制引用命令}{eg:citefornumeric}
+%\begin{texlist}
+%不带页码的引用(上标,方括号包围):
+% \cite{Peebles2001-100-100}\upcite{Peebles2001-100-100}
+% \supercite{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}
+%同时输出作者和顺序编码的三种引用方式:
+% (a)直接的方法:见\citeauthor{refb}\cite{refb}, \citeauthor{refc}\cite{refc}
+% (b)定义新的标注命令:见\authornumcite{refb,refc}
+% (c)用textcite但没有上标:见\textcite{refb,refc}
+%在页脚中引用和打印文献表:
+% \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{egcitenum.pdf}
+%}
+%\end{tcolorbox}
+%\caption{顺序编码制标注格式}\label{fig:cite:num}
+%\end{figure}
+
+其中,当不指定页码时,\verb|\pagescite|命令默认调用参考文献的页码数据进行输出,如果需要指定页码,那么需要在[]内或第二个[]内(当有两个[]时)输入页码。
+
+\qd{对于多个文献一起的压缩形式,指定页码只会应用最后一个参考文献的页码,这是不正确的,但这种情况其实本不应出现,因为指定页码本来就需要具体化指某一文献。使用时请尽可能使用
+\textbackslash pagescite\{key1\}\textbackslash pagescite\{key2\}这种形式
+而不是\textbackslash pagescite\{key1,key2\}|。}
+
+%作者年制的标注样式文件大体使用标准引用样式authoryear的内容。
+\paragraph{\heiti 作者年制的标注样式} \verb|\cite|和\verb|\parencite|命令将引用标签用圆括号括起来。为满足GB/T 7714-2015第10.2.4节的要求,增加了\verb|\pagescite|命令。
+为满足GB/T 7714-2015第10.2.1节的要求,增加了\verb|\yearpagescite|, \verb|\yearcite|命令用于处理文中已有作者信息只需要年份和页码的情况(为兼容性考虑,顺序编码制也给出该命令,但作用与
+\verb|\pagescite| 命令相同),也完善了 \verb|\textcite| 命令为句子提供主语。
+%各命令使用方式如例\ref{eg:citeforauthoryear}所示。
+%各引用命令的效果如图\ref{fig:cite:ay}所示。
+各引用命令的使用方式如表\ref{tab:cite:authoryear}所示。
+测试文档见\href{run:example/testallformat.tex}{testallformat.tex}。
+
+\begin{table}[!htb]
+\centering
+\caption{著者年份制常用命令示例}\label{tab:cite:authoryear}
+\includegraphics[scale=0.85]{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}
+
+\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-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,%
@@ -903,9 +912,87 @@ 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{egmultilan.pdf}
+\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=box, 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,
+gbbiblocal,sortcites,sorting=gbyntd]{biblatex}
+\DefineBibliographyStrings{english}{
+ andincite = {和},
+ andincitecn = {和},
+ andothersincitecn = {等},
+ andothersincite = {等{\adddot}},%adddot才能避开标点追踪
}
+\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}
+
+
+\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}
@@ -935,7 +1022,7 @@ leftrule=0pt,rightrule=0pt,toprule=0.4pt,bottomrule=0.4pt]
\href{run:example/opt-autolang-multilan.tex}{opt-autolang-multilan}。
-\subsection{多语言对照的文献表}\label{sec:multilan:implement}
+\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。
@@ -947,9 +1034,7 @@ 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{egdoublelan.pdf}
-}
+\includegraphics[width=\textparwd]{egdoublelan.pdf}
\end{tcolorbox}
\caption{双语言对照文献表示例一}\label{fig:double:lana}
\end{figure}
@@ -960,9 +1045,7 @@ 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{egdoublelanb.pdf}
-}
+\includegraphics[width=\textparwd]{egdoublelanb.pdf}
\end{tcolorbox}
\caption{双语言对照文献表示例二}\label{fig:double:lanb}
\end{figure}
@@ -1021,6 +1104,10 @@ language={chinese}
\bc{注意:由于动态set条目集设置等价于使用了 nocite命令,因此只要定义了动态条目集的文献都会出现在文献表中,因此如果不引用相应的文献,那么无需对其定义动态条目集}。
+\bc{注意:biblatex提供的mcite模块提供了mcite类命令,其等价于定义动态条目集,因此除了使用上述defbibentryset方法外,也可以使用mcite类命令}。
+
+\bc{注意:条目集方法本质上是将多个文献条目集合成一个组一起在文献表中输出,且仅有一个标注标签。无论是否是多语言对照都是可以使用的,这里的多语言对照实现只是条目集方法的一个具体应用}。
+
\paragraph{\heiti 利用条目关联满足双语文献要求}
除上述给出的条目集方案外,关联条目方法则是另一种可行方案,该方案的讨论可以见“Again about the \@ set label for authoryear style”\footnote{\url{https://github.com/plk/biblatex/issues/681}}。该方案同样也有静态和动态两种方法,静态就是修改bib文件内容,动态则是在tex源文档中做设置。
@@ -1064,7 +1151,65 @@ language={chinese}
双语对照文献的两种动态方法基于set和related的方法测试,参见:
\href{run:./example/opt-eg-authoryear.tex}{opt-eg-authoryear.tex}。
-\subsection{biblatex 的优点}
+\subsection{多样式支持}
+
+\subsubsection{一个文献表采用多种著录样式}
+
+一个文献表采用多种著录样式主要针对的是在一个tex文档生成参考文献表中,不同的语言文献采用不同的著录格式的需求,比如中文的文献采用GB/T 7714-2015 样式,而西文文献则采用西文习惯的样式。这种情况目前由gb7714-2015ms样式来实现,选项加载方式如例\ref{eg:gb7714ms}所示。
+
+目前gb7714-2015ms样式中,中文西文分别采用GB/T 7714-2015 标准样式和biblatex的默认样式,如果有需要完全可以通过定义中文和西文的格式做进一步的修改。图\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{2}|进行设置,该命令表示对参考文献节2的参考文献采用作者年制样式。
+设置多个参考文献节时,则继续采用\verb|\setaystylesection|设置,比如节3也要采用作者年制样式,那么设置\verb|\setaystylesection{3}|。
+
+目前gb7714-2015mx样式中的两种格式顺序编码和作者年制样式默认都是符合GB/T 7714-2015 标准的,如果需要做格式的修改,则完全可以通过自定义作出修改。图\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]{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}、
@@ -1124,57 +1269,7 @@ language={chinese}
\end{enumerate}
%上述这些优点也是笔者决定编写符合GB/T 7714-2015标准的参考文献样式文件的原因之一。
-\subsection{使用注意事项}\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}|,同时引用文献时使用的引用关键词应使用英文。
-
- 当文档使用其他编码时,可以利用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中的作者年制要求参考文献按文种集合,且中文在前英文在后。主要通过定义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/T7714-2005或GB/T7714-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 本文档根据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}
-
-\subsection{数据库bib文件和数据录入}\label{sec:bib:bibtex}
+\subsubsection{数据库bib文件和文献条目}\label{sec:bib:bibtex}
参考文献数据以bibtex格式保存在bib文件中。生成参考文献除tex源文档外,还需创建参考文献数据源文件即bib文件。bib文件数据源准备完成后,在加载biblatex宏包时,使用addbibresource命令将其加载进tex源文档中。\bc{注意:数据源可以加载多个,比如多个章节的参考文献放在不同的bib文件中,那么全部加载进来即可}。
@@ -1189,11 +1284,11 @@ bib文件中的参考文献信息是以条目形式组织,一篇文献创建
\hline
GB/T 7714-2015中的参考文献类型 & biblatex中的条目类型 & 类型标识代码\\ \hline
专著& book & M\\
- 标准& standard/book or inbook with field note=standard& S\\
+ 标准& standard/book or inbook with note=standard& S\\
专著中的析出文献& inbook & M\\
连续出版物& periodical& J\\
连续出版物的析出文献& article& J\\
- 报纸析出的文献& newspaper/article with field note=standard& N\\
+ 报纸析出的文献& newspaper/article with note=news& N\\
专利& patent& P\\
电子资源或电子公告& online/www/electronic& EB\\
会议录或会议文集& proceedings& C\\
@@ -1225,7 +1320,7 @@ bib文件中的参考文献信息是以条目形式组织,一篇文献创建
\begin{tabular}{cl}
\hline
GB/T 7714-2015中的文献著录项目 & biblatex中的域\\ \hline
- 责任者 & author\\
+ 责任者 & author/editor\\
题名 & title\\
译者 & translator\\
版本(主要用于出版物) & edition\\
@@ -1237,7 +1332,7 @@ bib文件中的参考文献信息是以条目形式组织,一篇文献创建
日期 & date\\
日期(不可解析的日期) & year\\
页码 & pages\\
- 析出文献来源的责任者 & bookauthor\\
+ 析出文献来源的责任者 & bookauthor/editor\\
析出文献来源的标题 & booktitle\\
连续出版物题名(期刊、报纸) & journal/journaltitle\\
期刊的卷 & volume\\
@@ -1254,7 +1349,19 @@ bib文件中的参考文献信息是以条目形式组织,一篇文献创建
需要注意的是,note域在本样式中也做特殊用途,即在book类型的note域中输入standard表示标准,在aritcle类型的note域中输入news表示报纸,当然也可以不做特殊用,而只是表示杂项信息,因为标准和报纸可以用standard和newspaper类型表示,尽管这两种类型不是biblatex原生的条目类型。而usera域用于表示参考文献类型和载体标识符(为兼容Lee zeping的bst样式使用的bib文件也可以用mark和medium表示)。一般情况下usera,mark,medium这些域不用在bib文件中输入,而由样式文件自动处理得到,既为了使bib文件更纯粹,也为了兼容不同的样式。想象一下如果在bib文件中给出usera域,但另一样式需要使用usera域且用途不同,那么就会有兼容性问题。不用手动输入更重要的目的是为用户减负,因为用户可以直接使用从网络(各种学术)导出参考文献信息而不用再额外添加一个参考文献类型和载体标识符。本宏包自动判断语言而不使用一个表示语言的域比如language来标记文献的语言类型也出于同样的考虑,当然也有一种情况即一篇文献中存在多种语言是无法用一个language标识的,比如一本英文著作被翻译为中文,那么原作者是英文,而译者则是中文,这时标记language的意义不大。标记language更多的是用在多种语言混合的文档中,可以用language来标记英语、中文、日语、法语和德语等用于分语言排序。
-各个数据域的录入应符合bib文件规范。\bc{需要注意: 有时直接从网络获取的参考文献信息中可能带有一些特殊字符比如\%,\&等,这些字符在 tex 中通常需要做转义处理,本样式中对像title,journal等常见域中出现的特殊字符已经做了转义,但是一些不常见的域比如 abstract 等没有考虑,所以用户需要手动处理,例如把\%改为\textbackslash \%,否则可能导致出错}。下面详细介绍本样式中使用的域及其数据录入方式:
+\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 命令定义,比如:
+\textbackslash DeclareFieldFormat\{howpublished\}\{\textbackslash href\{\#1\}\{\#1\}\}。
+}
+下面详细介绍本样式中使用的域及其数据录入方式:
\begin{description}
\item[author] 在biblatex中author域属于name数据类型,输入数据时,各姓名间用and 连接,当姓名过多省略时,用others代替。
@@ -1306,6 +1413,8 @@ bib文件中的参考文献信息是以条目形式组织,一篇文献创建
\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类似。或者是专利等的号时,直接输入需要打印的内容。
@@ -1329,6 +1438,61 @@ bib文件中的参考文献信息是以条目形式组织,一篇文献创建
\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}|,同时引用文献时使用的引用关键词应使用英文。
+
+ 当文档使用其他编码时,可以利用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中的作者年制要求参考文献按文种集合,且中文在前英文在后。主要通过定义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/T7714-2005或GB/T7714-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}
@@ -1351,6 +1515,14 @@ bib文件中的参考文献信息是以条目形式组织,一篇文献创建
详见文档:\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}
@@ -1392,7 +1564,8 @@ beamer类示例,参见: \href{run:./example/egbeamer.tex}{顺序编码制};
\href{run:./example/testallformat.tex}{testallformat.tex}。
详见文档:
-\href{run:./example/stdGBT7714-2015eg.pdf}{GBT7714-2015egstd}。
+\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}
@@ -1424,9 +1597,7 @@ 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{egfootstyle.pdf}
-}
+\includegraphics[width=\textparwd]{egfootstyle.pdf}
\end{tcolorbox}
\caption{顺序编码制的脚注方式}\label{fig:numeric:footnote}
\end{figure}
diff --git a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map-test.bib b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map-test.bib
index 920ee7af21d..a992cd3b132 100644
--- a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map-test.bib
+++ b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map-test.bib
@@ -48,6 +48,67 @@
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/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map.py b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map.py
index 4ab2325fcd8..ff6a76fbd70 100644
--- a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map.py
+++ b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex-map.py
@@ -1,44 +1,16 @@
#!/usr/bin/env python
"""
-python script to modify bib data
-
-features:
-1. souce map of biblatex
-2. generalize date
-
-history:
-v1.0 2019/02/09
-
-biblatex source map opts:
-
-已实现的选项:
-typesource=⟨entrytype⟩
-typetarget=⟨entrytype⟩
-fieldsource=⟨entryfield⟩
-fieldtarget=⟨entryfield⟩
-match=⟨regexp⟩
-matchi=⟨regexp⟩
-notmatch=⟨regexp⟩
-notmatchi=⟨regexp⟩
-replace=⟨regexp⟩
-
-未实现的选项
-notfield=⟨entryfield⟩
-fieldset=⟨entryfield⟩
-fieldvalue=⟨string⟩
-entryclone=⟨clonekey⟩
-entrynew=⟨entrynewkey⟩
-entrynewtype=⟨string⟩
-entrytarget=⟨string⟩
-entrynocite=true, false default: false
-entrynull=true, false default: false
-append=true, false default: false
-final=true, false default: false
-null=true, false default: false
-origfield=true, false default: false
-origfieldval=true, false default: false
-origentrytype=true, false default: false
+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"
@@ -51,14 +23,21 @@ 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
@@ -70,14 +49,1267 @@ sourcemaps=[#maps
[{"fieldsource":"urldate","match":r'(\d\d\d\d)\-(\d)\-(\d)',"replace":r'\1-0\2-0\3'}]#step1
],
[#map4:将urldate域的信息“yyyy-m-d”转换为“yyyy-mm-dd”,注意正则表达式直接写不用在外面套""
- [{"fieldsource":"date","match":r'(\d\d\d\d)\-(\d)\-(\d)',"replace":r'\1-0\2-0\3'}]#step1
+ [{"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文件
@@ -88,6 +1320,20 @@ def readfilecontents(bibFile):
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")
@@ -98,83 +1344,330 @@ def readfilecontents(bibFile):
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
- print("INFO: writing references from '" + biboutfile + "'")
+
try:
fout = open(biboutfile, 'w', encoding="utf8")
fout.write("%% \n")
- fout.write("%% bib file modified by bibmap.py\n")
- print(datetime.datetime.now().isoformat(timespec='seconds'))
+ fout.write("%% bib file modified by biblatex-map.py\n")
+
fout.write("%% "+datetime.datetime.now().isoformat(timespec='seconds')+"\n")
fout.write("%% \n\n\n")
- for bibentry in bibentries:
- fout.write('@'+bibentry["entrytype"]+'{'+bibentry["entrykey"]+',\n')
- for k,v in bibentry.items():
- if k=="entrytype" or k=="entrykey" or v=='""':
- pass
+
+ 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('\t'+k+' = '+v+',\n')
+ 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
- bibentries=[]
- bibentry={}
- entrysn=0
- for line in bibfilecontents:
+ 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("@"):#条目开始行
+
+ 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
+ bibentry['entrytype']=entrytype.lower()#条目类型小写,方便比较
entrykey=entrynow[1].split(sep=',', maxsplit=1)[0]
bibentry['entrykey']=entrykey
- else:
- if '=' in line:#条目域信息行
- entryline=line.lstrip()
- entrynow=entryline.split(sep='=', maxsplit=1)
- #print(entrynow)
- entryfield=entrynow[0].strip().lstrip()
- #print(entrynow[1])
- entryfieldline=entrynow[1].split(sep=',', maxsplit=1)
- entryfieldvalue=entryfieldline[0].lstrip()
- if entryfieldvalue=='':
- pass
+ 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:
- bibentry[entryfield]=entryfieldvalue.strip()
- elif '}' in line:#条目结束行
- print('entrysn=',entrysn)
- global bibentryglobal
- bibentryglobal=copy.deepcopy(bibentry)
- bibentries.append(bibentryglobal)
- bibentry={}
- else:
- pass
+ 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)
- for bibentryi in bibentries:
- print(bibentryi)
-
+
+ #输出解析后的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
#
# 执行数据映射操作
@@ -185,164 +1678,345 @@ def execsourcemap():
for bibentry in bibentries:#每个映射都需要遍历所有条目,对每个条目做map
mapcontinue=1#大于0表示正常,继续当前条目的map
- fieldsrcinfo={}#用于接收fieldsource相关处理的结果
- print("map info=",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:
+ 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)#coef is dict
+ mapcontinue=maptypesource(keyvals,bibentry,typesrcinfo)#coef is dict
+
elif k=="fieldsource":#域查找或设置
- mapcontinue=mapfieldsource(keyvals,bibentry,fieldsrcinfo)#coef is dict
- pass
+ mapcontinue=mapfieldsource(keyvals,bibentry,fieldsrcinfo,constraintinfo)#
+ #print("fieldsource step:",fieldsrcinfo)
+
elif k=="fieldset":#域设置
- pass
- elif k=="pertype":#类型限制
- pass
+ mapcontinue=mapfieldset(keyvals,bibentry,typesrcinfo,fieldsrcinfo,constraintinfo)#
+
+ elif k=="pertype": #类型限制
+ mapcontinue=mappertype(keyvals,constraintinfo)
+
elif k=="pernottype":#类型限制
- pass
+ mapcontinue=mappernottype(keyvals,constraintinfo)
+
elif k=="notfield":#域限制
- pass
+ 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):
+def maptypesource(keyvals,bibentry,typesrcinfo):
retrunval=1
for k,v in keyvals.items():
#print(k,v)
if k=='typesource':
- typesource=v
+ typesource=v.lower()
elif k=='typetarget':
- typetarget=v
+ typetarget=v.lower()
elif k=='final':
retrunval=0
else:
pass
-
- if bibentry['entrytype']==typesource:
- bibentry['entrytype']=typetarget
+
+ 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 retrunval #存在final时,且不匹配则终止map
+ return 1
#
#域名转换或判断域是否存在或match
-def mapfieldsource(keyvals,bibentry,fieldsrcinfo):
+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
+ fieldsource=v.lower()
elif k=='fieldtarget':
- fieldtarget=v
+ fieldtarget=v.lower()
mapfieldtype=1 #域map类型1,直接做域名转换
elif k=='replace':
fieldreplace=v
mapfieldtype=2 #域map类型2,直接做域信息转换
elif k=='final':
- if v=='false':
- fieldfinal=v
- else:
- fieldfinal='true'
- mapfieldtype=3 #域map类型3,做final判断可以终止map
+ 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':#区分大小写的match
+ elif k=='notmatch':#不区分大小写的notmatch,下面这两个选项的逻辑没有实现
+ fieldnotmatch=v
+ elif k=='notmatchi':#区分大小写的notmatch
fieldnotmatch=v
else:
pass
- if mapfieldtype==0:#第0中情况即,不做信息转换,也不终止map,仅返回一些信息
-
- if fieldsource in bibentry:
- if fieldmatch=='':
- m = re.match(fieldmatch, bibentry[fieldsource])
- if m:
- fieldsrcinfo[fieldsource]=[bibentry[fieldsource],fieldmatch]
- else:
- fieldsrcinfo[fieldsource]=[None] #正则不匹配,则返回为None
+ if setcontinue:
- elif fieldmatchi=='':
- m = re.match(fieldmatchi, bibentry[fieldsource])
- if m:
- fieldsrcinfo[fieldsource]=[bibentry[fieldsource],fieldmatchi]
+ #返回字典的第一项是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]=[None] #正则不匹配,则返回为None
-
+ fieldsrcinfo[fieldsource]=bibentry[fieldsource]#将域的值记录下来,用于下一step
+
else:
- fieldsrcinfo[fieldsource]=bibentry[fieldsource]#将域的值记录下来,用于下一step
+ fieldsrcinfo[fieldsource]=[None] #域不存在则返回为None
+ return 1
+
- 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==1:#第1中情况即,做域名转换
- print('fieldsource=',fieldsource,'fieldtarget=',fieldtarget)
- if fieldsource in bibentry:
- bibentry[fieldtarget]=bibentry[fieldsource]
- del bibentry[fieldsource]
- fieldsrcinfo[fieldsource]=bibentry[fieldtarget]
- else:
- fieldsrcinfo[fieldsource]=[None]
- return 1
-
- elif mapfieldtype==2:#域map类型2,直接做域信息转换
- print('fieldsource=',fieldsource)
- print('fieldmatch=',fieldmatch)
- print('fieldreplace=',fieldreplace)
- if fieldsource in bibentry:
- if fieldmatch:
- #strafrpl=re.sub(r'(\d\d\d\d)\-(\d)\-(\d)',r'\1-0\2-0\3','2015-1-3')
- #strafrpl=re.sub(r'(\d\d\d\d)\-(\d)\-(\d)',r'\1-0\2-0\3',bibentry[fieldsource])
- strafrpl=re.sub(fieldmatch,fieldreplace,bibentry[fieldsource]) #执行替换
- print('strafterreplace=',strafrpl)
- bibentry[fieldsource]=strafrpl
- elif fieldmatchi:
- strafrpl=re.sub(fieldmatchi, fieldreplace,bibentry[fieldsource])
- bibentry[fieldsource]=strafrpl
+
+ 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]
- else:
- fieldsrcinfo[fieldsource]=[None]
- return 1
+ 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 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
+ elif fieldmatchi:
+ if m:
+ fieldsrcinfo[fieldsource]=[bibentry[fieldsource],fieldmatchi]
+ return 1
+ else:
+ return 0
+
else:
- return 0
-
+ fieldsrcinfo[fieldsource]=bibentry[fieldsource]#将域的值记录下来,用于下一step
+ return 1
+
else:
- fieldsrcinfo[fieldsource]=bibentry[fieldsource]#将域的值记录下来,用于下一step
- return 1
-
- else:
- return 0
+ return 0
-
+ else:
+ fieldsrcinfo[fieldsource]=[None]
+ return 1
@@ -350,21 +2024,36 @@ def mapfieldsource(keyvals,bibentry,fieldsrcinfo):
#运行脚本测试
if __name__=="__main__":
- print('hello')
- print(b'hello')
- readfilecontents("biblatex-map-test.bib")
- printfilecontents()
+ #设置需要修改的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()
+ #printbibentries()
execsourcemap()
- printbibentries()
+ #printbibentries()
+
+ writefilenewbib(inputbibfile)
+
+ #print(bibentries[0])
+
+ #print(formatbibentry(bibentries[0]))
- writefilenewbib("biblatex-map-test.bib")
-
-
+ formatallbibliography()
+ printbibliography()
\ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex_check.py b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex_check.py
index f0be509ea7a..7493f8878ce 100644
--- a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex_check.py
+++ b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/biblatex_check.py
@@ -69,7 +69,7 @@ requiredFields = {"article": ["author", "title", "journaltitle/journal", "year/d
}
####################################################################
-
+#import os
import string
import re
import sys
@@ -137,24 +137,27 @@ if options.no_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()
+ 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 = ""
diff --git a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015.tex b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015.tex
index 780b6ec41f4..06a16f4e339 100644
--- a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015.tex
+++ b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015.tex
@@ -4,10 +4,10 @@
\begin{document}
-\includepdf[pages=-]{egfigure/eggbcitation.pdf}
+\includepdf[pages=-]{egfigure/tgbcitation.pdf}
-\includepdf[pages=-]{egfigure/eggbcitationay.pdf}
+\includepdf[pages=-]{egfigure/tgbcitationay.pdf}
-\includepdf[pages=-]{egfigure/eggbbiblio.pdf}
+\includepdf[pages=-]{egfigure/tgbbiblio.pdf}
\end{document}
diff --git a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015eg.tex b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015eg.tex
index 4acfe097263..f64360b40f2 100644
--- a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015eg.tex
+++ b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015eg.tex
@@ -6,117 +6,109 @@
\begin{document}
\phantomsection
-\addcontentsline{toc}{section}{cls-beamer}
-\includepdf[pages=-]{example/cls-beamer.pdf}
+%\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=-]{example/cls-beameray.pdf}
+%\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=-]{example/codeopt-gbcodegbk.pdf}
+%\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=-]{example/eg-opt-gbstyle.pdf}
+%\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-autolang-multilan}
-\includepdf[pages=-]{example/opt-autolang-multilan.pdf}
+%\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-eg-multilan}
-\includepdf[pages=-]{example/opt-eg-multilan.pdf}
+%\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-eg-authoryear}
-\includepdf[pages=-]{example/opt-eg-authoryear.pdf}
+%\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-gbalign-center}
-\includepdf[pages=-]{example/opt-gbalign-center.pdf}
+%\addcontentsline{toc}{section}{opt-gbbiblabel}
+\includepdf[pages=-,addtotoc={1,section,1,opt-gbbiblabel,eg:biblabel}]{example/opt-gbbiblabel.pdf}
-\phantomsection
-\addcontentsline{toc}{section}{opt-gbalign-gb}
-\includepdf[pages=-]{example/opt-gbalign-gb.pdf}
-
-\phantomsection
-\addcontentsline{toc}{section}{opt-gbalign-left}
-\includepdf[pages=-]{example/opt-gbalign-left.pdf}
\phantomsection
-\addcontentsline{toc}{section}{opt-gbbiblabel}
-\includepdf[pages=-]{example/opt-gbbiblabel.pdf}
+%\addcontentsline{toc}{section}{opt-gbfieldstd}
+\includepdf[pages=-,addtotoc={1,section,1,opt-gbfieldstd,eg:fieldstd}]{example/opt-gbfieldstd.pdf}
\phantomsection
-\addcontentsline{toc}{section}{opt-gbctexset}
-\includepdf[pages=-]{example/opt-gbctexset.pdf}
+%\addcontentsline{toc}{section}{opt-gbnamefmt}
+\includepdf[pages=-,addtotoc={1,section,1,opt-gbnamefmt,eg:namefmt}]{example/opt-gbnamefmt.pdf}
\phantomsection
-\addcontentsline{toc}{section}{opt-gbfieldstd}
-\includepdf[pages=-]{example/opt-gbfieldstd.pdf}
+%\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-gblocal}
-\includepdf[pages=-]{example/opt-gblocal.pdf}
+%\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-gbnamefmt}
-\includepdf[pages=-]{example/opt-gbnamefmt.pdf}
+%\addcontentsline{toc}{section}{opt-gbpunctin}
+\includepdf[pages=-,addtotoc={1,section,1,opt-gbpunctin,eg:in}]{example/opt-gbpunctin.pdf}
\phantomsection
-\addcontentsline{toc}{section}{opt-gbnamefmt-default}
-\includepdf[pages=-]{example/opt-gbnamefmt-default.pdf}
+%\addcontentsline{toc}{section}{opt-gbtitlelink}
+\includepdf[pages=-,addtotoc={1,section,1,opt-gbtitlelink,eg:titlelink}]{example/opt-gbtitlelink.pdf}
+
\phantomsection
-\addcontentsline{toc}{section}{opt-gbnoauthor-false}
-\includepdf[pages=-]{example/opt-gbnoauthor-false.pdf}
+%\addcontentsline{toc}{section}{opt-footbib}
+\includepdf[pages=-,addtotoc={1,section,1,opt-gbfootbib,eg:footbib}]{example/opt-gbfootbib.pdf}
\phantomsection
-\addcontentsline{toc}{section}{opt-gbnoauthor-true}
-\includepdf[pages=-]{example/opt-gbnoauthor-true.pdf}
+%\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-gbpub-true}
-\includepdf[pages=-]{example/opt-gbpub-true.pdf}
+%\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-gbpunctin}
-\includepdf[pages=-]{example/opt-gbpunctin.pdf}
+%\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-gbtitlelink}
-\includepdf[pages=-]{example/opt-gbtitlelink.pdf}
+%\addcontentsline{toc}{section}{opt-gblocal}
+\includepdf[pages=-,addtotoc={1,section,1,opt-gblocal,eg:local}]{example/opt-gblocal.pdf}
-\phantomsection
-\addcontentsline{toc}{section}{opt-gbtype}
-\includepdf[pages=-]{example/opt-gbtype.pdf}
-\phantomsection
-\addcontentsline{toc}{section}{testallformat}
-\includepdf[pages=-]{example/testallformat.pdf}
\end{document}
diff --git a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015fmt.tex b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015fmt.tex
new file mode 100644
index 00000000000..e3cd6eaa291
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015lan.tex b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015lan.tex
new file mode 100644
index 00000000000..81388b1ba56
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015lan.tex
@@ -0,0 +1,37 @@
+\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}
+
+
+\end{document}
diff --git a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015ms.tex b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015ms.tex
index 5f98b878a85..2a53a7ed9f4 100644
--- a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015ms.tex
+++ b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015ms.tex
@@ -4,10 +4,10 @@
\begin{document}
-\includepdf[pages=-]{egfigure/eggbcitationms.pdf}
+\includepdf[pages=-]{egfigure/tgbcitationms.pdf}
-\includepdf[pages=-]{egfigure/eggbcitationay.pdf}
+\includepdf[pages=-]{egfigure/tgbcitationay.pdf}
-\includepdf[pages=-]{egfigure/eggbbiblioms.pdf}
+\includepdf[pages=-]{egfigure/tgbbiblioms.pdf}
\end{document}
diff --git a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015thesis.tex b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015thesis.tex
index 0acc8890e4d..834dd36750f 100644
--- a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015thesis.tex
+++ b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/gbT7714-2015thesis.tex
@@ -24,6 +24,12 @@
\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}
@@ -55,4 +61,6 @@
%\addcontentsline{toc}{section}{ZJU}
\includepdf[pages=-,addtotoc={1,section,1,ZJU,eg:ZJU}]{egthesis/thesis-zju-numeric.pdf}
+
+
\end{document}
diff --git a/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/readme-BibLatex-Check.md b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/readme-BibLatex-Check.md
new file mode 100644
index 00000000000..d441c647905
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/readme-BibLatex-map.md b/Master/texmf-dist/doc/latex/biblatex-gb7714-2015/readme-BibLatex-map.md
new file mode 100644
index 00000000000..9209550fc7a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/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
+
+
+
+
+
+
diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/chinese-erj.bbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/chinese-erj.bbx
new file mode 100644
index 00000000000..7a0646b5627
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/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/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/chinese-erj.cbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/chinese-erj.cbx
new file mode 100644
index 00000000000..7fd829a0eed
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/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/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015-gbk.def b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015-gbk.def
index 17afbf67cee..50b9a5c39c6 100644
--- a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015-gbk.def
+++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015-gbk.def
@@ -21,3 +21,7 @@
\def\str@numbercn{}
\def\str@serialcn{}
\def\str@sameentry{ͬ}
+ \def\str@incn{}
+ \def\str@mathesiscn{˶ʿѧλ}
+ \def\str@phdthesiscn{ʿѧλ}
+ \def\str@editorcn{}
diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.bbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.bbx
index cc8c75d3e7e..6429952be64 100644
--- a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.bbx
+++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.bbx
@@ -11,10 +11,10 @@
%
% 版本和时间信息
%
-\def\versionofgbtstyle{2019/02/11 v1.0q}
+\def\versionofgbtstyle{2019/03/28 v1.0r}
\def\versionofbiblatex{\abx@version}
\ProvidesFile{gb7714-2015.bbx}[\versionofgbtstyle biblatex bibliography style]
-\RequireBiber[3]%显式指定用biber后端
+%\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求
%=====================================================================
% 加载标准样式
@@ -193,9 +193,11 @@
%为与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}
@@ -203,6 +205,14 @@
% 设置宏包选项
%=====================================================================
%
+ % 增加一个控制是否输出type域的选项
+ % 20190212,v1,0q,hzz
+ \newtoggle{bbx:gbfieldtype}
+ \DeclareBibliographyOption{gbfieldtype}[false]{%biblatex低版本
+ \settoggle{bbx:gbfieldtype}{#1}}
+ \ExecuteBibliographyOptions{gbfieldtype}
+
+ %
% 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表
% 20190203,v1.0p,hzz
% 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签
@@ -213,6 +223,10 @@
\ExecuteBibliographyOptions{gbfootbib}
%%
+ \newlength{\footbibmargin}
+ \newlength{\footbiblabelsep}
+ \setlength{\footbibmargin}{1em}%脚注的段落左侧缩进距离
+ \setlength{\footbiblabelsep}{0.5em}%脚注中标记号与脚注段落的间距
\def\execgbfootbib%
{%
%开启引用跟踪计数器,为使用\ifciteseen等测试命令
@@ -224,8 +238,80 @@
%beamer类因为其特殊性,为避免冲突不调footmisc。
%同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接
%如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。
- \PassOptionsToPackage{perpage,hang}{footmisc}
- \RequirePackage{footmisc}}
+ %\PassOptionsToPackage{perpage,hang}{footmisc}%
+ %\RequirePackage{footmisc}%
+
+ %重新实现脚注的根据单页重设脚注号码
+ %重新实现脚注的悬挂对齐问题,不再使用footmisc,直接从latex核心代码和hyperref代码进行修改
+ %v1.0q 20190317 hzz
+ \@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的方式
@@ -241,6 +327,7 @@
%
%判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容)
%记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。
+ %v1.0q 20190309 区分使脚注标注适应minipage中的情况
\newbibmacro*{citesavefn}{%
\ifciteseen%当被引用过为true
{\ifcsdef{sec\arabic{refsection}et\thefield{entrykey}}%当已经定义过脚注序号信息
@@ -248,9 +335,14 @@
\str@sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}et\thefield{entrykey}}}%
\@makefnmark%
}}%
- {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{\arabic{footnote}}}%
+ {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{%
+ \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}%
+ }}%
}%
- {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{\arabic{footnote}}}%
+ {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{%
+ \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}%
+ %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断
+ }}%
}
%
@@ -323,6 +415,10 @@
\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}{%
@@ -474,6 +570,12 @@
\@ifpackagelater{biblatex}{2016/03/27}
{ % 针对biblatex>=3.3版本的选项设置
+ % 增加不同语言排序的切换选项
+ % numeric样式,不使用该选项,这里给出仅为兼容性考虑
+ % v1.0q,20190307,hzz
+ %
+ \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{}
+
%
% 增加本地化字符串的中英文切换选项
% gbcitelocal指标注中的本地化字符串
@@ -519,6 +621,7 @@
\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}
@@ -534,6 +637,12 @@
}
}
{% 针对biblatex<3.3版本的选项设置
+ % 增加不同语言排序的切换选项
+ % numeric样式,不使用该选项,这里给出仅为兼容性考虑
+ % v1.0q,20190307,hzz
+ %
+ \DeclareBibliographyOption{gblanorder}[chineseahead]{}
+
%
% 增加序号标签格式处理选项
% v1.0l,20180623,hzz
@@ -552,6 +661,7 @@
\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}
@@ -639,6 +749,13 @@
\NewBibliographyString{volumecn}
\NewBibliographyString{numbercn}
\NewBibliographyString{serialcn}
+ \NewBibliographyString{incn}
+ \NewBibliographyString{mathesiscn}
+ \NewBibliographyString{phdthesiscn}
+ \NewBibliographyString{editorcn}
+ \NewBibliographyString{editorscn}
+
+
%
% 修改一些当地化字符串
@@ -669,6 +786,11 @@
andotherskr={외},
andjp={和},
andkr={和},
+ incn={\str@incn\addcolon\addspace},
+ mathesiscn={\str@mathesiscn},
+ phdthesiscn={\str@phdthesiscn},
+ editorscn={\str@editorcn},
+ editorcn={\str@editorcn},
}
@@ -846,11 +968,6 @@
\step[fieldsource=version] %有时会把version和edition混淆,处理后直接用edition
\step[fieldset=edition, origfieldval]
}
- \map{
- \pertype{inbook}
- \step[fieldsource=editor]%有时会把editor和bookauthor混淆,处理后使用bookauthor
- \step[fieldset=bookauthor, origfieldval]
- }
\map{%兼容老的standard类型,确定文献类型标识符
\pertype{standard}
\step[fieldset=usera, fieldvalue={S}]
@@ -866,8 +983,6 @@
\step[fieldset=usera, fieldvalue={C}]
\step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
\step[fieldset=publisher, origfieldval]
- \step[fieldsource=editor]%%有时会把editor和bookauthor混淆,处理后使用bookauthor
- \step[fieldset=bookauthor, origfieldval]
}
\map{
\pertype{proceedings}
@@ -880,8 +995,6 @@
\step[fieldset=usera, fieldvalue={G}]
\step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher
\step[fieldset=publisher, origfieldval]
- \step[fieldsource=editor]%%有时会把editor和bookauthor混淆,处理后使用bookauthor
- \step[fieldset=bookauthor, origfieldval]
}
\map{
\pertype{collection}
@@ -1081,27 +1194,27 @@
\step[fieldset=userd,origfieldval]
}
\map{%当文献给出language域时,设置文献要使用的本地化字符串的语言
- \step[fieldsource=language,match=english,final]
+ \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=russian,final]
+ \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=french,final]
+ \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=chinese,final]%中日韩语目前都用english,
+ \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=japnese,final]%中日韩语目前都用english,
+ \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=korean,final]%中日韩语目前都用english,
+ \step[fieldsource=language,match=\regexp{(k|K)(o|O)(r|R)(e|E)(a|A)(n|N)},final]%中日韩语目前都用english,
\step[fieldset=langid,fieldvalue={english}]
}
}
@@ -1124,14 +1237,14 @@
\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=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]
@@ -1282,14 +1395,14 @@
\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=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]
@@ -1554,28 +1667,40 @@
% 而[]中间的内容,从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]}}%
-}{\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}}
+\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}}
+\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}}
+\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等参考文献信息的输出格式
@@ -1690,13 +1815,13 @@
test \ifmorenames
}{\ifnumgreater{\value{liststop}}{1}%
{\finalandcomma}%
- {}%biblatex作者要区别单作者加等的情况,这里为符合gbt7714-2015第7.2节的要求加上了逗号。
+ {}%
\printdelim{andothersdelim}\printdelim{strandothersdelim}%
}{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如:
%袁训来, 陈哲, 肖书海, 等.
%胡泳, 范海燕, 译.
%潘惠霞, 魏婧, 杨艳, 等译.
-\ifcurrentname{translator}{\addcomma}{}%
+\ifcurrentname{translator}{\addcomma\addthinspace}{}%为了实现上述第二个示例情况做的处理
}}
@@ -1709,8 +1834,6 @@
% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了
% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置
\DeclareDelimFormat{strandothersdelim}{%
- \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
- \addspace%
\edef\userfieldabcde{userd}%
\ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
\ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
@@ -1719,7 +1842,7 @@
\ifcase\value{gbbiblocalcase}%
\iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}%
\iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}%
- \iffieldequalstr{\userfieldabcde}{japnese}{\bibstring{andothersjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andothersjp}}{}%
\iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}%
\iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%
\iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%
@@ -1748,7 +1871,7 @@
\ifcase\value{gbbiblocalcase}%
\iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}%
\iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
- \iffieldequalstr{\userfieldabcde}{japnese}{\bibstring{andjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}%
\iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}%
\iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}%
\iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}%
@@ -1853,6 +1976,36 @@
{\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}}
@@ -2064,6 +2217,17 @@
{\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}}
}
@@ -2575,6 +2739,8 @@ incollection,proceedings,inproceedings]{number}{%
%
% 编者的符号修改一下
+% v1.0 2016-07-01
+% v1.0q 2019-03-01 hzz 修改editortype前的标点
%
\renewbibmacro*{editor}{%源来自biblatex.DEF
\ifboolexpr{
@@ -2585,13 +2751,16 @@ incollection,proceedings,inproceedings]{number}{%
{\printnames{editor}%
\iffieldundef{editortype}%增加一个类型判断,用于存在editortype的情况
{\setunit\addspace}%当没有editortype时,直接用句点
- {\setunit{\addcomma\space}%
+ {%\setunit{\addcomma\space}%
\usebibmacro{editorstrg}}%
- \clearname{editor}}
+ %\clearname{editor}
+ }%
{}}
%
% 编者类型做一修改
+% v1.0 2016-07-01
+% v1.0q 2019-03-01 hzz 修改editortype不同语言的不同本地化字符串
%
\renewbibmacro*{editorstrg}{%源来自biblatex.DEF
\printtext[editortype]{%
@@ -2611,12 +2780,71 @@ incollection,proceedings,inproceedings]{number}{%
or
test {\ifandothers{editor}}
}
- {\bibstring{\thefield{editortype}s}}
- {\bibstring{\thefield{editortype}}}}
+ {\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
@@ -2722,12 +2950,26 @@ incollection,proceedings,inproceedings]{number}{%
%
% 修改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}\printtext{\bibstring{in}}}}%\newunit\newblock\intitlepunct
-
+ {\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}}%
+}
%=====================================================================
%设置驱动格式
@@ -3031,8 +3273,9 @@ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{
\newunit\newblock
\usebibmacro{byeditor+others}%增加的译者信息
\newunit\newblock
+ \iftoggle{bbx:gbfieldtype}{%
\printfield{type}%
- \setunit*{\addspace}%
+ \setunit*{\addspace}}{}%
\printfield{number}%
\newunit\newblock
\printfield{version}%
@@ -3118,7 +3361,9 @@ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{
\usebibmacro{in:}%
%\printtext{\texttt{//}\addthinspace}%
\usebibmacro{bybookauthor}%
- \ifnameundef{bookauthor}{}{\newunit}%替换下一句
+ \ifnameundef{bookauthor}{%
+ \ifnameundef{editor}{}{\newunit}%
+ }{\newunit}%替换下一句
%\newunit\newblock
\usebibmacro{maintitle+booktitle}%
\setunit{\addcolon}\printfield{volume}\printfield{number}%增加卷和册信息
diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.cbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.cbx
index 5aa650816e4..949c37dca92 100644
--- a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.cbx
+++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015.cbx
@@ -7,7 +7,7 @@
%% Released under the LaTeX Project Public License v1.3c or later
%% ---------------------------------------------------------------
%%
-\def\versionofgbtstyle{2019/02/11 v1.0q}
+\def\versionofgbtstyle{2019/03/28 v1.0r}
\ProvidesFile{gb7714-2015.cbx}[\versionofgbtstyle biblatex citation style]
%
diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx
index 23517c5562b..593f17155a9 100644
--- a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx
+++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.bbx
@@ -10,10 +10,10 @@
%
% 版本和时间信息
%
-\def\versionofgbtstyle{2019/02/11 v1.0q}
+\def\versionofgbtstyle{2019/03/28 v1.0r}
\def\versionofbiblatex{\abx@version}
\ProvidesFile{gb7714-2015ay.bbx}[\versionofgbtstyle biblatex bibliography style]
-\RequireBiber[3]%显式指定用biber后端
+%\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求
%=====================================================================
%加载标准样式
@@ -190,9 +190,11 @@
%为与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}
@@ -200,6 +202,14 @@
% 设置宏包选项
%=====================================================================
%
+ % 增加一个控制是否输出type域的选项
+ % 20190212,v1,0q,hzz
+ \newtoggle{bbx:gbfieldtype}
+ \DeclareBibliographyOption{gbfieldtype}[false]{%biblatex低版本
+ \settoggle{bbx:gbfieldtype}{#1}}
+ \ExecuteBibliographyOptions{gbfieldtype}
+
+ %
% 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表
% 20190203,v1.0p,hzz
% 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签
@@ -209,7 +219,11 @@
\ifstrequal{#1}{false}{}{\execgbfootbib}}
\ExecuteBibliographyOptions{gbfootbib}
- %%
+ %%
+ \newlength{\footbibmargin}
+ \newlength{\footbiblabelsep}
+ \setlength{\footbibmargin}{1em}%脚注的段落左侧缩进距离
+ \setlength{\footbiblabelsep}{0.5em}%脚注中标记号与脚注段落的间距
\def\execgbfootbib%
{%
%开启引用跟踪计数器,为使用\ifciteseen等测试命令
@@ -221,8 +235,79 @@
%beamer类因为其特殊性,为避免冲突不调footmisc。
%同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接
%如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。
- \PassOptionsToPackage{perpage,hang}{footmisc}
- \RequirePackage{footmisc}}
+ %\PassOptionsToPackage{perpage,hang}{footmisc}%
+ %\RequirePackage{footmisc}%
+
+ %重新实现脚注的根据单页重设脚注号码
+ %重新实现脚注的悬挂对齐问题,不再使用footmisc,直接从latex核心代码和hyperref代码进行修改
+ %v1.0q 20190317 hzz
+ \@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的方式
@@ -238,16 +323,22 @@
%
%判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容)
%记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。
+ %v1.0q 20190309 区分使脚注标注适应minipage中的情况
\newbibmacro*{citesavefn}{%
- \ifciteseen%当被引用过,则为true
+ \ifciteseen%当被引用过为true
{\ifcsdef{sec\arabic{refsection}et\thefield{entrykey}}%当已经定义过脚注序号信息
{\csgdef{labelsec\arabic{refsection}et\thefield{entrykey}}{%
- \str@sameentry\xdef\@thefnmark{\csuse{sec\arabic{refsection}et\thefield{entrykey}}}%
- \@makefnmark}%
- }%
- {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{\arabic{footnote}}}%
+ \str@sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}et\thefield{entrykey}}}%
+ \@makefnmark%
+ }}%
+ {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{%
+ \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}%
+ }}%
}%
- {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{\arabic{footnote}}}%
+ {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{%
+ \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}%
+ %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断
+ }}%
}
%
@@ -320,6 +411,10 @@
\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}{%
@@ -458,6 +553,41 @@
\@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 指文献表中的本地化字符串
@@ -498,8 +628,9 @@
\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}{familyahead}{\setcounter{gbnamefmtcase}{3}}{}%family-given
+ \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%
+ \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family
}
\ExecuteBibliographyOptions{gbnamefmt}
@@ -514,6 +645,13 @@
}
{
+ % 增加不同语言排序的切换选项
+ % biblatex 3.4及以下版本不能使用多个stylesourcemap,所以不使用该选项
+ % 这里给出仅为兼容性考虑
+ % v1.0q,20190307,hzz
+ %
+ \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{}
+
%
% 增加序号标签格式处理选项,作者年制不做处理,给出只为兼容选项考虑
% v1.0l,20180623,hzz
@@ -529,6 +667,7 @@
\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}
@@ -610,6 +749,11 @@
\NewBibliographyString{volumecn}
\NewBibliographyString{numbercn}
\NewBibliographyString{serialcn}
+ \NewBibliographyString{incn}
+ \NewBibliographyString{mathesiscn}
+ \NewBibliographyString{phdthesiscn}
+ \NewBibliographyString{editorcn}
+ \NewBibliographyString{editorscn}
%
% 修改一些当地化字符串
@@ -639,6 +783,11 @@
andotherskr={외},
andjp={和},
andkr={和},
+ incn={\str@incn\addcolon\addspace},
+ mathesiscn={\str@mathesiscn},
+ phdthesiscn={\str@phdthesiscn},
+ editorscn={\str@editorcn},
+ editorcn={\str@editorcn},
}
@@ -815,11 +964,6 @@
\step[fieldsource=version] %有时会把version和edition混淆,处理后直接用edition
\step[fieldset=edition, origfieldval]
}
- \map{
- \pertype{inbook}
- \step[fieldsource=editor]%有时会把editor和bookauthor混淆,处理后使用bookauthor
- \step[fieldset=bookauthor, origfieldval]
- }
\map{%兼容老的standard类型,确定文献类型标识符
\pertype{standard}
\step[fieldset=usera, fieldvalue={S}]
@@ -835,8 +979,6 @@
\step[fieldset=usera, fieldvalue={C}]
\step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用institution
\step[fieldset=publisher, origfieldval]
- \step[fieldsource=editor]%%有时会把editor和bookauthor混淆,处理后使用bookauthor
- \step[fieldset=bookauthor, origfieldval]
}
\map{
\pertype{proceedings}
@@ -849,8 +991,6 @@
\step[fieldset=usera, fieldvalue={G}]
\step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用institution
\step[fieldset=publisher, origfieldval]
- \step[fieldsource=editor]%%有时会把editor和bookauthor混淆,处理后使用bookauthor
- \step[fieldset=bookauthor, origfieldval]
}
\map{
\pertype{collection}
@@ -1050,28 +1190,36 @@
\step[fieldset=userd,origfieldval]
}
\map{%当文献给出language域时,设置文献要使用的本地化字符串的语言
- \step[fieldsource=language,match=english,final]
+ %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=russian,final]
+ \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=french,final]
+ \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=chinese,final]%中日韩语目前都用english,
+ \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=japnese,final]%中日韩语目前都用english,
+ \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=korean,final]%中日韩语目前都用english,
+ \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中有出现,但仅定义了类型,域和约束等都没有定义
@@ -1082,14 +1230,14 @@
\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=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]
@@ -1253,6 +1401,41 @@
}
}
+%
+% 不同语言分集调整的实现方式
+%
+% 原理方法:利用样式层的动态数据修改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]
+ }
+ }
+ }
+}
+
%
%驱动别名等价于驱动层映射
@@ -1285,15 +1468,13 @@
\field{sortkey}
}
\sort{
- \field{language}
+ \field{lansortorder}%language
}
\sort{%[direction=descending]
\field{sortname}
\field{author}
\field{editor}
\field{translator}
- \field{sorttitle}
- \field{title}
}
\sort{
\field{sortyear}
@@ -1318,15 +1499,13 @@
\field{sortkey}
}
\sort{
- \field{language}
+ \field{lansortorder}%language
}
\sort[direction=descending]{
\field{sortname}
\field{author}
\field{editor}
\field{translator}
- \field{sorttitle}
- \field{title}
}
\sort{
\field{sortyear}
@@ -1351,7 +1530,7 @@
\field{sortkey}
}
\sort{
- \field{language}
+ \field{lansortorder}%language
}
\sort[direction=descending]{
\field{sortyear}
@@ -1362,8 +1541,6 @@
\field{author}
\field{editor}
\field{translator}
- \field{sorttitle}
- \field{title}
}
\sort{
\field{sorttitle}
@@ -1384,7 +1561,7 @@
\field{sortkey}
}
\sort{
- \field{language}
+ \field{lansortorder}%language
}
\sort{
\field{sortyear}
@@ -1395,8 +1572,6 @@
\field{author}
\field{editor}
\field{translator}
- \field{sorttitle}
- \field{title}
}
\sort{
\field{sorttitle}
@@ -1422,15 +1597,13 @@
\field{sortkey}
}
\sort{
- \field{language}
+ \field{lansortorder}%language
}
\sort{%[direction=descending]
\field{sortname}
\field{author}
\field{editor}
\field{translator}
- \field{sorttitle}
- \field{title}
}
\sort{
\field{sortyear}
@@ -1455,15 +1628,13 @@
\field{sortkey}
}
\sort{
- \field{language}
+ \field{lansortorder}%language
}
\sort[direction=descending]{%
\field{sortname}
\field{author}
\field{editor}
\field{translator}
- \field{sorttitle}
- \field{title}
}
\sort{
\field{sortyear}
@@ -1488,7 +1659,7 @@
\field{sortkey}
}
\sort{
- \field{language}
+ \field{lansortorder}%language
}
\sort[direction=descending]{
\field{sortyear}
@@ -1499,8 +1670,6 @@
\field{author}
\field{editor}
\field{translator}
- \field{sorttitle}
- \field{title}
}
\sort{
\field{sorttitle}
@@ -1521,7 +1690,7 @@
\field{sortkey}
}
\sort{
- \field{language}
+ \field{lansortorder}%language
}
\sort{%[direction=ascending]
\field{sortyear}
@@ -1532,8 +1701,6 @@
\field{author}
\field{editor}
\field{translator}
- \field{sorttitle}
- \field{title}
}
\sort{
\field{sorttitle}
@@ -1623,28 +1790,42 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
% 而[]中间的内容,从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]}}%
-}{\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}}
+\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}}
+\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}}
+\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等参考文献信息的输出格式
@@ -1751,20 +1932,21 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
% 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}%
- {\finalandcomma}%
- {}%biblatex作者要区别单作者加等的情况,这里为符合gbt7714-2015第7.2节的要求加上了逗号。
+ }{\ifnumgreater{\value{liststop}}{1}%注意这里试图去区分姓名总数大于1的情况,当姓名总数大于1时,最后一个姓名后面先加入一个\finalandcomma
+ {\finalandcomma}%目前国标没有这样的区分要求,如果有需要也是可以这么去做的。
+ {}%
\printdelim{andothersdelim}\printdelim{strandothersdelim}%
}{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如:
%袁训来, 陈哲, 肖书海, 等.
%胡泳, 范海燕, 译.
%潘惠霞, 魏婧, 杨艳, 等译.
-\ifcurrentname{translator}{\addcomma}{}%
+\ifcurrentname{translator}{\addcomma\addthinspace}{}%为了实现上述第二个示例情况做的处理
}}
% 修改省略作者后的本地化字符串,比如et al.
@@ -1775,18 +1957,16 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了
% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置
\DeclareDelimFormat{strandothersdelim}{%
- \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}}{}%
+ \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}{\bibstring{andothersincitecn}}{}%中文已经通过english本地化字符串定义
- \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}%韩语未定义,所以与bib中一致
- \iffieldequalstr{\userfieldabcde}{japnese}{\bibstring{andothersjp}}{}%日与同韩语
- \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothersincite}}{}%英语已定义
+ \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%
@@ -1795,9 +1975,8 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
\bibstring{andothersincite}%
\fi}
+
\DeclareDelimFormat[bib,biblist]{strandothersdelim}{%
- \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
- \addspace%
\edef\userfieldabcde{userd}%
\ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
\ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
@@ -1806,7 +1985,7 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
\ifcase\value{gbbiblocalcase}%
\iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}%
\iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}%
- \iffieldequalstr{\userfieldabcde}{japnese}{\bibstring{andothersjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andothersjp}}{}%
\iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}%
\iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%
\iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%
@@ -1836,7 +2015,7 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
\ifcase\value{gbcitelocalcase}%
\iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andincitecn}}{}%
\iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
- \iffieldequalstr{\userfieldabcde}{japnese}{\bibstring{andjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}%
\iffieldequalstr{\userfieldabcde}{english}{\bibstring{andincite}}{}%
\iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}%
\iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}%
@@ -1858,7 +2037,7 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
\ifcase\value{gbbiblocalcase}%
\iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}%
\iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
- \iffieldequalstr{\userfieldabcde}{japnese}{\bibstring{andjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}%
\iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}%
\iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}%
\iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}%
@@ -1965,6 +2144,36 @@ test {\iftoggle{iftlseven}}%biblatex<=3.7
{\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}}
@@ -2176,6 +2385,17 @@ test {\iftoggle{iftlseven}}%biblatex<=3.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}}
}
@@ -2606,6 +2826,7 @@ incollection,proceedings,inproceedings]{number}{%
{\printdateextralabel}%
{\printfield{labelyear}%
\printfield{extrayear}}}}}%
+ \newbibmacro{date+extradate}{\usebibmacro{date+extrayear}}
}
\defversion{3.4}{dateextra}{
@@ -2619,6 +2840,7 @@ incollection,proceedings,inproceedings]{number}{%
{\printdateextralabel}%
{\printfield{labelyear}%
\printfield{extrayear}}}}}%
+ \newbibmacro{date+extradate}{\usebibmacro{date+extrayear}}
}
\defversion{3.7}{dateextra}{
\DeclareDelimFormat{nameyeardelim}{\addcomma\space}
@@ -2631,6 +2853,8 @@ incollection,proceedings,inproceedings]{number}{%
{\printlabeldateextra}%
{\printfield{labelyear}%
\printfield{extrayear}}}}}%
+
+\newbibmacro{date+extradate}{\usebibmacro{date+extrayear}}
}
\defversion{3.8}{dateextra}{
\DeclareDelimFormat{nameyeardelim}{\addcomma\space}
@@ -2666,8 +2890,40 @@ incollection,proceedings,inproceedings]{number}{%
\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}%
+\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
@@ -2781,7 +3037,46 @@ incollection,proceedings,inproceedings]{number}{%
}
%
+% 编者的符号修改一下
+% 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]{%
@@ -2801,12 +3096,71 @@ incollection,proceedings,inproceedings]{number}{%
or
test {\ifandothers{editor}}
}
- {\bibstring{\thefield{editortype}s}}
- {\bibstring{\thefield{editortype}}}}
+ {\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
@@ -2912,12 +3266,26 @@ incollection,proceedings,inproceedings]{number}{%
%
% 修改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}\printtext{\bibstring{in}}}}%\newunit\newblock\intitlepunct
-
+ {\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}}%
+}
%=====================================================================
%设置驱动格式
@@ -3224,8 +3592,10 @@ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{
\newunit\newblock
\usebibmacro{byeditor+others}%增加的译者信息
\newunit\newblock
- \printfield{type}%
+ \iftoggle{bbx:gbfieldtype}{%
+ \printfield{type}%
\setunit*{\addspace}%
+ }{}%
\printfield{number}%
\newunit\newblock
\printfield{version}%
@@ -3314,7 +3684,9 @@ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{
\usebibmacro{in:}%
%\printtext{\texttt{//}\addthinspace}%
\usebibmacro{bybookauthor}%
- \ifnameundef{bookauthor}{}{\newunit}%替换下一句
+ \ifnameundef{bookauthor}{%
+ \ifnameundef{editor}{}{\newunit}%
+ }{\newunit}%替换下一句
%\newunit\newblock
\usebibmacro{maintitle+booktitle}%
\setunit{\addcolon}\printfield{volume}\printfield{number}%增加卷和册信息
diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.cbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.cbx
index 133d4a727ab..3c35d2891d8 100644
--- a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.cbx
+++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ay.cbx
@@ -7,7 +7,7 @@
%% Released under the LaTeX Project Public License v1.3c or later
%% ---------------------------------------------------------------
%%
-\def\versionofgbtstyle{2019/02/11 v1.0q}
+\def\versionofgbtstyle{2019/03/28 v1.0r}
\ProvidesFile{gb7714-2015ay.cbx}[\versionofgbtstyle biblatex citation style]
%
diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.bbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.bbx
index 9b652a900e0..186f5577869 100644
--- a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.bbx
+++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.bbx
@@ -11,10 +11,11 @@
%
% 版本和时间信息
%
-\def\versionofgbtstyle{2019/02/11 v1.0q}
+\def\versionofgbtstyle{2019/03/28 v1.0r}
\def\versionofbiblatex{\abx@version}
\ProvidesFile{gb7714-2015ms.bbx}[\versionofgbtstyle biblatex bibliography style]
-\RequireBiber[3]%显式指定用biber后端
+%\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求
+
%=====================================================================
% 加载标准样式
@@ -80,9 +81,11 @@
%为与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}
@@ -90,6 +93,14 @@
% 设置宏包选项
%=====================================================================
%
+ % 增加一个控制是否输出type域的选项
+ % 20190212,v1,0q,hzz
+ \newtoggle{bbx:gbfieldtype}
+ \DeclareBibliographyOption{gbfieldtype}[false]{%biblatex低版本
+ \settoggle{bbx:gbfieldtype}{#1}}
+ \ExecuteBibliographyOptions{gbfieldtype}
+
+ %
% 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表
% 20190203,v1.0p,hzz
% 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签
@@ -99,7 +110,11 @@
\ifstrequal{#1}{false}{}{\execgbfootbib}}
\ExecuteBibliographyOptions{gbfootbib}
- %%
+ %%
+ \newlength{\footbibmargin}
+ \newlength{\footbiblabelsep}
+ \setlength{\footbibmargin}{1em}%脚注的段落左侧缩进距离
+ \setlength{\footbiblabelsep}{0.5em}%脚注中标记号与脚注段落的间距
\def\execgbfootbib%
{%
%开启引用跟踪计数器,为使用\ifciteseen等测试命令
@@ -111,8 +126,80 @@
%beamer类因为其特殊性,为避免冲突不调footmisc。
%同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接
%如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。
- \PassOptionsToPackage{perpage,hang}{footmisc}
- \RequirePackage{footmisc}}
+ %\PassOptionsToPackage{perpage,hang}{footmisc}%
+ %\RequirePackage{footmisc}%
+
+ %重新实现脚注的根据单页重设脚注号码
+ %重新实现脚注的悬挂对齐问题,不再使用footmisc,直接从latex核心代码和hyperref代码进行修改
+ %v1.0q 20190317 hzz
+ \@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的方式
@@ -128,6 +215,7 @@
%
%判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容)
%记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。
+ %v1.0q 20190309 区分使脚注标注适应minipage中的情况
\newbibmacro*{citesavefn}{%
\ifciteseen%当被引用过为true
{\ifcsdef{sec\arabic{refsection}et\thefield{entrykey}}%当已经定义过脚注序号信息
@@ -135,9 +223,14 @@
\str@sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}et\thefield{entrykey}}}%
\@makefnmark%
}}%
- {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{\arabic{footnote}}}%
+ {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{%
+ \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}%
+ }}%
}%
- {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{\arabic{footnote}}}%
+ {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{%
+ \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}%
+ %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断
+ }}%
}
%
@@ -209,6 +302,10 @@
\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}{%
@@ -333,6 +430,13 @@
\def\thegbcitelocalcase{\the\c@gbcitelocalcase}
\def\thegbbiblocalcase{\the\c@gbbiblocalcase}
+ % 增加不同语言排序的切换选项
+ % numeric样式,不使用该选项,这里给出仅为兼容性考虑
+ % v1.0q,20190307,hzz
+ %
+ \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{}
+
+
%
% 增加本地化字符串的中英文切换选项
% gbcitelocal指标注中的本地化字符串
@@ -374,6 +478,7 @@
\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
}
@@ -442,6 +547,12 @@
\NewBibliographyString{volumecn}
\NewBibliographyString{numbercn}
\NewBibliographyString{serialcn}
+ \NewBibliographyString{incn}
+ \NewBibliographyString{mathesiscn}
+ \NewBibliographyString{phdthesiscn}
+ \NewBibliographyString{editorcn}
+ \NewBibliographyString{editorscn}
+
%
% 修改一些当地化字符串
@@ -471,6 +582,11 @@
andotherskr={외},
andjp={和},
andkr={和},
+ incn={\str@incn\addcolon\addspace},
+ mathesiscn={\str@mathesiscn},
+ phdthesiscn={\str@phdthesiscn},
+ editorscn={\str@editorcn},
+ editorcn={\str@editorcn},
}
@@ -647,11 +763,6 @@
\step[fieldsource=version] %有时会把version和edition混淆,处理后直接用edition
\step[fieldset=edition, origfieldval]
}
- \map{
- \pertype{inbook}
- \step[fieldsource=editor]%有时会把editor和bookauthor混淆,处理后使用bookauthor
- \step[fieldset=bookauthor, origfieldval]
- }
\map{%兼容老的standard类型,确定文献类型标识符
\pertype{standard}
\step[fieldset=usera, fieldvalue={S}]
@@ -667,8 +778,6 @@
\step[fieldset=usera, fieldvalue={C}]
\step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用institution
\step[fieldset=publisher, origfieldval]
- \step[fieldsource=editor]%%有时会把editor和bookauthor混淆,处理后使用bookauthor
- \step[fieldset=bookauthor, origfieldval]
}
\map{
\pertype{proceedings}
@@ -681,8 +790,6 @@
\step[fieldset=usera, fieldvalue={G}]
\step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用institution
\step[fieldset=publisher, origfieldval]
- \step[fieldsource=editor]%%有时会把editor和bookauthor混淆,处理后使用bookauthor
- \step[fieldset=bookauthor, origfieldval]
}
\map{
\pertype{collection}
@@ -882,27 +989,27 @@
\step[fieldset=userd,origfieldval]
}
\map{%当文献给出language域时,设置文献要使用的本地化字符串的语言
- \step[fieldsource=language,match=english,final]
+ \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=russian,final]
+ \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=french,final]
+ \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=chinese,final]%中日韩语目前都用english,
+ \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=japnese,final]%中日韩语目前都用english,
+ \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=korean,final]%中日韩语目前都用english,
+ \step[fieldsource=language,match=\regexp{(k|K)(o|O)(r|R)(e|E)(a|A)(n|N)},final]%中日韩语目前都用english,
\step[fieldset=langid,fieldvalue={english}]
}
}
@@ -924,14 +1031,14 @@
\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=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]
@@ -1154,28 +1261,40 @@
% 而[]中间的内容,从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]}}%
-}{\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}}
+\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}}
+\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}}
+\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等参考文献信息的输出格式
@@ -1247,6 +1366,36 @@
{\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}}
@@ -1450,7 +1599,7 @@
%
% 重设专利title的输出,将文献类型标识符输出出去
%
-\newbibmacro*{patenttitle}{%原输出来自biblatex.def文件
+\renewbibmacro*{patenttitle}{%原输出来自biblatex.def文件
\ifboolexpr{%
test{\iffieldundef{title}}%
and%
@@ -1472,6 +1621,47 @@
}%
}
+%
+% 编者类型的本地化字符串输出
+% 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}%
+
%=====================================================================
%设置驱动格式
@@ -1537,13 +1727,13 @@ togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}}%
test \ifmorenames
}{\ifnumgreater{\value{liststop}}{1}%
{\finalandcomma}%
- {}%biblatex作者要区别单作者加等的情况,这里为符合gbt7714-2015第7.2节的要求加上了逗号。
+ {}%
\printdelim{andothersdelim}\printdelim{strandothersdelim}%
}{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如:
%袁训来, 陈哲, 肖书海, 等.
%胡泳, 范海燕, 译.
%潘惠霞, 魏婧, 杨艳, 等译.
-\ifcurrentname{translator}{\addcomma}{}%
+\ifcurrentname{translator}{\addcomma\addthinspace}{}%为了实现上述第二个示例情况做的处理
}}%
%
% 修改省略作者后的本地化字符串,比如et al.
@@ -1554,8 +1744,6 @@ togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}}%
% 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了
% 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置
\DeclareDelimFormat{strandothersdelim}{%
- \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
- \addspace%
\edef\userfieldabcde{userd}%
\ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}%
\ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}%
@@ -1564,7 +1752,7 @@ togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}}%
\ifcase\value{gbbiblocalcase}%
\iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}%
\iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}%
- \iffieldequalstr{\userfieldabcde}{japnese}{\bibstring{andothersjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andothersjp}}{}%
\iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}%
\iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%
\iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%
@@ -1592,7 +1780,7 @@ togl{bbx:gbstyle} or test {\iffieldequalstr{userd}{chinese}}%
\ifcase\value{gbbiblocalcase}%
\iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}%
\iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}%
- \iffieldequalstr{\userfieldabcde}{japnese}{\bibstring{andjp}}{}%
+ \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}%
\iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}%
\iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}%
\iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}%
@@ -1895,33 +2083,38 @@ incollection,proceedings,inproceedings]{number}{%
%
\renewbibmacro*{note+pages}{%源来自standard.bbx
%\printfield{note}%不要note,note用来判断是否是报纸newspaper
- \iffieldundef{pages}{}{
+ \iffieldundef{pages}{}{%
\setunit{\bibpagespunct}%
\printfield{pages}}%
%\newunit
}%
%
% 编者的符号修改一下
+% v1.0 2016-07-01
+% v1.0q 2019-03-01 hzz 修改editortype前的标点
%
\renewbibmacro*{editor}{%源来自biblatex.DEF
- \ifboolexpr{
+ \ifboolexpr{%
test \ifuseeditor
and
- not test {\ifnameundef{editor}}
- }
+ not test {\ifnameundef{editor}}%
+ }%
{\printnames{editor}%
\iffieldundef{editortype}%增加一个类型判断,用于存在editortype的情况
{\setunit\addspace}%当没有editortype时,直接用句点
- {\setunit{\addcomma\space}%
+ {%\setunit{\addcomma\space}%
\usebibmacro{editorstrg}}%
- \clearname{editor}}
+ %\clearname{editor}
+ }%
{}}%
%
% 编者类型做一修改
+% v1.0 2016-07-01
+% v1.0q 2019-03-01 hzz 修改editortype不同语言的不同本地化字符串
%
\renewbibmacro*{editorstrg}{%源来自biblatex.DEF
\printtext[editortype]{%
- \iffieldundef{editortype}
+ \iffieldundef{editortype}%
{%
% \ifboolexpr{ %这一段去掉,未定义编者类型情况下不处理
% test {\ifnumgreater{\value{editor}}{1}}
@@ -1930,18 +2123,34 @@ incollection,proceedings,inproceedings]{number}{%
% }
% {\bibstring{editors}}
% {\bibstring{editor}}
- }
- {\ifbibxstring{\thefield{editortype}} %定义编者类型情况下处理,以后根据需要修改
- {\ifboolexpr{
- test {\ifnumgreater{\value{editor}}{1}}
+ }%
+ {\ifbibxstring{\thefield{editortype}}%定义编者类型情况下处理,以后根据需要修改
+ {\ifboolexpr{%
+ test {\ifnumgreater{\value{editor}}{1}}%
or
- test {\ifandothers{editor}}
- }
- {\bibstring{\thefield{editortype}s}}
- {\bibstring{\thefield{editortype}}}}
+ 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
@@ -2002,11 +2211,25 @@ incollection,proceedings,inproceedings]{number}{%
%
% 修改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}\printtext{\bibstring{in}}}}%\newunit\newblock\intitlepunct
+ {\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条目类的驱动
%
@@ -2296,8 +2519,9 @@ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{
\newunit\newblock
\usebibmacro{byeditor+others}%增加的译者信息
\newunit\newblock
+ \iftoggle{bbx:gbfieldtype}{%
\printfield{type}%
- \setunit*{\addspace}%
+ \setunit*{\addspace}}{}%
\printfield{number}%
\newunit\newblock
\printfield{version}%
@@ -2380,7 +2604,9 @@ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{
\usebibmacro{in:}%
%\printtext{\texttt{//}\addthinspace}%
\usebibmacro{bybookauthor}%
- \ifnameundef{bookauthor}{}{\newunit}%替换下一句
+ \ifnameundef{bookauthor}{%
+ \ifnameundef{editor}{}{\newunit}%
+ }{\newunit}%替换下一句
%\newunit\newblock
\usebibmacro{maintitle+booktitle}%
\setunit{\addcolon}\printfield{volume}\printfield{number}%增加卷和册信息
@@ -2427,3 +2653,4 @@ test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{
\AtEveryBibitem{\localsetchinesecode}%
\AtEveryCite{\localsetchinesecode}%
+\AtEveryLositem{\localsetchinesecode}%
diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.cbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.cbx
index ffdfccf7e42..361f9d73a31 100644
--- a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.cbx
+++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015ms.cbx
@@ -7,7 +7,7 @@
%% Released under the LaTeX Project Public License v1.3c or later
%% ---------------------------------------------------------------
%%
-\def\versionofgbtstyle{2019/02/11 v1.0q}
+\def\versionofgbtstyle{2019/03/28 v1.0r}
\ProvidesFile{gb7714-2015.cbx}[\versionofgbtstyle biblatex citation style]
%
diff --git a/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015mx.bbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015mx.bbx
new file mode 100644
index 00000000000..7b043ea65b6
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015mx.bbx
@@ -0,0 +1,3247 @@
+%%
+%% ---------------------------------------------------------------
+%% 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/03/28 v1.0r}
+\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包的问题
+
+
+%=====================================================================
+% 功能函数
+%=====================================================================
+ %
+ % 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}
+
+ %
+ % 增加一个选项,用于控制是否实现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
+ \@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}et\thefield{entrykey}}%当已经定义过脚注序号信息
+ {\csgdef{labelsec\arabic{refsection}et\thefield{entrykey}}{%
+ \str@sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}et\thefield{entrykey}}}%
+ \@makefnmark%
+ }}%
+ {\csxdef{sec\arabic{refsection}et\thefield{entrykey}}{%
+ \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}%
+ }}%
+ }%
+ {\csxdef{sec\arabic{refsection}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}et\thefield{entrykey}}%
+ {\csuse{labelsec\arabic{refsection}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,
+ }
+
+
+%=====================================================================
+% 设置本地化字符串
+%=====================================================================
+ %
+ % 新建当地化字符串,用来记录“等”字符、“和”字符
+ %
+ \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.},
+ 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},
+}
+
+
+%=====================================================================
+% 动态数据修改
+%=====================================================================
+%
+% 各层次的数据映射和动态修改
+%
+% 原理方法:
+% 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}
+ {\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}}%
+}
+
+%=====================================================================
+%设置驱动格式
+%=====================================================================
+%
+% 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}}
+
+
+%
+% 期刊文章,连续出版物中的析出文献的格式
+%
+ \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}}
+
+
+
+%
+% 连续出版物的驱动
+%
+ \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}}
+
+%
+% 专利文献驱动
+%
+ \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}}
+
+
+%
+% 在线文献驱动
+%
+\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}}
+
+
+%
+% 报告类型驱动
+% 当有网址无出版项时,用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}}
+
+%
+% 论文、手册类型驱动
+% 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}}
+
+%
+% 备选类型驱动
+%
+% 利用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}}
+
+
+%
+% 专著中的析出文献的格式修改
+%
+\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
+ \usebibmacro{maintitle+booktitle}%
+ \setunit{\addcolon}\printfield{volume}\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}}
+
+
+%
+%针对不同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/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015mx.cbx b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015mx.cbx
new file mode 100644
index 00000000000..28682a5601c
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/biblatex-gb7714-2015/gb7714-2015mx.cbx
@@ -0,0 +1,367 @@
+%%
+%% ---------------------------------------------------------------
+%% 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/03/28 v1.0r}
+\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
+% 方法:对supercite增加[]
+\DeclareCiteCommand{\upcite}[\mkbibsuperbracket]%
+ {\usebibmacro{cite:init}%
+ \let\multicitedelim=\supercitedelim
+ \iffieldundef{prenote}
+ {}
+ {\BibliographyWarning{Ignoring prenote argument}}%
+ \iffieldundef{postnote}
+ {}
+ {\BibliographyWarning{Ignoring postnote argument}}}
+ {\usebibmacro{citeindex}%
+ \usebibmacro{cite:comp}}
+ {}
+ {\usebibmacro{cite:dump}}
+
+%
+% 重定义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}
+ {\usebibmacro{postnote}}
+
+
+%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}}
+
+
+
+
+}
+}{}{}