From 9623a1470641410d6c1784c8bf25e3bcf1398a01 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 21 Mar 2019 20:45:44 +0000 Subject: gbt7714 (21mar19) git-svn-id: svn://tug.org/texlive/trunk@50504 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/source/bibtex/gbt7714/gbt7714.dtx | 455 +++++++++++++++------ 1 file changed, 340 insertions(+), 115 deletions(-) (limited to 'Master/texmf-dist/source/bibtex') diff --git a/Master/texmf-dist/source/bibtex/gbt7714/gbt7714.dtx b/Master/texmf-dist/source/bibtex/gbt7714/gbt7714.dtx index 2012af01124..cfadbd888b3 100644 --- a/Master/texmf-dist/source/bibtex/gbt7714/gbt7714.dtx +++ b/Master/texmf-dist/source/bibtex/gbt7714/gbt7714.dtx @@ -1,6 +1,8 @@ % \iffalse meta-comment +% GB/T 7714-2015 BibTeX Style +% https://github.com/CTeX-org/gbt7714-bibtex-style % -% Copyright (C) 2016-2018 by Zeping Lee +% Copyright (C) 2016-2019 by Zeping Lee % % This file may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3c @@ -14,17 +16,20 @@ \iffalse \fi \begingroup - \def\nameoflatex{LaTeX2e} + \def\nameoflatex{LaTeX2e} \expandafter\endgroup\ifx\nameoflatex\fmtname\else \csname fi\endcsname % %<*install> \input docstrip.tex \preamble -Version: 2018/08/05 v1.0.9 - +------------------------------------------------------------------- +GB/T 7714-2015 BibTeX Style +https://github.com/CTeX-org/gbt7714-bibtex-style +Version: 2019/03/21 v1.1.1 +------------------------------------------------------------------- Copyright (C) 2016-\the\year by Zeping Lee - +------------------------------------------------------------------- This file may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c of this license or (at your option) any later version. @@ -32,7 +37,7 @@ The latest version of this license is in https://www.latex-project.org/lppl.txt and version 1.3c or later is part of all distributions of LaTeX version 2005/12/01 or later. - +------------------------------------------------------------------- \endpreamble \keepsilent \askforoverwritefalse @@ -41,8 +46,27 @@ version 2005/12/01 or later. \file{\jobname.sty}{\from{\jobname.dtx}{package}} \file{\jobname-plain.bst}{\from{\jobname.dtx}{2015,authoryear}} \file{\jobname-unsrt.bst}{\from{\jobname.dtx}{2015,numerical}} - \file{\jobname-2005-plain.bst}{\from{\jobname.dtx}{2005,authoryear}} - \file{\jobname-2005-unsrt.bst}{\from{\jobname.dtx}{2005,numerical}} + \file{versions/2005/\jobname-2005-plain.bst}{ + \from{\jobname.dtx}{2005,authoryear} + } + \file{versions/2005/\jobname-2005-unsrt.bst}{ + \from{\jobname.dtx}{2005,numerical} + } + \file{versions/thu/thuthesis-author-year.bst}{ + \from{\jobname.dtx}{thu,2005,authoryear}} + \file{versions/thu/thuthesis-numeric.bst}{ + \from{\jobname.dtx}{thu,2005,numerical}} + \file{versions/thu/thuthesis-bachelor.bst}{ + \from{\jobname.dtx}{2015,numerical}} + \file{versions/ustc/ustcthesis-authoryear.bst}{ + \from{\jobname.dtx}{ustc,2015,authoryear} + } + \file{versions/ustc/ustcthesis-numerical.bst}{ + \from{\jobname.dtx}{ustc,2015,numerical} + } + \file{versions/ustc/ustcthesis-bachelor.bst}{ + \from{\jobname.dtx}{ustc,2015,numerical,nouppercase,nomark,italicjournal} + } } \endbatchfile % @@ -55,7 +79,7 @@ version 2005/12/01 or later. %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesPackage{gbt7714} %<*package> - [2018/08/05 v1.0.9 GB/T 7714-2015 BibTeX Style] + [2019/03/21 v1.1.1 GB/T 7714-2015 BibTeX Style] % % %<*driver> @@ -154,7 +178,7 @@ version 2005/12/01 or later. % It is compatible with \pkg{natbib} and supports language detection (Chinese % and English) for each biblilography entry. % \end{abstract} - +% % \section{简介} % % GB/T 7714-2015 《信息与文献\quad 参考文献著录规则》\cite{gbt77142015} @@ -166,7 +190,7 @@ version 2005/12/01 or later. % \item 自动识别语言并进行相应处理 % \item 提供了简单的接口供用户修改样式 % \end{itemize} -% 本宏包的主页:\url{https://github.com/zepinglee/gbt7714-bibtex-style}。 +% 本宏包的主页:\url{https://github.com/CTeX-org/gbt7714-bibtex-style}。 % % % \section{使用方法} @@ -217,7 +241,7 @@ version 2005/12/01 or later. % 表~\ref{tab:entry-types} 列举了 \file{bib} 数据库中对应的文献类型。 % 这些尽可能兼容 \BibTeX{} 的标准类型,但是新增了若干文献类型(带 * 号)。 % -% \begin{table}[htbp] +% \begin{table}[htb] % \centering\small % \caption{全部文献类型} % \label{tab:entry-types} @@ -322,7 +346,7 @@ version 2005/12/01 or later. % 若变量被设为 |#1| 则表示该项被启用,设为 |#0| 则不启用。 % 默认的值是严格遵循国标的配置。 % -% \begin{table} +% \begin{table}[htb] % \centering\small % \caption{参考文献表样式的配置参数} % \label{tab:config} @@ -548,9 +572,7 @@ version 2005/12/01 or later. % Numerical 模式的 \cs{citet} 的页码: % \begin{macrocode} \newcommand\gbt@patchfailure[1]{% - \ClassError{ustcthesis}{Failed to patch command \protect#1.\MessageBreak - Please contact the template author.% - }{}% + \PackageError{gbt7714}{Failed to patch command \protect#1}{}% } \patchcmd{\NAT@citexnum}{% \@ifnum{\NAT@ctype=\z@}{% @@ -655,11 +677,21 @@ INTEGERS { sentence.case.title link.title show.mark + slash.for.extraction + in.booktitle italic.jounal + bold.journal.volume show.missing.address.publisher show.url show.doi show.note +%<*authoryear> + lang.zh.order + lang.ja.order + lang.en.order + lang.ru.order + lang.other.order +% } % \end{macrocode} @@ -674,6 +706,9 @@ FUNCTION {load.config} % 英文姓名转为全大写: % \begin{macrocode} #1 'uppercase.name := +%<*nouppercase|thu> + #0 'uppercase.name := +% % \end{macrocode} % % 最多显示的作者数量: @@ -683,52 +718,103 @@ FUNCTION {load.config} % % 采用著者-出版年制时,作者姓名与年份之间使用句点连接: % \begin{macrocode} +%<*authoryear> #0 'period.between.author.year := +%<*period|2005|ustc> + #1 'period.between.author.year := +% +% % \end{macrocode} % % 英文标题转为 sentence case (句首字母大写,其余小写): % \begin{macrocode} #1 'sentence.case.title := +%<*nosentencecase> + #0 'sentence.case.title := +% % \end{macrocode} % % 在标题添加超链接: % \begin{macrocode} #0 'link.title := +%<*linktitle> + #1 'link.title := +% % \end{macrocode} % % 著录文献类型标识(比如“[M/OL]“): % \begin{macrocode} #1 'show.mark := +%<*nomark> + #0 'show.mark := +% +% \end{macrocode} +% +% 使用“//”表示析出文献 +% \begin{macrocode} + #1 'slash.for.extraction := +%<*noslash> + #0 'slash.for.extraction := +% +% \end{macrocode} +% +% 使用“In:”表示析出文献 +% \begin{macrocode} + #0 'in.booktitle := % \end{macrocode} % % 期刊名使用斜体: % \begin{macrocode} #0 'italic.jounal := +%<*italicjournal> + #1 'italic.jounal := +% +% \end{macrocode} +% +% 期刊的卷使用粗体: +% \begin{macrocode} + #0 'bold.journal.volume := % \end{macrocode} % % 无出版地或出版者时,著录“出版地不详”,“出版者不详”,“S.l.” 或 “s.n.”: % \begin{macrocode} #1 'show.missing.address.publisher := +%<*noslsn|ustc> + #0 'show.missing.address.publisher := +% % \end{macrocode} % % 是否著录 URL: % \begin{macrocode} #1 'show.url := +%<*nourl> + #0 'show.url := +% % \end{macrocode} % % 是否著录 DOI: % \begin{macrocode} -%<*2015> #1 'show.doi := -% -%<*2005> +%<*nodoi|2005> #0 'show.doi := -% +% % \end{macrocode} % % 在每一条文献最后输出注释(note)的内容: % \begin{macrocode} #0 'show.note := +% \end{macrocode} +% +% \changes{v1.1.1}{2019/03/21}{允许自定义文种的顺序} +% 参考文献表按照“著者-出版年”组织时,各个文种的顺序: +% \begin{macrocode} +%<*authoryear> + #1 'lang.zh.order := + #2 'lang.ja.order := + #3 'lang.en.order := + #4 'lang.ru.order := + #5 'lang.other.order := +% } % \end{macrocode} @@ -771,7 +857,7 @@ ENTRY volume year } - { entry.lang entry.is.electronic } + { entry.lang entry.is.electronic entry.numbered } % \end{macrocode} % % These string entry variables are used to form the citation label. @@ -961,22 +1047,28 @@ FUNCTION {init.state.consts} % \end{macrocode} % % 下面是一些常量的定义 +% \changes{v1.1}{2019/01/02}{允许自定义“et al”} % \begin{macrocode} FUNCTION {bbl.anonymous} -{ lang.zh entry.lang = +{ entry.lang lang.zh = { "佚名" } { "Anon" } if$ } -FUNCTION {bbl.space} { "\ " } +FUNCTION {bbl.space} +{ entry.lang lang.zh = + { "\ " } + { " " } + if$ +} FUNCTION {bbl.et.al} -{ lang.zh entry.lang = +{ entry.lang lang.zh = { "等" } - { lang.ja entry.lang = + { entry.lang lang.ja = { "他" } - { lang.ru entry.lang = + { entry.lang lang.ru = { "идр" } { "et~al." } if$ @@ -986,6 +1078,9 @@ FUNCTION {bbl.et.al} if$ } +FUNCTION {citation.et.al} +{ bbl.et.al } + FUNCTION {bbl.colon} { ": " } %<*2015> @@ -995,24 +1090,24 @@ FUNCTION {bbl.wide.space} { "\quad " } FUNCTION {bbl.wide.space} { "\ " } % -FUNCTION {bbl.slash} { "//\allowbreak{}" } +FUNCTION {bbl.slash} { "//\allowbreak " } FUNCTION {bbl.sine.loco} -{ lang.zh entry.lang = +{ entry.lang lang.zh = { "[出版地不详]" } { "[S.l.]" } if$ } FUNCTION {bbl.sine.nomine} -{ lang.zh entry.lang = +{ entry.lang lang.zh = { "[出版者不详]" } { "[s.n.]" } if$ } FUNCTION {bbl.sine.loco.sine.nomine} -{ lang.zh entry.lang = +{ entry.lang lang.zh = { "[出版地不详: 出版者不详]" } { "[S.l.: s.n.]" } if$ @@ -1061,7 +1156,9 @@ FUNCTION {output.nonnull} { output.state before.all = 'write$ { output.state after.slash = - { bbl.slash * write$ } + { bbl.slash * write$ + newline$ + } { add.period$ " " * write$ } if$ } @@ -1122,9 +1219,22 @@ FUNCTION {output.check} % \end{macrocode} % % This function finishes all entries. +% +% Tsinghua requires no period at the end of book-like entries. % \begin{macrocode} FUNCTION {fin.entry} +%<*!thu> { add.period$ +% +%<*thu> +{ type$ "book" = + type$ "inbook" = or + type$ "incollection" = or + type$ "collection" = or + 'skip$ + 'add.period$ + if$ +% write$ newline$ } @@ -1158,7 +1268,11 @@ FUNCTION {new.sentence} FUNCTION {new.slash} { output.state before.all = 'skip$ - { after.slash 'output.state := } + { slash.for.extraction + { after.slash 'output.state := } + { after.block 'output.state := } + if$ + } if$ } @@ -1388,6 +1502,15 @@ FUNCTION {set.entry.lang} 'entry.lang := } +FUNCTION {set.entry.numbered} +{ type$ "patent" = + type$ "standard" = or + type$ "techreport" = or + { #1 'entry.numbered := } + { #0 'entry.numbered := } + if$ +} + % \end{macrocode} % % \subsubsection{Format names} @@ -1514,14 +1637,16 @@ FUNCTION {format.key} } FUNCTION {format.authors} -{ author empty$ +{ author empty$ not + { author format.names } + { "empty author in " cite$ * warning$ %<*authoryear> - { bbl.anonymous } + bbl.anonymous % %<*numerical> - { "" } + "" % - { author format.names } + } if$ } @@ -1536,7 +1661,7 @@ FUNCTION {format.translators} { translator empty$ { "" } { translator format.names - lang.zh entry.lang = + entry.lang lang.zh = { translator num.names$ #3 > { "译" * } { ", 译" * } @@ -1631,7 +1756,20 @@ FUNCTION {output.bibitem} ")" make.full.names duplicate$ short.list = { pop$ } { * } - if$ + if$ + 's := + s text.length$ 'charptr := + { charptr #0 > } + { s charptr #1 substring$ "]" = + { #0 'charptr := } + { charptr #1 - 'charptr := } + if$ + } + while$ + charptr #0 > + { "{" s * "}" * } + { s } + if$ "]{" * write$ cite$ write$ "}" write$ @@ -1661,15 +1799,15 @@ FUNCTION {change.sentence.case} } FUNCTION {add.link} - { url empty$ not - { "\href{" url * "}{" * swap$ * "}" * } - { doi empty$ not - { "\href{http://dx.doi.org/" doi * "}{" * swap$ * "}" * } - 'skip$ - if$ - } - if$ - } +{ url empty$ not + { "\href{" url * "}{" * swap$ * "}" * } + { doi empty$ not + { "\href{http://dx.doi.org/" doi * "}{" * swap$ * "}" * } + 'skip$ + if$ + } + if$ +} FUNCTION {format.title} { title empty$ @@ -1679,6 +1817,10 @@ FUNCTION {format.title} 'change.sentence.case 'skip$ if$ + entry.numbered number empty$ not and + { bbl.colon * number * } + 'skip$ + if$ link.title 'add.link 'skip$ @@ -1784,24 +1926,32 @@ FUNCTION {is.number} } FUNCTION {format.volume} -{ volume empty$ - { "" } - { lang.zh entry.lang = - { "第 " volume * " 卷" * } - { "volume" volume tie.or.space.connect } +{ volume empty$ not + { volume is.number + { entry.lang lang.zh = + { "第 " volume * " 卷" * } + { "volume" volume tie.or.space.connect } + if$ + } + { volume } if$ } + { "" } if$ } FUNCTION {format.number} -{ number empty$ - { "" } - { lang.zh entry.lang = - { "第 " number * " 册" * } - { "number" number tie.or.space.connect } +{ number empty$ not + { number is.number + { entry.lang lang.zh = + { "第 " number * " 册" * } + { "number" number tie.or.space.connect } + if$ + } + { number } if$ } + { "" } if$ } @@ -1812,36 +1962,55 @@ FUNCTION {format.volume.number} if$ } -FUNCTION {format.series.vol.num.title} -{ format.volume.number 's := - series empty$ not - { series - sentence.case.title - 'change.sentence.case +FUNCTION {format.title.vol.num} +{ title + sentence.case.title + 'change.sentence.case + 'skip$ + if$ + entry.numbered + { number empty$ not + { bbl.colon * number * } 'skip$ if$ - bbl.colon * + } + { format.volume.number 's := s empty$ not - { s * bbl.wide.space * } + { bbl.colon * s * } 'skip$ if$ - title + } + if$ +} + +FUNCTION {format.series.vol.num.title} +{ format.volume.number 's := + series empty$ not + { series sentence.case.title 'change.sentence.case 'skip$ if$ - * - } - { title + entry.numbered + { bbl.wide.space * } + { bbl.colon * + s empty$ not + { s * bbl.wide.space * } + 'skip$ + if$ + } + if$ + title * sentence.case.title 'change.sentence.case 'skip$ if$ - s empty$ not - { bbl.colon * s * } + entry.numbered number empty$ not and + { bbl.colon * number * } 'skip$ if$ } + { format.title.vol.num } if$ link.title 'add.link @@ -1849,28 +2018,48 @@ FUNCTION {format.series.vol.num.title} if$ } +FUNCTION {format.booktitle.vol.num} +{ booktitle + entry.numbered + 'skip$ + { format.volume.number 's := + s empty$ not + { bbl.colon * s * } + 'skip$ + if$ + } + if$ +} + +% \end{macrocode} +% +% \changes{v1.1}{2019/01/02}{修正 series 的 bug} +% \begin{macrocode} FUNCTION {format.series.vol.num.booktitle} { format.volume.number 's := series empty$ not { series bbl.colon * - s empty$ not + entry.numbered not s empty$ not and { s * bbl.wide.space * } 'skip$ if$ booktitle * } - { booktitle - s empty$ not - { bbl.colon * s * } + { format.booktitle.vol.num } + if$ + in.booktitle + { duplicate$ empty$ not entry.lang lang.en = and + { "In: " swap$ * } 'skip$ if$ } + 'skip$ if$ } FUNCTION {format.journal} { journal - italic.jounal + italic.jounal entry.lang lang.en = and 'italicize 'skip$ if$ @@ -1937,7 +2126,7 @@ FUNCTION {format.edition} { edition empty$ { "" } { edition is.number - { lang.zh entry.lang = + { entry.lang lang.zh = { edition " 版" * } { edition num.to.ordinal " ed." * } if$ @@ -2086,7 +2275,10 @@ FUNCTION {format.year} { date empty$ not { date extract.before.dash } { "empty year in " cite$ * warning$ - "" + urldate empty$ not + { "[" urldate extract.before.dash * "]" * } + { "" } + if$ } if$ } @@ -2213,6 +2405,17 @@ FUNCTION {format.pages} % % 报纸在卷号缺失时,期号与前面的日期直接相连,所以必须拆开输出。 % \begin{macrocode} +FUNCTION {format.journal.volume} +{ volume empty$ not + { bold.journal.volume + { "\textbf{" volume * "}" * } + { volume } + if$ + } + { "" } + if$ +} + FUNCTION {format.journal.number} { number empty$ not { "\penalty0 (" number * ")" * } @@ -2448,12 +2651,14 @@ FUNCTION {monograph} { format.authors } { editor empty$ not { format.editors } + { "empty author and editor in " cite$ * warning$ %<*authoryear> - { bbl.anonymous } + bbl.anonymous % %<*numerical> - { "" } + "" % + } if$ } if$ @@ -2502,7 +2707,7 @@ FUNCTION {monograph} % \begin{macrocode} FUNCTION {incollection} { output.bibitem - format.authors "author" output.check + format.authors output author format.key output %<*authoryear> period.between.author.year @@ -2544,7 +2749,7 @@ FUNCTION {incollection} % \begin{macrocode} FUNCTION {periodical} { output.bibitem - format.authors "author" output.check + format.authors output author format.key output %<*authoryear> period.between.author.year @@ -2588,7 +2793,7 @@ FUNCTION {periodical} % \begin{macrocode} FUNCTION {article} { output.bibitem - format.authors "author" output.check + format.authors output author format.key output %<*authoryear> period.between.author.year @@ -2606,7 +2811,7 @@ FUNCTION {article} %<*numerical> format.date "year" output.check % - volume output + format.journal.volume output format.journal.number "" output.after format.journal.pages "" output.after format.urldate "" output.after @@ -2635,12 +2840,7 @@ FUNCTION {patent} format.year "year" output.check % new.block - format.title - number empty$ not - { bbl.colon * number * } - 'skip$ - if$ - "title" output.check + format.title "title" output.check "P" set.entry.mark format.mark "" output.after new.block @@ -2829,7 +3029,16 @@ FUNCTION {manual} { monograph } % Optional: type, address, month, note % \begin{macrocode} FUNCTION {mastersthesis} +%<*!thu> { "D" set.entry.mark +% +%<*thu> +{ lang.zh entry.lang = + { "硕士学位论文" } + { "D" } + if$ + set.entry.mark +% monograph } @@ -2851,7 +3060,19 @@ FUNCTION {online} % % Optional: type, address, month, note % \begin{macrocode} +%<*!thu> FUNCTION {phdthesis} { mastersthesis } +% +%<*thu> +FUNCTION {phdthesis} +{ lang.zh entry.lang = + { "博士学位论文" } + { "D" } + if$ + set.entry.mark + monograph +} +% % \end{macrocode} % @@ -3131,7 +3352,7 @@ FUNCTION {format.lab.names} { t #1 "{ll}{ff}" format.name$} if$ s num.names$ #1 > - { bbl.space * bbl.et.al * } + { bbl.space * citation.et.al * } 'skip$ if$ } @@ -3256,14 +3477,14 @@ FUNCTION {calc.label} %<*authoryear> FUNCTION {sort.language.label} { entry.lang lang.zh = - { "a zh " } + { lang.zh.order } { entry.lang lang.ja = - { "b ja " } + { lang.ja.order } { entry.lang lang.en = - { "c en " } + { lang.en.order } { entry.lang lang.ru = - { "d ru " } - { "e other " } + { lang.ru.order } + { lang.other.order } if$ } if$ @@ -3271,6 +3492,7 @@ FUNCTION {sort.language.label} if$ } if$ + int.to.chr$ } FUNCTION {sort.format.names} @@ -3328,18 +3550,22 @@ FUNCTION {sort.format.title} % purposes, we still remove a leading "The " from the organization field. % \begin{macrocode} FUNCTION {anonymous.sort} -{ lang.zh entry.lang = +{ entry.lang lang.zh = { "yi4 ming2" } { "anon" } if$ } +FUNCTION {warn.empty.key} +{ entry.lang lang.zh = + { "empty key in " cite$ * warning$ } + 'skip$ + if$ +} + FUNCTION {author.sort} { key empty$ - { entry.lang lang.zh = - { "empty key in " cite$ * warning$ } - 'skip$ - if$ + { warn.empty.key author empty$ { anonymous.sort } { author sort.format.names } @@ -3351,7 +3577,8 @@ FUNCTION {author.sort} FUNCTION {author.editor.sort} { key empty$ - { author empty$ + { warn.empty.key + author empty$ { editor empty$ { anonymous.sort } { editor sort.format.names } @@ -3366,7 +3593,8 @@ FUNCTION {author.editor.sort} FUNCTION {author.organization.sort} { key empty$ - { author empty$ + { warn.empty.key + author empty$ { organization empty$ { anonymous.sort } { "The " #4 organization chop.word sortify } @@ -3381,7 +3609,8 @@ FUNCTION {author.organization.sort} FUNCTION {editor.organization.sort} { key empty$ - { editor empty$ + { warn.empty.key + editor empty$ { organization empty$ { anonymous.sort } { "The " #4 organization chop.word sortify } @@ -3420,6 +3649,7 @@ FUNCTION {int.to.fix} % \begin{macrocode} FUNCTION {presort} { set.entry.lang + set.entry.numbered show.url show.doi check.electronic calc.label label sortify @@ -3577,16 +3807,12 @@ FUNCTION {begin.bib} write$ newline$ "\providecommand{\natexlab}[1]{#1}" write$ newline$ - show.url show.doi or - { "\providecommand{\url}[1]{#1}" - write$ newline$ - "\expandafter\ifx\csname urlstyle\endcsname\relax\relax\else" - write$ newline$ - " \urlstyle{same}\fi" - write$ newline$ - } - 'skip$ - if$ + "\providecommand{\url}[1]{#1}" + write$ newline$ + "\expandafter\ifx\csname urlstyle\endcsname\relax\relax\else" + write$ newline$ + " \urlstyle{same}\fi" + write$ newline$ show.doi { "\providecommand{\href}[2]{\url{#2}}" write$ newline$ @@ -3656,4 +3882,3 @@ EXECUTE {end.bib} % % \Finale \endinput -所以只能在 bib 数据库中的 key 域手动录入作者姓名的拼音,如: -- cgit v1.2.3