diff options
Diffstat (limited to 'biblio/bibtex/contrib/gbt7714/gbt7714.sty')
-rw-r--r-- | biblio/bibtex/contrib/gbt7714/gbt7714.sty | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/biblio/bibtex/contrib/gbt7714/gbt7714.sty b/biblio/bibtex/contrib/gbt7714/gbt7714.sty new file mode 100644 index 0000000000..3269ff5bf7 --- /dev/null +++ b/biblio/bibtex/contrib/gbt7714/gbt7714.sty @@ -0,0 +1,124 @@ +%% +%% This is file `gbt7714.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% gbt7714.dtx (with options: `package') +%% ------------------------------------------------------------------- +%% GB/T 7714-2015 BibTeX Style +%% https://github.com/CTeX-org/gbt7714-bibtex-style +%% Version: 2019/03/21 v1.1.1 +%% ------------------------------------------------------------------- +%% Copyright (C) 2016-2019 by Zeping Lee <zepinglee AT gmail.com> +%% ------------------------------------------------------------------- +%% 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. +%% 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. +%% ------------------------------------------------------------------- +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{gbt7714} + [2019/03/21 v1.1.1 GB/T 7714-2015 BibTeX Style] +\newif\if@gbt@mmxv +\newif\if@gbt@numerical +\newif\if@gbt@super +\DeclareOption{2015}{\@gbt@mmxvtrue} +\DeclareOption{2005}{\@gbt@mmxvfalse} +\DeclareOption{super}{\@gbt@numericaltrue\@gbt@supertrue} +\DeclareOption{numbers}{\@gbt@numericaltrue\@gbt@superfalse} +\DeclareOption{authoryear}{\@gbt@numericalfalse} +\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{natbib}} +\ExecuteOptions{2015,super} +\ProcessOptions\relax +\if@gbt@numerical + \PassOptionsToPackage{sort&compress}{natbib} +\fi +\RequirePackage{natbib} +\RequirePackage{etoolbox} +\RequirePackage{url} +\newcommand\bibstyle@super{\bibpunct{[}{]}{,}{s}{,}{\textsuperscript{,}}} +\newcommand\bibstyle@numbers{\bibpunct{[}{]}{,}{n}{,}{,}} +\newcommand\bibstyle@authoryear{\bibpunct{(}{)}{;}{a}{,}{,}} +\newcommand\gbtbibstyle[1]{% + \ifstrequal{#1}{numerical}{% + \if@gbt@mmxv + \bibliographystyle{gbt7714-unsrt}% + \else + \bibliographystyle{gbt7714-2005-unsrt}% + \fi + }{% + \ifstrequal{#1}{authoryear}{% + \if@gbt@mmxv + \bibliographystyle{gbt7714-plain}% + \else + \bibliographystyle{gbt7714-2005-plain}% + \fi + }{% + \PackageError{gbt7714}{Unknown argument #1.}% + {It should be `numerical' or `authoryear'.}% + }% + }% +} +\if@gbt@numerical + \if@gbt@super + \citestyle{super}% + \gbtbibstyle{numerical}% + \else + \citestyle{numbers} + \gbtbibstyle{numerical}% + \fi +\else + \citestyle{authoryear} + \gbtbibstyle{authoryear}% +\fi +\newcommand\gbt@patchfailure[1]{% + \PackageError{gbt7714}{Failed to patch command \protect#1}{}% +} +\patchcmd{\NAT@citexnum}{% + \@ifnum{\NAT@ctype=\z@}{% + \if*#2*\else\NAT@cmt#2\fi + }{}% + \NAT@mbox{\NAT@@close}% +}{% + \NAT@mbox{\NAT@@close}% + \@ifnum{\NAT@ctype=\z@}{% + \if*#2*\else\textsuperscript{#2}\fi + }{}% +}{}{\gbt@patchfailure{\NAT@citexnum}} +\renewcommand\NAT@citesuper[3]{\ifNAT@swa + \if*#2*\else#2\NAT@spacechar\fi +\unskip\kern\p@\textsuperscript{\NAT@@open#1\NAT@@close\if*#3*\else#3\fi}% + \else #1\fi\endgroup} +\patchcmd{\NAT@citex}{% + \if*#2*\else\NAT@cmt#2\fi + \if\relax\NAT@date\relax\else\NAT@@close\fi +}{% + \if\relax\NAT@date\relax\else\NAT@@close\fi + \if*#2*\else\textsuperscript{#2}\fi +}{}{\gbt@patchfailure{\NAT@citex}} +\renewcommand\NAT@cite% + [3]{\ifNAT@swa\NAT@@open\if*#2*\else#2\NAT@spacechar\fi + #1\NAT@@close\if*#3*\else\textsuperscript{#3}\fi\else#1\fi\endgroup} +\patchcmd{\NAT@citexnum}{% + \ifx\NAT@last@yr\relax + \def@NAT@last@yr{\@citea}% + \else + \def@NAT@last@yr{--\NAT@penalty}% + \fi +}{% + \def@NAT@last@yr{-\NAT@penalty}% +}{}{\gbt@patchfailure{\NAT@citexnum}} +\renewcommand\@biblabel[1]{[#1]\hfill} +\def\UrlBreaks{% + \do\/% + \do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l% + \do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z% + \do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L% + \do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z% + \do0\do1\do2\do3\do4\do5\do6\do7\do8\do9\do=\do/\do.\do:% + \do\*\do\-\do\~\do\'\do\"\do\-} +\Urlmuskip=0mu plus 0.1mu |