├── .gitignore ├── LICENSE ├── README.md ├── gb7714-2015.bbx ├── gb7714-2015.cbx ├── logo.pdf ├── main.pdf ├── main.tex ├── tongjithesis.bib └── tongjithesis.cls /.gitignore: -------------------------------------------------------------------------------- 1 | .texpadtmp 2 | _minted-main -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TongjiThesis 2 | 3 | ## $\LaTeX{}$ Template for Tongji Undergraduate Thesis 4 | 5 | This repository establishes LaTeX template for Tongji Undergraduate Thesis. 6 | 7 | ### Documentation 8 | 9 | Please refer to `main.tex` for usage and `main.pdf` for demonstration. 10 | 11 | ### Downloads 12 | 13 | * Click [here](https://github.com/SXKDZ/tongjithesis/releases) to download 14 | 15 | ### Licence 16 | 17 | Apache 2.0 18 | 19 | ## 同济大学本科毕业设计论文$\LaTeX{}$模板 20 | 21 | 本仓库为同济本科毕业设计论文的LaTeX模板。 22 | 23 | ### 文档 24 | 25 | 请查阅 `main.tex`以获取相关使用方法,并且查阅 `main.pdf` 查看演示效果。 26 | 27 | ### 下载 28 | 29 | * 点击[这里](https://github.com/SXKDZ/tongjithesis/releases)下载 30 | 31 | ### 开源协议 32 | 33 | 本模板遵循Apache 2.0协议。 -------------------------------------------------------------------------------- /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{2019/03/28 v1.0r} 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 | \DeclareDatamodelFields[type=field,datatype=literal]{mark,medium,nameformat} 198 | \DeclareDatamodelFields[type=field,datatype=integer]{namefmtid} 199 | \DeclareDatamodelFields[type=field,datatype=literal]{shortbooktitle} 200 | \DeclareDatamodelFields[type=field,datatype=literal]{lansortorder} 201 | 202 | 203 | 204 | %===================================================================== 205 | % 设置宏包选项 206 | %===================================================================== 207 | % 208 | % 增加一个控制是否输出annotation域的选项,该域可以用于在文献条目后面输出一些注释信息 209 | % 20190509,v1,0s,hzz 210 | \newtoggle{bbx:gbannote} 211 | \DeclareBibliographyOption{gbannote}[false]{%biblatex低版本 212 | \settoggle{bbx:gbannote}{#1}} 213 | \ExecuteBibliographyOptions{gbannote} 214 | % 215 | %用于在文献条目后面输出注释信息的宏 216 | %FieldFormat{annotation}用于设置注释信息的格式 217 | \DeclareFieldFormat{annotation}{% 218 | \printtext{\addspace(#1)}% 219 | } 220 | \renewbibmacro*{annotation}{% 221 | \iftoggle{bbx:gbannote}% 222 | {\iffieldundef{annotation}% 223 | {\printfile[annotation]{\bibannotationprefix\thefield{entrykey}.tex}}% 224 | {\printfield{annotation}}}% 225 | {}% 226 | } 227 | 228 | % 229 | % 增加一个控制是否输出type域的选项 230 | % 20190212,v1,0q,hzz 231 | \newtoggle{bbx:gbfieldtype} 232 | \DeclareBibliographyOption{gbfieldtype}[false]{%biblatex低版本 233 | \settoggle{bbx:gbfieldtype}{#1}} 234 | \ExecuteBibliographyOptions{gbfieldtype} 235 | 236 | % 237 | % 增加一个控制是否根据页码重设脚注数字标号的选项 238 | % 20190422,v1,0r,hzz 239 | \newtoggle{bbx:gbfnperpage} 240 | \DeclareBibliographyOption{gbfnperpage}[false]{% 241 | \settoggle{bbx:gbfnperpage}{#1}} 242 | \ExecuteBibliographyOptions{gbfnperpage} 243 | 244 | 245 | % 246 | % 增加一个选项,用于控制是否实现GB/T 7714-2015标准的脚注文献表 247 | % 20190203,v1.0p,hzz 248 | % 原理方法:默认做patch,文献引用带圈上标数字表示,脚注中的文献用带圈非上标数字做标签 249 | % 当前面的脚注中已经存在当前文献,那么当前文献内容不再输出而用同(4)这样的方式 250 | % 需要注意的是由于小页环境和表格中的脚注本身的问题,可能会有一些问题 251 | \DeclareBibliographyOption{gbfootbib}[false]{% 252 | \ifstrequal{#1}{false}{}{\execgbfootbib}} 253 | \ExecuteBibliographyOptions{gbfootbib} 254 | 255 | %% 256 | \newlength{\footbibmargin} 257 | \newlength{\footbiblabelsep} 258 | \setlength{\footbibmargin}{1em}%脚注的段落左侧缩进距离 259 | \setlength{\footbiblabelsep}{0.5em}%脚注中标记号与脚注段落的间距 260 | \def\execgbfootbib% 261 | {% 262 | %开启引用跟踪计数器,为使用\ifciteseen等测试命令 263 | \ExecuteBibliographyOptions{citetracker=true} 264 | % 265 | %利用footmisc宏包来实现脚注文献的悬挂对齐 266 | \AtEndPreamble{ 267 | \@ifclassloaded{beamer}{}{ 268 | %beamer类因为其特殊性,为避免冲突不调footmisc。 269 | %同时footmisc与hyperref宏包也不兼容,所以使用footmisc时会破坏脚注的超链接 270 | %如果要实现超链接可以将下句注释掉,这里留着主要是实现悬挂对齐。 271 | %\PassOptionsToPackage{perpage,hang}{footmisc}% 272 | %\RequirePackage{footmisc}% 273 | 274 | %重新实现脚注的根据单页重设脚注号码 275 | %重新实现脚注的悬挂对齐问题,不再使用footmisc,直接从latex核心代码和hyperref代码进行修改 276 | %v1.0q 20190317 hzz 277 | %v1.0r 20190422 hzz 根据gbfnperpage选项设置 278 | \iftoggle{bbx:gbfnperpage}% 279 | {\@addtoreset{footnote}{page}}{}%重设计数器 280 | 281 | \@ifpackageloaded{hyperref}{%加载hyperref则对\H@@footnotetext做重定义 282 | \long\def\H@@footnotetext##1{\insert\footins{% 283 | \reset@font\footnotesize 284 | \interlinepenalty\interfootnotelinepenalty 285 | \splittopskip\footnotesep 286 | \splitmaxdepth \dp\strutbox \floatingpenalty \@MM 287 | \hsize\columnwidth \@parboxrestore 288 | \protected@edef\@currentlabel{% 289 | \csname p@footnote\endcsname\@thefnmark 290 | }% 291 | \color@begingroup 292 | \leftskip \footbibmargin%增加的左侧缩进 293 | \@makefntext{% 294 | \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% 295 | }% 296 | \color@endgroup}}% 297 | 298 | \long\def\H@@mpfootnotetext##1{% 299 | \global\setbox\@mpfootins\vbox{% 300 | \unvbox\@mpfootins 301 | \reset@font\footnotesize 302 | \hsize\columnwidth 303 | \@parboxrestore 304 | \protected@edef\@currentlabel 305 | {\csname p@mpfootnote\endcsname\@thefnmark}% 306 | \leftskip \footbibmargin%增加的左侧缩进 307 | \color@begingroup 308 | \@makefntext{% 309 | \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% 310 | \color@endgroup}} 311 | }{%否则对latex核心代码中的\@footnotetext做重定义 312 | \long\def\@footnotetext##1{\insert\footins{% 313 | \reset@font\footnotesize 314 | \interlinepenalty\interfootnotelinepenalty 315 | \splittopskip\footnotesep 316 | \splitmaxdepth \dp\strutbox \floatingpenalty \@MM 317 | \hsize\columnwidth \@parboxrestore 318 | \protected@edef\@currentlabel{% 319 | \csname p@footnote\endcsname\@thefnmark 320 | }% 321 | \color@begingroup 322 | \leftskip \footbibmargin%增加的左侧缩进 323 | \@makefntext{% 324 | \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox% 325 | }% 326 | \color@endgroup}}% 327 | 328 | \long\def\@mpfootnotetext##1{% 329 | \global\setbox\@mpfootins\vbox{% 330 | \unvbox\@mpfootins 331 | \reset@font\footnotesize 332 | \hsize\columnwidth 333 | \@parboxrestore 334 | \protected@edef\@currentlabel 335 | {\csname p@mpfootnote\endcsname\@thefnmark}% 336 | \leftskip \footbibmargin%增加的左侧缩进 337 | \color@begingroup 338 | \@makefntext{% 339 | \rule\z@\footnotesep\ignorespaces##1\@finalstrut\strutbox}% 340 | \color@endgroup}} 341 | } 342 | 343 | \long\def\@makefntext##1{%增加了脚注标记与正文的间隔 344 | \parindent 1em\noindent \hb@xt@ 0em{\hss \@makefnmark\makebox[\footbiblabelsep]{}}##1} 345 | 346 | } 347 | 348 | % 349 | %使脚注标记加圈并设置数字的字体为tiny,不使用修改thefootnote的方式 350 | \def\@makefnmark{\hbox{\@textsuperscript{\textcircled{\tiny\@thefnmark}}}} 351 | %做patch使得脚注内容中的脚注数字标签不上标 352 | \pretocmd{\@makefntext}{% 353 | \def\@makefnmark{% 354 | \hbox{\textcircled{\tiny\@thefnmark}}% 355 | }% 356 | }{}{} 357 | } 358 | 359 | % 360 | %判断当前文献是否已经引用过且是做的footfullcite(即已经作为脚注输出文献内容) 361 | %记录首次输出时的脚注号码,用于后面再次引用该文献时的输出,比如同(4)。 362 | %v1.0q 20190309 区分使脚注标注适应minipage中的情况 363 | \newbibmacro*{citesavefn}{% 364 | \ifciteseen%当被引用过为true 365 | {\ifcsdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}%当已经定义过脚注序号信息 366 | {\csgdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% 367 | \str@sameentry\gdef\@thefnmark{\csuse{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}% 368 | \@makefnmark% 369 | }}% 370 | {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% 371 | \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% 372 | }}% 373 | }% 374 | {\csxdef{sec\arabic{refsection}\arabic{page}et\thefield{entrykey}}{% 375 | \ifcsstring{@mpfn}{mpfootnote}{\@alph\c@mpfootnote}{\thefootnote}% 376 | %判断在minipage中比较麻烦,这里使用\@mpfn的定义进行判断 377 | }}% 378 | } 379 | 380 | % 381 | %重定义\footfullcite使完成gb7714-2015的脚注文献要求 382 | \DeclareCiteCommand{\footfullcite}[\mkbibfootnote]% 383 | {\defcounter{maxnames}{\blx@maxbibnames}%局部定义maxnames和minnames计数器 384 | \defcounter{minnames}{\blx@minbibnames}%使footfullcite内的作者输出与正文文献表中的一致。 385 | \usebibmacro{prenote}% 386 | \renewbibmacro*{postnote}{% 387 | \iffieldundef{postnote}% 388 | {}{\setunit{\addcolon\addspace}\printfield{postnote}}}%与ay样式不同,由于已修改postnote域格式,直接用printfield 389 | }% 390 | {\usebibmacro{citesavefn}% 391 | \ifcsdef{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}% 392 | {\csuse{labelsec\arabic{refsection}\arabic{page}et\thefield{entrykey}}}%\nopunct 393 | {\usedriver{\DeclareNameAlias{sortname}{default}}{\thefield{entrytype}}}% 394 | }% 395 | {\multicitedelim}% 396 | {\usebibmacro{postnote}} 397 | 398 | } 399 | 400 | % 401 | % 增加一个选项,用于控制gb7714的使用范围,即英文文献和中文文献使用不同的样式 402 | % 20180814,v1.0m,hzz 403 | % 原理方法: 404 | % 只为兼容性考虑不做任何处理 405 | \DeclareBibliographyOption{gbstyle}[true]{%biblatex低版本 406 | } 407 | 408 | % 409 | % 增加一个控制是否输出文献类型和载体标识的选项 410 | % 411 | % 原理方法: 412 | % 对于biblatex3.4以上版本DeclareBibliographyOption命令中的[datatype]如果是boolean,那么是可以省略的 413 | % 所以用老版本的不用[datatype]的命令可以兼容所有biblatex版本 414 | \newtoggle{bbx:gbtype} 415 | %\DeclareBibliographyOption[boolean]{gbtype}[true]{%biblatex高版本 416 | \DeclareBibliographyOption{gbtype}[true]{%biblatex低版本 417 | \settoggle{bbx:gbtype}{#1}} 418 | \ExecuteBibliographyOptions{gbtype} 419 | 420 | % 421 | % 增加一个源文件编码选择选项,当true时可以使用GBK编码。 422 | % v1.0k, 2018.05.08, by hzz 423 | % 424 | % 原理方法:将需要输出的中文字符串用命令形式表示存储,采用utf8编码时采用bbx文档 425 | % 内的定义即是utf8编码的中文字符串,但tex源文件是gbk编码时,利用gb7714-2015-gbk.def 426 | % 文档内的gbk编码的字符串覆盖。这种覆盖只能在宏包末尾加载时成功实现,所以使用 427 | % AtEndOfPackage。该解决思路源自biblatex-caspervector宏包。 428 | % 另外注意: 429 | % gbk编码的tex文档,利用pdflatex/latex能正确编译,利用xelatex能编译,但中文显示乱码 430 | % 在源文档前面增加 XeTeX 原语:\XeTeXinputencoding "GBK" 后,显示正常 431 | % utf-8编码的tex文档,利用xelatex能正确编译,而pdflatex/latex不能编译。 432 | \newtoggle{bbx:codegbk} 433 | \DeclareBibliographyOption{gbcodegbk}[false]{% 434 | \settoggle{bbx:codegbk}{#1}} 435 | \ExecuteBibliographyOptions{gbcodegbk} 436 | 437 | \def\str@bibliography{参考文献} 438 | \def\str@references{参考文献} 439 | \def\str@bytranslator{译} 440 | \def\str@andotherscn{等} 441 | \def\str@backrefpage{引用页} 442 | \def\str@backrefpages{引用页} 443 | \def\str@noaddress{出版地不详} 444 | \def\str@nopublisher{出版者不详} 445 | \def\str@edition{版} 446 | \def\str@volumecn{卷} 447 | \def\str@numbercn{册} 448 | \def\str@serialcn{第} 449 | \def\str@sameentry{同} 450 | \def\str@incn{见} 451 | \def\str@mathesiscn{硕士学位论文} 452 | \def\str@phdthesiscn{博士学位论文} 453 | \def\str@editorcn{主编} 454 | 455 | \AtEndOfPackage{% 456 | \iftoggle{bbx:codegbk}{% 457 | \ExecuteBibliographyOptions{texencoding = GBK} 458 | \input{gb7714-2015-gbk.def} 459 | }{}} 460 | 461 | % 462 | % 增加一个严格按GB/T 7714-2015给出著录格式控制域的输出的选项 463 | % v1.0k, 2018.05.08, by hzz 464 | % 465 | % 原理方法: 466 | % 默认设置该选项为真,进而不输出GB/T 7714-2015中没有的域的信息 467 | % 这样可以避免因为bib文件带有多余的域的信息的输出,比如因为bibtex样式 468 | % 可能需要用于中英文判断的language域的信息。 469 | \newtoggle{bbx:gbstrict} 470 | \DeclareBibliographyOption{gbstrict}[true]{% 471 | \settoggle{bbx:gbstrict}{#1}} 472 | \ExecuteBibliographyOptions{gbstrict} 473 | 474 | % 475 | % 增加一个控制标题域超链接设置的选项 476 | % v1.0k, 2018.05.24, by hzz 477 | % 478 | % 原理方法: 479 | % 利用标题域格式来实现,默认设置该选项为false,不做超链接。 480 | % 设置为true,则标题设置超链接 481 | \newtoggle{bbx:titlelink} 482 | \DeclareBibliographyOption{gbtitlelink}[false]{% 483 | \settoggle{bbx:titlelink}{#1}} 484 | \ExecuteBibliographyOptions{gbtitlelink} 485 | 486 | % 487 | % 增加一个控制参考文献标题是否能够被ctex宏包设置的选项 488 | % v1.0l, 2018.07.02, by hzz 489 | % 490 | % 原理方法: 491 | % 重定义biblatex的宏,去除使用本地化字符串的方式,是的可以利用ctexset进行设置 492 | \newtoggle{bbx:ctexset} 493 | \DeclareBibliographyOption{gbctexset}[true]{% 494 | \settoggle{bbx:ctexset}{#1}} 495 | \ExecuteBibliographyOptions{gbctexset} 496 | 497 | \AtEndOfPackage{% 498 | \iftoggle{bbx:ctexset}{% 499 | \def\blx@defbibstrings#1#2{% 500 | \def\do##1{\csundef{abx@lstr@##1}\csundef{abx@sstr@##1}}% 501 | \abx@dostrings 502 | \csuse{abx@strings@#1}% 503 | \setkeys{blx@lbx}{#2}% 504 | \let\do\blx@defbibstrings@i 505 | \csxdef{abx@strings@#1}{\abx@dostrings}% 506 | } 507 | }{}} 508 | 509 | 510 | 511 | % 512 | % 增加一个恢复域格式为标准样式的控制选项 513 | % v1.0k, 2018.05.15, by hzz 514 | % 515 | % 原理方法: 516 | % 默认设置该选项为false,采用国标要求的域格式输出相关域 517 | % 当设置该选项为true时,则重新利用标准样式的域格式输出相关的域 518 | \newtoggle{bbx:gbfieldstd} 519 | \DeclareBibliographyOption{gbfieldstd}[false]{% 520 | \settoggle{bbx:gbfieldstd}{#1}% 521 | \ifstrequal{#1}{false}{}{\execgbfdfmtstd}% 522 | } 523 | \ExecuteBibliographyOptions{gbfieldstd} 524 | 525 | % 526 | % 增加一个出版项自动处理控制选项,当true时使用出版者不详等信息补充缺失的出版信息。 527 | % 528 | \newtoggle{bbx:gbpub} 529 | \DeclareBibliographyOption{gbpub}[true]{% 530 | %\settoggle{bbx:gbpub}{#1} %或采用下面这一句 531 | \ifstrequal{#1}{false}{\togglefalse{bbx:gbpub}}{\toggletrue{bbx:gbpub}}} 532 | \ExecuteBibliographyOptions{gbpub} 533 | 534 | % 535 | % 增加控制析出文献来源前的标点符号//输出的选项 536 | % v1.0k, 2018.04.20,added in by hzz 537 | \newtoggle{bbx:gbpunctin} 538 | \DeclareBibliographyOption{gbpunctin}[true]{% 539 | \settoggle{bbx:gbpunctin}{#1}} 540 | \ExecuteBibliographyOptions{gbpunctin} 541 | 542 | 543 | % 544 | % 增加一个处理佚名或noauthor的控制选项 545 | % 546 | % 原理方法:在顺序编码制中不需要使用,为与作者年制的兼容性考虑,这里也增加避免报错 547 | \DeclareBibliographyOption{gbnoauthor}[true]{}% 548 | 549 | 550 | % 551 | % 选项设置 552 | % 553 | \ExecuteBibliographyOptions{ 554 | sorting=none, 555 | useprefix=true, %名字的信息包括前缀 556 | date = year, %日期仅写到年 557 | maxbibnames = 3,%设置名字最大数量 558 | minbibnames = 3, %设置缩减后的名字最小数量 559 | maxitems = 1,%设置列表最大数量 560 | minitems = 1, %设置缩减后的列表最小数量 561 | isbn=false, 562 | } 563 | 564 | % 565 | %为日期相关选项增加选项值gb7714-2015 566 | % 567 | \csdef{mkdaterangegb7714-2015}#1{% 568 | \begingroup 569 | \blx@metadateinfo{#1}% 570 | \iffieldundef{#1year} 571 | {} 572 | {\printtext[#1date]{% 573 | \blx@gbdate{#1}{}}}% 574 | \endgroup} 575 | 576 | \newrobustcmd*{\blx@gbdate}[3][]{% 577 | \dateeraprintpre{#2#3year}% 578 | \blx@imc@forcezerosy{\thefield{#2#3year}}\ifblank{#1}{}{\printfield{#1}}% 579 | \iffieldundef{#2#3month}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3month}}}% 580 | \iffieldundef{#2#3day}{}{\hyphen\blx@imc@forcezerosmdt{\thefield{#2#3day}}}} 581 | 582 | 583 | %为姓名格式选择增加的计数器 584 | \newcounter{gbnamefmtcase} 585 | \def\thegbnamefmtcase{\the\c@gbnamefmtcase} 586 | %为数字标签格式选择增加的计数器/命令 587 | \newcommand{\mkgbnumlabel}[1]{\mkbibbrackets{#1}} 588 | \def\gbbiblabelopt@bracket{\renewcommand{\mkgbnumlabel}[1]{\mkbibbrackets{##1}}} 589 | \def\gbbiblabelopt@parens{\renewcommand{\mkgbnumlabel}[1]{\mkbibparens{##1}}} 590 | \def\gbbiblabelopt@dot{\renewcommand{\mkgbnumlabel}[1]{##1\adddot}} 591 | \def\gbbiblabelopt@plain{\renewcommand{\mkgbnumlabel}[1]{##1}} 592 | \def\gbbiblabelopt@box{\renewcommand{\mkgbnumlabel}[1]{\framebox{##1}}} 593 | \def\gbbiblabelopt@circle{\renewcommand{\mkgbnumlabel}[1]{\textcircled{##1}}} 594 | %为文献表中数字标签对齐方式选择增加的计数器/命令 595 | \newcounter{gbalignlabel} 596 | \def\thegbalignlabel{\the\c@gbalignlabel} 597 | %为引用标签标注/文献表中本地化字符串中英文选择增加的计数器/命令 598 | \newcounter{gbcitelocalcase} 599 | \newcounter{gbbiblocalcase} 600 | \def\thegbcitelocalcase{\the\c@gbcitelocalcase} 601 | \def\thegbbiblocalcase{\the\c@gbbiblocalcase} 602 | 603 | \@ifpackagelater{biblatex}{2016/03/27} 604 | { % 针对biblatex>=3.3版本的选项设置 605 | % 增加不同语言排序的切换选项 606 | % numeric样式,不使用该选项,这里给出仅为兼容性考虑 607 | % v1.0q,20190307,hzz 608 | % 609 | \DeclareBibliographyOption[string]{gblanorder}[chineseahead]{} 610 | 611 | % 612 | % 增加本地化字符串的中英文切换选项 613 | % gbcitelocal指标注中的本地化字符串 614 | % gbbiblocal 指文献表中的本地化字符串 615 | % gblocal 指设置文献表和标注中的本地化字符串 616 | % v1.0o,20190103,hzz 617 | % 618 | \DeclareBibliographyOption[string]{gbcitelocal}[gb7714-2015]{% 619 | \ifstrequal{#1}{gb7714-2015}{\setcounter{gbcitelocalcase}{0}}{}% 620 | \ifstrequal{#1}{chinese}{\setcounter{gbcitelocalcase}{1}}{}% 621 | \ifstrequal{#1}{english}{\setcounter{gbcitelocalcase}{2}}{}% 622 | } 623 | \ExecuteBibliographyOptions{gbcitelocal} 624 | 625 | \DeclareBibliographyOption[string]{gbbiblocal}[gb7714-2015]{% 626 | \ifstrequal{#1}{gb7714-2015}{\setcounter{gbbiblocalcase}{0}}{}% 627 | \ifstrequal{#1}{chinese}{\setcounter{gbbiblocalcase}{1}}{}% 628 | \ifstrequal{#1}{english}{\setcounter{gbbiblocalcase}{2}}{}% 629 | } 630 | \ExecuteBibliographyOptions{gbbiblocal} 631 | 632 | \DeclareBibliographyOption[string]{gblocal}[gb7714-2015]{% 633 | \ExecuteBibliographyOptions{gbbiblocal=#1}% 634 | \ExecuteBibliographyOptions{gbcitelocal=#1}% 635 | } 636 | %\ExecuteBibliographyOptions{gblocal} %默认值已经通过两个相关选项设置 637 | 638 | % 639 | % 增加序号标签格式处理选项 640 | % v1.0l,20180623,hzz 641 | % 642 | \DeclareBibliographyOption[string]{gbbiblabel}[bracket]{% 643 | \csuse{gbbiblabelopt@#1} 644 | } 645 | \ExecuteBibliographyOptions{gbbiblabel} 646 | 647 | % 648 | % 增加姓名大小写格式处理选项 649 | % 650 | \DeclareBibliographyOption[string]{gbnamefmt}[uppercase]{% 651 | \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}% 652 | \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}% 653 | \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family 654 | \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{} 655 | \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given 656 | \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family 657 | } 658 | \ExecuteBibliographyOptions{gbnamefmt} 659 | 660 | % 661 | % 增加标签对齐选项 662 | % 663 | % right是默认的右对齐,left是左对齐,gb7714-2015是项对齐方式 664 | \DeclareBibliographyOption[string]{gbalign}[right]{% 665 | \ifstrequal{#1}{right}{\setcounter{gbalignlabel}{0}}{} 666 | \ifstrequal{#1}{left}{\setcounter{gbalignlabel}{1}}{} 667 | \ifstrequal{#1}{center}{\setcounter{gbalignlabel}{2}}{} 668 | \ifstrequal{#1}{gb7714-2015}{\setaligngbstyle}{} 669 | } 670 | } 671 | {% 针对biblatex<3.3版本的选项设置 672 | % 增加不同语言排序的切换选项 673 | % numeric样式,不使用该选项,这里给出仅为兼容性考虑 674 | % v1.0q,20190307,hzz 675 | % 676 | \DeclareBibliographyOption{gblanorder}[chineseahead]{} 677 | 678 | % 679 | % 增加序号标签格式处理选项 680 | % v1.0l,20180623,hzz 681 | % 682 | \DeclareBibliographyOption{gbbiblabel}[bracket]{% 683 | \csuse{gbbiblabelopt@#1} 684 | } 685 | \ExecuteBibliographyOptions{gbbiblabel} 686 | 687 | % 688 | % 增加姓名大小写格式处理选项 689 | % 690 | \DeclareBibliographyOption{gbnamefmt}[uppercase]{% 691 | \ifstrequal{#1}{uppercase}{\setcounter{gbnamefmtcase}{0}}{}% 692 | \ifstrequal{#1}{lowercase}{\setcounter{gbnamefmtcase}{1}}{}% 693 | \ifstrequal{#1}{givenahead}{\setcounter{gbnamefmtcase}{2}}{}%given-family 694 | \ifstrequal{#1}{familyahead}{\setcounter{gbnamefmtcase}{3}}{} 695 | \ifstrequal{#1}{pinyin}{\setcounter{gbnamefmtcase}{4}}{}%family-given 696 | \ifstrequal{#1}{reverseorder}{\setcounter{gbnamefmtcase}{5}}{}%family-given/given-family 697 | } 698 | \ExecuteBibliographyOptions{gbnamefmt} 699 | 700 | % 701 | % 增加标签对齐选项 702 | % 703 | % 原理方法:right是默认的右对齐,left是左对齐,gb7714-2015无效,仍然为右对齐模式, 704 | % 因为在这种biblatex低版本中,舍弃了list类环境后,会出错。 705 | % 注意:texlive2015中的3.0版中的DeclareBibliographyOption选项没有类型说明 706 | \DeclareBibliographyOption{gbalign}[right]{% 707 | \ifstrequal{#1}{right}{\setcounter{gbalignlabel}{0}}{} 708 | \ifstrequal{#1}{left}{\setcounter{gbalignlabel}{1}}{} 709 | \ifstrequal{#1}{center}{\setcounter{gbalignlabel}{2}}{} 710 | \ifstrequal{#1}{gb7714-2015}{}{} 711 | } 712 | } 713 | 714 | 715 | % 716 | % 针对biblatex<3.3版本的选项设置,比如texlive2015中的3.0版 717 | % 718 | \defversion{3.0}{opt}{ 719 | \ExecuteBibliographyOptions{ 720 | firstinits=true, %名字有缩写,参考3.1.2.3 Internal 721 | } 722 | } 723 | % 724 | % 针对3.3<=biblatex<3.5版本的选项设置,比如texlive2016中的3.4版 725 | % 726 | \defversion{3.4}{opt}{ 727 | \ExecuteBibliographyOptions{ 728 | giveninits=true, %名字有缩写,参考3.1.2.3 Internal 729 | } 730 | } 731 | % 732 | % 针对3.7<=biblatex<=3.9版本的选项设置,比如texlive2017中的3.7版 733 | % 734 | \defversion{3.7}{opt}{ 735 | \ExecuteBibliographyOptions{ 736 | giveninits=true, 737 | urldate =edtf, %iso8601 738 | eventdate =edtf, 739 | } 740 | } 741 | % 742 | % 针对3.10<=biblatex版本的选项设置,比如texlive2018中的3.11版 743 | % 744 | \defversion{3.10}{opt}{ 745 | \ExecuteBibliographyOptions{ 746 | giveninits=true, 747 | urldate =gb7714-2015, %iso,iso8601,edtf 748 | eventdate =gb7714-2015, 749 | } 750 | } 751 | 752 | % 753 | % 根据biblatex版本信息,选择选项设置 754 | % 755 | % 原理方法:如下这种选择机制能自动兼容更新的版本,但对于老版本 756 | % 必须要把情况列全。 757 | \iftoggle{iftlfive}{\switchversion{3.0}{opt}}{}%biblatex<=3.2 758 | \iftoggle{iftlsix}{\switchversion{3.4}{opt}}{}%3.3<=biblatex<=3.6 759 | \iftoggle{iftlseven}{\switchversion{3.7}{opt}}{}%biblatex=3.7 760 | \iftoggle{iftleight}{\switchversion{3.7}{opt}}{}%3.8<=biblatex<=3.9 761 | \iftoggle{iftlnine}{\switchversion{3.10}{opt}}{}%biblatex=3.10 762 | \iftoggle{iftlatest}{\switchversion{3.10}{opt}}{}%biblatex最新3.11 763 | 764 | 765 | %===================================================================== 766 | % 设置本地化字符串 767 | %===================================================================== 768 | % 769 | % 新建当地化字符串,用来记录“等”字符、“和”字符 770 | % 771 | \NewBibliographyString{andotherscn} 772 | \NewBibliographyString{andothersincitecn} 773 | \NewBibliographyString{andothersincite} 774 | \NewBibliographyString{andcn} 775 | \NewBibliographyString{andothersjp} 776 | \NewBibliographyString{andotherskr} 777 | \NewBibliographyString{andjp} 778 | \NewBibliographyString{andkr} 779 | \NewBibliographyString{andincitecn} 780 | \NewBibliographyString{andincite} 781 | \NewBibliographyString{volumecn} 782 | \NewBibliographyString{numbercn} 783 | \NewBibliographyString{serialcn} 784 | \NewBibliographyString{incn} 785 | \NewBibliographyString{mathesiscn} 786 | \NewBibliographyString{phdthesiscn} 787 | \NewBibliographyString{editorcn} 788 | \NewBibliographyString{editorscn} 789 | 790 | 791 | 792 | % 793 | % 修改一些当地化字符串 794 | % 795 | % 原理方法:直接利用当地化格式english修改出一些中文的格式,具体修改内容参考english.lbx文件 796 | % 当然也可以增加比如上面定义的andotherscn 797 | % 注意:在lbx文件和bbx文件中定义本地字符串的不同语法,两个参数和一个参数的区别 798 | 799 | \DefineBibliographyStrings{english}{ 800 | bibliography = {\str@bibliography}, 801 | references = {\str@references}, 802 | bytranslator= {\str@bytranslator},%\addperiod,%将trans. by 改成 译\addcomma\ 803 | and = {\addcomma},%将第2和3人名间的and符号改成逗号,用\finalnamedelim命令也可以定义,参见3.9.1节 804 | andcn = {\addcomma},%and本地化字符串的中文对应词 805 | andincitecn = {\addcomma},%将标注中的分开,便于与文献表中的区分 806 | andincite = {\addcomma}, 807 | %andothers = {et al.},%将超过3个人名的省略,et al.改成为 等 808 | andotherscn = {\str@andotherscn},%将超过3个人名的省略,et al.改成为 等 809 | andothersincitecn={\str@andotherscn},%将标注中的分开,便于与文献表中的区分 810 | andothersincite={et al.}, 811 | backrefpage = {\str@backrefpage:}, 812 | backrefpages = {\str@backrefpages:}, 813 | in={in\intitlepunct}, 814 | volumecn={\str@volumecn}, 815 | numbercn={\str@numbercn}, 816 | serialcn={\str@serialcn}, 817 | andothersjp={他}, 818 | andotherskr={외}, 819 | andjp={和}, 820 | andkr={和}, 821 | incn={\str@incn\addcolon\addspace}, 822 | mathesiscn={\str@mathesiscn}, 823 | phdthesiscn={\str@phdthesiscn}, 824 | editorscn={\str@editorcn}, 825 | editorcn={\str@editorcn}, 826 | } 827 | 828 | 829 | %===================================================================== 830 | % 动态数据修改 831 | %===================================================================== 832 | % 833 | % 各层次的数据映射和动态修改 834 | % 835 | % 原理方法: 836 | % 1. 进行语言包括中英文判断,并设置和记录,比如记录到userf,usere中 837 | % 2. 增加文献标识符如[M],[J]等,对一些容易混淆的域进行设置以增强兼容性 838 | % 3. \DeclareSourcemap命令对于biblatex3.11以下版本只能出现一次,3.11版开始支持多个 839 | % 4. \DeclarestyleSourcemap在biblatex v3.7版开始可以支持出现多次 840 | % 5. 把作者和译者信息准确的记录到userf,usere中,用于后面判断是否是cjk字符。 841 | % 注意:这里用userf,usere而不是namee,namef,是因为只有把name列表转成域,才能有效读取姓名中的字符, 842 | % 如果用namee,namef,name信息会自动解析,所以就不能为cjk判断提供需要的信息 843 | % 844 | % 不同的文献类型使用相同的驱动输出可以有5种方法: 845 | % 1. 是数据源层的映射,将其它类型转换为某一要使用驱动的类型 846 | % 2. 是样式层映射,也是将其它类型转换为某一要使用驱动的类型 847 | % 3. 是驱动层映射,也是将其它类型转换为某一要使用驱动的类型 848 | % 4. 定义驱动类型别名DeclareBibliographyAlias,将其它类型定义为某一要使用驱动的类型的别名 849 | % 驱动别名定义本质上是做了驱动层映射 850 | % 5. 直接定义不同的类型的驱动,但驱动内容相同。 851 | % 852 | % 关于数据映射和驱动使用的考虑如下: 853 | % 1. 为避免利用biber输出bib文件时的数据变动,尽量不在数据源层映射做类型转换 854 | % 2. 为减少代码量,尽量少做内容相同的不同类型驱动 855 | % 3. 因此类型相关的处理主要在样式层映射、驱动层映射、驱动别名 856 | % 4. 由于biblatex默认做的驱动别名处理可能增加一些信息比如masterthesis转thesis时增加的type 857 | % 可以在样式层映射做某些需要避免这种默认处置的转换 858 | % 5. 当没有避免默认行为的需求时,全部采用驱动别名的方式处理,等价于驱动层的映射 859 | % 860 | % 文献类型和驱动考虑如下: 861 | % 1. 连续出版物及析出文献有其特殊性,因此考虑两类periodical和article 862 | % newpaper映射为article,并以note域做区分特殊处理 863 | % 2. 专著和专著中的析出文献是主要的类型,因此考虑book和inbook 864 | % standard映射为book或inbook,并以note域做区分特殊处理 865 | % collection和proceedings基本与book类似,因此做book驱动别名处理 866 | % incollection和inproceedings基本与inbook类似,因此做inbook驱动别名处理 867 | % 3. 专利类型有其特殊性,考虑patent类型 868 | % 4. 电子资源类型有其特殊性,考虑online类型 869 | % 5. 报告类型与book有点类似,出版项处理与book一样,但有时又要有修改和更新日期 870 | % 因此考虑用一种类型来输出,使用report类型 871 | % 6. 手册/学位论文等类型与book有点类似,但对于出版项处理时,有缺省时,直接省略, 872 | % 同时有version和edition的区别,因此考虑用一种类型来输出,使用manual类型 873 | % 7. 包括报告,学位论文在内的其它所有的类型,都做一个判断,当没有出版项时, 874 | % 且存在网址信息时,将其转换为online类型输出,否则都做为manual类型输出。 875 | % 8. 备选类型misc当存在网址时直接转换为online,由于howpublished域可用于描述 876 | % 更多的信息,因此不存在网址时,独立做一个备选格式 877 | % 9. 出版项主要以如下方式处理: 878 | % (a) location+institution+date 仅用于连续出版物 879 | % (b)publisher+location+date 用于需要完整输出出版项的类型,比如book,collection,proceedings,in*,report 880 | % (c)institution+location+date 用于出版项缺失时不输出的类型,包括manual,thesis,archive等其他类型 881 | % (d)printlist{insitution} 用于电子资源,仅输出出版者或组织,为数据映射方便,本来默认的organization域转换为用insitution输出。 882 | % (e) 不输出,主要用于连续出版物析出的文献 883 | % 10. 日期以如下方式处理: 884 | % date 由于存在biblatex选项,因此通过选项控制,数据源为date解析数据或year 885 | % urldate 由于存在biblatex选项,因此通过选项控制,输出到日,且用[]包围,数据源为urldate 886 | % newsdate 用于公告日期,公开日期或新闻日期,输出到日,但无包围符号,数据源为date 887 | % modifydate 用于更新或修改日期,输出到日,且用()包围,数据源为date或enddate或eventdate 888 | 889 | 890 | \DeclareSourcemap{ 891 | \maps[datatype=bibtex]{% 892 | \map{%当没有作者时将editor转成author 893 | \pernottype{inbook}%因为in系列中editor可能用来表示bookauthor,所以排除 894 | \pernottype{inproceedings} 895 | \pernottype{incollection} 896 | \pernottype{periodical}%因为peridical直接使用editor,所以排除 897 | %注意notfield在低版本biblatex中没有 898 | %\step[notfield=author,final]%当author不存在,将editor复制给author 899 | \step[fieldsource=editor,fieldtarget=author]%并删除editor 900 | } 901 | \map{%当没有作者时将translator转成author 902 | \pernottype{inbook} 903 | \pernottype{inproceedings} 904 | \pernottype{incollection} 905 | %\step[notfield=author,final]%当author不存在,将translator复制给author 906 | \step[fieldsource=translator,fieldtarget=author]%并删除translator 907 | } 908 | \map{%让address和location同步,biblatex中address是location的别名 909 | %因此输出的时候只有location信息,但处理过程中是可以存在address的。 910 | %\step[notfield=address,final] 911 | \step[fieldsource=location,final] 912 | \step[fieldset=address,origfieldval] 913 | } 914 | \map{%让address和location同步 915 | %\step[notfield=location,final] 916 | \step[fieldsource=address,final] 917 | \step[fieldset=location,origfieldval] 918 | } 919 | \map{%处理在bib文件用mark标记文献类型标识符的情况 920 | \step[fieldsource=mark,final] 921 | \step[fieldset=usera, origfieldval] 922 | } 923 | \map{%处理在bib文件中直接给出文献的姓名格式为lowercase的情况 924 | \step[fieldsource=nameformat,match=lowercase,final] 925 | \step[fieldset=namefmtid,fieldvalue={1}] 926 | } 927 | \map{%处理在bib文件中直接给出文献的姓名格式为givenahead的情况 928 | \step[fieldsource=nameformat,match=givenahead,final] 929 | \step[fieldset=namefmtid,fieldvalue={2}] 930 | } 931 | \map{%处理在bib文件中直接给出文献的姓名格式为familyahead的情况 932 | \step[fieldsource=nameformat,match=familyahead,final] 933 | \step[fieldset=namefmtid,fieldvalue={3}] 934 | } 935 | \map{%处理在bib文件中直接给出文献的姓名格式为pinyin的情况 936 | \step[fieldsource=nameformat,match=pinyin,final] 937 | \step[fieldset=namefmtid,fieldvalue={4}] 938 | } 939 | \map{%根据article确定文献类型标识符 940 | \pertype{article} 941 | \step[fieldset=usera, fieldvalue={J}] 942 | } 943 | \map{%根据periodical确定文献类型标识符 944 | \pertype{periodical} 945 | \step[fieldset=usera, fieldvalue={J}] 946 | \step[fieldsource=author] %有时会把author和editor混淆,处理后使用editor 947 | \step[fieldset=editor, origfieldval] 948 | \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution 949 | \step[fieldset=institution, origfieldval] 950 | } 951 | \map{%根据增加一个新闻报纸的类型newspaper确定文献类型标识符 952 | \pertype{newspaper} 953 | \step[fieldset=usera, fieldvalue={N}] 954 | \step[fieldset=note, fieldvalue=news]%因为没有专门的驱动,记录note方便映射为article后判断 955 | } 956 | \map{%对应增加的一个数据库类型database确定文献类型标识符 957 | \pertype{database} 958 | \step[fieldset=usera, fieldvalue={DB}] 959 | \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution 960 | \step[fieldset=institution, origfieldval] 961 | } 962 | \map{%对应增加的一个数据集类型dataset确定文献类型标识符 963 | \pertype{dataset} 964 | \step[fieldset=usera, fieldvalue={DS}]% 965 | \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution 966 | \step[fieldset=institution, origfieldval] 967 | } 968 | \map{%对应增加的一个软件类型software确定文献类型标识符 969 | \pertype{software} 970 | \step[fieldset=usera, fieldvalue={CP}] 971 | \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution 972 | \step[fieldset=institution, origfieldval] 973 | } 974 | \map{%对应增加的一个舆图类型map确定文献类型标识符 975 | \pertype{map} 976 | \step[fieldset=usera, fieldvalue={CM}]% 977 | \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution 978 | \step[fieldset=institution, origfieldval] 979 | } 980 | \map{%对应增加的一个档案类型archive确定文献类型标识符 981 | \pertype{archive} 982 | \step[fieldset=usera, fieldvalue={A}] 983 | \step[fieldsource=publisher] %有时会把publisher和institution混淆,处理后使用institution 984 | \step[fieldset=institution, origfieldval] 985 | } 986 | \map{%因为misc类型本身就是没有类型,而不像其它文献有明确的类型,所以 987 | %当misc类型带有网址时,直接将其转换为online类型 988 | \pertype{misc} 989 | \step[fieldsource=url,final] 990 | \step[typesource=misc,typetarget=online] 991 | } 992 | \map{%对应增加的一个备选类型misc确定文献类型标识符 993 | \pertype{misc} 994 | \step[fieldset=usera, fieldvalue={Z}]% 995 | } 996 | \map{ 997 | \pertype{book} 998 | \pertype{inbook} 999 | \step[fieldset=usera, fieldvalue={M}] 1000 | \step[fieldsource=version] %有时会把version和edition混淆,处理后直接用edition 1001 | \step[fieldset=edition, origfieldval] 1002 | } 1003 | \map{%兼容老的standard类型,确定文献类型标识符 1004 | \pertype{standard} 1005 | \step[fieldset=usera, fieldvalue={S}] 1006 | \step[fieldset=note, fieldvalue=standard]%因为没有专门的驱动,记录note方便映射为book和inbook后判断 1007 | } 1008 | \map{ 1009 | \pertype{patent} 1010 | \step[fieldset=usera, fieldvalue={P}] 1011 | } 1012 | \map{ 1013 | \pertype{inproceedings} 1014 | \pertype{conference}%兼容老的conference类型 1015 | \step[fieldset=usera, fieldvalue={C}] 1016 | \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher 1017 | \step[fieldset=publisher, origfieldval] 1018 | } 1019 | \map{ 1020 | \pertype{proceedings} 1021 | \step[fieldset=usera, fieldvalue={C}] 1022 | \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher 1023 | \step[fieldset=publisher, origfieldval] 1024 | } 1025 | \map{ 1026 | \pertype{incollection} 1027 | \step[fieldset=usera, fieldvalue={G}] 1028 | \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher 1029 | \step[fieldset=publisher, origfieldval] 1030 | } 1031 | \map{ 1032 | \pertype{collection} 1033 | \step[fieldset=usera, fieldvalue={G}] 1034 | \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher 1035 | \step[fieldset=publisher, origfieldval] 1036 | } 1037 | \map{ 1038 | \pertype{report} 1039 | \pertype{techreport}%兼容老的techreport类型 1040 | \step[fieldset=usera, fieldvalue={R}] 1041 | \step[fieldsource=institution]%有时会把publisher和institution混淆,处理后使用publisher 1042 | \step[fieldset=publisher, origfieldval] 1043 | } 1044 | \map{ 1045 | \pertype{thesis} 1046 | \pertype{mastersthesis}%兼容老的mastersthesis和phdthesis类型 1047 | \pertype{phdthesis} 1048 | \step[fieldset=usera, fieldvalue={D}] 1049 | \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution 1050 | \step[fieldset=institution, origfieldval] 1051 | } 1052 | \map{ 1053 | \pertype{online} 1054 | \pertype{electronic}%兼容老的electronic类型 1055 | \pertype{www}%兼容老的www类型 1056 | \step[fieldset=usera, fieldvalue={EB}] 1057 | \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution 1058 | \step[fieldset=institution, origfieldval]%因为online的出版项处理类似手册 1059 | \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性 1060 | \step[fieldset=institution, origfieldval] 1061 | } 1062 | \map{ 1063 | \pertype{manual} 1064 | \step[fieldset=usera, fieldvalue={A}] 1065 | \step[fieldsource=edition]%有时会把version和edition混淆,处理后使用version 1066 | \step[fieldset=version, origfieldval] 1067 | \step[fieldsource=publisher]%有时会把publisher和institution混淆,处理后使用institution 1068 | \step[fieldset=institution, origfieldval] 1069 | \step[fieldsource=organization]%有时会把organization和institution混淆,处理后使用institution,以增强兼容性 1070 | \step[fieldset=institution, origfieldval] 1071 | } 1072 | \map{ 1073 | \pertype{unpublished} 1074 | \step[fieldset=usera, fieldvalue={Z}] 1075 | } 1076 | \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 1077 | \step[fieldsource={author}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] 1078 | }% 1079 | \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 1080 | \step[fieldsource={editor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] 1081 | }% 1082 | \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 1083 | \step[fieldsource={translator}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] 1084 | }% 1085 | \map[overwrite]{%用于处理zotero从cnki导出中文文献姓名中存在逗号的情况 1086 | \step[fieldsource={bookauthor}, match=\regexp{([\x{2FF0}-\x{9FA5}])\,\s*}, replace=\regexp{$1}] 1087 | }% 1088 | \map{%处理一些用year表示date的情况 1089 | %这样处理将会设置date域,并使得labeldatesource变为空,因为date的前缀为空(如果是urldate,那么labeldatesource就是url)。 1090 | %同时date域会被biblatex自动解析为year,month,day,并且覆盖原来的year信息 1091 | \step[fieldsource=year] 1092 | \step[fieldset=date, origfieldval] 1093 | } 1094 | \map{%将entrykey放入keywords中用于后期使用 1095 | \step[fieldsource=entrykey] 1096 | \step[fieldset=keywords, origfieldval] 1097 | } 1098 | \map{%文献题名的中文判断,将信息保存到userd中,避免因为标签生成原因导致title域被清除而产生问题 1099 | \step[fieldsource=title, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]% 1100 | \step[fieldset=userd, fieldvalue={chinese}] 1101 | } 1102 | \map{\step[fieldsource=title,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF 1103 | \step[fieldset=userd,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 1104 | } 1105 | \map{% 1106 | \step[fieldsource=title,match=\regexp{[\x{0400}-\x{052F}]},final] 1107 | \step[fieldset=userd,fieldvalue={russian}]%俄语 1108 | } 1109 | \map{% 1110 | \step[fieldsource=title,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] 1111 | \step[fieldset=userd,fieldvalue={japanese}]%日语 1112 | } %确定形式后可增加类似andotherscn这样的本地化字符串处理 1113 | \map{% 1114 | \step[fieldsource=title,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] 1115 | \step[fieldset=userd,fieldvalue={korean}]%韩语 1116 | } 1117 | \map{%将没有设置userd,且存在title域的默认设置为英文 1118 | \step[fieldsource=title,final] 1119 | \step[fieldset=userd,fieldvalue={english}] 1120 | } 1121 | \map{%作者的中文判断 1122 | \step[fieldsource=author, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] 1123 | \step[fieldset=userf, fieldvalue={chinese}] 1124 | } 1125 | \map{\step[fieldsource=author,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF 1126 | \step[fieldset=userf,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 1127 | } 1128 | \map{% 1129 | \step[fieldsource=author,match=\regexp{[\x{0400}-\x{052F}]},final] 1130 | \step[fieldset=userf,fieldvalue={russian}]%俄语 1131 | } 1132 | \map{% 1133 | \step[fieldsource=author,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] 1134 | \step[fieldset=userf,fieldvalue={japanese}]%日语 1135 | } %确定形式后可增加类似andotherscn这样的本地化字符串处理 1136 | \map{% 1137 | \step[fieldsource=author,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] 1138 | \step[fieldset=userf,fieldvalue={korean}]%韩语 1139 | } 1140 | \map{%将没有设置userf,且存在author域的默认设置为英文 1141 | \step[fieldsource=author,final] 1142 | \step[fieldset=userf,fieldvalue={english}] 1143 | } 1144 | \map{%译者的中文判断 1145 | \step[fieldsource=translator, match=\regexp{[\x{2FF0}-\x{9FA5}]},final] 1146 | \step[fieldset=usere, fieldvalue={chinese}] 1147 | } 1148 | \map{\step[fieldsource=translator,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF 1149 | \step[fieldset=usere,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 1150 | } 1151 | \map{% 1152 | \step[fieldsource=translator,match=\regexp{[\x{0400}-\x{052F}]},final] 1153 | \step[fieldset=usere,fieldvalue={russian}]%俄语 1154 | } 1155 | \map{% 1156 | \step[fieldsource=translator,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] 1157 | \step[fieldset=usere,fieldvalue={japanese}]%日语 1158 | } %确定形式后可增加类似andotherscn这样的本地化字符串处理 1159 | \map{% 1160 | \step[fieldsource=translator,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] 1161 | \step[fieldset=usere,fieldvalue={korean}]%韩语 1162 | } 1163 | \map{%将没有设置usere,且存在translator域的默认设置为英文 1164 | \step[fieldsource=translator,final] 1165 | \step[fieldset=usere,fieldvalue={english}] 1166 | } 1167 | \map{%编者的中文判断 1168 | \step[fieldsource=editor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 1169 | \step[fieldset=userc, fieldvalue={chinese}] 1170 | } 1171 | \map{\step[fieldsource=editor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF 1172 | \step[fieldset=userc,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 1173 | } 1174 | \map{% 1175 | \step[fieldsource=editor,match=\regexp{[\x{0400}-\x{052F}]},final] 1176 | \step[fieldset=userc,fieldvalue={russian}]%俄语 1177 | } 1178 | \map{% 1179 | \step[fieldsource=editor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] 1180 | \step[fieldset=userc,fieldvalue={japanese}]%日语 1181 | } %确定形式后可增加类似andotherscn这样的本地化字符串处理 1182 | \map{% 1183 | \step[fieldsource=editor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] 1184 | \step[fieldset=userc,fieldvalue={korean}]%韩语 1185 | } 1186 | \map{%将没有设置userc,且存在editor域的默认设置为英文 1187 | \step[fieldsource=editor,final] 1188 | \step[fieldset=userc,fieldvalue={english}] 1189 | } 1190 | \map{%编者的中文判断 1191 | \step[fieldsource=bookauthor, match=\regexp{[\x{2FF0}-\x{9FA5}]},final]%直接匹配cjk字符,unicode编码位置从2FF0到9FA5 1192 | \step[fieldset=userb, fieldvalue={chinese}] 1193 | } 1194 | \map{\step[fieldsource=bookauthor,match=\regexp{[\x{0100}-\x{017F}]},final]%\x80-\xFF 1195 | \step[fieldset=userb,fieldvalue={french}]%法语,0080开始到00ff的字符没法匹配有点奇怪 1196 | } 1197 | \map{% 1198 | \step[fieldsource=bookauthor,match=\regexp{[\x{0400}-\x{052F}]},final] 1199 | \step[fieldset=userb,fieldvalue={russian}]%俄语 1200 | } 1201 | \map{% 1202 | \step[fieldsource=bookauthor,match=\regexp{[\x{3040}-\x{30FF}\x{31F0}-\x{31FF}]},final] 1203 | \step[fieldset=userb,fieldvalue={japanese}]%日语 1204 | } %确定形式后可增加类似andotherscn这样的本地化字符串处理 1205 | \map{% 1206 | \step[fieldsource=bookauthor,match=\regexp{[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}]},final] 1207 | \step[fieldset=userb,fieldvalue={korean}]%韩语 1208 | } 1209 | \map{%将没有设置userc,且存在editor域的默认设置为英文 1210 | \step[fieldsource=bookauthor,final] 1211 | \step[fieldset=userb,fieldvalue={english}] 1212 | } 1213 | \map{\step[fieldsource=userd,final]%userd存在则用根据标题的语言设定language 1214 | \step[fieldset=language,origfieldval]%本身language存在则不设定 1215 | } 1216 | \map{\step[fieldsource=userf,final]%userd不存在,而userf存在则根据author的语言设定language 1217 | \step[fieldset=language,origfieldval] 1218 | }%如果没有作者和标题,那么剩下的最可能有意义的只有网址了,而网址通常是英文的,因此不用再进一步对其它域进行判断了。 1219 | \map{%将没有设置的language设置成en,即认为不是中文的就是英文的。 1220 | \step[fieldset=language,fieldvalue={english}] 1221 | } 1222 | \map{%一条文献的语言已经设定在language域中,由于出版项相关宏中使用userd判断, 1223 | %所以将一条文献的主体语言设定到userd中,本身前面userd已经设定,但没有处理无标题的情况, 1224 | %这里的处理等价于没有标题时,利用作者的语言设定userd,再没有作者,则默认用英文设定userd 1225 | \step[fieldsource=language] 1226 | \step[fieldset=userd,origfieldval] 1227 | } 1228 | \map{%当文献给出language域时,设置文献要使用的本地化字符串的语言 1229 | \step[fieldsource=language,match=\regexp{(e|E)(n|N)(g|G)(l|L)(i|I)(s|S)(h|H)},final] 1230 | \step[fieldset=langid,fieldvalue={english}] 1231 | } 1232 | \map{ 1233 | \step[fieldsource=language,match=\regexp{(r|R)(u|U)(s|S)(s|S)(i|I)(a|A)(n|N)},final] 1234 | \step[fieldset=langid,fieldvalue={russian}] 1235 | } 1236 | \map{% 1237 | \step[fieldsource=language,match=\regexp{(f|F)(r|R)(e|E)(n|N)(c|C)(h|H)},final] 1238 | \step[fieldset=langid,fieldvalue={french}] 1239 | } 1240 | \map{% 1241 | \step[fieldsource=language,match=\regexp{(c|C)(h|H)(i|I)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english, 1242 | \step[fieldset=langid,fieldvalue={english}] 1243 | } 1244 | \map{% 1245 | \step[fieldsource=language,match=\regexp{(j|J)(a|A)(p|P)(a|A)(n|N)(e|E)(s|S)(e|E)},final]%中日韩语目前都用english, 1246 | \step[fieldset=langid,fieldvalue={english}] 1247 | } 1248 | \map{% 1249 | \step[fieldsource=language,match=\regexp{(k|K)(o|O)(r|R)(e|E)(a|A)(n|N)},final]%中日韩语目前都用english, 1250 | \step[fieldset=langid,fieldvalue={english}] 1251 | } 1252 | } 1253 | } 1254 | 1255 | 1256 | % 1257 | % 修改输入的参考文献数据,样式层的操作 1258 | % 1259 | % 原理方法:因为biblatex3.0版的map不使用foreach选项,所以需要一个一个写,以处理特殊字符 1260 | \defversion{3.0}{map}{ 1261 | \DeclareStyleSourcemap{ 1262 | \maps[datatype=bibtex]{ 1263 | \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook, 1264 | %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义 1265 | %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断 1266 | \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook 1267 | \step[typesource=standard, typetarget=inbook, final] 1268 | } 1269 | \map{%剩下的全部映射为book 1270 | \step[typesource=standard, typetarget=book, final] 1271 | } 1272 | % \map{%先于标准样式的driver层映射,以取消type设置 1273 | % \step[typesource=mastersthesis, typetarget=thesis, final] 1274 | % %\step[fieldset=type, fieldvalue=mathesis] 1275 | % } 1276 | % \map{%先于标准样式的driver层映射,以取消type设置 1277 | % \step[typesource=phdthesis, typetarget=thesis, final] 1278 | % %\step[fieldset=type, fieldvalue=phdthesis] 1279 | % } 1280 | \map{%先于标准样式的driver层映射,以取消type设置 1281 | \step[typesource=techreport, typetarget=report, final] 1282 | %\step[fieldset=type, fieldvalue=techreport] 1283 | } 1284 | \map{% 1285 | \pertype{report} 1286 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1287 | \step[fieldset=location,fieldvalue={}] 1288 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1289 | %3.7以上版本用notfield 1290 | %\step[notfield=address,final]%当address不存在则继续 1291 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1292 | \step[typesource=report,typetarget=online] 1293 | \step[fieldset=note,fieldvalue={report}] 1294 | } 1295 | \map{% 1296 | \pertype{thesis} 1297 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1298 | \step[fieldset=location,fieldvalue={}] 1299 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1300 | %3.7以上版本用notfield 1301 | %\step[notfield=address,final]%当address不存在则继续 1302 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1303 | \step[typesource=thesis,typetarget=online] 1304 | } 1305 | \map{% 1306 | \pertype{manual} 1307 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1308 | \step[fieldset=location,fieldvalue={}] 1309 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1310 | %3.7以上版本用notfield 1311 | %\step[notfield=address,final]%当address不存在则继续 1312 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1313 | \step[typesource=manual,typetarget=online] 1314 | } 1315 | \map{% 1316 | \pertype{unpublished} 1317 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1318 | \step[fieldset=location,fieldvalue={}] 1319 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1320 | %3.7以上版本用notfield 1321 | %\step[notfield=address,final]%当address不存在则继续 1322 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1323 | \step[typesource=unpublished,typetarget=online] 1324 | } 1325 | \map{% 1326 | \pertype{database} 1327 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1328 | \step[fieldset=location,fieldvalue={}] 1329 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1330 | %3.7以上版本用notfield 1331 | %\step[notfield=address,final]%当address不存在则继续 1332 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1333 | \step[typesource=databasetypetarget=online] 1334 | } 1335 | \map{% 1336 | \pertype{dataset} 1337 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1338 | \step[fieldset=location,fieldvalue={}] 1339 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1340 | %3.7以上版本用notfield 1341 | %\step[notfield=address,final]%当address不存在则继续 1342 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1343 | \step[typesource=dataset,typetarget=online] 1344 | } 1345 | \map{% 1346 | \pertype{software} 1347 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1348 | \step[fieldset=location,fieldvalue={}] 1349 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1350 | %3.7以上版本用notfield 1351 | %\step[notfield=address,final]%当address不存在则继续 1352 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1353 | \step[typesource=software,typetarget=online] 1354 | } 1355 | \map{% 1356 | \pertype{map} 1357 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1358 | \step[fieldset=location,fieldvalue={}] 1359 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1360 | %3.7以上版本用notfield 1361 | %\step[notfield=address,final]%当address不存在则继续 1362 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1363 | \step[typesource=map,typetarget=online] 1364 | } 1365 | \map{% 1366 | \pertype{archive} 1367 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1368 | \step[fieldset=location,fieldvalue={}] 1369 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1370 | %3.7以上版本用notfield 1371 | %\step[notfield=address,final]%当address不存在则继续 1372 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1373 | \step[typesource=archive,typetarget=online] 1374 | } 1375 | \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确) 1376 | \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸 1377 | \step[fieldset=keywords, fieldvalue={,}, append] 1378 | \step[fieldset=keywords, origfieldval, append] 1379 | } 1380 | \map[overwrite]{%title,booktitle,journaltitle,journal,publisher,address,location,institution,organization 1381 | \step[fieldsource={title}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] 1382 | } 1383 | \map[overwrite]{ 1384 | \step[fieldsource={booktitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] 1385 | } 1386 | \map[overwrite]{ 1387 | \step[fieldsource={journaltitle}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] 1388 | } 1389 | \map[overwrite]{ 1390 | \step[fieldsource={journal}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] 1391 | } 1392 | \map[overwrite]{ 1393 | \step[fieldsource={publisher}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] 1394 | } 1395 | \map[overwrite]{ 1396 | \step[fieldsource={address}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] 1397 | } 1398 | \map[overwrite]{ 1399 | \step[fieldsource={location}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] 1400 | } 1401 | \map[overwrite]{ 1402 | \step[fieldsource={institution}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] 1403 | } 1404 | \map[overwrite]{ 1405 | \step[fieldsource={booktitle}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}] 1406 | } 1407 | \map[overwrite]{ 1408 | \step[fieldsource={booktitle}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}] 1409 | } 1410 | } 1411 | } 1412 | } 1413 | 1414 | % 1415 | % 修改输入的参考文献数据,样式层的操作 1416 | % 1417 | % 原理方法:biblatex3.4以上版本 1418 | \defversion{3.4}{map}{ 1419 | \DeclareStyleSourcemap{ 1420 | \maps[datatype=bibtex]{ 1421 | \map{%尝试未定义数据模型的standard类型映射为其他类型book或inbook, 1422 | %standard类型在blx-dm中有出现,但仅定义了类型,域和约束等都没有定义 1423 | %因为可能要映射两种类型,所以不能在驱动层处理,因为要做判断 1424 | \step[fieldsource=booktitle,final]%当存在booktitle域是映射为inbook 1425 | \step[typesource=standard, typetarget=inbook, final] 1426 | } 1427 | \map{%剩下的全部映射为book 1428 | \step[typesource=standard, typetarget=book, final] 1429 | } 1430 | % \map{%先于标准样式的driver层映射,以取消type设置 1431 | % \step[typesource=mastersthesis, typetarget=thesis, final] 1432 | % %\step[fieldset=type, fieldvalue=mathesis] 1433 | % } 1434 | % \map{%先于标准样式的driver层映射,以取消type设置 1435 | % \step[typesource=phdthesis, typetarget=thesis, final] 1436 | % %\step[fieldset=type, fieldvalue=phdthesis] 1437 | % } 1438 | \map{%先于标准样式的driver层映射,以取消type设置 1439 | \step[typesource=techreport, typetarget=report, final] 1440 | %\step[fieldset=type, fieldvalue=techreport] 1441 | } 1442 | \map{% 1443 | \pertype{report} 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=report,typetarget=online] 1451 | \step[fieldset=note,fieldvalue={report}] 1452 | } 1453 | \map{% 1454 | \pertype{thesis} 1455 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1456 | \step[fieldset=location,fieldvalue={}] 1457 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1458 | %3.7以上版本用notfield 1459 | %\step[notfield=address,final]%当address不存在则继续 1460 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1461 | \step[typesource=thesis,typetarget=online] 1462 | } 1463 | \map{% 1464 | \pertype{manual} 1465 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1466 | \step[fieldset=location,fieldvalue={}] 1467 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1468 | %3.7以上版本用notfield 1469 | %\step[notfield=address,final]%当address不存在则继续 1470 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1471 | \step[typesource=manual,typetarget=online] 1472 | } 1473 | \map{% 1474 | \pertype{unpublished} 1475 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1476 | \step[fieldset=location,fieldvalue={}] 1477 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1478 | %3.7以上版本用notfield 1479 | %\step[notfield=address,final]%当address不存在则继续 1480 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1481 | \step[typesource=unpublished,typetarget=online] 1482 | } 1483 | \map{% 1484 | \pertype{database} 1485 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1486 | \step[fieldset=location,fieldvalue={}] 1487 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1488 | %3.7以上版本用notfield 1489 | %\step[notfield=address,final]%当address不存在则继续 1490 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1491 | \step[typesource=databasetypetarget=online] 1492 | } 1493 | \map{% 1494 | \pertype{dataset} 1495 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1496 | \step[fieldset=location,fieldvalue={}] 1497 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1498 | %3.7以上版本用notfield 1499 | %\step[notfield=address,final]%当address不存在则继续 1500 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1501 | \step[typesource=dataset,typetarget=online] 1502 | } 1503 | \map{% 1504 | \pertype{software} 1505 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1506 | \step[fieldset=location,fieldvalue={}] 1507 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1508 | %3.7以上版本用notfield 1509 | %\step[notfield=address,final]%当address不存在则继续 1510 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1511 | \step[typesource=software,typetarget=online] 1512 | } 1513 | \map{% 1514 | \pertype{map} 1515 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1516 | \step[fieldset=location,fieldvalue={}] 1517 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1518 | %3.7以上版本用notfield 1519 | %\step[notfield=address,final]%当address不存在则继续 1520 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1521 | \step[typesource=map,typetarget=online] 1522 | } 1523 | \map{% 1524 | \pertype{archive} 1525 | %biblatex3.7以下版本用如下方式来替代,address和location已在sourcemap中同步 1526 | \step[fieldset=location,fieldvalue={}] 1527 | \step[fieldsource=location,notmatch=\regexp{.},final]%地址不存在且存在url那么转变为online 1528 | %3.7以上版本用notfield 1529 | %\step[notfield=address,final]%当address不存在则继续 1530 | \step[fieldsource=url,final]%地址不存在且存在url那么转变为online 1531 | \step[typesource=archive,typetarget=online] 1532 | } 1533 | \map[overwrite]{%这里还必须有overwrite,注意不同版本存在差异,比如texlive2015变16后biber有变化(20161207修改正确) 1534 | \step[fieldsource=note, final]%将note域信息复制给keywords,用于输出时容易区分标准和报纸 1535 | \step[fieldset=keywords, fieldvalue={,}, append] 1536 | \step[fieldset=keywords, origfieldval, append] 1537 | } 1538 | \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ 1539 | \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\#}, replace=\regexp{$1\\\#}] 1540 | } 1541 | \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,address,location,institution,organization}]{ 1542 | \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\%}, replace=\regexp{$1\\\%}] 1543 | } 1544 | \map[overwrite, foreach={title,booktitle,journaltitle,journal,publisher,% 1545 | address,location,institution,organization}]{ 1546 | \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{([^\\])\x26}, replace=\regexp{$1\\\x26}] 1547 | } 1548 | } 1549 | } 1550 | } 1551 | 1552 | \iftoggle{iftlfive}% 1553 | {\switchversion{3.0}{map}}%%当采用biblatex<=3.2版本时 1554 | {\switchversion{3.4}{map}}%%当采用3.3<=biblatex版本时 1555 | 1556 | % 1557 | %驱动别名等价于驱动层映射 1558 | % 1559 | \DeclareBibliographyAlias{newspaper}{article}% 1560 | \DeclareBibliographyAlias{inproceedings}{inbook}%会议论文文献类型驱动 1561 | \DeclareBibliographyAlias{conference}{inbook}%会议论文文献类型驱动 1562 | \DeclareBibliographyAlias{incollection}{inbook}%文集中析出文献类型驱动 1563 | \DeclareBibliographyAlias{collection}{book}%%文集类型驱动 1564 | \DeclareBibliographyAlias{proceedings}{book}%会议论文集文献类型驱动 1565 | \DeclareBibliographyAlias{thesis}{manual}%学位论文驱动 1566 | \DeclareBibliographyAlias{unpublished}{manual}%其它类型驱动 1567 | \DeclareBibliographyAlias{database}{manual} 1568 | \DeclareBibliographyAlias{dataset}{manual} 1569 | \DeclareBibliographyAlias{software}{manual} 1570 | \DeclareBibliographyAlias{map}{manual} 1571 | \DeclareBibliographyAlias{archive}{manual} 1572 | 1573 | 1574 | 1575 | %===================================================================== 1576 | % 参考文献表环境 1577 | %===================================================================== 1578 | % 1579 | % 列表格式 1580 | % 1581 | % 增加一个\bibitemindent尺寸用于控制list环境的itemindent 1582 | % v1.0l,20180615,hzz 1583 | \setlength{\bibhang}{\biblabelsep}% 1584 | \newlength{\bibitemindent} 1585 | \setlength{\bibitemindent}{0pt} 1586 | 1587 | 1588 | \defbibenvironment{bibliography} 1589 | {\list 1590 | {\printtext[labelnumberwidth]{% 1591 | \printfield{labelprefix}% 1592 | \printfield{labelnumber}}} 1593 | {\setlength{\labelwidth}{\labelnumberwidth}% 1594 | \setlength{\labelsep}{\biblabelsep}% 1595 | \setlength{\leftmargin}{\bibhang}% 1596 | \addtolength{\leftmargin}{\labelnumberwidth}% 1597 | \setlength{\itemindent}{\bibitemindent}% 1598 | \setlength{\itemsep}{\bibitemsep}% 1599 | \setlength{\parsep}{\bibparsep}}% 1600 | \renewcommand*{\makelabel}[1]{\hss##1}} 1601 | {\endlist} 1602 | {\item} 1603 | 1604 | % 1605 | % 顺序编码制-标签对齐方式处理 1606 | % 1607 | % 原理方法:利用选项提供的计数器数值做选择 1608 | % 左对齐,右对齐为list环境下的处理,此时list环境的\labelwidth只能设置一个,是最宽标签的宽度 1609 | % 项对齐则是在段落环境下做的处理。 1610 | % 左对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距可变 1611 | % 右对齐时,参考文献各项内容对齐,序号标签与参考文献项内容的间距相等,标签与页边距离可变 1612 | % 项对齐时,序号标签贴在页边,序号标签与参考文献项内容的间距相等 1613 | % 修改序号标签格式为: 1614 | % \DeclareFieldFormat{shorthandwidth}{\mkbibbrackets{#1}} %源来自numeric.BBX 1615 | % \DeclareFieldFormat{labelnumberwidth}{\ttfamily\mkbibbrackets{#1}\hfill} 1616 | \DeclareFieldFormat{labelnumberwidth}{% 1617 | \ifcase\value{gbalignlabel}%右对齐,整个标签为右对齐 1618 | \mkgbnumlabel{#1}% 1619 | \or%左对齐,整个标签为左对齐 1620 | \mkgbnumlabel{#1}\hfill% 1621 | \or%中间对齐,比如:序号数字居于[]中间 1622 | \hfil\mkgbnumlabel{\hfill#1\hfill}\hfil% 1623 | \fi} 1624 | 1625 | % 1626 | % 修改序号标签格式为以各条参文献为基础进行对齐的方式,即序号与条目内容间隔相等的方式。 1627 | \def\setaligngbstyle{% 1628 | \def\blx@bibitem##1{% 1629 | \blx@ifdata{##1} 1630 | {\begingroup 1631 | \blx@getdata{##1}% 1632 | \blx@bibcheck 1633 | \iftoggle{blx@skipentry}{}{% 1634 | \blx@setdefaultrefcontext{##1}% 1635 | \global\let\blx@noitem\@empty 1636 | \blx@setoptions@type\abx@field@entrytype 1637 | \blx@setoptions@entry 1638 | \blx@thelabelnumber 1639 | \addtocounter{instcount}\@ne 1640 | \blx@initsep 1641 | \blx@namesep 1642 | \csuse{blx@item@\blx@theenv}\relax 1643 | % \blx@initsep %移动到上面去,恢复bibnamesep等的作用机制 1644 | % \blx@namesep 1645 | \csuse{blx@hook@bibitem}% 1646 | \blx@execute 1647 | \blx@initunit 1648 | \blx@anchor 1649 | \blx@beglangbib 1650 | \bibsentence 1651 | \blx@pagetracker 1652 | \blx@driver\abx@field@entrytype 1653 | \blx@postpunct 1654 | \blx@endlangbib}% 1655 | \par\endgroup}%这里增加了一个\par 1656 | {}} 1657 | \newlength{\lengthid} 1658 | \newlength{\lengthlw} 1659 | \newcommand{\itemcmd}{% 1660 | \settowidth{\lengthid}{\mkgbnumlabel{\printfield{labelnumber}}} 1661 | \addtolength{\lengthid}{\biblabelsep} 1662 | \setlength{\lengthlw}{\textwidth} 1663 | \addtolength{\lengthlw}{-\lengthid} 1664 | \addvspace{\bibitemsep}%恢复\bibitemsep的作用 1665 | %\parshape 2 0em \textwidth \lengthid \lengthlw 1666 | \hangindent\lengthid 1667 | \mkgbnumlabel{\printfield{labelnumber}}% 1668 | \hspace{\biblabelsep}} 1669 | % 1670 | % 简单的段落环境 1671 | \defbibenvironment{bibliography} 1672 | {\begingroup\setlength{\parindent}{0em}} 1673 | {\endgroup} 1674 | {\itemcmd}} 1675 | 1676 | 1677 | %===================================================================== 1678 | % 设置单元或块等的标点 1679 | %===================================================================== 1680 | \renewrobustcmd*{\bibinithyphendelim}{\addhighpenspace}%用于处理姓名中名部分存在-的情况,比如ZHANG Yu-xin 1681 | \renewcommand*{\subtitlepunct}{\addcolon\addspace} %修改标题和其它标题信息间的标点,来源biblatex.def, 1682 | % 1683 | % 利用set实现的多语言文献不同语言间的分隔符 1684 | % 20170411,双语之间用newline替换par,避免采用gb7714-2015的项对齐方式第二语言间分段导致没有缩进 1685 | % 1686 | % 原理方法:set方法可以参考3.11.5 Entry Sets,4.11.1 Entry Sets 1687 | % 这里调整一下两种语言参考文献的间隔,源来自biblatex.def 1688 | \renewcommand*{\entrysetpunct}{\adddot\newline\nobreak} 1689 | \renewcommand*{\bibpagespunct}{\addcolon\addthinspace}%%页码引用格式的修改,修改为用冒号 1690 | %\renewcommand{\relateddelim}{}%\par 1691 | 1692 | %===================================================================== 1693 | % 修改域的格式,重定义域的输出宏 1694 | %===================================================================== 1695 | % 1696 | % 新增文献类型标识符的格式 1697 | % []前的nobreak,从GB4.1节的例子看不应该加,所以去掉 1698 | % 但因为考虑到cjk字符和[]之间可能添加空格,所以仍然加上 1699 | % 而[]中间的内容,从4.6.2节的例子看也是可以分割的,因此内部的nobreak也可以去掉 1700 | % 1701 | \DeclareFieldFormat{gbtypeflag}{% 1702 | \iftoggle{bbx:url}% 1703 | {\iffieldundef{url}%当存在url时,增加一个OL标识符 1704 | {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% 1705 | {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% 1706 | }% 1707 | {\ifentrytype{online}% 1708 | {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\texttt{/}OL]}}% 1709 | {\nobreak\printtext{[}\nobreak#1\nobreak\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}}% 1710 | }% 1711 | } 1712 | 1713 | % 1714 | % 新增用于报纸的文献类型标识符的格式 1715 | % 1716 | \DeclareFieldFormat{gbtypeflagn}{%用于报纸newspaper 1717 | \iftoggle{bbx:url}% 1718 | {\iffieldundef{url}%当存在url时,增加一个OL标识符 1719 | {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% 1720 | {\nobreak\printtext{[}\nobreak N\printtext{\texttt{/}OL]}\nobreak}% 1721 | }% 1722 | {\nobreak\printtext{[}\nobreak N\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% 1723 | } 1724 | 1725 | % 1726 | % 新增用于标准的文献类型标识符的格式 1727 | % 1728 | \DeclareFieldFormat{gbtypeflags}{%用于标准standard 1729 | \iftoggle{bbx:url}% 1730 | {\iffieldundef{url}%当存在url时,增加一个OL标识符 1731 | {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% 1732 | {\nobreak\printtext{[}\nobreak S\printtext{\texttt{/}OL]}\nobreak}% 1733 | }% 1734 | {\nobreak\printtext{[}\nobreak S\printtext{\iffieldundef{medium}{}{\texttt{/}\thefield{medium}}]}\nobreak}% 1735 | } 1736 | 1737 | % 1738 | % 重设title等参考文献信息的输出格式 1739 | % 1740 | % 原理方法:修改来自biblatex.def文件的原格式 1741 | \newcommand{\bibtitlefont}{} 1742 | \newcommand{\bibauthorfont}{} 1743 | \newcommand{\bibpubfont}{} 1744 | 1745 | \DeclareFieldFormat{title}{#1\adddot\addthinspace} 1746 | \DeclareFieldFormat{journaltitle}{#1\isdot}%添加\isdot用于缩写名带点情况,将其转换为缩写点,便于标点的追踪 1747 | \DeclareFieldFormat{issuetitle}{#1} 1748 | \DeclareFieldFormat{maintitle}{#1} 1749 | \DeclareFieldFormat{booktitle}{#1} 1750 | \DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 1751 | [article,patent,thesis,unpublished] 1752 | {title}{#1\adddot\addthinspace}%\mkbibquote{#1\isdot} 1753 | \DeclareFieldFormat%将期刊等文献的标题中原来带的引号去掉 1754 | [inbook,incollection,inproceedings] 1755 | {title}{#1}%\nopunct\unspace 1756 | \DeclareFieldFormat{url}{\url{#1}} %%url相关输出,url域修改如本行,源来自biblatex.def 1757 | \def\UrlFont{\rmfamily}%设置url字体为roman字体%\ttfamily 1758 | %\urlstyle{rm} %使用这句也一样 1759 | \setcounter{biburlnumpenalty}{100} %让url可以在数字后断行 1760 | \setcounter{biburlucpenalty}{100} %让url可以在大写字母后断行 1761 | \setcounter{biburllcpenalty}{100} %让url可以在小写字母后断行 1762 | \DeclareFieldFormat{doi}{% 1763 | \rmfamily{DOI}\addcolon\space 1764 | \ifhyperref 1765 | {\href{https://doi.org/#1}{\nolinkurl{#1}}} 1766 | {\nolinkurl{#1}}} 1767 | % 1768 | % 标题的字母大小写格式修改 1769 | % 1770 | % 注意:修改标题的字母大小写,不能用前面的title的格式而要用titlecase 1771 | % 因为titlecase is applied to the contents of the field directly,title is not 1772 | %\DeclareFieldFormat{titlecase}{\MakeCapital#1}%重设标题格式,将其修改为首字母大写 1773 | \DeclareFieldFormat{titlecase}{\iftoggle{bbx:titlelink}{% 1774 | \iffieldundef{url}{\MakeCapital#1}{% 1775 | \href{\thefield{url}}{#1}}}{\MakeCapital#1}}%重设标题格式,将其修改为首字母大写 1776 | \DeclareFieldFormat{pages}{#1}%去掉前面引导页码的pp.等字符,\mkpageprefix[bookpagination]{#1} 1777 | \DefineBibliographyExtras{english}{\renewcommand*{\bibrangedash}{-}}%将页码间隔符替换会英文的短横线 1778 | 1779 | \def\execgbfdfmtstd{%恢复到标准样式的设置 1780 | \DeclareFieldFormat{title}{\mkbibemph{##1}} 1781 | \DeclareFieldFormat 1782 | [article,inbook,incollection,inproceedings,patent,thesis,unpublished] 1783 | {title}{\mkbibquote{##1\isdot}} 1784 | \DeclareFieldFormat 1785 | [suppbook,suppcollection,suppperiodical] 1786 | {title}{##1} 1787 | \DeclareFieldFormat{journaltitle}{\mkbibemph{##1}} 1788 | \DeclareFieldFormat{issuetitle}{\mkbibemph{##1}} 1789 | \DeclareFieldFormat{maintitle}{\mkbibemph{##1}} 1790 | \DeclareFieldFormat{booktitle}{\mkbibemph{##1}} 1791 | \DeclareFieldFormat{url}{\mkbibacro{URL}\addcolon\space\url{##1}} 1792 | \DeclareFieldFormat{titlecase}{##1} 1793 | \DeclareFieldFormat{pages}{\mkpageprefix[bookpagination]{##1}} 1794 | } 1795 | 1796 | % 1797 | % 文献标题后的标点问题 1798 | % v1.0k,20180405,为texlive2017以上版本中的beamer兼容性做的处理,Hu Zhenzhen 1799 | % 1800 | % 原理方法:如下代码处理texlive2017以上版本中,beamer中文献的标题后出现两个点的情况: 1801 | % texlive2017以上的beamer中对macro{title}做了patch,正常情况下不会出现两个点的情况,但由于 1802 | % 之前为了处理texlive2015,2016下的title格式添加了adddot,导致出现两个点的情况,而且也影响 1803 | % 析出文献的//符号的输出,因此再次对macro{title}做patch消除beamer中做apptocmd时添加的\newunitpunct 1804 | \ifboolexpr{% 1805 | test{\iftoggle{iftlfive}} 1806 | or 1807 | test{\iftoggle{iftlsix}} 1808 | }{}% 1809 | {%texlive 2017对应iftlseven以上版本 1810 | \@ifclassloaded{beamer}{ 1811 | \DeclareFieldFormat{title}{#1}% 1812 | \DeclareFieldFormat[article,patent,thesis,unpublished]{title}{#1} 1813 | \AtBeginDocument{% 1814 | \patchcmd{\abx@macro@title}{\newunitpunct}{}{}{}}}{} 1815 | } 1816 | 1817 | 1818 | % 1819 | % 修改译者位置格式 1820 | % 1821 | % 原理方法:修改来自biblatex.def文件的bytranslator+others宏的格式 1822 | \renewbibmacro*{bytranslator+others}{\bibauthorfont% 1823 | \ifnameundef{translator} 1824 | {} 1825 | {%\usebibmacro{bytranslator+othersstrg} 1826 | %\setunit{\addspace}% 1827 | \printnames[bytranslator]{translator}% 1828 | \clearname{translator}% 1829 | %从macro*{bytranslator+othersstrg}%中可以看到当地化字符串格式的引用前的代码处理 1830 | %比如生成cotranslator等用于调用cotranslator所代表的当地化字符串 1831 | \usebibmacro{bytranslator+othersstrg}%“译”的位置换到下面来,即放到译者后面。 1832 | %\setunit{\addspace}% 1833 | \newunit}% 1834 | \usebibmacro{withothers}} 1835 | 1836 | 1837 | % 1838 | % 修改作者数量超过限定值,做省略时的处理格式 1839 | % v1.0,20160701,hzz 1840 | % v1.0O,20190103,hzz,修改利用新定义的一个分隔符strandothersdelim 1841 | % 1842 | % 原理方法:判断作者或译者是否中文,若中文用字符等,否则用et al. 。 1843 | \renewbibmacro*{name:andothers}{\bibauthorfont% 1844 | \ifboolexpr{ 1845 | test {\ifnumequal{\value{listcount}}{\value{liststop}}} 1846 | and 1847 | test \ifmorenames 1848 | }{\ifnumgreater{\value{liststop}}{1}% 1849 | {\finalandcomma}% 1850 | {}% 1851 | \printdelim{andothersdelim}\printdelim{strandothersdelim}% 1852 | }{%当是译者的时候需要特殊处理:从7.2节看等,译前面加逗号,但从示例看等和译同时出现时,译前的逗号没有,比如: 1853 | %袁训来, 陈哲, 肖书海, 等. 1854 | %胡泳, 范海燕, 译. 1855 | %潘惠霞, 魏婧, 杨艳, 等译. 1856 | \ifcurrentname{translator}{\addcomma\addthinspace}{}%为了实现上述第二个示例情况做的处理 1857 | }} 1858 | 1859 | 1860 | % 1861 | % 修改省略作者后的本地化字符串,比如et al. 1862 | % v1.0o,20190103,hzz 1863 | % 1864 | % 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andotherscn=“等”,否则用andothers=“et al.”。 1865 | % 非默认情况,根据选项信息,选择选择强制中文或英文 1866 | % 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了 1867 | % 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置 1868 | \DeclareDelimFormat{strandothersdelim}{% 1869 | \edef\userfieldabcde{userd}% 1870 | \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% 1871 | \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% 1872 | \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% 1873 | \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% 1874 | \ifcase\value{gbbiblocalcase}% 1875 | \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andotherscn}}{}% 1876 | \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andotherskr}}{}% 1877 | \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andothersjp}}{}% 1878 | \iffieldequalstr{\userfieldabcde}{english}{\bibstring{andothers}}{}% 1879 | \iffieldequalstr{\userfieldabcde}{french}{\bibstring{andothers}}{}% 1880 | \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{andothers}}{}% 1881 | \or% 1882 | \bibstring{andotherscn}% 1883 | \or% 1884 | \bibstring{andothers}% 1885 | \fi} 1886 | 1887 | % 1888 | % 修改最后一个作者前的字符串,比如 and 1889 | % v1.0o,20190103,hzz 1890 | % 1891 | % 原理方法:默认情况下判断作者或译者是否中文,若中文用字符andcn=“和”,否则用and=“and”。 1892 | % 非默认情况,根据选项信息,选择选择强制中文或英文 1893 | % 首先设置全局的,然后设置文献表中的,这一等价于将所有的cite命令环境都设置过了 1894 | % 而不用对每一个引用命令单独设置,比如cite,parancite,textcite都设置 1895 | \DeclareDelimFormat{finalnamedelim}{% 1896 | \ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}% 1897 | \addspace% 1898 | \edef\userfieldabcde{userd}% 1899 | \ifcurrentname{translator}{\edef\userfieldabcde{usere}}{}% 1900 | \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% 1901 | \ifcurrentname{author}{\edef\userfieldabcde{userf}}{}% 1902 | \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% 1903 | \ifcase\value{gbbiblocalcase}% 1904 | \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{andcn}}{}% 1905 | \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{andkr}}{}% 1906 | \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{andjp}}{}% 1907 | \iffieldequalstr{\userfieldabcde}{english}{\bibstring{and}}{}% 1908 | \iffieldequalstr{\userfieldabcde}{french}{\bibstring{and}}{}% 1909 | \iffieldequalstr{\userfieldabcde}{russian}{\bibstring{and}}{}% 1910 | \space% 1911 | \or% 1912 | \bibstring{andcn}\space% 1913 | \or% 1914 | \bibstring{and}\space% 1915 | \fi} 1916 | 1917 | 1918 | % 1919 | % 重设title的输出 1920 | % 1921 | % 20180425,v1.0k,为标题增加字体控制命令,Hu Zhenzhen 1922 | % 原理方法:将文献类型标识符输出出去,原输出来自biblatex.def文件 1923 | % 利用toggle做标识符是否输出的判断 1924 | \renewbibmacro*{title}{% 1925 | \ifboolexpr{% 1926 | test{\iffieldundef{title}}% 1927 | and 1928 | test{\iffieldundef{subtitle}}% 1929 | }% 1930 | {}% 1931 | {\printtext[title]{\bibtitlefont%增加字体控制命令 1932 | \printfield[titlecase]{title}% 1933 | \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 1934 | {}{\setunit{\subtitlepunct}% 1935 | \printfield[titlecase]{subtitle}}% 1936 | \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 1937 | {\setunit{\subtitlepunct}\printfield{titleaddon}}% 1938 | \iftoggle{bbx:gbtype}{% 1939 | \iffieldundef{note}{\printfield[gbtypeflag]{usera}}%在标题后直接给出文献标识字母,判断一下,是否是报纸和标准 1940 | {\iffieldequalstr{note}{standard}{\printfield[gbtypeflags]{usera}}%判断是否为标准 1941 | {\iffieldequalstr{note}{news}{\printfield[gbtypeflagn]{usera}}%判断是否为报纸 1942 | {\printfield[gbtypeflag]{usera}}}%其它 1943 | }}{}% 1944 | %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 1945 | %\newunit 1946 | }% 1947 | }} 1948 | 1949 | % 1950 | % 作者信息的输出格式 1951 | % 1952 | % 20180425,v1.0k,为作者增加字体控制命令,Hu Zhenzhen 1953 | % 20180603,v1.0l,增加使用nameformat域来选择姓名格式 1954 | \DeclareNameFormat{namefmtselected}{% 1955 | \iffieldundef{namefmtid}{}% 1956 | {\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}% 1957 | \ifcase\value{gbnamefmtcase}% 1958 | \ifgiveninits 1959 | {\usebibmacro{name:gbuppercase} 1960 | {\namepartfamily} 1961 | {\namepartgiveni} 1962 | {\namepartprefix} 1963 | {\namepartsuffix}} 1964 | {\usebibmacro{name:gbuppercase} 1965 | {\namepartfamily} 1966 | {\namepartgiven} 1967 | {\namepartprefix} 1968 | {\namepartsuffix}}% 1969 | \or 1970 | \ifgiveninits 1971 | {\usebibmacro{name:gblowercase} 1972 | {\namepartfamily} 1973 | {\namepartgiveni} 1974 | {\namepartprefix} 1975 | {\namepartsuffix}} 1976 | {\usebibmacro{name:gblowercase} 1977 | {\namepartfamily} 1978 | {\namepartgiven} 1979 | {\namepartprefix} 1980 | {\namepartsuffix}}% 1981 | \or 1982 | \ifgiveninits 1983 | {\usebibmacro{name:given-family} 1984 | {\namepartfamily} 1985 | {\namepartgiveni} 1986 | {\namepartprefix} 1987 | {\namepartsuffix}} 1988 | {\usebibmacro{name:given-family} 1989 | {\namepartfamily} 1990 | {\namepartgiven} 1991 | {\namepartprefix} 1992 | {\namepartsuffix}}% 1993 | \or 1994 | \ifgiveninits 1995 | {\usebibmacro{name:family-given} 1996 | {\namepartfamily} 1997 | {\namepartgiveni} 1998 | {\namepartprefix} 1999 | {\namepartsuffix}} 2000 | {\usebibmacro{name:family-given} 2001 | {\namepartfamily} 2002 | {\namepartgiven} 2003 | {\namepartprefix} 2004 | {\namepartsuffix}}% 2005 | \or 2006 | \usebibmacro{name:gbpinyin} 2007 | {\namepartfamily} 2008 | {\namepartgiven} 2009 | {\namepartprefix} 2010 | {\namepartsuffix}% 2011 | \or 2012 | \ifnumequal{\value{listcount}}{1} 2013 | {\ifgiveninits 2014 | {\usebibmacro{name:family-given} 2015 | {\namepartfamily} 2016 | {\namepartgiveni} 2017 | {\namepartprefix} 2018 | {\namepartsuffix}} 2019 | {\usebibmacro{name:family-given} 2020 | {\namepartfamily} 2021 | {\namepartgiven} 2022 | {\namepartprefix} 2023 | {\namepartsuffix}}% 2024 | \ifboolexpe{% 2025 | test {\ifdefvoid\namepartgiven} 2026 | and 2027 | test {\ifdefvoid\namepartprefix}} 2028 | {} 2029 | {\usebibmacro{name:revsdelim}}} 2030 | {\ifgiveninits 2031 | {\usebibmacro{name:given-family} 2032 | {\namepartfamily} 2033 | {\namepartgiveni} 2034 | {\namepartprefix} 2035 | {\namepartsuffix}} 2036 | {\usebibmacro{name:given-family} 2037 | {\namepartfamily} 2038 | {\namepartgiven} 2039 | {\namepartprefix} 2040 | {\namepartsuffix}}}% 2041 | \fi 2042 | \usebibmacro{name:andothers}} 2043 | 2044 | \DeclareNameAlias{default}{namefmtselected}%姓名的默认格式采用可选的模式 2045 | \DeclareNameAlias{sortname}{default}% Used in the bibliography %family-given/given-family 2046 | \DeclareNameAlias{citename}{default}% Default used by \citename 2047 | 2048 | \DeclareDelimFormat[bib,biblist]{andothersdelim}{\addcomma\addspace} 2049 | %\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}% 2050 | 2051 | %GB/T 7714-2015 风格,全部大写 2052 | \newbibmacro*{name:gbuppercase}[4]{\bibauthorfont% 2053 | \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 2054 | \renewcommand*{\revsdnamepunct}{}% 2055 | \ifuseprefix% 2056 | {\usebibmacro{name:delim}{#3#1}% 2057 | \usebibmacro{name:hook}{#3#1}% 2058 | \ifdefvoid{#3}{}{% 2059 | \ifcapital% 2060 | {\mkbibnameprefix{\MakeCapital{#3}}\isdot}% 2061 | {\mkbibnameprefix{#3}\isdot}% 2062 | \ifprefchar{}{\bibnamedelimc}}% 2063 | \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% 2064 | \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital 2065 | \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号 2066 | {\usebibmacro{name:delim}{#1}% 2067 | \usebibmacro{name:hook}{#1}% 2068 | \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% 2069 | \ifboolexpe{% 2070 | test {\ifdefvoid{#2}} 2071 | and 2072 | test {\ifdefvoid{#3}}} 2073 | {}{\revsdnamepunct}% 2074 | \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeUppercase{#2}}\isdot}%\MakeCapital 2075 | \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% 2076 | \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号 2077 | } 2078 | 2079 | %GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出 2080 | \newbibmacro*{name:gblowercase}[4]{\bibauthorfont% 2081 | \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 2082 | \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def 2083 | \ifuseprefix 2084 | {\usebibmacro{name:delim}{#3#1}% 2085 | \usebibmacro{name:hook}{#3#1}% 2086 | \ifdefvoid{#3}{}{% 2087 | \ifcapital 2088 | {\mkbibnameprefix{\MakeCapital{#3}}\isdot} 2089 | {\mkbibnameprefix{#3}\isdot}% 2090 | \ifprefchar{}{\bibnamedelimc}}% 2091 | \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot% 2092 | \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital 2093 | \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%后缀前加逗号 2094 | {\usebibmacro{name:delim}{#1}% 2095 | \usebibmacro{name:hook}{#1}% 2096 | \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{{#1}}}\isdot% 2097 | \ifboolexpe{% 2098 | test {\ifdefvoid{#2}} 2099 | and 2100 | test {\ifdefvoid{#3}}} 2101 | {}{\revsdnamepunct}% 2102 | \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{{#2}}\isdot}%\MakeCapital 2103 | \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} 2104 | \ifdefvoid{#4}{}{\addcomma\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}%%后缀前加逗号 2105 | } 2106 | 2107 | %中文常见风格,汉语拼音全拼模式 2108 | \newbibmacro*{name:gbpinyin}[4]{\bibauthorfont% 2109 | \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉,%来源biblatex2.STY 2110 | \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def 2111 | \renewrobustcmd*{\bibnamedelima}{\mbox{-}}% 2112 | \ifuseprefix 2113 | {\usebibmacro{name:delim}{#3#1}% 2114 | \usebibmacro{name:hook}{#3#1}% 2115 | \ifdefvoid{#3}{}{% 2116 | \ifcapital 2117 | {\mkbibnameprefix{\MakeCapital{#3}}\isdot} 2118 | {\mkbibnameprefix{#3}\isdot}% 2119 | \ifprefchar{}{\bibnamedelimc}}% 2120 | \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% 2121 | \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamegiven{#2}}\isdot}%\MakeCapital 2122 | \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}} 2123 | {\usebibmacro{name:delim}{#1}% 2124 | \usebibmacro{name:hook}{#1}% 2125 | \ifdefvoid{#2}{\mkbibnamefamily{\MakeCapital{#1}}}{\mkbibnamefamily{\MakeUppercase{#1}}}\isdot% 2126 | \ifboolexpe{% 2127 | test {\ifdefvoid{#2}} 2128 | and 2129 | test {\ifdefvoid{#3}}} 2130 | {} 2131 | {\revsdnamepunct}% 2132 | \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{\MakeCapital{#2}}\isdot}%\MakeCapital 2133 | \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot} 2134 | \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}% 2135 | } 2136 | 2137 | 2138 | \@ifpackagelater{biblatex}{2016/03/27}%biblatex<3.2版的情况 2139 | {}{ 2140 | %GB/T 7714-2015 风格,全部大写 2141 | \renewbibmacro*{name:gbuppercase}[4]{\bibauthorfont% 2142 | \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 2143 | \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def 2144 | \ifuseprefix 2145 | {\usebibmacro{name:delim}{#3#1}% 2146 | \usebibmacro{name:hook}{#3#1}% 2147 | \ifblank{#3}{}{% 2148 | \ifcapital 2149 | {\mkbibnameprefix{\MakeCapital{#3}}\isdot} 2150 | {\mkbibnameprefix{#3}\isdot}% 2151 | \ifpunctmark{'}{}{\bibnamedelimc}}% 2152 | %\mkbibnamelast{#1}\isdot 2153 | \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase 2154 | %注意上一句\MakeCapital后面如果再跟一个{}包含#1,则没有效果,可能是包在里面少了一层展开 2155 | %因为机构名通常包括在{}内,所以要多展开一次才行,所以这里去掉#1外面的{} 2156 | %\mkbibnamelast{\MakeUppercase{#1}}\isdot 2157 | %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 2158 | \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% 2159 | \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}}%后缀前加逗号 2160 | {\usebibmacro{name:delim}{#1}% 2161 | \usebibmacro{name:hook}{#1}% 2162 | %\mkbibnamelast{#1}\isdot %3.9.1 Generic Commands and Hooks,对姓重新处理,如下句: %\mkbibnamelast{\MakeUppercase{#1}} 2163 | \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase 2164 | %\mkbibnamelast{\MakeUppercase{#1}}\isdot 2165 | %\ifblank{#4}{}{\bibnamedelimd\mkbibnameaffix{#4}\isdot}%这句放到后面 2166 | \ifblank{#2#3}{}{\revsdnamepunct}% 2167 | \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% 2168 | \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% 2169 | \addcomma\addspace% 2170 | \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}%%后缀前加逗号 2171 | }% 2172 | } 2173 | 2174 | %GB/T 7714-2015 风格,大小写不变,根据bib文件内输入原样输出 2175 | \renewbibmacro*{name:gblowercase}[4]{\bibauthorfont% 2176 | \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 2177 | \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def 2178 | \ifuseprefix 2179 | {\usebibmacro{name:delim}{#3#1}% 2180 | \usebibmacro{name:hook}{#3#1}% 2181 | \ifblank{#3}{}{% 2182 | \ifcapital 2183 | {\mkbibnameprefix{\MakeCapital{#3}}\isdot} 2184 | {\mkbibnameprefix{#3}\isdot}% 2185 | \ifpunctmark{'}{}{\bibnamedelimc}}% 2186 | \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase 2187 | \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamefirst{{#2}}\isdot}% 2188 | \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}}%后缀前加逗号 2189 | {\usebibmacro{name:delim}{#1}% 2190 | \usebibmacro{name:hook}{#1}% 2191 | \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase 2192 | \ifblank{#2#3}{}{\revsdnamepunct}% 2193 | \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{{#2}}\isdot}% 2194 | \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% 2195 | \addcomma\addspace% 2196 | \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}%%后缀前加逗号 2197 | }% 2198 | } 2199 | 2200 | %中文常见风格,汉语拼音全拼模式 2201 | \renewbibmacro*{name:gbpinyin}[4]{\bibauthorfont% 2202 | \renewrobustcmd*{\bibinitperiod}{}%将名字简写后的点去掉 2203 | \renewcommand*{\revsdnamepunct}{}%%来源biblatex.def 2204 | \renewrobustcmd*{\bibnamedelima}{\mbox{-}}% 2205 | \ifuseprefix 2206 | {\usebibmacro{name:delim}{#3#1}% 2207 | \usebibmacro{name:hook}{#3#1}% 2208 | \ifblank{#3}{}{% 2209 | \ifcapital 2210 | {\mkbibnameprefix{\MakeCapital{#3}}\isdot} 2211 | {\mkbibnameprefix{#3}\isdot}% 2212 | \ifpunctmark{'}{}{\bibnamedelimc}}% 2213 | \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot%\MakeUppercase %\mkbibnamelast{\MakeUppercase{#1}} %\MakeSentenceCase 2214 | \ifblank{#2}{}{\revsdnamepunct\bibnamedelimd\MakeSentenceCase{\mkbibnamefirst{#2}}\isdot}% 2215 | \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}} 2216 | {\usebibmacro{name:delim}{#1}% 2217 | \usebibmacro{name:hook}{#1}% 2218 | \ifblank{#2}{\MakeCapital#1}{\mkbibnamelast{\MakeUppercase{#1}}}\isdot %大写,参考4.6.4 Miscellaneous Commands,\MakeUppercase %\MakeSentenceCase 2219 | \ifblank{#2#3}{}{\revsdnamepunct}% 2220 | \ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{\MakeUppercase{#2}}\isdot}% 2221 | \ifblank{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}% 2222 | \addcomma\addspace% 2223 | \ifblank{#4}{}{\addcomma\addspace\bibnamedelimd\mkbibnameaffix{#4}\isdot}% 2224 | }% 2225 | } 2226 | 2227 | %%biblatex<3.2版的情况,姓名的处理格式带参数 2228 | \DeclareNameFormat{namefmtselected}{% 2229 | \iffieldundef{namefmtid}{}% 2230 | {\defcounter{gbnamefmtcase}{\thefield{namefmtid}}}% 2231 | \ifcase\value{gbnamefmtcase}% 2232 | \iffirstinits 2233 | {\usebibmacro{name:gbuppercase}{#1}{#4}{#5}{#7}} 2234 | {\usebibmacro{name:gbuppercase}{#1}{#3}{#5}{#7}}% 2235 | \or 2236 | \iffirstinits 2237 | {\usebibmacro{name:gblowercase}{#1}{#4}{#5}{#7}} 2238 | {\usebibmacro{name:gblowercase}{#1}{#3}{#5}{#7}}% 2239 | \or 2240 | \iffirstinits 2241 | {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}} 2242 | {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}% 2243 | \ifblank{#3#5} 2244 | {} 2245 | {\usebibmacro{name:revsdelim}}% 2246 | \or 2247 | \iffirstinits 2248 | {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}} 2249 | {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}% 2250 | \or 2251 | \usebibmacro{name:gbpinyin}{#1}{#3}{#5}{#7}% 2252 | \or 2253 | \ifnumequal{\value{listcount}}{1} 2254 | {\iffirstinits 2255 | {\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}} 2256 | {\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}% 2257 | \ifblank{#3#5} 2258 | {} 2259 | {\usebibmacro{name:revsdelim}}} 2260 | {\iffirstinits 2261 | {\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}} 2262 | {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}}% 2263 | \fi 2264 | \usebibmacro{name:andothers}} 2265 | } 2266 | 2267 | % 2268 | % url和url日期格式 2269 | % 2270 | \renewbibmacro*{url+urldate}{% 2271 | %\usebibmacro{url}%%更换url的位置,放到下面 2272 | \iffieldundef{urlyear}% 2273 | {}{%\setunit*{\addspace}% 2274 | \usebibmacro{urldate}}% 2275 | \setunit{\addperiod\addspace}% 2276 | \usebibmacro{url}} 2277 | \renewbibmacro*{url}{\printfield{url}} 2278 | 2279 | 2280 | 2281 | 2282 | % 2283 | % 日期信息的输出格式,针对biblatex<3.7版本 2284 | % 2285 | \defversion{3.4}{date}{ 2286 | \renewbibmacro*{urldate}{% 2287 | \addthinspace\printtext{[}\printfield{urlyear}% 2288 | \iffieldundef{urlmonth}{}{\bibrangedash\printfield{urlmonth}}% 2289 | \iffieldundef{urlday}{}{\bibrangedash\printfield{urlday}}\printtext{]}} 2290 | 2291 | \newbibmacro*{newsdate}{%%新增加一个公告日期,公开日期或新闻日期 2292 | \iffieldundef{year}{}{\printfield{year}% 2293 | \iffieldundef{month}{}{\bibrangedash\printtext{\thefield{month}}% 2294 | \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}% 2295 | } 2296 | 2297 | \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 2298 | \ifboolexpr{% 2299 | test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% 2300 | }% 2301 | {}%更新或修改日期通常有day信息 2302 | {\iffieldequalstr{year}{}{%替换\iffieldundef{year},因为year总是存在,但为空 2303 | \iffieldundef{endyear}{% 2304 | \iffieldundef{eventyear}{}{\printtext{\mkbibparens{\printtext{\printfield{eventyear}}% 2305 | \iffieldundef{eventmonth}{}{\bibrangedash\thefield{eventmonth}}% 2306 | \iffieldundef{eventday}{}{\bibrangedash\printfield{eventday}}}}% 2307 | }% 2308 | }{% 2309 | \iffieldundef{endyear}{}{\printtext{\mkbibparens{\printtext{\printfield{endyear}}% 2310 | \iffieldundef{endmonth}{}{\bibrangedash\thefield{endmonth}}% 2311 | \iffieldundef{endday}{}{\bibrangedash\printfield{endday}}}}% 2312 | }% 2313 | }% 2314 | }% 2315 | {% 2316 | \iffieldundef{year}{}{\printtext{\mkbibparens{\printtext{\printfield{year}}% 2317 | \iffieldundef{month}{}{\bibrangedash\thefield{month}}% 2318 | \iffieldundef{day}{}{\bibrangedash\printfield{day}}}}% 2319 | }% 2320 | }% 2321 | }}% 2322 | } 2323 | 2324 | % 2325 | % 日期信息的输出格式,针对3.9>=biblatex>=3.7版本 2326 | % 2327 | \defversion{3.7}{date}{ 2328 | \DeclareFieldFormat{urldate}{##1} 2329 | \renewbibmacro*{urldate}{% 2330 | \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令 2331 | 2332 | % 2333 | % 专利的公告日期、或报纸的日期的输出宏 2334 | % 20160701,v1.0,新增加 2335 | % 20180405,v1.0k,为biblatexv3.7-3.9版本,出现多出点bug做处理,Hu Zhenzhen 2336 | % 2337 | % 原理方法:加上printtext避免破坏异步标点机制 2338 | % 2339 | \newbibmacro*{newsdate}{% 2340 | \printtext{\blx@edtfdate{}{}}% 2341 | } 2342 | 2343 | \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 2344 | \ifboolexpr{% 2345 | test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% 2346 | }% 2347 | {}%更新或修改日期通常有day信息 2348 | {\iffieldundef{year}{% 2349 | \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}% 2350 | {\printtext{(}\printenddate\printtext{)}}% 2351 | }{\iffieldequalstr{year}{}{%因为year存在,但为空 2352 | }{\printtext{(}\blx@edtfdate{}{}\printtext{)}}% 2353 | }% 2354 | }}% 2355 | } 2356 | 2357 | % 2358 | % 日期信息的输出格式,针对biblatex>=3.10版本 2359 | % 2360 | \defversion{3.10}{date}{ 2361 | \DeclareFieldFormat{urldate}{##1} 2362 | \renewbibmacro*{urldate}{% 2363 | \addthinspace\printtext{[}\printurldate\printtext{]}}%能用高层命令+选项尽量用命令(比如这里的\printurldate),而不用\blx@edtfdate这种更底层的命令 2364 | 2365 | % 2366 | % 专利的公告日期、或报纸的日期的输出宏 2367 | % 20160701,v1.0,新增加 2368 | % 20180405,为biblatexv3.10版本,出现多出点bug做处理,Hu Zhenzhen 2369 | % 2370 | % 原理方法:加上printtext避免破坏异步标点机制 2371 | % 本可以用\printdate,但由于date选项设置为year,所以仅会给出年份 2372 | % 所以无法再用选项设置的方法,印象需要用底层的命令 2373 | % 这里可以用\blx@isodate,但用\blx@gbdate试图避免版本判断 2374 | \newbibmacro*{newsdate}{%% 2375 | \printtext{\blx@gbdate{}{}}%%\blx@isodate{}{}% 2376 | } 2377 | 2378 | % 2379 | \newbibmacro*{modifydate}{%新增加一个带括号的日期,用于表示电子资源的更新和修改日期,而公告日期则按日期格式 2380 | \ifboolexpr{% 2381 | test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% 2382 | }% 2383 | {}%更新或修改日期通常有day信息 2384 | {\iffieldundef{year}{% 2385 | \iffieldundef{endyear}{\iffieldundef{eventyear}{}{\printtext{(}\printeventdate\printtext{)}}}% 2386 | {\printtext{(}\printenddate\printtext{)}}% 2387 | }{\iffieldequalstr{year}{}{%因为year存在,但为空 2388 | }{\printtext{(}\blx@gbdate{}{}\printtext{)}}% 2389 | }% 2390 | }}% 2391 | } 2392 | 2393 | % 2394 | % biblatex>v3.8版利用related实现双语文献的处理 2395 | % 2396 | \defversion{3.8}{dblang}{ 2397 | %为了实现v3.8以上版本的双语文献,采用related的方法代替set方法,因为set方法已经无法实现了, 2398 | %因为set不再复制其第一个成员的信息。于是定义一个命令,用于动态的修改数据,即添加related域的信息 2399 | %其中使用了\DeclareStyleSourcemap,但由于其只能出现在导言区中,因此\defdoublelangentry命令也只能出现在导言区中 2400 | \newcommand{\defdoublelangentry}[2]{% 2401 | \edef\entrykeya{##1} 2402 | \edef\entrykeyb{##2} 2403 | \DeclareStyleSourcemap{ 2404 | \maps[datatype=bibtex]{ 2405 | \map{ 2406 | \step[fieldsource=entrykey, match=\entrykeya, final] 2407 | \step[fieldset=related, fieldvalue=\entrykeyb] 2408 | } 2409 | } 2410 | } 2411 | } 2412 | } 2413 | 2414 | % 2415 | % 关联文献间的分隔符 2416 | % 2417 | \renewcommand{\relateddelim}{\adddot\newline\nobreak}%\par,而作者年样式不需要修改,因为没有项对齐的标签问题 2418 | 2419 | % 2420 | % 关联文献的输出格式,针对3.9>=biblatex>=3.7版本 2421 | % 2422 | % 原理方法:因为related宏中带有##了,所以无法封装到defversion中了。所以直接做判断 2423 | % 下面这一段主要针对v3.8-3.10,因为我提问后,biblatex作者为3.11版增加了一个钩子控制relatedblock前的分隔符。 2424 | \ifboolexpr{ 2425 | test{\iftoggle{iftleight}} 2426 | or 2427 | test{\iftoggle{iftlnine}} 2428 | }{\renewbibmacro*{related}{%standard.bbx 2429 | \ifboolexpr{ test {\iffieldundef{related}} or test {\ifrelatedloop} } 2430 | {} 2431 | {\usebibmacro{begrelated}% 2432 | \def\bbx@tempa{}% 2433 | \setcounter{bbx:relatedtotal}{0}% 2434 | \def\do##1{% 2435 | \entrydata{##1}{% 2436 | \ifrelatedloop 2437 | {} 2438 | {\stepcounter{bbx:relatedtotal}% 2439 | \gappto{\bbx@tempa}{##1,}}}}% 2440 | \docsvfield{related}% 2441 | \restorefield{related}{\bbx@tempa}% 2442 | \ifnumgreater{\value{bbx:relatedtotal}}{0} 2443 | {\listcsxadd{bbx:relatedloop}{\strfield{entrykey}}% 2444 | \iffieldundef{clonesourcekey} 2445 | {} 2446 | {\listcsxadd{bbx:relatedloop}{\strfield{clonesourcekey}}}% 2447 | \setcounter{bbx:relatedcount}{0}% 2448 | \def\do{% 2449 | \stepcounter{bbx:relatedcount}% 2450 | \ifnumgreater{\value{bbx:relatedcount}}{0}%这里从1改为0 2451 | {\ifcsundef{relateddelim\strfield{relatedtype}} 2452 | {\printtext{\relateddelim}} 2453 | {\printtext{\csuse{relateddelim\strfield{relatedtype}}}}} 2454 | {}}% 2455 | \ifbibmacroundef{related:\strfield{relatedtype}} 2456 | {\appto{\do}{\usebibmacro{related:default}}} 2457 | {\appto{\do}{\usebibmacro*{related:\strfield{relatedtype}}}}% 2458 | \iffieldformatundef{related:\strfield{relatedtype}} 2459 | {\def\bbx@tempa{related}} 2460 | {\def\bbx@tempa{related:\strfield{relatedtype}}}% 2461 | \iffieldformatundef{relatedstring:\strfield{relatedtype}} 2462 | {\def\bbx@tempb{relatedstring:default}} 2463 | {\def\bbx@tempb{relatedstring:\strfield{relatedtype}}}% 2464 | \printtext[\bbx@tempa]{% 2465 | \usebibmacro{begrelatedloop}% 2466 | \iffieldundef{relatedstring} 2467 | {\ifboolexpr{ 2468 | test {\ifnumgreater{\value{bbx:relatedtotal}}{1}} 2469 | and 2470 | test {\ifbibxstring{\thefield{relatedtype}s}} 2471 | } 2472 | {\printtext[\bbx@tempb]{% 2473 | \bibstring[\mkrelatedstring]{\thefield{relatedtype}s}}} 2474 | {\iffieldbibstring{relatedtype} 2475 | {\printtext[\bbx@tempb]{% 2476 | \bibstring[\mkrelatedstring]{\thefield{relatedtype}}}} 2477 | {}}} 2478 | {\iffieldbibstring{relatedstring} 2479 | {\printtext[\bbx@tempb]{% 2480 | \bibstring[\mkrelatedstring]{\thefield{relatedstring}}}} 2481 | {\printfield[\bbx@tempb]{relatedstring}}}% 2482 | \docsvfield{related}% 2483 | \usebibmacro{endrelatedloop}}}% 2484 | {}% 2485 | \usebibmacro{endrelated}}} 2486 | }{} 2487 | 2488 | % 2489 | % 关联文献块前的分隔符,针对biblatex>3.11 2490 | % 2491 | % 原理方法:因为增加了begrelateddelim钩子,所以不需要重定义related输出宏 2492 | \defversion{3.11}{related}{ 2493 | \renewcommand{\begrelateddelim}{\adddot\newline\nobreak} 2494 | } 2495 | 2496 | \iftoggle{iftlfive}{\switchversion{3.4}{date}}{}%biblatex<=3.2 2497 | \iftoggle{iftlsix}{\switchversion{3.4}{date}}{}%3.3<=biblatex<=3.6 2498 | \iftoggle{iftlseven}{\switchversion{3.7}{date}}{}%biblatex=3.7 2499 | \iftoggle{iftleight}{\switchversion{3.7}{date}\switchversion{3.8}{dblang}}{}%3.8<=biblatex<=3.9 2500 | \iftoggle{iftlnine}{\switchversion{3.10}{date}\switchversion{3.8}{dblang}}{}%biblatex=3.10 2501 | \iftoggle{iftlatest}{\switchversion{3.10}{date}\switchversion{3.8}{dblang}\switchversion{3.11}{related}}{}%biblatex最新3.11 2502 | 2503 | % 2504 | % 调整doi+eprint+url格式 2505 | % 2016.07.01 byhzz 2506 | % 2019.05.01 byhzz 在eprint前增加一个空格 2507 | % 原理方法:源来自standard.bbx,因为页码后面直接跟引用日期,没有标点所以去掉其中的标点。 2508 | \renewbibmacro*{doi+eprint+url}{% 2509 | % \iftoggle{bbx:doi}%把doi的位置放到url后面 2510 | % {\printfield{doi}} 2511 | % {}% 2512 | %\newunit\newblock 2513 | \iftoggle{bbx:eprint} 2514 | {\iffieldundef{eprint}{}{\newunit\usebibmacro{eprint}}} 2515 | {}% 2516 | %\newunit\newblock 2517 | \iftoggle{bbx:url} 2518 | {\usebibmacro{url+urldate}} 2519 | {} 2520 | \newunit\newblock 2521 | \iftoggle{bbx:doi} 2522 | {\printfield{doi}} 2523 | {}} 2524 | 2525 | % 2526 | % 调整页码的格式,即chapter+pages格式 2527 | % 2528 | \renewbibmacro*{chapter+pages}{% 2529 | \iftoggle{bbx:gbstrict}{}{% 2530 | \printfield{chapter}}% 2531 | \iffieldundef{pages}{}{%这里增加一个判断,当没有页码时就不输出 2532 | \setunit{\bibpagespunct}% 2533 | \printfield{pages}}% 2534 | %\newunit %这里的标点去掉 2535 | } 2536 | 2537 | % 2538 | % 当location等出版项超过maxitem缩减后不再输出etal 2539 | % 2540 | \DeclareListFormat{location}{% 2541 | \usebibmacro{list:delim}{#1}% 2542 | #1\isdot} 2543 | \DeclareListAlias{institution}{location} 2544 | \DeclareListAlias{publisher}{location} 2545 | 2546 | % 新增一个样式用于输出连续出版物的地址,单位,时间, 2547 | % 用于periodical连续出版物的出版社和地址的处理 2548 | % 2549 | % v1.0k,20180425,为出版信息增加字体控制命令,hzz 2550 | % %类似\newbibmacro*{publisher+location+date} 2551 | \newbibmacro*{location+institution+date}{\bibpubfont% 2552 | \iftoggle{bbx:gbpub}% 2553 | {\testCJKfirst{userd}% 2554 | \ifboolexpr{% 2555 | test {\iflistundef{location}} and test {\iflistundef{institution}}% 2556 | }{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}% 2557 | {\printtext{[S.l.\space :\space s.n.\adddot]}}% 2558 | }{% 2559 | \iflistundef{location}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}}{\printtext{[S.l.\adddot]}}}% 2560 | {\printlist{location}}% 2561 | \addcolon\addspace% 2562 | \iflistundef{institution}{% 2563 | \iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}}{\printtext{\mkbibbrackets{s.n.}}}}% 2564 | {\printlist{institution}}}% 2565 | \setunit{\addcomma\addspace}% 2566 | %\usebibmacro{date}% 2567 | \printfield{year}% 2568 | \bibrangedash% 2569 | \iffieldundef{endyear}{}{\printfield{endyear}}% 2570 | \newunit}% 2571 | {\printlist{location}% 2572 | \iflistundef{institution}% 2573 | {\setunit*{\addcomma\space}} 2574 | {\setunit*{\addcolon\space}}% 2575 | \printlist{institution}% 2576 | \setunit*{\addcomma\space}% 2577 | \usebibmacro{date}% 2578 | \newunit}% 2579 | } 2580 | % 2581 | % 通用的出版社和地址的处理 2582 | % 2583 | % 原理方法:当没有出版社地址时,直接判断title的信息是否是中文,若为中文,则写出版地不详,否则用英文的字符表示。 2584 | % 事实上title对于每个文献来说是必须的,所以用它判断是最快的,而且一般标题和出版社的语言是一样的。 2585 | % 注意标准standard类型,因为当没有出版项时直接省略,所以做特殊处理 2586 | \renewbibmacro*{publisher+location+date}{\bibpubfont% 2587 | \iftoggle{bbx:gbpub}% 2588 | {\testCJKfirst{userd}% 2589 | \ifboolexpr{ test {\iflistundef{location}} and test {\iflistundef{publisher}} }% 2590 | {\iffieldequalstr{note}{standard}{}{\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress}\space :\space\str@nopublisher]}{\printtext{[S.l.\space :\space s.n.\adddot]}}}}% 2591 | {\iflistundef{location}{%\adddot 2592 | \iffieldequalstr{note}{standard}{}%%从gbt7714-2015标准第19页看到,标准存在出版项时输出,没有时完全省略。 2593 | {\iftoggle{ifCJKforgbt}{\printtext{[\str@noaddress]}\addcolon\addspace}{\printtext{[S.l.\adddot]}\addcolon\addspace}}}% \bibstring{noaddress} 2594 | {\printlist{location}\addcolon\addspace}%%\addcolon\addspace% 2595 | \iflistundef{publisher}{% 2596 | \iffieldequalstr{note}{standard}{}% 2597 | {\iftoggle{ifCJKforgbt}{\printtext{[\str@nopublisher]}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}% 2598 | {\printtext{\mkbibbrackets{s.n.}}\setunit{\adddot\addspace}\setunit*{\addcomma\addspace}}}}% 2599 | {\printlist{publisher}}}% 2600 | \setunit*{\addcomma\addspace}%\addcomma\addspace% 2601 | \usebibmacro{date}%%\newunit %去掉这个标点 2602 | }% 2603 | {\printlist{location}% 2604 | \iflistundef{publisher} 2605 | {\setunit*{\addcomma\space}} 2606 | {\setunit*{\addcolon\space}}% 2607 | \printlist{publisher}% 2608 | \setunit*{\addcomma\space}% 2609 | \usebibmacro{date}%%\newunit 2610 | }% 2611 | } 2612 | 2613 | % 2614 | % 修改了一个institution+location+date用于manual、report、thesis等类型 2615 | % 2616 | % 20180425,v1.0k,增加了字体控制命令,hzz 2617 | % 20190105,v1.0o,加了一个编组避免\usebibmacro{date}把month和day信息去掉 2618 | \renewbibmacro*{institution+location+date}{\bibpubfont%当没有institution时不处理。 2619 | {\printlist{location}%%加了一个编组避免\usebibmacro{date}把month和day信息去掉 2620 | \iflistundef{institution} 2621 | {\setunit*{\addcomma\space}} 2622 | {\setunit*{\addcolon\space}}% 2623 | \printlist{institution}% 2624 | \setunit*{\addcomma\space}% 2625 | \usebibmacro{date}% 2626 | %\newunit 2627 | }} 2628 | 2629 | % 2630 | % 对volume卷信息格式做出修改 2631 | % v1.0o,20190105,hzz 2632 | % 2633 | \DeclareFieldFormat{volume}{% 2634 | \testCJKfirst{userd}% 2635 | \iftoggle{ifCJKforgbt}% 2636 | {\bibstring{serialcn}#1\bibstring{volumecn}}% 2637 | {\bibstring{volume}~#1}% 2638 | }% volume of a book 2639 | \DeclareFieldFormat[article,periodical]{volume}{#1}% volume of a journal 2640 | 2641 | % 2642 | % 对number册信息格式做出修改 2643 | % v1.0o,20190105,hzz 2644 | % 2645 | \DeclareFieldFormat{number}{#1}% 2646 | \DeclareFieldFormat[book,collection,inbook,% 2647 | incollection,proceedings,inproceedings]{number}{% 2648 | \testCJKfirst{userd}% 2649 | \iftoggle{ifCJKforgbt}% 2650 | {\bibstring{serialcn}#1\bibstring{numbercn}}% 2651 | {#1}% 2652 | }% 2653 | 2654 | % 2655 | % 对edition版本信息格式做出修改 2656 | % 2657 | \DeclareFieldFormat{edition}{\bibtitlefont%源来自biblatex.DEF 2658 | \testCJKfirst{userd}% 2659 | \iftoggle{ifCJKforgbt}% 2660 | {\ifinteger{#1}% 2661 | {\printtext{#1\str@edition}}% 2662 | {#1\isdot}}% 2663 | {\ifinteger{#1}% 2664 | {\mkbibordedition{#1}~\bibstring{edition}}% 2665 | {#1\isdot}}} 2666 | 2667 | % 2668 | % 对version的版本信息做出修改 2669 | % 2670 | \DeclareFieldFormat{version}{\bibtitlefont%源来自biblatex.DEF 2671 | \testCJKfirst{userd}% 2672 | \ifinteger{#1}% 2673 | {\iftoggle{ifCJKforgbt}{\printtext{#1\str@edition}}% 2674 | {\mkbibordedition{#1}~\bibstring{version}}}% 2675 | {#1\isdot}} 2676 | 2677 | % 2678 | % 修改析出文献的文集的标题与附加标题间的符号 2679 | % 2680 | \renewbibmacro*{booktitle}{% 2681 | \ifboolexpr{ 2682 | test {\iffieldundef{booktitle}} 2683 | and 2684 | test {\iffieldundef{booksubtitle}} 2685 | } 2686 | {} 2687 | {\printtext[booktitle]{\bibtitlefont% 2688 | \printfield[titlecase]{booktitle}% 2689 | \setunit{\subtitlepunct}% 2690 | \printfield[titlecase]{booksubtitle}}% 2691 | \newunit%标点换成下一句 2692 | \setunit{\subtitlepunct}}% 2693 | \printfield{booktitleaddon}} 2694 | 2695 | 2696 | % 2697 | % 调整期刊名的格式 2698 | % 2699 | % v1.0k,20180425,增加了字体控制命令,hzz 2700 | \renewbibmacro*{journal+issuetitle}{\bibpubfont%源来自standard.bbx 2701 | \usebibmacro{journal}% 2702 | %\setunit*{\addspace}% 2703 | \setunit*{\addcomma\addspace}%修改为增加一个逗号 2704 | \iffieldundef{series} 2705 | {} 2706 | {\newunit 2707 | \printfield{series}% 2708 | \setunit{\addspace}}% 2709 | %\usebibmacro{volume+number+eid}% 2710 | %\setunit{\addspace}% 2711 | \usebibmacro{issue+date}% 2712 | %\setunit{\addcolon\space}% 2713 | \iffieldundef{volume}{}{\setunit{\addcomma\space}}% 2714 | %换成逗号和空格 2715 | \usebibmacro{issue}% 2716 | \usebibmacro{volume+number+eid}%把卷期放到年份后面 2717 | %\newunit 2718 | } 2719 | 2720 | 2721 | 2722 | % 2723 | % 调整期刊卷和期的格式 2724 | % 2725 | \renewbibmacro*{volume+number+eid}{%源来自standard.bbx 2726 | \iftoggle{bbx:gbfieldstd}{% 2727 | \printfield{volume}% 2728 | \setunit*{\adddot}% 2729 | \printfield{number}% 2730 | \setunit{\addcomma\space}% 2731 | \printfield{eid}}{% 2732 | \printfield{volume}% 2733 | %\setunit*{\adddot}%去掉点号 2734 | %\printfield{number}% 2735 | \iffieldundef{number}{}{\printtext{\mkbibparens{\printfield{number}}}}%增加一个圆括号 2736 | \iffieldundef{eid}{}{% 2737 | \setunit{\addcomma\space}% 2738 | \printfield{eid}}}} 2739 | 2740 | % 2741 | % 调整期刊年份的格式 2742 | % 2743 | \renewbibmacro*{issue+date}{%去掉括号 2744 | \printtext{%去掉了[parens] 2745 | \iffieldundef{issue} 2746 | {%\usebibmacro{date} 2747 | \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸 2748 | {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸 2749 | {\usebibmacro{date}}% 2750 | }}% 2751 | {\iftoggle{bbx:gbstrict}{}{\printfield{issue}% 2752 | \setunit*{\addspace}}% 2753 | %\usebibmacro{date} 2754 | \iffieldundef{note}{\usebibmacro{date}}%判断一下,是否是报纸 2755 | {\iffieldequalstr{note}{news}{\usebibmacro{newsdate}}%判断是否为报纸 2756 | {\usebibmacro{date}}% 2757 | }}}% 2758 | %\newunit 2759 | } 2760 | 2761 | % 2762 | % 调整页码前的标点和去掉期刊文章等页码后面的标点 2763 | % 2764 | \renewbibmacro*{note+pages}{%源来自standard.bbx 2765 | %\printfield{note}%不要note,note用来判断是否是报纸newspaper 2766 | \iffieldundef{pages}{}{ 2767 | \setunit{\bibpagespunct}% 2768 | \printfield{pages}}% 2769 | %\newunit 2770 | } 2771 | 2772 | 2773 | % 2774 | % 编者的符号修改一下 2775 | % v1.0 2016-07-01 2776 | % v1.0q 2019-03-01 hzz 修改editortype前的标点 2777 | % 2778 | \renewbibmacro*{editor}{%源来自biblatex.DEF 2779 | \ifboolexpr{ 2780 | test \ifuseeditor 2781 | and 2782 | not test {\ifnameundef{editor}} 2783 | } 2784 | {\printnames{editor}% 2785 | \iffieldundef{editortype}%增加一个类型判断,用于存在editortype的情况 2786 | {\setunit\addspace}%当没有editortype时,直接用句点 2787 | {%\setunit{\addcomma\space}% 2788 | \usebibmacro{editorstrg}}% 2789 | %\clearname{editor} 2790 | }% 2791 | {}} 2792 | 2793 | % 2794 | % 编者类型做一修改 2795 | % v1.0 2016-07-01 2796 | % v1.0q 2019-03-01 hzz 修改editortype不同语言的不同本地化字符串 2797 | % 2798 | \renewbibmacro*{editorstrg}{%源来自biblatex.DEF 2799 | \printtext[editortype]{% 2800 | \iffieldundef{editortype} 2801 | {% 2802 | % \ifboolexpr{ %这一段去掉,未定义编者类型情况下不处理 2803 | % test {\ifnumgreater{\value{editor}}{1}} 2804 | % or 2805 | % test {\ifandothers{editor}} 2806 | % } 2807 | % {\bibstring{editors}} 2808 | % {\bibstring{editor}} 2809 | } 2810 | {\ifbibxstring{\thefield{editortype}} %定义编者类型情况下处理,以后根据需要修改 2811 | {\ifboolexpr{ 2812 | test {\ifnumgreater{\value{editor}}{1}} 2813 | or 2814 | test {\ifandothers{editor}} 2815 | } 2816 | {\printdelim{streditortypes}} 2817 | {\printdelim{streditortype}}} 2818 | {\thefield{editortype}}}% 2819 | }} 2820 | 2821 | % 2822 | % 编者类型的本地化字符串输出 2823 | % v1.0q 2019-03-01 hzz 2824 | % 能对不同条目类型作格式设置的域格式,能对不同环境做格式设置的分隔符 2825 | % 能对不同文境作设置的包括排序,标签等 2826 | % 这里因为考虑可能标注和文献表中存在不同,所以用分隔符来输出本地化字符串 2827 | % 2828 | \DeclareDelimFormat{streditortypes}{% 2829 | \edef\userfieldabcde{userd}% 2830 | \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% 2831 | \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% 2832 | \ifcase\value{gbbiblocalcase}% 2833 | \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}scn}}{}% 2834 | \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}skr}}{}% 2835 | \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}sjp}}{}% 2836 | \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% 2837 | \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% 2838 | \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}s}}{}% 2839 | \or% 2840 | \bibstring{\thefield{editortype}scn}% 2841 | \or% 2842 | \addcomma\addthinspace\bibstring{\thefield{editortype}s}% 2843 | \fi} 2844 | % 2845 | \DeclareDelimFormat{streditortype}{% 2846 | \edef\userfieldabcde{userd}% 2847 | \ifcurrentname{editor}{\edef\userfieldabcde{userc}}{}% 2848 | \ifcurrentname{bookauthor}{\edef\userfieldabcde{userb}}{}% 2849 | \ifcase\value{gbbiblocalcase}% 2850 | \iffieldequalstr{\userfieldabcde}{chinese}{\bibstring{\thefield{editortype}cn}}{}% 2851 | \iffieldequalstr{\userfieldabcde}{korean}{\bibstring{\thefield{editortype}kr}}{}% 2852 | \iffieldequalstr{\userfieldabcde}{japanese}{\bibstring{\thefield{editortype}jp}}{}% 2853 | \iffieldequalstr{\userfieldabcde}{english}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% 2854 | \iffieldequalstr{\userfieldabcde}{french}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% 2855 | \iffieldequalstr{\userfieldabcde}{russian}{\addcomma\addthinspace\bibstring{\thefield{editortype}}}{}% 2856 | \or% 2857 | \bibstring{\thefield{editortype}cn}% 2858 | \or% 2859 | \addcomma\addthinspace\bibstring{\thefield{editortype}}% 2860 | \fi} 2861 | 2862 | 2863 | % 2864 | % bookauthor域的输出, 2865 | % v1.0q 2019-03-01 hzz 2866 | % 不再对editor和bookauthor做sourcemap,而是下面的宏内逻辑代替, 2867 | % 使得除使用bookauthor外也可以使用editor,便于在使用editor时使用editortype 2868 | \renewbibmacro*{bybookauthor}{% 2869 | \ifnameundef{bookauthor}% 2870 | {\ifnameundef{editor}% 2871 | {}% 2872 | {\ifnamesequal{author}{editor}% 2873 | {}{\usebibmacro{editor}}}% 2874 | }% 2875 | {\ifnamesequal{author}{bookauthor}% 2876 | {}{\printnames{bookauthor}}% 2877 | }% 2878 | } 2879 | 2880 | % 2881 | % 修改期刊的标题 2882 | % 2883 | \renewbibmacro*{periodical}{%源来自biblatex.DEF 2884 | \iffieldundef{title} 2885 | {} 2886 | {\printtext[title]{\bibtitlefont% 2887 | \printfield[titlecase]{title}% 2888 | %\setunit{\subtitlepunct}% 2889 | \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 2890 | {}{\setunit{\subtitlepunct} 2891 | \printfield[titlecase]{subtitle}}% 2892 | %}%把编组结束移到后面去 2893 | \iftoggle{bbx:gbtype}{% 2894 | \iffieldundef{usera}{}{%在标题后直接给出文献标识字母 2895 | \printfield[gbtypeflag]{usera}}}{} 2896 | }} 2897 | } 2898 | 2899 | % 2900 | % 期刊的标题做修改 2901 | % 2902 | \renewbibmacro*{title+issuetitle}{%源来自standard.BBX 2903 | \usebibmacro{periodical}% 2904 | %\setunit*{\addspace}% 2905 | \setunit*{\adddot\addspace}%标点修改为句点 2906 | \iffieldundef{series} 2907 | {} 2908 | {\newunit 2909 | \printfield{series}% 2910 | \setunit{\addspace}}% 2911 | \usebibmacro{periodical+issue}%将issue调整到上面来,并修改 2912 | \iffieldundef{number}{}{%%进一步处理有范围的数字 2913 | \multinumberparser{\thefield{number}}}% 2914 | \iffieldundef{volume}% 2915 | {\printfield{year}% 2916 | \printtext{\mkbibparens{\multinumberfirst}}% 2917 | \bibrangedash% 2918 | \iffieldundef{endyear}{}{\printfield{endyear}\printtext{\mkbibparens{\multinumbersecond}}}% 2919 | }% 2920 | {\multivolparser{\thefield{volume}}% 2921 | \printfield{year}% 2922 | \setunit{\addcomma\space}%将冒号修改为逗号 2923 | \printtext{\multivolfirst}% 2924 | \printtext{\mkbibparens{\multinumberfirst}}% 2925 | \bibrangedash% 2926 | \iffieldundef{endyear}{}{% 2927 | \printfield{endyear}% 2928 | \setunit{\addcomma\space}%将冒号修改为逗号 2929 | \printtext{\multivolsecond}% 2930 | \printtext{\mkbibparens{\multinumbersecond}}}% 2931 | }% 2932 | \setunit{\addcomma\space}% 2933 | \printfield{eid}% 2934 | \setunit{\addspace}% 2935 | %\usebibmacro{issue+date}% 2936 | %\setunit{\addcolon\space}% 2937 | \usebibmacro{issue}% 2938 | \newunit} 2939 | 2940 | % 2941 | % 新增一个样式用于调整期刊年份的格式,只打印年份 2942 | % 2943 | \newbibmacro*{periodical+issue}{% 2944 | \printtext{%去掉了[parens] 2945 | \iffieldundef{issue} 2946 | {%\usebibmacro{date}%修改为下一句 2947 | }% 2948 | {\printfield{issue}% 2949 | \setunit*{\addspace}% 2950 | %\usebibmacro{date}%修改为下一句 2951 | }% 2952 | }% 2953 | %\newunit 2954 | } 2955 | 2956 | % 2957 | % 重设专利title的输出,将文献类型标识符输出出去 2958 | % 2959 | \newbibmacro*{patenttitle}{%原输出来自biblatex.def文件 2960 | \ifboolexpr{% 2961 | test{\iffieldundef{title}}% 2962 | and% 2963 | test{\iffieldundef{subtitle}}% 2964 | }% 2965 | {}% 2966 | {\printtext[title]{\bibtitlefont% 2967 | \printfield[titlecase]{title}% 2968 | \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题 2969 | {}{\setunit{\subtitlepunct}% 2970 | \printfield[titlecase]{subtitle}}% 2971 | \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格 2972 | {\setunit{\subtitlepunct}\printfield{titleaddon}}% 2973 | \setunit{\subtitlepunct}\printfield{number}%写专利号 2974 | \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}% 2975 | %\iffieldundef{booktitle}{\newunit}{}%当title是析出时,不要标点 2976 | %\newunit 2977 | }% 2978 | }% 2979 | } 2980 | 2981 | 2982 | 2983 | % 2984 | % 修改in:用于inbook、incollection、inproceedings等类型 2985 | % 2018.04.20,v1.0k,renewed marco,by hzz 2986 | % 20190212,v1.0q,增加中英文区分,by hzz 2987 | % 2988 | % 原理方法:使用bibmacro{in:}改变了以前在driver中直接输出//的方式,同时也简化了标点控制。 2989 | \renewbibmacro*{in:}{% 2990 | \iftoggle{bbx:gbpunctin}{\printtext{\texttt{//}\allowbreak}}%\addthinspace 2991 | {\setunit{\adddot\addspace}% 2992 | \iffieldequalstr{userd}{chinese}% 2993 | {\printtext{\bibstring{incn}}}% 2994 | {\printtext{\bibstring{in}}}% 2995 | }}%\newunit\newblock\intitlepunct 2996 | 2997 | % 2998 | % 修改type域的输出格式 2999 | % 2019.02.12,v1.0q,byhzz 3000 | % 使其可以区分中英文输出不同的格式,比如博士论文英文输出PHD thesis,中文则是博士学位论文 3001 | \DeclareFieldFormat{type}% 3002 | {\iffieldequalstr{userd}{chinese}% 3003 | {\ifbibxstring{#1cn}{\bibxstring{#1cn}}{#1}}% 3004 | {\ifbibstring{#1}{\bibstring{#1}}{#1}}% 3005 | } 3006 | 3007 | % 3008 | % 修改series域的输出格式 3009 | % 2019.05.01,v1.0r,byhzz 3010 | \renewbibmacro*{series+number}{% 3011 | \printfield{series}% 3012 | %\setunit*{\addspace}% 3013 | %\printfield{number}% 3014 | %\newunit 3015 | } 3016 | 3017 | %===================================================================== 3018 | %设置驱动格式 3019 | %===================================================================== 3020 | % 3021 | % book条目类的驱动 3022 | % 3023 | \DeclareBibliographyDriver{book}{%源来自standard.bbx文件 3024 | \usebibmacro{bibindex}% 3025 | \usebibmacro{begentry}% 3026 | \usebibmacro{author/editor+others/translator+others}% 3027 | \ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 3028 | \usebibmacro{maintitle+title}% 3029 | \iftoggle{bbx:gbstrict}{}{% 3030 | \newunit 3031 | \printlist{language}% 3032 | \newunit\newblock% 3033 | \usebibmacro{byauthor}% 3034 | \newunit\newblock}% 3035 | \usebibmacro{byeditor+others}% 3036 | \newunit 3037 | \printfield{edition}% 3038 | \newunit\newblock%% 3039 | \iftoggle{bbx:gbstrict}{}{% 3040 | \iffieldundef{maintitle}% 3041 | {\printfield{volume}% 3042 | \printfield{part}}% 3043 | {}% 3044 | \newunit% 3045 | \printfield{volumes}% 3046 | \newunit\newblock% 3047 | \usebibmacro{series+number}}% 3048 | \newunit\newblock% 3049 | %\printfield{note}% 3050 | %\newunit\newblock% 3051 | \usebibmacro{publisher+location+date}% 3052 | %\newunit\newblock %这里标点去掉 3053 | \usebibmacro{chapter+pages}% 3054 | \iffieldundef{url}{}{%当没有网址时也不输出 3055 | \usebibmacro{modifydate}}%带括号的修改或更新日期, 3056 | \usebibmacro{doi+eprint+url}%从下面移动到上面来,因为gbt2015的url需直接放在页码后面。 3057 | \newunit\newblock% 3058 | \printfield{pagetotal}% 3059 | \newunit\newblock% 3060 | \iftoggle{bbx:isbn} 3061 | {\printfield{isbn}} 3062 | {}% 3063 | \newunit\newblock 3064 | %\usebibmacro{doi+eprint+url}% 3065 | %\newunit\newblock 3066 | \usebibmacro{addendum+pubstate}% 3067 | \setunit{\bibpagerefpunct}\newblock 3068 | \usebibmacro{pageref}% 3069 | \newunit\newblock 3070 | \iftoggle{bbx:related} 3071 | {\usebibmacro{related:init}% 3072 | \usebibmacro{related}} 3073 | {}% 3074 | \usebibmacro{finentry}\usebibmacro{annotation}} 3075 | 3076 | 3077 | % 3078 | % 期刊文章,连续出版物中的析出文献的格式 3079 | % 3080 | \DeclareBibliographyDriver{article}{% 3081 | \usebibmacro{bibindex}% 3082 | \usebibmacro{begentry}% 3083 | \usebibmacro{author/translator+others}% 3084 | \ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 3085 | \usebibmacro{title}% 3086 | \iftoggle{bbx:gbstrict}{}{% 3087 | \newunit% 3088 | \printlist{language}% 3089 | \newunit\newblock 3090 | \usebibmacro{byauthor}% 3091 | \newunit\newblock 3092 | \usebibmacro{bytranslator+others}% 3093 | \newunit\newblock 3094 | \printfield{version}}% 3095 | \newunit\newblock 3096 | %\usebibmacro{in:}% 不使用in来表示期刊等连续出版物 3097 | \usebibmacro{journal+issuetitle}% 3098 | %\newunit 3099 | % \usebibmacro{byeditor+others}% 3100 | % \newunit 3101 | \usebibmacro{note+pages}% 3102 | \iffieldequalstr{note}{news}{}{%当是新闻时不输出修改或更新日期 3103 | \iffieldundef{url}{}{%当没有网址时也不输出 3104 | \usebibmacro{modifydate}}}%带括号的修改或更新日期, 3105 | \usebibmacro{doi+eprint+url}%从后面移上来,调整url和页码之间的位置 3106 | \newunit\newblock 3107 | \iftoggle{bbx:isbn} 3108 | {\printfield{issn}} 3109 | {}% 3110 | \newunit\newblock 3111 | %\usebibmacro{doi+eprint+url}% 3112 | %\newunit\newblock 3113 | \usebibmacro{addendum+pubstate}% 3114 | \setunit{\bibpagerefpunct}\newblock 3115 | \usebibmacro{pageref}% 3116 | \newunit\newblock 3117 | \iftoggle{bbx:related} 3118 | {\usebibmacro{related:init}% 3119 | \usebibmacro{related}} 3120 | {}% 3121 | \usebibmacro{finentry}\usebibmacro{annotation}} 3122 | 3123 | 3124 | 3125 | % 3126 | % 连续出版物的驱动 3127 | % 3128 | \DeclareBibliographyDriver{periodical}{%源来自standard.BBX 3129 | \usebibmacro{bibindex}% 3130 | \usebibmacro{begentry}% 3131 | \usebibmacro{editor}% 3132 | %\setunit{\labelnamepunct}\newblock 3133 | \newunit\newblock %删除上面一行,添加这一行 3134 | \usebibmacro{title+issuetitle}% 3135 | \newunit\newblock% 3136 | \usebibmacro{location+institution+date}%添加这一行用于输出地址,单位和时间 3137 | \newunit\newblock%添加这一行 3138 | \iftoggle{bbx:gbstrict}{}{% 3139 | \printlist{language}% 3140 | \newunit\newblock 3141 | \usebibmacro{byeditor}% 3142 | \newunit\newblock 3143 | \printfield{note}% 3144 | \newunit\newblock} 3145 | \iftoggle{bbx:isbn} 3146 | {\printfield{issn}} 3147 | {}% 3148 | \newunit\newblock 3149 | \usebibmacro{doi+eprint+url}% 3150 | \newunit\newblock 3151 | \usebibmacro{addendum+pubstate}% 3152 | \setunit{\bibpagerefpunct}\newblock 3153 | \usebibmacro{pageref}% 3154 | \newunit\newblock 3155 | \iftoggle{bbx:related} 3156 | {\usebibmacro{related:init}% 3157 | \usebibmacro{related}} 3158 | {}% 3159 | \usebibmacro{finentry}\usebibmacro{annotation}} 3160 | 3161 | % 3162 | % 专利文献驱动 3163 | % 3164 | \DeclareBibliographyDriver{patent}{%源来自standard.BBX 3165 | \usebibmacro{bibindex}% 3166 | \usebibmacro{begentry}% 3167 | \usebibmacro{author}% 3168 | \ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 3169 | %\usebibmacro{title}% 3170 | \usebibmacro{patenttitle}%给出专利专用的标题输出 3171 | \iftoggle{bbx:gbstrict}{}{% 3172 | \newunit% 3173 | \printlist{language}% 3174 | \newunit\newblock 3175 | \usebibmacro{byauthor}}% 3176 | \newunit\newblock 3177 | \printfield{type}% 3178 | \setunit*{\addspace}% 3179 | %\printfield{number}%已放到patenttitle中处理 3180 | \iflistundef{location} 3181 | {} 3182 | {\setunit*{\addspace}% 3183 | \printtext{%[parens] 3184 | \printlist[][-\value{listtotal}]{location}}}% 3185 | \newunit\newblock 3186 | \usebibmacro{byholder}% 3187 | \newunit\newblock 3188 | \printfield{note}% 3189 | \newunit\newblock 3190 | \usebibmacro{newsdate}% 3191 | %\newunit\newblock 3192 | \usebibmacro{doi+eprint+url}% 3193 | \newunit\newblock 3194 | \usebibmacro{addendum+pubstate}% 3195 | \setunit{\bibpagerefpunct}\newblock 3196 | \usebibmacro{pageref}% 3197 | \newunit\newblock 3198 | \iftoggle{bbx:related} 3199 | {\usebibmacro{related:init}% 3200 | \usebibmacro{related}} 3201 | {}% 3202 | \usebibmacro{finentry}\usebibmacro{annotation}} 3203 | 3204 | 3205 | % 3206 | % 在线文献驱动 3207 | % 3208 | \DeclareBibliographyDriver{online}{%源来自standard.BBX 3209 | \usebibmacro{bibindex}% 3210 | \usebibmacro{begentry}% 3211 | \usebibmacro{author/editor+others/translator+others}% 3212 | \ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 3213 | \usebibmacro{title}% 3214 | \iftoggle{bbx:gbstrict}{}{% 3215 | \newunit% 3216 | \printlist{language}% 3217 | \newunit\newblock 3218 | \usebibmacro{byauthor}% 3219 | \newunit\newblock 3220 | \usebibmacro{byeditor+others}% 3221 | \newunit\newblock 3222 | \printfield{note}}% 3223 | \newunit 3224 | \printfield{version}% 3225 | \newunit\newblock 3226 | %\printlist{organization}% 3227 | \printlist{institution}% 3228 | \newunit\newblock 3229 | \ifboolexpr{% 3230 | test{\iffieldundef{day}} and test{\iffieldundef{endday}} and test{\iffieldundef{eventday}}% 3231 | }{\usebibmacro{date}}% 3232 | {\usebibmacro{modifydate}}%修改或更新日期,为带括号的时间 3233 | \usebibmacro{url+urldate}%从下面移上来 3234 | \newunit\newblock 3235 | \iftoggle{bbx:eprint} 3236 | {\usebibmacro{eprint}} 3237 | {}% 3238 | \newunit\newblock 3239 | %\usebibmacro{url+urldate}% 3240 | %\newunit\newblock 3241 | \usebibmacro{addendum+pubstate}% 3242 | \setunit{\bibpagerefpunct}\newblock 3243 | \usebibmacro{pageref}% 3244 | \newunit\newblock 3245 | \iftoggle{bbx:related} 3246 | {\usebibmacro{related:init}% 3247 | \usebibmacro{related}} 3248 | {}% 3249 | \usebibmacro{finentry}\usebibmacro{annotation}} 3250 | 3251 | 3252 | % 3253 | % 报告类型驱动 3254 | % 当有网址无出版项时,用online输出 3255 | % 3256 | \DeclareBibliographyDriver{report}{% 3257 | \usebibmacro{bibindex}% 3258 | \usebibmacro{begentry}% 3259 | \usebibmacro{author}% 3260 | \ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 3261 | \usebibmacro{title}% 3262 | \iftoggle{bbx:gbstrict}{}{% 3263 | \newunit% 3264 | \printlist{language}% 3265 | \newunit\newblock 3266 | \usebibmacro{byauthor}}% 3267 | \newunit\newblock 3268 | \usebibmacro{byeditor+others}%增加的译者信息 3269 | \newunit\newblock 3270 | \printfield{type}% 3271 | \setunit*{\addspace}% 3272 | \printfield{number}% 3273 | \newunit\newblock 3274 | \printfield{version}% 3275 | \newunit 3276 | \printfield{note}% 3277 | \newunit\newblock 3278 | \usebibmacro{publisher+location+date}% 3279 | %\newunit\newblock 3280 | \usebibmacro{chapter+pages}% 3281 | \usebibmacro{doi+eprint+url}% 3282 | \newunit 3283 | \printfield{pagetotal}% 3284 | \newunit\newblock 3285 | \iftoggle{bbx:isbn} 3286 | {\printfield{isrn}} 3287 | {}% 3288 | \newunit\newblock 3289 | % \usebibmacro{doi+eprint+url}% 3290 | % \newunit\newblock 3291 | \usebibmacro{addendum+pubstate}% 3292 | \setunit{\bibpagerefpunct}\newblock 3293 | \usebibmacro{pageref}% 3294 | \newunit\newblock 3295 | \iftoggle{bbx:related} 3296 | {\usebibmacro{related:init}% 3297 | \usebibmacro{related}} 3298 | {}% 3299 | \usebibmacro{finentry}\usebibmacro{annotation}} 3300 | 3301 | % 3302 | % 论文、手册类型驱动 3303 | % 2016-11-11,增加了译者信息 3304 | % 3305 | \DeclareBibliographyDriver{manual}{% 3306 | \usebibmacro{bibindex}% 3307 | \usebibmacro{begentry}% 3308 | \usebibmacro{author}% 3309 | \ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 3310 | \usebibmacro{title}% 3311 | \iftoggle{bbx:gbstrict}{}{% 3312 | \newunit% 3313 | \printlist{language}% 3314 | \newunit\newblock 3315 | \usebibmacro{byauthor}}% 3316 | \newunit\newblock 3317 | \usebibmacro{byeditor+others}%增加的译者信息 3318 | \newunit\newblock 3319 | \iftoggle{bbx:gbfieldtype}{% 3320 | \printfield{type}% 3321 | \setunit*{\addspace}}{}% 3322 | \printfield{number}% 3323 | \newunit\newblock 3324 | \printfield{version}% 3325 | \newunit 3326 | \printfield{note}% 3327 | \newunit\newblock 3328 | \usebibmacro{institution+location+date}% 3329 | %\newunit\newblock 3330 | \usebibmacro{chapter+pages}% 3331 | \iffieldundef{url}{}{%当没有网址时也不输出修改或更新日期 3332 | \usebibmacro{modifydate}}%修改或更新日期为带括号的时间 3333 | \usebibmacro{doi+eprint+url}% 3334 | \newunit 3335 | \printfield{pagetotal}% 3336 | \newunit\newblock 3337 | \iftoggle{bbx:isbn} 3338 | {\printfield{isrn}} 3339 | {}% 3340 | \newunit\newblock 3341 | % \usebibmacro{doi+eprint+url}% 3342 | % \newunit\newblock 3343 | \usebibmacro{addendum+pubstate}% 3344 | \setunit{\bibpagerefpunct}\newblock 3345 | \usebibmacro{pageref}% 3346 | \newunit\newblock 3347 | \iftoggle{bbx:related} 3348 | {\usebibmacro{related:init}% 3349 | \usebibmacro{related}} 3350 | {}% 3351 | \usebibmacro{finentry}\usebibmacro{annotation}} 3352 | 3353 | % 3354 | % 备选类型驱动 3355 | % 3356 | % 利用biblatex的misc驱动 3357 | \DeclareBibliographyDriver{misc}{% 3358 | \usebibmacro{bibindex}% 3359 | \usebibmacro{begentry}% 3360 | \usebibmacro{author/editor+others/translator+others}% 3361 | \ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 3362 | \usebibmacro{title}% 3363 | \iftoggle{bbx:gbstrict}{}{% 3364 | \newunit 3365 | \printlist{language}% 3366 | \newunit\newblock 3367 | \usebibmacro{byauthor}% 3368 | \newunit\newblock 3369 | \usebibmacro{byeditor+others}}% 3370 | \newunit\newblock 3371 | \printfield{howpublished}% 3372 | \newunit\newblock 3373 | \printfield{type}% 3374 | \newunit 3375 | \printfield{version}% 3376 | \newunit 3377 | \printfield{note}% 3378 | \newunit\newblock 3379 | \usebibmacro{institution+location+date}% 3380 | %\usebibmacro{organization+location+date}% 3381 | %\newunit\newblock 3382 | \usebibmacro{doi+eprint+url}% 3383 | \newunit\newblock 3384 | \usebibmacro{addendum+pubstate}% 3385 | \setunit{\bibpagerefpunct}\newblock 3386 | \usebibmacro{pageref}% 3387 | \newunit\newblock 3388 | \iftoggle{bbx:related} 3389 | {\usebibmacro{related:init}% 3390 | \usebibmacro{related}} 3391 | {}% 3392 | \usebibmacro{finentry}\usebibmacro{annotation}} 3393 | 3394 | 3395 | % 3396 | % 专著中的析出文献的格式修改 3397 | % 3398 | \DeclareBibliographyDriver{inbook}{%源来自standard.bbx 3399 | \usebibmacro{bibindex}% 3400 | \usebibmacro{begentry}% 3401 | \usebibmacro{author/translator+others}% 3402 | \ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点 3403 | \usebibmacro{title}% 3404 | \usebibmacro{in:}% 3405 | %\printtext{\texttt{//}\addthinspace}% 3406 | \usebibmacro{bybookauthor}% 3407 | \ifnameundef{bookauthor}{% 3408 | \ifnameundef{editor}{}{\newunit}% 3409 | }{\newunit}%替换下一句 3410 | %\newunit\newblock 3411 | \iffieldundef{series}{}{\usebibmacro{series+number}\setunit{\addcolon\addspace}}%为处理一些存在series的情况而增加 3412 | \usebibmacro{maintitle+booktitle}% 3413 | \iffieldundef{volume}{}{\setunit{\addcolon\addspace}\printfield{volume}}% 3414 | \iffieldundef{number}{}{\setunit{\addcolon\addspace}\printfield{number}}%增加卷和册信息 3415 | \newunit\newblock% 3416 | % \usebibmacro{byeditor+others}% 3417 | % \newunit\newblock 3418 | \printfield{edition}% 3419 | \newunit 3420 | \iftoggle{bbx:gbstrict}{}{% 3421 | % \iffieldundef{maintitle} 3422 | % {\printfield{volume}% 3423 | % \printfield{part}} 3424 | % {}% 3425 | % \newunit 3426 | % \printfield{volumes}% 3427 | % \newunit\newblock 3428 | % \usebibmacro{series+number} 3429 | }% 3430 | \newunit\newblock 3431 | %\printfield{note}% 3432 | %\newunit\newblock 3433 | \usebibmacro{publisher+location+date}% 3434 | %\newunit\newblock 3435 | \usebibmacro{chapter+pages}% 3436 | %\newunit\newblock 3437 | \usebibmacro{doi+eprint+url}%移到上面来 3438 | \newunit\newblock 3439 | \iftoggle{bbx:isbn} 3440 | {\printfield{isbn}} 3441 | {}% 3442 | \newunit\newblock 3443 | % \usebibmacro{doi+eprint+url}% 3444 | % \newunit\newblock 3445 | \usebibmacro{addendum+pubstate}% 3446 | \setunit{\bibpagerefpunct}\newblock 3447 | \usebibmacro{pageref}% 3448 | \newunit\newblock 3449 | \iftoggle{bbx:related} 3450 | {\usebibmacro{related:init}% 3451 | \usebibmacro{related}} 3452 | {}% 3453 | \usebibmacro{finentry}\usebibmacro{annotation}} 3454 | -------------------------------------------------------------------------------- /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 | \def\versionofgbtstyle{2019/03/28 v1.0r} 11 | \ProvidesFile{gb7714-2015.cbx}[\versionofgbtstyle biblatex citation style] 12 | 13 | % 14 | % 加载标准样式 15 | % 16 | \RequireCitationStyle{numeric-comp} %numeric 17 | 18 | 19 | % 20 | % 选项设置 21 | % 22 | \ExecuteBibliographyOptions{ 23 | autocite = superscript , 24 | autopunct = true , 25 | %sorting = none , 26 | maxcitenames=1, 27 | mincitenames=1, 28 | } 29 | 30 | %textcite标注命令中的标点设置 31 | %\DeclareDelimFormat[textcite]{andothersdelim}{\addspace}% 32 | 33 | % 34 | % 定义一个上标方括号wrapper 35 | % 36 | \newcommand*\mkbibsuperbracket[1]{% 37 | \mkbibsuperscript{\mkbibbrackets{#1}}% 38 | } 39 | 40 | % 修改postnote的输出格式 41 | \DeclareFieldFormat{postnote}{#1} 42 | 43 | % 44 | % 重定义cite命令 45 | % 46 | % 方法:\DeclareCiteCommand{\cite}[\mkbibparens]{precode}{loopcode}{sepcode}{postcode} 47 | % v1.0p版后将cite的处理方式修改为类似pagescite,而不再使用biblatex的标准方式 48 | \DeclareCiteCommand{\cite}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号 49 | {[\usebibmacro{cite:init}% 50 | \usebibmacro{prenote}} 51 | {\usebibmacro{citeindex}% 52 | \usebibmacro{cite:comp}} 53 | {} 54 | {\usebibmacro{cite:dump}]% 55 | \printfield{postnote}} 56 | % v1.0p 以前用的方式 57 | %\DeclareCiteCommand{\cite}[\mkbibsuperbracket]%利用mkbibsuperbracket添加方括号 58 | % {\usebibmacro{cite:init}% 59 | % \usebibmacro{prenote}} 60 | % {\usebibmacro{citeindex}% 61 | % \usebibmacro{cite:comp}} 62 | % {} 63 | % {\usebibmacro{cite:dump}% 64 | % \usebibmacro{postnote}} 65 | 66 | % 67 | % 定义upcite命令 68 | % 20180604,v1.0l,hzz 69 | % 20190409,v1.0r,hzz 70 | % 方法:对supercite增加[] 71 | \newrobustcmd*{\upcite}{% 72 | \cite} 73 | 74 | % 75 | % 重定义parencite命令,以满足标签带页码的国标要求 76 | % 77 | \DeclareCiteCommand{\parencite}%[\mkbibbrackets] 78 | {[\usebibmacro{cite:init}%] 79 | \usebibmacro{prenote}}% 80 | {\usebibmacro{citeindex}% 81 | \usebibmacro{cite:comp}} 82 | {} 83 | {%[ 84 | \usebibmacro{cite:dump}]% 85 | \mkbibsuperscript{\printfield{postnote}}} 86 | 87 | % 88 | % 新定义pagescite命令,以满足标签带页码的国标要求 89 | % 90 | % 原理方法: 91 | % 1.新增页码输出宏 92 | \newbibmacro*{postpages}{% 93 | \iffieldundef{postnote} 94 | {\printfield[postnote]{pages}} 95 | {\printfield{postnote}}} 96 | % 2.新增\pagescite引用命令 97 | \DeclareCiteCommand{\pagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 98 | {[\usebibmacro{cite:init}%]直接添加方括号 99 | \usebibmacro{prenote}% 100 | } 101 | {\usebibmacro{citeindex}% 102 | \usebibmacro{cite:comp}} 103 | {} 104 | {\usebibmacro{cite:dump}]% 105 | \usebibmacro{postpages}} 106 | 107 | % 108 | % 定义yearpagescite,为与ay样式兼容,等同于\pagescite 109 | % 110 | \DeclareCiteCommand{\yearpagescite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 111 | {[\usebibmacro{cite:init}%]直接添加方括号 112 | \usebibmacro{prenote}% 113 | } 114 | {\usebibmacro{citeindex}% 115 | \usebibmacro{cite:comp}} 116 | {} 117 | {\usebibmacro{cite:dump}]% 118 | \usebibmacro{postpages}} 119 | 120 | % 121 | % 定义\yearcite命令,为与ay样式兼容,且提供不输出页码的标签格式, 122 | % 123 | % 原理方法:等同于\pagescite,但不要页码 124 | \DeclareCiteCommand{\yearcite}[\mkbibsuperscript]%\mkbibbrackets,仍然用上标 125 | {[\usebibmacro{cite:init}%]直接添加方括号 126 | \usebibmacro{prenote}% 127 | } 128 | {\usebibmacro{citeindex}% 129 | \usebibmacro{cite:comp}} 130 | {} 131 | {\usebibmacro{cite:dump}]} 132 | 133 | % 134 | % 定义\authornumcite命令,输出作者信息,然后在后面带上顺序编码 135 | % 20180427,v1.0k,增加,hzz 136 | % gb7714样式新定义的命令都把cite放到最后,比如前面的pagescite,yearcite,这里的\authornumcite 137 | % 区别于biblatex定义的命令都把cite放到前面,比如citeauthor等。 138 | %见numeric.CBX 139 | \newbibmacro*{cite}{% 140 | \printtext[bibhyperref]{% 141 | \printfield{labelprefix}% 142 | \printfield{labelnumber}% 143 | \ifbool{bbx:subentry} 144 | {\printfield{entrysetcount}} 145 | {}}} 146 | %见numeric.CBX,\DeclareCiteCommand{\cite}, 147 | \DeclareCiteCommand{\authornumcite}%[\mkbibsuperscript] 148 | {\usebibmacro{prenote}} 149 | {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace 150 | {\renewcommand*{\andothersdelim}{\addspace}}% 151 | \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}% 152 | \usebibmacro{cite}}}} 153 | {\multicitedelim} 154 | {\mkbibsuperscript{\printfield{postnote}}} 155 | 156 | 157 | % 158 | % 增加如下多个命令 159 | % 20190409,v1.0r,hzz 160 | % 方法:利用newcommand或newrobustcmd命令进行定义 161 | % 注意\citet和\citep命令之所以不用newrobustcmd,是为避免加载natbib模块后产生冲突 162 | \DeclareCiteCommand{\citet}% 163 | {\usebibmacro{prenote}} 164 | {\iffieldequalstr{userf}{cn}{\renewcommand*{\andothersdelim}{\addthinspace}}%\addthinspace 165 | {\renewcommand*{\andothersdelim}{\addspace}}% 166 | \printnames{labelname}\mkbibsuperscript{\mkbibbrackets{\usebibmacro{citeindex}% 167 | \usebibmacro{cite}}}} 168 | {\multicitedelim} 169 | {\mkbibsuperscript{\printfield{postnote}}} 170 | 171 | 172 | \DeclareCiteCommand{\citep}[\mkbibsuperscript]%利用mkbibsuperbracket添加方括号 173 | {[\usebibmacro{cite:init}% 174 | \usebibmacro{prenote}} 175 | {\usebibmacro{citeindex}% 176 | \usebibmacro{cite:comp}} 177 | {} 178 | {\usebibmacro{cite:dump}]% 179 | \printfield{postnote}} 180 | 181 | \newrobustcmd*{\citetns}% 182 | {\textcite} 183 | 184 | \newrobustcmd*{\citepns}% 185 | {\parencite} 186 | 187 | \newrobustcmd*{\inlinecite}% 188 | {\parencite} 189 | 190 | % 191 | % 增加如下复数的命令,以符合biblatex的复数命令习惯 192 | % 20190430,v1.0r,hzz 193 | % citec和citecs命令是实现了[1]-[3]这样的压缩形式。 194 | % authornumcites是常用命令authornumcite的复数形式 195 | \DeclareFieldFormat{labelbracket}{\mkbibbrackets{#1}} 196 | 197 | \newbibmacro*{citec:comp:comp}{% 198 | \ifboolexpr{ 199 | ( test {\iffieldundef{labelprefix}} and test {\ifundef\cbx@lastprefix} ) 200 | or 201 | test {\iffieldequals{labelprefix}{\cbx@lastprefix}} 202 | } 203 | {\ifnumequal{\thefield{labelnumber}}{\value{cbx@tempcntb}} 204 | {\savefield{entrykey}{\cbx@lastkey}% 205 | \savefield{labelnumber}{\cbx@lastnumber}% 206 | \addtocounter{cbx@tempcnta}{1}} 207 | {\ifnumequal{\thefield{labelnumber}}{\value{cbx@tempcntb}-1} 208 | {} 209 | {\usebibmacro{citec:dump}% 210 | \ifnumgreater{\value{cbx@tempcntb}}{-1} 211 | {\multicitedelim} 212 | {}% 213 | \printtext[bibhyperref]{% 214 | \printfield{labelprefix}% 215 | \printtext[labelbracket]{\printfield{labelnumber}}}}}} 216 | {\usebibmacro{cite:comp:end}}% 217 | \setcounter{cbx@tempcntb}{\thefield{labelnumber}}% 218 | \savefield{labelprefix}{\cbx@lastprefix}} 219 | 220 | \newbibmacro*{citec:comp}{% 221 | \addtocounter{cbx@tempcntb}{1}% 222 | \iffieldundef{shorthand} 223 | {\ifbool{bbx:subentry} 224 | {\iffieldundef{entrysetcount} 225 | {\usebibmacro{citec:comp:comp}} 226 | {\usebibmacro{cite:comp:inset}}} 227 | {\usebibmacro{citec:comp:comp}}} 228 | {\usebibmacro{cite:comp:shand}}} 229 | 230 | \newbibmacro*{citec:dump}{% 231 | \ifnumgreater{\value{cbx@tempcnta}}{0} 232 | {\ifnumgreater{\value{cbx@tempcnta}}{1} 233 | {\bibrangedash} 234 | {\multicitedelim}% 235 | \bibhyperref[\cbx@lastkey]{% 236 | \ifdef\cbx@lastprefix 237 | {\printtext[labelprefix]{\cbx@lastprefix}} 238 | {}% 239 | \printtext[labelbracket]{\cbx@lastnumber}}}%labelnumber 240 | {}% 241 | \setcounter{cbx@tempcnta}{0}% 242 | \global\undef\cbx@lastprefix} 243 | 244 | %\DeclareCiteCommand{\citec}[\mkbibsuperscript]%[\mkbibbrackets] 245 | % {\usebibmacro{cite:init}% 246 | % \usebibmacro{prenote}} 247 | % {\usebibmacro{citeindex}% 248 | % \usebibmacro{citec:comp}} 249 | % {} 250 | % {\usebibmacro{citec:dump}% 251 | % \usebibmacro{postnote}} 252 | 253 | %上面这个用于非压缩情况,这里考虑了压缩的情况 254 | \DeclareCiteCommand{\citec}[\mkbibsuperscript]% 255 | {\ifnumless{\value{multicitecount}}{2} 256 | {\usebibmacro{cite:init}% 257 | \usebibmacro{prenote}} 258 | {\iffieldundef{prenote} 259 | {\iffieldundef{postnote} 260 | {} 261 | {\usebibmacro{citec:dump}% 262 | \usebibmacro{cite:init}% 263 | \setunit{\multicitedelim}}} 264 | {\usebibmacro{citec:dump}% 265 | \usebibmacro{cite:init}% 266 | \setunit{\multicitedelim}% 267 | \usebibmacro{prenote}}}} 268 | {\usebibmacro{citeindex}% 269 | \usebibmacro{citec:comp}} 270 | {} 271 | {\ifboolexpr{ test {\ifnumequal{\value{multicitecount}}{\value{multicitetotal}}} 272 | or not test {\iffieldundef{postnote}}} 273 | {\usebibmacro{citec:dump}% 274 | \usebibmacro{postnote}} 275 | {}} 276 | 277 | \DeclareMultiCiteCommand{\citecs}[\mkbibsuperscript]{\citec}{} 278 | 279 | \DeclareMultiCiteCommand{\authornumcites}[]{\authornumcite}{\multicitedelim} 280 | -------------------------------------------------------------------------------- /logo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SXKDZ/tongjithesis/cce9160c3c62e9be6fe5daf6a9942c97832dc04e/logo.pdf -------------------------------------------------------------------------------- /main.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SXKDZ/tongjithesis/cce9160c3c62e9be6fe5daf6a9942c97832dc04e/main.pdf -------------------------------------------------------------------------------- /main.tex: -------------------------------------------------------------------------------- 1 | \documentclass[color]{tongjithesis} 2 | \addbibresource[location=local]{tongjithesis.bib} 3 | 4 | \usepackage{lipsum} 5 | \usepackage{duckuments} 6 | 7 | \school 8 | {软件学院} 9 | {School of Software Engineering} 10 | 11 | \major 12 | {软件工程} 13 | {Software Engineering} 14 | 15 | \thesistitle 16 | {这是一个长长长长长的标题} 17 | {这是一个长长长长长的副标题} 18 | {Long Long Long Long Long Long Title} 19 | {Long Long Long Long Long Long Long Subtitle} 20 | 21 | \thesisauthor{毛哥}{Ge MAO} 22 | 23 | \schoolnumber{80286} 24 | 25 | \keyword 26 | {吃,喝,拉,撒} 27 | {Eat, drink, xxx, yyy} 28 | 29 | \advisor{老师}{Professor} 30 | 31 | \thesisdate{2019}{6}{1} 32 | 33 | \begin{document} 34 | 35 | \maketitle 36 | 37 | \begin{cabstract} 38 | 手认演带雄!不会所心我一资族方过三习长令人还;健生意看不都一带。像另以际要,留最游用少成、状形不当投办专际士代欢除药国看题不车那然产易河。条计全天,着至是美不自康许知。多能实修弟些她对们看不跟天愿自方以色手到是分有司代被养下天风委时就体间够及慢说己,家大也多没被黑……也间身自关放小节同皮深大回是有……再量上总台把雄到天部种要期把是,多空色,你长望我行没心发。我又中算由其得是一到来环人大?界视车线电,当上处认他经可后么样议定市一知服城不会良土表新候自想不绝变结黑人本太时,维连此主当自下品务过决;名上的。系反怀花不灵,关念儿关。力例小里方两然的难给能加合色另冷我的团是来爸法?的条别然所日怕了影近意,生言有我感际英面,别一他草;社团时任光地?住情半电地里看画朋我我室剧。乐不外好头没然万子农片创,作用么约,她人这说行拉乐一一往,利界优下不,微可战、学解好间:纪一着没印充国要半以时的止次起也条山人利毒会把足。 39 | \end{cabstract} 40 | 41 | \begin{eabstract} 42 | \lipsum[3-4] 43 | \end{eabstract} 44 | 45 | % toc 46 | \toc 47 | 48 | % main contents 49 | \mainmatter 50 | 51 | \chapter{引~言} 52 | \section{背景介绍} 53 | 财伤争多水楼说地过湾目的这 54 | 原春影情指,的明说类湾,全希保入长,去生得品好书道然去风及。 55 | 56 | 天湾军前下自不成何有了府员?提如里牛望可现美一这个了许,导共底真在领台子度然长,选是道度示在;的手先人响团是。再行是,电笔银是人充;人童上为!离念些时人期务力,也的在!办笑包?人么作在不:见也共满中,一源不?社向国么,木动为行不火陆不……打轻一印开外字……美失水,司戏力度人压起公这面。 57 | 58 | \emph{老无行选环家之具长},\textbf{两双处高策大头的……}全商做国传北学系题行场;或务怎望海答原?调甚小时当题而专解品早只才里不相小己定安、又样中同,对房晚力听年处假十作安进小过,子老来人地:果生正它很动士、人又该河省情计任生程她严难资系有自。 59 | 60 | \begin{equation} 61 | S = \sum_{a,b=1}^{n} \frac{\sqrt{a^2 + b^2}}{a + b} 62 | \end{equation} 63 | 64 | \begin{table} 65 | \centering 66 | \caption{表格} 67 | \begin{tabular}{ccccccc} 68 | \toprule 69 | \multirow{2}[0]{*}{ABC} & \multicolumn{2}{c}{甲} & \multicolumn{2}{c}{乙} & \multicolumn{2}{c}{丙} \\ 70 | \cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7} 71 | & A & B & A & B & A & B \\ \midrule 72 | 1 & xx.yy & xx.yy & xx.yy & xx.yy & xx.yy & xx.yy \\ 73 | 2 & xx.yy & xx.yy & xx.yy & xx.yy & xx.yy & xx.yy \\ 74 | 3 & xx.yy & xx.yy & xx.yy & xx.yy & xx.yy & xx.yy \\ 75 | 4 & xx.yy & xx.yy & xx.yy & xx.yy & xx.yy & xx.yy \\ 76 | 5 & xx.yy & xx.yy & -- & -- & xx.yy & xx.yy \\ 77 | 6 & xx.yy & xx.yy & xx.yy & xx.yy & xx.yy & xx.yy \\ 78 | 7 & xx.yy & xx.yy & xx.yy & xx.yy & xx.yy & xx.yy \\ 79 | 8 & xx.yy & xx.yy & xx.yy & xx.yy & xx.yy & xx.yy \\ 80 | 9 & {\bf xx.yy} & {\bf xx.yy} & {\bf xx.yy} & {\bf xx.yy} & {\bf xx.yy} & {\bf xx.yy} \\ 81 | \bottomrule 82 | \end{tabular} 83 | \label{tab:table1} 84 | \end{table} 85 | 86 | \subsection{人天力失众难轻可如中了部马} 87 | 好济发可去名、三就布?种快股便消他因子道家子,食足重容尽面与调益与赛效日底女言我年始甚公广为更先?线海起实单发完是我的性气风地总以:了台个无。倒样花会心开日:们众表中员生中医戏花实我然单!做来在那活、木心的温度住!乐么女:快名我别权价好那保出? 88 | 89 | 去孩远的官后显到,国海皮集我先。我的名企实人知不。 90 | 91 | 里取西!爱这马头企容长湾这解治乎!一我时得之比术投使应演天检花晚,华强当主甚会有断信我儿以手无比的华?致前它放生东成放。心上黑够利!现省条天?应计又一成客想无两,安日地化供高会视,地统的再中语义的前的?你关落得下的因我旅给员尔际;最神此教股话,信往续,以年面异:转感陆源觉规营如美反?明是产族不战家欢表我红年怎外可心妈:千是世。现已众果儿界,成灯上,知半放,议光事加们力新必有天体送奖前光都历有是什十信调例我,初在致清台湾事安小位外考命了力统了海当是美边可子回感家直金,有高的会字东停保感定!利度有先件三形收取天个她飞夫件小天变保像史声交交多春性开来更人工型于标,车实的等千在水、是在依展林,代初健人着,你几要一指低眼会,定日价……战我专法族能时地人!后有们,上也送力竟组?黄打各利商化连般朋师越要解成神地力商学引饭信德子利光经减统楼一包爸确图导初车医双,细河案此去土才母,全天现如二未以给命资活富一自国当道位吃心自,洲你总会持时?去美照一爱半,此大度它去以爱她老了我红境行分必。 92 | 93 | 式然来北以多?不当特本子完儿公一地速下线坡上亲书是结听企度模看现广来选从石道务经,推险别台车次歌间型朋人以们信气那比微西子:大张亚时有式型定国又打写的民八!里民有为的总爸近经;我体多吸常必从理情第不可过孩一事制人无么庭可年样!是人朋统深大白,首友候式?只改到行!公通一微天种料花来么排我学也大们运新便天当;没面年是因么清的合当? 94 | 95 | 客也像坐一明就总,理治想子:么坡我世客岸他金个的在治特惊我细,觉然答部。城妈品面方。这衣同望险用进怀是书口非草;之身为然完湾相响湾亲来同,治人位。是四己受出阿旅坐小首何时通球未后起天星音这增的入市够参制个值中小。亲自百工景感定戏计山了?\(xx\)起儿起能\(\sqrt{x}^\frac{1}{2}\)全显吗方,基毒老神学都展高业起太家业?使不和?线我值厂园国朋起增出医生看留而马原两个变备一新有马至时在供动紧儿看找关活,快传水医一长为着而有去以门物河会险对乡全节差专时音下呢从子别打各个又奖适,四童美不名连天业长一式被与设马,在票机生……行有得年公不开不实一上果人、企从了失生好在了创,心不野服父取一健备生现里要级影落用都差民人班境门得将,剧能大字些朋等识是化上院自河当果林方化有经虽大合,里们西?时趣不大之通馆在人车给务支热不办成尽厂面发再回,上阳离来口方权送记刻大土,学来新到厂着西!造及开两政况说报车跑反种性望式来果的台? 96 | 97 | \begin{algorithm} 98 | \caption{算法} 99 | \label{algo:algo1} 100 | \KwIn{输入\((xx,yy,zz)\)} 101 | \KwOut{输入\((1\odot1,2\times2,3zz)\)} 102 | 103 | 绝式在配应配道据有西渐样型配\; 104 | 重层不化望的友孩在实格生\; 105 | 106 | \tcc{罗交我毒如来联的间书图谈结准人} 107 | 系断纪信由市着非重政或\; 108 | 得路地理程家化影发算国在\; 109 | 灯日英头息种己施假公场单\; 110 | 出期这亲场正神星法非是上\; 111 | 罗交我毒如来联的间书图\; 112 | 113 | \Repeat{不投发政怀取用家树他庭题开经专来} { 114 | \For{内小教获一的觉育再不务天子国元亲数\(i\)} { 115 | 野脚书数么时读是国量推牛者\; 116 | } 117 | } 118 | 119 | \Return{育也朋宝一年则选外} 120 | \end{algorithm} 121 | 122 | \begin{proposition} 123 | \label{prop1} 124 | 市下急心。为人座在来严里从失进种弟地真后而时她听商你风油慢,清来化的高义养市清里?李没得青活利因空影生望不上中小能须自西后的必他妈记的大实上,操装时合所市起打营问台走善跟电的战!趣争声节打们技加会有了经事,阿用影包称节能而另虽色术,族只论给室育汽……必的手阳里其官自是白难过……的回大推选选讲不修所,死其可言的年身的其质喜星有及职纸有所都注论……告众和交阿比放大不了过……我紧面后实孩行以境生是家起动业得个纸儿。 125 | \end{proposition} 126 | 127 | \begin{proof} 128 | 外成不持叶诉观子间能个不倒她他,他原我在,究安马友环金动是是加保见水楼市今低失工的,总笑值都出;下要不示山校马,或天年统么全小只在台精收!减么等西力出,令官布在打你立证黑主;大应力东部气起精的里计有这有我木命器? 129 | 130 | 丽讲前机,没境钱之空?有如报全开与起是,用两力生四工,外定一易运了定光人县的员;画时面相风大健优众清​​看会小克……报的门……心年有地所整类苦学而供起爸南成于好,屋由年能企人、的上学文。称旅体不员根因车也先自然? 131 | 132 | 进叶我形,福天难。斯物师;行见解电务,什错面的一县者,有简相!的山机朋笔久有写灵反良不买的来角意! 133 | 134 | 135 | \end{proof} 136 | 137 | \begin{figure} 138 | \centering 139 | \includegraphics[width=.5\textwidth]{example-image-duck} 140 | \caption{图片} 141 | \label{fig:figure1} 142 | \end{figure} 143 | 144 | \begin{figure} 145 | \centering 146 | \includegraphics[width=.75\textwidth]{example-image-duck} 147 | \caption{又一张图片} 148 | \label{fig:figure2} 149 | \end{figure} 150 | 151 | \begin{mdframed}[style=codebox] 152 | \begin{cppcode} 153 | #include 154 | using namespace std; 155 | int main(void) { 156 | int a, b; // declare two integers 157 | scanf("%d %d", &a, &b); 158 | printf("%d\n", a + b); // print the sum 159 | return 0; 160 | } 161 | \end{cppcode} 162 | \end{mdframed} 163 | \begin{listing}[H] %DO NOT put code into listing env, it will cause cross-page failure 164 | \caption{A+B问题经典算法} 165 | \label{code:sample} 166 | \end{listing} 167 | 168 | \begin{longtable}{l|p{8cm}} 169 | \caption {一个长表格}\label{Tab:1}\\ 170 | \toprule 171 | \textbf{北成口看会} & \textbf{不素定者言}\\\midrule 172 | \endfirsthead 173 | \captionsetup{style=continued} 174 | \caption[]{}\\ 175 | \midrule 176 | {\bf 文件(夹)} & {\bf 功能描述}\\\midrule 177 | \endhead 178 | \endfoot 179 | \endlastfoot 180 | 政为计 & 复越是难人表时 \\ 181 | 多为哥期 & 爸度的参的正感 \\ 182 | 发料 & 此物木质消一财加出这 \\ 183 | 丽讲前机没境钱之空 & 有如报全开与起是 \\ 184 | 用两力生四工 & 外定一易运了定光人县的员 \\ 185 | 画时面相风大健 & 优众清​​看会小克……报的门…… \\ 186 | \midrule 187 | 心年有地所整类苦学 & 而供起爸南成于好,屋由年能企人、的上学文。称旅体不员根因车也先自然?\\ 188 | 歌我一来每怕学总长看不的行 & 家他的安是种中我心我片直飞金 \\ 189 | 作断时率农衣定基成先样设灯情空 & 说门值发士大令投会政山他 \\ 190 | \midrule 191 | 感生民作叫资师成 & 得急导的在怕大可赛、的地果字何代样黑月,走里消。步事够院新慢积人包年产时念看情光,林了请,他觉期度务升?西民这像新怎不:例后创精各游绝:确地开自条举世平者市选从生她?在们好他住景确间母然制?人新与。山师本更指、越平那量求发和年就王爸能食,计兴来时有冷路天的试际天适,英的类关格当于的趣河最可起有面色他近学天要有?和委们一中能的孩。还和力再长相上显,为方两高:处国斯,苦细家,字的应!分山夫都!名方查美可,尽黄一苦大妈他爸声看收小要够的自界平下政之动叫总好希最大机客线:名景险预看被身,很里前月又动当… …影地了选程集有有子斯每未,体民别不地安更微才地各,策位花到成性;不自如西那,同着发规星,先者心头活告势直纪台化几绝黄众果方等?此拉天职人我乐纸小,上有亮病赛身有良的外听友一样业,定次品在制众少放妈法生师市有也同终达方在员亲热登事,的请古关定春情大,一亲主反它反社笑伤界科去化真动才语望?\\ 192 | 如感百是候,一心台两件。 & 他看因,度观及那用力,以因会能一国高难面古通般论里妈不同成。提不的国人生,完形车如,都后小了了奖影动果过共步一代念于不,证人代鱼后所下广少于石应家化就加一了,己接只,像长完是接儿长、业连。\\ 193 | 意兰来师水切列电!& 是科到火路种道树地类外政的那声我相天弟同美人书史得做着满热雨着间取,市度事可最,形么子总他金小黄续难美接益人然有国断你但给提天线可一入时同初县样许来直观想出它向举眼军它已风二,有导女定?\\ 194 | \midrule 195 | 的的使士院,如动情品状,布友来!& 议出人动气白知晚高人一?个亲地然回。\\ 196 | 看一们破? & 布大山兴成亚个品人打家一世从长起言足业年费推单主王良是,的鱼饭天年发。为易费中民评不以,原风的下功我这影富在种脑制使亮得构爱有市么到生去?\\ 197 | 病接县星未进多包不家 \cite{jam91} \citet{jam91} & 选管院人……风交色观世妈,传出真战杂合族轮为家特当日星差内女的知知交人画如几共的地健类去;们们定民统年件度任不当保年们花的习理身,受阳多人目生于绿。果吃知虽湾:现方管数,精性不学那血,科过一过国,来专心特别又认洲为海,代童高车动第本。目日第谢!假老乐国只作下现技,上来年管决讲员文地才备。如结呢何在公公。如艺唱、上个论他式文轻起很一杂赛候却衣太方,人前血量太作都国区资子他;场车业得。\\ 198 | \bottomrule 199 | \end{longtable} 200 | 201 | \clearpage 202 | { 203 | \hyphenpenalty=1000 %断词阈值,值越大越不容易出现断词 204 | \tolerance=500 %丑度,10000为最大无溢出盒子 205 | \hbadness=100 %如果丑度超过hbadness这一阀值,那么就会发出警告 206 | \printbibliography[heading=bibintoc,title=参考文献] 207 | } 208 | 209 | \clearpage 210 | \addcontentsline{toc}{chapter}{本科就读期间取得的学术成果} 211 | \chapter*{本科就读期间取得的学术成果} 212 | \begin{enumerate} 213 | \item 1 214 | \item 2 215 | \item 3 216 | \item 4 217 | \end{enumerate} 218 | 219 | \clearpage 220 | \addcontentsline{toc}{chapter}{致~谢} 221 | \chapter*{致~谢} 222 | 223 | 我衷心感谢\textsc{TongjiThesis}对我的论文的帮助,帮助我节约了不少时间。非常感谢! 224 | 225 | \begin{enumerate} 226 | \item 股女济增型馆发程情少我,初答积老西,去时们不要,小的而自回念因的政根我节本史。 227 | \item 以里生星故神始广意金施头、儿于洋小,方根心起热外一轮了以定只有到本治:像士己不无回念年洲,心格打导解美,国一西的己一场? 228 | \item 一管牛里向的,一到的这出脑竟送。 229 | \item 如感百是候,一心台两件。 230 | \item 他看因,度观及那用力,以因会能一国高难面古通般论里妈不同成。提不的国人生,完形车如,都后小了了奖影动果过共步一代念于不,证人代鱼后所下广少于石应家化就加一了,己接只,像长完是接。 231 | \end{enumerate} 232 | 233 | 又有一个列表: 234 | \begin{itemize} 235 | \item 笔解会这,致小的人区智下古岸习子几的爱助家重件者然是人成里国路人艺与游及不情质你且孩落夜我的轻每今色音故愿作…… 236 | \item 感生民作叫资师成?无包部热非……源士不说屋:投得来人天早参再。 237 | \item 得急导的在怕大可赛、的地果字何代样黑月,走里消。步事够院新慢积人包年产时念看情光,林了请,他觉期度务升? 238 | \item 西民这像新怎不:例后创精各游绝:确地开自条举世平者市选从生她?在们好他住景确间母然制?人新与。 239 | \item 山师本更指、越平那量求发和年就王爸能食。 240 | \end{itemize} 241 | 242 | \end{document} 243 | -------------------------------------------------------------------------------- /tongjithesis.bib: -------------------------------------------------------------------------------- 1 | @article{jon88, 2 | author = {Jones}, 3 | title = {Title}, 4 | journal = {Journal}, 5 | year = {1988}, 6 | } 7 | 8 | @article{jon89, 9 | author = {Jones and Baker}, 10 | title = {Title}, 11 | journal = {Journal}, 12 | year = {1989}, 13 | } 14 | 15 | @article{jon90, 16 | author = {Jones and Baker and Williams}, 17 | title = {Title}, 18 | journal = {Journal}, 19 | year = {1990}, 20 | } 21 | 22 | @article{lzp1, 23 | author = {李泽平}, 24 | key = {li3 ze2 ping2}, 25 | title = {题名}, 26 | journal = {期刊}, 27 | year = {2016}, 28 | } 29 | 30 | @article{lzp2, 31 | author = {李泽平 and 泽平李}, 32 | key = {li3 ze2 ping2 ze2 ping2 li3}, 33 | title = {题名}, 34 | journal = {期刊}, 35 | year = {2016}, 36 | } 37 | 38 | @article{lzp3, 39 | author = {李泽平 and 泽平李 and 平泽李}, 40 | key = {li3 ze2 ping2 ze2 ping2 li3 ping2 ze2 li3}, 41 | title = {题名}, 42 | journal = {期刊}, 43 | year = {2016}, 44 | } 45 | 46 | @article{jam91, 47 | author = {James and Baker and Williams}, 48 | title = {Title}, 49 | journal = {Journal}, 50 | year = {1991}, 51 | } 52 | 53 | @article{jon91, 54 | author = {Jones and Baker and Williams}, 55 | title = {Title}, 56 | journal = {Journal}, 57 | year = {1991}, 58 | } 59 | 60 | @article{jon92, 61 | author = {Jones and Baker and Williams}, 62 | title = {Title}, 63 | journal = {Journal}, 64 | year = {1992}, 65 | } 66 | 67 | @article{jon92b, 68 | author = {Jones and Baker and Williams}, 69 | title = {Title}, 70 | journal = {Journal}, 71 | year = {1992}, 72 | } 73 | 74 | @article{jam91, 75 | author = {James and Baker and Williams}, 76 | title = {Title}, 77 | journal = {Journal}, 78 | year = {1991}, 79 | } 80 | 81 | @article{jon91, 82 | author = {Jones and Baker and Williams}, 83 | title = {Title}, 84 | journal = {Journal}, 85 | year = {1991}, 86 | } 87 | 88 | @article{jon92, 89 | author = {Jones and Baker and Williams}, 90 | title = {Title}, 91 | journal = {Journal}, 92 | year = {1992}, 93 | } 94 | 95 | @article{jon92b, 96 | author = {Jones and Baker and Williams}, 97 | title = {Title}, 98 | journal = {Journal}, 99 | year = {1992}, 100 | } 101 | -------------------------------------------------------------------------------- /tongjithesis.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e}[2007/10/19] 2 | \ProvidesClass{tongjithesis}[2019/05/17 v0.2.5 The LaTeX template for bachelor thesis of Tongji University] 3 | \typeout{Document Class `tongjithesis' v0.2.5 by SXKDZ (2019/05)} 4 | 5 | %%% class options %%% 6 | \newif\iftongji@color\tongji@colorfalse 7 | \newif\iftongji@debug\tongji@debugfalse 8 | \newif\iftongji@compressed\tongji@compressedfalse 9 | \newif\iftongji@notimes\tongji@notimesfalse 10 | \DeclareOption{color}{\tongji@colortrue} 11 | \DeclareOption{debug}{\tongji@debugtrue} 12 | \DeclareOption{notimes}{\tongji@notimestrue} 13 | \DeclareOption{compressed}{\tongji@compressedtrue} 14 | \DeclareOption*{\PassOptionsToClass{\CurrentOption}{ctexbook}} 15 | \ProcessOptions\relax 16 | 17 | \LoadClass[zihao=5,a4paper,oneside]{ctexbook} 18 | 19 | % compress space between punctuations by `punct=banjiao` 20 | \iftongji@compressed 21 | \ctexset{ 22 | punct=banjiao 23 | } 24 | \fi 25 | 26 | %%% global packages %%% 27 | \RequirePackage{ifthen} 28 | 29 | %%% Chinese support %%% 30 | \RequirePackage{xeCJK} 31 | 32 | % support circled numbers and special characters 33 | \xeCJKsetcharclass{`①}{`⑩}{1} 34 | \XeTeXcharclass`┊=1 35 | 36 | %%% space setting %%% 37 | \RequirePackage{setspace} 38 | 39 | %%% page geometry %%% 40 | \RequirePackage[top=24mm,bottom=20mm,left=35mm,right=20mm,includefoot]{geometry} 41 | 42 | %%% font specification %%% 43 | \setCJKmainfont[BoldFont=FZHei-B01S, ItalicFont=FZKai-Z03S,Mapping=fullwidth-stop]{FZShuSong-Z01S} 44 | \setCJKmonofont[Mapping=fullwidth-stop]{FZKai-Z03S} 45 | 46 | \setCJKfamilyfont{kai}[Mapping=fullwidth-stop]{FZKai-Z03S} 47 | \setCJKfamilyfont{hei}[Mapping=fullwidth-stop]{FZHei-B01S} 48 | \setCJKfamilyfont{cuhei}[Mapping=fullwidth-stop]{FZDaHei-B02S} 49 | \setCJKfamilyfont{songhei}[Mapping=fullwidth-stop]{FZSongHei-B07S} 50 | 51 | \newcommand{\kaiti}{\CJKfamily{kai}} 52 | \renewcommand{\heiti}{\CJKfamily{hei}} 53 | \newcommand{\cuheiti}{\CJKfamily{cuhei}} 54 | \newcommand{\songheiti}{\CJKfamily{songhei}} 55 | 56 | %%% hyperref and url %%% 57 | \RequirePackage[xetex,unicode]{hyperref} 58 | \iftongji@color 59 | \hypersetup{colorlinks} 60 | \else 61 | \hypersetup{hidelinks} 62 | \fi 63 | \hypersetup{ 64 | bookmarksnumbered, 65 | bookmarksopen, 66 | pdfdisplaydoctitle, 67 | pdfsubject=同济大学毕业设计(论文), 68 | pdfcreator=TongjiThesis by SXKDZ, 69 | } 70 | 71 | \RequirePackage{etoolbox} 72 | \AtBeginDocument{ 73 | \hypersetup{ 74 | pdftitle=\tongji@thesistitle, 75 | pdfauthor=\tongji@thesisauthor, 76 | pdfkeywords=\tongji@keyword, 77 | } 78 | } 79 | 80 | \PassOptionsToPackage{hyphens}{url} 81 | \def\UrlFont{\ttfamily} 82 | 83 | %%% math symbols %%% 84 | \RequirePackage{amsmath,amssymb,amsfonts,mathrsfs,bm} 85 | \RequirePackage[amsmath,thmmarks,hyperref]{ntheorem} 86 | \RequirePackage{lmodern} 87 | 88 | \DeclareMathOperator*{\argmin}{argmin} 89 | \DeclareMathOperator*{\argmax}{argmax} 90 | 91 | \RequirePackage{accents} 92 | % left arrow over text 93 | \DeclareRobustCommand{\cev}[1]{% 94 | \mathpalette\do@cev{#1}% 95 | } 96 | \newcommand{\do@cev}[2]{% 97 | \fix@cev{#1}{+}% 98 | \reflectbox{$\m@th#1\vec{\reflectbox{$\fix@cev{#1}{-}\m@th#1#2\fix@cev{#1}{+}$}}$}% 99 | \fix@cev{#1}{-}% 100 | } 101 | \newcommand{\fix@cev}[2]{% 102 | \ifx#1\displaystyle 103 | \mkern#23mu 104 | \else 105 | \ifx#1\textstyle 106 | \mkern#23mu 107 | \else 108 | \ifx#1\scriptstyle 109 | \mkern#22mu 110 | \else 111 | \mkern#22mu 112 | \fi 113 | \fi 114 | \fi 115 | } 116 | 117 | % change global font to Times New Roman 118 | \RequirePackage{fontspec} 119 | \ifthenelse{\NOT \boolean{tongji@notimes}}{\setmainfont{Times New Roman}}{} 120 | 121 | % change equation numbering with Chinese parenthesis 122 | \def\tagform@#1{\maketag@@@{(\ignorespaces#1\unskip\@@italiccorr)}} 123 | 124 | %%% theorem %%% 125 | \theoremsymbol{\ensuremath{\square}} 126 | \theoremheaderfont{\itshape} 127 | \theoremseparator{:} 128 | \newtheorem*{proof}{证明} 129 | \theoremheaderfont{\normalfont\bfseries} 130 | \theoremstyle{plain} 131 | \theoremsymbol{} 132 | \theoremseparator{:} 133 | \newtheorem{assumption}{假设}[chapter] 134 | \newtheorem{definition}{定义}[chapter] 135 | \newtheorem{proposition}{命题}[chapter] 136 | \newtheorem{lemma}{引理}[chapter] 137 | \newtheorem{theorem}{定理}[chapter] 138 | \newtheorem{axiom}{公理}[chapter] 139 | \newtheorem{corollary}{推论}[chapter] 140 | \newtheorem{exercise}{练习}[chapter] 141 | \newtheorem{example}{例}[chapter] 142 | \newtheorem{remark}{注释}[chapter] 143 | \newtheorem{problem}{问题}[chapter] 144 | \newtheorem{conjecture}{猜想}[chapter] 145 | 146 | %%% bibliographies %%% 147 | \RequirePackage[backend=biber,style=gb7714-2015,gbpub=false]{biblatex} 148 | \renewcommand{\citet}[1]{\textcite{#1}} 149 | 150 | %%% glutter %%% 151 | \RequirePackage{fancybox} 152 | \fancyput(-0.75cm,-13cm){\parbox{1em}{┊┊┊┊┊┊┊┊┊┊┊┊┊装┊┊┊┊┊订┊┊┊┊┊线┊┊┊┊┊┊┊┊┊┊┊┊┊}} 153 | 154 | %%% header and footer %%% 155 | \RequirePackage{fancyhdr,lastpage} 156 | 157 | \setlength{\headheight}{40pt} 158 | \setlength{\footskip}{20pt} 159 | 160 | \pagestyle{fancyplain} 161 | \fancyhf{} % clear all header and footer fields 162 | \lhead{\quad\includegraphics[width=4.5cm]{logo.pdf}} 163 | \rhead{\raisebox{2.5ex}{\zihao{4}{毕业设计(论文)}}} 164 | \renewcommand{\headrulewidth}{0.75pt} 165 | 166 | \cfoot{\zihao{-4}\thepage} 167 | \renewcommand{\footrulewidth}{0pt} 168 | 169 | \def\headrule{{ 170 | \hrule\@height\headrulewidth\@width\headwidth 171 | \vskip 2pt % 2pt between lines 172 | \hrule\@height\headrulewidth\@width\headwidth % another lower line 173 | \vskip-\headrulewidth 174 | \vskip-1.5pt 175 | }} 176 | 177 | \def\footrule{{ 178 | \vskip\footruleskip\vskip\footrulewidth 179 | \hrule\@width\headwidth\@height\footrulewidth 180 | }} 181 | 182 | % modify mainmatter with another footer style 183 | \let\oldmainmatter\mainmatter 184 | \renewcommand{\mainmatter}[0]{% 185 | \oldmainmatter 186 | \cfoot{}\rfoot{\zihao{-4}{共~~\pageref{LastPage}~~页~~~第~~\thepage~~页\quad{}}} 187 | \renewcommand{\footrulewidth}{0.75pt} 188 | } 189 | 190 | %%% cross reference %%% 191 | \newcommand*{\tabref}[1]{\tablename~\ref{#1}} 192 | \newcommand*{\figref}[1]{\figurename~\ref{#1}} 193 | \newcommand*{\algoref}[1]{算法~\ref{#1}} 194 | \newcommand*{\listingref}[1]{\lstlistingname~\ref{#1}} 195 | \renewcommand*{\eqref}[1]{公式(\ref{#1})} 196 | \newcommand*{\secref}[1]{第~\ref{#1}~节} 197 | \newcommand*{\chapref}[1]{第~\ref{#1}~章} 198 | 199 | %%% tables %%% 200 | \RequirePackage{booktabs,multirow,longtable,diagbox} 201 | 202 | % redefining table/tabular/tabularx/longtable environments with texts of \zihao{-5} 203 | \renewcommand{\arraystretch}{1.2} 204 | 205 | \AtBeginEnvironment{table}{\zihao{-5}} 206 | \AtBeginEnvironment{tabular}{\zihao{-5}} 207 | \AtBeginEnvironment{tabularx}{\zihao{-5}} 208 | \AtBeginEnvironment{longtable}{\zihao{-5}} 209 | 210 | %%% captions %%% 211 | \RequirePackage[skip=3pt,width=.8\textwidth,font=small,labelsep=space]{caption} 212 | 213 | \RequirePackage{subcaption} 214 | \DeclareCaptionLabelFormat{quanjiaoparens}{({#2})} 215 | \captionsetup[sub]{font=small,labelformat=quanjiaoparens} 216 | 217 | % continued captions for longtables 218 | \DeclareCaptionLabelFormat{continuedlabel}{续#1#2} 219 | \DeclareCaptionStyle{continued}[justification=raggedleft]{skip=3pt,width=.75\textwidth,font=small,labelformat=continuedlabel} 220 | 221 | %%% figures %%% 222 | \RequirePackage{graphicx,float} 223 | 224 | %%% title formatting %%% 225 | \setcounter{secnumdepth}{5} 226 | 227 | \ctexset{ 228 | chapter={ 229 | name={,}, 230 | number={\arabic{chapter}}, 231 | format={\centering\zihao{4}\heiti}, 232 | nameformat={}, 233 | aftername={\quad}, 234 | titleformat={}, 235 | beforeskip={-.5\baselineskip}, 236 | afterskip={.5\baselineskip}, 237 | }, 238 | section={ 239 | format={\zihao{5}\heiti}, 240 | aftername={\space}, 241 | beforeskip={.5\baselineskip}, 242 | afterskip={.5\baselineskip}, 243 | }, 244 | subsection={ 245 | format={\zihao{5}\heiti}, 246 | aftername={\space}, 247 | beforeskip={.5\baselineskip}, 248 | afterskip={.5\baselineskip}, 249 | indent={2em}, 250 | }, 251 | subsubsection={ 252 | numbering={true}, 253 | number={\Alph{subsubsection}}, 254 | format={\zihao{5}\heiti}, 255 | aftername={. }, 256 | beforeskip={0pt}, 257 | afterskip={0pt}, 258 | indent={2em}, 259 | }, 260 | paragraph={ 261 | numbering={true}, 262 | number={\alph{paragraph}}, 263 | format={\zihao{5}\heiti}, 264 | aftername={. }, 265 | aftertitle={\par}, 266 | beforeskip={0pt}, 267 | afterskip={0pt}, 268 | indent={2em}, 269 | }, 270 | } 271 | 272 | \newcommand{\Title}[1]{{\centering{\cuheiti\zihao{-2}{#1}}}} 273 | \newcommand{\TitleEng}[1]{{\centering\zihao{-2}{\textbf{#1}}}} 274 | 275 | %%% toc %%% 276 | \RequirePackage{titletoc} 277 | \renewcommand{\contentsname}{\zihao{4}{\textbf{目~录}}} 278 | \newcommand{\toc}{ 279 | \tableofcontents 280 | \titlecontents{chapter}[0em]{} 281 | {\contentspush{\thecontentslabel\ }} 282 | {}{\titlerule*[4pt]{.}\contentspage} 283 | \titlecontents{section}[2em]{} 284 | {\contentspush{\thecontentslabel\ }} 285 | {}{\titlerule*[4pt]{.}\contentspage} 286 | \titlecontents{subsection}[4em]{} 287 | {\contentspush{\thecontentslabel\ }} 288 | {}{\titlerule*[4pt]{.}\contentspage} 289 | } 290 | 291 | %%% code listing %%% 292 | \RequirePackage{xcolor} 293 | \RequirePackage[chapter]{minted} % listings sucks, use minted, require installation of pygmentize 294 | \RequirePackage{mdframed} %achieve code box 295 | \mdfdefinestyle{codebox}{ 296 | leftmargin=3em, 297 | rightmargin=3em, 298 | innertopmargin=1em, 299 | innerbottommargin=1em, 300 | linewidth=0.6pt 301 | } 302 | \newminted{python}{ 303 | linenos=true, 304 | breaklines=true, 305 | breakanywhere=true, 306 | frame=none, 307 | python3=true, 308 | fontsize=\zihao{5}, 309 | numbersep=2em, 310 | style=default, 311 | tabsize=2, 312 | xleftmargin=0.5em, 313 | xrightmargin=0.5em, 314 | } 315 | \newminted{bash}{ 316 | linenos=true, 317 | breaklines=true, 318 | breakanywhere=true, 319 | frame=none, 320 | fontsize=\zihao{5}, 321 | numbersep=2em, 322 | style=default, 323 | tabsize=2, 324 | xleftmargin=0.5em, 325 | xrightmargin=0.5em, 326 | } 327 | \newminted{cpp}{ 328 | linenos=true, 329 | breaklines=true, 330 | breakanywhere=true, 331 | frame=none, 332 | fontsize=\zihao{5}, 333 | numbersep=2em, 334 | style=default, 335 | tabsize=2, 336 | xleftmargin=0.5em, 337 | xrightmargin=0.5em, 338 | } 339 | \iftongji@color 340 | \relax 341 | \else 342 | \usemintedstyle{bw} 343 | \fi 344 | \renewcommand{\theFancyVerbLine}{\rmfamily \textcolor{gray}{\zihao{5} \oldstylenums{\arabic{FancyVerbLine}}}} %re-define line numbers format 345 | \renewcommand{\listingscaption}{代码} 346 | 347 | %%% algorithm pseudocode %%% 348 | \RequirePackage[linesnumbered,ruled,vlined]{algorithm2e} 349 | \renewcommand{\algorithmcfname}{算法} 350 | \SetKwInput{KwIn}{输入} 351 | \SetKwInput{KwOut}{输出} 352 | \newcommand{\commentstyle}[1]{\texttt{#1}} 353 | \SetCommentSty{commentstyle} 354 | 355 | %%% lists %%% 356 | % circled numbers 357 | \RequirePackage{tikz} 358 | \newcommand{\circled}[2][]{ 359 | \tikz[baseline=(char.base)]{ 360 | \node[shape = circle, draw, inner sep = 1pt] 361 | (char) {\phantom{\ifblank{#1}{#2}{#1}}};% 362 | \node at (char.center) 363 | {\makebox[0pt][c]{#2}}; 364 | } 365 | } 366 | \robustify{\circled} 367 | \newcommand{\dcircled}[1]{\circled[00]{#1}} 368 | 369 | \RequirePackage{enumitem,calc} 370 | \setlist[enumerate,1]{label=(\arabic*)} 371 | \setlist[enumerate,2]{label=\circled{\arabic*}} 372 | 373 | % first line indention only 374 | \newlist{fitemize}{itemize}{1} 375 | \setlist[fitemize]{ 376 | label={\(\bullet\)}, 377 | align=right, 378 | labelwidth=2.5em, 379 | labelsep=.5em, 380 | itemindent=3em, 381 | leftmargin=0pt, 382 | nosep 383 | } 384 | 385 | \newlist{fbenumerate}{enumerate}{1} 386 | \setlist[fbenumerate]{ 387 | label={[\arabic*]}, 388 | align=right, 389 | labelwidth=2.5em, 390 | labelsep=.5em, 391 | itemindent=3em, 392 | leftmargin=0pt, 393 | nosep 394 | } 395 | 396 | \setlist[itemize]{ 397 | labelwidth=*, 398 | labelindent=\parindent, 399 | leftmargin=*, 400 | labelsep=.5em, 401 | nosep 402 | } 403 | \setlist[enumerate]{ 404 | labelwidth=*, 405 | labelindent=\parindent, 406 | leftmargin=*, 407 | labelsep=0pt, 408 | nosep 409 | } 410 | 411 | %%% misc %%% 412 | \renewcommand{\frontmatter}{ 413 | \cleardoublepage 414 | \@mainmatterfalse 415 | \pagenumbering{Roman} 416 | } 417 | 418 | % debug for framing and line numbering 419 | \iftongji@debug 420 | \geometry{showframe} 421 | 422 | \RequirePackage[mathlines]{lineno} 423 | \setpagewiselinenumbers 424 | \linenumbers 425 | % \modulolinenumbers[5] 426 | \fi 427 | 428 | % circled numbering for footnote 429 | \RequirePackage[perpage,symbol*]{footmisc} 430 | \DefineFNsymbols{fncircled}{①②③④⑤⑥⑦⑧⑨⑩} 431 | \setfnsymbol{fncircled} 432 | \renewcommand\@makefntext[1]{\@thefnmark~#1} 433 | 434 | %%% front cover %%% 435 | \let\oldtabular\tabular 436 | \let\endoldtabular\endtabular 437 | \newenvironment{information}[1][h!]{ 438 | \renewcommand{\arraystretch}{1.5} 439 | \setlength{\tabcolsep}{8pt} 440 | \zihao{-3}\oldtabular[#1] 441 | }{\renewcommand{\arraystretch}{1.2}\endoldtabular 442 | } 443 | \newcommand{\ulinecentered}[1]{\uline{\makebox[18em][c]{#1}}} 444 | %\newcommand{\ulinecentered}[1]{\fbox[b]{\parbox[t]{18em}{\centering #1}}} 445 | 446 | \RequirePackage{array} 447 | \newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}} 448 | 449 | \newcommand{\MakeFrontCover}{ 450 | \begin{titlepage} 451 | \begin{center} 452 | 453 | \thisfancyput(-0.75cm,-13cm){} 454 | \vspace*{\fill} 455 | 456 | \includegraphics[height=2.25cm]{logo.pdf} 457 | 458 | \zihao{-2}\MakeUppercase{\textbf{\tongji@universityeng}} 459 | \vskip 30pt 460 | 461 | \zihao{1}{\textbf{毕业设计(论文)}} 462 | \vskip 80pt 463 | 464 | \begin{information}{M{4em}M{18em}} 465 | 课题名称 & \ulinecentered{\tongji@thesistitle}\\ 466 | 副\enskip{}标\enskip{}题 & \ulinecentered{\tongji@thesissubtitle}\\ 467 | 学\quad{}\quad{}院 & \ulinecentered{\tongji@school}\\ 468 | 专\quad{}\quad{}业 & \ulinecentered{\tongji@major}\\ 469 | 学生姓名 & \ulinecentered{\tongji@thesisauthor}\\ 470 | 学\quad{}\quad{}号 & \ulinecentered{\tongji@authorschoolnumber}\\ 471 | 指导教师 & \ulinecentered{\tongji@advisor}\\ 472 | 日\quad{}\quad{}期 & \ulinecentered{\tongji@thesisyear{}年\tongji@thesismonth{}月\tongji@thesisday{}日}\\ 473 | \end{information} 474 | 475 | \vspace*{\fill} 476 | 477 | \end{center} 478 | \end{titlepage} 479 | } 480 | 481 | %%% abstracts %%% 482 | \newenvironment{cabstract}{% 483 | \newpage 484 | \vspace*{9pt} 485 | \begin{center} 486 | \begin{minipage}[h]{.8\textwidth} 487 | \centering{\Title{\tongji@thesistitle}} 488 | \end{minipage} 489 | \end{center} 490 | \vspace*{18pt} 491 | \centerline{\zihao{4}{\textbf{摘~要}}} 492 | \vskip 9pt 493 | \par 494 | }{% 495 | \vskip 18pt 496 | \noindent{\songheiti{关键词:}}\tongji@keyword 497 | } 498 | 499 | \newenvironment{eabstract}{% 500 | \newpage 501 | \vspace*{9pt} 502 | \begin{center} 503 | \begin{minipage}[h]{.8\textwidth} 504 | \centering{\TitleEng{\tongji@thesistitleeng}} 505 | \end{minipage} 506 | \end{center} 507 | \vspace*{18pt} 508 | \centerline{\zihao{4}{\textbf{ABSTRACT}}} 509 | \vskip 9pt 510 | \par 511 | }{% 512 | \vskip 18pt 513 | \noindent{{\textbf{Keywords:}}} \tongji@keywordeng 514 | } 515 | 516 | %%% custom information %%% 517 | \renewcommand{\maketitle}{% 518 | \MakeFrontCover 519 | \frontmatter 520 | } 521 | 522 | \def\tongji@university{同济大学} 523 | \def\tongji@universityeng{Tongji University} 524 | \newcommand{\university}[2]{% 525 | \def\tongji@university{#1} 526 | \def\tongji@universityeng{#2} 527 | } 528 | 529 | \def\tongji@school{} 530 | \def\tongji@schooleng{} 531 | \newcommand{\school}[2]{% 532 | \def\tongji@school{#1} 533 | \def\tongji@schooleng{#2} 534 | } 535 | 536 | \def\tongji@major{} 537 | \def\tongji@majoreng{} 538 | \newcommand{\major}[2]{% 539 | \def\tongji@major{#1} 540 | \def\tongji@majoreng{#2} 541 | } 542 | 543 | \def\tongji@thesistitle{} 544 | \def\tongji@thesissubtitle{} 545 | \def\tongji@thesistitleeng{} 546 | \def\tongji@thesissubtitleeng{} 547 | \newcommand{\thesistitle}[4]{% 548 | \def\tongji@thesistitle{#1} 549 | \def\tongji@thesissubtitle{#2} 550 | \def\tongji@thesistitleeng{#3} 551 | \def\tongji@thesissubtitleeng{#4} 552 | } 553 | 554 | \def\tongji@thesisauthor{} 555 | \def\tongji@thesisauthoreng{} 556 | \newcommand{\thesisauthor}[2]{% 557 | \def\tongji@thesisauthor{#1} 558 | \def\tongji@thesisauthoreng{#2} 559 | } 560 | 561 | \def\tongji@authorschoolnumber{} 562 | \newcommand{\schoolnumber}[1]{% 563 | \def\tongji@authorschoolnumber{#1} 564 | } 565 | 566 | \def\tongji@advisor{} 567 | \def\tongji@advisoreng{} 568 | \newcommand{\advisor}[2]{% 569 | \def\tongji@advisor{#1} 570 | \def\tongji@advisoreng{#2} 571 | } 572 | 573 | \def\tongji@thesisyear{} 574 | \def\tongji@thesismonth{} 575 | \def\tongji@thesisday{} 576 | \newcommand{\thesisdate}[3]{% 577 | \def\tongji@thesisyear{#1} 578 | \def\tongji@thesismonth{#2} 579 | \def\tongji@thesisday{#3} 580 | } 581 | 582 | \def\tongji@keyword{} 583 | \def\tongji@keywordeng{} 584 | \newcommand{\keyword}[2]{% 585 | \def\tongji@keyword{#1} 586 | \def\tongji@keywordeng{#2} 587 | } 588 | --------------------------------------------------------------------------------