diff options
author | Karl Berry <karl@freefriends.org> | 2015-07-26 22:51:41 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-07-26 22:51:41 +0000 |
commit | e61b053df8b7bc3dd892dc7ca61be49a83e1e7bc (patch) | |
tree | 29b6ec6b60433019604189aa8b01a55dd6b4979c /Master/texmf-dist/tex/latex/nmbib | |
parent | 7a88911ffe2801abc78f25c81f6b3cf2bc0c4b82 (diff) |
nmbib (26jul15)
git-svn-id: svn://tug.org/texlive/trunk@37964 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/nmbib')
-rw-r--r-- | Master/texmf-dist/tex/latex/nmbib/nmbib.sty | 438 |
1 files changed, 438 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/nmbib/nmbib.sty b/Master/texmf-dist/tex/latex/nmbib/nmbib.sty new file mode 100644 index 00000000000..cfe88b4eadf --- /dev/null +++ b/Master/texmf-dist/tex/latex/nmbib/nmbib.sty @@ -0,0 +1,438 @@ +%% +%% This is file `nmbib.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% nmbib.dtx (with options: `style') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from nmbib.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file nmbib.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +%% Copyright 2015, Michael Cohen <mcohen@u-aizu.ac.jp> +%% and Boris Veytsman <borisv@lk.net> +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any +%% later version. +%% The latest version of the license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2003/06/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Boris Veytsman +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{nmbib} +[2015/07/25 v1.03 Multibibliography support for LaTeX] +\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{natbib}} +\ProcessOptions\relax +\RequirePackage{natbib} +\def\NMBIB@types{timeline,sequence,authors} +\def\multibibliographyfilename#1#2{% + \expandafter\edef\csname NMBIB@#1@filename\endcsname{#2}} +\@onlypreamble{\multibibliographyfilename} +\@for\@tempa:=\NMBIB@types\do{% + \expandafter\multibibliographyfilename{\@tempa}{\jobname-\@tempa}} +\@for\@tempa:=\NMBIB@types\do{% + \expandafter\newwrite\csname NMBIB@\@tempa @aux\endcsname} +\AtBeginDocument{% + \if@filesw + \@for\@tempa:=\NMBIB@types\do{% + \immediate\openout\csname NMBIB@\@tempa @aux\endcsname + \csname NMBIB@\@tempa @filename\endcsname.aux + \immediate\write\csname NMBIB@\@tempa @aux\endcsname{\relax}}% + \fi} +\AtEndDocument{% + \if@filesw + \@for\@tempa:=\NMBIB@types\do{% + \immediate\closeout\csname NMBIB@\@tempa @aux\endcsname}% + \fi} +\def\multibibliographystyle#1#2{% + \ifx\@begindocumenthook\@undefined\else + \expandafter\AtBeginDocument + \fi + {\if@filesw + \immediate\write\csname NMBIB@#1@aux\endcsname{% + \string\bibstyle{#2}}% + \fi}} +\def\multibibliography#1{% + \ifx\@begindocumenthook\@undefined\else + \expandafter\AtBeginDocument + \fi + {\if@filesw + \@for\@tempa:=\NMBIB@types\do{% + \immediate\write\csname NMBIB@\@tempa @aux\endcsname + {\string\bibdata{#1}}}% + \fi}} +\def\nmbibBasetype#1{\gdef\NMBIB@bibcite@type{#1}} +\nmbibBasetype{sequence} +\@for\@tempa:=\NMBIB@types\do{% + \expandafter\edef\csname NMBIB@\@tempa + @cite@suffix\endcsname{\@tempa}} +\def\NMBIB@alias@cite@suffix{authors} +\def\nmbibRedirectLinks#1#2{% + \expandafter\edef\csname NMBIB@#1@cite@suffix\endcsname{#2}} +\def\NAT@set@cites{} +\let\@cite\NAT@cite +\let\@citex\NAT@citex +\let\@biblabel\NAT@biblabel +\let\@bibsetup\NAT@bibsetup +\let\NAT@space\NAT@spacechar +\let\NAT@penalty\@empty +\renewcommand\NAT@idxtxt{\NAT@name\NAT@spacechar\NAT@open\NAT@date\NAT@close} +\def\natexlab#1{#1} +\newif\ifNMBIB@printyearsuffix +\NMBIB@printyearsuffixtrue +\def\nmbibYearSuffixOn{\NMBIB@printyearsuffixtrue} +\def\nmbibYearSuffixOff{\NMBIB@printyearsuffixfalse} +\renewcommand\NAT@sort@cites[1]{% + \let\NAT@cite@list\@empty + \@for\@citeb:=#1\do{\expandafter\NAT@star@cite\@citeb\@@}% + \if@filesw + \@for\@tempa:=\NMBIB@types\do{% + \expandafter\immediate\expandafter\write\expandafter + \csname NMBIB@\@tempa @aux\endcsname + \expandafter{\expandafter\string\expandafter\citation\expandafter{\NAT@cite@list}}}% + \fi + \@ifnum{\NAT@sort>\z@}{% + \expandafter\NAT@sort@cites@\expandafter{\NAT@cite@list}% + }{}% +}% +\def\nmbibcitenumber#1#2{% + \@ifundefined{nmbib@num@#1\@extra@binfo}{\relax}{% + \NAT@citemultiple + \PackageWarningNoLine{natbib}{Citation `#1' multiply defined}% + }% + \global\@namedef{nmbib@num@#1\@extra@binfo}{#2}} +\AtEndDocument{\let\nmbibcitenumber\NMBIB@testnum} +\newcommand\NMBIB@testnum[2]{% + \def\NAT@temp{#2}% + \expandafter \ifx \csname nmbib@num@#1\@extra@binfo\endcsname\NAT@temp + \else + \ifNAT@swa \NAT@swafalse + \PackageWarningNoLine{natbib}{% + Citation(s) may have changed.\MessageBreak + Rerun to get citations correct% + }% + \fi + \fi +}% +\let\NAT@parse@orig=\NAT@parse\relax +\renewcommand\NAT@parse[1]{\NAT@parse@orig{#1}% + \@ifundefined{nmbib@num@#1\@extra@binfo}{\def\NAT@num{0}}{% + \edef\NAT@num{\csname nmbib@num@#1\@extra@binfo\endcsname}}} +\def\nmbibLink#1#2#3{% + \hyper@natlinkstart{#1\@extra@b@citeb-\csname + NMBIB@#2@cite@suffix\endcsname}#3\hyper@natlinkend} +\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 + \NMBIB@hyper@{alias}{\@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 + }{% + \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{\NMBIB@hyper@{sequence}{{\citenumfont{\NAT@num}}}}% + \NAT@def@citea@box + \or + \NMBIB@hyper@citea@space{sequence}{\NAT@test{\NAT@ctype}}% + \or + \NAT@hyper@citea@space{sequence}{\NAT@test{\NAT@ctype}}% + \or + \NAT@hyper@citea@space{alias}{\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}% + \fi + }{#1}{#2}% +}% +\def\NMBIB@hyper@#1#2{% + \nmbibLink{\@citeb}{#1}{#2}} +\def\NMBIB@hyper@citea#1#2{% + \@citea + \NMBIB@hyper@{#1}{#2}% + \NAT@def@citea +}% +\def\NMBIB@hyper@citea@space#1#2{% + \@citea + \NMBIB@hyper@{#1}{#2}% + \NAT@def@citea@space +}% +\def\def@NAT@last@yr#1{% + \protected@edef\NAT@last@yr{% + #1% + \noexpand\mbox{% + \noexpand\hyper@natlinkstart{\@citeb\@extra@b@citeb-\NMBIB@sequence@cite@suffix}% + {\noexpand\citenumfont{\NAT@num}}% + \noexpand\hyper@natlinkend + }% + }% +}% +\def\NAT@citea@mbox{% + \@citea\mbox{\NMBIB@hyper@{sequence}{{\citenumfont{\NAT@num}}}}% +}% +\def\NMBIB@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\NMBIB@hyper@{authors}{\NAT@nmfmt{\NAT@nm}}% + \NMBIB@hyper@{timeline}{\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 + \NMBIB@hyper@{timeline}{\NAT@exlab}% + \else\unskip\NAT@spacechar + \NMBIB@hyper@{timeline}{\NAT@date}% + \fi + \else + \@citea\NMBIB@hyper@{authors}{% + \NAT@nmfmt{\NAT@nm}% + \hyper@natlinkbreak{% + \NAT@aysep\NAT@spacechar}{\@citeb\@extra@b@citeb + }}% + \NMBIB@hyper@{timeline}{\NAT@date + }% + \fi + \fi + \or\@citea\NMBIB@hyper@{authors}{\NAT@nmfmt{\NAT@nm}}% + \or\@citea\NMBIB@hyper@{timeline}{\NAT@date}% + \or\@citea\NMBIB@hyper@{alias}{\NAT@alias}% + \fi \NAT@def@citea + \else + \ifcase\NAT@ctype + \if\relax\NAT@date\relax + \@citea\NMBIB@hyper@{authors}{\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 + \NMBIB@hyper@{timeline}{\NAT@exlab}% + \else + \unskip\NAT@spacechar + \NMBIB@hyper@{timeline}{\NAT@date}% + \fi + \else + \@citea\NMBIB@hyper@{authors}{% + \NAT@nmfmt{\NAT@nm}% + \hyper@natlinkbreak{\NAT@spacechar\NAT@@open\if*#1*\else#1\NAT@spacechar\fi}% + {\@citeb\@extra@b@citeb}}% + \NMBIB@hyper@{timeline}{\NAT@date + }% + \fi + \fi + \or\@citea\NMBIB@hyper@{authors}{\NAT@nmfmt{\NAT@nm}}% + \or\@citea\NMBIB@hyper@{timeline}{\NAT@date}% + \or\@citea\NMBIB@hyper@{alias}{\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\fi}{#1}{#2}} +\let\@citex\NMBIB@citex +\newcommand\citealn[1]{[\citenum{#1}]} +\def\nmbibSetCiteall#1{\def\NMBIB@citeallformat{#1}} +\nmbibSetCiteall{\nmbibLink{\nmbibKEY}{authors}{\nmbibNAME} % + (\nmbibLink{\nmbibKEY}{timeline}{\nmbibDATE}) % + [\nmbibLink{\nmbibKEY}{sequence}{\nmbibNUM}]} +\DeclareRobustCommand\citeall +{\begingroup\@ifnextchar*{\NAT@fulltrue\@citeall}{\NAT@fullfalse\@citeall*}} +\def\@citeall#1{\@ifnextchar[{\@@citeall}{\@@citeall[]}} +\def\@@citeall[#1]{\@ifnextchar[{\@@@citeall[#1]}{\@@@citeall[][#1]}} +\def\@@@citeall[#1][#2]#3{% + \NAT@reset@parser + \NAT@sort@cites{#3}% + \NAT@reset@citea + \@cite{% + \@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{}}% + {\NAT@parse{\@citeb}% + \ifNAT@full\let\NAT@nm\NAT@all@names\else + \let\NAT@nm\NAT@name\fi + \edef\nmbibKEY{\@citeb}% + \edef\nmbibDATE{\NAT@date}% + \edef\nmbibNAME{\NAT@nm}% + \edef\nmbibNUM{\NAT@num}% + \@citea\NMBIB@citeallformat + \def\@citea{; }% + }}\if*#2*\else\NAT@cmt#2\fi}{#1}{#2}} +\providecommand{\timelinerefname}{Chronological List of References} +\providecommand{\timelinebibname}{Chrolonlogical Bibliography} +\providecommand{\sequencerefname}{Sequential List of References} +\providecommand{\sequencebibname}{Sequential Bibliography} +\providecommand{\authorsrefname}{Alphabetic List of References} +\providecommand{\authorsbibname}{Alphabetic Bibliography} +\newif\ifNMBIB@writenumber +\NMBIB@writenumberfalse +\def\NMBIB@setup@authors{% + \NMBIB@writenumberfalse} +\let\NMBIB@setup@timeline\NMBIB@setup@authors +\def\NMBIB@setup@sequence{% + \NMBIB@writenumbertrue} +\def\printbibliography#1{% + \def\NMBIB@current@type{#1}% + \def\@biblabel{\csname NMBIB@#1@biblabel\endcsname} + \edef\NMBIB@current@cite@suffix{\csname NMBIB@#1@cite@suffix\endcsname}% + \csname NMBIB@setup@#1\endcsname + \ifx\NMBIB@current@type\NMBIB@bibcite@type + \def\natexlab@real##1{##1}% + \else + \def\natexlab@real##1{\NAT@exlab}% + \fi + \edef\refname{\csname #1refname\endcsname}% + \edef\bibname{\csname #1bibname\endcsname}% + \@input@{\csname NMBIB@#1@filename\endcsname.bbl}% + \def\natexlab##1{##1}} +\def\bibitem{\@ifnextchar[{\@@lbibitem}{\@@lbibitem[]}}% +\def\@@lbibitem[#1]#2{% + \let\natexlab\natexlab@real + \NAT@parse{#2}% + \def\nmbibKEY{#2}% + \edef\nmbibDATE{\NAT@date}% + \edef\nmbibNAME{\NAT@name}% + \edef\nmbibNUM{\NAT@num}% + \@lbibitem[#1]{#2}% + \ifNMBIB@printyearsuffix\else\def\natexlab##1{}\fi} +\providecommand\NAT@exlab{} +\renewcommand\NAT@wrout[5]{% +\if@filesw + \ifx\NMBIB@current@type\NMBIB@bibcite@type + {\let\protect\noexpand\let~\relax + \immediate + \write\@auxout{\string\bibcite{#5}{{#1}{#2}{{#3}}{{#4}}}}}\fi + \ifNMBIB@writenumber + {\let\protect\noexpand\let~\relax + \immediate + \write\@auxout{\string\nmbibcitenumber{#5}{#1}}}\fi +\fi +\ignorespaces} +\def\NAT@anchor#1#2{% + \hyper@natanchorstart{#1\@extra@b@citeb-\NMBIB@current@cite@suffix}% + \def\@tempa{#2}\@ifx{\@tempa\@empty}{}{\@biblabel{#2}}% + \hyper@natanchorend +}% +\def\nmbibSetBiblabel#1#2{% + \expandafter\def\csname NMBIB@#1@biblabel\endcsname##1{#2}} +\nmbibSetBiblabel{timeline}{[\nmbibDATE: + \nmbibLink{\nmbibKEY}{authors}{\nmbibNAME}; + \nmbibLink{\nmbibKEY}{sequence}{\nmbibNUM}]} +\nmbibSetBiblabel{authors}{[\nmbibNAME\ + (\nmbibLink{\nmbibKEY}{timeline}{\nmbibDATE}); + \nmbibLink{\nmbibKEY}{sequence}{\nmbibNUM}]} +\nmbibSetBiblabel{sequence}{[\nmbibNUM: + \nmbibLink{\nmbibKEY}{authors}{\nmbibNAME} + (\nmbibLink{\nmbibKEY}{timeline}{\nmbibDATE})]} +\endinput +%% +%% End of file `nmbib.sty'. |