summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/nmbib
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/nmbib
Initial commit
Diffstat (limited to 'macros/latex/contrib/nmbib')
-rw-r--r--macros/latex/contrib/nmbib/Makefile70
-rw-r--r--macros/latex/contrib/nmbib/README12
-rw-r--r--macros/latex/contrib/nmbib/chronoplainnm.bst1513
-rw-r--r--macros/latex/contrib/nmbib/nmbib.bib35
-rw-r--r--macros/latex/contrib/nmbib/nmbib.dtx1309
-rw-r--r--macros/latex/contrib/nmbib/nmbib.ins27
-rw-r--r--macros/latex/contrib/nmbib/nmbib.pdfbin0 -> 347244 bytes
-rw-r--r--macros/latex/contrib/nmbib/nmbibtex.1163
-rwxr-xr-xmacros/latex/contrib/nmbib/nmbibtex.pl120
-rw-r--r--macros/latex/contrib/nmbib/nmsample.pdfbin0 -> 96763 bytes
-rw-r--r--macros/latex/contrib/nmbib/nmsample.tex68
-rw-r--r--macros/latex/contrib/nmbib/plainnm.bst1429
-rw-r--r--macros/latex/contrib/nmbib/type.bib54
-rw-r--r--macros/latex/contrib/nmbib/unsrtnm.bst1316
14 files changed, 6116 insertions, 0 deletions
diff --git a/macros/latex/contrib/nmbib/Makefile b/macros/latex/contrib/nmbib/Makefile
new file mode 100644
index 0000000000..4b59427e24
--- /dev/null
+++ b/macros/latex/contrib/nmbib/Makefile
@@ -0,0 +1,70 @@
+#
+# Makefile for multibibliography package
+#
+# This file is in public domain
+#
+# $Id: Makefile,v 1.8 2015/04/27 19:29:03 boris Exp $
+#
+
+PACKAGE=nmbib
+SAMPLES = nmsample.tex
+
+PERLSCRIPTS = nmbibtex.pl
+
+MANPAGES = ${PERLSCRIPTS:%.pl=%.1}
+
+all: $(PACKAGE).pdf ${SAMPLES:%.tex=%.pdf} ${MANPAGES}
+ chmod a+x ${PERLSCRIPTS}
+
+%.pdf: %.dtx $(PACKAGE).sty
+ pdflatex $<
+ perl nmbibtex.pl $*
+ pdflatex $<
+ - makeindex -s gind.ist -o $*.ind $*.idx
+ - makeindex -s gglo.ist -o $*.gls $*.glo
+ pdflatex $<
+ while ( grep -q '^LaTeX Warning: Label(s) may have changed' $*.log) \
+ do pdflatex $<; done
+
+
+
+
+%.sty: %.ins %.dtx
+ pdflatex $<
+
+%.pdf: %.tex $(PACKAGE).sty
+ pdflatex $<
+ perl nmbibtex.pl $*
+ pdflatex $<
+ pdflatex $<
+ while ( grep -q '^LaTeX Warning: Label(s) may have changed' $*.log) \
+ do pdflatex $<; done
+
+
+.PRECIOUS: $(PACKAGE).cfg $(PACKAGE).sty
+
+%.1: %.pl
+ pod2man $< $@
+
+clean:
+ $(RM) $(PACKAGE).sty *.log *.aux \
+ *.cfg *.glo *.idx *.toc \
+ *.ilg *.ind *.out *.lof \
+ *.lot *.bbl *.blg *.gls *.hd \
+ *.dvi *.ps *.tgz *.zip *.brf
+
+veryclean: clean
+ $(RM) $(PACKAGE).pdf ${SAMPLES:%.tex=%.pdf} ${MANPAGES}
+
+distclean: veryclean
+
+#
+# Archive for the distribution. Includes typeset documentation
+#
+archive: all clean
+ tar -czvf $(PACKAGE).tgz -C .. --exclude '*~' --exclude '*.tgz' --exclude CVS $(PACKAGE)
+
+zip: all clean
+ ${MAKE} $(PACKAGE).sty
+ $(RM) *.log
+ zip -r $(PACKAGE).zip * -x '*~' -x '*.tgz' -x '*.zip' -x CVS -x 'CVS/*' \ No newline at end of file
diff --git a/macros/latex/contrib/nmbib/README b/macros/latex/contrib/nmbib/README
new file mode 100644
index 0000000000..833fa7992e
--- /dev/null
+++ b/macros/latex/contrib/nmbib/README
@@ -0,0 +1,12 @@
+ New Multibibliography Package
+ Michael Cohen and Boris Veytsman
+
+The nmbib package is a rewrite of multibiliography package providing
+multiple bibliographies with different sorting. The new version
+offers a number of citation commands, streamlines the creation of
+bibliographies, ensures the compatibility with natbib package and
+provides other improvments.
+
+Changes:
+
+ v1.04 An embarrassing typo corrected. \ No newline at end of file
diff --git a/macros/latex/contrib/nmbib/chronoplainnm.bst b/macros/latex/contrib/nmbib/chronoplainnm.bst
new file mode 100644
index 0000000000..5ce90c8836
--- /dev/null
+++ b/macros/latex/contrib/nmbib/chronoplainnm.bst
@@ -0,0 +1,1513 @@
+%% File chronoplainn.bst.
+%% Based on plainnat.bst by Patric W. Daly
+%%
+%% 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.
+%%
+%%
+%%
+%% ORIGINAL COPYRIGHT STATEMENT
+%%
+%% Copyright 1993-2007 Patrick W Daly
+%% Max-Planck-Institut f\"ur Sonnensystemforschung
+%% Max-Planck-Str. 2
+%% D-37191 Katlenburg-Lindau
+%% Germany
+%% E-mail: daly@mps.mpg.de
+%%
+%% This program can be redistributed and/or modified under the terms
+%% of the LaTeX Project Public License Distributed from CTAN
+%% archives in directory macros/latex/base/lppl.txt; either
+%% version 1 of the License, or any later version.
+%%
+%% END ORIGINAL COPYRIGHT STATEMENT
+%%
+%%
+%%
+ENTRY
+ { address
+ author
+ booktitle
+ chapter
+ day
+ doi
+ eid
+ edition
+ editor
+ howpublished
+ institution
+ isbn
+ issn
+ journal
+ key
+ month
+ note
+ number
+ organization
+ pages
+ publisher
+ school
+ series
+ title
+ type
+ url
+ volume
+ year
+ }
+ {}
+ { label extra.label sort.label short.list }
+
+INTEGERS { output.state before.all mid.sentence after.sentence after.block }
+
+FUNCTION {init.state.consts}
+{ #0 'before.all :=
+ #1 'mid.sentence :=
+ #2 'after.sentence :=
+ #3 'after.block :=
+}
+
+STRINGS { s t }
+
+FUNCTION {output.nonnull}
+{ 's :=
+ output.state mid.sentence =
+ { ", " * write$ }
+ { output.state after.block =
+ { add.period$ write$
+ newline$
+ "\newblock " write$
+ }
+ { output.state before.all =
+ 'write$
+ { add.period$ " " * write$ }
+ if$
+ }
+ if$
+ mid.sentence 'output.state :=
+ }
+ if$
+ s
+}
+
+FUNCTION {output}
+{ duplicate$ empty$
+ 'pop$
+ 'output.nonnull
+ if$
+}
+
+FUNCTION {output.check}
+{ 't :=
+ duplicate$ empty$
+ { pop$ "empty " t * " in " * cite$ * warning$ }
+ 'output.nonnull
+ if$
+}
+
+
+
+FUNCTION {fin.entry}
+{ add.period$
+ write$
+ newline$
+}
+
+FUNCTION {new.block}
+{ output.state before.all =
+ 'skip$
+ { after.block 'output.state := }
+ if$
+}
+
+FUNCTION {new.sentence}
+{ output.state after.block =
+ 'skip$
+ { output.state before.all =
+ 'skip$
+ { after.sentence 'output.state := }
+ if$
+ }
+ if$
+}
+
+FUNCTION {not}
+{ { #0 }
+ { #1 }
+ if$
+}
+
+FUNCTION {and}
+{ 'skip$
+ { pop$ #0 }
+ if$
+}
+
+FUNCTION {or}
+{ { pop$ #1 }
+ 'skip$
+ if$
+}
+
+FUNCTION {new.block.checka}
+{ empty$
+ 'skip$
+ 'new.block
+ if$
+}
+
+FUNCTION {new.block.checkb}
+{ empty$
+ swap$ empty$
+ and
+ 'skip$
+ 'new.block
+ if$
+}
+
+FUNCTION {new.sentence.checka}
+{ empty$
+ 'skip$
+ 'new.sentence
+ if$
+}
+
+FUNCTION {new.sentence.checkb}
+{ empty$
+ swap$ empty$
+ and
+ 'skip$
+ 'new.sentence
+ if$
+}
+
+FUNCTION {field.or.null}
+{ duplicate$ empty$
+ { pop$ "" }
+ 'skip$
+ if$
+}
+
+FUNCTION {emphasize}
+{ duplicate$ empty$
+ { pop$ "" }
+ { "\emph{" swap$ * "}" * }
+ if$
+}
+
+INTEGERS { nameptr namesleft numnames }
+
+FUNCTION {format.names}
+{ 's :=
+ #1 'nameptr :=
+ s num.names$ 'numnames :=
+ numnames 'namesleft :=
+ { namesleft #0 > }
+ { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
+ nameptr #1 >
+ { namesleft #1 >
+ { ", " * t * }
+ { numnames #2 >
+ { "," * }
+ 'skip$
+ if$
+ t "others" =
+ { " et~al." * }
+ { " and " * t * }
+ if$
+ }
+ if$
+ }
+ 't
+ if$
+ nameptr #1 + 'nameptr :=
+ namesleft #1 - 'namesleft :=
+ }
+ while$
+ "\nmbibLink{" cite$ * "}{authors}{" * swap$ * "}" *
+}
+
+FUNCTION {format.key}
+{ empty$
+ { key field.or.null }
+ { "" }
+ if$
+}
+
+FUNCTION {format.authors}
+{ author empty$
+ { "" }
+ { author format.names }
+ if$
+}
+
+FUNCTION {format.editors}
+{ editor empty$
+ { "" }
+ { editor format.names
+ editor num.names$ #1 >
+ { ", editors" * }
+ { ", editor" * }
+ if$
+ }
+ if$
+}
+
+FUNCTION {format.isbn}
+{ isbn empty$
+ { "" }
+ { new.block "ISBN " isbn * }
+ if$
+}
+
+FUNCTION {format.issn}
+{ issn empty$
+ { "" }
+ { new.block "ISSN " issn * }
+ if$
+}
+
+FUNCTION {format.url}
+{ url empty$
+ { "" }
+ { new.block "URL \url{" url * "}" * }
+ if$
+}
+
+FUNCTION {format.doi}
+{ doi empty$
+ { "" }
+ { new.block "\doi{" doi * "}" * }
+ if$
+}
+
+FUNCTION {format.title}
+{ title empty$
+ { "" }
+ { title "t" change.case$ }
+ if$
+}
+
+FUNCTION {format.full.names}
+{'s :=
+ #1 'nameptr :=
+ s num.names$ 'numnames :=
+ numnames 'namesleft :=
+ { namesleft #0 > }
+ { s nameptr
+ "{vv~}{ll}" format.name$ 't :=
+ nameptr #1 >
+ {
+ namesleft #1 >
+ { ", " * t * }
+ {
+ numnames #2 >
+ { "," * }
+ 'skip$
+ if$
+ t "others" =
+ { " et~al." * }
+ { " and " * t * }
+ if$
+ }
+ if$
+ }
+ 't
+ if$
+ nameptr #1 + 'nameptr :=
+ namesleft #1 - 'namesleft :=
+ }
+ while$
+}
+
+FUNCTION {author.editor.full}
+{ author empty$
+ { editor empty$
+ { "" }
+ { editor format.full.names }
+ if$
+ }
+ { author format.full.names }
+ if$
+}
+
+FUNCTION {author.full}
+{ author empty$
+ { "" }
+ { author format.full.names }
+ if$
+}
+
+FUNCTION {editor.full}
+{ editor empty$
+ { "" }
+ { editor format.full.names }
+ if$
+}
+
+FUNCTION {make.full.names}
+{ type$ "book" =
+ type$ "inbook" =
+ or
+ 'author.editor.full
+ { type$ "proceedings" =
+ 'editor.full
+ 'author.full
+ if$
+ }
+ if$
+}
+
+FUNCTION {output.bibitem}
+{ newline$
+ "\bibitem[" write$
+ label write$
+ ")" make.full.names duplicate$ short.list =
+ { pop$ }
+ { * }
+ if$
+ "]{" * write$
+ cite$ write$
+ "}" write$
+ newline$
+ ""
+ before.all 'output.state :=
+}
+
+FUNCTION {n.dashify}
+{ 't :=
+ ""
+ { t empty$ not }
+ { t #1 #1 substring$ "-" =
+ { t #1 #2 substring$ "--" = not
+ { "--" *
+ t #2 global.max$ substring$ 't :=
+ }
+ { { t #1 #1 substring$ "-" = }
+ { "-" *
+ t #2 global.max$ substring$ 't :=
+ }
+ while$
+ }
+ if$
+ }
+ { t #1 #1 substring$ *
+ t #2 global.max$ substring$ 't :=
+ }
+ if$
+ }
+ while$
+}
+
+FUNCTION {format.date}
+{ year duplicate$ empty$
+ { "empty year in " cite$ * warning$
+ pop$ "" }
+ 'skip$
+ if$
+ month empty$
+ 'skip$
+ { month
+ " " * swap$ *
+ }
+ if$
+ extra.label *
+}
+
+FUNCTION {format.btitle}
+{ title emphasize
+}
+
+FUNCTION {tie.or.space.connect}
+{ duplicate$ text.length$ #3 <
+ { "~" }
+ { " " }
+ if$
+ swap$ * *
+}
+
+FUNCTION {either.or.check}
+{ empty$
+ 'pop$
+ { "can't use both " swap$ * " fields in " * cite$ * warning$ }
+ if$
+}
+
+FUNCTION {format.bvolume}
+{ volume empty$
+ { "" }
+ { "volume" volume tie.or.space.connect
+ series empty$
+ 'skip$
+ { " of " * series emphasize * }
+ if$
+ "volume and number" number either.or.check
+ }
+ if$
+}
+
+FUNCTION {format.number.series}
+{ volume empty$
+ { number empty$
+ { series field.or.null }
+ { output.state mid.sentence =
+ { "number" }
+ { "Number" }
+ if$
+ number tie.or.space.connect
+ series empty$
+ { "there's a number but no series in " cite$ * warning$ }
+ { " in " * series * }
+ if$
+ }
+ if$
+ }
+ { "" }
+ if$
+}
+
+FUNCTION {format.edition}
+{ edition empty$
+ { "" }
+ { output.state mid.sentence =
+ { edition "l" change.case$ " edition" * }
+ { edition "t" change.case$ " edition" * }
+ if$
+ }
+ if$
+}
+
+INTEGERS { multiresult }
+
+FUNCTION {multi.page.check}
+{ 't :=
+ #0 'multiresult :=
+ { multiresult not
+ t empty$ not
+ and
+ }
+ { t #1 #1 substring$
+ duplicate$ "-" =
+ swap$ duplicate$ "," =
+ swap$ "+" =
+ or or
+ { #1 'multiresult := }
+ { t #2 global.max$ substring$ 't := }
+ if$
+ }
+ while$
+ multiresult
+}
+
+FUNCTION {format.pages}
+{ pages empty$
+ { "" }
+ { pages multi.page.check
+ { "pages" pages n.dashify tie.or.space.connect }
+ { "page" pages tie.or.space.connect }
+ if$
+ }
+ if$
+}
+
+FUNCTION {format.eid}
+{ eid empty$
+ { "" }
+ { "art." eid tie.or.space.connect }
+ if$
+}
+
+FUNCTION {format.vol.num.pages}
+{ volume field.or.null
+ number empty$
+ 'skip$
+ { "\penalty0 (" number * ")" * *
+ volume empty$
+ { "there's a number but no volume in " cite$ * warning$ }
+ 'skip$
+ if$
+ }
+ if$
+ pages empty$
+ 'skip$
+ { duplicate$ empty$
+ { pop$ format.pages }
+ { ":\penalty0 " * pages n.dashify * }
+ if$
+ }
+ if$
+}
+
+FUNCTION {format.vol.num.eid}
+{ volume field.or.null
+ number empty$
+ 'skip$
+ { "\penalty0 (" number * ")" * *
+ volume empty$
+ { "there's a number but no volume in " cite$ * warning$ }
+ 'skip$
+ if$
+ }
+ if$
+ eid empty$
+ 'skip$
+ { duplicate$ empty$
+ { pop$ format.eid }
+ { ":\penalty0 " * eid * }
+ if$
+ }
+ if$
+}
+
+FUNCTION {format.chapter.pages}
+{ chapter empty$
+ 'format.pages
+ { type empty$
+ { "chapter" }
+ { type "l" change.case$ }
+ if$
+ chapter tie.or.space.connect
+ pages empty$
+ 'skip$
+ { ", " * format.pages * }
+ if$
+ }
+ if$
+}
+
+FUNCTION {format.in.ed.booktitle}
+{ booktitle empty$
+ { "" }
+ { editor empty$
+ { "In " booktitle emphasize * }
+ { "In " format.editors * ", " * booktitle emphasize * }
+ if$
+ }
+ if$
+}
+
+FUNCTION {empty.misc.check}
+{ author empty$ title empty$ howpublished empty$
+ month empty$ year empty$ note empty$
+ and and and and and
+ key empty$ not and
+ { "all relevant fields are empty in " cite$ * warning$ }
+ 'skip$
+ if$
+}
+
+FUNCTION {format.thesis.type}
+{ type empty$
+ 'skip$
+ { pop$
+ type "t" change.case$
+ }
+ if$
+}
+
+FUNCTION {format.tr.number}
+{ type empty$
+ { "Technical Report" }
+ 'type
+ if$
+ number empty$
+ { "t" change.case$ }
+ { number tie.or.space.connect }
+ if$
+}
+
+FUNCTION {format.article.crossref}
+{ key empty$
+ { journal empty$
+ { "need key or journal for " cite$ * " to crossref " * crossref *
+ warning$
+ ""
+ }
+ { "In \emph{" journal * "}" * }
+ if$
+ }
+ { "In " }
+ if$
+ " \citet{" * crossref * "}" *
+}
+
+FUNCTION {format.book.crossref}
+{ volume empty$
+ { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
+ "In "
+ }
+ { "Volume" volume tie.or.space.connect
+ " of " *
+ }
+ if$
+ editor empty$
+ editor field.or.null author field.or.null =
+ or
+ { key empty$
+ { series empty$
+ { "need editor, key, or series for " cite$ * " to crossref " *
+ crossref * warning$
+ "" *
+ }
+ { "\emph{" * series * "}" * }
+ if$
+ }
+ 'skip$
+ if$
+ }
+ 'skip$
+ if$
+ " \citet{" * crossref * "}" *
+}
+
+FUNCTION {format.incoll.inproc.crossref}
+{ editor empty$
+ editor field.or.null author field.or.null =
+ or
+ { key empty$
+ { booktitle empty$
+ { "need editor, key, or booktitle for " cite$ * " to crossref " *
+ crossref * warning$
+ ""
+ }
+ { "In \emph{" booktitle * "}" * }
+ if$
+ }
+ { "In " }
+ if$
+ }
+ { "In " }
+ if$
+ " \citet{" * crossref * "}" *
+}
+
+FUNCTION {article}
+{ output.bibitem
+ format.authors "author" output.check
+ author format.key output
+ new.block
+ format.title "title" output.check
+ new.block
+ crossref missing$
+ { journal emphasize "journal" output.check
+ eid empty$
+ { format.vol.num.pages output }
+ { format.vol.num.eid output }
+ if$
+ format.date "year" output.check
+ }
+ { format.article.crossref output.nonnull
+ eid empty$
+ { format.pages output }
+ { format.eid output }
+ if$
+ }
+ if$
+ format.issn output
+ format.doi output
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {book}
+{ output.bibitem
+ author empty$
+ { format.editors "author and editor" output.check
+ editor format.key output
+ }
+ { format.authors output.nonnull
+ crossref missing$
+ { "author and editor" editor either.or.check }
+ 'skip$
+ if$
+ }
+ if$
+ new.block
+ format.btitle "title" output.check
+ crossref missing$
+ { format.bvolume output
+ new.block
+ format.number.series output
+ new.sentence
+ publisher "publisher" output.check
+ address output
+ }
+ { new.block
+ format.book.crossref output.nonnull
+ }
+ if$
+ format.edition output
+ format.date "year" output.check
+ format.isbn output
+ format.doi output
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {booklet}
+{ output.bibitem
+ format.authors output
+ author format.key output
+ new.block
+ format.title "title" output.check
+ howpublished address new.block.checkb
+ howpublished output
+ address output
+ format.date output
+ format.isbn output
+ format.doi output
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {inbook}
+{ output.bibitem
+ author empty$
+ { format.editors "author and editor" output.check
+ editor format.key output
+ }
+ { format.authors output.nonnull
+ crossref missing$
+ { "author and editor" editor either.or.check }
+ 'skip$
+ if$
+ }
+ if$
+ new.block
+ format.btitle "title" output.check
+ crossref missing$
+ { format.bvolume output
+ format.chapter.pages "chapter and pages" output.check
+ new.block
+ format.number.series output
+ new.sentence
+ publisher "publisher" output.check
+ address output
+ }
+ { format.chapter.pages "chapter and pages" output.check
+ new.block
+ format.book.crossref output.nonnull
+ }
+ if$
+ format.edition output
+ format.date "year" output.check
+ format.isbn output
+ format.doi output
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {incollection}
+{ output.bibitem
+ format.authors "author" output.check
+ author format.key output
+ new.block
+ format.title "title" output.check
+ new.block
+ crossref missing$
+ { format.in.ed.booktitle "booktitle" output.check
+ format.bvolume output
+ format.number.series output
+ format.chapter.pages output
+ new.sentence
+ publisher "publisher" output.check
+ address output
+ format.edition output
+ format.date "year" output.check
+ }
+ { format.incoll.inproc.crossref output.nonnull
+ format.chapter.pages output
+ }
+ if$
+ format.isbn output
+ format.doi output
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {inproceedings}
+{ output.bibitem
+ format.authors "author" output.check
+ author format.key output
+ new.block
+ format.title "title" output.check
+ new.block
+ crossref missing$
+ { format.in.ed.booktitle "booktitle" output.check
+ format.bvolume output
+ format.number.series output
+ format.pages output
+ address empty$
+ { organization publisher new.sentence.checkb
+ organization output
+ publisher output
+ format.date "year" output.check
+ }
+ { address output.nonnull
+ format.date "year" output.check
+ new.sentence
+ organization output
+ publisher output
+ }
+ if$
+ }
+ { format.incoll.inproc.crossref output.nonnull
+ format.pages output
+ }
+ if$
+ format.isbn output
+ format.doi output
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {conference} { inproceedings }
+
+FUNCTION {manual}
+{ output.bibitem
+ format.authors output
+ author format.key output
+ new.block
+ format.btitle "title" output.check
+ organization address new.block.checkb
+ organization output
+ address output
+ format.edition output
+ format.date output
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {mastersthesis}
+{ output.bibitem
+ format.authors "author" output.check
+ author format.key output
+ new.block
+ format.title "title" output.check
+ new.block
+ "Master's thesis" format.thesis.type output.nonnull
+ school "school" output.check
+ address output
+ format.date "year" output.check
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {misc}
+{ output.bibitem
+ format.authors output
+ author format.key output
+ title howpublished new.block.checkb
+ format.title output
+ howpublished new.block.checka
+ howpublished output
+ format.date output
+ format.issn output
+ format.url output
+ new.block
+ note output
+ fin.entry
+ empty.misc.check
+}
+
+FUNCTION {phdthesis}
+{ output.bibitem
+ format.authors "author" output.check
+ author format.key output
+ new.block
+ format.btitle "title" output.check
+ new.block
+ "PhD thesis" format.thesis.type output.nonnull
+ school "school" output.check
+ address output
+ format.date "year" output.check
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {proceedings}
+{ output.bibitem
+ format.editors output
+ editor format.key output
+ new.block
+ format.btitle "title" output.check
+ format.bvolume output
+ format.number.series output
+ address output
+ format.date "year" output.check
+ new.sentence
+ organization output
+ publisher output
+ format.isbn output
+ format.doi output
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {techreport}
+{ output.bibitem
+ format.authors "author" output.check
+ author format.key output
+ new.block
+ format.title "title" output.check
+ new.block
+ format.tr.number output.nonnull
+ institution "institution" output.check
+ address output
+ format.date "year" output.check
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {unpublished}
+{ output.bibitem
+ format.authors "author" output.check
+ author format.key output
+ new.block
+ format.title "title" output.check
+ new.block
+ note "note" output.check
+ format.date output
+ format.url output
+ fin.entry
+}
+
+FUNCTION {default.type} { misc }
+
+
+MACRO {jan} {"January"}
+
+MACRO {feb} {"February"}
+
+MACRO {mar} {"March"}
+
+MACRO {apr} {"April"}
+
+MACRO {may} {"May"}
+
+MACRO {jun} {"June"}
+
+MACRO {jul} {"July"}
+
+MACRO {aug} {"August"}
+
+MACRO {sep} {"September"}
+
+MACRO {oct} {"October"}
+
+MACRO {nov} {"November"}
+
+MACRO {dec} {"December"}
+
+
+
+MACRO {acmcs} {"ACM Computing Surveys"}
+
+MACRO {acta} {"Acta Informatica"}
+
+MACRO {cacm} {"Communications of the ACM"}
+
+MACRO {ibmjrd} {"IBM Journal of Research and Development"}
+
+MACRO {ibmsj} {"IBM Systems Journal"}
+
+MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
+
+MACRO {ieeetc} {"IEEE Transactions on Computers"}
+
+MACRO {ieeetcad}
+ {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
+
+MACRO {ipl} {"Information Processing Letters"}
+
+MACRO {jacm} {"Journal of the ACM"}
+
+MACRO {jcss} {"Journal of Computer and System Sciences"}
+
+MACRO {scp} {"Science of Computer Programming"}
+
+MACRO {sicomp} {"SIAM Journal on Computing"}
+
+MACRO {tocs} {"ACM Transactions on Computer Systems"}
+
+MACRO {tods} {"ACM Transactions on Database Systems"}
+
+MACRO {tog} {"ACM Transactions on Graphics"}
+
+MACRO {toms} {"ACM Transactions on Mathematical Software"}
+
+MACRO {toois} {"ACM Transactions on Office Information Systems"}
+
+MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
+
+MACRO {tcs} {"Theoretical Computer Science"}
+
+
+READ
+
+FUNCTION {sortify}
+{ purify$
+ "l" change.case$
+}
+
+INTEGERS { len }
+
+FUNCTION {chop.word}
+{ 's :=
+ 'len :=
+ s #1 len substring$ =
+ { s len #1 + global.max$ substring$ }
+ 's
+ if$
+}
+
+FUNCTION {format.lab.names}
+{ 's :=
+ s #1 "{vv~}{ll}" format.name$
+ s num.names$ duplicate$
+ #2 >
+ { pop$ " et~al." * }
+ { #2 <
+ 'skip$
+ { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
+ { " et~al." * }
+ { " and " * s #2 "{vv~}{ll}" format.name$ * }
+ if$
+ }
+ if$
+ }
+ if$
+}
+
+FUNCTION {author.key.label}
+{ author empty$
+ { key empty$
+ { cite$ #1 #3 substring$ }
+ 'key
+ if$
+ }
+ { author format.lab.names }
+ if$
+}
+
+FUNCTION {author.editor.key.label}
+{ author empty$
+ { editor empty$
+ { key empty$
+ { cite$ #1 #3 substring$ }
+ 'key
+ if$
+ }
+ { editor format.lab.names }
+ if$
+ }
+ { author format.lab.names }
+ if$
+}
+
+FUNCTION {author.key.organization.label}
+{ author empty$
+ { key empty$
+ { organization empty$
+ { cite$ #1 #3 substring$ }
+ { "The " #4 organization chop.word #3 text.prefix$ }
+ if$
+ }
+ 'key
+ if$
+ }
+ { author format.lab.names }
+ if$
+}
+
+FUNCTION {editor.key.organization.label}
+{ editor empty$
+ { key empty$
+ { organization empty$
+ { cite$ #1 #3 substring$ }
+ { "The " #4 organization chop.word #3 text.prefix$ }
+ if$
+ }
+ 'key
+ if$
+ }
+ { editor format.lab.names }
+ if$
+}
+
+FUNCTION {calc.short.authors}
+{ type$ "book" =
+ type$ "inbook" =
+ or
+ 'author.editor.key.label
+ { type$ "proceedings" =
+ 'editor.key.organization.label
+ { type$ "manual" =
+ 'author.key.organization.label
+ 'author.key.label
+ if$
+ }
+ if$
+ }
+ if$
+ 'short.list :=
+}
+
+FUNCTION {calc.label}
+{ calc.short.authors
+ short.list
+ "("
+ *
+ year duplicate$ empty$
+ short.list key field.or.null = or
+ { pop$ "" }
+ 'skip$
+ if$
+ *
+ 'label :=
+}
+
+FUNCTION {sort.format.names}
+{ 's :=
+ #1 'nameptr :=
+ ""
+ s num.names$ 'numnames :=
+ numnames 'namesleft :=
+ { namesleft #0 > }
+ {
+ s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't :=
+ nameptr #1 >
+ {
+ " " *
+ namesleft #1 = t "others" = and
+ { "zzzzz" * }
+ { numnames #2 > nameptr #2 = and
+ { "zz" * year field.or.null * " " * }
+ 'skip$
+ if$
+ t sortify *
+ }
+ if$
+ }
+ { t sortify * }
+ if$
+ nameptr #1 + 'nameptr :=
+ namesleft #1 - 'namesleft :=
+ }
+ while$
+}
+
+FUNCTION {sort.format.title}
+{ 't :=
+ "A " #2
+ "An " #3
+ "The " #4 t chop.word
+ chop.word
+ chop.word
+ sortify
+ #1 global.max$ substring$
+}
+
+FUNCTION {author.sort}
+{ author empty$
+ { key empty$
+ { "to sort, need author or key in " cite$ * warning$
+ ""
+ }
+ { key sortify }
+ if$
+ }
+ { author sort.format.names }
+ if$
+}
+
+FUNCTION {author.editor.sort}
+{ author empty$
+ { editor empty$
+ { key empty$
+ { "to sort, need author, editor, or key in " cite$ * warning$
+ ""
+ }
+ { key sortify }
+ if$
+ }
+ { editor sort.format.names }
+ if$
+ }
+ { author sort.format.names }
+ if$
+}
+
+FUNCTION {author.organization.sort}
+{ author empty$
+ { organization empty$
+ { key empty$
+ { "to sort, need author, organization, or key in " cite$ * warning$
+ ""
+ }
+ { key sortify }
+ if$
+ }
+ { "The " #4 organization chop.word sortify }
+ if$
+ }
+ { author sort.format.names }
+ if$
+}
+
+FUNCTION {editor.organization.sort}
+{ editor empty$
+ { organization empty$
+ { key empty$
+ { "to sort, need editor, organization, or key in " cite$ * warning$
+ ""
+ }
+ { key sortify }
+ if$
+ }
+ { "The " #4 organization chop.word sortify }
+ if$
+ }
+ { editor sort.format.names }
+ if$
+}
+
+
+% Convert month to its number
+STRINGS { month.str }
+FUNCTION { month.to.num }
+{
+ #3 text.prefix$
+ "l" change.case$
+ "00" 'month.str :=
+ duplicate$ "jan" =
+ { "01" 'month.str := }
+ 'skip$
+ if$
+ duplicate$ "feb" =
+ { "02" 'month.str := }
+ 'skip$
+ if$
+ duplicate$ "mar" =
+ { "03" 'month.str := }
+ 'skip$
+ if$
+ duplicate$ "apr" =
+ { "04" 'month.str := }
+ 'skip$
+ if$
+ duplicate$ "may" =
+ { "05" 'month.str := }
+ 'skip$
+ if$
+ duplicate$ "jun" =
+ { "06" 'month.str := }
+ 'skip$
+ if$
+ duplicate$ "jul" =
+ { "07" 'month.str := }
+ 'skip$
+ if$
+ duplicate$ "aug" =
+ { "08" 'month.str := }
+ 'skip$
+ if$
+ duplicate$ "sep" =
+ { "09" 'month.str := }
+ 'skip$
+ if$
+ duplicate$ "oct" =
+ { "10" 'month.str := }
+ 'skip$
+ if$
+ duplicate$ "nov" =
+ { "11" 'month.str := }
+ 'skip$
+ if$
+ "dec" =
+ { "12" 'month.str := }
+ 'skip$
+ if$
+ month.str
+}
+
+
+% Timeline prefix in the form YYYYMM
+FUNCTION { timeline.prefix }
+{
+ "0000"
+ year field.or.null *
+ #-1
+ #4
+ substring$
+ month empty$
+ { "00" }
+ { month month.to.num }
+ if$
+ *
+ "00"
+ day field.or.null *
+ #-1
+ #2
+ substring$
+ *
+}
+
+FUNCTION {presort}
+{ calc.label
+ label sortify
+ " "
+ *
+ type$ "book" =
+ type$ "inbook" =
+ or
+ 'author.editor.sort
+ { type$ "proceedings" =
+ 'editor.organization.sort
+ { type$ "manual" =
+ 'author.organization.sort
+ 'author.sort
+ if$
+ }
+ if$
+ }
+ if$
+ timeline.prefix
+ " " *
+ swap$ *
+ " "
+ *
+ year field.or.null sortify
+ *
+ " "
+ *
+ cite$
+ *
+ #1 entry.max$ substring$
+ 'sort.label :=
+ sort.label *
+ #1 entry.max$ substring$
+ 'sort.key$ :=
+}
+
+ITERATE {presort}
+
+SORT
+
+STRINGS { longest.label last.label next.extra }
+
+INTEGERS { longest.label.width last.extra.num number.label }
+
+FUNCTION {initialize.longest.label}
+{ "" 'longest.label :=
+ #0 int.to.chr$ 'last.label :=
+ "" 'next.extra :=
+ #0 'longest.label.width :=
+ #0 'last.extra.num :=
+ #0 'number.label :=
+}
+
+FUNCTION {forward.pass}
+{ last.label label =
+ { last.extra.num #1 + 'last.extra.num :=
+ last.extra.num int.to.chr$ 'extra.label :=
+ }
+ { "a" chr.to.int$ 'last.extra.num :=
+ "" 'extra.label :=
+ label 'last.label :=
+ }
+ if$
+ number.label #1 + 'number.label :=
+}
+
+FUNCTION {reverse.pass}
+{ next.extra "b" =
+ { "a" 'extra.label := }
+ 'skip$
+ if$
+ extra.label 'next.extra :=
+ extra.label
+ duplicate$ empty$
+ 'skip$
+ { "{\natexlab{" swap$ * "}}" * }
+ if$
+ 'extra.label :=
+ label extra.label * 'label :=
+}
+
+EXECUTE {initialize.longest.label}
+
+ITERATE {forward.pass}
+
+REVERSE {reverse.pass}
+
+FUNCTION {bib.sort.order}
+{ sort.label 'sort.key$ :=
+}
+
+ITERATE {bib.sort.order}
+
+SORT
+
+FUNCTION {begin.bib}
+{ preamble$ empty$
+ 'skip$
+ { preamble$ write$ newline$ }
+ if$
+ "\begin{thebibliography}{" number.label int.to.str$ * "}" *
+ write$ newline$
+ "\providecommand{\natexlab}[1]{#1}"
+ write$ newline$
+ "\providecommand{\url}[1]{\texttt{#1}}"
+ write$ newline$
+ "\expandafter\ifx\csname urlstyle\endcsname\relax"
+ write$ newline$
+ " \providecommand{\doi}[1]{doi: #1}\else"
+ write$ newline$
+ " \providecommand{\doi}{doi: \begingroup \urlstyle{rm}\Url}\fi"
+ write$ newline$
+ " \providecommand{\nmbibLink}[3]{#3}"
+ write$ newline$
+}
+
+EXECUTE {begin.bib}
+
+EXECUTE {init.state.consts}
+
+ITERATE {call.type$}
+
+FUNCTION {end.bib}
+{ newline$
+ "\end{thebibliography}" write$ newline$
+}
+
+EXECUTE {end.bib}
diff --git a/macros/latex/contrib/nmbib/nmbib.bib b/macros/latex/contrib/nmbib/nmbib.bib
new file mode 100644
index 0000000000..c98b87240e
--- /dev/null
+++ b/macros/latex/contrib/nmbib/nmbib.bib
@@ -0,0 +1,35 @@
+@Manual{Multibibliography,
+ title = {The {M}ultibiliography package},
+ author = {Michael Cohen and Yannis Haralambous and Boris Veytsman},
+ month = {March},
+ year = 2013,
+ note = {\url{http://www.ctan.org/pkg/multibibliography}}
+}
+
+@Article{Multibibliography13,
+ author = {Michael Cohen and Yannis Haralambous and Boris Veytsman},
+ title = {The multibibliography package},
+ journal = {TUGboat},
+ year = 2013,
+ volume = 34,
+ number = 3,
+ pages = {340--343},
+ note = {\url{https://www.tug.org/members/TUGboat/tb34-3/tb108cohen.pdf}}
+}
+
+@Manual{Daly:Natbib,
+ title = {Natural Sciences Citations and References
+ (Author-Year and Numerical Schemes)},
+ author = {Patrick W. Daly},
+ month = {February},
+ year = 2009,
+ note = {\url{http://mirrors.ctan.org/macros/latex/contrib/natbib}}
+}
+
+@Manual{Rahtz:Hyperref,
+ title = {Hypertext Marks in \LaTeX: a Manual for Hyperref},
+ author = {Sebastian Rahtz and Heiko Oberdiek},
+ month = {November},
+ year = 2012,
+ note = {\url{http://mirrors.ctan.org/macros/latex/contrib/hyperref}}
+}
diff --git a/macros/latex/contrib/nmbib/nmbib.dtx b/macros/latex/contrib/nmbib/nmbib.dtx
new file mode 100644
index 0000000000..24647ae06f
--- /dev/null
+++ b/macros/latex/contrib/nmbib/nmbib.dtx
@@ -0,0 +1,1309 @@
+% \iffalse
+% $Id: nmbib.dtx,v 1.21 2015/07/27 20:22:45 boris Exp $
+%
+%% 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
+%%
+%<*gobble>
+% \fi
+% \CheckSum{978}
+%
+%
+%% \CharacterTable
+%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
+%
+%\iffalse
+% \begin{macrocode}
+\documentclass{ltxdoc}
+\usepackage{hypdoc}
+\usepackage{nmbib}
+\let\cite\citep
+\PageIndex
+\CodelineIndex
+\RecordChanges
+\EnableCrossrefs
+\begin{document}
+ \DocInput{nmbib.dtx}
+\end{document}
+% \end{macrocode}
+%</gobble>
+% \fi
+% \MakeShortVerb{|}
+% \GetFileInfo{nmbib.sty}
+%
+% \changes{v1.00}{2014/01/23}{Preliminary release}
+% \changes{v1.03}{2015/07/25}{Added day field in the chrono bst}
+%
+% \title{New Multibibliography Package\thanks{\copyright 2015 Michael
+% Cohen and Boris Veytsman}}
+% \author{Boris Veytsman\thanks{borisv@lk.net}
+% \and Michael Cohen\thanks{mcohen@u-aizu.ac.jp}}
+% \date{\filedate, \fileversion}
+% \maketitle
+%
+% \begin{abstract}
+% The |nmbib| package is a rewrite of |multibiliography| package
+% providing multiple bibliographies with different sorting. The new
+% version offers a number of citation commands, streamlines the
+% creation of bibliographies, ensures compatibility with the
+% |natbib| package, and provides other improvements.
+% \end{abstract}
+%
+% \tableofcontents
+%
+% \clearpage
+%
+%\section{Introduction}
+%\label{sec:intro}
+%
+% The list of cited works accompanying a scholarly work is not just
+% a technical appendix or a subtle way to avoid accusations of
+% plagiarism. Rather, it is an organic part of the work, telling the
+% user a story about the field of study and showing why the given
+% work is an organic part of it. There are several ways to tell the
+% story, and accordingly there are several ways to organize the list
+% of references. One can tell it accordingly to logical
+% development of ideas, so the order of citations follows the order
+% they are mentioned in the paper. This leads to the ``unsorted''
+% style of references, usual in physics and mathematics papers and books.
+% Alternatively, one can choose to tell the story as the story of
+% people behind the ideas, ordering the citations alphabetically by
+% author names. This is the order used in humanities and other fields.
+% Yet another possibility is to tell the story in the chronological
+% order. The chronological order of citations is not widely used,
+% with the important exception of resumes and CVs, but it has its own
+% advantages.
+%
+% In the times BC (Before Computers), difficulties in manual creation
+% of reference lists discouraged presentation of more than one such
+% list. Now we can easily have as many lists as we want. Accordingly
+% we can have not one, but several lists of references, each telling a
+% different story. The package
+% |multibibliography|~\cite{Multibibliography, Multibibliography13}
+% provided just this: multiple bibliographies with the same references arranged
+% in different orders, with hyperlinks between entries. However, this
+% package had various limitations, including: the fixed format of
+% typesetting citations in text, the limitation on the possible
+% Bib\TeX\ styles. Also, it requires post-processing by a Perl
+% script.
+%
+% This package tries to lift these limitations. It provides the
+% following improvements over the original |multibiliography|:
+% \begin{enumerate}
+% \item A Perl postprocessing is no longer needed: all processing is done
+% by Bib\TeX.
+% \item The user can work with familiar |natbib|~\cite{Daly:Natbib}
+% commands \cs{citep}, \cs{citet}, \cs{citeauthor}, \cs{citeyear},
+% \cs{citenum}.
+% \item Any |natbib|-compatible |.bst| file can be used for formatting
+% the bibliography provided that it has the right sorting of entries
+% (note that the provided style gives |natbib|-compatible
+% chronological ordering).
+% \item The style is much more customizable than that produced by
+% |multibibliography|.
+% \item Hyperlinks between the entries are improved.
+% \end{enumerate}
+%
+% Note about the name. The letter \emph{n} in the package name can be
+% interpreted as
+% \begin{enumerate}
+% \item \emph{N}ew multibibliography style, or
+% \item \emph{N}atbib-compatible multibibliography style, or even
+% \item \emph{N}-ordering multibibliography style, with $N$ being a
+% usual mathematical moniker for ``many''.
+% \end{enumerate}
+%
+%
+%\section{User Guide}
+%\label{sec:ug}
+%
+%
+%\subsection{Usage Summary}
+%\label{sec:ug_usage}
+%
+% The simplest way to use the package is the following:
+% \begin{enumerate}
+% \item Add to the preamble of your |.tex| file
+% \begin{verbatim}
+% \usepackage{nmbib}
+% \multibibliography{FILE1, FILE2, ...}
+% \multibibliographystyle{timeline}{STYLE1}
+% \multibibliographystyle{sequence}{STYLE2}
+% \multibibliographystyle{authors}{STYLE3}
+% \end{verbatim}
+%
+% \item Use |natbib| commands such as |\cite|, |\citep|, |\citet|,
+% |\citeauthor|, |\citeyear|, and |\citenum|. The command |\citeall|
+% creates a ``full citation'', showing the author, year, and
+% number of the citation.
+% \item Put in your document at the places where you want the
+% bibliography the commands |\printbibliography{timeline}|,
+% |\printbibliography{sequence}|, and |\printbibliography{authors}|.
+%
+% \item Run |latex| on the |tex| file. This will create, besides the
+% standard auxiliary file |FILE.aux|, three new files:
+% |FILE-timeline.aux|, |FILE-sequence.aux| and |FILE-authors.aux|.
+% \item Run |bibtex| on each of the three auxiliary files mentioned
+% above:
+% \begin{verbatim}
+% bibtex FILE-timeline
+% bibtex FILE-sequence
+% bibtex FILE-authors
+% \end{verbatim}
+% \item Run |latex| on the |tex| file at least twice (this is a
+% |natbib| requirement).
+% \end{enumerate}
+%
+% Below we discuss these commands in more detail as well as
+% customization commands.
+%
+%
+%\subsection{Options}
+%\label{sec:ug_options}
+%
+% The |nmbib| package internally uses |natbib| \cite{Daly:Natbib} for citation
+% formatting. The options used for |nmbib| are sent to |natbib|.
+%
+%\subsection{Setting up}
+%\label{sec:ug_setting}
+%
+% \DescribeMacro{\multibibliography}%
+% The list of \BibTeX\ databases to be used for references is set by
+% the command \cs{multibibliography}\marg{bibfile1, bibfile2, \dots}.
+% Note that the similar command \cs{bibliography} in standard
+% \LaTeX\ performs \emph{two} functions:
+% it sets up the databases and prints the
+% bibliography. The command \cs{multibibliography}, on the other
+% hand, performs only one function: the setting up of the databases.
+% The bibliographies themselves are printed by the command
+% \cs{printbibliography}, discussed below. Therefore the \cs{multibibliography} command
+% can be issued anywhere in the file, including
+% the preamble.
+%
+% \DescribeMacro{\multibibliographystyle}
+% The standard \cs{bibliographystyle} command sets the bibliography
+% style of the reference list. Since |nmbib| generates several
+% bibliographies, the corresponding command is more versatile:
+% \cs{multibibliographystyle}\marg{type}\marg{style},
+% where |type| is the type of the bibliography
+% \begin{description}
+% \item[timeline:] Chronologically ordered list.
+% \item[sequence:] Sequentially ordered list.
+% \item[authors:] Alphabetic list, ordered according to
+% authors' names.
+% \end{description}
+% and \marg{style} is the corresponding \BibTeX\ style. The style, of
+% course, must sort the entries in the proper order.
+%
+% The package can accommodate any |natbib| \BibTeX\ style,
+% including |unsrtnat|, |plainnat|, and |abbrvnat|. It may work with other
+% styles, but success is not guaranteed. The \BibTeX\ styles
+% supplied with the package offer additional hyperlink features; if
+% you do not use |hyperref| or do not care for the links between the
+% different reference lists, you probably do not need these features.
+%
+% There are three citation styles provided with the package:
+% \begin{description}
+% \item[chronoplainnm:] Similar to |plainnat|, but sorting
+% entries in chronological order (using year, month and day if the
+% latter two are available) and providing links to other lists from the
+% body of the entries.
+% \item[plainnm:] Similar to |plainnat|, but providing links to other
+% lists from the body of the entries. The sorting is alphabetical
+% by authors' names, as in |plainnat|.
+% \item[unsrtnm:] Similar to |unsrtnat|, but providing links to other
+% lists from the body of the entries. The order of entries is the
+% order of citations, as in |unsrtnat|.
+% \end{description}
+%
+%
+%\subsection{Citation commands}
+%\label{sec:ug_commands}
+%
+% All citations commands defined in |natbib| can be used: \cs{cite},
+% \cs{citenum}, \cs{citealt}, \cs{citet}, \cs{Citet}, etc. The |nmbib| package
+% adds a couple of new commands, described here.
+%
+% \DescribeMacro{\citealn}%
+% The commands \cs{citealn}\marg{keys} is the alternative \cs{citenum}
+% command: it puts square brackets around its argument.
+%
+% \DescribeMacro{\citeall}%
+% The command \cs{citeall}\marg{keys} produces citations with
+% authors' names, years, and sequence numbers, similar to that
+% produced by the \cs{cite} command in the |multibibliography| package.
+% To reproduce the behavior of that package, just put in
+% the preamble of your document
+% \begin{verbatim}
+% \let\cite\citeall
+% \end{verbatim}
+%
+% The starred command \cs{citeall*} is similar to \cs{citeall} with
+% the following difference: if \cs{citeall} prints the shortened author
+% list for papers with multiple authors (``Jones et.\ al.''),
+% \cs{citeall*} prints the full list (``Jones, Smith, and Brown'').
+%
+%
+%\subsection{Printing the bibliographies}
+%\label{sec:ug_print}
+%
+%
+% \DescribeMacro{\printbibliography}%
+% The command \cs{printbibliography}\marg{type} prints the
+% bibliography. The argument is the type of bibliography---
+% |timeline|, |sequence|, or |authors| (see the explanation above).
+%
+%
+% You can put this command anywhere in your file; the corresponding
+% bibliography will be printed in this place. You can use all three
+% possible lists, any two, or even one. The only limitation is
+% that the ``base type'' list must be included.
+% (See Section~\ref{sec:ug_customization} for the discussion of base type.)
+%
+%
+%\subsection{Hyperlinks}
+%\label{sec:ug_hyperlinks}
+%
+% The |nmbib| package tries to fully exploit features of |hyperref| package
+% \cite{Rahtz:Hyperref}. Links from and between
+% citations should work ``smartly'': links from authors' names go
+% into the alphabetic list, links from the publication years go into the
+% chronological list, and links from the citation numbers go into the
+% sequential list.
+%
+% \DescribeMacro{\nmbibRedirectLinks}%
+% Of course, the user might include only some of the three possible
+% lists. In this case some links become ``dangling.'' The command
+% \cs{nmbibRedirectLinks}\penalty0\marg{source\_type}%
+% \penalty0\marg{target\_type} redirects the links that otherwise go to
+% the list \marg{source\_type} to the list \marg{source\_type}. For
+% example, if a chronological list is not included, the
+% command |\nmbibRedirectLinks{timeline}{authors}| makes the links
+% from the publication year go into the alphabetical list of
+% publications.
+%
+% \DescribeMacro{\nmbibLink}%
+% The clickable links themselves are created with the help of the
+% command \cs{nmbibLink}\marg{citation}\marg{type}\marg{text}. This
+% command is available to the user, which enables constructions like
+% \begin{verbatim}
+% The idea was proposed by \citet{Thor10}. Note the assumption of
+% differentiability in \nmbibLink{Thor10}{authors}{his paper}.
+% \end{verbatim}
+% In this example ``his paper'' becomes a hyperlink to the paper in
+% the alphabetical list.
+%
+% The links created with \cs{nmbibLink} respect the redirections set
+% by the command \cs{nmbibRedirectLinks}.
+%
+%
+%\subsection{Advanced customization}
+%\label{sec:ug_customization}
+%
+% \DescribeMacro{\timelinerefname}%
+% \DescribeMacro{\sequencerefname}%
+% \DescribeMacro{\authorsrefname}%
+% \DescribeMacro{\timelinebibname}%
+% \DescribeMacro{\sequencebibname}%
+% \DescribeMacro{\authorsbibname}%
+% The commands \cs{refname} (for article-like classes) and
+% \cs{bibname} (for book-like classes) retain the names of the
+% bibliography. The |nmbib| package defines three macros |\TYPErefname| and
+% three commands |\TYPEbibname|, |TYPE| being |timeline|, |sequence|,
+% or |authors|. These macros can be redefined with the usual
+% \cs{renewcommand}.
+% For example, for a German article, one might use
+% \begin{verbatim}
+% \renewcommand{\timelinerefname}{Chronologische Referenzliste}
+% \renewcommand{\sequencerefname}{Sequenzielle Referenzliste}
+% \renewcommand{\authorsrefname}{Alphabetische Referenzliste}
+% \end{verbatim}
+%
+%
+%
+% \DescribeMacro{\multibibliographyfilename}
+% By default the package creates three auxillary files with the
+% following file names: |FILE-timeline.aux|,
+% |FILE-sequence.aux|, and |FILE-authors.aux|. The command
+% \cs{multibibliograpyfilename}\marg{type}\marg{name} changes this
+% default. Here \marg{type} is |timeline|, |sequence|, or |authors|, and
+% \marg{name} is the file name. The default setting is equivalent to
+% \begin{verbatim}
+% \multibibliograpyfilename{timeline}{\jobname-timeline}
+% \multibibliograpyfilename{sequence}{\jobname-sequence}
+% \multibibliograpyfilename{authors}{\jobname-authors}
+% \end{verbatim}
+% This command may be present only in the preamble of a document.
+%
+%
+%
+% \DescribeMacro{\nmbibBasetype}%
+% Suppose an author published several works in the same year. They
+% need to be distinguished in the text and bibliography. In the
+% standard author-year styles this is done by adding a suffix after
+% the year: if we want to cite three works by A.\,U.\ Thor published
+% in 2013, they are respectively cited as Thor~(2013a), Thor~(2013b), and
+% Thor~(2013c). When we have only one reference list,
+% the choice of suffixes is simple: the first work becomes 2013a, the
+% second 2013b, etc. But how should we deal with the situation of
+% several subbibliographies? The order of these references in different
+% lists could be different, so the same work could get different labels in
+% different lists.
+%
+% To prevent this confusion, only one reference list is used to
+% construct the labels. We call the corresponding list type the
+% \emph{base type}. By default it is |sequence|, but this might be
+% changed (and should be chaged if the user does not include
+% sequential list) with the command \cs{nmbibBasetype}\marg{type}, with
+% \marg{type} being |timeline|, |sequence|, or |authors|. The list
+% chosen as a base type must be included with the
+% \cs{printbibliography} macro.
+%
+% Package |natbib| defines citation aliases: you can use ``Paper~I''
+% or ``Paper~II'' as aliases for some papers. Normally hyperlinks
+% from aliases go into the alphabetic list; however, you can change
+% it with the special type |alias| in \cs{nmbibRedirectLinks}, for
+% example,
+% \begin{verbatim}
+% \nmbibRedirectLinks{alias}{timeline}
+% \end{verbatim}
+%
+%
+%
+% \DescribeMacro{\nmbibSetCiteall}%
+% The format of the \cs{citeall} and \cs{citeall*} macros can be
+% changed by the command \cs{nmbibSetCiteall}\marg{pattern}, where
+% \marg{pattern} sets the citation format. The pattern can use any
+% punctuation, \cs{nmbibLink} command and the special tokens
+% \cs{nmbibKEY}, \cs{nmbibNAME}, \cs{nmbibDATE} and \cs{nmbibNUM},
+% which are substituted by the citation information. For example, the
+% default format is established by the command
+% \begin{verbatim}
+% \nmbibSetCiteall{\nmbibLink{\nmbibKEY}{authors}{\nmbibNAME}
+% (\nmbibLink{\nmbibKEY}{timeline}{\nmbibDATE})
+% [\nmbibLink{\nmbibKEY}{sequence}{\nmbibNUM}]}
+% \end{verbatim}
+% which produces the following result: \citeall{Daly:Natbib}.
+%
+% \DescribeMacro{\nmbibSetBiblabel}%
+% The command \cs{nmbibSetBiblabel}\marg{type}{pattern} is used to set
+% the format of the label in the reference list of the given type.
+% The \marg{pattern} parameter uses the same tokens as \cs{nmbibSetCiteall}.
+% The default is
+% \begin{verbatim}
+%\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})]}
+% \end{verbatim}
+% To suppress the label for any type, use an empty pattern:
+% |\nmbibSetBiblabel{authors}{}|. To use numerical labels only for a
+% sequential list, issue |\nmbibSetBiblabel{sequence}{[\nmbibNUM]}|
+% etc.
+%
+% \DescribeMacro{nmbibYearSuffixOff}%
+% \DescribeMacro{nmbibYearSuffixOn}%
+% If there are several works with the same authors and year, the
+% package adds suffixes to the year numbers, like 2003a and 2003b. By
+% default these suffixes are printed both in the labels \emph{and} in
+% the bibliographic entries themselves. The command
+% \cs{nmbibYearSuffixOff} deletes these suffixes from the bibliography
+% entries (but not from labels). The command \cs{nmbibYearSuffixOff}
+% restores them.
+%
+%
+%\subsection{Auxillary script}
+%\label{sec:script}
+%
+% To integrate the package with IDEs like \TeX Shop, we provide a
+% simple script |nmbibtex| which compiles all bibliographies. Its
+% usage is very simple:
+% \begin{verbatim}
+% nmbibtex FILE
+% \end{verbatim}
+% where |FILE| is the file name without prefixes.
+%
+%
+%\StopEventually{\clearpage\nmbibYearSuffixOff
+% \multibibliography{nmbib}%
+% \multibibliographystyle{timeline}{chronoplainnm}%
+% \multibibliographystyle{sequence}{unsrtnm}%
+% \multibibliographystyle{authors}{plainnm}%
+% \printbibliography{sequence}%
+% \printbibliography{authors}%
+% \printbibliography{timeline}}
+%
+% \clearpage
+%
+% \section{Implementation}
+% \label{sec:implementation}
+%
+%
+%\subsection{Declarations}
+%\label{sec:decl}
+%
+% We start with declaration, who we are:
+%
+%
+% \begin{macrocode}
+%<style>\NeedsTeXFormat{LaTeX2e}
+%<*gobble>
+\ProvidesFile{nmbib.dtx}
+%</gobble>
+%<style>\ProvidesPackage{nmbib}
+%<*style>
+[2015/07/27 v1.04 Multibibliography support for LaTeX]
+% \end{macrocode}
+%
+%
+%
+%\subsection{Loading packages}
+%\label{sec:loading}
+%
+% We send all options to |natbib|
+% \begin{macrocode}
+\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{natbib}}
+\ProcessOptions\relax
+% \end{macrocode}
+% and call |natbib|
+% \begin{macrocode}
+\RequirePackage{natbib}
+% \end{macrocode}
+%
+%
+%
+%
+%\subsection{Preliminary Definitions and opening aux files}
+%\label{sec:opening}
+%
+% \begin{macro}{\NMBIB@types}
+% The comma-separated collection of types: right now we have three
+% of them.
+% \begin{macrocode}
+\def\NMBIB@types{timeline,sequence,authors}
+% \end{macrocode}
+%
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\multibibliographyfilename}
+% Defining the names for bibliography files
+% \begin{macrocode}
+\def\multibibliographyfilename#1#2{%
+ \expandafter\edef\csname NMBIB@#1@filename\endcsname{#2}}
+\@onlypreamble{\multibibliographyfilename}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\NMBIB@@timeline@filename}
+% \begin{macro}{\NMBIB@@sequence@filename}
+% \begin{macro}{\NMBIB@@authors@filename}
+% The file names for aux files (without |.aux| extension)
+% \begin{macrocode}
+\@for\@tempa:=\NMBIB@types\do{%
+ \expandafter\multibibliographyfilename{\@tempa}{\jobname-\@tempa}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\NMBIB@timeline@aux}
+% \begin{macro}{\NMBIB@sequence@aux}
+% \begin{macro}{\NMBIB@authors@aux}
+% We introduce the output streams
+% \begin{macrocode}
+\@for\@tempa:=\NMBIB@types\do{%
+ \expandafter\newwrite\csname NMBIB@\@tempa @aux\endcsname}
+% \end{macrocode}
+% We open and close them at the beginning and end of the document
+% \begin{macrocode}
+\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}
+% \end{macrocode}
+%
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\multibibliographystyle}
+% Define the bibliographystyle for the corresponding list. Note the
+% trick with \cs{@begindocumenthook}, which allows us to write the
+% files only after the files are opened.
+% \begin{macrocode}
+\def\multibibliographystyle#1#2{%
+ \ifx\@begindocumenthook\@undefined\else
+ \expandafter\AtBeginDocument
+ \fi
+ {\if@filesw
+ \immediate\write\csname NMBIB@#1@aux\endcsname{%
+ \string\bibstyle{#2}}%
+ \fi}}
+% \end{macrocode}
+%
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\multibibliography}
+% Writing bibliography data to the aux files
+% \begin{macrocode}
+\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}}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\nmbibBasetype}
+% \begin{macro}{\NMBIB@bibcite@type}
+% The macro \cs{nmbibBasetype} sets the type that is used for the
+% citation command:
+% \begin{macrocode}
+\def\nmbibBasetype#1{\gdef\NMBIB@bibcite@type{#1}}
+\nmbibBasetype{sequence}
+% \end{macrocode}
+%
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\NMBIB@timeline@cite@suffix}
+% \begin{macro}{\NMBIB@sequence@cite@suffix}
+% \begin{macro}{\NMBIB@authors@cite@suffix}
+% \begin{macro}{\NMBIB@alias@cite@suffix}
+% The macro \cs{NMBIB@TYPE@cite@suffix} keeps the suffix added to
+% the hyperlink |cite|:
+% \begin{macrocode}
+\@for\@tempa:=\NMBIB@types\do{%
+ \expandafter\edef\csname NMBIB@\@tempa
+ @cite@suffix\endcsname{\@tempa}}
+\def\NMBIB@alias@cite@suffix{authors}
+% \end{macrocode}
+%
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\nmbibRedirectLinks}
+% The macro \cs{nmbibRedirectLinks}\marg{from}\marg{to} redefines
+% the suffix:
+% \begin{macrocode}
+\def\nmbibRedirectLinks#1#2{%
+ \expandafter\edef\csname NMBIB@#1@cite@suffix\endcsname{#2}}
+% \end{macrocode}
+%
+% \end{macro}
+%
+%\subsection{Citation commands}
+%\label{sec:citex}
+%
+%
+% \begin{macro}{\NAT@set@cites}
+% The command |\NAT@set@cites| is used by |natbib| to set up
+% citation styles. It is added to the |begindocument| hook, so we
+% need to disable it here:
+% \begin{macrocode}
+\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}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\ifNMBIB@printyearsuffix}
+% \changes{v1.02}{2015/04/24}{Added macro}
+% Whether to print the year suffix
+% \begin{macrocode}
+\newif\ifNMBIB@printyearsuffix
+\NMBIB@printyearsuffixtrue
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\nmbibYearSuffixOn}
+% \changes{v1.02}{2015/04/24}{Added macro}
+% Switching on the suffixes
+% \begin{macrocode}
+\def\nmbibYearSuffixOn{\NMBIB@printyearsuffixtrue}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\nmbibYearSuffixOff}
+% \changes{v1.02}{2015/04/24}{Added macro}
+% Switching off the suffixes
+% \begin{macrocode}
+\def\nmbibYearSuffixOff{\NMBIB@printyearsuffixfalse}
+% \end{macrocode}
+%
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\NAT@sort@cites}
+% The command \cs{NAT@sort@cites} sorts the citations and writes
+% them to the aux file. We want to write them to another file
+% instead.
+% \begin{macrocode}
+\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}%
+ }{}%
+}%
+% \end{macrocode}
+%
+% \end{macro}
+%
+%
+% \begin{macro}{\nmbibcitenumber}
+% This command is written to the main |aux| file and contains the
+% number of the citation (since different lists may produce
+% different numbers). We store the number in the macro
+% |\nmbib@num@KEY\@extra@binfo|. We also use |natbib| warnings
+% about multiple citations.
+% \begin{macrocode}
+\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}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\NMBIB@testnum}
+% Testing whether citation number have been changed.
+% \begin{macrocode}
+\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
+}%
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\NAT@parse}
+% The |natbib| command \cs{NAT@parse} parses the \cs{bibcite}
+% arguments and stores them in the corresponding macros. However,
+% the citation number may be wrong since it might be taken from a
+% wrong list. Therefore we use the number from \cs{nmbibcitenumber}
+% instead.
+% \begin{macrocode}
+\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}}}
+% \end{macrocode}
+%
+% \end{macro}
+%
+%
+% \begin{macro}{\nmbibLink}
+% The command \cs{nmbibLink}\marg{key}\marg{type}\marg{text} is like
+% \cs{NAT@hyper@}, but on the user level:
+% \begin{macrocode}
+\def\nmbibLink#1#2#3{%
+ \hyper@natlinkstart{#1\@extra@b@citeb-\csname
+ NMBIB@#2@cite@suffix\endcsname}#3\hyper@natlinkend}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\NAT@citexnum}
+% We use \cs{NAT@citexnum} to cite numbers:
+% \begin{macrocode}
+\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}%
+}%
+% \end{macrocode}
+%
+% \end{macro}
+%
+%
+%
+%
+%
+% \begin{macro}{\NMBIB@hyper@}
+% This is the replacement for \cs{NAT@hyper@}
+% \begin{macrocode}
+\def\NMBIB@hyper@#1#2{%
+ \nmbibLink{\@citeb}{#1}{#2}}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\NMBIB@hyper@citea}
+% This is the replacement for \cs{NAT@hyper@citea}:
+% \begin{macrocode}
+\def\NMBIB@hyper@citea#1#2{%
+ \@citea
+ \NMBIB@hyper@{#1}{#2}%
+ \NAT@def@citea
+}%
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\NMBIB@hyper@citea@space}
+% The replacement for \cs{NAT@hyper@citea@space}
+% \begin{macrocode}
+\def\NMBIB@hyper@citea@space#1#2{%
+ \@citea
+ \NMBIB@hyper@{#1}{#2}%
+ \NAT@def@citea@space
+}%
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\def@NAT@last@yr}
+% Another |natbib| macro to redefine
+% \begin{macrocode}
+\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
+ }%
+ }%
+}%
+% \end{macrocode}
+%
+% \end{macro}
+%
+%
+% \begin{macro}{\NAT@citea@mbox}
+% This is used in numerical citations
+% \begin{macrocode}
+\def\NAT@citea@mbox{%
+ \@citea\mbox{\NMBIB@hyper@{sequence}{{\citenumfont{\NAT@num}}}}%
+}%
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\NMBIB@citex}
+% And now the heart of |natbib|\dots
+% \begin{macrocode}
+\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
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\citealn}
+% Alternative numerical citation command:
+% \begin{macrocode}
+\newcommand\citealn[1]{[\citenum{#1}]}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\nmbibSetCiteall}
+% Setting the format of \cs{citeall}
+% \begin{macrocode}
+\def\nmbibSetCiteall#1{\def\NMBIB@citeallformat{#1}}
+\nmbibSetCiteall{\nmbibLink{\nmbibKEY}{authors}{\nmbibNAME} %
+ (\nmbibLink{\nmbibKEY}{timeline}{\nmbibDATE}) %
+ [\nmbibLink{\nmbibKEY}{sequence}{\nmbibNUM}]}
+% \end{macrocode}
+%
+% \end{macro}
+%
+%
+% \begin{macro}{\citeall}
+% The full cite command
+% \begin{macrocode}
+\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}}
+% \end{macrocode}
+%
+% \end{macro}
+%
+%
+%\subsection{Processing bibliography}
+%\label{sec:processing_bibliography}
+%
+% \begin{macro}{\timelinerefname}
+% \changes{v1.01}{2015/01/27}{Typo corrected}
+% Reference list for chrono ordering
+% \begin{macrocode}
+\providecommand{\timelinerefname}{Chronological List of References}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\timelinebibname}
+% \changes{v1.04}{2015/07/27}{Typo corrected}
+% Reference list for chrono ordering
+% \begin{macrocode}
+\providecommand{\timelinebibname}{Chronological Bibliography}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\sequencerefname}
+% Reference list for sequential ordering
+% \begin{macrocode}
+\providecommand{\sequencerefname}{Sequential List of References}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\sequencebibname}
+% Reference list for sequential ordering
+% \begin{macrocode}
+\providecommand{\sequencebibname}{Sequential Bibliography}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\authorsrefname}
+% Reference list for alph ordering
+% \begin{macrocode}
+\providecommand{\authorsrefname}{Alphabetic List of References}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\authorsbibname}
+% Reference list for alph ordering
+% \begin{macrocode}
+\providecommand{\authorsbibname}{Alphabetic Bibliography}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\ifNMBIB@writenumber}
+% The switch whether to write the citation number to the |aux|
+% file. Should be true for sequence, false otherwise.
+% \begin{macrocode}
+\newif\ifNMBIB@writenumber
+\NMBIB@writenumberfalse
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\NMBIB@setup@authors}
+% Set up alphabetical-style reference list
+% \begin{macrocode}
+\def\NMBIB@setup@authors{%
+ \NMBIB@writenumberfalse}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\NMBIB@setup@timeline}
+% Timeline reference list looks like alhpabetical
+% \begin{macrocode}
+\let\NMBIB@setup@timeline\NMBIB@setup@authors
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\NMBIB@setup@sequence}
+% Sequential citations are numerical
+% \begin{macrocode}
+\def\NMBIB@setup@sequence{%
+ \NMBIB@writenumbertrue}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\printbibliography}
+% \changes{v1.02}{2015/04/24}{Added suppression of suffixes}
+% The actual printing of the bibliography of the given type. Note
+% that we need to reset \cs{natexlab} afterwards---just in case it
+% is used outside the bibliography.
+% \begin{macrocode}
+\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}}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\bibitem}
+% Normally \cs{bibitem} is defined as \cs{@lbibitem}. We want first
+% to calculate the biblabel
+% \begin{macrocode}
+\def\bibitem{\@ifnextchar[{\@@lbibitem}{\@@lbibitem[]}}%
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\@@lbibitem}
+% \changes{v1.02}{2015/04/24}{Added suppression of suffixes}
+% The macro \cs{@@lbibitem} calculates \cs{NAT@exlab} and
+% calls \cs{@lbibitem}:
+% \begin{macrocode}
+\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}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\NAT@exlab}
+% Before the package is loaded, \cs{NAT@exlab} should not give an
+% error:
+% \begin{macrocode}
+\providecommand\NAT@exlab{}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\NAT@wrout}
+% The original \cs{NAT@wrout} writes to aux file the information
+% from the bbl file. Here we check whether we need to do this and
+% whether to write the number:
+% \begin{macrocode}
+\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}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\NAT@anchor}
+% The command \cs{NAT@anchor}\marg{KEY}\marg{text} creates a
+% hyperlink if the package |hyperref| is loaded. Here we redefine
+% it to create cites in the style |KEY-TYPE|:
+% \begin{macrocode}
+\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
+}%
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\nmbibSetBiblabel}
+% Setting biblabel for the list
+% \begin{macrocode}
+\def\nmbibSetBiblabel#1#2{%
+ \expandafter\def\csname NMBIB@#1@biblabel\endcsname##1{#2}}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \begin{macro}{\NMBIB@timeline@biblabel}
+% \begin{macro}{\NMBIB@sequence@biblabel}
+% \changes{v1.01}{2015/01/27}{Punctiuation changed}
+% \begin{macro}{\NMBIB@authors@biblabel}
+% The default labels
+% \begin{macrocode}
+\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})]}
+% \end{macrocode}
+%
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+%\subsection{Ending the Style}
+%\label{sec:end}
+%
+%
+%
+% \begin{macrocode}
+%</style>
+% \end{macrocode}
+%\Finale
+%\clearpage
+%
+%\PrintChanges
+%\clearpage
+%\PrintIndex
+%
+\endinput
+
diff --git a/macros/latex/contrib/nmbib/nmbib.ins b/macros/latex/contrib/nmbib/nmbib.ins
new file mode 100644
index 0000000000..5711f64245
--- /dev/null
+++ b/macros/latex/contrib/nmbib/nmbib.ins
@@ -0,0 +1,27 @@
+%
+% Doctrip file for nmbib
+% This file is in public domain
+% $Id: nmbib.ins,v 1.1 2014-10-12 20:58:26 boris Exp $
+%
+\def\batchfile{nmbib.ins}
+\input docstrip
+\keepsilent
+\showprogress
+
+
+\askforoverwritefalse
+
+\generate{%
+ \file{nmbib.sty}{\from{nmbib.dtx}{style}}}
+
+\obeyspaces
+\Msg{*****************************************************}%
+\Msg{* Congratulations! You successfully generated the *}%
+\Msg{* nmbib package. *}%
+\Msg{* *}%
+\Msg{* Please move the file nmbib.sty to the place where *}%
+\Msg{* LaTeX files are kept in your system, and the bst *}%
+\Msg{* files to the place where BibTeX files are. *}%
+\Msg{* *}%
+\Msg{* Happy TeXing! *}%
+\Msg{*****************************************************}% \ No newline at end of file
diff --git a/macros/latex/contrib/nmbib/nmbib.pdf b/macros/latex/contrib/nmbib/nmbib.pdf
new file mode 100644
index 0000000000..ba4aeed009
--- /dev/null
+++ b/macros/latex/contrib/nmbib/nmbib.pdf
Binary files differ
diff --git a/macros/latex/contrib/nmbib/nmbibtex.1 b/macros/latex/contrib/nmbib/nmbibtex.1
new file mode 100644
index 0000000000..bb7bb38f4b
--- /dev/null
+++ b/macros/latex/contrib/nmbib/nmbibtex.1
@@ -0,0 +1,163 @@
+.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.ie \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.el \{\
+. de IX
+..
+.\}
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "NMBIBTEX 1"
+.TH NMBIBTEX 1 "2015-04-25" "perl v5.10.1" "User Contributed Perl Documentation"
+.\" For nroff, turn off justification. Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
+.SH "NAME"
+nmbibtex \- a program to compile bibliographies for the package nmbib
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+nmbibtex \fI\s-1OPTIONS\s0\fR \fI\s-1FILE\s0\fR
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+nmbibtex calls \fIbibtex\fR\|(1) for all aux files produced by the package
+nmbib
+.SH "OPTIONS"
+.IX Header "OPTIONS"
+.IP "\fB\-h\fR" 4
+.IX Item "-h"
+Print the help information and exit
+.IP "\fB\-min\-crossrefs\fR \fInumber\fR" 4
+.IX Item "-min-crossrefs number"
+Send the option \f(CW\*(C`\-min\-crossref=NUMBER\*(C'\fR to \fIbibtex\fR\|(1)
+.IP "\fB\-terse\fR" 4
+.IX Item "-terse"
+Send the option \f(CW\*(C`\-terse\*(C'\fR to \fIbibtex\fR\|(1)
+.IP "\fB\-v\fR" 4
+.IX Item "-v"
+Print the copyright information and exit
+.SH "AUTHORS AND LICENSE"
+.IX Header "AUTHORS AND LICENSE"
+Copyright 2015, Michael Cohen mcohen@u\-aizu.ac.jp
+and Boris Veytsman borisv@lk.net
+.PP
+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.
diff --git a/macros/latex/contrib/nmbib/nmbibtex.pl b/macros/latex/contrib/nmbib/nmbibtex.pl
new file mode 100755
index 0000000000..80a89bb177
--- /dev/null
+++ b/macros/latex/contrib/nmbib/nmbibtex.pl
@@ -0,0 +1,120 @@
+#!/usr/bin/env perl
+# $Id: nmbibtex.pl,v 1.1 2015/04/26 00:19:37 boris Exp $
+#
+# 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
+
+=pod
+
+=head1 NAME
+
+nmbibtex - a program to compile bibliographies for the package nmbib
+
+=head1 SYNOPSIS
+
+nmbibtex I<OPTIONS> I<FILE>
+
+=head1 DESCRIPTION
+
+nmbibtex calls L<bibtex(1)> for all aux files produced by the package
+nmbib
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<-h>
+
+Print the help information and exit
+
+=item B<-min-crossrefs> I<number>
+
+Send the option C<-min-crossref=NUMBER> to L<bibtex(1)>
+
+=item B<-terse>
+
+Send the option C<-terse> to L<bibtex(1)>
+
+=item B<-v>
+
+Print the copyright information and exit
+
+=back
+
+=head1 AUTHORS AND LICENSE
+
+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.
+
+=cut
+
+ use strict;
+
+my $USAGE = <<'END';
+Usage: nmbibtex [-min-crossref NUMBER] [-terse] FILE
+
+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.
+END
+
+ use Getopt::Long;
+
+my $help=0;
+my $terse=0;
+my $mincross=-1;
+
+GetOptions("h" => \$help,
+ 'v' => \$help,
+ '-terse' => \$terse,
+ "-min-crossrefs=i" => \$mincross) or die $USAGE;
+
+if ($help){
+ die $USAGE;
+}
+
+my $cmdline = "bibtex ";
+if ($terse) {
+ $cmdline .= "-terse ";
+}
+if ($mincross>0) {
+ $cmdline .= "-min-crossrefs=$mincross ";
+}
+
+
+
+my $file = shift;
+
+if (!length($file)) {
+ die $USAGE;
+}
+
+# Just in case strip the suffix
+$file =~ s/\.aux$//;
+$file =~ s/\.AUX$//;
+
+my @auxfiles = glob("$file-*.aux");
+foreach my $auxfile (@auxfiles) {
+ print `$cmdline $auxfile`;
+}
diff --git a/macros/latex/contrib/nmbib/nmsample.pdf b/macros/latex/contrib/nmbib/nmsample.pdf
new file mode 100644
index 0000000000..bfcf4824b5
--- /dev/null
+++ b/macros/latex/contrib/nmbib/nmsample.pdf
Binary files differ
diff --git a/macros/latex/contrib/nmbib/nmsample.tex b/macros/latex/contrib/nmbib/nmsample.tex
new file mode 100644
index 0000000000..56ff2a807a
--- /dev/null
+++ b/macros/latex/contrib/nmbib/nmsample.tex
@@ -0,0 +1,68 @@
+\documentclass{article}
+\usepackage{nmbib}
+\usepackage[colorlinks]{hyperref}
+\multibibliographystyle{timeline}{chronoplainnm}
+\multibibliographystyle{sequence}{unsrtnm}
+\multibibliographystyle{authors}{plainnm}
+\multibibliography{type,nmbib}
+\usepackage{booktabs}
+\usepackage[tableposition=top]{caption}
+\begin{document}
+
+The package \textsl{nmbib} allows several kinds of citations:
+author-year parenthetical \verb|\citep|:
+\citep{Daly:Customizing_Bibliographic_Style_Files}, author-year
+textual \verb|\citet|: \citet{kopka03}, authors only
+\verb|\citeauthor|: \citeauthor{Daly:Natbib}, year only
+\verb|\citeyear|: \citeyear{Mori:Managing_bibliographies}, numerical
+\verb|\citenum|: \citenum{Patashnik:bibtexing}, \verb|\citealn|:
+\citealn{Multibibliography}. The \verb|\citeall| command produces the
+full citation: \citeall{Markey:Tame_the_BeaST}, close to the one
+produced by the \textsl{multibibliography} package
+\citep{Multibibliography, Multibibliography13}.
+
+Full citation command \verb|\citeall|: \citeall{Multibibliography,
+ Multibibliography13}. The starred form: \verb|\citeall*|:
+\citeall*{Multibibliography, Multibibliography13}
+
+
+
+We can create links with a user-level universal command
+\verb|\nmbibLink|: \nmbibLink{Daly:Natbib}{authors}{Daly's package in
+ the alphabetic list}, \nmbibLink{kopka03}{sequence}{Kopka and Daly's
+ book in the sequential list}.
+
+\begin{table}
+ \centering
+ \caption{Examples of citation commands}
+ \label{tab:examples}
+ \begin{tabular}{ll}
+ \toprule
+ Command & Result\\
+ \midrule
+ \verb|\citet{Daly:Natbib}| & \citet{Daly:Natbib}\\
+ \verb|\citep{Daly:Natbib}| & \citep{Daly:Natbib}\\
+ \verb|\cite{Daly:Natbib}| & \cite{Daly:Natbib}\\
+ \verb|\citealt{Daly:Natbib}| & \citealt{Daly:Natbib}\\
+ \verb|\citealp{Daly:Natbib}| & \citealp{Daly:Natbib}\\
+ \verb|\citetext{Daly:Natbib}| & \citetext{Daly:Natbib}\\
+ \verb|\citenum{Daly:Natbib}| & \citenum{Daly:Natbib}\\
+ \verb|\citealn{Daly:Natbib}| & \citealn{Daly:Natbib}\\
+ \verb|\citeauthor{Daly:Natbib}| & \citeauthor{Daly:Natbib}\\
+ \verb|\citeyear{Daly:Natbib}| & \citeyear{Daly:Natbib}\\
+ \verb|\citefullauthor{Daly:Natbib}| &
+ \citefullauthor{Daly:Natbib}\\
+ \verb|\citeall{Daly:Natbib}| & \citeall{Daly:Natbib}\\
+ \bottomrule
+ \end{tabular}
+\end{table}
+
+\nmbibYearSuffixOff
+\clearpage
+\printbibliography{timeline}
+\clearpage
+\printbibliography{sequence}
+\clearpage
+\printbibliography{authors}
+
+\end{document}
diff --git a/macros/latex/contrib/nmbib/plainnm.bst b/macros/latex/contrib/nmbib/plainnm.bst
new file mode 100644
index 0000000000..19135fdb87
--- /dev/null
+++ b/macros/latex/contrib/nmbib/plainnm.bst
@@ -0,0 +1,1429 @@
+%% File plainnm.bst.
+%% Based on plainnat.bst by Patric W. Daly
+%%
+%% 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.
+%%
+%%
+%%
+%% ORIGINAL COPYRIGHT STATEMENT
+%% File: `plainnat.bst'
+%% A modification of `plain.bst' for use with natbib package
+%%
+%% Copyright 1993-2007 Patrick W Daly
+%% Max-Planck-Institut f\"ur Sonnensystemforschung
+%% Max-Planck-Str. 2
+%% D-37191 Katlenburg-Lindau
+%% Germany
+%% E-mail: daly@mps.mpg.de
+%%
+%% This program can be redistributed and/or modified under the terms
+%% of the LaTeX Project Public License Distributed from CTAN
+%% archives in directory macros/latex/base/lppl.txt; either
+%% version 1 of the License, or any later version.
+%%
+%% END ORIGINAL COPYRIGHT STATEMENT
+%%
+%%
+%%
+ENTRY
+ { address
+ author
+ booktitle
+ chapter
+ doi
+ eid
+ edition
+ editor
+ howpublished
+ institution
+ isbn
+ issn
+ journal
+ key
+ month
+ note
+ number
+ organization
+ pages
+ publisher
+ school
+ series
+ title
+ type
+ url
+ volume
+ year
+ }
+ {}
+ { label extra.label sort.label short.list }
+
+INTEGERS { output.state before.all mid.sentence after.sentence after.block }
+
+FUNCTION {init.state.consts}
+{ #0 'before.all :=
+ #1 'mid.sentence :=
+ #2 'after.sentence :=
+ #3 'after.block :=
+}
+
+STRINGS { s t }
+
+FUNCTION {output.nonnull}
+{ 's :=
+ output.state mid.sentence =
+ { ", " * write$ }
+ { output.state after.block =
+ { add.period$ write$
+ newline$
+ "\newblock " write$
+ }
+ { output.state before.all =
+ 'write$
+ { add.period$ " " * write$ }
+ if$
+ }
+ if$
+ mid.sentence 'output.state :=
+ }
+ if$
+ s
+}
+
+FUNCTION {output}
+{ duplicate$ empty$
+ 'pop$
+ 'output.nonnull
+ if$
+}
+
+FUNCTION {output.check}
+{ 't :=
+ duplicate$ empty$
+ { pop$ "empty " t * " in " * cite$ * warning$ }
+ 'output.nonnull
+ if$
+}
+
+FUNCTION {fin.entry}
+{ add.period$
+ write$
+ newline$
+}
+
+FUNCTION {new.block}
+{ output.state before.all =
+ 'skip$
+ { after.block 'output.state := }
+ if$
+}
+
+FUNCTION {new.sentence}
+{ output.state after.block =
+ 'skip$
+ { output.state before.all =
+ 'skip$
+ { after.sentence 'output.state := }
+ if$
+ }
+ if$
+}
+
+FUNCTION {not}
+{ { #0 }
+ { #1 }
+ if$
+}
+
+FUNCTION {and}
+{ 'skip$
+ { pop$ #0 }
+ if$
+}
+
+FUNCTION {or}
+{ { pop$ #1 }
+ 'skip$
+ if$
+}
+
+FUNCTION {new.block.checka}
+{ empty$
+ 'skip$
+ 'new.block
+ if$
+}
+
+FUNCTION {new.block.checkb}
+{ empty$
+ swap$ empty$
+ and
+ 'skip$
+ 'new.block
+ if$
+}
+
+FUNCTION {new.sentence.checka}
+{ empty$
+ 'skip$
+ 'new.sentence
+ if$
+}
+
+FUNCTION {new.sentence.checkb}
+{ empty$
+ swap$ empty$
+ and
+ 'skip$
+ 'new.sentence
+ if$
+}
+
+FUNCTION {field.or.null}
+{ duplicate$ empty$
+ { pop$ "" }
+ 'skip$
+ if$
+}
+
+FUNCTION {emphasize}
+{ duplicate$ empty$
+ { pop$ "" }
+ { "\emph{" swap$ * "}" * }
+ if$
+}
+
+INTEGERS { nameptr namesleft numnames }
+
+FUNCTION {format.names}
+{ 's :=
+ #1 'nameptr :=
+ s num.names$ 'numnames :=
+ numnames 'namesleft :=
+ { namesleft #0 > }
+ { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
+ nameptr #1 >
+ { namesleft #1 >
+ { ", " * t * }
+ { numnames #2 >
+ { "," * }
+ 'skip$
+ if$
+ t "others" =
+ { " et~al." * }
+ { " and " * t * }
+ if$
+ }
+ if$
+ }
+ 't
+ if$
+ nameptr #1 + 'nameptr :=
+ namesleft #1 - 'namesleft :=
+ }
+ while$
+}
+
+FUNCTION {format.key}
+{ empty$
+ { key field.or.null }
+ { "" }
+ if$
+}
+
+FUNCTION {format.authors}
+{ author empty$
+ { "" }
+ { author format.names }
+ if$
+}
+
+FUNCTION {format.editors}
+{ editor empty$
+ { "" }
+ { editor format.names
+ editor num.names$ #1 >
+ { ", editors" * }
+ { ", editor" * }
+ if$
+ }
+ if$
+}
+
+FUNCTION {format.isbn}
+{ isbn empty$
+ { "" }
+ { new.block "ISBN " isbn * }
+ if$
+}
+
+FUNCTION {format.issn}
+{ issn empty$
+ { "" }
+ { new.block "ISSN " issn * }
+ if$
+}
+
+FUNCTION {format.url}
+{ url empty$
+ { "" }
+ { new.block "URL \url{" url * "}" * }
+ if$
+}
+
+FUNCTION {format.doi}
+{ doi empty$
+ { "" }
+ { new.block "\doi{" doi * "}" * }
+ if$
+}
+
+FUNCTION {format.title}
+{ title empty$
+ { "" }
+ { title "t" change.case$ }
+ if$
+}
+
+FUNCTION {format.full.names}
+{'s :=
+ #1 'nameptr :=
+ s num.names$ 'numnames :=
+ numnames 'namesleft :=
+ { namesleft #0 > }
+ { s nameptr
+ "{vv~}{ll}" format.name$ 't :=
+ nameptr #1 >
+ {
+ namesleft #1 >
+ { ", " * t * }
+ {
+ numnames #2 >
+ { "," * }
+ 'skip$
+ if$
+ t "others" =
+ { " et~al." * }
+ { " and " * t * }
+ if$
+ }
+ if$
+ }
+ 't
+ if$
+ nameptr #1 + 'nameptr :=
+ namesleft #1 - 'namesleft :=
+ }
+ while$
+}
+
+FUNCTION {author.editor.full}
+{ author empty$
+ { editor empty$
+ { "" }
+ { editor format.full.names }
+ if$
+ }
+ { author format.full.names }
+ if$
+}
+
+FUNCTION {author.full}
+{ author empty$
+ { "" }
+ { author format.full.names }
+ if$
+}
+
+FUNCTION {editor.full}
+{ editor empty$
+ { "" }
+ { editor format.full.names }
+ if$
+}
+
+FUNCTION {make.full.names}
+{ type$ "book" =
+ type$ "inbook" =
+ or
+ 'author.editor.full
+ { type$ "proceedings" =
+ 'editor.full
+ 'author.full
+ if$
+ }
+ if$
+}
+
+FUNCTION {output.bibitem}
+{ newline$
+ "\bibitem[" write$
+ label write$
+ ")" make.full.names duplicate$ short.list =
+ { pop$ }
+ { * }
+ if$
+ "]{" * write$
+ cite$ write$
+ "}" write$
+ newline$
+ ""
+ before.all 'output.state :=
+}
+
+FUNCTION {n.dashify}
+{ 't :=
+ ""
+ { t empty$ not }
+ { t #1 #1 substring$ "-" =
+ { t #1 #2 substring$ "--" = not
+ { "--" *
+ t #2 global.max$ substring$ 't :=
+ }
+ { { t #1 #1 substring$ "-" = }
+ { "-" *
+ t #2 global.max$ substring$ 't :=
+ }
+ while$
+ }
+ if$
+ }
+ { t #1 #1 substring$ *
+ t #2 global.max$ substring$ 't :=
+ }
+ if$
+ }
+ while$
+}
+
+FUNCTION {format.date}
+{ year duplicate$ empty$
+ { "empty year in " cite$ * warning$
+ pop$ "" }
+ 'skip$
+ if$
+ month empty$
+ 'skip$
+ { month
+ " " * swap$ *
+ }
+ if$
+ extra.label *
+ "\nmbibLink{" cite$ * "}{timeline}{" * swap$ * "}" *
+}
+
+FUNCTION {format.btitle}
+{ title emphasize
+}
+
+FUNCTION {tie.or.space.connect}
+{ duplicate$ text.length$ #3 <
+ { "~" }
+ { " " }
+ if$
+ swap$ * *
+}
+
+FUNCTION {either.or.check}
+{ empty$
+ 'pop$
+ { "can't use both " swap$ * " fields in " * cite$ * warning$ }
+ if$
+}
+
+FUNCTION {format.bvolume}
+{ volume empty$
+ { "" }
+ { "volume" volume tie.or.space.connect
+ series empty$
+ 'skip$
+ { " of " * series emphasize * }
+ if$
+ "volume and number" number either.or.check
+ }
+ if$
+}
+
+FUNCTION {format.number.series}
+{ volume empty$
+ { number empty$
+ { series field.or.null }
+ { output.state mid.sentence =
+ { "number" }
+ { "Number" }
+ if$
+ number tie.or.space.connect
+ series empty$
+ { "there's a number but no series in " cite$ * warning$ }
+ { " in " * series * }
+ if$
+ }
+ if$
+ }
+ { "" }
+ if$
+}
+
+FUNCTION {format.edition}
+{ edition empty$
+ { "" }
+ { output.state mid.sentence =
+ { edition "l" change.case$ " edition" * }
+ { edition "t" change.case$ " edition" * }
+ if$
+ }
+ if$
+}
+
+INTEGERS { multiresult }
+
+FUNCTION {multi.page.check}
+{ 't :=
+ #0 'multiresult :=
+ { multiresult not
+ t empty$ not
+ and
+ }
+ { t #1 #1 substring$
+ duplicate$ "-" =
+ swap$ duplicate$ "," =
+ swap$ "+" =
+ or or
+ { #1 'multiresult := }
+ { t #2 global.max$ substring$ 't := }
+ if$
+ }
+ while$
+ multiresult
+}
+
+FUNCTION {format.pages}
+{ pages empty$
+ { "" }
+ { pages multi.page.check
+ { "pages" pages n.dashify tie.or.space.connect }
+ { "page" pages tie.or.space.connect }
+ if$
+ }
+ if$
+}
+
+FUNCTION {format.eid}
+{ eid empty$
+ { "" }
+ { "art." eid tie.or.space.connect }
+ if$
+}
+
+FUNCTION {format.vol.num.pages}
+{ volume field.or.null
+ number empty$
+ 'skip$
+ { "\penalty0 (" number * ")" * *
+ volume empty$
+ { "there's a number but no volume in " cite$ * warning$ }
+ 'skip$
+ if$
+ }
+ if$
+ pages empty$
+ 'skip$
+ { duplicate$ empty$
+ { pop$ format.pages }
+ { ":\penalty0 " * pages n.dashify * }
+ if$
+ }
+ if$
+}
+
+FUNCTION {format.vol.num.eid}
+{ volume field.or.null
+ number empty$
+ 'skip$
+ { "\penalty0 (" number * ")" * *
+ volume empty$
+ { "there's a number but no volume in " cite$ * warning$ }
+ 'skip$
+ if$
+ }
+ if$
+ eid empty$
+ 'skip$
+ { duplicate$ empty$
+ { pop$ format.eid }
+ { ":\penalty0 " * eid * }
+ if$
+ }
+ if$
+}
+
+FUNCTION {format.chapter.pages}
+{ chapter empty$
+ 'format.pages
+ { type empty$
+ { "chapter" }
+ { type "l" change.case$ }
+ if$
+ chapter tie.or.space.connect
+ pages empty$
+ 'skip$
+ { ", " * format.pages * }
+ if$
+ }
+ if$
+}
+
+FUNCTION {format.in.ed.booktitle}
+{ booktitle empty$
+ { "" }
+ { editor empty$
+ { "In " booktitle emphasize * }
+ { "In " format.editors * ", " * booktitle emphasize * }
+ if$
+ }
+ if$
+}
+
+FUNCTION {empty.misc.check}
+{ author empty$ title empty$ howpublished empty$
+ month empty$ year empty$ note empty$
+ and and and and and
+ key empty$ not and
+ { "all relevant fields are empty in " cite$ * warning$ }
+ 'skip$
+ if$
+}
+
+FUNCTION {format.thesis.type}
+{ type empty$
+ 'skip$
+ { pop$
+ type "t" change.case$
+ }
+ if$
+}
+
+FUNCTION {format.tr.number}
+{ type empty$
+ { "Technical Report" }
+ 'type
+ if$
+ number empty$
+ { "t" change.case$ }
+ { number tie.or.space.connect }
+ if$
+}
+
+FUNCTION {format.article.crossref}
+{ key empty$
+ { journal empty$
+ { "need key or journal for " cite$ * " to crossref " * crossref *
+ warning$
+ ""
+ }
+ { "In \emph{" journal * "}" * }
+ if$
+ }
+ { "In " }
+ if$
+ " \citet{" * crossref * "}" *
+}
+
+FUNCTION {format.book.crossref}
+{ volume empty$
+ { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
+ "In "
+ }
+ { "Volume" volume tie.or.space.connect
+ " of " *
+ }
+ if$
+ editor empty$
+ editor field.or.null author field.or.null =
+ or
+ { key empty$
+ { series empty$
+ { "need editor, key, or series for " cite$ * " to crossref " *
+ crossref * warning$
+ "" *
+ }
+ { "\emph{" * series * "}" * }
+ if$
+ }
+ 'skip$
+ if$
+ }
+ 'skip$
+ if$
+ " \citet{" * crossref * "}" *
+}
+
+FUNCTION {format.incoll.inproc.crossref}
+{ editor empty$
+ editor field.or.null author field.or.null =
+ or
+ { key empty$
+ { booktitle empty$
+ { "need editor, key, or booktitle for " cite$ * " to crossref " *
+ crossref * warning$
+ ""
+ }
+ { "In \emph{" booktitle * "}" * }
+ if$
+ }
+ { "In " }
+ if$
+ }
+ { "In " }
+ if$
+ " \citet{" * crossref * "}" *
+}
+
+FUNCTION {article}
+{ output.bibitem
+ format.authors "author" output.check
+ author format.key output
+ new.block
+ format.title "title" output.check
+ new.block
+ crossref missing$
+ { journal emphasize "journal" output.check
+ eid empty$
+ { format.vol.num.pages output }
+ { format.vol.num.eid output }
+ if$
+ format.date "year" output.check
+ }
+ { format.article.crossref output.nonnull
+ eid empty$
+ { format.pages output }
+ { format.eid output }
+ if$
+ }
+ if$
+ format.issn output
+ format.doi output
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {book}
+{ output.bibitem
+ author empty$
+ { format.editors "author and editor" output.check
+ editor format.key output
+ }
+ { format.authors output.nonnull
+ crossref missing$
+ { "author and editor" editor either.or.check }
+ 'skip$
+ if$
+ }
+ if$
+ new.block
+ format.btitle "title" output.check
+ crossref missing$
+ { format.bvolume output
+ new.block
+ format.number.series output
+ new.sentence
+ publisher "publisher" output.check
+ address output
+ }
+ { new.block
+ format.book.crossref output.nonnull
+ }
+ if$
+ format.edition output
+ format.date "year" output.check
+ format.isbn output
+ format.doi output
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {booklet}
+{ output.bibitem
+ format.authors output
+ author format.key output
+ new.block
+ format.title "title" output.check
+ howpublished address new.block.checkb
+ howpublished output
+ address output
+ format.date output
+ format.isbn output
+ format.doi output
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {inbook}
+{ output.bibitem
+ author empty$
+ { format.editors "author and editor" output.check
+ editor format.key output
+ }
+ { format.authors output.nonnull
+ crossref missing$
+ { "author and editor" editor either.or.check }
+ 'skip$
+ if$
+ }
+ if$
+ new.block
+ format.btitle "title" output.check
+ crossref missing$
+ { format.bvolume output
+ format.chapter.pages "chapter and pages" output.check
+ new.block
+ format.number.series output
+ new.sentence
+ publisher "publisher" output.check
+ address output
+ }
+ { format.chapter.pages "chapter and pages" output.check
+ new.block
+ format.book.crossref output.nonnull
+ }
+ if$
+ format.edition output
+ format.date "year" output.check
+ format.isbn output
+ format.doi output
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {incollection}
+{ output.bibitem
+ format.authors "author" output.check
+ author format.key output
+ new.block
+ format.title "title" output.check
+ new.block
+ crossref missing$
+ { format.in.ed.booktitle "booktitle" output.check
+ format.bvolume output
+ format.number.series output
+ format.chapter.pages output
+ new.sentence
+ publisher "publisher" output.check
+ address output
+ format.edition output
+ format.date "year" output.check
+ }
+ { format.incoll.inproc.crossref output.nonnull
+ format.chapter.pages output
+ }
+ if$
+ format.isbn output
+ format.doi output
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {inproceedings}
+{ output.bibitem
+ format.authors "author" output.check
+ author format.key output
+ new.block
+ format.title "title" output.check
+ new.block
+ crossref missing$
+ { format.in.ed.booktitle "booktitle" output.check
+ format.bvolume output
+ format.number.series output
+ format.pages output
+ address empty$
+ { organization publisher new.sentence.checkb
+ organization output
+ publisher output
+ format.date "year" output.check
+ }
+ { address output.nonnull
+ format.date "year" output.check
+ new.sentence
+ organization output
+ publisher output
+ }
+ if$
+ }
+ { format.incoll.inproc.crossref output.nonnull
+ format.pages output
+ }
+ if$
+ format.isbn output
+ format.doi output
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {conference} { inproceedings }
+
+FUNCTION {manual}
+{ output.bibitem
+ format.authors output
+ author format.key output
+ new.block
+ format.btitle "title" output.check
+ organization address new.block.checkb
+ organization output
+ address output
+ format.edition output
+ format.date output
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {mastersthesis}
+{ output.bibitem
+ format.authors "author" output.check
+ author format.key output
+ new.block
+ format.title "title" output.check
+ new.block
+ "Master's thesis" format.thesis.type output.nonnull
+ school "school" output.check
+ address output
+ format.date "year" output.check
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {misc}
+{ output.bibitem
+ format.authors output
+ author format.key output
+ title howpublished new.block.checkb
+ format.title output
+ howpublished new.block.checka
+ howpublished output
+ format.date output
+ format.issn output
+ format.url output
+ new.block
+ note output
+ fin.entry
+ empty.misc.check
+}
+
+FUNCTION {phdthesis}
+{ output.bibitem
+ format.authors "author" output.check
+ author format.key output
+ new.block
+ format.btitle "title" output.check
+ new.block
+ "PhD thesis" format.thesis.type output.nonnull
+ school "school" output.check
+ address output
+ format.date "year" output.check
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {proceedings}
+{ output.bibitem
+ format.editors output
+ editor format.key output
+ new.block
+ format.btitle "title" output.check
+ format.bvolume output
+ format.number.series output
+ address output
+ format.date "year" output.check
+ new.sentence
+ organization output
+ publisher output
+ format.isbn output
+ format.doi output
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {techreport}
+{ output.bibitem
+ format.authors "author" output.check
+ author format.key output
+ new.block
+ format.title "title" output.check
+ new.block
+ format.tr.number output.nonnull
+ institution "institution" output.check
+ address output
+ format.date "year" output.check
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {unpublished}
+{ output.bibitem
+ format.authors "author" output.check
+ author format.key output
+ new.block
+ format.title "title" output.check
+ new.block
+ note "note" output.check
+ format.date output
+ format.url output
+ fin.entry
+}
+
+FUNCTION {default.type} { misc }
+
+
+MACRO {jan} {"January"}
+
+MACRO {feb} {"February"}
+
+MACRO {mar} {"March"}
+
+MACRO {apr} {"April"}
+
+MACRO {may} {"May"}
+
+MACRO {jun} {"June"}
+
+MACRO {jul} {"July"}
+
+MACRO {aug} {"August"}
+
+MACRO {sep} {"September"}
+
+MACRO {oct} {"October"}
+
+MACRO {nov} {"November"}
+
+MACRO {dec} {"December"}
+
+
+
+MACRO {acmcs} {"ACM Computing Surveys"}
+
+MACRO {acta} {"Acta Informatica"}
+
+MACRO {cacm} {"Communications of the ACM"}
+
+MACRO {ibmjrd} {"IBM Journal of Research and Development"}
+
+MACRO {ibmsj} {"IBM Systems Journal"}
+
+MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
+
+MACRO {ieeetc} {"IEEE Transactions on Computers"}
+
+MACRO {ieeetcad}
+ {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
+
+MACRO {ipl} {"Information Processing Letters"}
+
+MACRO {jacm} {"Journal of the ACM"}
+
+MACRO {jcss} {"Journal of Computer and System Sciences"}
+
+MACRO {scp} {"Science of Computer Programming"}
+
+MACRO {sicomp} {"SIAM Journal on Computing"}
+
+MACRO {tocs} {"ACM Transactions on Computer Systems"}
+
+MACRO {tods} {"ACM Transactions on Database Systems"}
+
+MACRO {tog} {"ACM Transactions on Graphics"}
+
+MACRO {toms} {"ACM Transactions on Mathematical Software"}
+
+MACRO {toois} {"ACM Transactions on Office Information Systems"}
+
+MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
+
+MACRO {tcs} {"Theoretical Computer Science"}
+
+
+READ
+
+FUNCTION {sortify}
+{ purify$
+ "l" change.case$
+}
+
+INTEGERS { len }
+
+FUNCTION {chop.word}
+{ 's :=
+ 'len :=
+ s #1 len substring$ =
+ { s len #1 + global.max$ substring$ }
+ 's
+ if$
+}
+
+FUNCTION {format.lab.names}
+{ 's :=
+ s #1 "{vv~}{ll}" format.name$
+ s num.names$ duplicate$
+ #2 >
+ { pop$ " et~al." * }
+ { #2 <
+ 'skip$
+ { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
+ { " et~al." * }
+ { " and " * s #2 "{vv~}{ll}" format.name$ * }
+ if$
+ }
+ if$
+ }
+ if$
+}
+
+FUNCTION {author.key.label}
+{ author empty$
+ { key empty$
+ { cite$ #1 #3 substring$ }
+ 'key
+ if$
+ }
+ { author format.lab.names }
+ if$
+}
+
+FUNCTION {author.editor.key.label}
+{ author empty$
+ { editor empty$
+ { key empty$
+ { cite$ #1 #3 substring$ }
+ 'key
+ if$
+ }
+ { editor format.lab.names }
+ if$
+ }
+ { author format.lab.names }
+ if$
+}
+
+FUNCTION {author.key.organization.label}
+{ author empty$
+ { key empty$
+ { organization empty$
+ { cite$ #1 #3 substring$ }
+ { "The " #4 organization chop.word #3 text.prefix$ }
+ if$
+ }
+ 'key
+ if$
+ }
+ { author format.lab.names }
+ if$
+}
+
+FUNCTION {editor.key.organization.label}
+{ editor empty$
+ { key empty$
+ { organization empty$
+ { cite$ #1 #3 substring$ }
+ { "The " #4 organization chop.word #3 text.prefix$ }
+ if$
+ }
+ 'key
+ if$
+ }
+ { editor format.lab.names }
+ if$
+}
+
+FUNCTION {calc.short.authors}
+{ type$ "book" =
+ type$ "inbook" =
+ or
+ 'author.editor.key.label
+ { type$ "proceedings" =
+ 'editor.key.organization.label
+ { type$ "manual" =
+ 'author.key.organization.label
+ 'author.key.label
+ if$
+ }
+ if$
+ }
+ if$
+ 'short.list :=
+}
+
+FUNCTION {calc.label}
+{ calc.short.authors
+ short.list
+ "("
+ *
+ year duplicate$ empty$
+ short.list key field.or.null = or
+ { pop$ "" }
+ 'skip$
+ if$
+ *
+ 'label :=
+}
+
+FUNCTION {sort.format.names}
+{ 's :=
+ #1 'nameptr :=
+ ""
+ s num.names$ 'numnames :=
+ numnames 'namesleft :=
+ { namesleft #0 > }
+ {
+ s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't :=
+ nameptr #1 >
+ {
+ " " *
+ namesleft #1 = t "others" = and
+ { "zzzzz" * }
+ { numnames #2 > nameptr #2 = and
+ { "zz" * year field.or.null * " " * }
+ 'skip$
+ if$
+ t sortify *
+ }
+ if$
+ }
+ { t sortify * }
+ if$
+ nameptr #1 + 'nameptr :=
+ namesleft #1 - 'namesleft :=
+ }
+ while$
+}
+
+FUNCTION {sort.format.title}
+{ 't :=
+ "A " #2
+ "An " #3
+ "The " #4 t chop.word
+ chop.word
+ chop.word
+ sortify
+ #1 global.max$ substring$
+}
+
+FUNCTION {author.sort}
+{ author empty$
+ { key empty$
+ { "to sort, need author or key in " cite$ * warning$
+ ""
+ }
+ { key sortify }
+ if$
+ }
+ { author sort.format.names }
+ if$
+}
+
+FUNCTION {author.editor.sort}
+{ author empty$
+ { editor empty$
+ { key empty$
+ { "to sort, need author, editor, or key in " cite$ * warning$
+ ""
+ }
+ { key sortify }
+ if$
+ }
+ { editor sort.format.names }
+ if$
+ }
+ { author sort.format.names }
+ if$
+}
+
+FUNCTION {author.organization.sort}
+{ author empty$
+ { organization empty$
+ { key empty$
+ { "to sort, need author, organization, or key in " cite$ * warning$
+ ""
+ }
+ { key sortify }
+ if$
+ }
+ { "The " #4 organization chop.word sortify }
+ if$
+ }
+ { author sort.format.names }
+ if$
+}
+
+FUNCTION {editor.organization.sort}
+{ editor empty$
+ { organization empty$
+ { key empty$
+ { "to sort, need editor, organization, or key in " cite$ * warning$
+ ""
+ }
+ { key sortify }
+ if$
+ }
+ { "The " #4 organization chop.word sortify }
+ if$
+ }
+ { editor sort.format.names }
+ if$
+}
+
+
+FUNCTION {presort}
+{ calc.label
+ label sortify
+ " "
+ *
+ type$ "book" =
+ type$ "inbook" =
+ or
+ 'author.editor.sort
+ { type$ "proceedings" =
+ 'editor.organization.sort
+ { type$ "manual" =
+ 'author.organization.sort
+ 'author.sort
+ if$
+ }
+ if$
+ }
+ if$
+ " "
+ *
+ year field.or.null sortify
+ *
+ " "
+ *
+ cite$
+ *
+ #1 entry.max$ substring$
+ 'sort.label :=
+ sort.label *
+ #1 entry.max$ substring$
+ 'sort.key$ :=
+}
+
+ITERATE {presort}
+
+SORT
+
+STRINGS { longest.label last.label next.extra }
+
+INTEGERS { longest.label.width last.extra.num number.label }
+
+FUNCTION {initialize.longest.label}
+{ "" 'longest.label :=
+ #0 int.to.chr$ 'last.label :=
+ "" 'next.extra :=
+ #0 'longest.label.width :=
+ #0 'last.extra.num :=
+ #0 'number.label :=
+}
+
+FUNCTION {forward.pass}
+{ last.label label =
+ { last.extra.num #1 + 'last.extra.num :=
+ last.extra.num int.to.chr$ 'extra.label :=
+ }
+ { "a" chr.to.int$ 'last.extra.num :=
+ "" 'extra.label :=
+ label 'last.label :=
+ }
+ if$
+ number.label #1 + 'number.label :=
+}
+
+FUNCTION {reverse.pass}
+{ next.extra "b" =
+ { "a" 'extra.label := }
+ 'skip$
+ if$
+ extra.label 'next.extra :=
+ extra.label
+ duplicate$ empty$
+ 'skip$
+ { "{\natexlab{" swap$ * "}}" * }
+ if$
+ 'extra.label :=
+ label extra.label * 'label :=
+}
+
+EXECUTE {initialize.longest.label}
+
+ITERATE {forward.pass}
+
+REVERSE {reverse.pass}
+
+FUNCTION {bib.sort.order}
+{ sort.label 'sort.key$ :=
+}
+
+ITERATE {bib.sort.order}
+
+SORT
+
+FUNCTION {begin.bib}
+{ preamble$ empty$
+ 'skip$
+ { preamble$ write$ newline$ }
+ if$
+ "\begin{thebibliography}{" number.label int.to.str$ * "}" *
+ write$ newline$
+ "\providecommand{\natexlab}[1]{#1}"
+ write$ newline$
+ "\providecommand{\url}[1]{\texttt{#1}}"
+ write$ newline$
+ "\expandafter\ifx\csname urlstyle\endcsname\relax"
+ write$ newline$
+ " \providecommand{\doi}[1]{doi: #1}\else"
+ write$ newline$
+ " \providecommand{\doi}{doi: \begingroup \urlstyle{rm}\Url}\fi"
+ write$ newline$
+ " \providecommand{\nmbibLink}[3]{#3}"
+ write$ newline$
+}
+
+EXECUTE {begin.bib}
+
+EXECUTE {init.state.consts}
+
+ITERATE {call.type$}
+
+FUNCTION {end.bib}
+{ newline$
+ "\end{thebibliography}" write$ newline$
+}
+
+EXECUTE {end.bib}
diff --git a/macros/latex/contrib/nmbib/type.bib b/macros/latex/contrib/nmbib/type.bib
new file mode 100644
index 0000000000..4f061811ec
--- /dev/null
+++ b/macros/latex/contrib/nmbib/type.bib
@@ -0,0 +1,54 @@
+@string{TUB = "TUGboat: Communications of the {\TeX} Users Group"}
+@string{TUG = "TUG: {\TeX} Users Group Meeting"}
+
+@misc{Daly:Customizing_Bibliographic_Style_Files,
+ author = "Patrick W. Daly",
+ year = "2007",
+ title = "Customizing Bibliographic Style Files",
+ note = "\url{http://mirrors.ctan.org/macros/latex/contrib/custom-bib/makebst.pdf}"
+}
+
+@misc{Daly:merlin.mbs,
+ author = "Patrick W. Daly",
+ year = "2011",
+ month = oct,
+ title = "{A Master Bibliographic Style File for numerical, author--year, multilingual applications}",
+ note = "\url{http://mirrors.ctan.org/macros/latex/contrib/custom-bib/merlin.pdf} v.\,4.33"
+}
+
+@book{kopka03,
+ ISBN = {0-321-17385-6},
+ keywords = {Typography, LaTeX, Word Processing},
+ year = {2003},
+ author = {Helmut Kopka and Patrick W. Daly},
+ title = {Guide to LaTeX},
+ pages = {624},
+ edition = {4th},
+ publisher = {Addison-Wesley Professional}
+}
+
+@misc{Markey:Tame_the_BeaST,
+ author = "Nicolas Markey",
+ year = "2009",
+ month = oct,
+ title = "{Tame the BeaST: The B to X of Bib{\TeX}}",
+ note = "\url{http://mirrors.ctan.org/info/bibtex/tamethebeast/ttb_en.pdf}, v.\,1.4"
+}
+
+@article{Mori:Managing_bibliographies,
+ author = "Lapo F. Mori",
+ journal = TUG,
+ volume = 30,
+ number = 1,
+ year = 2009,
+ pages = "36-48",
+ title = "Managing bibliographies with {\LaTeX}"
+}
+
+@misc{Patashnik:bibtexing,
+ author = "Oren Patashnik",
+ year = "1998",
+ title = "Bib{\TeX}ing",
+ note = "\url{http://mirrors.ctan.org/biblio/bibtex/contrib/doc/btxdoc.pdf}"
+}
+
diff --git a/macros/latex/contrib/nmbib/unsrtnm.bst b/macros/latex/contrib/nmbib/unsrtnm.bst
new file mode 100644
index 0000000000..490614a056
--- /dev/null
+++ b/macros/latex/contrib/nmbib/unsrtnm.bst
@@ -0,0 +1,1316 @@
+%% File unsrtnm.bst.
+%% Based on unsrtnat.bst by Patric W. Daly
+%%
+%% 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.
+%%
+%%
+%%
+%% ORIGINAL COPYRIGHT STATEMENT
+%% File: `unsrtnat.bst'
+%% A modification of `unsrt.bst' for use with natbib package
+%%
+%% Copyright 1993-2007 Patrick W Daly
+%% Max-Planck-Institut f\"ur Sonnensystemforschung
+%% Max-Planck-Str. 2
+%% D-37191 Katlenburg-Lindau
+%% Germany
+%% E-mail: daly@mps.mpg.de
+%%
+%% This program can be redistributed and/or modified under the terms
+%% of the LaTeX Project Public License Distributed from CTAN
+%% archives in directory macros/latex/base/lppl.txt; either
+%% version 1 of the License, or any later version.
+%%
+%% END ORIGINAL COPYRIGHT STATEMENT
+%%
+%%
+%%
+ENTRY
+ { address
+ author
+ booktitle
+ chapter
+ doi
+ eid
+ edition
+ editor
+ howpublished
+ institution
+ isbn
+ issn
+ journal
+ key
+ month
+ note
+ number
+ organization
+ pages
+ publisher
+ school
+ series
+ title
+ type
+ url
+ volume
+ year
+ }
+ {}
+ { label extra.label sort.label short.list }
+
+INTEGERS { output.state before.all mid.sentence after.sentence after.block }
+
+FUNCTION {init.state.consts}
+{ #0 'before.all :=
+ #1 'mid.sentence :=
+ #2 'after.sentence :=
+ #3 'after.block :=
+}
+
+STRINGS { s t }
+
+FUNCTION {output.nonnull}
+{ 's :=
+ output.state mid.sentence =
+ { ", " * write$ }
+ { output.state after.block =
+ { add.period$ write$
+ newline$
+ "\newblock " write$
+ }
+ { output.state before.all =
+ 'write$
+ { add.period$ " " * write$ }
+ if$
+ }
+ if$
+ mid.sentence 'output.state :=
+ }
+ if$
+ s
+}
+
+FUNCTION {output}
+{ duplicate$ empty$
+ 'pop$
+ 'output.nonnull
+ if$
+}
+
+FUNCTION {output.check}
+{ 't :=
+ duplicate$ empty$
+ { pop$ "empty " t * " in " * cite$ * warning$ }
+ 'output.nonnull
+ if$
+}
+
+FUNCTION {fin.entry}
+{ add.period$
+ write$
+ newline$
+}
+
+FUNCTION {new.block}
+{ output.state before.all =
+ 'skip$
+ { after.block 'output.state := }
+ if$
+}
+
+FUNCTION {new.sentence}
+{ output.state after.block =
+ 'skip$
+ { output.state before.all =
+ 'skip$
+ { after.sentence 'output.state := }
+ if$
+ }
+ if$
+}
+
+FUNCTION {not}
+{ { #0 }
+ { #1 }
+ if$
+}
+
+FUNCTION {and}
+{ 'skip$
+ { pop$ #0 }
+ if$
+}
+
+FUNCTION {or}
+{ { pop$ #1 }
+ 'skip$
+ if$
+}
+
+FUNCTION {new.block.checka}
+{ empty$
+ 'skip$
+ 'new.block
+ if$
+}
+
+FUNCTION {new.block.checkb}
+{ empty$
+ swap$ empty$
+ and
+ 'skip$
+ 'new.block
+ if$
+}
+
+FUNCTION {new.sentence.checka}
+{ empty$
+ 'skip$
+ 'new.sentence
+ if$
+}
+
+FUNCTION {new.sentence.checkb}
+{ empty$
+ swap$ empty$
+ and
+ 'skip$
+ 'new.sentence
+ if$
+}
+
+FUNCTION {field.or.null}
+{ duplicate$ empty$
+ { pop$ "" }
+ 'skip$
+ if$
+}
+
+FUNCTION {emphasize}
+{ duplicate$ empty$
+ { pop$ "" }
+ { "\emph{" swap$ * "}" * }
+ if$
+}
+
+INTEGERS { nameptr namesleft numnames }
+
+FUNCTION {format.names}
+{ 's :=
+ #1 'nameptr :=
+ s num.names$ 'numnames :=
+ numnames 'namesleft :=
+ { namesleft #0 > }
+ { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
+ nameptr #1 >
+ { namesleft #1 >
+ { ", " * t * }
+ { numnames #2 >
+ { "," * }
+ 'skip$
+ if$
+ t "others" =
+ { " et~al." * }
+ { " and " * t * }
+ if$
+ }
+ if$
+ }
+ 't
+ if$
+ nameptr #1 + 'nameptr :=
+ namesleft #1 - 'namesleft :=
+ }
+ while$
+ "\nmbibLink{" cite$ * "}{authors}{" * swap$ * "}" *
+}
+
+FUNCTION {format.key}
+{ empty$
+ { key field.or.null }
+ { "" }
+ if$
+}
+
+FUNCTION {format.authors}
+{ author empty$
+ { "" }
+ { author format.names }
+ if$
+}
+
+FUNCTION {format.editors}
+{ editor empty$
+ { "" }
+ { editor format.names
+ editor num.names$ #1 >
+ { ", editors" * }
+ { ", editor" * }
+ if$
+ }
+ if$
+}
+
+FUNCTION {format.isbn}
+{ isbn empty$
+ { "" }
+ { new.block "ISBN " isbn * }
+ if$
+}
+
+FUNCTION {format.issn}
+{ issn empty$
+ { "" }
+ { new.block "ISSN " issn * }
+ if$
+}
+
+FUNCTION {format.url}
+{ url empty$
+ { "" }
+ { new.block "URL \url{" url * "}" * }
+ if$
+}
+
+FUNCTION {format.doi}
+{ doi empty$
+ { "" }
+ { new.block "\doi{" doi * "}" * }
+ if$
+}
+
+FUNCTION {format.title}
+{ title empty$
+ { "" }
+ { title "t" change.case$ }
+ if$
+}
+
+FUNCTION {format.full.names}
+{'s :=
+ #1 'nameptr :=
+ s num.names$ 'numnames :=
+ numnames 'namesleft :=
+ { namesleft #0 > }
+ { s nameptr
+ "{vv~}{ll}" format.name$ 't :=
+ nameptr #1 >
+ {
+ namesleft #1 >
+ { ", " * t * }
+ {
+ numnames #2 >
+ { "," * }
+ 'skip$
+ if$
+ t "others" =
+ { " et~al." * }
+ { " and " * t * }
+ if$
+ }
+ if$
+ }
+ 't
+ if$
+ nameptr #1 + 'nameptr :=
+ namesleft #1 - 'namesleft :=
+ }
+ while$
+}
+
+FUNCTION {author.editor.full}
+{ author empty$
+ { editor empty$
+ { "" }
+ { editor format.full.names }
+ if$
+ }
+ { author format.full.names }
+ if$
+}
+
+FUNCTION {author.full}
+{ author empty$
+ { "" }
+ { author format.full.names }
+ if$
+}
+
+FUNCTION {editor.full}
+{ editor empty$
+ { "" }
+ { editor format.full.names }
+ if$
+}
+
+FUNCTION {make.full.names}
+{ type$ "book" =
+ type$ "inbook" =
+ or
+ 'author.editor.full
+ { type$ "proceedings" =
+ 'editor.full
+ 'author.full
+ if$
+ }
+ if$
+}
+
+FUNCTION {output.bibitem}
+{ newline$
+ "\bibitem[" write$
+ label write$
+ ")" make.full.names duplicate$ short.list =
+ { pop$ }
+ { * }
+ if$
+ "]{" * write$
+ cite$ write$
+ "}" write$
+ newline$
+ ""
+ before.all 'output.state :=
+}
+
+FUNCTION {n.dashify}
+{ 't :=
+ ""
+ { t empty$ not }
+ { t #1 #1 substring$ "-" =
+ { t #1 #2 substring$ "--" = not
+ { "--" *
+ t #2 global.max$ substring$ 't :=
+ }
+ { { t #1 #1 substring$ "-" = }
+ { "-" *
+ t #2 global.max$ substring$ 't :=
+ }
+ while$
+ }
+ if$
+ }
+ { t #1 #1 substring$ *
+ t #2 global.max$ substring$ 't :=
+ }
+ if$
+ }
+ while$
+}
+
+FUNCTION {format.date}
+{ year duplicate$ empty$
+ { "empty year in " cite$ * warning$
+ pop$ "" }
+ 'skip$
+ if$
+ month empty$
+ 'skip$
+ { month
+ " " * swap$ *
+ }
+ if$
+ extra.label *
+ "\nmbibLink{" cite$ * "}{timeline}{" * swap$ * "}" *
+}
+
+FUNCTION {format.btitle}
+{ title emphasize
+}
+
+FUNCTION {tie.or.space.connect}
+{ duplicate$ text.length$ #3 <
+ { "~" }
+ { " " }
+ if$
+ swap$ * *
+}
+
+FUNCTION {either.or.check}
+{ empty$
+ 'pop$
+ { "can't use both " swap$ * " fields in " * cite$ * warning$ }
+ if$
+}
+
+FUNCTION {format.bvolume}
+{ volume empty$
+ { "" }
+ { "volume" volume tie.or.space.connect
+ series empty$
+ 'skip$
+ { " of " * series emphasize * }
+ if$
+ "volume and number" number either.or.check
+ }
+ if$
+}
+
+FUNCTION {format.number.series}
+{ volume empty$
+ { number empty$
+ { series field.or.null }
+ { output.state mid.sentence =
+ { "number" }
+ { "Number" }
+ if$
+ number tie.or.space.connect
+ series empty$
+ { "there's a number but no series in " cite$ * warning$ }
+ { " in " * series * }
+ if$
+ }
+ if$
+ }
+ { "" }
+ if$
+}
+
+FUNCTION {format.edition}
+{ edition empty$
+ { "" }
+ { output.state mid.sentence =
+ { edition "l" change.case$ " edition" * }
+ { edition "t" change.case$ " edition" * }
+ if$
+ }
+ if$
+}
+
+INTEGERS { multiresult }
+
+FUNCTION {multi.page.check}
+{ 't :=
+ #0 'multiresult :=
+ { multiresult not
+ t empty$ not
+ and
+ }
+ { t #1 #1 substring$
+ duplicate$ "-" =
+ swap$ duplicate$ "," =
+ swap$ "+" =
+ or or
+ { #1 'multiresult := }
+ { t #2 global.max$ substring$ 't := }
+ if$
+ }
+ while$
+ multiresult
+}
+
+FUNCTION {format.pages}
+{ pages empty$
+ { "" }
+ { pages multi.page.check
+ { "pages" pages n.dashify tie.or.space.connect }
+ { "page" pages tie.or.space.connect }
+ if$
+ }
+ if$
+}
+
+FUNCTION {format.eid}
+{ eid empty$
+ { "" }
+ { "art." eid tie.or.space.connect }
+ if$
+}
+
+FUNCTION {format.vol.num.pages}
+{ volume field.or.null
+ number empty$
+ 'skip$
+ { "\penalty0 (" number * ")" * *
+ volume empty$
+ { "there's a number but no volume in " cite$ * warning$ }
+ 'skip$
+ if$
+ }
+ if$
+ pages empty$
+ 'skip$
+ { duplicate$ empty$
+ { pop$ format.pages }
+ { ":\penalty0 " * pages n.dashify * }
+ if$
+ }
+ if$
+}
+
+FUNCTION {format.vol.num.eid}
+{ volume field.or.null
+ number empty$
+ 'skip$
+ { "\penalty0 (" number * ")" * *
+ volume empty$
+ { "there's a number but no volume in " cite$ * warning$ }
+ 'skip$
+ if$
+ }
+ if$
+ eid empty$
+ 'skip$
+ { duplicate$ empty$
+ { pop$ format.eid }
+ { ":\penalty0 " * eid * }
+ if$
+ }
+ if$
+}
+
+FUNCTION {format.chapter.pages}
+{ chapter empty$
+ 'format.pages
+ { type empty$
+ { "chapter" }
+ { type "l" change.case$ }
+ if$
+ chapter tie.or.space.connect
+ pages empty$
+ 'skip$
+ { ", " * format.pages * }
+ if$
+ }
+ if$
+}
+
+FUNCTION {format.in.ed.booktitle}
+{ booktitle empty$
+ { "" }
+ { editor empty$
+ { "In " booktitle emphasize * }
+ { "In " format.editors * ", " * booktitle emphasize * }
+ if$
+ }
+ if$
+}
+
+FUNCTION {empty.misc.check}
+{ author empty$ title empty$ howpublished empty$
+ month empty$ year empty$ note empty$
+ and and and and and
+ key empty$ not and
+ { "all relevant fields are empty in " cite$ * warning$ }
+ 'skip$
+ if$
+}
+
+FUNCTION {format.thesis.type}
+{ type empty$
+ 'skip$
+ { pop$
+ type "t" change.case$
+ }
+ if$
+}
+
+FUNCTION {format.tr.number}
+{ type empty$
+ { "Technical Report" }
+ 'type
+ if$
+ number empty$
+ { "t" change.case$ }
+ { number tie.or.space.connect }
+ if$
+}
+
+FUNCTION {format.article.crossref}
+{ key empty$
+ { journal empty$
+ { "need key or journal for " cite$ * " to crossref " * crossref *
+ warning$
+ ""
+ }
+ { "In \emph{" journal * "}" * }
+ if$
+ }
+ { "In " }
+ if$
+ " \citet{" * crossref * "}" *
+}
+
+FUNCTION {format.book.crossref}
+{ volume empty$
+ { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
+ "In "
+ }
+ { "Volume" volume tie.or.space.connect
+ " of " *
+ }
+ if$
+ editor empty$
+ editor field.or.null author field.or.null =
+ or
+ { key empty$
+ { series empty$
+ { "need editor, key, or series for " cite$ * " to crossref " *
+ crossref * warning$
+ "" *
+ }
+ { "\emph{" * series * "}" * }
+ if$
+ }
+ 'skip$
+ if$
+ }
+ 'skip$
+ if$
+ " \citet{" * crossref * "}" *
+}
+
+FUNCTION {format.incoll.inproc.crossref}
+{ editor empty$
+ editor field.or.null author field.or.null =
+ or
+ { key empty$
+ { booktitle empty$
+ { "need editor, key, or booktitle for " cite$ * " to crossref " *
+ crossref * warning$
+ ""
+ }
+ { "In \emph{" booktitle * "}" * }
+ if$
+ }
+ { "In " }
+ if$
+ }
+ { "In " }
+ if$
+ " \citet{" * crossref * "}" *
+}
+
+FUNCTION {article}
+{ output.bibitem
+ format.authors "author" output.check
+ author format.key output
+ new.block
+ format.title "title" output.check
+ new.block
+ crossref missing$
+ { journal emphasize "journal" output.check
+ eid empty$
+ { format.vol.num.pages output }
+ { format.vol.num.eid output }
+ if$
+ format.date "year" output.check
+ }
+ { format.article.crossref output.nonnull
+ eid empty$
+ { format.pages output }
+ { format.eid output }
+ if$
+ }
+ if$
+ format.issn output
+ format.doi output
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {book}
+{ output.bibitem
+ author empty$
+ { format.editors "author and editor" output.check
+ editor format.key output
+ }
+ { format.authors output.nonnull
+ crossref missing$
+ { "author and editor" editor either.or.check }
+ 'skip$
+ if$
+ }
+ if$
+ new.block
+ format.btitle "title" output.check
+ crossref missing$
+ { format.bvolume output
+ new.block
+ format.number.series output
+ new.sentence
+ publisher "publisher" output.check
+ address output
+ }
+ { new.block
+ format.book.crossref output.nonnull
+ }
+ if$
+ format.edition output
+ format.date "year" output.check
+ format.isbn output
+ format.doi output
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {booklet}
+{ output.bibitem
+ format.authors output
+ author format.key output
+ new.block
+ format.title "title" output.check
+ howpublished address new.block.checkb
+ howpublished output
+ address output
+ format.date output
+ format.isbn output
+ format.doi output
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {inbook}
+{ output.bibitem
+ author empty$
+ { format.editors "author and editor" output.check
+ editor format.key output
+ }
+ { format.authors output.nonnull
+ crossref missing$
+ { "author and editor" editor either.or.check }
+ 'skip$
+ if$
+ }
+ if$
+ new.block
+ format.btitle "title" output.check
+ crossref missing$
+ { format.bvolume output
+ format.chapter.pages "chapter and pages" output.check
+ new.block
+ format.number.series output
+ new.sentence
+ publisher "publisher" output.check
+ address output
+ }
+ { format.chapter.pages "chapter and pages" output.check
+ new.block
+ format.book.crossref output.nonnull
+ }
+ if$
+ format.edition output
+ format.date "year" output.check
+ format.isbn output
+ format.doi output
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {incollection}
+{ output.bibitem
+ format.authors "author" output.check
+ author format.key output
+ new.block
+ format.title "title" output.check
+ new.block
+ crossref missing$
+ { format.in.ed.booktitle "booktitle" output.check
+ format.bvolume output
+ format.number.series output
+ format.chapter.pages output
+ new.sentence
+ publisher "publisher" output.check
+ address output
+ format.edition output
+ format.date "year" output.check
+ }
+ { format.incoll.inproc.crossref output.nonnull
+ format.chapter.pages output
+ }
+ if$
+ format.isbn output
+ format.doi output
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {inproceedings}
+{ output.bibitem
+ format.authors "author" output.check
+ author format.key output
+ new.block
+ format.title "title" output.check
+ new.block
+ crossref missing$
+ { format.in.ed.booktitle "booktitle" output.check
+ format.bvolume output
+ format.number.series output
+ format.pages output
+ address empty$
+ { organization publisher new.sentence.checkb
+ organization output
+ publisher output
+ format.date "year" output.check
+ }
+ { address output.nonnull
+ format.date "year" output.check
+ new.sentence
+ organization output
+ publisher output
+ }
+ if$
+ }
+ { format.incoll.inproc.crossref output.nonnull
+ format.pages output
+ }
+ if$
+ format.isbn output
+ format.doi output
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {conference} { inproceedings }
+
+FUNCTION {manual}
+{ output.bibitem
+ format.authors output
+ author format.key output
+ new.block
+ format.btitle "title" output.check
+ organization address new.block.checkb
+ organization output
+ address output
+ format.edition output
+ format.date output
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {mastersthesis}
+{ output.bibitem
+ format.authors "author" output.check
+ author format.key output
+ new.block
+ format.title "title" output.check
+ new.block
+ "Master's thesis" format.thesis.type output.nonnull
+ school "school" output.check
+ address output
+ format.date "year" output.check
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {misc}
+{ output.bibitem
+ format.authors output
+ author format.key output
+ title howpublished new.block.checkb
+ format.title output
+ howpublished new.block.checka
+ howpublished output
+ format.date output
+ format.issn output
+ format.url output
+ new.block
+ note output
+ fin.entry
+ empty.misc.check
+}
+
+FUNCTION {phdthesis}
+{ output.bibitem
+ format.authors "author" output.check
+ author format.key output
+ new.block
+ format.btitle "title" output.check
+ new.block
+ "PhD thesis" format.thesis.type output.nonnull
+ school "school" output.check
+ address output
+ format.date "year" output.check
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {proceedings}
+{ output.bibitem
+ format.editors output
+ editor format.key output
+ new.block
+ format.btitle "title" output.check
+ format.bvolume output
+ format.number.series output
+ address output
+ format.date "year" output.check
+ new.sentence
+ organization output
+ publisher output
+ format.isbn output
+ format.doi output
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {techreport}
+{ output.bibitem
+ format.authors "author" output.check
+ author format.key output
+ new.block
+ format.title "title" output.check
+ new.block
+ format.tr.number output.nonnull
+ institution "institution" output.check
+ address output
+ format.date "year" output.check
+ format.url output
+ new.block
+ note output
+ fin.entry
+}
+
+FUNCTION {unpublished}
+{ output.bibitem
+ format.authors "author" output.check
+ author format.key output
+ new.block
+ format.title "title" output.check
+ new.block
+ note "note" output.check
+ format.date output
+ format.url output
+ fin.entry
+}
+
+FUNCTION {default.type} { misc }
+
+
+MACRO {jan} {"January"}
+
+MACRO {feb} {"February"}
+
+MACRO {mar} {"March"}
+
+MACRO {apr} {"April"}
+
+MACRO {may} {"May"}
+
+MACRO {jun} {"June"}
+
+MACRO {jul} {"July"}
+
+MACRO {aug} {"August"}
+
+MACRO {sep} {"September"}
+
+MACRO {oct} {"October"}
+
+MACRO {nov} {"November"}
+
+MACRO {dec} {"December"}
+
+
+
+MACRO {acmcs} {"ACM Computing Surveys"}
+
+MACRO {acta} {"Acta Informatica"}
+
+MACRO {cacm} {"Communications of the ACM"}
+
+MACRO {ibmjrd} {"IBM Journal of Research and Development"}
+
+MACRO {ibmsj} {"IBM Systems Journal"}
+
+MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
+
+MACRO {ieeetc} {"IEEE Transactions on Computers"}
+
+MACRO {ieeetcad}
+ {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
+
+MACRO {ipl} {"Information Processing Letters"}
+
+MACRO {jacm} {"Journal of the ACM"}
+
+MACRO {jcss} {"Journal of Computer and System Sciences"}
+
+MACRO {scp} {"Science of Computer Programming"}
+
+MACRO {sicomp} {"SIAM Journal on Computing"}
+
+MACRO {tocs} {"ACM Transactions on Computer Systems"}
+
+MACRO {tods} {"ACM Transactions on Database Systems"}
+
+MACRO {tog} {"ACM Transactions on Graphics"}
+
+MACRO {toms} {"ACM Transactions on Mathematical Software"}
+
+MACRO {toois} {"ACM Transactions on Office Information Systems"}
+
+MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
+
+MACRO {tcs} {"Theoretical Computer Science"}
+
+
+READ
+
+FUNCTION {sortify}
+{ purify$
+ "l" change.case$
+}
+
+INTEGERS { len }
+
+FUNCTION {chop.word}
+{ 's :=
+ 'len :=
+ s #1 len substring$ =
+ { s len #1 + global.max$ substring$ }
+ 's
+ if$
+}
+
+FUNCTION {format.lab.names}
+{ 's :=
+ s #1 "{vv~}{ll}" format.name$
+ s num.names$ duplicate$
+ #2 >
+ { pop$ " et~al." * }
+ { #2 <
+ 'skip$
+ { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
+ { " et~al." * }
+ { " and " * s #2 "{vv~}{ll}" format.name$ * }
+ if$
+ }
+ if$
+ }
+ if$
+}
+
+FUNCTION {author.key.label}
+{ author empty$
+ { key empty$
+ { cite$ #1 #3 substring$ }
+ 'key
+ if$
+ }
+ { author format.lab.names }
+ if$
+}
+
+FUNCTION {author.editor.key.label}
+{ author empty$
+ { editor empty$
+ { key empty$
+ { cite$ #1 #3 substring$ }
+ 'key
+ if$
+ }
+ { editor format.lab.names }
+ if$
+ }
+ { author format.lab.names }
+ if$
+}
+
+FUNCTION {author.key.organization.label}
+{ author empty$
+ { key empty$
+ { organization empty$
+ { cite$ #1 #3 substring$ }
+ { "The " #4 organization chop.word #3 text.prefix$ }
+ if$
+ }
+ 'key
+ if$
+ }
+ { author format.lab.names }
+ if$
+}
+
+FUNCTION {editor.key.organization.label}
+{ editor empty$
+ { key empty$
+ { organization empty$
+ { cite$ #1 #3 substring$ }
+ { "The " #4 organization chop.word #3 text.prefix$ }
+ if$
+ }
+ 'key
+ if$
+ }
+ { editor format.lab.names }
+ if$
+}
+
+FUNCTION {calc.short.authors}
+{ type$ "book" =
+ type$ "inbook" =
+ or
+ 'author.editor.key.label
+ { type$ "proceedings" =
+ 'editor.key.organization.label
+ { type$ "manual" =
+ 'author.key.organization.label
+ 'author.key.label
+ if$
+ }
+ if$
+ }
+ if$
+ 'short.list :=
+}
+
+FUNCTION {calc.label}
+{ calc.short.authors
+ short.list
+ "("
+ *
+ year duplicate$ empty$
+ short.list key field.or.null = or
+ { pop$ "" }
+ 'skip$
+ if$
+ *
+ 'label :=
+}
+
+INTEGERS { seq.num }
+
+FUNCTION {init.seq}
+{ #0 'seq.num :=}
+
+EXECUTE {init.seq}
+
+FUNCTION {int.to.fix}
+{ "000000000" swap$ int.to.str$ *
+ #-1 #10 substring$
+}
+
+
+FUNCTION {presort}
+{ calc.label
+ label sortify
+ " "
+ *
+ seq.num #1 + 'seq.num :=
+ seq.num int.to.fix
+ 'sort.label :=
+ sort.label *
+ #1 entry.max$ substring$
+ 'sort.key$ :=
+}
+
+ITERATE {presort}
+
+SORT
+
+STRINGS { longest.label last.label next.extra }
+
+INTEGERS { longest.label.width last.extra.num number.label }
+
+FUNCTION {initialize.longest.label}
+{ "" 'longest.label :=
+ #0 int.to.chr$ 'last.label :=
+ "" 'next.extra :=
+ #0 'longest.label.width :=
+ #0 'last.extra.num :=
+ #0 'number.label :=
+}
+
+FUNCTION {forward.pass}
+{ last.label label =
+ { last.extra.num #1 + 'last.extra.num :=
+ last.extra.num int.to.chr$ 'extra.label :=
+ }
+ { "a" chr.to.int$ 'last.extra.num :=
+ "" 'extra.label :=
+ label 'last.label :=
+ }
+ if$
+ number.label #1 + 'number.label :=
+}
+
+FUNCTION {reverse.pass}
+{ next.extra "b" =
+ { "a" 'extra.label := }
+ 'skip$
+ if$
+ extra.label 'next.extra :=
+ extra.label
+ duplicate$ empty$
+ 'skip$
+ { "{\natexlab{" swap$ * "}}" * }
+ if$
+ 'extra.label :=
+ label extra.label * 'label :=
+}
+
+EXECUTE {initialize.longest.label}
+
+ITERATE {forward.pass}
+
+REVERSE {reverse.pass}
+
+FUNCTION {bib.sort.order}
+{ sort.label 'sort.key$ :=
+}
+
+ITERATE {bib.sort.order}
+
+SORT
+
+FUNCTION {begin.bib}
+{ preamble$ empty$
+ 'skip$
+ { preamble$ write$ newline$ }
+ if$
+ "\begin{thebibliography}{" number.label int.to.str$ * "}" *
+ write$ newline$
+ "\providecommand{\natexlab}[1]{#1}"
+ write$ newline$
+ "\providecommand{\url}[1]{\texttt{#1}}"
+ write$ newline$
+ "\expandafter\ifx\csname urlstyle\endcsname\relax"
+ write$ newline$
+ " \providecommand{\doi}[1]{doi: #1}\else"
+ write$ newline$
+ " \providecommand{\doi}{doi: \begingroup \urlstyle{rm}\Url}\fi"
+ write$ newline$
+ " \providecommand{\nmbibLink}[3]{#3}"
+ write$ newline$
+}
+
+EXECUTE {begin.bib}
+
+EXECUTE {init.state.consts}
+
+ITERATE {call.type$}
+
+FUNCTION {end.bib}
+{ newline$
+ "\end{thebibliography}" write$ newline$
+}
+
+EXECUTE {end.bib}