├── images └── fig1.png ├── appendix.tex ├── appendices └── app_1.tex ├── figures └── sample_fig.tex ├── citation.tex ├── thanks.tex ├── conclusion.tex ├── papers.bib ├── published_papers.tex ├── introduction.tex ├── table_of_contents.tex ├── abstract.tex ├── cover_english.tex ├── copyright.tex ├── cover_chinese.tex ├── README.md ├── main.tex ├── .gitignore ├── LICENSE ├── gb7714-2015.cbx └── gb7714-2015.bbx /images/fig1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GouMinghao/new_SJTU_thesis_template/HEAD/images/fig1.png -------------------------------------------------------------------------------- /appendix.tex: -------------------------------------------------------------------------------- 1 | \newpage 2 | \fancyhead[LH]{上海交通大学学位论文} 3 | \fancyhead[RH]{附录} 4 | \appendix 5 | \input{appendices/app_1.tex} 6 | 7 | -------------------------------------------------------------------------------- /appendices/app_1.tex: -------------------------------------------------------------------------------- 1 | \newpage 2 | \fancyhead[LH]{上海交通大学学位论文} 3 | \fancyhead[RH]{附录 ~\ref{subsec:appendix_1}} 4 | \section{f1}\label{subsec:appendix_1} 5 | 6 | section -------------------------------------------------------------------------------- /figures/sample_fig.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[htbp] 2 | \center{\includegraphics[width=0.9\textwidth] 3 | {images/fig1.png}} 4 | \bicaption{上海交通大学校徽}{SJTU Logo} 5 | \label{fig:sjtu} 6 | \end{figure} -------------------------------------------------------------------------------- /citation.tex: -------------------------------------------------------------------------------- 1 | \newpage 2 | \fancyhead[LH]{上海交通大学学位论文} 3 | \fancyhead[RH]{参考文献} 4 | \phantomsection 5 | \addcontentsline{toc}{section}{参考文献} 6 | \renewcommand\refname{参考文献} 7 | \printbibliography[heading=bibliography,title=参考文献] 8 | -------------------------------------------------------------------------------- /thanks.tex: -------------------------------------------------------------------------------- 1 | \newpage 2 | \fancyhead[LH]{上海交通大学学位论文} 3 | \fancyhead[RH]{致\qquad 谢} 4 | 5 | \phantomsection 6 | \addcontentsline{toc}{section}{致\qquad 谢} 7 | 8 | \section*{致\qquad 谢} 9 | 10 | \hspace{8mm} 11 | 12 | 感谢上海交通大学 -------------------------------------------------------------------------------- /conclusion.tex: -------------------------------------------------------------------------------- 1 | \newpage 2 | \fancyhead[LH]{上海交通大学学位论文} 3 | \fancyhead[RH]{~\ref{sec:conclusion}\quad 全文总结} 4 | \section{全文总结}\label{sec:conclusion} 5 | 6 | \subsection{主要结论} 7 | 8 | 本文主要解决了问题。 9 | 10 | \begin{itemize} 11 | \item 一个点 12 | \end{itemize} -------------------------------------------------------------------------------- /papers.bib: -------------------------------------------------------------------------------- 1 | @article{paper, 2 | title={title of paper}, 3 | author={firstname, lastname and firstname2, lastname 2}, 4 | journal={journal name (JN)}, 5 | volume={11}, 6 | number={22-33}, 7 | pages={4444--5555}, 8 | year={2021}, 9 | publisher={Fake Publisher China: Minhang, Shanghai} 10 | } -------------------------------------------------------------------------------- /published_papers.tex: -------------------------------------------------------------------------------- 1 | \newpage 2 | \fancyhead[LH]{上海交通大学学位论文} 3 | \fancyhead[RH]{学术论文和科研成果目录} 4 | \phantomsection 5 | \addcontentsline{toc}{section}{攻读学位期间学术论文和科研成果目录} 6 | \section*{攻读学位期间学术论文和科研成果目录} 7 | \begin{enumerate}[label = {[\textbf{\arabic*}]}] 8 | \item {One published paper} 9 | \item {Another published paper} 10 | 11 | \end{enumerate} 12 | -------------------------------------------------------------------------------- /introduction.tex: -------------------------------------------------------------------------------- 1 | \newpage 2 | \pagenumbering{arabic} 3 | \fancyhead[LH]{上海交通大学学位论文} 4 | \fancyhead[RH]{\ref{sec:introduction}\quad 绪论} 5 | \section{绪论}\label{sec:introduction} 6 | \subsection{引言} % 7 | 8 | 本文介绍了xxx。 9 | 10 | \subsection{本文研究意义}\label{subsec:introduction_meaning} 11 | refer to paper~\cite{paper}. 12 | 13 | \subsection{图片使用}\label{subsec:how_to_insert_figure} 14 | \input{figures/sample_fig.tex} 15 | 校徽如图~\ref{fig:sjtu}所示。 16 | 17 | \subsection{本章小结} 18 | 本章初步介绍了本文的主要研究问题 -------------------------------------------------------------------------------- /table_of_contents.tex: -------------------------------------------------------------------------------- 1 | \newpage 2 | \renewcommand\contentsname{\textbf{目\quad 录}} 3 | \thispagestyle{fancy} 4 | \fancyhead [RO, LE] {\normalsize{\songti 目\quad 录}} 5 | \fancyhead [LO, RE] {\normalsize{\songti 上海交通大学学位论文}} 6 | \begin{center} 7 | \tableofcontents 8 | \end{center} 9 | 10 | \begin{center} 11 | \newpage 12 | \listoffigures 13 | \newpage % 如果不需要英文可以删掉 14 | \listoffigureEng 15 | \newpage 16 | \listoftables 17 | \newpage % 如果不需要英文可以删掉 18 | \listoftableEng 19 | \end{center} -------------------------------------------------------------------------------- /abstract.tex: -------------------------------------------------------------------------------- 1 | \newpage 2 | \pagenumbering{Roman} 3 | \fancyhead[LH]{上海交通大学学位论文} 4 | \fancyhead[RH]{摘\quad 要} 5 | 6 | \phantomsection 7 | \addcontentsline{toc}{section}{摘\quad 要} 8 | 9 | \section*{摘\quad 要} 10 | %摘要:二字间空一格,黑体16磅加粗居中,单倍行距,段前24磅,段后18磅。 11 | 12 | \hspace{8mm}摘要\\ 13 | ~\\ 14 | \textbf{关键词}:关键词1\\ 15 | %关键字:宋体12磅,行距20磅,段前段后0磅,关键字之间用逗号隔开,关键词三个字加粗。 16 | 17 | 18 | \newpage 19 | \phantomsection 20 | \addcontentsline{toc}{section}{ABSTRACT} 21 | \section*{ABSTRACT} 22 | %ABSTRCT:Arial 16磅加粗居中,单倍行距,段前24磅,段后18磅 23 | 24 | \hspace{8mm}abstract. 25 | \\ 26 | %英文摘要内容:Times New Roman 12磅,行距20磅段前段后0磅 27 | ~\\ 28 | \textbf{Key words}: k1 29 | %Keywords:Times New Roman 12磅,行距20磅, “key words” 两词加粗 -------------------------------------------------------------------------------- /cover_english.tex: -------------------------------------------------------------------------------- 1 | \newpage 2 | \thispagestyle{empty} 3 | ~\\ 4 | \begin{center} 5 | \zihao{4} 6 | \textbf{ 7 | A Dissertation Submitted to \\ 8 | Shanghai Jiao Tong University for Master Degree} 9 | \end{center} 10 | ~\\ 11 | \begin{center} 12 | \zihao{-2}\textbf{Title tile 13 | } 14 | \end{center} 15 | %英文论文标题:大写,Times New Roman,加粗,14 points,居中 16 | ~\\ 17 | ~\\ 18 | ~\\ 19 | \ifx\isblindreview\istrue 20 | \begin{center} 21 | \zihao{3} 22 | Author: \\ %盲审稿使用,此处不填写 23 | Supervisor: 24 | \end{center} 25 | \else 26 | \begin{center} 27 | \zihao{3} 28 | Author: name\\ 29 | Supervisor: teacher 30 | \end{center} 31 | \fi 32 | ~\\ 33 | ~\\ 34 | ~\\ 35 | \begin{center} 36 | \zihao{3} 37 | School of xxx\\ 38 | Shanghai Jiao Tong University \\ 39 | Shanghai, P.R.China \\ 40 | \end{center} 41 | -------------------------------------------------------------------------------- /copyright.tex: -------------------------------------------------------------------------------- 1 | \newpage 2 | \thispagestyle{empty} 3 | \begin{center} 4 | \heiti \zihao{3}\textbf{ 5 | 上海交通大学\\ 6 | 学位论文原创性声明} 7 | \end{center} 8 | 9 | \zihao{-4} 10 | 本人郑重声明:所呈交的学位论文,是本人在导师的指导下,独立进行研究工作所取得的成果。除文中已经注明引用的内容外,本论文不包含任何其他个人或集体已经发表或撰写过的作品成果。对本文的研究做出重要贡献的个人和集体,均已在文中以明确方式标明。本人完全知晓本声明的法律后果由本人承担。 11 | 12 | \begin{flushright} 13 | \begin{tabular}{l} 14 | \zihao{4} 15 | 学位论文作者签名:\hspace{20mm}\qquad\\ 16 | \zihao{4} 17 | 日期:\qquad 年\qquad 月\qquad 日 18 | \end{tabular} 19 | \end{flushright} 20 | 21 | ~\\ 22 | \begin{center} 23 | \heiti \zihao{3}\textbf{ 24 | 上海交通大学\\ 25 | 学位论文使用授权书} 26 | \end{center} 27 | 28 | 本人同意学校保留并向国家有关部门或机构送交论文的复印件和电子版,允许论文被查阅和借阅。\\ 29 | 本学位论文属于 :\par 30 | □公开论文\par 31 | □内部论文,保密□1年/□2年/□3年,过保密期后适用本授权书。\par 32 | □秘密论文,保密\_\_\_年(不超过10年),过保密期后适用本授权书。\par 33 | □机密论文,保密\_\_\_年(不超过20年),过保密期后适用本授权书。\par 34 | (请在以上方框内选择打“√”)\\ 35 | 36 | \begin{flushright} 37 | \zihao{4} 38 | \begin{tabular}{l l} 39 | 学位论文作者签名:\hspace{10mm}\qquad \hspace{100mm}&指导教师签名:\qquad\\ 40 | 日期:\qquad 年\qquad 月\qquad 日 &日期:\qquad 年\qquad 月\qquad 日\\ 41 | \end{tabular} 42 | \end{flushright} -------------------------------------------------------------------------------- /cover_chinese.tex: -------------------------------------------------------------------------------- 1 | 2 | \thispagestyle{empty} 3 | 4 | \renewcommand{\headrulewidth}{0pt} 5 | \begin{figure}[htb] 6 | \center{\includegraphics[width=5cm] {images/fig1.png}} 7 | \end{figure} 8 | 9 | \begin{center} 10 | \songti \zihao{-2} 上海交通大学学位论文 11 | \end{center} 12 | %该页为中文扉页。无需页眉页脚,纸质论文应装订在右侧 13 | ~\\ 14 | \begin{center} 15 | \songti \zihao{2} \textbf{标题} 16 | \end{center} 17 | %中文论文标题,1行或2行,宋体,加粗,二号,居中。论文题目不得超过36个汉字 18 | ~\\ 19 | ~\\ 20 | ~\\ 21 | ~\\ 22 | \ifx\isblindreview\istrue 23 | \begin{center} %盲审稿使用,此处不填写 24 | \heiti \zihao{4} 25 | \begin{tabular}{l} 26 | \textbf{姓\quad 名:}\\ 27 | \textbf{学\quad 号:}\\ 28 | \textbf{导\quad 师:}\\ 29 | \textbf{学\quad 院: xx学院}\\ 30 | \textbf{学科/专业名称:xx技术}\\ 31 | \textbf{申请学位层次:x士}\\ 32 | \end{tabular} 33 | \end{center} 34 | \else 35 | \begin{center} 36 | \heiti \zihao{4} 37 | \begin{tabular}{l} 38 | \textbf{姓\quad 名:名字}\\ 39 | \textbf{学\quad 号:111122223333}\\ 40 | \textbf{导\quad 师:老板}\\ 41 | \textbf{学\quad 院: xx学院}\\ 42 | \textbf{学科/专业名称:xx技术}\\ 43 | \textbf{申请学位层次:x士}\\ 44 | \end{tabular} 45 | \end{center} 46 | \fi 47 | ~\\ 48 | \begin{center} 49 | \ifx\isblindreview\istrue 50 | \else 51 | \songti \zihao{4} \textbf{2022年3月} 52 | \fi 53 | \end{center} -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 上海交通大学研究生毕业论文LaTex模板 2 | 上海交通大学研究生院今年发布了官方[LaTex模板](https://www.gs.sjtu.edu.cn/info/1136/8374.htm)。但是此模板显然存在一些问题,也存在一些使用不太方便的地方,在此处进行了修改与调整。 3 | 4 | ## 使用方法 5 | ### 本地编译 6 | 1. 无论你使用的是什么操作系统,在使用前需要确保已经完成了[texlive](https://tug.org/texlive/)的安装。本项目只支持使用XeLaTex进行编译。 7 | 8 | 9 | 2. 克隆或者直接[下载](https://github.com/GouMinghao/new_SJTU_thesis_template/releases/download/v1.1.0/v1.1.0.zip)本项目 10 | ```bash 11 | git clone https://github.com/GouMinghao/new_SJTU_thesis_template.git 12 | ``` 13 | 14 | 3. 运行`build.sh` 或者`build.bat`来完成编译。 15 | 16 | ### 使用Overleaf 17 | 1. 下载本模板的[zip包](https://github.com/GouMinghao/new_SJTU_thesis_template/releases/download/v1.1.0/v1.1.0.zip),或者克隆过后自行压缩打包。 18 | 2. 上传至[Overleaf](https://latex.sjtu.edu.cn/)。 19 | 3. 选择编译器为`XeLaTex`即可完成编译。 20 | 21 | ## 与官方模板相比的修改 22 | 23 | ### BUG修复 24 | 1. 修复了官方模板中表格使用了图片计数器导致表格编号不正确的问题。 25 | 2. 修复了使用LaTex编译时`\quad`后面不加空格导致编译报错的问题。 26 | 3. 修复了使用`section*`部分时,生成超链接位置不对的问题。 27 | 4. 修复了使用XeLaTex编译时英文字体不是`Times New Roman`的问题。 28 | 29 | ### 改进 30 | 1. 添加了对`.bib`文件进行引用的支持。 31 | 2. 优化了`main.tex`的结构,将文件进行分离,避免在一个文件中写太多代码。 32 | 3. 将章节号改为使用引用的方式,避免硬编码章节号。 33 | 4. 优化了附录的格式,放弃了`section*`的方式,避免无法引用附录中的章节。 34 | 5. 添加了图片与表格的索引并引入了中英文图表标题。 35 | 6. 添加了盲审稿模式,如果需要生成盲审稿,只需要将[main.tex](main.tex#L84)中84行的`false`改成`true`即可。 36 | 37 | ## 感谢 38 | 1. 感谢sjtug提供的[非官方模板](https://github.com/sjtug/SJTUThesis)以及递归感谢。 39 | 40 | ## 软件许可证 41 | 1. 本repo绝大部分代码来自于上海交通大学[官方模板](https://www.gs.sjtu.edu.cn/info/1136/8374.htm),校徽等版权归上海交通大学所有。 42 | 2. `biblatex-gb7714-2015`样式文件使用[`LPPL`](https://www.latex-project.org/lppl.txt)许可证。 43 | 3. 其余部分使用[Apache License 2.0](./LICENSE)许可证 -------------------------------------------------------------------------------- /main.tex: -------------------------------------------------------------------------------- 1 | \documentclass[UTF8,a4paper,12pt]{ctexart} 2 | \usepackage{ctex} 3 | \usepackage{amsmath} 4 | \numberwithin{equation}{section} 5 | \allowdisplaybreaks[4] %多行公式中换页 6 | \usepackage{array} 7 | \usepackage[font=small,font=bf,labelsep=quad]{caption} 8 | \usepackage{amssymb} 9 | \usepackage{tikz} 10 | \usepackage{amsthm} 11 | \usepackage{mathrsfs} 12 | \usepackage{enumitem} 13 | \usepackage{dutchcal} 14 | \usepackage{multirow} 15 | \usepackage{color} 16 | \usepackage{titletoc} 17 | \usepackage{graphicx} %插入图片 18 | \usepackage{times} 19 | \usepackage{mathptmx} 20 | \usepackage{fancyhdr} %页眉页脚 21 | 22 | 23 | \usepackage{bicaption} 24 | 25 | % \captionsetup{labelfont=bf} %表格表号与表题加粗 26 | \captionsetup[figure][bi-first]{name=图} 27 | \captionsetup[figure][bi-second]{name=Figure} 28 | \captionsetup[bi-first]{labelfont={bf}, textfont={normalfont, it}} 29 | \captionsetup[bi-second]{labelfont={bf}, textfont={normalfont, it}} 30 | \captionsetup[table][bi-first]{name=表} 31 | \captionsetup[table][bi-second]{name=Table} 32 | 33 | % Use the bicaption package with list type "figureEng" for the 2nd language 34 | \captionsetup[bi-second]{listtype+=Eng} 35 | % Define type "figureEng" and \listoffigureEng 36 | \usepackage{newfloat} 37 | \renewcommand{\listfigurename}{本文插图索引} 38 | \renewcommand{\listtablename}{本文表格索引} 39 | 40 | \DeclareFloatingEnvironment[fileext=lof2]{figureEng}[Figure][List of Figures] 41 | \DeclareFloatingEnvironment[fileext=lof3]{tableEng}[Table][List of Tables] 42 | 43 | % \usepackage[figuresleft]{rotating} 44 | \DeclareMathOperator*{\argmax}{argmax} 45 | \DeclareMathOperator*{\argmin}{argmin} 46 | \pagestyle{fancy} 47 | \fancyhf{} 48 | \fancyfoot[C]{\thepage} 49 | \usepackage{setspace} 50 | \setlength{\baselineskip}{20pt} 51 | \newcommand*{\circled}[1]{\lower.7ex\hbox{\tikz\draw (0pt, 0pt)% 52 | circle (.5em) node {\makebox[1em][c]{\small #1}};}} 53 | \usepackage{hyperref} %目录 54 | \hypersetup{colorlinks=true,linkcolor=black} 55 | \renewcommand {\thefigure} {\thesection{}-\arabic{figure}}%设定图片的编号。这样设置的实现效果为图1-1 56 | \renewcommand {\thetable} {\thesection{}-\arabic{table}} 57 | 58 | \usepackage{appendix} 59 | \usepackage{tocloft} 60 | \renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}} %为目录中section补上引导点 61 | \usepackage{titletoc} 62 | \titlecontents{section}[0pt]{\addvspace{6pt}\filright\bf}% 63 | {\contentspush{\thecontentslabel \quad}}% 64 | {}{\titlerule*[8pt]{.}\contentspage} 65 | \makeatletter %双线页眉 66 | \def\headrule{{\if@fancyplain\let\headrulewidth\plainheadrulewidth\fi% 67 | \hrule\@height 1.5pt \@width\headwidth\vskip1.5pt%上面线为1pt粗 68 | \hrule\@height 0.5pt\@width\headwidth %下面0.5pt粗 69 | \vskip-2\headrulewidth\vskip-1pt} %两条线的距离1pt 70 | \vspace{6mm}} %双线与下面正文之间的垂直间距 71 | \makeatother 72 | \setmainfont{Times New Roman} 73 | \CTEXsetup[format={\heiti \zihao{3} \bfseries \center}]{section} 74 | \CTEXsetup[number={第\chinese{section}章}]{section} 75 | \usepackage[explicit]{titlesec} 76 | \titlespacing*{\section}{0pt}{24pt plus .24pt minus .24pt}{18pt plus .0ex} 77 | 78 | \usepackage[backend=biber,style=gb7714-2015]{biblatex} 79 | \addbibresource[location=local]{papers.bib} 80 | 81 | 82 | \def\istrue{true} 83 | %%%%%%%%%%%%%%%% 84 | \def\isblindreview{false} % modify to {true} if it is the blind review version 85 | %%%%%%%%%%%%%%%% 86 | 87 | \begin{document} 88 | \include{cover_chinese} 89 | \include{cover_english} 90 | \ifx\isblindreview\istrue 91 | \else 92 | \include{copyright} 93 | \fi 94 | \include{abstract} 95 | \include{table_of_contents} 96 | \include{introduction} 97 | \include{conclusion} 98 | \include{citation} 99 | \include{appendix} 100 | \ifx\isblindreview\istrue 101 | \else 102 | \include{published_papers} 103 | \include{thanks} 104 | \fi 105 | \end{document} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | main.pdf 2 | 3 | ## Core latex/pdflatex auxiliary files: 4 | *.aux 5 | *.lof 6 | *.lof2 7 | *.lof3 8 | *.log 9 | *.lot 10 | *.fls 11 | *.out 12 | *.toc 13 | *.fmt 14 | *.fot 15 | *.cb 16 | *.cb2 17 | .*.lb 18 | 19 | ## Intermediate documents: 20 | *.dvi 21 | *.xdv 22 | *-converted-to.* 23 | # these rules might exclude image files for figures etc. 24 | # *.ps 25 | # *.eps 26 | # *.pdf 27 | 28 | ## Generated if empty string is given at "Please type another file name for output:" 29 | .pdf 30 | 31 | ## Bibliography auxiliary files (bibtex/biblatex/biber): 32 | *.bbl 33 | *.bcf 34 | *.blg 35 | *-blx.aux 36 | *-blx.bib 37 | *.run.xml 38 | 39 | ## Build tool auxiliary files: 40 | *.fdb_latexmk 41 | *.synctex 42 | *.synctex(busy) 43 | *.synctex.gz 44 | *.synctex.gz(busy) 45 | *.pdfsync 46 | 47 | ## Build tool directories for auxiliary files 48 | # latexrun 49 | latex.out/ 50 | 51 | ## Auxiliary and intermediate files from other packages: 52 | # algorithms 53 | *.alg 54 | *.loa 55 | 56 | # achemso 57 | acs-*.bib 58 | 59 | # amsthm 60 | *.thm 61 | 62 | # beamer 63 | *.nav 64 | *.pre 65 | *.snm 66 | *.vrb 67 | 68 | # changes 69 | *.soc 70 | 71 | # comment 72 | *.cut 73 | 74 | # cprotect 75 | *.cpt 76 | 77 | # elsarticle (documentclass of Elsevier journals) 78 | *.spl 79 | 80 | # endnotes 81 | *.ent 82 | 83 | # fixme 84 | *.lox 85 | 86 | # feynmf/feynmp 87 | *.mf 88 | *.mp 89 | *.t[1-9] 90 | *.t[1-9][0-9] 91 | *.tfm 92 | 93 | #(r)(e)ledmac/(r)(e)ledpar 94 | *.end 95 | *.?end 96 | *.[1-9] 97 | *.[1-9][0-9] 98 | *.[1-9][0-9][0-9] 99 | *.[1-9]R 100 | *.[1-9][0-9]R 101 | *.[1-9][0-9][0-9]R 102 | *.eledsec[1-9] 103 | *.eledsec[1-9]R 104 | *.eledsec[1-9][0-9] 105 | *.eledsec[1-9][0-9]R 106 | *.eledsec[1-9][0-9][0-9] 107 | *.eledsec[1-9][0-9][0-9]R 108 | 109 | # glossaries 110 | *.acn 111 | *.acr 112 | *.glg 113 | *.glo 114 | *.gls 115 | *.glsdefs 116 | *.lzo 117 | *.lzs 118 | 119 | # uncomment this for glossaries-extra (will ignore makeindex's style files!) 120 | # *.ist 121 | 122 | # gnuplottex 123 | *-gnuplottex-* 124 | 125 | # gregoriotex 126 | *.gaux 127 | *.gtex 128 | 129 | # htlatex 130 | *.4ct 131 | *.4tc 132 | *.idv 133 | *.lg 134 | *.trc 135 | *.xref 136 | 137 | # hyperref 138 | *.brf 139 | 140 | # knitr 141 | *-concordance.tex 142 | # TODO Comment the next line if you want to keep your tikz graphics files 143 | *.tikz 144 | *-tikzDictionary 145 | 146 | # listings 147 | *.lol 148 | 149 | # luatexja-ruby 150 | *.ltjruby 151 | 152 | # makeidx 153 | *.idx 154 | *.ilg 155 | *.ind 156 | 157 | # minitoc 158 | *.maf 159 | *.mlf 160 | *.mlt 161 | *.mtc[0-9]* 162 | *.slf[0-9]* 163 | *.slt[0-9]* 164 | *.stc[0-9]* 165 | 166 | # minted 167 | _minted* 168 | *.pyg 169 | 170 | # morewrites 171 | *.mw 172 | 173 | # nomencl 174 | *.nlg 175 | *.nlo 176 | *.nls 177 | 178 | # pax 179 | *.pax 180 | 181 | # pdfpcnotes 182 | *.pdfpc 183 | 184 | # sagetex 185 | *.sagetex.sage 186 | *.sagetex.py 187 | *.sagetex.scmd 188 | 189 | # scrwfile 190 | *.wrt 191 | 192 | # sympy 193 | *.sout 194 | *.sympy 195 | sympy-plots-for-*.tex/ 196 | 197 | # pdfcomment 198 | *.upa 199 | *.upb 200 | 201 | # pythontex 202 | *.pytxcode 203 | pythontex-files-*/ 204 | 205 | # tcolorbox 206 | *.listing 207 | 208 | # thmtools 209 | *.loe 210 | 211 | # TikZ & PGF 212 | *.dpth 213 | *.md5 214 | *.auxlock 215 | 216 | # todonotes 217 | *.tdo 218 | 219 | # vhistory 220 | *.hst 221 | *.ver 222 | 223 | # easy-todo 224 | *.lod 225 | 226 | # xcolor 227 | *.xcp 228 | 229 | # xmpincl 230 | *.xmpi 231 | 232 | # xindy 233 | *.xdy 234 | 235 | # xypic precompiled matrices and outlines 236 | *.xyc 237 | *.xyd 238 | 239 | # endfloat 240 | *.ttt 241 | *.fff 242 | 243 | # Latexian 244 | TSWLatexianTemp* 245 | 246 | ## Editors: 247 | # WinEdt 248 | *.bak 249 | *.sav 250 | 251 | # Texpad 252 | .texpadtmp 253 | 254 | # LyX 255 | *.lyx~ 256 | 257 | # Kile 258 | *.backup 259 | 260 | # gummi 261 | .*.swp 262 | 263 | # KBibTeX 264 | *~[0-9]* 265 | 266 | # TeXnicCenter 267 | *.tps 268 | 269 | # auto folder when using emacs and auctex 270 | ./auto/* 271 | *.el 272 | 273 | # expex forward references with \gathertags 274 | *-tags.tex 275 | 276 | # standalone packages 277 | *.sta 278 | 279 | # Makeindex log files 280 | *.lpz 281 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [2021] [Minghao Gou] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. -------------------------------------------------------------------------------- /gb7714-2015.cbx: -------------------------------------------------------------------------------- 1 | %% 2 | %% --------------------------------------------------------------- 3 | %% biblatex-gb7714-2015 --- A biblatex implementation of the 4 | %% GBT7714-2015 citation style,numerical sequence 5 | %% Maintained by huzhenzhen 6 | %% E-mail: hzzmail@163.com 7 | %% Released under the LaTeX Project Public License v1.3c or later 8 | %% --------------------------------------------------------------- 9 | %% 10 | \ProvidesFile{gb7714-2015.cbx}[a biblatex citation style for GB/T 7714-2015] 11 | 12 | % 13 | % 加载标准样式 14 | % 15 | \RequireCitationStyle{numeric-comp} %numeric 16 | 17 | % 18 | % 增加一个控制是否将标准标签中的作者加上超链接的选项 19 | % 20210121,v1.0w,hzz 20 | \newtoggle{bbx:gblabelref} 21 | \DeclareBibliographyOption{gblabelref}[false]{%biblatex低版本 22 | \settoggle{bbx:gblabelref}{#1}} 23 | \ExecuteBibliographyOptions{gblabelref} 24 | 25 | % 26 | % 增加标签包围符号格式处理选项 27 | % 20211030,1.1a,hzz 28 | % 29 | \newrobustcmd{\mkbibleftborder}{[} 30 | \newrobustcmd{\mkbibrightborder}{]} 31 | \DeclareBibliographyOption[string]{gbcitelabel}[bracket]{% 32 | \csuse{gbcitelabelopt@#1} 33 | } 34 | \ExecuteBibliographyOptions{gbcitelabel} 35 | 36 | \renewrobustcmd{\mkbibsuperscript}[1]{% 37 | \unspace\allowhyphens\textsuperscript{% 38 | \begingroup 39 | \protected\long\def\mkbibsuperscript##1{% 40 | \blx@warning{Nested superscript}% 41 | \mkbibbrackets{##1}}%嵌套的这里没有动 42 | #1\endgroup}\kern\z@}% 43 | 44 | \def\gbcitelabelopt@bracket{% 45 | \renewrobustcmd{\mkbibleftborder}{[}% 46 | \renewrobustcmd{\mkbibrightborder}{]}% 47 | } 48 | \def\gbcitelabelopt@parens{% 49 | \renewrobustcmd{\mkbibleftborder}{(}% 50 | \renewrobustcmd{\mkbibrightborder}{)}% 51 | } 52 | \def\gbcitelabelopt@dot{% 53 | \renewrobustcmd{\mkbibleftborder}{}% 54 | \renewrobustcmd{\mkbibrightborder}{.}% 55 | } 56 | \def\gbcitelabelopt@plain{% 57 | \renewrobustcmd{\mkbibleftborder}{}% 58 | \renewrobustcmd{\mkbibrightborder}{}% 59 | } 60 | \def\gbcitelabelopt@box{% 61 | \renewrobustcmd{\mkbibleftborder}{}% 62 | \renewrobustcmd{\mkbibrightborder}{}% 63 | \renewrobustcmd{\mkbibsuperscript}[1]{% 64 | \unspace\allowhyphens\textsuperscript{% 65 | \begingroup 66 | \framebox{##1}\endgroup}\kern\z@}% 67 | } 68 | \def\gbcitelabelopt@circle{% 69 | \renewrobustcmd{\mkbibleftborder}{}% 70 | \renewrobustcmd{\mkbibrightborder}{}% 71 | \renewrobustcmd{\mkbibsuperscript}[1]{% 72 | \unspace\allowhyphens\textsuperscript{% 73 | \begingroup 74 | \textcircled{##1}\endgroup}\kern\z@}% 75 | } 76 | 77 | 78 | % 79 | % 选项设置 80 | % 81 | \ExecuteBibliographyOptions{ 82 | autocite = superscript , 83 | autopunct = true , 84 | %sorting = none , 85 | maxcitenames=1, 86 | mincitenames=1, 87 | } 88 | 89 | % 90 | % 修订使可用选项gblabelref来控制是否将标准标签中的作者加上超链接 91 | % 20210121,v1.0w,hzz 92 | % 93 | \iftoggle{iftlatest}% 94 | {\renewbibmacro*{textcite}{% 95 | \iffieldequals{namehash}{\cbx@lasthash} 96 | {\usebibmacro{cite:comp}} 97 | {\usebibmacro{cite:dump}% 98 | \ifbool{cbx:parens} 99 | {\printtext{\bibclosebracket}\global\boolfalse{cbx:parens}} 100 | {}% 101 | \iffirstcitekey 102 | {} 103 | {\setunit{\textcitedelim}}% 104 | \usebibmacro{cite:init}% 105 | \ifnameundef{labelname} 106 | {\printfield[citetitle]{labeltitle}} 107 | {\iftoggle{bbx:gblabelref}{\printtext[bibhyperref]{\printnames{labelname}}}{\printnames{labelname}}}% 108 | \setunit*{\printdelim{namelabeldelim}}% 109 | \printtext{\bibopenbracket}\global\booltrue{cbx:parens}% 110 | \ifnumequal{\value{citecount}}{1} 111 | {\usebibmacro{prenote}} 112 | {}% 113 | \usebibmacro{cite:comp}% 114 | \stepcounter{textcitecount}% 115 | \savefield{namehash}{\cbx@lasthash}}}% 116 | } 117 | 118 | 119 | % 120 | %设置标注中各篇文献之间的标点 121 | %20210530,v1.0y,hzz 122 | %textcite标注命令中的标点设置 123 | %\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}% 124 | \renewcommand*{\compcitedelim}{\addcomma}%\addcomma\addthinspace 125 | \renewcommand*{\supercitedelim}{\addcomma} 126 | \renewcommand*{\multicitedelim}{\addcomma} 127 | 128 | % 129 | %将连续3篇文献压缩改为连续2篇文献压缩 130 | % 131 | %该宏的目的是抛弃压缩内部的编号,而仅输出最后一个编号,主要通过cbx@tempcnta来控制 132 | %一般情况下cbx@tempcnta为0,所以该宏不输出任何内容。当cbx@tempcnta在cite:comp:comp宏中更改变大后 133 | %说明开始进入需要压缩的范围,当到压缩终点时,cbx@tempcnta必然大于1,则输出内容。 134 | %修改第二行的数字1为0即可将默认的3个开始压缩变为2个开始压缩。 135 | \renewbibmacro*{cite:dump}{% 136 | \ifnumgreater{\value{cbx@tempcnta}}{0}% 137 | {\ifnumgreater{\value{cbx@tempcnta}}{0}%1改为0,可以将压缩起始3个编号改为2个编号 138 | {\bibrangedash}% 139 | {\multicitedelim}% 140 | \bibhyperref[\cbx@lastkey]{% 141 | \ifdef\cbx@lastprefix% 142 | {\printtext[labelprefix]{\cbx@lastprefix}}% 143 | {}% 144 | \printtext[labelnumber]{\cbx@lastnumber}}}% 145 | {}% 146 | \setcounter{cbx@tempcnta}{0}% 147 | \global\undef\cbx@lastprefix} 148 | 149 | %biblatex v3.15 增加了一堆标点命令如\multiciterangedelim 150 | %为方便用户定义,在新的版本中使用新的{cite:dump},尽管前面的定义也没有问题 151 | %前面的定义是适用于biblatex v2.8以后的版本的,从16年到20年都没动过 152 | %而且也适用于最新的版本,biblatex本身兼容性做的也还是不错的。 153 | \@ifpackagelater{biblatex}{2020/08/15}{%v3.15 2020-08-16 154 | \renewbibmacro*{cite:dump}{% 155 | \usebibmacro{cite:dump:inset}% 156 | % dump labelnumber (+labelprefix) 157 | \ifnumgreater{\value{cbx@tempcnta}}{0} 158 | {\ifnumgreater{\value{cbx@tempcnta}}{0}%1改为0,可以将压缩起始3个编号改为2个编号 159 | {\setunit{\multiciterangedelim}} 160 | {\setunit{\multicitedelim}}% 161 | \usebibmacro{cite:print:last:labelnumber}% 162 | \global\undef\cbx@lastprefix} 163 | {}% 164 | \setcounter{cbx@tempcnta}{0}% 165 | }% 166 | }{} 167 | 168 | % 169 | % 定义一个上标方括号wrapper 170 | % 171 | \newcommand*\mkbibsuperbracket[1]{% 172 | \mkbibsuperscript{\mkbibbrackets{#1}}% 173 | } 174 | 175 | % 修改postnote的输出格式 176 | \DeclareFieldFormat{postnote}{#1} 177 | 178 | 179 | %修改\mkbibsuperscript宏在最后加上一个空白使得xeCJK不会自动在引用标签后面加上中英文之间的空白 180 | %20210401,v1.0w,hzz 181 | %20211030,v1.1a,hzz,调整到选项中去 182 | %\renewrobustcmd{\mkbibsuperscript}[1]{% 183 | % \unspace\allowhyphens\textsuperscript{% 184 | % \begingroup 185 | % \protected\long\def\mkbibsuperscript##1{% 186 | % \blx@warning{Nested superscript}% 187 | % \mkbibbrackets{##1}}% 188 | % #1\endgroup}\kern\z@} 189 | 190 | \newrobustcmd{\mkbibsuperscriptusp}[1]{% 191 | \unspace\allowhyphens\textsuperscript{% 192 | \begingroup 193 | \protected\long\def\mkbibsuperscriptusp##1{% 194 | \blx@warning{Nested superscript}% 195 | \mkbibbrackets{##1}}% 196 | #1\endgroup}} 197 | 198 | 199 | 200 | % 201 | % 重定义cite命令 202 | % 203 | % 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode} 204 | % v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式 205 | \DeclareCiteCommand{\cite}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号 \textsuperscript 206 | {\mkbibleftborder\usebibmacro{cite:init}% 207 | \usebibmacro{prenote}} 208 | {\usebibmacro{citeindex}% 209 | \usebibmacro{cite:comp}} 210 | {} 211 | {\usebibmacro{cite:dump}\mkbibrightborder% 212 | \printfield{postnote}}%\kern\p@ \kern\z@ 213 | 214 | %\renewcommand{\cite}[1]{\textsuperscript{[\supercite{#1}]}\kern\z@} 215 | % v1.0p 以前用的方式 216 | %\DeclareCiteCommand{\cite}[\mkbibsuperbracket]%利用mkbibsuperbracket添加方括号 217 | % {\usebibmacro{cite:init}% 218 | % \usebibmacro{prenote}} 219 | % {\usebibmacro{citeindex}% 220 | % \usebibmacro{cite:comp}} 221 | % {} 222 | % {\usebibmacro{cite:dump}% 223 | % \usebibmacro{postnote}} 224 | 225 | % 226 | % 定义upcite命令 227 | % 20180604,v1.0l,hzz 228 | % 20190409,v1.0r,hzz 229 | % 方法:对supercite增加[] 230 | \newrobustcmd*{\upcite}{% 231 | \cite} 232 | 233 | % 234 | % 重定义parencite命令,以满足标签带页码的国标要求 235 | % 236 | \DeclareCiteCommand{\parencite}%[\mkbibbrackets] 237 | {\mkbibleftborder\usebibmacro{cite:init}% 238 | \usebibmacro{prenote}}% 239 | {\usebibmacro{citeindex}% 240 | \usebibmacro{cite:comp}} 241 | {} 242 | {%[ 243 | \usebibmacro{cite:dump}\mkbibrightborder% 244 | \mkbibsuperscriptusp{\printfield{postnote}}} 245 | 246 | % 247 | % 新定义pagescite命令,以满足标签带页码的国标要求 248 | % 249 | % 原理方法: 250 | % 1.新增页码输出宏 251 | \newbibmacro*{postpages}{% 252 | \iffieldundef{postnote} 253 | {\printfield[postnote]{pages}} 254 | {\printfield{postnote}}} 255 | % 2.新增\pagescite引用命令 256 | \DeclareCiteCommand{\pagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 257 | {\mkbibleftborder\usebibmacro{cite:init}%]直接添加方括号 258 | \usebibmacro{prenote}% 259 | } 260 | {\usebibmacro{citeindex}% 261 | \usebibmacro{cite:comp}} 262 | {} 263 | {\usebibmacro{cite:dump}\mkbibrightborder% 264 | \usebibmacro{postpages}} 265 | 266 | % 267 | % 定义yearpagescite,为与ay样式兼容,等同于\pagescite 268 | % 269 | \DeclareCiteCommand{\yearpagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 270 | {\mkbibleftborder\usebibmacro{cite:init}%直接添加方括号 271 | \usebibmacro{prenote}% 272 | } 273 | {\usebibmacro{citeindex}% 274 | \usebibmacro{cite:comp}} 275 | {} 276 | {\usebibmacro{cite:dump}\mkbibrightborder% 277 | \usebibmacro{postpages}} 278 | 279 | % 280 | % 定义\yearcite命令,为与ay样式兼容,且提供不输出页码的标签格式, 281 | % 282 | % 原理方法:等同于\pagescite,但不要页码 283 | \DeclareCiteCommand{\yearcite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 284 | {\mkbibleftborder\usebibmacro{cite:init}%直接添加方括号 285 | \usebibmacro{prenote}% 286 | } 287 | {\usebibmacro{citeindex}% 288 | \usebibmacro{cite:comp}} 289 | {} 290 | {\usebibmacro{cite:dump}\mkbibrightborder} 291 | 292 | 293 | % 294 | % 定义\authornumcite命令,输出作者信息,然后在后面带上顺序编码 295 | % 20180427,v1.0k,增加,hzz 296 | % gb7714样式新定义的命令都把cite放到最后,比如前面的pagescite,yearcite,这里的\authornumcite 297 | % 区别于biblatex定义的命令都把cite放到前面,比如citeauthor等。见numeric.CBX 298 | % 20200121,v1.0w,增加超链接,hzz 299 | \newbibmacro*{citeathn}{% 300 | \printtext[bibhyperref]{% 301 | \printfield{labelprefix}% 302 | \printfield{labelnumber}% 303 | \ifbool{bbx:subentry} 304 | {\printfield{entrysetcount}} 305 | {}}} 306 | %见numeric.CBX,\DeclareCiteCommand{\cite}, 307 | \DeclareCiteCommand{\authornumcite}%[\mkbibsuperscript] 308 | {\usebibmacro{prenote}} 309 | {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace 310 | {\renewcommand*{\andothersdelim}{\addspace}}% 311 | \iftoggle{bbx:gblabelref}{\printtext[bibhyperref]{\printnames{labelname}}}{\printnames{labelname}}% 312 | \mkbibsuperscript{\mkbibleftborder\usebibmacro{citeindex}% 313 | \usebibmacro{citeathn}\mkbibrightborder}} 314 | {\multicitedelim} 315 | {\mkbibsuperscript{\printfield{postnote}}} 316 | 317 | 318 | % 319 | % 增加如下多个命令 320 | % 20190409,v1.0r,hzz 321 | % 方法:利用newcommand或newrobustcmd命令进行定义 322 | % 注意\citet和\citep命令之所以不用newrobustcmd,是为避免加载natbib模块后产生冲突 323 | %\DeclareCiteCommand{\citet}% 324 | % {\usebibmacro{prenote}} 325 | % {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace 326 | % {\renewcommand*{\andothersdelim}{\addspace}}% 327 | % \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}% 328 | % \usebibmacro{citeathn}}}} 329 | % {\multicitedelim} 330 | % {\mkbibsuperscript{\printfield{postnote}}} 331 | 332 | % 333 | % 重定义citet,因为前面与\authornumcite同定义的命令无法正确处理多个bibtexkey同时给出的压缩情况 334 | % 20200721,v1.0v,hzz 335 | % 方法:利用textcite命令进行定义 336 | % 基本利用textcite命令来写citet,仅利用bool{cbx:incitet}做判断,进而处理不同的上标和页码形式 337 | % 20210416,v1.0y,hzz:将namelabeldelim标点注释掉了,因为中文环境下不需要, 338 | % 若有需要可以用context sensitive的形式做定义 339 | \newbool{cbx:incitet} 340 | \global\booltrue{cbx:incitet} 341 | 342 | \newbibmacro*{citet}{% 343 | \iffieldequals{namehash}{\cbx@lasthash}% 344 | {\usebibmacro{cite:comp}}% 345 | {\usebibmacro{cite:dump}% 346 | \ifbool{cbx:parens}% 347 | {\mkbibsuperscript{\printtext{\bibclosebracket}}\global\boolfalse{cbx:parens}}% 348 | {}% 349 | \iffirstcitekey 350 | {} 351 | {\textcitedelim}% 352 | \usebibmacro{cite:init}% 353 | \ifnameundef{labelname} 354 | {\printfield[citetitle]{labeltitle}} 355 | {\printnames{labelname}}% 356 | %\setunit*{\printdelim{namelabeldelim}}% 357 | \mkbibsuperscript{\printtext{\bibopenbracket}\global\booltrue{cbx:parens}% 358 | \ifnumequal{\value{citecount}}{1} 359 | {\usebibmacro{prenote}}% 360 | {}% 361 | \usebibmacro{cite:comp}% 362 | \stepcounter{textcitecount}% 363 | \savefield{namehash}{\cbx@lasthash}}}} 364 | 365 | \DeclareCiteCommand{\cbx@textcite}% 366 | {\usebibmacro{cite:init}}% 367 | {\usebibmacro{citeindex}% 368 | \ifbool{cbx:incitet}{\usebibmacro{citet}}{\usebibmacro{textcite}}% 369 | }% 370 | {}% 371 | {\ifbool{cbx:incitet}{\mkbibsuperscript{\usebibmacro{cite:dump}\usebibmacro{postnote}}}% 372 | {\usebibmacro{cite:dump}\usebibmacro{postnote}}% 373 | \ifbool{cbx:parens}% 374 | {\ifbool{cbx:incitet}{\mkbibsuperscript{\bibclosebracket}}{\bibclosebracket}% 375 | \global\boolfalse{cbx:parens}}% 376 | {}} 377 | 378 | \newrobustcmd{\cbx@citet@init}[2]{% 379 | \global\booltrue{cbx:incitet}% 380 | \setcounter{textcitetotal}{0}% 381 | \setcounter{textcitecount}{0}% 382 | \def\cbx@savedcites{#1}#2\cbx@savedcites\empty} 383 | 384 | \renewrobustcmd{\cbx@textcite@init}[2]{% 385 | \global\boolfalse{cbx:incitet}% 386 | \setcounter{textcitetotal}{0}% 387 | \setcounter{textcitecount}{0}% 388 | \def\cbx@savedcites{#1}#2\cbx@savedcites\empty} 389 | 390 | \DeclareCiteCommand{\citet}[\cbx@citet@init\cbx@textcite] 391 | {\gdef\cbx@savedkeys{}% 392 | \citetrackerfalse% 393 | \pagetrackerfalse% 394 | \DeferNextCitekeyHook% 395 | \usebibmacro{cite:init}} 396 | {\ifthenelse{\iffirstcitekey\AND\value{multicitetotal}>0} 397 | {\protected@xappto\cbx@savedcites{()(\thefield{multipostnote})}% 398 | \global\clearfield{multipostnote}} 399 | {}% 400 | \xappto\cbx@savedkeys{\thefield{entrykey},}% 401 | \iffieldequals{namehash}{\cbx@lasthash} 402 | {} 403 | {\stepcounter{textcitetotal}% 404 | \savefield{namehash}{\cbx@lasthash}}} 405 | {} 406 | {\protected@xappto\cbx@savedcites{% 407 | [\thefield{prenote}][\thefield{postnote}]{\cbx@savedkeys}}} 408 | 409 | 410 | 411 | \DeclareCiteCommand{\citep}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号 412 | {\mkbibleftborder\usebibmacro{cite:init}% 413 | \usebibmacro{prenote}} 414 | {\usebibmacro{citeindex}% 415 | \usebibmacro{cite:comp}} 416 | {} 417 | {\usebibmacro{cite:dump}\mkbibrightborder% 418 | \printfield{postnote}} 419 | 420 | \newrobustcmd*{\citetns}% 421 | {\textcite} 422 | 423 | \newrobustcmd*{\citepns}% 424 | {\parencite} 425 | 426 | \newrobustcmd*{\inlinecite}% 427 | {\parencite} 428 | 429 | % 430 | % 增加如下复数的命令,以符合biblatex的复数命令习惯 431 | % 20190430,v1.0r,hzz 432 | % citec和citecs命令是实现了[1]-[3]这样的压缩形式。 433 | % authornumcites是常用命令authornumcite的复数形式 434 | %\DeclareFieldFormat{labelbracket}{\mkbibbrackets{#1}} 435 | \DeclareFieldFormat{labelbracket}{\mkbibleftborder{#1}\mkbibrightborder} 436 | 437 | \newbibmacro*{citec:comp:comp}{% 438 | \ifboolexpr{ 439 | ( test {\iffieldundef{labelprefix}} and test {\ifundef\cbx@lastprefix} ) 440 | or 441 | test {\iffieldequals{labelprefix}{\cbx@lastprefix}}% 442 | } 443 | {\ifnumequal{\thefield{labelnumber}}{\value{cbx@tempcntb}} 444 | {\savefield{entrykey}{\cbx@lastkey}% 445 | \savefield{labelnumber}{\cbx@lastnumber}% 446 | \addtocounter{cbx@tempcnta}{1}} 447 | {\ifnumequal{\thefield{labelnumber}}{\value{cbx@tempcntb}-1} 448 | {} 449 | {\usebibmacro{citec:dump}% 450 | \ifnumgreater{\value{cbx@tempcntb}}{-1} 451 | {\multicitedelim} 452 | {}% 453 | \printtext[bibhyperref]{% 454 | \printfield{labelprefix}% 455 | \printtext[labelbracket]{\printfield{labelnumber}}}}}} 456 | {\usebibmacro{cite:comp:end}}% 457 | \setcounter{cbx@tempcntb}{\thefield{labelnumber}}% 458 | \savefield{labelprefix}{\cbx@lastprefix}} 459 | 460 | \newbibmacro*{citec:comp}{% 461 | \addtocounter{cbx@tempcntb}{1}% 462 | \iffieldundef{shorthand} 463 | {\ifbool{bbx:subentry} 464 | {\iffieldundef{entrysetcount} 465 | {\usebibmacro{citec:comp:comp}} 466 | {\usebibmacro{cite:comp:inset}}} 467 | {\usebibmacro{citec:comp:comp}}} 468 | {\usebibmacro{cite:comp:shand}}} 469 | 470 | \newbibmacro*{citec:dump}{% 471 | \ifnumgreater{\value{cbx@tempcnta}}{0} 472 | {\ifnumgreater{\value{cbx@tempcnta}}{0}%从1改成0就是从3个开始压缩改成2个开始压缩 473 | {\bibrangedash} 474 | {\multicitedelim}% 475 | \bibhyperref[\cbx@lastkey]{% 476 | \ifdef\cbx@lastprefix 477 | {\printtext[labelprefix]{\cbx@lastprefix}} 478 | {}% 479 | \printtext[labelbracket]{\cbx@lastnumber}}}%labelnumber 480 | {}% 481 | \setcounter{cbx@tempcnta}{0}% 482 | \global\undef\cbx@lastprefix} 483 | 484 | %\DeclareCiteCommand{\citec}[\mkbibsuperscript]%[\mkbibbrackets] 485 | % {\usebibmacro{cite:init}% 486 | % \usebibmacro{prenote}} 487 | % {\usebibmacro{citeindex}% 488 | % \usebibmacro{citec:comp}} 489 | % {} 490 | % {\usebibmacro{citec:dump}% 491 | % \usebibmacro{postnote}} 492 | 493 | %上面这个用于非压缩情况,这里考虑了压缩的情况 494 | \DeclareCiteCommand{\citec}[\mkbibsuperscript]% 495 | {\ifnumless{\value{multicitecount}}{2} 496 | {\usebibmacro{cite:init}% 497 | \usebibmacro{prenote}} 498 | {\iffieldundef{prenote} 499 | {\iffieldundef{postnote} 500 | {} 501 | {\usebibmacro{citec:dump}% 502 | \usebibmacro{cite:init}% 503 | \setunit{\multicitedelim}% 504 | }} 505 | {\usebibmacro{citec:dump}% 506 | \usebibmacro{cite:init}% 507 | \setunit{\multicitedelim}% 508 | \usebibmacro{prenote}}}} 509 | {\usebibmacro{citeindex}% 510 | \usebibmacro{citec:comp}} 511 | {} 512 | {\ifboolexpr{ test {\ifnumequal{\value{multicitecount}}{\value{multicitetotal}}} 513 | or not test {\iffieldundef{postnote}}} 514 | {\usebibmacro{citec:dump}% 515 | \printfield{postnote}% 516 | } 517 | {}} 518 | 519 | \DeclareMultiCiteCommand{\citecs}[\mkbibsuperscript]{\citec}{} 520 | 521 | \DeclareMultiCiteCommand{\authornumcites}[]{\authornumcite}{\multicitedelim} -------------------------------------------------------------------------------- /gb7714-2015.bbx: -------------------------------------------------------------------------------- 1 | %% 2 | %% --------------------------------------------------------------- 3 | %% biblatex-gb7714-2015 --- A biblatex implementation of the 4 | %% GBT7714-2015 bibliography style,numerical sequence 5 | %% Maintained by huzhenzhen 6 | %% E-mail: hzzmail@163.com 7 | %% Released under the LaTeX Project Public License v1.3c or later 8 | %% --------------------------------------------------------------- 9 | %% 10 | 11 | % 12 | % 版本和时间信息 13 | % 14 | \def\versionofgbtstyle{2021/09/11 v1.1a} 15 | \def\versionofbiblatex{\abx@version} 16 | \ProvidesFile{gb7714-2015.bbx}[\versionofgbtstyle biblatex bibliography style] 17 | %\RequireBiber[3]%显式指定用biber后端,当用bibtex时会报错,但其实不会影响编译,只是采用bibtex后无法达成格式需求 18 | 19 | %===================================================================== 20 | % 加载标准样式 21 | %===================================================================== 22 | \RequireBibliographyStyle{numeric-comp} 23 | \RequirePackage{xstring}%解决texlive2015的biblatex3.0不加载xstring包的问题 24 | 25 | 26 | %===================================================================== 27 | % 功能函数 28 | %===================================================================== 29 | % 30 | % biblatex版本判断 31 | % 20180405,v1.0k,为兼容biblatexv3.11增加toggle:iftlnine,HU zhenzhen 32 | % 20181020,v1.0n,为不再使用xstring宏包做的修改,hzz 33 | % 34 | % 原理方法:当版本继续更新时,增加一个新的toggle用以处理新的旧版,最新版和未判断出来的版本永远用iftlatest 35 | \providetoggle{iftlfive}\togglefalse{iftlfive} %处理biblatex3.2之前版本,时间2016-03-01前 36 | \providetoggle{iftlsix}\togglefalse{iftlsix} %处理biblatex3.3开始改变姓名机制后版本,时间2016-03-01及以后 37 | \providetoggle{iftlseven}\togglefalse{iftlseven}%处理biblatex3.7的兼容性,时间2016-12-01后 38 | \providetoggle{iftleight}\togglefalse{iftleight}%处理biblatex3.8到3.9的兼容性,时间2017-11-01后到2017-12-01前 39 | \providetoggle{iftlnine}\togglefalse{iftlnine} %处理biblatex10的兼容性,时间2017-12-01后 40 | \providetoggle{iftlatest}\toggletrue{iftlatest} %假设是最新版biblatex 41 | 42 | \@ifpackagelater{biblatex}{2014/04/01}{ 43 | \@ifpackagelater{biblatex}{2016/03/01}{ 44 | \@ifpackagelater{biblatex}{2016/12/01}{ 45 | \@ifpackagelater{biblatex}{2017/11/01}{ 46 | \@ifpackagelater{biblatex}{2017/12/01}{ 47 | \@ifpackagelater{biblatex}{2018/02/19}{} 48 | {\toggletrue{iftlnine}\togglefalse{iftlatest}}} 49 | {\toggletrue{iftleight}\togglefalse{iftlatest}}} 50 | {\toggletrue{iftlseven}\togglefalse{iftlatest}}} 51 | {\toggletrue{iftlsix}\togglefalse{iftlatest}}} 52 | {\toggletrue{iftlfive}\togglefalse{iftlatest}}} 53 | {\PackageError{biblatex}{Outdated 'biblatex' package} 54 | {Please update biblatex, This is a fatal error.}} 55 | 56 | \newcommand\defversion[2]{\csdef{codeversion#1#2}}%定义不同版本的命令 57 | \newcommand\switchversion[2]{\csuse{codeversion#1#2}}%使用不同版本的命令 58 | 59 | % 60 | % 判断CJK字符的函数,用于判断作者等信息是否由中文字符构成 61 | % v1.0k,20180509,hzz 62 | % 63 | % 原理方法:用biber中的perl方法代替。因为利用tex函数对字符判断时,当字符在宏 64 | % 中时,基于`的方法无法解决GBK编码的问题,基于CJKsymbol的方法无法解决utf-8 65 | % 编码用xelatex编译的问题。 66 | % 67 | % 原理是:利用perl正则将中文标识记录到域中, 68 | % 然后利用\iffieldundef和\iffieldequalstr进行判断 69 | \providetoggle{ifCJKforgbt} 70 | \def\testCJKfirst#1{% 71 | \iffieldundef{#1}{\togglefalse{ifCJKforgbt}}{% 72 | \iffieldequalstr{#1}{chinese}{\toggletrue{ifCJKforgbt}}{\togglefalse{ifCJKforgbt}}}} 73 | 74 | % 75 | % 2个卷的解析函数,用于连续出版物 76 | % 77 | % 原理方法: 范围起止间隔符号还是用-,而不是与date相同的/,因为有合期期刊的问题,需要用到/符号 78 | \newcommand{\multivolparser}[1]{% 79 | \IfSubStr{#1}{-}% 80 | {\StrBefore{#1}{-}[\multivolfirst]\StrBehind{#1}{-}[\multivolsecond]}% 81 | {\def\multivolfirst{#1}\def\multivolsecond{}}% 82 | } 83 | 84 | 85 | % 86 | % 2个期的解析函数,用于连续出版物 87 | % 88 | \newcommand{\multinumberparser}[1]{% 89 | \IfSubStr{#1}{-}% 90 | {\StrBefore{#1}{-}[\multinumberfirst]\StrBehind{#1}{-}[\multinumbersecond]}% 91 | {\def\multinumberfirst{#1}\def\multinumbersecond{}}% 92 | } 93 | 94 | % 对没有分隔符环境命令的低版本biblatex做增补,避免报错 95 | % 96 | \iftoggle{iftlfive}{ 97 | 98 | \def\blx@inf@delimdeclare#1#2{% 99 | \blx@info{Delimiter '#1' in context '#2' already defined, overwriting}} 100 | 101 | \def\blx@warn@delimuse#1#2{% 102 | \blx@warning{Delimiter '#1' in context '#2' undefined}} 103 | % Delimiter interface 104 | 105 | % []{}{} 106 | \newrobustcmd*{\DeclareDelimFormat}{% 107 | \@ifstar 108 | {\blx@declaredelimclear} 109 | {\blx@declaredelim}} 110 | 111 | \newrobustcmd*{\blx@declaredelimclear}[3][]{% 112 | \ifcsvoid{blx@declaredelimcontexts@#2} 113 | {} 114 | {\def\do##1{\csundef{blx@printdelim@##1@#2}}% 115 | \dolistcsloop{blx@declaredelimcontexts@#2}}% 116 | \cslet{blx@declaredelimcontexts@#2}\@empty 117 | \ifblank{#1} 118 | {\blx@declaredelim{#2}{#3}} 119 | {\blx@declaredelim[#1]{#2}{#3}}} 120 | 121 | \newrobustcmd*{\blx@declaredelim}[3][]{% 122 | \ifblank{#1} 123 | {\blx@declaredelim@i{}{}{#2}{#3}} 124 | {\def\do##1{% 125 | \listcsadd{blx@declaredelimcontexts@#2}{##1}% 126 | \blx@declaredelim@i{blx@printdelim@##1@}{##1}{#2}{#3}}% 127 | \docsvlist{#1}}}% 128 | 129 | \def\blx@declaredelim@i#1#2#3#4{% 130 | \def\do@i##1{% 131 | \ifcsdef{#1##1} 132 | {\blx@inf@delimdeclare{##1}{#2}} 133 | {}% 134 | \csdef{#1##1}{#4}}% 135 | \forcsvlist{\do@i}{#3}} 136 | 137 | % *[]{}{} 138 | \newrobustcmd*{\DeclareDelimAlias}{% 139 | \@ifstar 140 | {\blx@declaredelimalias} 141 | {\blx@declaredelimaliasauto}} 142 | 143 | \newrobustcmd*{\blx@declaredelimalias}[3][]{% 144 | \ifblank{#1} 145 | {\blx@declaredelimalias@i{}{#2}{#3}} 146 | {\def\do##1{% 147 | \blx@declaredelimalias@i{blx@printdelim@##1@}{#2}{#3}}% 148 | \docsvlist{#1}}} 149 | 150 | \newrobustcmd*{\blx@declaredelimaliasauto}[2]{% 151 | \blx@declaredelimalias@i{}{#1}{#2}% 152 | \ifcsvoid{blx@declaredelimcontexts@#2} 153 | {} 154 | {\def\do##1{% 155 | \blx@declaredelimalias@i{blx@printdelim@##1@}{#1}{#2}}% 156 | \dolistcsloop{blx@declaredelimcontexts@#2}}} 157 | 158 | \def\blx@declaredelimalias@i#1#2#3{% 159 | \ifcsdef{#1#2} 160 | {\blx@inf@delimdeclare{#2}{#1}} 161 | {}% 162 | \csdef{#1#2}{\csuse{#1#3}}} 163 | 164 | \def\blx@delimcontext{none} 165 | \newcommand*{\printdelim}[2][]{% 166 | \ifblank{#1} 167 | {\ifcsdef{blx@printdelim@\blx@delimcontext @#2} 168 | {\csuse{blx@printdelim@\blx@delimcontext @#2}} 169 | {\ifcsdef{#2}% fall back on legacy macros 170 | {\csuse{#2}} 171 | {\blx@warn@delimuse{#2}{*}}}} 172 | {\ifcsdef{blx@printdelim@#1@#2} 173 | {\csuse{blx@printdelim@#1@#2}} 174 | {\blx@warn@delimuse{#2}{#1}}}} 175 | 176 | \newcommand*{\delimcontext}[1]{% 177 | \edef\blx@delimcontext{\blx@delimcontextalias{#1}}} 178 | 179 | \def\blx@delimcontextalias#1{% 180 | \ifcsdef{blx@delimcontextalias@#1} 181 | {\csuse{blx@delimcontextalias@#1}} 182 | {#1}} 183 | 184 | \newcommand*{\DeclareDelimcontextAlias}[2]{% 185 | \csgdef{blx@delimcontextalias@#1}{#2}} 186 | }{} 187 | 188 | 189 | %===================================================================== 190 | % 数据模型定义 191 | %===================================================================== 192 | %定义类型和载体标识,从gb内容看载体基本属于介质。 193 | %为与lee zeping的bst的样式统一,使用mark和medium这两域名 194 | %为单个条目的姓名格式控制增加nameformat和namefmtid两个域 195 | %为缩略信息文献表增加了shortbooktitle域 196 | %为多语言排序增加了lansortorder域 197 | %因为language域会被clearlang选项清除,增加languageid域,类型设为field而不是list 198 | \DeclareDatamodelFields[type=field,datatype=literal]{mark,medium,nameformat} 199 | \DeclareDatamodelFields[type=field,datatype=integer]{namefmtid} 200 | \DeclareDatamodelFields[type=field,datatype=literal]{shortbooktitle} 201 | \DeclareDatamodelFields[type=field,datatype=literal]{lansortorder} 202 | \DeclareDatamodelFields[type=field,datatype=literal]{languageid} 203 | 204 | %因为biblatex更新3.14版本以后,biber对于为声明数据模型的条目类型 205 | %不再默认读取,而是以空字符串作为条目类型名,自然在条目定义alias时 206 | %就会出现问题,因此显式的声明一下newspaper,然后保留后面采用alias的方式 207 | %而standard类型则是采用另一种方式直接在sourcemap中转换为其它类型。 208 | \@ifpackagelater{biblatex}{2019/11/30}{%2019/12/01 v3.14 209 | \DeclareDatamodelEntrytypes{newspaper}% 210 | }{} 211 | 212 | 213 | 214 | %===================================================================== 215 | % 设置宏包选项 216 | %===================================================================== 217 | % 218 | % 增加一个控制是否调整日期输出位置的选项mergedate 219 | % 为兼容性考虑,但实际不产生作用了,因为如果要使用ay样式可以直接从bibstyle进入 220 | % 因为使用string所以只适用于biblatex3.3以上版本 221 | % 20210415,v1.0y,hzz 222 | \DeclareBibliographyOption[string]{mergedate}[none]{% 223 | \ifcsdef{bbx@opt@mergedate@#1} 224 | {\csuse{bbx@opt@mergedate@#1}} 225 | {}} 226 | \ExecuteBibliographyOptions{mergedate} 227 | 228 | \def\bbx@opt@mergedate@none{}%none就是正常的顺序编码样式 229 | \def\bbx@opt@mergedate@true{}%none就是正常的顺序编码样式 230 | \def\bbx@opt@mergedate@false{}%none就是正常的顺序编码样式 231 | 232 | 233 | % 234 | % 增加一个控制是否输出恢复传统crossref作用的选项 235 | % 20210216,v1.0w,hzz 236 | \newtoggle{bbx:citexref} 237 | \DeclareBibliographyOption{citexref}[true]{% 238 | \settoggle{bbx:citexref}{#1}} 239 | \ExecuteBibliographyOptions{citexref} 240 | 241 | \newbibmacro*{citexref}{% 242 | \printtext[bibhyperref]{% 243 | \printfield{labelprefix}% 244 | \printfield{labelnumber}% 245 | \ifbool{bbx:subentry} 246 | {\printfield{entrysetcount}} 247 | {}}} 248 | 249 | \DeclareCiteCommand{\bbx@xrefcite}[\mkbibbrackets]% 250 | {\boolfalse{citetracker}% 251 | \boolfalse{pagetracker}% 252 | \boolfalse{backtracker}} 253 | {\usebibmacro{citexref}} 254 | {} 255 | {} 256 | 257 | \newbibmacro*{crosscite}[1]{% 258 | \iftoggle{bbx:citexref} 259 | {\iffieldundef{crossref} 260 | {\iffieldundef{xref} 261 | {\usebibmacro{#1}} 262 | {\printtext{\bbx@xrefcite{\thefield{xref}}}}} 263 | {\printtext{\bbx@xrefcite{\thefield{crossref}}}}} 264 | {\usebibmacro{#1}}} 265 | 266 | % 267 | % 增加一个控制是否输出文献载体的选项 268 | % 20191125,v1,0s,hzz 269 | \newtoggle{bbx:gbmedium} 270 | \DeclareBibliographyOption{gbmedium}[true]{%biblatex低版本 271 | \settoggle{bbx:gbmedium}{#1}} 272 | \ExecuteBibliographyOptions{gbmedium} 273 | 274 | % 275 | % 增加一个控制是否输出annotation域的选项,该域可以用于在文献条目后面输出一些注释信息 276 | % 20190509,v1,0s,hzz 277 | \newtoggle{bbx:gbannote} 278 | \DeclareBibliographyOption{gbannote}[false]{%biblatex低版本 279 | \settoggle{bbx:gbannote}{#1}} 280 | \ExecuteBibliographyOptions{gbannote} 281 | % 282 | %用于在文献条目后面输出注释信息的宏 283 | %FieldFormat{annotation}用于设置注释信息的格式 284 | \DeclareFieldFormat{annotation}{% 285 | \printtext{\addspace(#1)}% 286 | } 287 | \renewbibmacro*{annotation}{% 288 | \iftoggle{bbx:gbannote}% 289 | {\iffieldundef{annotation}% 290 | {\printfile[annotation]{\bibannotationprefix\thefield{entrykey}.tex}}% 291 | {\printfield{annotation}}}% 292 | {}% 293 | } 294 | 295 | % 296 | % 增加一个控制是否输出type域的选项 297 | % 20190212,v1,0q,hzz 298 | \newtoggle{bbx:gbfieldtype} 299 | \DeclareBibliographyOption{gbfieldtype}[false]{%biblatex低版本 300 | \settoggle{bbx:gbfieldtype}{#1}} 301 | \ExecuteBibliographyOptions{gbfieldtype} 302 | 303 | % 304 | % 增加一个控制是否根据页码重设脚注数字标号的选项 305 | % 20190422,v1,0r,hzz 306 | \newtoggle{bbx:gbfnperpage} 307 | \DeclareBibliographyOption{gbfnperpage}[false]{% 308 | \settoggle{bbx:gbfnperpage}{#1}} 309 | \ExecuteBibliographyOptions{gbfnperpage} 310 | 311 | 312 | % 313 | % 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表 314 | % 20190203,v1.0p,hzz 315 | % 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签 316 | % 当前面的脚注中已经存在当前文献,那么当前文献内容不再输出而用同(4)这样的方式 317 | % 需要注意的是由于小页环境和表格中的脚注本身的问题,可能会有一些问题 318 | \DeclareBibliographyOption{gbfootbib}[false]{% 319 | \ifstrequal{#1}{false}{}{\execgbfootbib}} 320 | \ExecuteBibliographyOptions{gbfootbib} 321 | 322 | %% 323 | \newlength{\footbibmargin} 324 | \newlength{\footbiblabelsep} 325 | \setlength{\footbibmargin}{1em}%脚注的段落左侧缩进距离 326 | \setlength{\footbiblabelsep}{0.5em}%脚注中标记号与脚注段落的间距 327 | \def\execgbfootbib% 328 | {% 329 | %开启引用跟踪计数器,为使用\ifciteseen等测试命令 330 | \ExecuteBibliographyOptions{citetracker=true} 331 | % 332 | %利用footmisc宏包来实现脚注文献的悬挂对齐 333 | \AtEndPreamble{ 334 | \@ifclassloaded{beamer}{}{ 335 | %beamer类因为其特殊性,为避免冲突不调footmisc。 336 | %同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接 337 | %如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。 338 | %\PassOptionsToPackage{perpage,hang}{footmisc}% 339 | %\RequirePackage{footmisc}% 340 | 341 | %重新实现脚注的根据单页重设脚注号码 342 | %重新实现脚注的悬挂对齐问题,不再使用footmisc,直接从latex核心代码和hyperref代码进行修改 343 | %v1.0q 20190317 hzz 344 | %v1.0r 20190422 hzz 根据gbfnperpage选项设置 345 | \iftoggle{bbx:gbfnperpage}% 346 | {\@addtoreset{footnote}{page}}{}%重设计数器 347 | 348 | \@ifpackageloaded{hyperref}{%加载hyperref则对\H@@footnotetext做重定义 349 | \long\def\H@@footnotetext##1{\insert\footins{% 350 | \reset@font\footnotesize 351 | \interlinepenalty\interfootnotelinepenalty 352 | \splittopskip\footnotesep 353 | \splitmaxdepth \dp\strutbox \floatingpenalty \@MM 354 | \hsize\columnwidth \@parboxrestore 355 | \protected@edef\@currentlabel{% 356 | \csname p@footnote\endcsname\@thefnmark 357 | }% 358 | \color@begingroup 359 | \leftskip \footbibmargin%增加的左侧缩进 360 | \@makefntext{% 361 | \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% 362 | }% 363 | \color@endgroup}}% 364 | 365 | \long\def\H@@mpfootnotetext##1{% 366 | \global\setbox\@mpfootins\vbox{% 367 | \unvbox\@mpfootins 368 | \reset@font\footnotesize 369 | \hsize\columnwidth 370 | \@parboxrestore 371 | \protected@edef\@currentlabel 372 | {\csname p@mpfootnote\endcsname\@thefnmark}% 373 | \leftskip \footbibmargin%增加的左侧缩进 374 | \color@begingroup 375 | \@makefntext{% 376 | \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% 377 | \color@endgroup}} 378 | }{%否则对latex核心代码中的\@footnotetext做重定义 379 | \long\def\@footnotetext##1{\insert\footins{% 380 | \reset@font\footnotesize 381 | \interlinepenalty\interfootnotelinepenalty 382 | \splittopskip\footnotesep 383 | \splitmaxdepth \dp\strutbox \floatingpenalty \@MM 384 | \hsize\columnwidth \@parboxrestore 385 | \protected@edef\@currentlabel{% 386 | \csname p@footnote\endcsname\@thefnmark 387 | }% 388 | \color@begingroup 389 | \leftskip \footbibmargin%增加的左侧缩进 390 | \@makefntext{% 391 | \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% 392 | }% 393 | \color@endgroup}}% 394 | 395 | \long\def\@mpfootnotetext##1{% 396 | \global\setbox\@mpfootins\vbox{% 397 | \unvbox\@mpfootins 398 | \reset@font\footnotesize 399 | \hsize\columnwidth 400 | \@parboxrestore 401 | \protected@edef\@currentlabel 402 | {\csname p@mpfootnote\endcsname\@thefnmark}% 403 | \leftskip \footbibmargin%增加的左侧缩进 404 | \color@begingroup 405 | \@makefntext{% 406 | \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% 407 | \color@endgroup}} 408 | } 409 | 410 | \long\def\@makefntext##1{%增加了脚注标记与正文的间隔 411 | \parindent 1em\noindent \hb@xt@ 0em{\hss \@makefnmark\makebox[\footbiblabelsep]{}}##1} 412 | 413 | } 414 | 415 | % 416 | %使脚注标记加圈并设置数字的字体为tiny,不使用修改thefootnote的方式 417 | \def\@makefnmark{\hbox{\@textsuperscript{\textcircled{\tiny\@thefnmark}}}} 418 | %做patch使得脚注内容中的脚注数字标签不上标 419 | \pretocmd{\@makefntext}{% 420 | \def\@makefnmark{% 421 | \hbox{\textcircled{\tiny\@thefnmark}}% 422 | }% 423 | }{}{} 424 | } 425 | 426 | % 427 | %判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容) 428 | %记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。 429 | %v1.0q 20190309 区分使脚注标注适应minipage中的情况 430 | \newbibmacro*{citesavefn}{% 431 | \ifciteseen%当被引用过为true 432 | {\ifcsdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%当已经定义过脚注序号信息 433 | {\csgdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% 434 | \str@sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}% 435 | \@makefnmark% 436 | }}% 437 | {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% 438 | \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% 439 | }}% 440 | }% 441 | {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% 442 | \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% 443 | %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断 444 | }}% 445 | } 446 | 447 | % 448 | %重定义\footfullcite使完成gb7714-2015的脚注文献要求 449 | \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]% 450 | {\defcounter{maxnames}{\blx@maxbibnames}%局部定义maxnames和minnames计数器 451 | \defcounter{minnames}{\blx@minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。 452 | \usebibmacro{prenote}% 453 | \renewbibmacro*{postnote}{% 454 | \iffieldundef{postnote}% 455 | {}{\setunit{\addcolon\addspace}\printfield{postnote}}}%与ay样式不同,由于已修改postnote域格式,直接用printfield 456 | }% 457 | {\usebibmacro{citesavefn}% 458 | \ifcsdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}% 459 | {\csuse{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}%\nopunct 460 | {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}% 461 | }% 462 | {\multicitedelim}% 463 | {\usebibmacro{postnote}} 464 | 465 | } 466 | 467 | % 468 | % 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式 469 | % 20180814,v1.0m,hzz 470 | % 原理方法: 471 | % 只为兼容性考虑不做任何处理 472 | \DeclareBibliographyOption{gbstyle}[true]{%biblatex低版本 473 | } 474 | 475 | % 476 | % 增加一个控制是否输出文献类型和载体标识的选项 477 | % 478 | % 原理方法: 479 | % 对于biblatex3.4以上版本DeclareBibliographyOption命令中的[datatype]如果是boolean,那么是可以省略的 480 | % 所以用老版本的不用[datatype]的命令可以兼容所有biblatex版本 481 | \newtoggle{bbx:gbtype} 482 | %\DeclareBibliographyOption[boolean]{gbtype}[true]{%biblatex高版本 483 | \DeclareBibliographyOption{gbtype}[true]{%biblatex低版本 484 | \settoggle{bbx:gbtype}{#1}} 485 | \ExecuteBibliographyOptions{gbtype} 486 | 487 | % 488 | % 增加一个源文件编码选择选项,当true时可以使用GBK编码。 489 | % v1.0k, 2018.05.08, by hzz 490 | % 491 | % 原理方法:将需要输出的中文字符串用命令形式表示存储,采用utf8编码时采用bbx文档 492 | % 内的定义即是utf8编码的中文字符串,但tex源文件是gbk编码时,利用gb7714-2015-gbk.def 493 | % 文档内的gbk编码的字符串覆盖。这种覆盖只能在宏包末尾加载时成功实现,所以使用 494 | % AtEndOfPackage。该解决思路源自biblatex-caspervector宏包。 495 | % 另外注意: 496 | % gbk编码的tex文档,利用pdflatex/latex能正确编译,利用xelatex能编译,但中文显示乱码 497 | % 在源文档前面增加 XeTeX 原语:\XeTeXinputencoding "GBK" 后,显示正常 498 | % utf-8编码的tex文档,利用xelatex能正确编译,而pdflatex/latex不能编译。 499 | \newtoggle{bbx:codegbk} 500 | \DeclareBibliographyOption{gbcodegbk}[false]{% 501 | \settoggle{bbx:codegbk}{#1}} 502 | \ExecuteBibliographyOptions{gbcodegbk} 503 | 504 | \def\str@bibliography{参考文献} 505 | \def\str@references{参考文献} 506 | \def\str@bytranslator{译} 507 | \def\str@andotherscn{等} 508 | \def\str@andcn{和} 509 | \def\str@backrefpage{引用页} 510 | \def\str@backrefpages{引用页} 511 | \def\str@noaddress{出版地不详} 512 | \def\str@nopublisher{出版者不详} 513 | \def\str@edition{版} 514 | \def\str@volumecn{卷} 515 | \def\str@numbercn{册} 516 | \def\str@serialcn{第} 517 | \def\str@sameentry{同} 518 | \def\str@incn{见} 519 | \def\str@mathesiscn{硕士学位论文} 520 | \def\str@phdthesiscn{博士学位论文} 521 | \def\str@editorcn{主编} 522 | 523 | \AtEndOfPackage{% 524 | \iftoggle{bbx:codegbk}{% 525 | \ExecuteBibliographyOptions{texencoding = GBK} 526 | \input{gb7714-2015-gbk.def} 527 | }{}} 528 | 529 | % 530 | % 增加一个严格按GB/T 7714-2015给出著录格式控制域的输出的选项 531 | % v1.0k, 2018.05.08, by hzz 532 | % 533 | % 原理方法: 534 | % 默认设置该选项为真,进而不输出GB/T 7714-2015中没有的域的信息 535 | % 这样可以避免因为bib文件带有多余的域的信息的输出,比如因为bibtex样式 536 | % 可能需要用于中英文判断的language域的信息。 537 | \newtoggle{bbx:gbstrict} 538 | \DeclareBibliographyOption{gbstrict}[true]{% 539 | \settoggle{bbx:gbstrict}{#1}} 540 | \ExecuteBibliographyOptions{gbstrict} 541 | 542 | % 543 | % 增加一个控制标题域超链接设置的选项 544 | % v1.0k, 2018.05.24, by hzz 545 | % 546 | % 原理方法: 547 | % 利用标题域格式来实现,默认设置该选项为false,不做超链接。 548 | % 设置为true,则标题设置超链接 549 | \newtoggle{bbx:titlelink} 550 | \DeclareBibliographyOption{gbtitlelink}[false]{% 551 | \settoggle{bbx:titlelink}{#1}} 552 | \ExecuteBibliographyOptions{gbtitlelink} 553 | 554 | % 555 | % 增加一个控制参考文献标题是否能够被ctex宏包设置的选项 556 | % v1.0l, 2018.07.02, by hzz 557 | % 558 | % 原理方法: 559 | % 重定义biblatex的宏,去除使用本地化字符串的方式,是的可以利用ctexset进行设置 560 | \newtoggle{bbx:ctexset} 561 | \DeclareBibliographyOption{gbctexset}[true]{% 562 | \settoggle{bbx:ctexset}{#1}} 563 | \ExecuteBibliographyOptions{gbctexset} 564 | 565 | \AtEndOfPackage{% 566 | \iftoggle{bbx:ctexset}{% 567 | \def\blx@defbibstrings#1#2{% 568 | \def\do##1{\csundef{abx@lstr@##1}\csundef{abx@sstr@##1}}% 569 | \abx@dostrings 570 | \csuse{abx@strings@#1}% 571 | \setkeys{blx@lbx}{#2}% 572 | \let\do\blx@defbibstrings@i 573 | \csxdef{abx@strings@#1}{\abx@dostrings}% 574 | } 575 | }{}} 576 | 577 | % 578 | % 增加一个处理佚名或noauthor的控制选项 579 | % 580 | % 原理方法:在顺序编码制中不需要使用,为与作者年制的兼容性考虑,这里也增加避免报错 581 | \DeclareBibliographyOption{gbnoauthor}[true]{}% 582 | 583 | 584 | % 585 | % 增加一个恢复域格式为标准样式的控制选项 586 | % v1.0k, 2018.05.15, by hzz 587 | % 588 | % 原理方法: 589 | % 默认设置该选项为false,采用国标要求的域格式输出相关域 590 | % 当设置该选项为true时,则重新利用标准样式的域格式输出相关的域 591 | \newtoggle{bbx:gbfieldstd} 592 | \DeclareBibliographyOption{gbfieldstd}[false]{% 593 | \settoggle{bbx:gbfieldstd}{#1}% 594 | \ifstrequal{#1}{false}{}{\execgbfdfmtstd}% 595 | } 596 | \ExecuteBibliographyOptions{gbfieldstd} 597 | 598 | % 599 | % 增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。 600 | % 601 | \newtoggle{bbx:gbpub} 602 | \DeclareBibliographyOption{gbpub}[true]{% 603 | %\settoggle{bbx:gbpub}{#1} %或采用下面这一句 604 | \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}} 605 | \ExecuteBibliographyOptions{gbpub} 606 | 607 | % 608 | % 增加控制析出文献来源前的标点符号//输出的选项 609 | % v1.0k, 2018.04.20,added in by hzz 610 | \newtoggle{bbx:gbpunctin} 611 | \DeclareBibliographyOption{gbpunctin}[true]{% 612 | \settoggle{bbx:gbpunctin}{#1}} 613 | \ExecuteBibliographyOptions{gbpunctin} 614 | 615 | 616 | 617 | 618 | 619 | % 620 | % 选项设置 621 | % 622 | \ExecuteBibliographyOptions{ 623 | sorting=none, 624 | useprefix=true, %名字的信息包括前缀 625 | date = year, %日期仅写到年 626 | maxbibnames = 3,%设置名字最大数量 627 | minbibnames = 3, %设置缩减后的名字最小数量 628 | maxitems = 1,%设置列表最大数量 629 | minitems = 1, %设置缩减后的列表最小数量 630 | isbn=false, 631 | } 632 | 633 | % 634 | %为日期相关选项增加选项值gb7714-2015 635 | % 636 | \csdef{mkdaterangegb7714-2015}#1{% 637 | \begingroup 638 | \blx@metadateinfo{#1}% 639 | \iffieldundef{#1year} 640 | {} 641 | {\printtext[#1date]{% 642 | \blx@gbdate{#1}{}}}% 643 | \endgroup} 644 | 645 | \newrobustcmd*{\blx@gbdate}[3][]{% 646 | \dateeraprintpre{#2#3year}% 647 | \blx@imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}% 648 | \iffieldundef{#2#3month}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3month}}}% 649 | \iffieldundef{#2#3day}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3day}}}} 650 | 651 | 652 | %为姓名格式选择增加的计数器 653 | \newcounter{gbnamefmtcase} 654 | \def\thegbnamefmtcase{\the\c@gbnamefmtcase} 655 | %为数字标签格式选择增加的计数器/命令 656 | \newcommand{\mkgbnumlabel}[1]{\mkbibbrackets{#1}} 657 | \def\gbbiblabelopt@bracket{\renewcommand{\mkgbnumlabel}[1]{\mkbibbrackets{##1}}} 658 | \def\gbbiblabelopt@parens{\renewcommand{\mkgbnumlabel}[1]{\mkbibparens{##1}}} 659 | \def\gbbiblabelopt@dot{\renewcommand{\mkgbnumlabel}[1]{##1\adddot}} 660 | \def\gbbiblabelopt@plain{\renewcommand{\mkgbnumlabel}[1]{##1}} 661 | \def\gbbiblabelopt@box{\renewcommand{\mkgbnumlabel}[1]{\framebox{##1}}} 662 | \def\gbbiblabelopt@circle{\renewcommand{\mkgbnumlabel}[1]{\textcircled{##1}}} 663 | %为文献表中数字标签对齐方式选择增加的计数器/命令 664 | \newcounter{gbalignlabel} 665 | \def\thegbalignlabel{\the\c@gbalignlabel} 666 | %为引用标签标注/文献表中本地化字符串中英文选择增加的计数器/命令 667 | \newcounter{gbcitelocalcase} 668 | \newcounter{gbbiblocalcase} 669 | \def\thegbcitelocalcase{\the\c@gbcitelocalcase} 670 | \def\thegbbiblocalcase{\the\c@gbbiblocalcase} 671 | 672 | \@ifpackagelater{biblatex}{2016/03/27} 673 | { % 针对biblatex>=3.3版本的选项设置 674 | % 增加不同语言排序的切换选项 675 | % numeric样式,不使用该选项,这里给出仅为兼容性考虑 676 | % v1.0q,20190307,hzz 677 | % 678 | % 增加不同语言排序的切换选项 679 | % gblanorder=chineseahead的顺序为cn,jp,kr,en,fr,ru 680 | % gblanorder=englishahead的顺序为en,fr,ru,cn,jp,kr 681 | % gblanorder=cn;en;ru;fr;jp;kr的顺序为指定的cn;en;ru;fr;jp;kr,自定义内容可以随意写以分号分隔 682 | % v1.0q,20190307,hzz 683 | % 684 | \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{% 685 | \ifstrequal{#1}{chineseahead}%%中文在前的顺序 686 | {\gdef\lancnorder{1}\gdef\lanjporder{2}\gdef\lankrorder{3}% 687 | \gdef\lanenorder{4}\gdef\lanfrorder{5}\gdef\lanruorder{6}}% 688 | {% 689 | \ifstrequal{#1}{englishahead}% 690 | {\execlanodeah\dealsortlan}% 691 | {\execlanodudf{#1}\dealsortlan}% 692 | }% 693 | } 694 | \ExecuteBibliographyOptions{gblanorder} 695 | 696 | \def\execlanodeah{%中文在后的顺序 697 | \gdef\lancnorder{4} 698 | \gdef\lanjporder{5} 699 | \gdef\lankrorder{6} 700 | \gdef\lanenorder{1} 701 | \gdef\lanfrorder{2} 702 | \gdef\lanruorder{3}} 703 | 704 | \newcounter{lanordernum} 705 | \newcommand{\execlanodudf}[1]{%like:cn;en;ru;fr;jp;kr 706 | \setcounter{lanordernum}{0} 707 | \DeclareListParser{\parsinglanorder}{;} 708 | \renewcommand*{\do}[1]{\stepcounter{lanordernum}\csxdef{lan##1order}{\thelanordernum}} 709 | \parsinglanorder{#1} 710 | } 711 | 712 | % 713 | % 增加本地化字符串的中英文切换选项 714 | % gbcitelocal指标注中的本地化字符串 715 | % gbbiblocal 指文献表中的本地化字符串 716 | % gblocal 指设置文献表和标注中的本地化字符串 717 | % v1.0o,20190103,hzz 718 | % 719 | \DeclareBibliographyOption[string]{gbcitelocal}[gb7714-2015]{% 720 | \ifstrequal{#1}{gb7714-2015}{\setcounter{gbcitelocalcase}{0}}{}% 721 | \ifstrequal{#1}{chinese}{\setcounter{gbcitelocalcase}{1}}{}% 722 | \ifstrequal{#1}{english}{\setcounter{gbcitelocalcase}{2}}{}% 723 | } 724 | \ExecuteBibliographyOptions{gbcitelocal} 725 | 726 | \DeclareBibliographyOption[string]{gbbiblocal}[gb7714-2015]{% 727 | \ifstrequal{#1}{gb7714-2015}{\setcounter{gbbiblocalcase}{0}}{}% 728 | \ifstrequal{#1}{chinese}{\setcounter{gbbiblocalcase}{1}}{}% 729 | \ifstrequal{#1}{english}{\setcounter{gbbiblocalcase}{2}}{}% 730 | } 731 | \ExecuteBibliographyOptions{gbbiblocal} 732 | 733 | \DeclareBibliographyOption[string]{gblocal}[gb7714-2015]{% 734 | \ExecuteBibliographyOptions{gbbiblocal=#1}% 735 | \ExecuteBibliographyOptions{gbcitelocal=#1}% 736 | } 737 | %\ExecuteBibliographyOptions{gblocal} %默认值已经通过两个相关选项设置 738 | 739 | % 740 | % 增加序号标签格式处理选项 741 | % v1.0l,20180623,hzz 742 | % 743 | \DeclareBibliographyOption[string]{gbbiblabel}[bracket]{% 744 | \csuse{gbbiblabelopt@#1} 745 | } 746 | \ExecuteBibliographyOptions{gbbiblabel} 747 | 748 | % 749 | % 增加姓名大小写格式处理选项 750 | % 751 | \DeclareBibliographyOption[string]{gbnamefmt}[uppercase]{% 752 | \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}% 753 | \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}% 754 | \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family 755 | \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{} 756 | \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given 757 | \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family 758 | \ifstrequal{#1}{quanpin}{\setcounter{gbnamefmtcase}{6}}{}%全拼 759 | } 760 | \ExecuteBibliographyOptions{gbnamefmt} 761 | 762 | % 763 | % 增加标签对齐选项 764 | % 765 | % right是默认的右对齐,left是左对齐,gb7714-2015是项对齐方式 766 | \DeclareBibliographyOption[string]{gbalign}[right]{% 767 | \ifstrequal{#1}{right}{\setcounter{gbalignlabel}{0}}{} 768 | \ifstrequal{#1}{left}{\setcounter{gbalignlabel}{1}}{} 769 | \ifstrequal{#1}{center}{\setcounter{gbalignlabel}{2}}{} 770 | \ifstrequal{#1}{gb7714-2015}{\setaligngbstyle}{} 771 | \ifstrequal{#1}{gb7714-2015ay}{\setaligngbstyleay}{} 772 | } 773 | } 774 | {% 针对biblatex<3.3版本的选项设置 775 | % 增加不同语言排序的切换选项 776 | % numeric样式, biblatex 3.4及以下版本不能使用多个stylesourcemap,所以不使用该选项 777 | % v1.0q,20190307,hzz 778 | % 779 | \DeclareBibliographyOption{gblanorder}[chineseahead]{} 780 | 781 | % 782 | % 增加序号标签格式处理选项 783 | % v1.0l,20180623,hzz 784 | % 785 | \DeclareBibliographyOption{gbbiblabel}[bracket]{% 786 | \csuse{gbbiblabelopt@#1} 787 | } 788 | \ExecuteBibliographyOptions{gbbiblabel} 789 | 790 | % 791 | % 增加姓名大小写格式处理选项 792 | % 793 | \DeclareBibliographyOption{gbnamefmt}[uppercase]{% 794 | \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}% 795 | \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}% 796 | \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family 797 | \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{} 798 | \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given 799 | \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family 800 | \ifstrequal{#1}{quanpin}{\setcounter{gbnamefmtcase}{6}}{}%family-given 801 | } 802 | \ExecuteBibliographyOptions{gbnamefmt} 803 | 804 | % 805 | % 增加标签对齐选项 806 | % 807 | % 原理方法:right是默认的右对齐,left是左对齐,gb7714-2015无效,仍然为右对齐模式, 808 | % 因为在这种biblatex低版本中,舍弃了list类环境后,会出错。 809 | % 注意:texlive2015中的3.0版中的DeclareBibliographyOption选项没有类型说明 810 | \DeclareBibliographyOption{gbalign}[right]{% 811 | \ifstrequal{#1}{right}{\setcounter{gbalignlabel}{0}}{} 812 | \ifstrequal{#1}{left}{\setcounter{gbalignlabel}{1}}{} 813 | \ifstrequal{#1}{center}{\setcounter{gbalignlabel}{2}}{} 814 | \ifstrequal{#1}{gb7714-2015}{}{} 815 | \ifstrequal{#1}{gb7714-2015ay}{\setaligngbstyleay}{} 816 | } 817 | } 818 | 819 | 820 | % 821 | % 针对biblatex<3.3版本的选项设置,比如texlive2015中的3.0版 822 | % 823 | \defversion{3.0}{opt}{ 824 | \ExecuteBibliographyOptions{ 825 | firstinits=true, %名字有缩写,参考3.1.2.3 Internal 826 | } 827 | } 828 | % 829 | % 针对3.3<=biblatex<3.5版本的选项设置,比如texlive2016中的3.4版 830 | % 831 | \defversion{3.4}{opt}{ 832 | \ExecuteBibliographyOptions{ 833 | giveninits=true, %名字有缩写,参考3.1.2.3 Internal 834 | } 835 | } 836 | % 837 | % 针对3.7<=biblatex<=3.9版本的选项设置,比如texlive2017中的3.7版 838 | % 839 | \defversion{3.7}{opt}{ 840 | \ExecuteBibliographyOptions{ 841 | giveninits=true, 842 | urldate =edtf, %iso8601 843 | eventdate =edtf, 844 | } 845 | } 846 | % 847 | % 针对3.10<=biblatex版本的选项设置,比如texlive2018中的3.11版 848 | % 849 | \defversion{3.10}{opt}{ 850 | \ExecuteBibliographyOptions{ 851 | giveninits=true, 852 | urldate =gb7714-2015, %iso,iso8601,edtf 853 | eventdate =gb7714-2015, 854 | } 855 | } 856 | 857 | % 858 | % 根据biblatex版本信息,选择选项设置 859 | % 860 | % 原理方法:如下这种选择机制能自动兼容更新的版本,但对于老版本 861 | % 必须要把情况列全。 862 | \iftoggle{iftlfive}{\switchversion{3.0}{opt}}{}%biblatex<=3.2 863 | \iftoggle{iftlsix}{\switchversion{3.4}{opt}}{}%3.3<=biblatex<=3.6 864 | \iftoggle{iftlseven}{\switchversion{3.7}{opt}}{}%biblatex=3.7 865 | \iftoggle{iftleight}{\switchversion{3.7}{opt}}{}%3.8<=biblatex<=3.9 866 | \iftoggle{iftlnine}{\switchversion{3.10}{opt}}{}%biblatex=3.10 867 | \iftoggle{iftlatest}{\switchversion{3.10}{opt}}{}%biblatex最新3.11 868 | 869 | 870 | %===================================================================== 871 | % 设置本地化字符串 872 | %===================================================================== 873 | % 874 | % 新建当地化字符串,用来记录“等”字符、“和”字符 875 | % 876 | \NewBibliographyString{andotherscn} 877 | \NewBibliographyString{andothersincitecn} 878 | \NewBibliographyString{andothersincite} 879 | \NewBibliographyString{andcn} 880 | \NewBibliographyString{andothersjp} 881 | \NewBibliographyString{andotherskr} 882 | \NewBibliographyString{andjp} 883 | \NewBibliographyString{andkr} 884 | \NewBibliographyString{andincitecn} 885 | \NewBibliographyString{andincite} 886 | \NewBibliographyString{volumecn} 887 | \NewBibliographyString{numbercn} 888 | \NewBibliographyString{serialcn} 889 | \NewBibliographyString{incn} 890 | \NewBibliographyString{mathesiscn} 891 | \NewBibliographyString{phdthesiscn} 892 | \NewBibliographyString{editorcn} 893 | \NewBibliographyString{editorscn} 894 | \NewBibliographyString{bytranslatorcn} 895 | 896 | 897 | 898 | % 899 | % 修改一些当地化字符串 900 | % 901 | % 原理方法:直接利用当地化格式english修改出一些中文的格式,具体修改内容参考english.lbx文件 902 | % 当然也可以增加比如上面定义的andotherscn 903 | % 注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别 904 | 905 | \DefineBibliographyStrings{english}{ 906 | bibliography = {\str@bibliography}, 907 | references = {\str@references}, 908 | bytranslatorcn = {\str@bytranslator},%\addperiod,%将trans. by 改成 译\addcomma\ 909 | and = {\addcomma},%将第2和3人名间的and符号改成逗号,用\finalnamedelim命令也可以定义,参见3.9.1节 910 | andcn = {\addcomma},%and本地化字符串的中文对应词 911 | andincitecn = {\str@andcn},%将标注中的分开,便于与文献表中的区分 912 | andincite = {\addcomma\space},%注意add开头的命令会其把前面的空格去掉 913 | %andothers = {et al.},%将超过3个人名的省略,et al.改成为 等 914 | andotherscn = {\str@andotherscn},%将超过3个人名的省略,et al.改成为 等 915 | andothersincitecn={\str@andotherscn},%将标注中的分开,便于与文献表中的区分 916 | andothersincite={et al\adddot}, 917 | backrefpage = {\str@backrefpage:}, 918 | backrefpages = {\str@backrefpages:}, 919 | in={in\intitlepunct}, 920 | volumecn={\str@volumecn}, 921 | numbercn={\str@numbercn}, 922 | serialcn={\str@serialcn}, 923 | andothersjp={他}, 924 | andotherskr={외}, 925 | andjp={和}, 926 | andkr={和}, 927 | incn={\str@incn\addcolon\addspace}, 928 | mathesiscn={\str@mathesiscn}, 929 | phdthesiscn={\str@phdthesiscn}, 930 | editorscn={\str@editorcn}, 931 | editorcn={\str@editorcn}, 932 | } 933 | 934 | % 935 | % 增加两个命令用于临时的局部的修改本地化字符串 936 | % 其中\setlocalbibstring修改缩写字符串,setlocalbiblstring修改长字符串 937 | % 注意使用时因为是局部修改,因此要将其与需要修改的引用命令放在一个编组符号内 938 | % v1.0t,hzz,20190525 939 | \newcommand{\setlocalbibstring}[2]{% 940 | \csdef{abx@sstr@#1}{#2}} 941 | \newcommand{\setlocalbiblstring}[2]{% 942 | \csdef{abx@lstr@#1}{#2}} 943 | 944 | %===================================================================== 945 | % 动态数据修改 946 | %===================================================================== 947 | % 948 | % 各层次的数据映射和动态修改 949 | % 950 | % 原理方法: 951 | % 1. 进行语言包括中英文判断,并设置和记录,比如记录到userf,usere中 952 | % 2. 增加文献标识符如[M],[J]等,对一些容易混淆的域进行设置以增强兼容性 953 | % 3. \DeclareSourcemap命令对于biblatex3.11以下版本只能出现一次,3.11版开始支持多个 954 | % 4. \DeclarestyleSourcemap在biblatex v3.7版开始可以支持出现多次 955 | % 5. 把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。 956 | % 注意:这里用userf,usere而不是namee,namef,是因为只有把name列表转成域,才能有效读取姓名中的字符, 957 | % 如果用namee,namef,name信息会自动解析,所以就不能为cjk判断提供需要的信息 958 | % 959 | % 不同的文献类型使用相同的驱动输出可以有5种方法: 960 | % 1. 是数据源层的映射,将其它类型转换为某一要使用驱动的类型 961 | % 2. 是样式层映射,也是将其它类型转换为某一要使用驱动的类型 962 | % 3. 是驱动层映射,也是将其它类型转换为某一要使用驱动的类型 963 | % 4. 定义驱动类型别名DeclareBibliographyAlias,将其它类型定义为某一要使用驱动的类型的别名 964 | % 驱动别名定义本质上是做了驱动层映射 965 | % 5. 直接定义不同的类型的驱动,但驱动内容相同。 966 | % 967 | % 关于数据映射和驱动使用的考虑如下: 968 | % 1. 为避免利用biber输出bib文件时的数据变动,尽量不在数据源层映射做类型转换 969 | % 2. 为减少代码量,尽量少做内容相同的不同类型驱动 970 | % 3. 因此类型相关的处理主要在样式层映射、驱动层映射、驱动别名 971 | % 4. 由于biblatex默认做的驱动别名处理可能增加一些信息比如masterthesis转thesis时增加的type 972 | % 可以在样式层映射做某些需要避免这种默认处置的转换 973 | % 5. 当没有避免默认行为的需求时,全部采用驱动别名的方式处理,等价于驱动层的映射 974 | % 975 | % 文献类型和驱动考虑如下: 976 | % 1. 连续出版物及析出文献有其特殊性,因此考虑两类periodical和article 977 | % newpaper映射为article,并以note域做区分特殊处理 978 | % 2. 专著和专著中的析出文献是主要的类型,因此考虑book和inbook 979 | % standard映射为book或inbook,并以note域做区分特殊处理 980 | % collection和proceedings基本与book类似,因此做book驱动别名处理 981 | % incollection和inproceedings基本与inbook类似,因此做inbook驱动别名处理 982 | % 3. 专利类型有其特殊性,考虑patent类型 983 | % 4. 电子资源类型有其特殊性,考虑online类型 984 | % 5. 报告类型与book有点类似,出版项处理与book一样,但有时又要有修改和更新日期 985 | % 因此考虑用一种类型来输出,使用report类型 986 | % 6. 手册/学位论文等类型与book有点类似,但对于出版项处理时,有缺省时,直接省略, 987 | % 同时有version和edition的区别,因此考虑用一种类型来输出,使用manual类型 988 | % 7. 包括报告,学位论文在内的其它所有的类型,都做一个判断,当没有出版项时, 989 | % 且存在网址信息时,将其转换为online类型输出,否则都做为manual类型输出。 990 | % 8. 备选类型misc当存在网址时直接转换为online,由于howpublished域可用于描述 991 | % 更多的信息,因此不存在网址时,独立做一个备选格式 992 | % 9. 出版项主要以如下方式处理: 993 | % (a) location+institution+date 仅用于连续出版物 994 | % (b)publisher+location+date 用于需要完整输出出版项的类型,比如book,collection,proceedings,in*,report 995 | % (c)institution+location+date 用于出版项缺失时不输出的类型,包括manual,thesis,archive等其他类型 996 | % (d)printlist{insitution} 用于电子资源,仅输出出版者或组织,为数据映射方便,本来默认的organization域转换为用insitution输出。 997 | % (e) 不输出,主要用于连续出版物析出的文献 998 | % 10. 日期以如下方式处理: 999 | % date 由于存在biblatex选项,因此通过选项控制,数据源为date解析数据或year 1000 | % urldate 由于存在biblatex选项,因此通过选项控制,输出到日,且用[]包围,数据源为urldate 1001 | % newsdate 用于公告日期,公开日期或新闻日期,输出到日,但无包围符号,数据源为date 1002 | % modifydate 用于更新或修改日期,输出到日,且用()包围,数据源为date或enddate或eventdate 1003 | 1004 | 1005 | \DeclareSourcemap{ 1006 | \maps[datatype=bibtex]{% 1007 | \map{%如果author或者editor或者translator存在,那么设置namea便于后面判断。 1008 | \step[fieldsource=author,final] 1009 | \step[fieldset=namea,origfieldval] 1010 | } 1011 | \map{% 1012 | \step[fieldsource=editor,final] 1013 | \step[fieldset=namea,origfieldval] 1014 | } 1015 | \map{% 1016 | \step[fieldsource=translator,final] 1017 | \step[fieldset=namea,origfieldval] 1018 | } 1019 | \map{%让address和location同步,biblatex中address是location的别名 1020 | %因此输出的时候只有location信息,但处理过程中是可以存在address的。 1021 | %\step[notfield=address,final] 1022 | \step[fieldsource=location,final] 1023 | \step[fieldset=address,origfieldval] 1024 | } 1025 | \map{%让address和location同步 1026 | %\step[notfield=location,final] 1027 | \step[fieldsource=address,final] 1028 | \step[fieldset=location,origfieldval] 1029 | } 1030 | \map{%处理在bib文件用mark标记文献类型标识符的情况 1031 | \step[fieldsource=mark,final] 1032 | \step[fieldset=usera, origfieldval] 1033 | } 1034 | \map{%处理在bib文件中直接给出文献的姓名格式为lowercase的情况 1035 | \step[fieldsource=nameformat,match=lowercase,final] 1036 | \step[fieldset=namefmtid,fieldvalue={1}] 1037 | } 1038 | \map{%处理在bib文件中直接给出文献的姓名格式为givenahead的情况 1039 | \step[fieldsource=nameformat,match=givenahead,final] 1040 | \step[fieldset=namefmtid,fieldvalue={2}] 1041 | } 1042 | \map{%处理在bib文件中直接给出文献的姓名格式为familyahead的情况 1043 | \step[fieldsource=nameformat,match=familyahead,final] 1044 | \step[fieldset=namefmtid,fieldvalue={3}] 1045 | } 1046 | \map{%处理在bib文件中直接给出文献的姓名格式为pinyin的情况 1047 | \step[fieldsource=nameformat,match=pinyin,final] 1048 | \step[fieldset=namefmtid,fieldvalue={4}] 1049 | } 1050 | \map{%处理在bib文件中直接给出文献的姓名格式为全拼的情况 1051 | \step[fieldsource=nameformat,match=quanpin,final] 1052 | \step[fieldset=namefmtid,fieldvalue={6}] 1053 | } 1054 | \map{%根据article确定文献类型标识符 1055 | \pertype{article} 1056 | \step[fieldset=usera, fieldvalue={J}] 1057 | } 1058 | \map{%根据periodical确定文献类型标识符 1059 | \pertype{periodical} 1060 | \step[fieldset=usera, fieldvalue={J}] 1061 | \step[fieldsource=author] %有时会把author和editor混淆,处理后使用editor 1062 | \step[fieldset=editor, origfieldval] 1063 | \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution 1064 | \step[fieldset=institution, origfieldval] 1065 | } 1066 | \map{%根据增加一个新闻报纸的类型newspaper确定文献类型标识符 1067 | \pertype{newspaper} 1068 | \step[fieldset=usera, fieldvalue={N}] 1069 | \step[fieldset=note, fieldvalue=news]%因为没有专门的驱动,记录note方便映射为article后判断 1070 | } 1071 | \map{%对应增加的一个数据库类型database确定文献类型标识符 1072 | \pertype{database} 1073 | \step[fieldset=usera, fieldvalue={DB}] 1074 | \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution 1075 | \step[fieldset=institution, origfieldval] 1076 | } 1077 | \map{%对应增加的一个数据集类型dataset确定文献类型标识符 1078 | \pertype{dataset} 1079 | \step[fieldset=usera, fieldvalue={DS}]% 1080 | \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution 1081 | \step[fieldset=institution, origfieldval] 1082 | } 1083 | \map{%对应增加的一个软件类型software确定文献类型标识符 1084 | \pertype{software} 1085 | \step[fieldset=usera, fieldvalue={CP}] 1086 | \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution 1087 | \step[fieldset=institution, origfieldval] 1088 | } 1089 | \map{%对应增加的一个舆图类型map确定文献类型标识符 1090 | \pertype{map} 1091 | \step[fieldset=usera, fieldvalue={CM}]% 1092 | \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution 1093 | \step[fieldset=institution, origfieldval] 1094 | } 1095 | \map{%对应增加的一个档案类型archive确定文献类型标识符 1096 | \pertype{archive} 1097 | \step[fieldset=usera, fieldvalue={A}] 1098 | \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution 1099 | \step[fieldset=institution, origfieldval] 1100 | } 1101 | \map{%因为misc类型本身就是没有类型,而不像其它文献有明确的类型,所以 1102 | %当misc类型带有网址时,直接将其转换为online类型 1103 | \pertype{misc} 1104 | \step[fieldsource=url,final] 1105 | \step[typesource=misc,typetarget=online] 1106 | } 1107 | \map{%对应增加的一个备选类型misc确定文献类型标识符 1108 | \pertype{misc} 1109 | \step[fieldset=usera, fieldvalue={Z}]% 1110 | } 1111 | \map{ 1112 | \pertype{book} 1113 | \pertype{inbook} 1114 | \step[fieldset=usera, fieldvalue={M}] 1115 | \step[fieldsource=version] %有时会把version和edition混淆,处理后直接用edition 1116 | \step[fieldset=edition, origfieldval] 1117 | } 1118 | \map{%兼容老的standard类型,确定文献类型标识符 1119 | \pertype{standard} 1120 | \step[fieldset=usera, fieldvalue={S}] 1121 | \step[fieldset=note, fieldvalue=standard]%因为没有专门的驱动,记录note方便映射为book和inbook后判断 1122 | } 1123 | \map{ 1124 | \pertype{patent} 1125 | \step[fieldset=usera, fieldvalue={P}] 1126 | } 1127 | \map{ 1128 | \pertype{inproceedings} 1129 | \pertype{conference}%兼容老的conference类型 1130 | \step[fieldset=usera, fieldvalue={C}] 1131 | \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher 1132 | \step[fieldset=publisher, origfieldval] 1133 | } 1134 | \map{ 1135 | \pertype{proceedings} 1136 | \step[fieldset=usera, fieldvalue={C}] 1137 | \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher 1138 | \step[fieldset=publisher, origfieldval] 1139 | } 1140 | \map{ 1141 | \pertype{incollection} 1142 | \step[fieldset=usera, fieldvalue={G}] 1143 | \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher 1144 | \step[fieldset=publisher, origfieldval] 1145 | } 1146 | \map{ 1147 | \pertype{collection} 1148 | \step[fieldset=usera, fieldvalue={G}] 1149 | \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher 1150 | \step[fieldset=publisher, origfieldval] 1151 | } 1152 | \map{ 1153 | \pertype{report} 1154 | \pertype{techreport}%兼容老的techreport类型 1155 | \step[fieldset=usera, fieldvalue={R}] 1156 | \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher 1157 | \step[fieldset=publisher, origfieldval] 1158 | } 1159 | \map{ 1160 | \pertype{thesis} 1161 | \pertype{mastersthesis}%兼容老的mastersthesis和phdthesis类型 1162 | \pertype{phdthesis} 1163 | \step[fieldset=usera, fieldvalue={D}] 1164 | \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution 1165 | \step[fieldset=institution, origfieldval] 1166 | } 1167 | \map{ 1168 | \pertype{online} 1169 | \pertype{electronic}%兼容老的electronic类型 1170 | \pertype{www}%兼容老的www类型 1171 | \step[fieldset=usera, fieldvalue={EB}] 1172 | \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution 1173 | \step[fieldset=institution, origfieldval]%因为online的出版项处理类似手册 1174 | \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性 1175 | \step[fieldset=institution, origfieldval] 1176 | } 1177 | \map{ 1178 | \pertype{manual} 1179 | \step[fieldset=usera, fieldvalue={A}] 1180 | \step[fieldsource=edition]%有时会把version和edition混淆,处理后使用version 1181 | \step[fieldset=version, origfieldval] 1182 | \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution 1183 | \step[fieldset=institution, origfieldval] 1184 | \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性 1185 | \step[fieldset=institution, origfieldval] 1186 | } 1187 | \map{ 1188 | \pertype{unpublished} 1189 | \step[fieldset=usera, fieldvalue={Z}] 1190 | } 1191 | \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 1192 | \step[fieldsource={author}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] 1193 | }% 1194 | \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 1195 | \step[fieldsource={editor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] 1196 | }% 1197 | \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 1198 | \step[fieldsource={translator}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] 1199 | }% 1200 | \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 1201 | \step[fieldsource={bookauthor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] 1202 | }% 1203 | \map{%处理一些用year表示date的情况 1204 | %这样处理将会设置date域,并使得labeldatesource变为空,因为date的前缀为空(如果是urldate,那么labeldatesource就是url)。 1205 | %同时date域会被biblatex自动解析为year,month,day,并且覆盖原来的year信息 1206 | \step[fieldsource=year] 1207 | \step[fieldset=date, origfieldval] 1208 | } 1209 | \map{%将entrykey放入keywords中用于后期使用 1210 | \step[fieldsource=entrykey] 1211 | \step[fieldset=keywords, origfieldval] 1212 | } 1213 | \map{\step[fieldsource=title,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF 1214 | \step[fieldset=userd,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 1215 | } 1216 | \map{% 1217 | \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final] 1218 | \step[fieldset=userd,fieldvalue={russian}]%俄语 1219 | } 1220 | \map{% 1221 | \step[fieldsource=title,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] 1222 | \step[fieldset=userd,fieldvalue={japanese}]%日语 1223 | } %确定形式后可增加类似andotherscn这样的本地化字符串处理 1224 | \map{% 1225 | \step[fieldsource=title,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] 1226 | \step[fieldset=userd,fieldvalue={korean}]%韩语 1227 | } 1228 | \map{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题 1229 | \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]% 1230 | \step[fieldset=userd, fieldvalue={chinese}] 1231 | } 1232 | \map{%将没有设置userd,且存在title域的默认设置为英文 1233 | \step[fieldsource=title,final] 1234 | \step[fieldset=userd,fieldvalue={english}] 1235 | } 1236 | \map{\step[fieldsource=author,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF 1237 | \step[fieldset=userf,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 1238 | } 1239 | \map{% 1240 | \step[fieldsource=author,match=\regexp{[\x{0400}-\x{052F}]},final] 1241 | \step[fieldset=userf,fieldvalue={russian}]%俄语 1242 | } 1243 | \map{% 1244 | \step[fieldsource=author,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] 1245 | \step[fieldset=userf,fieldvalue={japanese}]%日语 1246 | } %确定形式后可增加类似andotherscn这样的本地化字符串处理 1247 | \map{% 1248 | \step[fieldsource=author,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] 1249 | \step[fieldset=userf,fieldvalue={korean}]%韩语 1250 | } 1251 | \map{%作者的中文判断 1252 | \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] 1253 | \step[fieldset=userf, fieldvalue={chinese}] 1254 | } 1255 | \map{%将没有设置userf,且存在author域的默认设置为英文 1256 | \step[fieldsource=author,final] 1257 | \step[fieldset=userf,fieldvalue={english}] 1258 | } 1259 | \map{\step[fieldsource=translator,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF 1260 | \step[fieldset=usere,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 1261 | } 1262 | \map{% 1263 | \step[fieldsource=translator,match=\regexp{[\x{0400}-\x{052F}]},final] 1264 | \step[fieldset=usere,fieldvalue={russian}]%俄语 1265 | } 1266 | \map{% 1267 | \step[fieldsource=translator,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] 1268 | \step[fieldset=usere,fieldvalue={japanese}]%日语 1269 | } %确定形式后可增加类似andotherscn这样的本地化字符串处理 1270 | \map{% 1271 | \step[fieldsource=translator,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] 1272 | \step[fieldset=usere,fieldvalue={korean}]%韩语 1273 | } 1274 | \map{%译者的中文判断 1275 | \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] 1276 | \step[fieldset=usere, fieldvalue={chinese}] 1277 | } 1278 | \map{%将没有设置usere,且存在translator域的默认设置为英文 1279 | \step[fieldsource=translator,final] 1280 | \step[fieldset=usere,fieldvalue={english}] 1281 | } 1282 | \map{\step[fieldsource=editor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF 1283 | \step[fieldset=userc,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 1284 | } 1285 | \map{% 1286 | \step[fieldsource=editor,match=\regexp{[\x{0400}-\x{052F}]},final] 1287 | \step[fieldset=userc,fieldvalue={russian}]%俄语 1288 | } 1289 | \map{% 1290 | \step[fieldsource=editor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] 1291 | \step[fieldset=userc,fieldvalue={japanese}]%日语 1292 | } %确定形式后可增加类似andotherscn这样的本地化字符串处理 1293 | \map{% 1294 | \step[fieldsource=editor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] 1295 | \step[fieldset=userc,fieldvalue={korean}]%韩语 1296 | } 1297 | \map{%编者的中文判断 1298 | \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 1299 | \step[fieldset=userc, fieldvalue={chinese}] 1300 | } 1301 | \map{%将没有设置userc,且存在editor域的默认设置为英文 1302 | \step[fieldsource=editor,final] 1303 | \step[fieldset=userc,fieldvalue={english}] 1304 | } 1305 | \map{\step[fieldsource=bookauthor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF 1306 | \step[fieldset=userb,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 1307 | } 1308 | \map{% 1309 | \step[fieldsource=bookauthor,match=\regexp{[\x{0400}-\x{052F}]},final] 1310 | \step[fieldset=userb,fieldvalue={russian}]%俄语 1311 | } 1312 | \map{% 1313 | \step[fieldsource=bookauthor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] 1314 | \step[fieldset=userb,fieldvalue={japanese}]%日语 1315 | } %确定形式后可增加类似andotherscn这样的本地化字符串处理 1316 | \map{% 1317 | \step[fieldsource=bookauthor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] 1318 | \step[fieldset=userb,fieldvalue={korean}]%韩语 1319 | } 1320 | \map{%编者的中文判断 1321 | \step[fieldsource=bookauthor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 1322 | \step[fieldset=userb, fieldvalue={chinese}] 1323 | } 1324 | \map{%将没有设置userc,且存在editor域的默认设置为英文 1325 | \step[fieldsource=bookauthor,final] 1326 | \step[fieldset=userb,fieldvalue={english}] 1327 | } 1328 | \map{\step[fieldsource=userd,final]%userd存在则用根据标题的语言设定language 1329 | \step[fieldset=language,origfieldval]%本身language存在则不设定 1330 | } 1331 | \map{\step[fieldsource=userf,final]%userd不存在,而userf存在则根据author的语言设定language 1332 | \step[fieldset=language,origfieldval] 1333 | }%如果没有作者和标题,那么剩下的最可能有意义的只有网址了,而网址通常是英文的,因此不用再进一步对其它域进行判断了。 1334 | \map{%将没有设置的language设置成en,即认为不是中文的就是英文的。 1335 | \step[fieldset=language,fieldvalue={english}] 1336 | } 1337 | \map{%一条文献的语言已经设定在language域中,由于出版项相关宏中使用userd判断, 1338 | %所以将一条文献的主体语言设定到userd中,本身前面userd已经设定,但没有处理无标题的情况, 1339 | %这里的处理等价于没有标题时,利用作者的语言设定userd,再没有作者,则默认用英文设定userd 1340 | \step[fieldsource=language] 1341 | \step[fieldset=userd,origfieldval] 1342 | } 1343 | \map{%当文献给出language域时,设置文献要使用的本地化字符串的语言 1344 | %biblatex 3.11及以下版本仅有match是区分大小写的,而3.12版开始用matchi来区分大小,而match不区分 1345 | %这里为兼容3.11及以下版本,所以用一个复杂一点的正则表达式 1346 | \step[fieldsource=language,match=\regexp{(e|E)(n|N)(g|G)(l|L)(i|I)(s|S)(h|H)},final] 1347 | \step[fieldset=langid,fieldvalue={english}] 1348 | \step[fieldset=languageid,fieldvalue={english}] 1349 | \step[fieldset=lansortorder,fieldvalue=\lanenorder] 1350 | } 1351 | \map{ 1352 | \step[fieldsource=language,match=\regexp{(r|R)(u|U)(s|S)(s|S)(i|I)(a|A)(n|N)},final] 1353 | \step[fieldset=langid,fieldvalue={russian}] 1354 | \step[fieldset=languageid,fieldvalue={russian}] 1355 | \step[fieldset=lansortorder,fieldvalue=\lanruorder] 1356 | } 1357 | \map{% 1358 | \step[fieldsource=language,match=\regexp{(f|F)(r|R)(e|E)(n|N)(c|C)(h|H)},final] 1359 | \step[fieldset=langid,fieldvalue={french}] 1360 | \step[fieldset=languageid,fieldvalue={french}] 1361 | \step[fieldset=lansortorder,fieldvalue=\lanfrorder] 1362 | } 1363 | \map{% 1364 | \step[fieldsource=language,match=\regexp{(c|C)(h|H)(i|I)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english, 1365 | \step[fieldset=langid,fieldvalue={english}] 1366 | \step[fieldset=languageid,fieldvalue={chinese}] 1367 | \step[fieldset=lansortorder,fieldvalue=\lancnorder] 1368 | } 1369 | \map{% 1370 | \step[fieldsource=language,match=\regexp{(j|J)(a|A)(p|P)(a|A)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english, 1371 | \step[fieldset=langid,fieldvalue={english}] 1372 | \step[fieldset=languageid,fieldvalue={japanese}] 1373 | \step[fieldset=lansortorder,fieldvalue=\lanjporder] 1374 | } 1375 | \map{% 1376 | \step[fieldsource=language,match=\regexp{(k|K)(o|O)(r|R)(e|E)(a|A)(n|N)},final]%中日韩语目前都用english, 1377 | \step[fieldset=langid,fieldvalue={english}] 1378 | \step[fieldset=languageid,fieldvalue={korean}] 1379 | \step[fieldset=lansortorder,fieldvalue=\lankrorder] 1380 | } 1381 | \map[overwrite]{%bib中abstract和howpublished常出现特殊字符这里做一下预处理。 1382 | \step[fieldsource={howpublished}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}] 1383 | } 1384 | \map[overwrite]{ 1385 | \step[fieldsource={abstract}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}] 1386 | } 1387 | \map[overwrite]{ 1388 | \step[fieldsource={howpublished}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}] 1389 | } 1390 | \map[overwrite]{ 1391 | \step[fieldsource={abstract}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}] 1392 | } 1393 | \map[overwrite]{%&符号处理 1394 | \step[fieldsource={abstract}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] 1395 | } 1396 | \map[overwrite]{%&符号处理 1397 | \step[fieldsource={howpublished}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] 1398 | } 1399 | } 1400 | } 1401 | 1402 | 1403 | % 1404 | % 修改输入的参考文献数据,样式层的操作 1405 | % 1406 | % 原理方法:因为biblatex3.0版的map不使用foreach选项,所以需要一个一个写,以处理特殊字符 1407 | \defversion{3.0}{map}{ 1408 | \DeclareStyleSourcemap{ 1409 | \maps[datatype=bibtex]{ 1410 | \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook, 1411 | %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义 1412 | %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断 1413 | \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook 1414 | \step[typesource=standard, typetarget=inbook, final] 1415 | } 1416 | \map{%剩下的全部映射为book 1417 | \step[typesource=standard, typetarget=book, final] 1418 | } 1419 | % \map{%先于标准样式的driver层映射,以取消type设置 1420 | % \step[typesource=mastersthesis, typetarget=thesis, final] 1421 | % %\step[fieldset=type, fieldvalue=mathesis] 1422 | % } 1423 | % \map{%先于标准样式的driver层映射,以取消type设置 1424 | % \step[typesource=phdthesis, typetarget=thesis, final] 1425 | % %\step[fieldset=type, fieldvalue=phdthesis] 1426 | % } 1427 | \map{%先于标准样式的driver层映射,以取消type设置 1428 | \step[typesource=techreport, typetarget=report, final] 1429 | %\step[fieldset=type, fieldvalue=techreport] 1430 | } 1431 | \map{% 1432 | \pertype{report} 1433 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1434 | \step[fieldset=location,fieldvalue={}] 1435 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1436 | %3.7以上版本用notfield 1437 | %\step[notfield=address,final]%当address不存在则继续 1438 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1439 | \step[typesource=report,typetarget=online] 1440 | \step[fieldset=note,fieldvalue={report}] 1441 | } 1442 | \map{% 1443 | \pertype{thesis} 1444 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1445 | \step[fieldset=location,fieldvalue={}] 1446 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1447 | %3.7以上版本用notfield 1448 | %\step[notfield=address,final]%当address不存在则继续 1449 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1450 | \step[typesource=thesis,typetarget=online] 1451 | } 1452 | \map{% 1453 | \pertype{manual} 1454 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1455 | \step[fieldset=location,fieldvalue={}] 1456 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1457 | %3.7以上版本用notfield 1458 | %\step[notfield=address,final]%当address不存在则继续 1459 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1460 | \step[typesource=manual,typetarget=online] 1461 | } 1462 | \map{% 1463 | \pertype{unpublished} 1464 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1465 | \step[fieldset=location,fieldvalue={}] 1466 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1467 | %3.7以上版本用notfield 1468 | %\step[notfield=address,final]%当address不存在则继续 1469 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1470 | \step[typesource=unpublished,typetarget=online] 1471 | } 1472 | \map{% 1473 | \pertype{database} 1474 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1475 | \step[fieldset=location,fieldvalue={}] 1476 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1477 | %3.7以上版本用notfield 1478 | %\step[notfield=address,final]%当address不存在则继续 1479 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1480 | \step[typesource=databasetypetarget=online] 1481 | } 1482 | \map{% 1483 | \pertype{dataset} 1484 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1485 | \step[fieldset=location,fieldvalue={}] 1486 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1487 | %3.7以上版本用notfield 1488 | %\step[notfield=address,final]%当address不存在则继续 1489 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1490 | \step[typesource=dataset,typetarget=online] 1491 | } 1492 | \map{% 1493 | \pertype{software} 1494 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1495 | \step[fieldset=location,fieldvalue={}] 1496 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1497 | %3.7以上版本用notfield 1498 | %\step[notfield=address,final]%当address不存在则继续 1499 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1500 | \step[typesource=software,typetarget=online] 1501 | } 1502 | \map{% 1503 | \pertype{map} 1504 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1505 | \step[fieldset=location,fieldvalue={}] 1506 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1507 | %3.7以上版本用notfield 1508 | %\step[notfield=address,final]%当address不存在则继续 1509 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1510 | \step[typesource=map,typetarget=online] 1511 | } 1512 | \map{% 1513 | \pertype{archive} 1514 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1515 | \step[fieldset=location,fieldvalue={}] 1516 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1517 | %3.7以上版本用notfield 1518 | %\step[notfield=address,final]%当address不存在则继续 1519 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1520 | \step[typesource=archive,typetarget=online] 1521 | } 1522 | \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确) 1523 | \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸 1524 | \step[fieldset=keywords, fieldvalue={,}, append] 1525 | \step[fieldset=keywords, origfieldval, append] 1526 | } 1527 | \map[overwrite]{%title,booktitle,journaltitle,journal,publisher,address,location,institution,organization 1528 | \step[fieldsource={title}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] 1529 | } 1530 | \map[overwrite]{ 1531 | \step[fieldsource={booktitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] 1532 | } 1533 | \map[overwrite]{ 1534 | \step[fieldsource={journaltitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] 1535 | } 1536 | \map[overwrite]{ 1537 | \step[fieldsource={journal}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] 1538 | } 1539 | \map[overwrite]{ 1540 | \step[fieldsource={publisher}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] 1541 | } 1542 | \map[overwrite]{ 1543 | \step[fieldsource={address}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] 1544 | } 1545 | \map[overwrite]{ 1546 | \step[fieldsource={location}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] 1547 | } 1548 | \map[overwrite]{%&符号处理 1549 | \step[fieldsource={institution}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] 1550 | } 1551 | \map[overwrite]{ 1552 | \step[fieldsource={booktitle}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}] 1553 | } 1554 | \map[overwrite]{ 1555 | \step[fieldsource={booktitle}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}] 1556 | } 1557 | } 1558 | } 1559 | } 1560 | 1561 | % 1562 | % 修改输入的参考文献数据,样式层的操作 1563 | % 1564 | % 原理方法:biblatex3.4以上版本 1565 | \defversion{3.4}{map}{ 1566 | \DeclareStyleSourcemap{ 1567 | \maps[datatype=bibtex]{ 1568 | \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook, 1569 | %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义 1570 | %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断 1571 | \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook 1572 | \step[typesource=standard, typetarget=inbook, final] 1573 | } 1574 | \map{%剩下的全部映射为book 1575 | \step[typesource=standard, typetarget=book, final] 1576 | } 1577 | % \map{%先于标准样式的driver层映射,以取消type设置 1578 | % \step[typesource=mastersthesis, typetarget=thesis, final] 1579 | % %\step[fieldset=type, fieldvalue=mathesis] 1580 | % } 1581 | % \map{%先于标准样式的driver层映射,以取消type设置 1582 | % \step[typesource=phdthesis, typetarget=thesis, final] 1583 | % %\step[fieldset=type, fieldvalue=phdthesis] 1584 | % } 1585 | \map{%先于标准样式的driver层映射,以取消type设置 1586 | \step[typesource=techreport, typetarget=report, final] 1587 | %\step[fieldset=type, fieldvalue=techreport] 1588 | } 1589 | \map{% 1590 | \pertype{report} 1591 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1592 | \step[fieldset=location,fieldvalue={}] 1593 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1594 | %3.7以上版本用notfield 1595 | %\step[notfield=address,final]%当address不存在则继续 1596 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1597 | \step[typesource=report,typetarget=online] 1598 | \step[fieldset=note,fieldvalue={report}] 1599 | } 1600 | \map{% 1601 | \pertype{thesis} 1602 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1603 | \step[fieldset=location,fieldvalue={}] 1604 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1605 | %3.7以上版本用notfield 1606 | %\step[notfield=address,final]%当address不存在则继续 1607 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1608 | \step[typesource=thesis,typetarget=online] 1609 | } 1610 | \map{% 1611 | \pertype{manual} 1612 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1613 | \step[fieldset=location,fieldvalue={}] 1614 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1615 | %3.7以上版本用notfield 1616 | %\step[notfield=address,final]%当address不存在则继续 1617 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1618 | \step[typesource=manual,typetarget=online] 1619 | } 1620 | \map{% 1621 | \pertype{unpublished} 1622 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1623 | \step[fieldset=location,fieldvalue={}] 1624 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1625 | %3.7以上版本用notfield 1626 | %\step[notfield=address,final]%当address不存在则继续 1627 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1628 | \step[typesource=unpublished,typetarget=online] 1629 | } 1630 | \map{% 1631 | \pertype{database} 1632 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1633 | \step[fieldset=location,fieldvalue={}] 1634 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1635 | %3.7以上版本用notfield 1636 | %\step[notfield=address,final]%当address不存在则继续 1637 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1638 | \step[typesource=databasetypetarget=online] 1639 | } 1640 | \map{% 1641 | \pertype{dataset} 1642 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1643 | \step[fieldset=location,fieldvalue={}] 1644 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1645 | %3.7以上版本用notfield 1646 | %\step[notfield=address,final]%当address不存在则继续 1647 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1648 | \step[typesource=dataset,typetarget=online] 1649 | } 1650 | \map{% 1651 | \pertype{software} 1652 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1653 | \step[fieldset=location,fieldvalue={}] 1654 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1655 | %3.7以上版本用notfield 1656 | %\step[notfield=address,final]%当address不存在则继续 1657 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1658 | \step[typesource=software,typetarget=online] 1659 | } 1660 | \map{% 1661 | \pertype{map} 1662 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1663 | \step[fieldset=location,fieldvalue={}] 1664 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1665 | %3.7以上版本用notfield 1666 | %\step[notfield=address,final]%当address不存在则继续 1667 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1668 | \step[typesource=map,typetarget=online] 1669 | } 1670 | \map{% 1671 | \pertype{archive} 1672 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1673 | \step[fieldset=location,fieldvalue={}] 1674 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1675 | %3.7以上版本用notfield 1676 | %\step[notfield=address,final]%当address不存在则继续 1677 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1678 | \step[typesource=archive,typetarget=online] 1679 | } 1680 | \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确) 1681 | \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸 1682 | \step[fieldset=keywords, fieldvalue={,}, append] 1683 | \step[fieldset=keywords, origfieldval, append] 1684 | } 1685 | \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ 1686 | \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}] 1687 | } 1688 | \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ 1689 | \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}] 1690 | } 1691 | \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,% 1692 | address,location,institution,organization}]{ 1693 | \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] 1694 | } 1695 | } 1696 | } 1697 | } 1698 | 1699 | \iftoggle{iftlfive}% 1700 | {\switchversion{3.0}{map}}%%当采用biblatex<=3.2版本时 1701 | {\switchversion{3.4}{map}}%%当采用3.3<=biblatex版本时 1702 | 1703 | 1704 | % 1705 | % 不同语言分集调整的实现方式 1706 | % 1707 | % 原理方法:利用样式层的动态数据修改lansortorder域来实现排序 1708 | \def\dealsortlan{ 1709 | \DeclareStyleSourcemap{ 1710 | \maps[datatype=bibtex]{ 1711 | \map[overwrite]{%当文献给出language域时,设置文献要使用的本地化字符串的语言 1712 | \step[fieldsource=language,match=english,final] 1713 | \step[fieldset=lansortorder,fieldvalue=\lanenorder] 1714 | } 1715 | \map[overwrite]{ 1716 | \step[fieldsource=language,match=russian,final] 1717 | \step[fieldset=lansortorder,fieldvalue=\lanruorder] 1718 | } 1719 | \map[overwrite]{% 1720 | \step[fieldsource=language,match=french,final] 1721 | \step[fieldset=lansortorder,fieldvalue=\lanfrorder] 1722 | } 1723 | \map[overwrite]{% 1724 | \step[fieldsource=language,match=chinese,final]%中日韩语目前都用english, 1725 | \step[fieldset=lansortorder,fieldvalue=\lancnorder] 1726 | } 1727 | \map[overwrite]{% 1728 | \step[fieldsource=language,match=japanese,final]%中日韩语目前都用english, 1729 | \step[fieldset=lansortorder,fieldvalue=\lanjporder] 1730 | } 1731 | \map[overwrite]{% 1732 | \step[fieldsource=language,match=korean,final]%中日韩语目前都用english, 1733 | \step[fieldset=lansortorder,fieldvalue=\lankrorder] 1734 | } 1735 | } 1736 | } 1737 | } 1738 | 1739 | % 1740 | %驱动别名等价于驱动层映射 1741 | % 1742 | \DeclareBibliographyAlias{newspaper}{article}% 1743 | \DeclareBibliographyAlias{inproceedings}{inbook}%会议论文文献类型驱动 1744 | \DeclareBibliographyAlias{conference}{inbook}%会议论文文献类型驱动 1745 | \DeclareBibliographyAlias{incollection}{inbook}%文集中析出文献类型驱动 1746 | \DeclareBibliographyAlias{collection}{book}%%文集类型驱动 1747 | \DeclareBibliographyAlias{proceedings}{book}%会议论文集文献类型驱动 1748 | \DeclareBibliographyAlias{thesis}{manual}%学位论文驱动 1749 | \DeclareBibliographyAlias{unpublished}{manual}%其它类型驱动 1750 | \DeclareBibliographyAlias{database}{manual} 1751 | \DeclareBibliographyAlias{dataset}{manual} 1752 | \DeclareBibliographyAlias{software}{manual} 1753 | \DeclareBibliographyAlias{map}{manual} 1754 | \DeclareBibliographyAlias{archive}{manual} 1755 | 1756 | %===================================================================== 1757 | % 设置排序格式 1758 | %===================================================================== 1759 | % 1760 | % 排序格式,用降序,及userb域,针对biblatex3.7及以下版本 1761 | % 1762 | \defversion{3.7}{sort}{%这是3.4版的,3.7版略有差异,但不大,后面有注释 1763 | \DeclareSortingScheme{gb7714-2015}{ 1764 | \sort{ 1765 | \field{presort} 1766 | } 1767 | %\sort[final]{ 1768 | %\field{sortkey} 1769 | %} 1770 | \sort{ 1771 | \field{lansortorder}%language 1772 | } 1773 | \sort{ 1774 | \field{sortkey} 1775 | } 1776 | \sort{%[direction=descending] 1777 | \field{sortname} 1778 | \field{author} 1779 | \field{editor} 1780 | \field{translator} 1781 | } 1782 | \sort{ 1783 | \field{sortyear} 1784 | \field{year} 1785 | } 1786 | \sort{ 1787 | \field{sorttitle} 1788 | \field{title} 1789 | } 1790 | \sort{ 1791 | \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume} 1792 | \literal{0000}%3.7版是\literal{0} 1793 | } 1794 | } 1795 | 1796 | %降序的nyt 1797 | \DeclareSortingScheme{gbnytd}{ 1798 | \sort{ 1799 | \field{presort} 1800 | } 1801 | %\sort[final]{ 1802 | %\field{sortkey} 1803 | %} 1804 | \sort{ 1805 | \field{lansortorder}%language 1806 | } 1807 | \sort[direction=descending]{ 1808 | \field{sortkey} 1809 | } 1810 | \sort[direction=descending]{ 1811 | \field{sortname} 1812 | \field{author} 1813 | \field{editor} 1814 | \field{translator} 1815 | } 1816 | \sort{ 1817 | \field{sortyear} 1818 | \field{year} 1819 | } 1820 | \sort{ 1821 | \field{sorttitle} 1822 | \field{title} 1823 | } 1824 | \sort{ 1825 | \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume} 1826 | \literal{0000}%3.7版是\literal{0} 1827 | } 1828 | } 1829 | 1830 | %降序的ynt 1831 | \DeclareSortingScheme{gbyntd}{ 1832 | \sort{ 1833 | \field{presort} 1834 | } 1835 | %\sort[final]{ 1836 | %\field{sortkey} 1837 | %} 1838 | \sort{ 1839 | \field{lansortorder}%language 1840 | } 1841 | \sort[direction=descending]{ 1842 | \field{sortyear} 1843 | \field{year} 1844 | } 1845 | \sort{ 1846 | \field{sortkey} 1847 | } 1848 | \sort{ 1849 | \field{sortname} 1850 | \field{author} 1851 | \field{editor} 1852 | \field{translator} 1853 | } 1854 | \sort{ 1855 | \field{sorttitle} 1856 | \field{title} 1857 | } 1858 | \sort{ 1859 | \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume} 1860 | \literal{0000}%3.7版是\literal{0} 1861 | } 1862 | } 1863 | 1864 | %升序的ynt 1865 | \DeclareSortingScheme{gbynta}{ 1866 | \sort{ 1867 | \field{presort} 1868 | } 1869 | %\sort[final]{ 1870 | %\field{sortkey} 1871 | %} 1872 | \sort{ 1873 | \field{lansortorder}%language 1874 | } 1875 | \sort{ 1876 | \field{sortyear} 1877 | \field{year} 1878 | } 1879 | \sort{ 1880 | \field{sortkey} 1881 | } 1882 | \sort{ 1883 | \field{sortname} 1884 | \field{author} 1885 | \field{editor} 1886 | \field{translator} 1887 | } 1888 | \sort{ 1889 | \field{sorttitle} 1890 | \field{title} 1891 | } 1892 | \sort{ 1893 | \field[padside=left,padwidth=4,padchar=0]{volume}%3.7版是\field{volume} 1894 | \literal{0000}%3.7版是\literal{0} 1895 | } 1896 | } 1897 | } 1898 | 1899 | 1900 | % 1901 | % 排序格式,用降序,及userb域,针对biblatex3.8及以上版本 1902 | % 1903 | \defversion{3.8}{sort}{ 1904 | \DeclareSortingTemplate{gb7714-2015}{ 1905 | \sort{ 1906 | \field{presort} 1907 | } 1908 | %\sort[final]{ 1909 | %\field{sortkey} 1910 | %} 1911 | \sort{ 1912 | \field{lansortorder}%language 1913 | } 1914 | \sort{ 1915 | \field{sortkey} 1916 | } 1917 | \sort{%[direction=descending] 1918 | \field{sortname} 1919 | \field{author} 1920 | \field{editor} 1921 | \field{translator} 1922 | } 1923 | \sort{ 1924 | \field{sortyear} 1925 | \field{year} 1926 | } 1927 | \sort{ 1928 | \field{sorttitle} 1929 | \field{title} 1930 | } 1931 | \sort{ 1932 | \field{volume} 1933 | \literal{0} 1934 | } 1935 | } 1936 | 1937 | %降序的nyt 1938 | \DeclareSortingTemplate{gbnytd}{ 1939 | \sort{ 1940 | \field{presort} 1941 | } 1942 | % \sort[final]{ 1943 | % \field{sortkey} 1944 | % } 1945 | \sort{ 1946 | \field{lansortorder}%language 1947 | } 1948 | \sort[direction=descending]{ 1949 | \field{sortkey} 1950 | } 1951 | \sort[direction=descending]{% 1952 | \field{sortname} 1953 | \field{author} 1954 | \field{editor} 1955 | \field{translator} 1956 | } 1957 | \sort{ 1958 | \field{sortyear} 1959 | \field{year} 1960 | } 1961 | \sort{ 1962 | \field{sorttitle} 1963 | \field{title} 1964 | } 1965 | \sort{ 1966 | \field{volume} 1967 | \literal{0} 1968 | } 1969 | } 1970 | 1971 | %降序的ynt 1972 | \DeclareSortingTemplate{gbyntd}{ 1973 | \sort{ 1974 | \field{presort} 1975 | } 1976 | % \sort[final]{ 1977 | % \field{sortkey} 1978 | % } 1979 | \sort{ 1980 | \field{lansortorder}%language 1981 | } 1982 | \sort[direction=descending]{ 1983 | \field{sortyear} 1984 | \field{year} 1985 | } 1986 | \sort{ 1987 | \field{sortkey} 1988 | } 1989 | \sort{% 1990 | \field{sortname} 1991 | \field{author} 1992 | \field{editor} 1993 | \field{translator} 1994 | } 1995 | \sort{ 1996 | \field{sorttitle} 1997 | \field{title} 1998 | } 1999 | \sort{ 2000 | \field{volume} 2001 | \literal{0} 2002 | } 2003 | } 2004 | 2005 | %升序的ynt 2006 | \DeclareSortingTemplate{gbynta}{ 2007 | \sort{ 2008 | \field{presort} 2009 | } 2010 | % \sort[final]{ 2011 | % \field{sortkey} 2012 | % } 2013 | \sort{ 2014 | \field{lansortorder}%language 2015 | } 2016 | \sort{%[direction=ascending] 2017 | \field{sortyear} 2018 | \field{year} 2019 | } 2020 | \sort{ 2021 | \field{sortkey} 2022 | } 2023 | \sort{% 2024 | \field{sortname} 2025 | \field{author} 2026 | \field{editor} 2027 | \field{translator} 2028 | } 2029 | \sort{ 2030 | \field{sorttitle} 2031 | \field{title} 2032 | } 2033 | \sort{ 2034 | \field{volume} 2035 | \literal{0} 2036 | } 2037 | } 2038 | } 2039 | 2040 | 2041 | \ifboolexpr{ 2042 | test {\iftoggle{iftlfive}} 2043 | or 2044 | test {\iftoggle{iftlsix}} 2045 | or 2046 | test {\iftoggle{iftlseven}}%biblatex<=3.7 2047 | }{\switchversion{3.7}{sort}}{\switchversion{3.8}{sort}}%3.8<=biblatex 2048 | 2049 | %===================================================================== 2050 | % 参考文献表环境 2051 | %===================================================================== 2052 | % 2053 | % 列表格式 2054 | % 2055 | % 增加一个\bibitemindent尺寸用于控制list环境的itemindent 2056 | % v1.0l,20180615,hzz 2057 | % v1.0t,20200319,hzz,增加尺寸\biblabelextend使某些字体下标签宽度不足时可增加标签宽度 2058 | \setlength{\bibhang}{\biblabelsep}% 2059 | \newlength{\bibitemindent} 2060 | \setlength{\bibitemindent}{0pt} 2061 | \newlength{\biblabelextend} 2062 | \setlength{\biblabelextend}{0pt} 2063 | 2064 | 2065 | \defbibenvironment{bibliography} 2066 | {\list 2067 | {\printtext[labelnumberwidth]{% 2068 | \printfield{labelprefix}% 2069 | \printfield{labelnumber}}} 2070 | {\addtolength{\labelnumberwidth}{\biblabelextend}% 2071 | \setlength{\labelwidth}{\labelnumberwidth}% 2072 | \setlength{\labelsep}{\biblabelsep}% 2073 | \setlength{\leftmargin}{\bibhang}% 2074 | \addtolength{\leftmargin}{\labelnumberwidth}% 2075 | \setlength{\itemindent}{\bibitemindent}% 2076 | \setlength{\itemsep}{\bibitemsep}% 2077 | \setlength{\parsep}{\bibparsep}}% 2078 | \renewcommand*{\makelabel}[1]{\hss##1}} 2079 | {\endlist} 2080 | {\item} 2081 | 2082 | % 2083 | % 顺序编码制-标签对齐方式处理 2084 | % 2085 | % 原理方法:利用选项提供的计数器数值做选择 2086 | % 左对齐,右对齐为list环境下的处理,此时list环境的\labelwidth只能设置一个,是最宽标签的宽度 2087 | % 项对齐则是在段落环境下做的处理。 2088 | % 左对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距可变 2089 | % 右对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距相等,标签与页边距离可变 2090 | % 项对齐时,序号标签贴在页边,序号标签与参考文献项内容的间距相等 2091 | % 修改序号标签格式为: 2092 | % \DeclareFieldFormat{shorthandwidth}{\mkbibbrackets{#1}} %源来自numeric.BBX 2093 | % \DeclareFieldFormat{labelnumberwidth}{\ttfamily\mkbibbrackets{#1}\hfill} 2094 | \DeclareFieldFormat{labelnumberwidth}{% 2095 | \ifcase\value{gbalignlabel}%右对齐,整个标签为右对齐 2096 | \mkgbnumlabel{#1}% 2097 | \or%左对齐,整个标签为左对齐 2098 | \mkgbnumlabel{#1}\hfill% 2099 | \or%中间对齐,比如:序号数字居于[]中间 2100 | \hfil\mkgbnumlabel{\hfill#1\hfill}\hfil% 2101 | \fi} 2102 | 2103 | % 2104 | % 修改序号标签格式为以各条参文献为基础进行对齐的方式,即序号与条目内容间隔相等的方式。 2105 | \def\setaligngbstyle{% 2106 | \def\blx@bibitem##1{% 2107 | \blx@ifdata{##1} 2108 | {\begingroup 2109 | \blx@getdata{##1}% 2110 | \blx@bibcheck 2111 | \iftoggle{blx@skipentry}{}{% 2112 | \blx@setdefaultrefcontext{##1}% 2113 | \global\let\blx@noitem\@empty 2114 | \blx@setoptions@type\abx@field@entrytype 2115 | \blx@setoptions@entry 2116 | \blx@thelabelnumber 2117 | \addtocounter{instcount}\@ne 2118 | \blx@initsep 2119 | \blx@namesep 2120 | \csuse{blx@item@\blx@theenv}\relax 2121 | % \blx@initsep %移动到上面去,恢复bibnamesep等的作用机制 2122 | % \blx@namesep 2123 | \csuse{blx@hook@bibitem}% 2124 | \blx@execute 2125 | \blx@initunit 2126 | \blx@anchor 2127 | \blx@beglangbib 2128 | \bibsentence 2129 | \blx@pagetracker 2130 | \blx@driver\abx@field@entrytype 2131 | \blx@postpunct 2132 | \blx@endlangbib}% 2133 | \par\endgroup}%这里增加了一个\par 2134 | {}} 2135 | \newlength{\lengthid} 2136 | \newlength{\lengthlw} 2137 | \newcommand{\itemcmd}{% 2138 | \settowidth{\lengthid}{\mkgbnumlabel{\printfield{labelnumber}}} 2139 | \addtolength{\lengthid}{\biblabelsep} 2140 | \setlength{\lengthlw}{\textwidth} 2141 | \addtolength{\lengthlw}{-\lengthid} 2142 | \addvspace{\bibitemsep}%恢复\bibitemsep的作用 2143 | %\parshape 2 0em \textwidth \lengthid \lengthlw 2144 | \hangindent\lengthid 2145 | \mkgbnumlabel{\printfield{labelnumber}}% 2146 | \hspace{\biblabelsep}} 2147 | % 2148 | % 简单的段落环境 2149 | \defbibenvironment{bibliography} 2150 | {\begingroup\setlength{\parindent}{0em}} 2151 | {\endgroup} 2152 | {\itemcmd}} 2153 | 2154 | % 2155 | % 增加一个作者年制文献表格式的文献表输出环境。 2156 | % 20210411,hzz,v1.0x 2157 | \def\setaligngbstyleay{% 2158 | \setlength{\bibhang}{1em} 2159 | \setlength{\bibitemindent}{-\bibhang} 2160 | \setlength{\bibitemsep}{4.5pt} 2161 | \defbibenvironment{bibliography} 2162 | {\list 2163 | {} 2164 | {\setlength{\leftmargin}{\bibhang}% 2165 | \setlength{\itemindent}{\bibitemindent}% 2166 | \setlength{\itemsep}{\bibitemsep}% 2167 | \setlength{\parsep}{\bibparsep}}} 2168 | {\endlist} 2169 | {\item} 2170 | } 2171 | 2172 | %===================================================================== 2173 | % 设置单元或块等的标点 2174 | %===================================================================== 2175 | \renewrobustcmd*{\bibinithyphendelim}{\addhighpenspace}%用于处理姓名中名部分存在-的情况,比如ZHANG Yu-xin 2176 | \renewcommand*{\subtitlepunct}{\addcolon\addspace} %修改标题和其它标题信息间的标点,来源biblatex.def, 2177 | % 2178 | % 利用set实现的多语言文献不同语言间的分隔符 2179 | % 20170411,双语之间用newline替换par,避免采用gb7714-2015的项对齐方式第二语言间分段导致没有缩进 2180 | % 2181 | % 原理方法:set方法可以参考3.11.5 Entry Sets,4.11.1 Entry Sets 2182 | % 这里调整一下两种语言参考文献的间隔,源来自biblatex.def 2183 | \renewcommand*{\entrysetpunct}{\adddot\newline\nobreak} 2184 | \renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%%页码引用格式的修改,修改为用冒号 2185 | % 2021.08.19,增加出版地和出版社之间的标点,hzz 2186 | \newcommand{\publocpunct}{\addcolon\addspace}%出版项中:出版社地址后面的标点 2187 | %\renewcommand{\relateddelim}{}%\par 2188 | 2189 | %===================================================================== 2190 | % 修改域的格式,重定义域的输出宏 2191 | %===================================================================== 2192 | % 2193 | % 新增文献类型标识符的格式 2194 | % []前的nobreak,从GB4.1节的例子看不应该加,所以去掉 2195 | % 但因为考虑到cjk字符和[]之间可能添加空格,所以仍然加上 2196 | % 而[]中间的内容,从4.6.2节的例子看也是可以分割的,因此内部的nobreak也可以去掉 2197 | % 2198 | \DeclareFieldFormat{gbtypeflag}{% 2199 | \iftoggle{bbx:gbmedium}% 2200 | {\iftoggle{bbx:url}% 2201 | {\iffieldundef{url}%当存在url时,增加一个OL标识符 2202 | {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% 2203 | {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% 2204 | }% 2205 | {\ifentrytype{online}% 2206 | {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% 2207 | {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% 2208 | }}% 2209 | {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{]}}% 2210 | } 2211 | 2212 | % 2213 | % 新增用于报纸的文献类型标识符的格式 2214 | % 2215 | \DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper 2216 | \iftoggle{bbx:gbmedium}% 2217 | {\iftoggle{bbx:url}% 2218 | {\iffieldundef{url}%当存在url时,增加一个OL标识符 2219 | {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% 2220 | {\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}% 2221 | }% 2222 | {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% 2223 | }{\nobreak\printtext{[}\nobreak N\printtext{]}\nobreak}% 2224 | } 2225 | 2226 | % 2227 | % 新增用于标准的文献类型标识符的格式 2228 | % 2229 | \DeclareFieldFormat{gbtypeflags}{%用于标准standard 2230 | \iftoggle{bbx:gbmedium}% 2231 | {\iftoggle{bbx:url}% 2232 | {\iffieldundef{url}%当存在url时,增加一个OL标识符 2233 | {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% 2234 | {\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}% 2235 | }% 2236 | {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% 2237 | }{\nobreak\printtext{[}\nobreak S\printtext{]}\nobreak}% 2238 | } 2239 | 2240 | % 2241 | % 重设title等参考文献信息的输出格式 2242 | % 2243 | % 原理方法:修改来自biblatex.def文件的原格式 2244 | \newcommand{\bibtitlefont}{} 2245 | \newcommand{\bibauthorfont}{} 2246 | \newcommand{\bibpubfont}{} 2247 | 2248 | \DeclareFieldFormat{title}{#1\adddot\addthinspace} 2249 | \DeclareFieldFormat{journaltitle}{#1\isdot}%添加\isdot用于缩写名带点情况,将其转换为缩写点,便于标点的追踪 2250 | \DeclareFieldFormat{issuetitle}{#1} 2251 | \DeclareFieldFormat{maintitle}{#1} 2252 | \DeclareFieldFormat{booktitle}{#1} 2253 | \DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 2254 | [article,patent,thesis,unpublished] 2255 | {title}{#1\adddot\addthinspace}%\mkbibquote{#1\isdot} 2256 | \DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 2257 | [inbook,incollection,inproceedings] 2258 | {title}{#1}%\nopunct\unspace 2259 | \DeclareFieldFormat{url}{\url{#1}} %%url相关输出,url域修改如本行,源来自biblatex.def 2260 | \def\UrlFont{\rmfamily}%设置url字体为roman字体%\ttfamily 2261 | %\urlstyle{rm} %使用这句也一样 2262 | \setcounter{biburlnumpenalty}{100} %让url可以在数字后断行 2263 | \setcounter{biburlucpenalty}{100} %让url可以在大写字母后断行 2264 | \setcounter{biburllcpenalty}{100} %让url可以在小写字母后断行 2265 | \DeclareFieldFormat{doi}{% 2266 | \rmfamily{DOI}\addcolon\space 2267 | \ifhyperref 2268 | {\href{https://doi.org/#1}{\nolinkurl{#1}}} 2269 | {\nolinkurl{#1}}} 2270 | % 2271 | % 标题的字母大小写格式修改 2272 | % 2273 | % 注意:修改标题的字母大小写,不能用前面的title的格式而要用titlecase 2274 | % 因为titlecase is applied to the contents of the field directly,title is not 2275 | %\DeclareFieldFormat{titlecase}{\MakeCapital#1}%重设标题格式,将其修改为首字母大写 2276 | \DeclareFieldFormat{titlecase}{\iftoggle{bbx:titlelink}{% 2277 | \iffieldundef{url}{\MakeCapital#1}{% 2278 | \href{\thefield{url}}{#1}}}{\MakeCapital#1}}%重设标题格式,将其修改为首字母大写 2279 | \DeclareFieldFormat{pages}{#1}%去掉前面引导页码的pp.等字符,\mkpageprefix[bookpagination]{#1} 2280 | \DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{-}}%将页码间隔符替换会英文的短横线 2281 | \DefineBibliographyExtras{russian}{\renewcommand*{\bibrangedash}{-}}%将页码间隔符替换会英文的短横线 2282 | 2283 | \def\execgbfdfmtstd{%恢复到标准样式的设置 2284 | \DeclareFieldFormat{title}{\mkbibemph{##1}} 2285 | \DeclareFieldFormat 2286 | [article,inbook,incollection,inproceedings,patent,thesis,unpublished] 2287 | {title}{\mkbibquote{##1\isdot}} 2288 | \DeclareFieldFormat 2289 | [suppbook,suppcollection,suppperiodical] 2290 | {title}{##1} 2291 | \DeclareFieldFormat{journaltitle}{\mkbibemph{##1}} 2292 | \DeclareFieldFormat{issuetitle}{\mkbibemph{##1}} 2293 | \DeclareFieldFormat{maintitle}{\mkbibemph{##1}} 2294 | \DeclareFieldFormat{booktitle}{\mkbibemph{##1}} 2295 | \DeclareFieldFormat{url}{\mkbibacro{URL}\addcolon\space\url{##1}} 2296 | \DeclareFieldFormat{titlecase}{##1} 2297 | \DeclareFieldFormat{pages}{\mkpageprefix[bookpagination]{##1}} 2298 | } 2299 | 2300 | % 2301 | % 文献标题后的标点问题 2302 | % v1.0k,20180405,为texlive2017以上版本中的beamer兼容性做的处理,Hu Zhenzhen 2303 | % 2304 | % 原理方法:如下代码处理texlive2017以上版本中,beamer中文献的标题后出现两个点的情况: 2305 | % texlive2017以上的beamer中对macro{title}做了patch,正常情况下不会出现两个点的情况,但由于 2306 | % 之前为了处理texlive2015,2016下的title格式添加了adddot,导致出现两个点的情况,而且也影响 2307 | % 析出文献的//符号的输出,因此再次对macro{title}做patch消除beamer中做apptocmd时添加的\newunitpunct 2308 | \ifboolexpr{% 2309 | test{\iftoggle{iftlfive}} 2310 | or 2311 | test{\iftoggle{iftlsix}} 2312 | }{}% 2313 | {%texlive 2017对应iftlseven以上版本 2314 | \@ifclassloaded{beamer}{ 2315 | \DeclareFieldFormat{title}{#1}% 2316 | \DeclareFieldFormat[article,patent,thesis,unpublished]{title}{#1} 2317 | \AtBeginDocument{% 2318 | \patchcmd{\abx@macro@title}{\newunitpunct}{}{}{}}}{} 2319 | } 2320 | 2321 | 2322 | % 2323 | % 修改译者位置格式 2324 | % v1.0w,20210401,hzz,增加对英文等其它语言译者的处理 2325 | % 2326 | % 原理方法:修改来自biblatex.def文件的bytranslator+others宏的格式 2327 | \renewbibmacro*{bytranslator+others}{\bibauthorfont% 2328 | \ifnameundef{translator} 2329 | {} 2330 | {\iffieldequalstr{usere}{chinese}{}{\usebibmacro{bytranslator+othersstrg}} 2331 | %\setunit{\addspace}% 2332 | \printnames[bytranslator]{translator}% 2333 | \clearname{translator}% 2334 | %从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理 2335 | %比如生成cotranslator等用于调用cotranslator所代表的当地化字符串 2336 | \iffieldequalstr{usere}{chinese}{\usebibmacro{bytranslator+othersstrg}}{}%“译”的位置换到下面来,即放到译者后面。 2337 | %\setunit{\addspace}% 2338 | \newunit}% 2339 | \usebibmacro{withothers}} 2340 | 2341 | \renewbibmacro*{bytranslator+othersstrg}{% 2342 | \def\abx@tempa{bytranslator}% 2343 | \ifnamesequal{translator}{commentator} 2344 | {\appto\abx@tempa{co}% 2345 | \clearname{commentator}} 2346 | {\ifnamesequal{translator}{annotator} 2347 | {\appto\abx@tempa{an}% 2348 | \clearname{annotator}} 2349 | {}}% 2350 | \ifnamesequal{translator}{introduction} 2351 | {\appto\abx@tempa{in}% 2352 | \clearname{introduction}} 2353 | {\ifnamesequal{translator}{foreword} 2354 | {\appto\abx@tempa{fo}% 2355 | \clearname{foreword}} 2356 | {\ifnamesequal{translator}{afterword} 2357 | {\appto\abx@tempa{af}% 2358 | \clearname{afterword}} 2359 | {}}}% 2360 | \iffieldequalstr{usere}{chinese}{\bibstring{bytranslatorcn}} 2361 | {\bibstring{\abx@tempa}}} 2362 | 2363 | 2364 | % 2365 | % 修改作者数量超过限定值,做省略时的处理格式 2366 | % v1.0,20160701,hzz 2367 | % v1.0O,20190103,hzz,修改利用新定义的一个分隔符strandothersdelim 2368 | % v1.0w,20210401,hzz,针对其它语言的译者后的标点与中文不同做处理 2369 | % 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。 2370 | % \printnames由start-stop控制项数,默认是1和maxnames/minnames 2371 | \newcommand{\aftertransdelim}{\addcomma\addthinspace} 2372 | \renewbibmacro*{name:andothers}{\bibauthorfont% 2373 | \ifboolexpr{ 2374 | test {\ifnumequal{\value{listcount}}{\value{liststop}}} 2375 | and 2376 | test \ifmorenames 2377 | }{\ifnumgreater{\value{liststop}}{1}%注意这里试图去区分姓名总数大于1的情况,当姓名总数大于1时,最后一个姓名后面先加入一个\finalandcomma 2378 | {\finalandcomma}%目前国标没有这样的区分要求,如果有需要也是可以这么去做的。 2379 | {}% 2380 | \printdelim{andothersdelim}\printdelim{strandothersdelim}% 2381 | }{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如: 2382 | %袁训来, 陈哲, 肖书海, 等. 2383 | %胡泳, 范海燕, 译. 2384 | %潘惠霞, 魏婧, 杨艳, 等译. 2385 | \ifcurrentname{translator}{\iffieldequalstr{usere}{chinese}{\aftertransdelim}{}}{}%为了实现上述第二个示例情况做的处理 2386 | }} 2387 | 2388 | 2389 | 2390 | % 修改省略作者后的本地化字符串,比如et al. 2391 | % v1.0o,20190103,hzz 2392 | % 2393 | % 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andotherscn=“等”,否则用andothers=“et al.”。 2394 | % 非默认情况,根据选项信息,选择选择强制中文或英文 2395 | % 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了 2396 | % 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置 2397 | \DeclareDelimFormat{strandothersdelim}{% 2398 | \edef\userfieldabcde{userd}%这里使用\iffieldequalstr{labelnamesource}替代ifcurrentname因为标注中使用ifcurrentname无效 2399 | \iffieldequalstr{labelnamesource}{translator}{\edef\userfieldabcde{usere}}{}% 2400 | \iffieldequalstr{labelnamesource}{editor}{\edef\userfieldabcde{userc}}{}% 2401 | \iffieldequalstr{labelnamesource}{author}{\edef\userfieldabcde{userf}}{}% 2402 | \iffieldequalstr{labelnamesource}{bookauthor}{\edef\userfieldabcde{userb}}{}% 2403 | \ifcase\value{gbcitelocalcase}% 2404 | \iffieldequalstr{\userfieldabcde}{chinese}{\ifbibstring{andothersincitecn}{\bibstring{andothersincitecn}}{\bibstring{andothers}}}{}%中文已经通过english本地化字符串定义 2405 | \iffieldequalstr{\userfieldabcde}{korean}{\ifbibstring{andotherskr}{\bibstring{andotherskr}}{\bibstring{andothers}}}{}%韩语未定义,所以与bib中一致 2406 | \iffieldequalstr{\userfieldabcde}{japanese}{\ifbibstring{andothersjp}{\bibstring{andothersjp}}{\bibstring{andothers}}}{}%日与同韩语 2407 | \iffieldequalstr{\userfieldabcde}{english}{\ifbibstring{andothersincite}{\bibstring{andothersincite}}{\bibstring{andothers}}}{}%英语已定义 2408 | \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}%法语未定义,若要定义需要针对french本地化字符串定义 2409 | \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}%俄语未定义,若要定义需要针对russian本地化字符串定义 2410 | \or% 2411 | \bibstring{andothersincitecn}% 2412 | \or% 2413 | \bibstring{andothersincite}% 2414 | \fi} 2415 | 2416 | 2417 | \DeclareDelimFormat[bib,biblist]{strandothersdelim}{% 2418 | \edef\userfieldabcde{userd}% 2419 | \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% 2420 | \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% 2421 | \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% 2422 | \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% 2423 | \ifcase\value{gbbiblocalcase}% 2424 | \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}% 2425 | \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}% 2426 | \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andothersjp}}{}% 2427 | \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}% 2428 | \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}% 2429 | \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}% 2430 | \or% 2431 | \bibstring{andotherscn}% 2432 | \or% 2433 | \bibstring{andothers}% 2434 | \fi} 2435 | 2436 | % 2437 | % 修改最后一个作者前的字符串,比如 and 2438 | % v1.0o,20190103,hzz 2439 | % 2440 | % 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andcn=“和”,否则用and=“and”。 2441 | % 非默认情况,根据选项信息,选择选择强制中文或英文 2442 | % 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了 2443 | % 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置 2444 | \DeclareDelimFormat{finalnamedelim}{% 2445 | \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% 2446 | % \addspace% 2447 | \edef\userfieldabcde{userd}% 2448 | \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% 2449 | \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% 2450 | \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% 2451 | \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% 2452 | \ifcase\value{gbcitelocalcase}% 2453 | \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andincitecn}}{}% 2454 | \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% 2455 | \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}% 2456 | \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andincite}}{}% 2457 | \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}% 2458 | \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}% 2459 | %\space% 2460 | \or% 2461 | \bibstring{andincitecn}%\space% 2462 | \or% 2463 | \bibstring{andincite}% 2464 | \fi} 2465 | 2466 | \DeclareDelimFormat[bib,biblist]{finalnamedelim}{% 2467 | \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% 2468 | \addspace% 2469 | \edef\userfieldabcde{userd}% 2470 | \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% 2471 | \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% 2472 | \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% 2473 | \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% 2474 | \ifcase\value{gbbiblocalcase}% 2475 | \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}% 2476 | \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% 2477 | \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}% 2478 | \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}% 2479 | \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}% 2480 | \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}% 2481 | \space% 2482 | \or% 2483 | \bibstring{andcn}% 2484 | \or% 2485 | \bibstring{and}% 2486 | \fi} 2487 | 2488 | 2489 | % 2490 | % 重设title的输出 2491 | % 2492 | % 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen 2493 | % 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件 2494 | % 利用toggle做标识符是否输出的判断 2495 | \renewbibmacro*{title}{% 2496 | \ifboolexpr{% 2497 | test{\iffieldundef{title}}% 2498 | and 2499 | test{\iffieldundef{subtitle}}% 2500 | }% 2501 | {}% 2502 | {\printtext[title]{\bibtitlefont%增加字体控制命令 2503 | \printfield[titlecase]{title}% 2504 | \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 2505 | {}{\setunit{\subtitlepunct}% 2506 | \printfield[titlecase]{subtitle}}% 2507 | \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 2508 | {\setunit{\subtitlepunct}\printfield{titleaddon}}% 2509 | \iftoggle{bbx:gbtype}{% 2510 | \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准 2511 | {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准 2512 | {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸 2513 | {\printfield[gbtypeflag]{usera}}}%其它 2514 | }}{}% 2515 | %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 2516 | %\newunit 2517 | }% 2518 | }} 2519 | 2520 | % 2521 | % 作者信息的输出格式 2522 | % 2523 | % 20180425,v1.0k,为作者增加字体控制命令,Hu Zhenzhen 2524 | % 20180603,v1.0l,增加使用nameformat域来选择姓名格式 2525 | \DeclareNameFormat{namefmtselected}{% 2526 | \iffieldundef{namefmtid}{}% 2527 | {\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}% 2528 | %\printtext{\thegbnamefmtcase}% 2529 | \ifcase\value{gbnamefmtcase}% 2530 | \ifgiveninits 2531 | {\usebibmacro{name:gbuppercase} 2532 | {\namepartfamily} 2533 | {\namepartgiveni} 2534 | {\namepartprefix} 2535 | {\namepartsuffix}} 2536 | {\usebibmacro{name:gbuppercase} 2537 | {\namepartfamily} 2538 | {\namepartgiven} 2539 | {\namepartprefix} 2540 | {\namepartsuffix}}% 2541 | \or 2542 | \ifgiveninits 2543 | {\usebibmacro{name:gblowercase} 2544 | {\namepartfamily} 2545 | {\namepartgiveni} 2546 | {\namepartprefix} 2547 | {\namepartsuffix}} 2548 | {\usebibmacro{name:gblowercase} 2549 | {\namepartfamily} 2550 | {\namepartgiven} 2551 | {\namepartprefix} 2552 | {\namepartsuffix}}% 2553 | \or 2554 | \ifgiveninits 2555 | {\usebibmacro{name:given-family} 2556 | {\namepartfamily} 2557 | {\namepartgiveni} 2558 | {\namepartprefix} 2559 | {\namepartsuffix}} 2560 | {\usebibmacro{name:given-family} 2561 | {\namepartfamily} 2562 | {\namepartgiven} 2563 | {\namepartprefix} 2564 | {\namepartsuffix}}% 2565 | \or 2566 | \ifgiveninits 2567 | {\usebibmacro{name:family-given} 2568 | {\namepartfamily} 2569 | {\namepartgiveni} 2570 | {\namepartprefix} 2571 | {\namepartsuffix}} 2572 | {\usebibmacro{name:family-given} 2573 | {\namepartfamily} 2574 | {\namepartgiven} 2575 | {\namepartprefix} 2576 | {\namepartsuffix}}% 2577 | \or 2578 | \usebibmacro{name:gbpinyin} 2579 | {\namepartfamily} 2580 | {\namepartgiven} 2581 | {\namepartprefix} 2582 | {\namepartsuffix}% 2583 | \or 2584 | \ifnumequal{\value{listcount}}{1} 2585 | {\ifgiveninits 2586 | {\usebibmacro{name:family-given} 2587 | {\namepartfamily} 2588 | {\namepartgiveni} 2589 | {\namepartprefix} 2590 | {\namepartsuffix}} 2591 | {\usebibmacro{name:family-given} 2592 | {\namepartfamily} 2593 | {\namepartgiven} 2594 | {\namepartprefix} 2595 | {\namepartsuffix}}% 2596 | \ifboolexpe{% 2597 | test {\ifdefvoid\namepartgiven} 2598 | and 2599 | test {\ifdefvoid\namepartprefix}} 2600 | {} 2601 | {\usebibmacro{name:revsdelim}}} 2602 | {\ifgiveninits 2603 | {\usebibmacro{name:given-family} 2604 | {\namepartfamily} 2605 | {\namepartgiveni} 2606 | {\namepartprefix} 2607 | {\namepartsuffix}} 2608 | {\usebibmacro{name:given-family} 2609 | {\namepartfamily} 2610 | {\namepartgiven} 2611 | {\namepartprefix} 2612 | {\namepartsuffix}}}% 2613 | \or 2614 | \usebibmacro{name:gbquanpin} 2615 | {\namepartfamily} 2616 | {\namepartgiven} 2617 | {\namepartprefix} 2618 | {\namepartsuffix}% 2619 | \fi 2620 | \usebibmacro{name:andothers}} 2621 | 2622 | \DeclareNameAlias{default}{namefmtselected}%姓名的默认格式采用可选的模式 2623 | \DeclareNameAlias{sortname}{default}% Used in the bibliography %family-given/given-family 2624 | \DeclareNameAlias{citename}{default}% Default used by \citename 2625 | 2626 | \DeclareDelimFormat[bib,biblist]{andothersdelim}{\addcomma\addspace} 2627 | %\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}% 2628 | 2629 | %GB/T 7714-2015 风格,全部大写 2630 | \def\gbcaselocalset{\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 2631 | \renewcommand*{\revsdnamepunct}{}%%%来源biblatex.def 2632 | } 2633 | \newbibmacro*{name:gbuppercase}[4]{\bibauthorfont% 2634 | \gbcaselocalset% 2635 | \ifuseprefix% 2636 | {\usebibmacro{name:delim}{#3#1}% 2637 | \usebibmacro{name:hook}{#3#1}% 2638 | \ifdefvoid{#3}{}{% 2639 | \ifcapital% 2640 | {\mkbibnameprefix{\MakeCapital{#3}}\isdot}% 2641 | {\mkbibnameprefix{#3}\isdot}% 2642 | \ifprefchar{}{\bibnamedelimc}}% 2643 | \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% 2644 | \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital 2645 | \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号 2646 | {\usebibmacro{name:delim}{#1}% 2647 | \usebibmacro{name:hook}{#1}% 2648 | \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% 2649 | \ifboolexpe{% 2650 | test {\ifdefvoid{#2}} 2651 | and 2652 | test {\ifdefvoid{#3}}} 2653 | {}{\revsdnamepunct}% 2654 | \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital 2655 | \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% 2656 | \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号 2657 | } 2658 | 2659 | %GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出 2660 | \newbibmacro*{name:gblowercase}[4]{\bibauthorfont% 2661 | \gbcaselocalset% 2662 | \ifuseprefix 2663 | {\usebibmacro{name:delim}{#3#1}% 2664 | \usebibmacro{name:hook}{#3#1}% 2665 | \ifdefvoid{#3}{}{% 2666 | \ifcapital 2667 | {\mkbibnameprefix{\MakeCapital{#3}}\isdot} 2668 | {\mkbibnameprefix{#3}\isdot}% 2669 | \ifprefchar{}{\bibnamedelimc}}% 2670 | \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot% 2671 | \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital 2672 | \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号 2673 | {\usebibmacro{name:delim}{#1}% 2674 | \usebibmacro{name:hook}{#1}% 2675 | \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot% 2676 | \ifboolexpe{% 2677 | test {\ifdefvoid{#2}} 2678 | and 2679 | test {\ifdefvoid{#3}}} 2680 | {}{\revsdnamepunct}% 2681 | \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital 2682 | \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} 2683 | \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号 2684 | } 2685 | 2686 | %中文常见风格,汉语拼音全拼模式 2687 | \def\gbpinyinlocalset{\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY 2688 | \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def 2689 | \renewrobustcmd*{\bibnamedelima}{\mbox{-}}} 2690 | \newbibmacro*{name:gbpinyin}[4]{\bibauthorfont% 2691 | \gbpinyinlocalset% 2692 | \ifuseprefix 2693 | {\usebibmacro{name:delim}{#3#1}% 2694 | \usebibmacro{name:hook}{#3#1}% 2695 | \ifdefvoid{#3}{}{% 2696 | \ifcapital 2697 | {\mkbibnameprefix{\MakeCapital{#3}}\isdot} 2698 | {\mkbibnameprefix{#3}\isdot}% 2699 | \ifprefchar{}{\bibnamedelimc}}% 2700 | \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% 2701 | \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeSentenceCase{#2}}\isdot}%\MakeCapital 2702 | \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}} 2703 | {\usebibmacro{name:delim}{#1}% 2704 | \usebibmacro{name:hook}{#1}% 2705 | \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% 2706 | \ifboolexpe{% 2707 | test {\ifdefvoid{#2}} 2708 | and 2709 | test {\ifdefvoid{#3}}} 2710 | {} 2711 | {\revsdnamepunct}% 2712 | \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeCapital{#2}}\isdot}%\MakeCapital 2713 | \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} 2714 | \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}% 2715 | } 2716 | %中文常见风格,汉语拼音全拼模式 2717 | \def\gbquanpinlocalset{\renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY 2718 | \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def 2719 | \renewrobustcmd*{\bibnamedelima}{}} 2720 | \newbibmacro*{name:gbquanpin}[4]{\bibauthorfont% 2721 | \gbquanpinlocalset% 2722 | \ifuseprefix 2723 | {\usebibmacro{name:delim}{#3#1}% 2724 | \usebibmacro{name:hook}{#3#1}% 2725 | \ifdefvoid{#3}{}{% 2726 | \ifcapital 2727 | {\mkbibnameprefix{\MakeCapital{#3}}\isdot} 2728 | {\mkbibnameprefix{#3}\isdot}% 2729 | \ifprefchar{}{\bibnamedelimc}}% 2730 | \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeCapital{#1}}}\isdot% 2731 | \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeSentenceCase{#2}}\isdot}%\MakeCapital 2732 | \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}} 2733 | {\usebibmacro{name:delim}{#1}% 2734 | \usebibmacro{name:hook}{#1}% 2735 | \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeCapital{#1}}}\isdot% 2736 | \ifboolexpe{% 2737 | test {\ifdefvoid{#2}} 2738 | and 2739 | test {\ifdefvoid{#3}}} 2740 | {} 2741 | {\revsdnamepunct}% 2742 | \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeCapital{#2}}\isdot}%\MakeCapital 2743 | \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} 2744 | \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}% 2745 | } 2746 | 2747 | 2748 | \@ifpackagelater{biblatex}{2016/03/27}%biblatex<3.2版的情况 2749 | {}{ 2750 | %GB/T 7714-2015 风格,全部大写 2751 | \renewbibmacro*{name:gbuppercase}[4]{\bibauthorfont% 2752 | \gbcaselocalset% 2753 | \ifuseprefix 2754 | {\usebibmacro{name:delim}{#3#1}% 2755 | \usebibmacro{name:hook}{#3#1}% 2756 | \ifblank{#3}{}{% 2757 | \ifcapital 2758 | {\mkbibnameprefix{\MakeCapital{#3}}\isdot} 2759 | {\mkbibnameprefix{#3}\isdot}% 2760 | \ifpunctmark{'}{}{\bibnamedelimc}}% 2761 | %\mkbibnamelast{#1}\isdot 2762 | \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase 2763 | %注意上一句\MakeCapital后面如果再跟一个{}包含#1,则没有效果,可能是包在里面少了一层展开 2764 | %因为机构名通常包括在{}内,所以要多展开一次才行,所以这里去掉#1外面的{} 2765 | %\mkbibnamelast{\MakeUppercase{#1}}\isdot 2766 | %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 2767 | \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% 2768 | \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}}%后缀前加逗号 2769 | {\usebibmacro{name:delim}{#1}% 2770 | \usebibmacro{name:hook}{#1}% 2771 | %\mkbibnamelast{#1}\isdot %3.9.1 Generic Commands and Hooks,对姓重新处理,如下句: %\mkbibnamelast{\MakeUppercase{#1}} 2772 | \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase 2773 | %\mkbibnamelast{\MakeUppercase{#1}}\isdot 2774 | %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 2775 | \ifblank{#2#3}{}{\revsdnamepunct}% 2776 | \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% 2777 | \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% 2778 | \addcomma\addspace% 2779 | \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}%%后缀前加逗号 2780 | }% 2781 | } 2782 | 2783 | %GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出 2784 | \renewbibmacro*{name:gblowercase}[4]{\bibauthorfont% 2785 | \gbcaselocalset% 2786 | \ifuseprefix 2787 | {\usebibmacro{name:delim}{#3#1}% 2788 | \usebibmacro{name:hook}{#3#1}% 2789 | \ifblank{#3}{}{% 2790 | \ifcapital 2791 | {\mkbibnameprefix{\MakeCapital{#3}}\isdot} 2792 | {\mkbibnameprefix{#3}\isdot}% 2793 | \ifpunctmark{'}{}{\bibnamedelimc}}% 2794 | \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase 2795 | \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{{#2}}\isdot}% 2796 | \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}}%后缀前加逗号 2797 | {\usebibmacro{name:delim}{#1}% 2798 | \usebibmacro{name:hook}{#1}% 2799 | \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase 2800 | \ifblank{#2#3}{}{\revsdnamepunct}% 2801 | \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{{#2}}\isdot}% 2802 | \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% 2803 | \addcomma\addspace% 2804 | \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}%%后缀前加逗号 2805 | }% 2806 | } 2807 | 2808 | %中文常见风格,汉语拼音全拼模式 2809 | \renewbibmacro*{name:gbpinyin}[4]{\bibauthorfont% 2810 | \gbpinyinlocalset% 2811 | \ifuseprefix 2812 | {\usebibmacro{name:delim}{#3#1}% 2813 | \usebibmacro{name:hook}{#3#1}% 2814 | \ifblank{#3}{}{% 2815 | \ifcapital 2816 | {\mkbibnameprefix{\MakeCapital{#3}}\isdot} 2817 | {\mkbibnameprefix{#3}\isdot}% 2818 | \ifpunctmark{'}{}{\bibnamedelimc}}% 2819 | \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase 2820 | \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{\MakeSentenceCase{#2}}\isdot}% 2821 | \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}} 2822 | {\usebibmacro{name:delim}{#1}% 2823 | \usebibmacro{name:hook}{#1}% 2824 | \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase 2825 | \ifblank{#2#3}{}{\revsdnamepunct}% 2826 | \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% 2827 | \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% 2828 | \addcomma\addspace% 2829 | \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}% 2830 | }% 2831 | } 2832 | %中文常见风格,汉语拼音全拼模式 2833 | \renewbibmacro*{name:gbquanpin}[4]{\bibauthorfont% 2834 | \gbquanpinlocalset% 2835 | \ifuseprefix 2836 | {\usebibmacro{name:delim}{#3#1}% 2837 | \usebibmacro{name:hook}{#3#1}% 2838 | \ifblank{#3}{}{% 2839 | \ifcapital 2840 | {\mkbibnameprefix{\MakeCapital{#3}}\isdot} 2841 | {\mkbibnameprefix{#3}\isdot}% 2842 | \ifpunctmark{'}{}{\bibnamedelimc}}% 2843 | \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeCapital{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase 2844 | \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{\MakeSentenceCase{#2}}\isdot}% 2845 | \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}} 2846 | {\usebibmacro{name:delim}{#1}% 2847 | \usebibmacro{name:hook}{#1}% 2848 | \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeCapital{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase 2849 | \ifblank{#2#3}{}{\revsdnamepunct}% 2850 | \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% 2851 | \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% 2852 | \addcomma\addspace% 2853 | \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}% 2854 | }% 2855 | } 2856 | 2857 | %%biblatex<3.2版的情况,姓名的处理格式带参数 2858 | \DeclareNameFormat{namefmtselected}{% 2859 | \iffieldundef{namefmtid}{}% 2860 | {\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}% 2861 | \ifcase\value{gbnamefmtcase}% 2862 | \iffirstinits 2863 | {\usebibmacro{name:gbuppercase}{#1}{#4}{#5}{#7}} 2864 | {\usebibmacro{name:gbuppercase}{#1}{#3}{#5}{#7}}% 2865 | \or 2866 | \iffirstinits 2867 | {\usebibmacro{name:gblowercase}{#1}{#4}{#5}{#7}} 2868 | {\usebibmacro{name:gblowercase}{#1}{#3}{#5}{#7}}% 2869 | \or 2870 | \iffirstinits 2871 | {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}} 2872 | {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}% 2873 | \ifblank{#3#5} 2874 | {} 2875 | {\usebibmacro{name:revsdelim}}% 2876 | \or 2877 | \iffirstinits 2878 | {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}} 2879 | {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}% 2880 | \or 2881 | \usebibmacro{name:gbpinyin}{#1}{#3}{#5}{#7}% 2882 | \or 2883 | \ifnumequal{\value{listcount}}{1} 2884 | {\iffirstinits 2885 | {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}} 2886 | {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}% 2887 | \ifblank{#3#5} 2888 | {} 2889 | {\usebibmacro{name:revsdelim}}} 2890 | {\iffirstinits 2891 | {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}} 2892 | {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}}% 2893 | \or 2894 | \usebibmacro{name:gbquanpin}{#1}{#3}{#5}{#7}% 2895 | \fi 2896 | \usebibmacro{name:andothers}} 2897 | } 2898 | 2899 | % 2900 | % url和url日期格式 2901 | % 2902 | \renewbibmacro*{url+urldate}{% 2903 | %\usebibmacro{url}%%更换url的位置,放到下面 2904 | \iffieldundef{urlyear}% 2905 | {}{%\setunit*{\addspace}% 2906 | \usebibmacro{urldate}}% 2907 | \setunit{\addperiod\addspace}% 2908 | \usebibmacro{url}} 2909 | \renewbibmacro*{url}{\printfield{url}} 2910 | 2911 | 2912 | 2913 | 2914 | % 2915 | % 日期信息的输出格式,针对biblatex<3.7版本 2916 | % 2917 | \defversion{3.4}{date}{ 2918 | \renewbibmacro*{urldate}{% 2919 | \addthinspace\printtext{[}\printfield{urlyear}% 2920 | \iffieldundef{urlmonth}{}{\bibrangedash\printfield{urlmonth}}% 2921 | \iffieldundef{urlday}{}{\bibrangedash\printfield{urlday}}\printtext{]}} 2922 | 2923 | \newbibmacro*{newsdate}{%%新增加一个公告日期,公开日期或新闻日期 2924 | \iffieldundef{year}{}{\printfield{year}% 2925 | \iffieldundef{month}{}{\bibrangedash\printtext{\thefield{month}}% 2926 | \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}% 2927 | } 2928 | 2929 | \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 2930 | \ifboolexpr{% 2931 | test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% 2932 | }% 2933 | {}%更新或修改日期通常有day信息 2934 | {\iffieldequalstr{year}{}{%替换\iffieldundef{year},因为year总是存在,但为空 2935 | \iffieldundef{endyear}{% 2936 | \iffieldundef{eventyear}{}{\printtext{\mkbibparens{\printtext{\printfield{eventyear}}% 2937 | \iffieldundef{eventmonth}{}{\bibrangedash\thefield{eventmonth}}% 2938 | \iffieldundef{eventday}{}{\bibrangedash\printfield{eventday}}}}% 2939 | }% 2940 | }{% 2941 | \iffieldundef{endyear}{}{\printtext{\mkbibparens{\printtext{\printfield{endyear}}% 2942 | \iffieldundef{endmonth}{}{\bibrangedash\thefield{endmonth}}% 2943 | \iffieldundef{endday}{}{\bibrangedash\printfield{endday}}}}% 2944 | }% 2945 | }% 2946 | }% 2947 | {% 2948 | \iffieldundef{year}{}{\printtext{\mkbibparens{\printtext{\printfield{year}}% 2949 | \iffieldundef{month}{}{\bibrangedash\thefield{month}}% 2950 | \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}% 2951 | }% 2952 | }% 2953 | }}% 2954 | } 2955 | 2956 | % 2957 | % 日期信息的输出格式,针对3.9>=biblatex>=3.7版本 2958 | % 2959 | \defversion{3.7}{date}{ 2960 | \DeclareFieldFormat{urldate}{##1} 2961 | \renewbibmacro*{urldate}{% 2962 | \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令 2963 | 2964 | % 2965 | % 专利的公告日期、或报纸的日期的输出宏 2966 | % 20160701,v1.0,新增加 2967 | % 20180405,v1.0k,为biblatexv3.7-3.9版本,出现多出点bug做处理,Hu Zhenzhen 2968 | % 2969 | % 原理方法:加上printtext避免破坏异步标点机制 2970 | % 2971 | \newbibmacro*{newsdate}{% 2972 | \printtext{\blx@edtfdate{}{}}% 2973 | } 2974 | 2975 | \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 2976 | \ifboolexpr{% 2977 | test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% 2978 | }% 2979 | {}%更新或修改日期通常有day信息 2980 | {\iffieldundef{year}{% 2981 | \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}% 2982 | {\printtext{(}\printenddate\printtext{)}}% 2983 | }{\iffieldequalstr{year}{}{%因为year存在,但为空 2984 | }{\printtext{(}\blx@edtfdate{}{}\printtext{)}}% 2985 | }% 2986 | }}% 2987 | } 2988 | 2989 | % 2990 | % 日期信息的输出格式,针对biblatex>=3.10版本 2991 | % 2992 | \defversion{3.10}{date}{ 2993 | \DeclareFieldFormat{urldate}{##1} 2994 | \renewbibmacro*{urldate}{% 2995 | \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令 2996 | 2997 | % 2998 | % 专利的公告日期、或报纸的日期的输出宏 2999 | % 20160701,v1.0,新增加 3000 | % 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen 3001 | % 3002 | % 原理方法:加上printtext避免破坏异步标点机制 3003 | % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份 3004 | % 所以无法再用选项设置的方法,印象需要用底层的命令 3005 | % 这里可以用\blx@isodate,但用\blx@gbdate试图避免版本判断 3006 | \newbibmacro*{newsdate}{%% 3007 | \printtext{\blx@gbdate{}{}}%%\blx@isodate{}{}% 3008 | } 3009 | 3010 | % 3011 | \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 3012 | \ifboolexpr{% 3013 | test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% 3014 | }% 3015 | {}%更新或修改日期通常有day信息 3016 | {\iffieldundef{year}{% 3017 | \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}% 3018 | {\printtext{(}\printenddate\printtext{)}}% 3019 | }{\iffieldequalstr{year}{}{%因为year存在,但为空 3020 | }{\printtext{(}\blx@gbdate{}{}\printtext{)}}% 3021 | }% 3022 | }}% 3023 | } 3024 | 3025 | % 3026 | % biblatex>v3.8版利用related实现双语文献的处理 3027 | % 3028 | \defversion{3.8}{dblang}{ 3029 | %为了实现v3.8以上版本的双语文献,采用related的方法代替set方法,因为set方法已经无法实现了, 3030 | %因为set不再复制其第一个成员的信息。于是定义一个命令,用于动态的修改数据,即添加related域的信息 3031 | %其中使用了\DeclareStyleSourcemap,但由于其只能出现在导言区中,因此\defdoublelangentry命令也只能出现在导言区中 3032 | \newcommand{\defdoublelangentry}[2]{% 3033 | \edef\entrykeya{##1} 3034 | \edef\entrykeyb{##2} 3035 | \DeclareStyleSourcemap{ 3036 | \maps[datatype=bibtex]{ 3037 | \map{ 3038 | \step[fieldsource=entrykey, match=\entrykeya, final] 3039 | \step[fieldset=related, fieldvalue=\entrykeyb] 3040 | } 3041 | } 3042 | } 3043 | } 3044 | } 3045 | 3046 | % 3047 | % 关联文献间的分隔符 3048 | % 3049 | \renewcommand{\relateddelim}{\adddot\newline\nobreak}%\par,而作者年样式不需要修改,因为没有项对齐的标签问题 3050 | 3051 | % 3052 | % 关联文献的输出格式,针对3.9>=biblatex>=3.7版本 3053 | % 3054 | % 原理方法:因为related宏中带有##了,所以无法封装到defversion中了。所以直接做判断 3055 | % 下面这一段主要针对v3.8-3.10,因为我提问后,biblatex作者为3.11版增加了一个钩子控制relatedblock前的分隔符。 3056 | \ifboolexpr{ 3057 | test{\iftoggle{iftleight}} 3058 | or 3059 | test{\iftoggle{iftlnine}} 3060 | }{\renewbibmacro*{related}{%standard.bbx 3061 | \ifboolexpr{ test {\iffieldundef{related}} or test {\ifrelatedloop} } 3062 | {} 3063 | {\usebibmacro{begrelated}% 3064 | \def\bbx@tempa{}% 3065 | \setcounter{bbx:relatedtotal}{0}% 3066 | \def\do##1{% 3067 | \entrydata{##1}{% 3068 | \ifrelatedloop 3069 | {} 3070 | {\stepcounter{bbx:relatedtotal}% 3071 | \gappto{\bbx@tempa}{##1,}}}}% 3072 | \docsvfield{related}% 3073 | \restorefield{related}{\bbx@tempa}% 3074 | \ifnumgreater{\value{bbx:relatedtotal}}{0} 3075 | {\listcsxadd{bbx:relatedloop}{\strfield{entrykey}}% 3076 | \iffieldundef{clonesourcekey} 3077 | {} 3078 | {\listcsxadd{bbx:relatedloop}{\strfield{clonesourcekey}}}% 3079 | \setcounter{bbx:relatedcount}{0}% 3080 | \def\do{% 3081 | \stepcounter{bbx:relatedcount}% 3082 | \ifnumgreater{\value{bbx:relatedcount}}{0}%这里从1改为0 3083 | {\ifcsundef{relateddelim\strfield{relatedtype}} 3084 | {\printtext{\relateddelim}} 3085 | {\printtext{\csuse{relateddelim\strfield{relatedtype}}}}} 3086 | {}}% 3087 | \ifbibmacroundef{related:\strfield{relatedtype}} 3088 | {\appto{\do}{\usebibmacro{related:default}}} 3089 | {\appto{\do}{\usebibmacro*{related:\strfield{relatedtype}}}}% 3090 | \iffieldformatundef{related:\strfield{relatedtype}} 3091 | {\def\bbx@tempa{related}} 3092 | {\def\bbx@tempa{related:\strfield{relatedtype}}}% 3093 | \iffieldformatundef{relatedstring:\strfield{relatedtype}} 3094 | {\def\bbx@tempb{relatedstring:default}} 3095 | {\def\bbx@tempb{relatedstring:\strfield{relatedtype}}}% 3096 | \printtext[\bbx@tempa]{% 3097 | \usebibmacro{begrelatedloop}% 3098 | \iffieldundef{relatedstring} 3099 | {\ifboolexpr{ 3100 | test {\ifnumgreater{\value{bbx:relatedtotal}}{1}} 3101 | and 3102 | test {\ifbibxstring{\thefield{relatedtype}s}} 3103 | } 3104 | {\printtext[\bbx@tempb]{% 3105 | \bibstring[\mkrelatedstring]{\thefield{relatedtype}s}}} 3106 | {\iffieldbibstring{relatedtype} 3107 | {\printtext[\bbx@tempb]{% 3108 | \bibstring[\mkrelatedstring]{\thefield{relatedtype}}}} 3109 | {}}} 3110 | {\iffieldbibstring{relatedstring} 3111 | {\printtext[\bbx@tempb]{% 3112 | \bibstring[\mkrelatedstring]{\thefield{relatedstring}}}} 3113 | {\printfield[\bbx@tempb]{relatedstring}}}% 3114 | \docsvfield{related}% 3115 | \usebibmacro{endrelatedloop}}}% 3116 | {}% 3117 | \usebibmacro{endrelated}}} 3118 | }{} 3119 | 3120 | % 3121 | % 关联文献块前的分隔符,针对biblatex>3.11 3122 | % 3123 | % 原理方法:因为增加了begrelateddelim钩子,所以不需要重定义related输出宏 3124 | \defversion{3.11}{related}{ 3125 | \renewcommand{\begrelateddelim}{\adddot\newline\nobreak} 3126 | } 3127 | 3128 | \iftoggle{iftlfive}{\switchversion{3.4}{date}}{}%biblatex<=3.2 3129 | \iftoggle{iftlsix}{\switchversion{3.4}{date}}{}%3.3<=biblatex<=3.6 3130 | \iftoggle{iftlseven}{\switchversion{3.7}{date}}{}%biblatex=3.7 3131 | \iftoggle{iftleight}{\switchversion{3.7}{date}\switchversion{3.8}{dblang}}{}%3.8<=biblatex<=3.9 3132 | \iftoggle{iftlnine}{\switchversion{3.10}{date}\switchversion{3.8}{dblang}}{}%biblatex=3.10 3133 | \iftoggle{iftlatest}{\switchversion{3.10}{date}\switchversion{3.8}{dblang}\switchversion{3.11}{related}}{}%biblatex最新3.11 3134 | 3135 | % 3136 | % 调整doi+eprint+url格式 3137 | % 2016.07.01 byhzz 3138 | % 2019.05.01 byhzz 在eprint前增加一个空格 3139 | % 原理方法:源来自standard.bbx,因为页码后面直接跟引用日期,没有标点所以去掉其中的标点。 3140 | \renewbibmacro*{doi+eprint+url}{% 3141 | % \iftoggle{bbx:doi}%把doi的位置放到url后面 3142 | % {\printfield{doi}} 3143 | % {}% 3144 | %\newunit\newblock 3145 | \iftoggle{bbx:eprint} 3146 | {\iffieldundef{eprint}{}{\newunit\usebibmacro{eprint}}} 3147 | {}% 3148 | %\newunit\newblock 3149 | \iftoggle{bbx:url} 3150 | {\usebibmacro{url+urldate}} 3151 | {} 3152 | \newunit\newblock 3153 | \iftoggle{bbx:doi} 3154 | {\printfield{doi}} 3155 | {}} 3156 | 3157 | % 3158 | % 调整页码的格式,即chapter+pages格式 3159 | % 3160 | \renewbibmacro*{chapter+pages}{% 3161 | \iftoggle{bbx:gbstrict}{}{% 3162 | \printfield{chapter}}% 3163 | \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出 3164 | \setunit{\bibpagespunct}% 3165 | \printfield{pages}}% 3166 | %\newunit %这里的标点去掉 3167 | } 3168 | 3169 | % 3170 | % 当location等出版项超过maxitem缩减后不再输出etal 3171 | % 3172 | \DeclareListFormat{location}{% 3173 | \usebibmacro{list:delim}{#1}% 3174 | #1\isdot} 3175 | \DeclareListAlias{institution}{location} 3176 | \DeclareListAlias{publisher}{location} 3177 | 3178 | % 新增一个样式用于输出连续出版物的地址,单位,时间, 3179 | % 用于periodical连续出版物的出版社和地址的处理 3180 | % 3181 | % v1.0k,20180425,为出版信息增加字体控制命令,hzz 3182 | % %类似\newbibmacro*{publisher+location+date} 3183 | \newbibmacro*{location+institution+date}{\bibpubfont% 3184 | \iftoggle{bbx:gbpub}% 3185 | {\testCJKfirst{userd}% 3186 | \ifboolexpr{% 3187 | test {\iflistundef{location}} and test {\iflistundef{institution}}% 3188 | }{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}% 3189 | {\printtext{[S.l.\space :\space s.n.\adddot]}}% 3190 | }{% 3191 | \iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}}{\printtext{[S.l.\adddot]}}}% 3192 | {\printlist{location}}% 3193 | \publocpunct% 3194 | \iflistundef{institution}{% 3195 | \iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}}{\printtext{\mkbibbrackets{s.n.}}}}% 3196 | {\printlist{institution}}}% 3197 | \setunit{\addcomma\addspace}% 3198 | %\usebibmacro{date}% 3199 | \printfield{year}% 3200 | \bibrangedash% 3201 | \iffieldundef{endyear}{}{\printfield{endyear}}% 3202 | \newunit}% 3203 | {\printlist{location}% 3204 | \iflistundef{institution}% 3205 | {\setunit*{\addcomma\space}} 3206 | {\setunit*{\publocpunct}}% 3207 | \printlist{institution}% 3208 | \setunit*{\addcomma\space}% 3209 | \usebibmacro{date}% 3210 | \newunit}% 3211 | } 3212 | % 3213 | % 通用的出版社和地址的处理 3214 | % 3215 | % 原理方法:当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。 3216 | % 事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。 3217 | % 注意标准standard类型,因为当没有出版项时直接省略,所以做特殊处理 3218 | \renewbibmacro*{publisher+location+date}{\bibpubfont% 3219 | \iftoggle{bbx:gbpub}% 3220 | {\testCJKfirst{userd}% 3221 | \ifboolexpr{ test {\iflistundef{location}} and test {\iflistundef{publisher}} }% 3222 | {\iffieldequalstr{note}{standard}{}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}% 3223 | {\iflistundef{location}{%\adddot 3224 | \iffieldequalstr{note}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。 3225 | {\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\publocpunct}}}% \bibstring{noaddress} 3226 | {\printlist{location}\publocpunct}%%\addcolon\addspace% 3227 | \iflistundef{publisher}{% 3228 | \iffieldequalstr{note}{standard}{}% 3229 | {\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}% 3230 | {\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}}}% 3231 | {\printlist{publisher}}}% 3232 | \setunit*{\addcomma\addspace}%\addcomma\addspace% 3233 | \usebibmacro{date}%%\newunit %去掉这个标点 3234 | }% 3235 | {\printlist{location}% 3236 | \iflistundef{publisher} 3237 | {\setunit*{\addcomma\space}} 3238 | {\setunit*{\publocpunct}}% 3239 | \printlist{publisher}% 3240 | \setunit*{\addcomma\space}% 3241 | \usebibmacro{date}%%\newunit 3242 | }% 3243 | } 3244 | 3245 | % 3246 | % 修改了一个institution+location+date用于manual、report、thesis等类型 3247 | % 3248 | % 20180425,v1.0k,增加了字体控制命令,hzz 3249 | % 20190105,v1.0o,加了一个编组避免\usebibmacro{date}把month和day信息去掉 3250 | \renewbibmacro*{institution+location+date}{\bibpubfont%当没有institution时不处理。 3251 | {\printlist{location}%%加了一个编组避免\usebibmacro{date}把month和day信息去掉 3252 | \iflistundef{institution} 3253 | {\setunit*{\addcomma\space}} 3254 | {\setunit*{\publocpunct}}% 3255 | \printlist{institution}% 3256 | \setunit*{\addcomma\space}% 3257 | \usebibmacro{date}% 3258 | %\newunit 3259 | }} 3260 | 3261 | % 3262 | % 对volume卷信息格式做出修改 3263 | % v1.0o,20190105,hzz 3264 | % 3265 | \DeclareFieldFormat{volume}{% 3266 | \testCJKfirst{userd}% 3267 | \iftoggle{ifCJKforgbt}% 3268 | {\bibstring{serialcn}#1\bibstring{volumecn}}% 3269 | {\bibstring{volume}~#1}% 3270 | }% volume of a book 3271 | \DeclareFieldFormat[article,periodical]{volume}{#1}% volume of a journal 3272 | 3273 | % 3274 | % 对number册信息格式做出修改 3275 | % v1.0o,20190105,hzz 3276 | % 3277 | \DeclareFieldFormat{number}{#1}% 3278 | \DeclareFieldFormat[book,collection,inbook,% 3279 | incollection,proceedings,inproceedings]{number}{% 3280 | \testCJKfirst{userd}% 3281 | \iftoggle{ifCJKforgbt}% 3282 | {\bibstring{serialcn}#1\bibstring{numbercn}}% 3283 | {#1}% 3284 | }% 3285 | 3286 | % 3287 | % 对edition版本信息格式做出修改 3288 | % 3289 | \DeclareFieldFormat{edition}{\bibtitlefont%源来自biblatex.DEF 3290 | \testCJKfirst{userd}% 3291 | \iftoggle{ifCJKforgbt}% 3292 | {\ifinteger{#1}% 3293 | {\printtext{#1\str@edition}}% 3294 | {#1\isdot}}% 3295 | {\ifinteger{#1}% 3296 | {\mkbibordedition{#1}~\bibstring{edition}}% 3297 | {#1\isdot}}} 3298 | 3299 | % 3300 | % 对version的版本信息做出修改 3301 | % 3302 | \DeclareFieldFormat{version}{\bibtitlefont%源来自biblatex.DEF 3303 | \testCJKfirst{userd}% 3304 | \ifinteger{#1}% 3305 | {\iftoggle{ifCJKforgbt}{\printtext{#1\str@edition}}% 3306 | {\mkbibordedition{#1}~\bibstring{version}}}% 3307 | {#1\isdot}} 3308 | 3309 | % 3310 | % 修改析出文献的文集的标题与附加标题间的符号 3311 | % 3312 | \renewbibmacro*{booktitle}{% 3313 | \ifboolexpr{ 3314 | test {\iffieldundef{booktitle}} 3315 | and 3316 | test {\iffieldundef{booksubtitle}} 3317 | } 3318 | {} 3319 | {\printtext[booktitle]{\bibtitlefont% 3320 | \printfield[titlecase]{booktitle}% 3321 | \setunit{\subtitlepunct}% 3322 | \printfield[titlecase]{booksubtitle}}% 3323 | \newunit%标点换成下一句 3324 | \setunit{\subtitlepunct}}% 3325 | \printfield{booktitleaddon}} 3326 | 3327 | 3328 | % 3329 | % 调整期刊名的格式 3330 | % 3331 | % v1.0k,20180425,增加了字体控制命令,hzz 3332 | \renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx 3333 | \usebibmacro{journal}% 3334 | %\setunit*{\addspace}% 3335 | \setunit*{\addcomma\addspace}%修改为增加一个逗号 3336 | \iffieldundef{series} 3337 | {} 3338 | {\newunit 3339 | \printfield{series}% 3340 | \setunit{\addspace}}% 3341 | %\usebibmacro{volume+number+eid}% 3342 | %\setunit{\addspace}% 3343 | \usebibmacro{issue+date}% 3344 | %\setunit{\addcolon\space}% 3345 | \iffieldundef{volume}{}{\setunit{\addcomma\space}}% 3346 | %换成逗号和空格 3347 | \usebibmacro{issue}% 3348 | \usebibmacro{volume+number+eid}%把卷期放到年份后面 3349 | %\newunit 3350 | } 3351 | 3352 | 3353 | 3354 | % 3355 | % 调整期刊卷和期的格式 3356 | % 3357 | \renewbibmacro*{volume+number+eid}{%源来自standard.bbx 3358 | \iftoggle{bbx:gbfieldstd}{% 3359 | \printfield{volume}% 3360 | \setunit*{\adddot}% 3361 | \printfield{number}% 3362 | \setunit{\addcomma\space}% 3363 | \printfield{eid}}{% 3364 | \printfield{volume}% 3365 | %\setunit*{\adddot}%去掉点号 3366 | %\printfield{number}% 3367 | \iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号 3368 | \iffieldundef{eid}{}{% 3369 | \setunit{\addcomma\space}% 3370 | \printfield{eid}}}} 3371 | 3372 | % 3373 | % 调整期刊年份的格式 3374 | % 3375 | \renewbibmacro*{issue+date}{%去掉括号 3376 | \printtext{%去掉了[parens] 3377 | \iffieldundef{issue} 3378 | {%\usebibmacro{date} 3379 | \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸 3380 | {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸 3381 | {\usebibmacro{date}}% 3382 | }}% 3383 | {\iftoggle{bbx:gbstrict}{}{\printfield{issue}% 3384 | \setunit*{\addspace}}% 3385 | %\usebibmacro{date} 3386 | \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸 3387 | {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸 3388 | {\usebibmacro{date}}% 3389 | }}}% 3390 | %\newunit 3391 | } 3392 | 3393 | % 3394 | % 调整页码前的标点和去掉期刊文章等页码后面的标点 3395 | % 3396 | \renewbibmacro*{note+pages}{%源来自standard.bbx 3397 | %\printfield{note}%不要note,note用来判断是否是报纸newspaper 3398 | \iffieldundef{pages}{}{ 3399 | \setunit{\bibpagespunct}% 3400 | \printfield{pages}}% 3401 | %\newunit 3402 | } 3403 | 3404 | 3405 | % 3406 | % 编者的符号修改一下 3407 | % v1.0 2016-07-01 3408 | % v1.0q 2019-03-01 hzz 修改editortype前的标点 3409 | % 3410 | \renewbibmacro*{editor}{%源来自biblatex.DEF 3411 | \ifboolexpr{ 3412 | test \ifuseeditor 3413 | and 3414 | not test {\ifnameundef{editor}} 3415 | } 3416 | {\printnames{editor}% 3417 | \iffieldundef{editortype}%增加一个类型判断,用于存在editortype的情况 3418 | {\setunit\addspace}%当没有editortype时,直接用句点 3419 | {%\setunit{\addcomma\space}% 3420 | \usebibmacro{editorstrg}}% 3421 | %\clearname{editor} 3422 | }% 3423 | {}} 3424 | 3425 | % 3426 | % 编者类型做一修改 3427 | % v1.0 2016-07-01 3428 | % v1.0q 2019-03-01 hzz 修改editortype不同语言的不同本地化字符串 3429 | % 3430 | \renewbibmacro*{editorstrg}{%源来自biblatex.DEF 3431 | \printtext[editortype]{% 3432 | \iffieldundef{editortype} 3433 | {% 3434 | % \ifboolexpr{ %这一段去掉,未定义编者类型情况下不处理 3435 | % test {\ifnumgreater{\value{editor}}{1}} 3436 | % or 3437 | % test {\ifandothers{editor}} 3438 | % } 3439 | % {\bibstring{editors}} 3440 | % {\bibstring{editor}} 3441 | } 3442 | {\ifbibxstring{\thefield{editortype}} %定义编者类型情况下处理,以后根据需要修改 3443 | {\ifboolexpr{ 3444 | test {\ifnumgreater{\value{editor}}{1}} 3445 | or 3446 | test {\ifandothers{editor}} 3447 | } 3448 | {\printdelim{streditortypes}} 3449 | {\printdelim{streditortype}}} 3450 | {\thefield{editortype}}}% 3451 | }} 3452 | 3453 | % 3454 | % 编者类型的本地化字符串输出 3455 | % v1.0q 2019-03-01 hzz 3456 | % 能对不同条目类型作格式设置的域格式,能对不同环境做格式设置的分隔符 3457 | % 能对不同文境作设置的包括排序,标签等 3458 | % 这里因为考虑可能标注和文献表中存在不同,所以用分隔符来输出本地化字符串 3459 | % 3460 | \DeclareDelimFormat{streditortypes}{% 3461 | \edef\userfieldabcde{userd}% 3462 | \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% 3463 | \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% 3464 | \ifcase\value{gbbiblocalcase}% 3465 | \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}scn}}{}% 3466 | \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}skr}}{}% 3467 | \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}sjp}}{}% 3468 | \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% 3469 | \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% 3470 | \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% 3471 | \or% 3472 | \bibstring{\thefield{editortype}scn}% 3473 | \or% 3474 | \addcomma\addthinspace\bibstring{\thefield{editortype}s}% 3475 | \fi} 3476 | % 3477 | \DeclareDelimFormat{streditortype}{% 3478 | \edef\userfieldabcde{userd}% 3479 | \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% 3480 | \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% 3481 | \ifcase\value{gbbiblocalcase}% 3482 | \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}cn}}{}% 3483 | \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}kr}}{}% 3484 | \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}jp}}{}% 3485 | \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% 3486 | \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% 3487 | \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% 3488 | \or% 3489 | \bibstring{\thefield{editortype}cn}% 3490 | \or% 3491 | \addcomma\addthinspace\bibstring{\thefield{editortype}}% 3492 | \fi} 3493 | 3494 | 3495 | % 3496 | % bookauthor域的输出, 3497 | % v1.0q 2019-03-01 hzz 3498 | % 不再对editor和bookauthor做sourcemap,而是下面的宏内逻辑代替, 3499 | % 使得除使用bookauthor外也可以使用editor,便于在使用editor时使用editortype 3500 | \renewbibmacro*{bybookauthor}{% 3501 | \ifnameundef{bookauthor}% 3502 | {\ifnameundef{editor}% 3503 | {}% 3504 | {\ifnamesequal{author}{editor}% 3505 | {}{\usebibmacro{editor}}}% 3506 | }% 3507 | {\ifnamesequal{author}{bookauthor}% 3508 | {}{\printnames{bookauthor}}% 3509 | }% 3510 | } 3511 | 3512 | % 责任者如果没有author用editor或translator替代 3513 | % 20210521 v1.0y hzz 3514 | %专著如果责任者是editor那么不用输出类型信息 3515 | \renewbibmacro*{editor+others}{% 3516 | \ifboolexpr{ 3517 | test \ifuseeditor 3518 | and 3519 | not test {\ifnameundef{editor}} 3520 | } 3521 | {\printnames{editor}% 3522 | \clearname{editor}} 3523 | {}} 3524 | %要注意要使用translator那么需要开启usetranslator选项的。 3525 | %注意其中的标点处理。 3526 | \renewbibmacro*{translator+others}{% 3527 | \ifboolexpr{ 3528 | test \ifusetranslator 3529 | and 3530 | not test {\ifnameundef{translator}} 3531 | } 3532 | {\renewcommand{\aftertransdelim}{\adddot\addspace}{\adddot\addspace}\printnames{translator}% 3533 | \clearname{translator}} 3534 | {}} 3535 | 3536 | 3537 | % 3538 | % 修改期刊的标题 3539 | % 3540 | \renewbibmacro*{periodical}{%源来自biblatex.DEF 3541 | \iffieldundef{title} 3542 | {} 3543 | {\printtext[title]{\bibtitlefont% 3544 | \printfield[titlecase]{title}% 3545 | %\setunit{\subtitlepunct}% 3546 | \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 3547 | {}{\setunit{\subtitlepunct} 3548 | \printfield[titlecase]{subtitle}}% 3549 | %}%把编组结束移到后面去 3550 | \iftoggle{bbx:gbtype}{% 3551 | \iffieldundef{usera}{}{%在标题后直接给出文献标识字母 3552 | \printfield[gbtypeflag]{usera}}}{} 3553 | }} 3554 | } 3555 | 3556 | % 3557 | % 期刊的标题做修改 3558 | % 3559 | \renewbibmacro*{title+issuetitle}{%源来自standard.BBX 3560 | \usebibmacro{periodical}% 3561 | %\setunit*{\addspace}% 3562 | \setunit*{\adddot\addspace}%标点修改为句点 3563 | \iffieldundef{series} 3564 | {} 3565 | {\newunit 3566 | \printfield{series}% 3567 | \setunit{\addspace}}% 3568 | \usebibmacro{periodical+issue}%将issue调整到上面来,并修改 3569 | \iffieldundef{number}{}{%%进一步处理有范围的数字 3570 | \multinumberparser{\thefield{number}}}% 3571 | \iffieldundef{volume}% 3572 | {\printfield{year}% 3573 | \printtext{\mkbibparens{\multinumberfirst}}% 3574 | \bibrangedash% 3575 | \iffieldundef{endyear}{}{\printfield{endyear}\printtext{\mkbibparens{\multinumbersecond}}}% 3576 | }% 3577 | {\multivolparser{\thefield{volume}}% 3578 | \printfield{year}% 3579 | \setunit{\addcomma\space}%将冒号修改为逗号 3580 | \printtext{\multivolfirst}% 3581 | \printtext{\mkbibparens{\multinumberfirst}}% 3582 | \bibrangedash% 3583 | \iffieldundef{endyear}{}{% 3584 | \printfield{endyear}% 3585 | \setunit{\addcomma\space}%将冒号修改为逗号 3586 | \printtext{\multivolsecond}% 3587 | \printtext{\mkbibparens{\multinumbersecond}}}% 3588 | }% 3589 | \setunit{\addcomma\space}% 3590 | \printfield{eid}% 3591 | \setunit{\addspace}% 3592 | %\usebibmacro{issue+date}% 3593 | %\setunit{\addcolon\space}% 3594 | \usebibmacro{issue}% 3595 | \newunit} 3596 | 3597 | % 3598 | % 新增一个样式用于调整期刊年份的格式,只打印年份 3599 | % 3600 | \newbibmacro*{periodical+issue}{% 3601 | \printtext{%去掉了[parens] 3602 | \iffieldundef{issue} 3603 | {%\usebibmacro{date}%修改为下一句 3604 | }% 3605 | {\printfield{issue}% 3606 | \setunit*{\addspace}% 3607 | %\usebibmacro{date}%修改为下一句 3608 | }% 3609 | }% 3610 | %\newunit 3611 | } 3612 | 3613 | % 3614 | % 重设专利title的输出,将文献类型标识符输出出去 3615 | % 3616 | \newbibmacro*{patenttitle}{%原输出来自biblatex.def文件 3617 | \ifboolexpr{% 3618 | test{\iffieldundef{title}}% 3619 | and% 3620 | test{\iffieldundef{subtitle}}% 3621 | }% 3622 | {}% 3623 | {\printtext[title]{\bibtitlefont% 3624 | \printfield[titlecase]{title}% 3625 | \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 3626 | {}{\setunit{\subtitlepunct}% 3627 | \printfield[titlecase]{subtitle}}% 3628 | \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 3629 | {\setunit{\subtitlepunct}\printfield{titleaddon}}% 3630 | \setunit{\subtitlepunct}\printfield{number}%写专利号 3631 | \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}% 3632 | %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 3633 | %\newunit 3634 | }% 3635 | }% 3636 | } 3637 | 3638 | 3639 | 3640 | % 3641 | % 修改in:用于inbook、incollection、inproceedings等类型 3642 | % 2018.04.20,v1.0k,renewed marco,by hzz 3643 | % 20190212,v1.0q,增加中英文区分,by hzz 3644 | % 3645 | % 原理方法:使用bibmacro{in:}改变了以前在driver中直接输出//的方式,同时也简化了标点控制。 3646 | \renewbibmacro*{in:}{% 3647 | \iftoggle{bbx:gbpunctin}{\printtext{\allowbreak\texttt{//}\allowbreak}}%\addthinspace 3648 | {\setunit{\adddot\addspace}% 3649 | \iffieldequalstr{userd}{chinese}% 3650 | {\printtext{\bibstring{incn}}}% 3651 | {\printtext{\bibstring{in}}}% 3652 | }}%\newunit\newblock\intitlepunct 3653 | 3654 | % 3655 | % 修改type域的输出格式 3656 | % 2019.02.12,v1.0q,byhzz 3657 | % 使其可以区分中英文输出不同的格式,比如博士论文英文输出PHD thesis,中文则是博士学位论文 3658 | \DeclareFieldFormat{type}% 3659 | {\iffieldequalstr{userd}{chinese}% 3660 | {\ifbibxstring{#1cn}{\bibxstring{#1cn}}{#1}}% 3661 | {\ifbibstring{#1}{\bibstring{#1}}{#1}}% 3662 | } 3663 | 3664 | % 3665 | % 修改series域的输出格式 3666 | % 2019.05.01,v1.0r,byhzz 3667 | \renewbibmacro*{series+number}{% 3668 | \printfield{series}% 3669 | %\setunit*{\addspace}% 3670 | %\printfield{number}% 3671 | %\newunit 3672 | } 3673 | 3674 | %===================================================================== 3675 | %设置驱动格式 3676 | %===================================================================== 3677 | % 3678 | % book条目类的驱动 3679 | % 3680 | \DeclareBibliographyDriver{book}{%源来自standard.bbx文件 3681 | \usebibmacro{bibindex}% 3682 | \usebibmacro{begentry}% 3683 | \usebibmacro{author/editor+others/translator+others}% 3684 | \ifnameundef{namea}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 3685 | \usebibmacro{maintitle+title}% 3686 | \iftoggle{bbx:gbstrict}{}{% 3687 | \newunit 3688 | \printlist{language}% 3689 | \newunit\newblock% 3690 | \usebibmacro{byauthor}% 3691 | \newunit\newblock}% 3692 | \usebibmacro{byeditor+others}% 3693 | \newunit 3694 | \printfield{edition}% 3695 | \newunit\newblock%% 3696 | \iftoggle{bbx:gbstrict}{}{% 3697 | \iffieldundef{maintitle}% 3698 | {\printfield{volume}% 3699 | \printfield{part}}% 3700 | {}% 3701 | \newunit% 3702 | \printfield{volumes}% 3703 | \newunit\newblock% 3704 | \usebibmacro{series+number}}% 3705 | \newunit\newblock% 3706 | %\printfield{note}% 3707 | %\newunit\newblock% 3708 | \usebibmacro{publisher+location+date}% 3709 | %\newunit\newblock %这里标点去掉 3710 | \usebibmacro{chapter+pages}% 3711 | \iffieldundef{url}{}{%当没有网址时也不输出 3712 | \usebibmacro{modifydate}}%带括号的修改或更新日期, 3713 | \usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。 3714 | \newunit\newblock% 3715 | \printfield{pagetotal}% 3716 | \newunit\newblock% 3717 | \iftoggle{bbx:isbn} 3718 | {\printfield{isbn}} 3719 | {}% 3720 | \newunit\newblock 3721 | %\usebibmacro{doi+eprint+url}% 3722 | %\newunit\newblock 3723 | \usebibmacro{addendum+pubstate}% 3724 | \setunit{\bibpagerefpunct}\newblock 3725 | \usebibmacro{pageref}% 3726 | \newunit\newblock 3727 | \iftoggle{bbx:related} 3728 | {\usebibmacro{related:init}% 3729 | \usebibmacro{related}} 3730 | {}% 3731 | \usebibmacro{finentry}\usebibmacro{annotation}} 3732 | 3733 | 3734 | % 3735 | % 期刊文章,连续出版物中的析出文献的格式 3736 | % 3737 | \DeclareBibliographyDriver{article}{% 3738 | \usebibmacro{bibindex}% 3739 | \usebibmacro{begentry}% 3740 | \usebibmacro{author/translator+others}% 3741 | \ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 3742 | \usebibmacro{title}% 3743 | \iftoggle{bbx:gbstrict}{}{% 3744 | \newunit% 3745 | \printlist{language}% 3746 | \newunit\newblock 3747 | \usebibmacro{byauthor}% 3748 | \newunit\newblock 3749 | \usebibmacro{bytranslator+others}% 3750 | \newunit\newblock 3751 | \printfield{version}}% 3752 | \newunit\newblock 3753 | %\usebibmacro{in:}% 不使用in来表示期刊等连续出版物 3754 | \usebibmacro{journal+issuetitle}% 3755 | %\newunit 3756 | % \usebibmacro{byeditor+others}% 3757 | % \newunit 3758 | \usebibmacro{note+pages}% 3759 | \iffieldequalstr{note}{news}{}{%当是新闻时不输出修改或更新日期 3760 | \iffieldundef{url}{}{%当没有网址时也不输出 3761 | \iftoggle{bbx:url}{%当url选项为false时,也不输出 3762 | \usebibmacro{modifydate}}{}}}%带括号的修改或更新日期, 3763 | \usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置 3764 | \newunit\newblock 3765 | \iftoggle{bbx:isbn} 3766 | {\printfield{issn}} 3767 | {}% 3768 | \newunit\newblock 3769 | %\usebibmacro{doi+eprint+url}% 3770 | %\newunit\newblock 3771 | \usebibmacro{addendum+pubstate}% 3772 | \setunit{\bibpagerefpunct}\newblock 3773 | \usebibmacro{pageref}% 3774 | \newunit\newblock 3775 | \iftoggle{bbx:related} 3776 | {\usebibmacro{related:init}% 3777 | \usebibmacro{related}} 3778 | {}% 3779 | \usebibmacro{finentry}\usebibmacro{annotation}} 3780 | 3781 | 3782 | 3783 | % 3784 | % 连续出版物的驱动 3785 | % 3786 | \DeclareBibliographyDriver{periodical}{%源来自standard.BBX 3787 | \usebibmacro{bibindex}% 3788 | \usebibmacro{begentry}% 3789 | \usebibmacro{editor}% 3790 | %\setunit{\labelnamepunct}\newblock 3791 | \newunit\newblock %删除上面一行,添加这一行 3792 | \usebibmacro{title+issuetitle}% 3793 | \newunit\newblock% 3794 | \usebibmacro{location+institution+date}%添加这一行用于输出地址,单位和时间 3795 | \newunit\newblock%添加这一行 3796 | \iftoggle{bbx:gbstrict}{}{% 3797 | \printlist{language}% 3798 | \newunit\newblock 3799 | \usebibmacro{byeditor}% 3800 | \newunit\newblock 3801 | \printfield{note}% 3802 | \newunit\newblock} 3803 | \iftoggle{bbx:isbn} 3804 | {\printfield{issn}} 3805 | {}% 3806 | \newunit\newblock 3807 | \usebibmacro{doi+eprint+url}% 3808 | \newunit\newblock 3809 | \usebibmacro{addendum+pubstate}% 3810 | \setunit{\bibpagerefpunct}\newblock 3811 | \usebibmacro{pageref}% 3812 | \newunit\newblock 3813 | \iftoggle{bbx:related} 3814 | {\usebibmacro{related:init}% 3815 | \usebibmacro{related}} 3816 | {}% 3817 | \usebibmacro{finentry}\usebibmacro{annotation}} 3818 | 3819 | % 3820 | % 专利文献驱动 3821 | % 3822 | \DeclareBibliographyDriver{patent}{%源来自standard.BBX 3823 | \usebibmacro{bibindex}% 3824 | \usebibmacro{begentry}% 3825 | \usebibmacro{author}% 3826 | \ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 3827 | %\usebibmacro{title}% 3828 | \usebibmacro{patenttitle}%给出专利专用的标题输出 3829 | \iftoggle{bbx:gbstrict}{}{% 3830 | \newunit% 3831 | \printlist{language}% 3832 | \newunit\newblock 3833 | \usebibmacro{byauthor}}% 3834 | \newunit\newblock 3835 | \printfield{type}% 3836 | \setunit*{\addspace}% 3837 | %\printfield{number}%已放到patenttitle中处理 3838 | \iflistundef{location} 3839 | {} 3840 | {\setunit*{\addspace}% 3841 | \printtext{%[parens] 3842 | \printlist[][-\value{listtotal}]{location}}}% 3843 | \newunit\newblock 3844 | \usebibmacro{byholder}% 3845 | \newunit\newblock 3846 | \printfield{note}% 3847 | \newunit\newblock 3848 | \usebibmacro{newsdate}% 3849 | %\newunit\newblock 3850 | \usebibmacro{doi+eprint+url}% 3851 | \newunit\newblock 3852 | \usebibmacro{addendum+pubstate}% 3853 | \setunit{\bibpagerefpunct}\newblock 3854 | \usebibmacro{pageref}% 3855 | \newunit\newblock 3856 | \iftoggle{bbx:related} 3857 | {\usebibmacro{related:init}% 3858 | \usebibmacro{related}} 3859 | {}% 3860 | \usebibmacro{finentry}\usebibmacro{annotation}} 3861 | 3862 | 3863 | % 3864 | % 在线文献驱动 3865 | % 3866 | \DeclareBibliographyDriver{online}{%源来自standard.BBX 3867 | \usebibmacro{bibindex}% 3868 | \usebibmacro{begentry}% 3869 | \usebibmacro{author/editor+others/translator+others}% 3870 | \ifnameundef{namea}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 3871 | \usebibmacro{title}% 3872 | \iftoggle{bbx:gbstrict}{}{% 3873 | \newunit% 3874 | \printlist{language}% 3875 | \newunit\newblock 3876 | \usebibmacro{byauthor}% 3877 | \newunit\newblock 3878 | \usebibmacro{byeditor+others}% 3879 | \newunit\newblock 3880 | \printfield{note}}% 3881 | \newunit 3882 | \printfield{version}% 3883 | \newunit\newblock 3884 | %\printlist{organization}% 3885 | \printlist{institution}% 3886 | \newunit\newblock 3887 | \ifboolexpr{% 3888 | test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% 3889 | }{\usebibmacro{date}}% 3890 | {\usebibmacro{modifydate}}%修改或更新日期,为带括号的时间 3891 | \usebibmacro{url+urldate}%从下面移上来 3892 | \newunit\newblock 3893 | \iftoggle{bbx:eprint} 3894 | {\usebibmacro{eprint}} 3895 | {}% 3896 | \newunit\newblock 3897 | %\usebibmacro{url+urldate}% 3898 | %\newunit\newblock 3899 | \usebibmacro{addendum+pubstate}% 3900 | \setunit{\bibpagerefpunct}\newblock 3901 | \usebibmacro{pageref}% 3902 | \newunit\newblock 3903 | \iftoggle{bbx:related} 3904 | {\usebibmacro{related:init}% 3905 | \usebibmacro{related}} 3906 | {}% 3907 | \usebibmacro{finentry}\usebibmacro{annotation}} 3908 | 3909 | 3910 | % 3911 | % 报告类型驱动 3912 | % 当有网址无出版项时,用online输出 3913 | % 3914 | \DeclareBibliographyDriver{report}{% 3915 | \usebibmacro{bibindex}% 3916 | \usebibmacro{begentry}% 3917 | \usebibmacro{author/editor+others/translator+others}% 3918 | \ifnameundef{namea}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 3919 | \usebibmacro{title}% 3920 | \iftoggle{bbx:gbstrict}{}{% 3921 | \newunit% 3922 | \printlist{language}% 3923 | \newunit\newblock 3924 | \usebibmacro{byauthor}}% 3925 | \newunit\newblock 3926 | \usebibmacro{byeditor+others}%增加的译者信息 3927 | \newunit\newblock 3928 | \printfield{type}% 3929 | \setunit*{\addspace}% 3930 | \printfield{number}% 3931 | \newunit\newblock 3932 | \printfield{version}% 3933 | \newunit 3934 | \printfield{note}% 3935 | \newunit\newblock 3936 | \usebibmacro{publisher+location+date}% 3937 | %\newunit\newblock 3938 | \usebibmacro{chapter+pages}% 3939 | \usebibmacro{doi+eprint+url}% 3940 | \newunit 3941 | \printfield{pagetotal}% 3942 | \newunit\newblock 3943 | \iftoggle{bbx:isbn} 3944 | {\printfield{isrn}} 3945 | {}% 3946 | \newunit\newblock 3947 | % \usebibmacro{doi+eprint+url}% 3948 | % \newunit\newblock 3949 | \usebibmacro{addendum+pubstate}% 3950 | \setunit{\bibpagerefpunct}\newblock 3951 | \usebibmacro{pageref}% 3952 | \newunit\newblock 3953 | \iftoggle{bbx:related} 3954 | {\usebibmacro{related:init}% 3955 | \usebibmacro{related}} 3956 | {}% 3957 | \usebibmacro{finentry}\usebibmacro{annotation}} 3958 | 3959 | % 3960 | % 论文、手册类型驱动 3961 | % 2016-11-11,增加了译者信息 3962 | % 3963 | \DeclareBibliographyDriver{manual}{% 3964 | \usebibmacro{bibindex}% 3965 | \usebibmacro{begentry}% 3966 | \usebibmacro{author/editor+others/translator+others}% 3967 | \ifnameundef{namea}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 3968 | \usebibmacro{title}% 3969 | \iftoggle{bbx:gbstrict}{}{% 3970 | \newunit% 3971 | \printlist{language}% 3972 | \newunit\newblock 3973 | \usebibmacro{byauthor}}% 3974 | \newunit\newblock 3975 | \usebibmacro{byeditor+others}%增加的译者信息 3976 | \newunit\newblock 3977 | \iftoggle{bbx:gbfieldtype}{% 3978 | \printfield{type}% 3979 | \setunit*{\addspace}}{}% 3980 | \printfield{number}% 3981 | \newunit\newblock 3982 | \printfield{version}% 3983 | \newunit 3984 | \printfield{note}% 3985 | \newunit\newblock 3986 | \usebibmacro{institution+location+date}% 3987 | %\newunit\newblock 3988 | \usebibmacro{chapter+pages}% 3989 | \iffieldundef{url}{}{%当没有网址时也不输出修改或更新日期 3990 | \usebibmacro{modifydate}}%修改或更新日期为带括号的时间 3991 | \usebibmacro{doi+eprint+url}% 3992 | \newunit 3993 | \printfield{pagetotal}% 3994 | \newunit\newblock 3995 | \iftoggle{bbx:isbn} 3996 | {\printfield{isrn}} 3997 | {}% 3998 | \newunit\newblock 3999 | % \usebibmacro{doi+eprint+url}% 4000 | % \newunit\newblock 4001 | \usebibmacro{addendum+pubstate}% 4002 | \setunit{\bibpagerefpunct}\newblock 4003 | \usebibmacro{pageref}% 4004 | \newunit\newblock 4005 | \iftoggle{bbx:related} 4006 | {\usebibmacro{related:init}% 4007 | \usebibmacro{related}} 4008 | {}% 4009 | \usebibmacro{finentry}\usebibmacro{annotation}} 4010 | 4011 | % 4012 | % 备选类型驱动 4013 | % 4014 | % 利用biblatex的misc驱动 4015 | \DeclareBibliographyDriver{misc}{% 4016 | \usebibmacro{bibindex}% 4017 | \usebibmacro{begentry}% 4018 | \usebibmacro{author/editor+others/translator+others}% 4019 | \ifnameundef{namea}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 4020 | \usebibmacro{title}% 4021 | \iftoggle{bbx:gbstrict}{}{% 4022 | \newunit 4023 | \printlist{language}% 4024 | \newunit\newblock 4025 | \usebibmacro{byauthor}% 4026 | \newunit\newblock 4027 | \usebibmacro{byeditor+others}}% 4028 | \newunit\newblock 4029 | \printfield{howpublished}% 4030 | \newunit\newblock 4031 | \printfield{type}% 4032 | \newunit 4033 | \printfield{version}% 4034 | \newunit 4035 | \printfield{note}% 4036 | \newunit\newblock 4037 | \usebibmacro{institution+location+date}% 4038 | %\usebibmacro{organization+location+date}% 4039 | %\newunit\newblock 4040 | \usebibmacro{doi+eprint+url}% 4041 | \newunit\newblock 4042 | \usebibmacro{addendum+pubstate}% 4043 | \setunit{\bibpagerefpunct}\newblock 4044 | \usebibmacro{pageref}% 4045 | \newunit\newblock 4046 | \iftoggle{bbx:related} 4047 | {\usebibmacro{related:init}% 4048 | \usebibmacro{related}} 4049 | {}% 4050 | \usebibmacro{finentry}\usebibmacro{annotation}} 4051 | 4052 | % 4053 | % 增加inbook:parent用于辅助crossref传统功能的实现 4054 | % 用在{crosscite}宏中 4055 | % 20210216,v1.0w,hzz 4056 | \newbibmacro*{inbook:parent}{% 4057 | \usebibmacro{bybookauthor}% 4058 | \ifnameundef{bookauthor}{% 4059 | \ifnameundef{editor}{}{\newunit}% 4060 | }{\newunit}%替换下一句 4061 | %\newunit\newblock 4062 | \iffieldundef{series}{}{\usebibmacro{series+number}\setunit{\addcolon\addspace}}%为处理一些存在series的情况而增加 4063 | \usebibmacro{maintitle+booktitle}% 4064 | \iffieldundef{volume}{}{\setunit{\addcolon\addspace}\printfield{volume}}% 4065 | \iffieldundef{number}{}{\setunit{\addcolon\addspace}\printfield{number}}%增加卷和册信息 4066 | \newunit\newblock% 4067 | % \usebibmacro{byeditor+others}% 4068 | % \newunit\newblock 4069 | \printfield{edition}% 4070 | \newunit 4071 | \iftoggle{bbx:gbstrict}{}{% 4072 | % \iffieldundef{maintitle} 4073 | % {\printfield{volume}% 4074 | % \printfield{part}} 4075 | % {}% 4076 | % \newunit 4077 | % \printfield{volumes}% 4078 | % \newunit\newblock 4079 | % \usebibmacro{series+number} 4080 | }% 4081 | \newunit\newblock 4082 | %\printfield{note}% 4083 | %\newunit\newblock 4084 | \usebibmacro{publisher+location+date}} 4085 | 4086 | % 4087 | % 专著中的析出文献的格式修改 4088 | % 4089 | \DeclareBibliographyDriver{inbook}{%源来自standard.bbx 4090 | \usebibmacro{bibindex}% 4091 | \usebibmacro{begentry}% 4092 | \usebibmacro{author/translator+others}% 4093 | \ifboolexpr{ 4094 | test {\ifnameundef{author}} 4095 | and 4096 | test {\ifnameundef{translator}} 4097 | }{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 4098 | \usebibmacro{title}% 4099 | \usebibmacro{in:}% 4100 | %\printtext{\texttt{//}\addthinspace}% 4101 | \usebibmacro{crosscite}{inbook:parent}% 4102 | %\newunit\newblock 4103 | \usebibmacro{chapter+pages}% 4104 | %\newunit\newblock 4105 | \usebibmacro{doi+eprint+url}%移到上面来 4106 | \newunit\newblock 4107 | \iftoggle{bbx:isbn} 4108 | {\printfield{isbn}} 4109 | {}% 4110 | \newunit\newblock 4111 | % \usebibmacro{doi+eprint+url}% 4112 | % \newunit\newblock 4113 | \usebibmacro{addendum+pubstate}% 4114 | \setunit{\bibpagerefpunct}\newblock 4115 | \usebibmacro{pageref}% 4116 | \newunit\newblock 4117 | \iftoggle{bbx:related} 4118 | {\usebibmacro{related:init}% 4119 | \usebibmacro{related}} 4120 | {}% 4121 | \usebibmacro{finentry}\usebibmacro{annotation}} --------------------------------------------------------------------------------