diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/gbt7714/gbt7714.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/gbt7714/gbt7714.sty | 260 |
1 files changed, 203 insertions, 57 deletions
diff --git a/Master/texmf-dist/tex/latex/gbt7714/gbt7714.sty b/Master/texmf-dist/tex/latex/gbt7714/gbt7714.sty index 3269ff5bf7a..18bf8f8042b 100644 --- a/Master/texmf-dist/tex/latex/gbt7714/gbt7714.sty +++ b/Master/texmf-dist/tex/latex/gbt7714/gbt7714.sty @@ -8,7 +8,7 @@ %% ------------------------------------------------------------------- %% GB/T 7714-2015 BibTeX Style %% https://github.com/CTeX-org/gbt7714-bibtex-style -%% Version: 2019/03/21 v1.1.1 +%% Version: 2019/11/20 v1.1.2 %% ------------------------------------------------------------------- %% Copyright (C) 2016-2019 by Zeping Lee <zepinglee AT gmail.com> %% ------------------------------------------------------------------- @@ -22,7 +22,7 @@ %% ------------------------------------------------------------------- \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{gbt7714} - [2019/03/21 v1.1.1 GB/T 7714-2015 BibTeX Style] + [2019/11/20 v1.1.2 GB/T 7714-2015 BibTeX Style] \newif\if@gbt@mmxv \newif\if@gbt@numerical \newif\if@gbt@super @@ -38,31 +38,31 @@ \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 + \@ifundefined{gbt@bib@#1}{% + \PackageError{gbt7714}{Invalid argument #1}{}% }{% - \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'.}% - }% + \@nameuse{gbt@bib@#1} }% } +\newcommand\gbt@bib@numerical{% + \if@gbt@mmxv + \bibliographystyle{gbt7714-unsrt}% + \else + \bibliographystyle{gbt7714-2005-unsrt}% + \fi +} +\newcommand\gbt@bib@authoryear{% + \if@gbt@mmxv + \bibliographystyle{gbt7714-plain}% + \else + \bibliographystyle{gbt7714-2005-plain}% + \fi +} \if@gbt@numerical \if@gbt@super \citestyle{super}% @@ -75,50 +75,196 @@ \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}} +\def\NAT@citexnum[#1][#2]#3{% + \NAT@reset@parser + \NAT@sort@cites{#3}% + \NAT@reset@citea + \@cite{\def\NAT@num{-1}\let\NAT@last@yr\relax\let\NAT@nm\@empty + \@for\@citeb:=\NAT@cite@list\do + {\@safe@activestrue + \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}% + \@safe@activesfalse + \@ifundefined{b@\@citeb\@extra@b@citeb}{% + {\reset@font\bfseries?} + \NAT@citeundefined\PackageWarning{natbib}% + {Citation `\@citeb' on page \thepage \space undefined}}% + {\let\NAT@last@num\NAT@num\let\NAT@last@nm\NAT@nm + \NAT@parse{\@citeb}% + \ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{% + \let\NAT@name=\NAT@all@names + \global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}% + \fi + \ifNAT@full\let\NAT@nm\NAT@all@names\else + \let\NAT@nm\NAT@name\fi + \ifNAT@swa + \@ifnum{\NAT@ctype>\@ne}{% + \@citea + \NAT@hyper@{\@ifnum{\NAT@ctype=\tw@}{\NAT@test{\NAT@ctype}}{\NAT@alias}}% + }{% + \@ifnum{\NAT@cmprs>\z@}{% + \NAT@ifcat@num\NAT@num + {\let\NAT@nm=\NAT@num}% + {\def\NAT@nm{-2}}% + \NAT@ifcat@num\NAT@last@num + {\@tempcnta=\NAT@last@num\relax}% + {\@tempcnta\m@ne}% + \@ifnum{\NAT@nm=\@tempcnta}{% + \@ifnum{\NAT@merge>\@ne}{}{\NAT@last@yr@mbox}% + }{% + \advance\@tempcnta by\@ne + \@ifnum{\NAT@nm=\@tempcnta}{% + % \ifx\NAT@last@yr\relax + % \def@NAT@last@yr{\@citea}% + % \else + % \def@NAT@last@yr{--\NAT@penalty}% + % \fi + \def@NAT@last@yr{-\NAT@penalty}% + }{% + \NAT@last@yr@mbox + }% + }% + }{% + \@tempswatrue + \@ifnum{\NAT@merge>\@ne}{\@ifnum{\NAT@last@num=\NAT@num\relax}{\@tempswafalse}{}}{}% + \if@tempswa\NAT@citea@mbox\fi + }% + }% + \NAT@def@citea + \else + \ifcase\NAT@ctype + \ifx\NAT@last@nm\NAT@nm \NAT@yrsep\NAT@penalty\NAT@space\else + \@citea \NAT@test{\@ne}\NAT@spacechar\NAT@mbox{\NAT@super@kern\NAT@@open}% + \fi + \if*#1*\else#1\NAT@spacechar\fi + \NAT@mbox{\NAT@hyper@{{\citenumfont{\NAT@num}}}}% + \NAT@def@citea@box + \or + \NAT@hyper@citea@space{\NAT@test{\NAT@ctype}}% + \or + \NAT@hyper@citea@space{\NAT@test{\NAT@ctype}}% + \or + \NAT@hyper@citea@space\NAT@alias + \fi + \fi + }% + }% + \@ifnum{\NAT@cmprs>\z@}{\NAT@last@yr}{}% + \ifNAT@swa\else + % \@ifnum{\NAT@ctype=\z@}{% + % \if*#2*\else\NAT@cmt#2\fi + % }{}% + \NAT@mbox{\NAT@@close}% + \@ifnum{\NAT@ctype=\z@}{% + \if*#2*\else\textsuperscript{#2}\fi + }{}% + \fi + }{#1}{#2}% +}% \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}} +\def\NAT@citex% + [#1][#2]#3{% + \NAT@reset@parser + \NAT@sort@cites{#3}% + \NAT@reset@citea + \@cite{\let\NAT@nm\@empty\let\NAT@year\@empty + \@for\@citeb:=\NAT@cite@list\do + {\@safe@activestrue + \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}% + \@safe@activesfalse + \@ifundefined{b@\@citeb\@extra@b@citeb}{\@citea% + {\reset@font\bfseries ?}\NAT@citeundefined + \PackageWarning{natbib}% + {Citation `\@citeb' on page \thepage \space undefined}\def\NAT@date{}}% + {\let\NAT@last@nm=\NAT@nm\let\NAT@last@yr=\NAT@year + \NAT@parse{\@citeb}% + \ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{% + \let\NAT@name=\NAT@all@names + \global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}% + \fi + \ifNAT@full\let\NAT@nm\NAT@all@names\else + \let\NAT@nm\NAT@name\fi + \ifNAT@swa\ifcase\NAT@ctype + \if\relax\NAT@date\relax + \@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}\NAT@date}% + \else + \ifx\NAT@last@nm\NAT@nm\NAT@yrsep + \ifx\NAT@last@yr\NAT@year + \def\NAT@temp{{?}}% + \ifx\NAT@temp\NAT@exlab\PackageWarningNoLine{natbib}% + {Multiple citation on page \thepage: same authors and + year\MessageBreak without distinguishing extra + letter,\MessageBreak appears as question mark}\fi + \NAT@hyper@{\NAT@exlab}% + \else\unskip\NAT@spacechar + \NAT@hyper@{\NAT@date}% + \fi + \else + \@citea\NAT@hyper@{% + \NAT@nmfmt{\NAT@nm}% + \hyper@natlinkbreak{% + \NAT@aysep\NAT@spacechar}{\@citeb\@extra@b@citeb + }% + \NAT@date + }% + \fi + \fi + \or\@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}% + \or\@citea\NAT@hyper@{\NAT@date}% + \or\@citea\NAT@hyper@{\NAT@alias}% + \fi \NAT@def@citea + \else + \ifcase\NAT@ctype + \if\relax\NAT@date\relax + \@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}% + \else + \ifx\NAT@last@nm\NAT@nm\NAT@yrsep + \ifx\NAT@last@yr\NAT@year + \def\NAT@temp{{?}}% + \ifx\NAT@temp\NAT@exlab\PackageWarningNoLine{natbib}% + {Multiple citation on page \thepage: same authors and + year\MessageBreak without distinguishing extra + letter,\MessageBreak appears as question mark}\fi + \NAT@hyper@{\NAT@exlab}% + \else + \unskip\NAT@spacechar + \NAT@hyper@{\NAT@date}% + \fi + \else + \@citea\NAT@hyper@{% + \NAT@nmfmt{\NAT@nm}% + \hyper@natlinkbreak{\NAT@spacechar\NAT@@open\if*#1*\else#1\NAT@spacechar\fi}% + {\@citeb\@extra@b@citeb}% + \NAT@date + }% + \fi + \fi + \or\@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}% + \or\@citea\NAT@hyper@{\NAT@date}% + \or\@citea\NAT@hyper@{\NAT@alias}% + \fi + \if\relax\NAT@date\relax + \NAT@def@citea + \else + \NAT@def@citea@close + \fi + \fi + }}\ifNAT@swa\else + % \if*#2*\else\NAT@cmt#2\fi + \if\relax\NAT@date\relax\else\NAT@@close\fi + \if*#2*\else\textsuperscript{#2}\fi + \fi}{#1}{#2}} \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\-} +\g@addto@macro\UrlBreaks{% + \do0\do1\do2\do3\do4\do5\do6\do7\do8\do9% + \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 +} \Urlmuskip=0mu plus 0.1mu |