| 1 |
% \iffalse |
| 2 |
% $Id: nmbib.dtx,v 1.21 2015/07/27 20:22:45 boris Exp $ |
| 3 |
% |
| 4 |
%% Copyright 2015-2024, Michael Cohen <[email protected]> |
| 5 |
%% and Boris Veytsman <[email protected]> |
| 6 |
%% This work may be distributed and/or modified under the |
| 7 |
%% conditions of the LaTeX Project Public License, either |
| 8 |
%% version 1.3 of this license or (at your option) any |
| 9 |
%% later version. |
| 10 |
%% The latest version of the license is in |
| 11 |
%% http://www.latex-project.org/lppl.txt |
| 12 |
%% and version 1.3 or later is part of all distributions of |
| 13 |
%% LaTeX version 2003/06/01 or later. |
| 14 |
%% |
| 15 |
%% This work has the LPPL maintenance status `maintained'. |
| 16 |
%% |
| 17 |
%% The Current Maintainer of this work is Boris Veytsman |
| 18 |
%% |
| 19 |
%<*gobble> |
| 20 |
% \fi |
| 21 |
% \CheckSum{978} |
| 22 |
% |
| 23 |
% |
| 24 |
%% \CharacterTable |
| 25 |
%% {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 |
| 26 |
%% 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 |
| 27 |
%% Digits \0\1\2\3\4\5\6\7\8\9 |
| 28 |
%% Exclamation \! Double quote \" Hash (number) \# |
| 29 |
%% Dollar \$ Percent \% Ampersand \& |
| 30 |
%% Acute accent \' Left paren \( Right paren \) |
| 31 |
%% Asterisk \* Plus \+ Comma \, |
| 32 |
%% Minus \- Point \. Solidus \/ |
| 33 |
%% Colon \: Semicolon \; Less than \< |
| 34 |
%% Equals \= Greater than \> Question mark \? |
| 35 |
%% Commercial at \@ Left bracket \[ Backslash \\ |
| 36 |
%% Right bracket \] Circumflex \^ Underscore \_ |
| 37 |
%% Grave accent \` Left brace \{ Vertical bar \| |
| 38 |
%% Right brace \} Tilde \~} |
| 39 |
% |
| 40 |
%\iffalse |
| 41 |
% \begin{macrocode} |
| 42 |
\documentclass{ltxdoc} |
| 43 |
\usepackage{hypdoc} |
| 44 |
\usepackage{nmbib} |
| 45 |
\let\cite\citep |
| 46 |
\PageIndex |
| 47 |
\CodelineIndex |
| 48 |
\RecordChanges |
| 49 |
\EnableCrossrefs |
| 50 |
\begin{document} |
| 51 |
\DocInput{nmbib.dtx} |
| 52 |
\end{document} |
| 53 |
% \end{macrocode} |
| 54 |
%</gobble> |
| 55 |
% \fi |
| 56 |
% \MakeShortVerb{|} |
| 57 |
% \GetFileInfo{nmbib.sty} |
| 58 |
% |
| 59 |
% \changes{v1.00}{2014/01/23}{Preliminary release} |
| 60 |
% \changes{v1.03}{2015/07/25}{Added day field in the chrono bst} |
| 61 |
% |
| 62 |
% \title{New Multibibliography Package\thanks{\copyright 2015--2024 Michael |
| 63 |
% Cohen and Boris Veytsman}} |
| 64 |
% \author{Boris Veytsman\thanks{[email protected]} |
| 65 |
% \and Michael Cohen\thanks{[email protected]}} |
| 66 |
% \date{\filedate, \fileversion} |
| 67 |
% \maketitle |
| 68 |
% |
| 69 |
% \begin{abstract} |
| 70 |
% The |nmbib| package is a rewrite of |multibiliography| package |
| 71 |
% providing multiple bibliographies with different sorting. The new |
| 72 |
% version offers a number of citation commands, streamlines the |
| 73 |
% creation of bibliographies, ensures compatibility with the |
| 74 |
% |natbib| package, and provides other improvements. |
| 75 |
% \end{abstract} |
| 76 |
% |
| 77 |
% \tableofcontents |
| 78 |
% |
| 79 |
% \clearpage |
| 80 |
% |
| 81 |
%\section{Introduction} |
| 82 |
%\label{sec:intro} |
| 83 |
% |
| 84 |
% The list of cited works accompanying a scholarly work is not just |
| 85 |
% a technical appendix or a subtle way to avoid accusations of |
| 86 |
% plagiarism. Rather, it is an organic part of the work, telling the |
| 87 |
% user a story about the field of study and showing why the given |
| 88 |
% work is an organic part of it. There are several ways to tell the |
| 89 |
% story, and accordingly there are several ways to organize the list |
| 90 |
% of references. One can tell it accordingly to logical |
| 91 |
% development of ideas, so the order of citations follows the order |
| 92 |
% they are mentioned in the paper. This leads to the ``unsorted'' |
| 93 |
% style of references, usual in physics and mathematics papers and books. |
| 94 |
% Alternatively, one can choose to tell the story as the story of |
| 95 |
% people behind the ideas, ordering the citations alphabetically by |
| 96 |
% author names. This is the order used in humanities and other fields. |
| 97 |
% Yet another possibility is to tell the story in the chronological |
| 98 |
% order. The chronological order of citations is not widely used, |
| 99 |
% with the important exception of resumes and CVs, but it has its own |
| 100 |
% advantages. |
| 101 |
% |
| 102 |
% In the times BC (Before Computers), difficulties in manual creation |
| 103 |
% of reference lists discouraged presentation of more than one such |
| 104 |
% list. Now we can easily have as many lists as we want. Accordingly |
| 105 |
% we can have not one, but several lists of references, each telling a |
| 106 |
% different story. The package |
| 107 |
% |multibibliography|~\cite{Multibibliography, Multibibliography13} |
| 108 |
% provided just this: multiple bibliographies with the same references arranged |
| 109 |
% in different orders, with hyperlinks between entries. However, this |
| 110 |
% package had various limitations, including: the fixed format of |
| 111 |
% typesetting citations in text, the limitation on the possible |
| 112 |
% Bib\TeX\ styles. Also, it requires post-processing by a Perl |
| 113 |
% script. |
| 114 |
% |
| 115 |
% This package tries to lift these limitations. It provides the |
| 116 |
% following improvements over the original |multibiliography|: |
| 117 |
% \begin{enumerate} |
| 118 |
% \item A Perl postprocessing is no longer needed: all processing is done |
| 119 |
% by Bib\TeX. |
| 120 |
% \item The user can work with familiar |natbib|~\cite{Daly:Natbib} |
| 121 |
% commands \cs{citep}, \cs{citet}, \cs{citeauthor}, \cs{citeyear}, |
| 122 |
% \cs{citenum}. |
| 123 |
% \item Any |natbib|-compatible |.bst| file can be used for formatting |
| 124 |
% the bibliography provided that it has the right sorting of entries |
| 125 |
% (note that the provided style gives |natbib|-compatible |
| 126 |
% chronological ordering). |
| 127 |
% \item The style is much more customizable than that produced by |
| 128 |
% |multibibliography|. |
| 129 |
% \item Hyperlinks between the entries are improved. |
| 130 |
% \end{enumerate} |
| 131 |
% |
| 132 |
% Note about the name. The letter \emph{n} in the package name can be |
| 133 |
% interpreted as |
| 134 |
% \begin{enumerate} |
| 135 |
% \item \emph{N}ew multibibliography style, or |
| 136 |
% \item \emph{N}atbib-compatible multibibliography style, or even |
| 137 |
% \item \emph{N}-ordering multibibliography style, with $N$ being a |
| 138 |
% usual mathematical moniker for ``many''. |
| 139 |
% \end{enumerate} |
| 140 |
% |
| 141 |
% |
| 142 |
%\section{User Guide} |
| 143 |
%\label{sec:ug} |
| 144 |
% |
| 145 |
% |
| 146 |
%\subsection{Usage Summary} |
| 147 |
%\label{sec:ug_usage} |
| 148 |
% |
| 149 |
% The simplest way to use the package is the following: |
| 150 |
% \begin{enumerate} |
| 151 |
% \item Add to the preamble of your |.tex| file |
| 152 |
% \begin{verbatim} |
| 153 |
% \usepackage{nmbib} |
| 154 |
% \multibibliography{FILE1, FILE2, ...} |
| 155 |
% \multibibliographystyle{timeline}{STYLE1} |
| 156 |
% \multibibliographystyle{sequence}{STYLE2} |
| 157 |
% \multibibliographystyle{authors}{STYLE3} |
| 158 |
% \end{verbatim} |
| 159 |
% |
| 160 |
% \item Use |natbib| commands such as |\cite|, |\citep|, |\citet|, |
| 161 |
% |\citeauthor|, |\citeyear|, and |\citenum|. The command |\citeall| |
| 162 |
% creates a ``full citation'', showing the author, year, and |
| 163 |
% number of the citation. |
| 164 |
% \item Put in your document at the places where you want the |
| 165 |
% bibliography the commands |\printbibliography{timeline}|, |
| 166 |
% |\printbibliography{sequence}|, and |\printbibliography{authors}|. |
| 167 |
% |
| 168 |
% \item Run |latex| on the |tex| file. This will create, besides the |
| 169 |
% standard auxiliary file |FILE.aux|, three new files: |
| 170 |
% |FILE-timeline.aux|, |FILE-sequence.aux| and |FILE-authors.aux|. |
| 171 |
% \item Run |bibtex| on each of the three auxiliary files mentioned |
| 172 |
% above: |
| 173 |
% \begin{verbatim} |
| 174 |
% bibtex FILE-timeline |
| 175 |
% bibtex FILE-sequence |
| 176 |
% bibtex FILE-authors |
| 177 |
% \end{verbatim} |
| 178 |
% \item Run |latex| on the |tex| file at least twice (this is a |
| 179 |
% |natbib| requirement). |
| 180 |
% \end{enumerate} |
| 181 |
% |
| 182 |
% Below we discuss these commands in more detail as well as |
| 183 |
% customization commands. |
| 184 |
% |
| 185 |
% |
| 186 |
%\subsection{Options} |
| 187 |
%\label{sec:ug_options} |
| 188 |
% |
| 189 |
% The |nmbib| package internally uses |natbib| \cite{Daly:Natbib} for citation |
| 190 |
% formatting. The options used for |nmbib| are sent to |natbib|. |
| 191 |
% |
| 192 |
%\subsection{Setting up} |
| 193 |
%\label{sec:ug_setting} |
| 194 |
% |
| 195 |
% \DescribeMacro{\multibibliography}% |
| 196 |
% The list of \BibTeX\ databases to be used for references is set by |
| 197 |
% the command \cs{multibibliography}\marg{bibfile1, bibfile2, \dots}. |
| 198 |
% Note that the similar command \cs{bibliography} in standard |
| 199 |
% \LaTeX\ performs \emph{two} functions: |
| 200 |
% it sets up the databases and prints the |
| 201 |
% bibliography. The command \cs{multibibliography}, on the other |
| 202 |
% hand, performs only one function: the setting up of the databases. |
| 203 |
% The bibliographies themselves are printed by the command |
| 204 |
% \cs{printbibliography}, discussed below. Therefore the \cs{multibibliography} command |
| 205 |
% can be issued anywhere in the file, including |
| 206 |
% the preamble. |
| 207 |
% |
| 208 |
% \DescribeMacro{\multibibliographystyle} |
| 209 |
% The standard \cs{bibliographystyle} command sets the bibliography |
| 210 |
% style of the reference list. Since |nmbib| generates several |
| 211 |
% bibliographies, the corresponding command is more versatile: |
| 212 |
% \cs{multibibliographystyle}\marg{type}\marg{style}, |
| 213 |
% where |type| is the type of the bibliography |
| 214 |
% \begin{description} |
| 215 |
% \item[timeline:] Chronologically ordered list. |
| 216 |
% \item[sequence:] Sequentially ordered list. |
| 217 |
% \item[authors:] Alphabetic list, ordered according to |
| 218 |
% authors' names. |
| 219 |
% \end{description} |
| 220 |
% and \marg{style} is the corresponding \BibTeX\ style. The style, of |
| 221 |
% course, must sort the entries in the proper order. |
| 222 |
% |
| 223 |
% The package can accommodate any |natbib| \BibTeX\ style, |
| 224 |
% including |unsrtnat|, |plainnat|, and |abbrvnat|. It may work with other |
| 225 |
% styles, but success is not guaranteed. The \BibTeX\ styles |
| 226 |
% supplied with the package offer additional hyperlink features; if |
| 227 |
% you do not use |hyperref| or do not care for the links between the |
| 228 |
% different reference lists, you probably do not need these features. |
| 229 |
% |
| 230 |
% There are three citation styles provided with the package: |
| 231 |
% \begin{description} |
| 232 |
% \item[chronoplainnm:] Similar to |plainnat|, but sorting |
| 233 |
% entries in chronological order (using year, month and day if the |
| 234 |
% latter two are available) and providing links to other lists from the |
| 235 |
% body of the entries. |
| 236 |
% \item[plainnm:] Similar to |plainnat|, but providing links to other |
| 237 |
% lists from the body of the entries. The sorting is alphabetical |
| 238 |
% by authors' names, as in |plainnat|. |
| 239 |
% \item[unsrtnm:] Similar to |unsrtnat|, but providing links to other |
| 240 |
% lists from the body of the entries. The order of entries is the |
| 241 |
% order of citations, as in |unsrtnat|. |
| 242 |
% \end{description} |
| 243 |
% |
| 244 |
% |
| 245 |
%\subsection{Citation commands} |
| 246 |
%\label{sec:ug_commands} |
| 247 |
% |
| 248 |
% All citations commands defined in |natbib| can be used: \cs{cite}, |
| 249 |
% \cs{citenum}, \cs{citealt}, \cs{citet}, \cs{Citet}, etc. The |nmbib| package |
| 250 |
% adds a couple of new commands, described here. |
| 251 |
% |
| 252 |
% \DescribeMacro{\citealn}% |
| 253 |
% The commands \cs{citealn}\marg{keys} is the alternative \cs{citenum} |
| 254 |
% command: it puts square brackets around its argument. |
| 255 |
% |
| 256 |
% \DescribeMacro{\citeall}% |
| 257 |
% The command \cs{citeall}\marg{keys} produces citations with |
| 258 |
% authors' names, years, and sequence numbers, similar to that |
| 259 |
% produced by the \cs{cite} command in the |multibibliography| package. |
| 260 |
% To reproduce the behavior of that package, just put in |
| 261 |
% the preamble of your document |
| 262 |
% \begin{verbatim} |
| 263 |
% \let\cite\citeall |
| 264 |
% \end{verbatim} |
| 265 |
% |
| 266 |
% The starred command \cs{citeall*} is similar to \cs{citeall} with |
| 267 |
% the following difference: if \cs{citeall} prints the shortened author |
| 268 |
% list for papers with multiple authors (``Jones et.\ al.''), |
| 269 |
% \cs{citeall*} prints the full list (``Jones, Smith, and Brown''). |
| 270 |
% |
| 271 |
% |
| 272 |
%\subsection{Printing the bibliographies} |
| 273 |
%\label{sec:ug_print} |
| 274 |
% |
| 275 |
% |
| 276 |
% \DescribeMacro{\printbibliography}% |
| 277 |
% The command \cs{printbibliography}\marg{type} prints the |
| 278 |
% bibliography. The argument is the type of bibliography--- |
| 279 |
% |timeline|, |sequence|, or |authors| (see the explanation above). |
| 280 |
% |
| 281 |
% |
| 282 |
% You can put this command anywhere in your file; the corresponding |
| 283 |
% bibliography will be printed in this place. You can use all three |
| 284 |
% possible lists, any two, or even one. The only limitation is |
| 285 |
% that the ``base type'' list must be included. |
| 286 |
% (See Section~\ref{sec:ug_customization} for the discussion of base type.) |
| 287 |
% |
| 288 |
% |
| 289 |
%\subsection{Hyperlinks} |
| 290 |
%\label{sec:ug_hyperlinks} |
| 291 |
% |
| 292 |
% The |nmbib| package tries to fully exploit features of |hyperref| package |
| 293 |
% \cite{Rahtz:Hyperref}. Links from and between |
| 294 |
% citations should work ``smartly'': links from authors' names go |
| 295 |
% into the alphabetic list, links from the publication years go into the |
| 296 |
% chronological list, and links from the citation numbers go into the |
| 297 |
% sequential list. |
| 298 |
% |
| 299 |
% \DescribeMacro{\nmbibRedirectLinks}% |
| 300 |
% Of course, the user might include only some of the three possible |
| 301 |
% lists. In this case some links become ``dangling.'' The command |
| 302 |
% \cs{nmbibRedirectLinks}\penalty0\marg{source\_type}% |
| 303 |
% \penalty0\marg{target\_type} redirects the links that otherwise go to |
| 304 |
% the list \marg{source\_type} to the list \marg{source\_type}. For |
| 305 |
% example, if a chronological list is not included, the |
| 306 |
% command |\nmbibRedirectLinks{timeline}{authors}| makes the links |
| 307 |
% from the publication year go into the alphabetical list of |
| 308 |
% publications. |
| 309 |
% |
| 310 |
% \DescribeMacro{\nmbibLink}% |
| 311 |
% The clickable links themselves are created with the help of the |
| 312 |
% command \cs{nmbibLink}\marg{citation}\marg{type}\marg{text}. This |
| 313 |
% command is available to the user, which enables constructions like |
| 314 |
% \begin{verbatim} |
| 315 |
% The idea was proposed by \citet{Thor10}. Note the assumption of |
| 316 |
% differentiability in \nmbibLink{Thor10}{authors}{his paper}. |
| 317 |
% \end{verbatim} |
| 318 |
% In this example ``his paper'' becomes a hyperlink to the paper in |
| 319 |
% the alphabetical list. |
| 320 |
% |
| 321 |
% The links created with \cs{nmbibLink} respect the redirections set |
| 322 |
% by the command \cs{nmbibRedirectLinks}. |
| 323 |
% |
| 324 |
% |
| 325 |
%\subsection{Advanced customization} |
| 326 |
%\label{sec:ug_customization} |
| 327 |
% |
| 328 |
% \DescribeMacro{\timelinerefname}% |
| 329 |
% \DescribeMacro{\sequencerefname}% |
| 330 |
% \DescribeMacro{\authorsrefname}% |
| 331 |
% \DescribeMacro{\timelinebibname}% |
| 332 |
% \DescribeMacro{\sequencebibname}% |
| 333 |
% \DescribeMacro{\authorsbibname}% |
| 334 |
% The commands \cs{refname} (for article-like classes) and |
| 335 |
% \cs{bibname} (for book-like classes) retain the names of the |
| 336 |
% bibliography. The |nmbib| package defines three macros |\TYPErefname| and |
| 337 |
% three commands |\TYPEbibname|, |TYPE| being |timeline|, |sequence|, |
| 338 |
% or |authors|. These macros can be redefined with the usual |
| 339 |
% \cs{renewcommand}. |
| 340 |
% For example, for a German article, one might use |
| 341 |
% \begin{verbatim} |
| 342 |
% \renewcommand{\timelinerefname}{Chronologische Referenzliste} |
| 343 |
% \renewcommand{\sequencerefname}{Sequenzielle Referenzliste} |
| 344 |
% \renewcommand{\authorsrefname}{Alphabetische Referenzliste} |
| 345 |
% \end{verbatim} |
| 346 |
% |
| 347 |
% |
| 348 |
% |
| 349 |
% \DescribeMacro{\multibibliographyfilename} |
| 350 |
% By default the package creates three auxillary files with the |
| 351 |
% following file names: |FILE-timeline.aux|, |
| 352 |
% |FILE-sequence.aux|, and |FILE-authors.aux|. The command |
| 353 |
% \cs{multibibliograpyfilename}\marg{type}\marg{name} changes this |
| 354 |
% default. Here \marg{type} is |timeline|, |sequence|, or |authors|, and |
| 355 |
% \marg{name} is the file name. The default setting is equivalent to |
| 356 |
% \begin{verbatim} |
| 357 |
% \multibibliograpyfilename{timeline}{\jobname-timeline} |
| 358 |
% \multibibliograpyfilename{sequence}{\jobname-sequence} |
| 359 |
% \multibibliograpyfilename{authors}{\jobname-authors} |
| 360 |
% \end{verbatim} |
| 361 |
% This command may be present only in the preamble of a document. |
| 362 |
% |
| 363 |
% |
| 364 |
% |
| 365 |
% \DescribeMacro{\nmbibBasetype}% |
| 366 |
% Suppose an author published several works in the same year. They |
| 367 |
% need to be distinguished in the text and bibliography. In the |
| 368 |
% standard author-year styles this is done by adding a suffix after |
| 369 |
% the year: if we want to cite three works by A.\,U.\ Thor published |
| 370 |
% in 2013, they are respectively cited as Thor~(2013a), Thor~(2013b), and |
| 371 |
% Thor~(2013c). When we have only one reference list, |
| 372 |
% the choice of suffixes is simple: the first work becomes 2013a, the |
| 373 |
% second 2013b, etc. But how should we deal with the situation of |
| 374 |
% several subbibliographies? The order of these references in different |
| 375 |
% lists could be different, so the same work could get different labels in |
| 376 |
% different lists. |
| 377 |
% |
| 378 |
% To prevent this confusion, only one reference list is used to |
| 379 |
% construct the labels. We call the corresponding list type the |
| 380 |
% \emph{base type}. By default it is |sequence|, but this might be |
| 381 |
% changed (and should be chaged if the user does not include |
| 382 |
% sequential list) with the command \cs{nmbibBasetype}\marg{type}, with |
| 383 |
% \marg{type} being |timeline|, |sequence|, or |authors|. The list |
| 384 |
% chosen as a base type must be included with the |
| 385 |
% \cs{printbibliography} macro. |
| 386 |
% |
| 387 |
% Package |natbib| defines citation aliases: you can use ``Paper~I'' |
| 388 |
% or ``Paper~II'' as aliases for some papers. Normally hyperlinks |
| 389 |
% from aliases go into the alphabetic list; however, you can change |
| 390 |
% it with the special type |alias| in \cs{nmbibRedirectLinks}, for |
| 391 |
% example, |
| 392 |
% \begin{verbatim} |
| 393 |
% \nmbibRedirectLinks{alias}{timeline} |
| 394 |
% \end{verbatim} |
| 395 |
% |
| 396 |
% |
| 397 |
% |
| 398 |
% \DescribeMacro{\nmbibSetCiteall}% |
| 399 |
% The format of the \cs{citeall} and \cs{citeall*} macros can be |
| 400 |
% changed by the command \cs{nmbibSetCiteall}\marg{pattern}, where |
| 401 |
% \marg{pattern} sets the citation format. The pattern can use any |
| 402 |
% punctuation, \cs{nmbibLink} command and the special tokens |
| 403 |
% \cs{nmbibKEY}, \cs{nmbibNAME}, \cs{nmbibDATE} and \cs{nmbibNUM}, |
| 404 |
% which are substituted by the citation information. For example, the |
| 405 |
% default format is established by the command |
| 406 |
% \begin{verbatim} |
| 407 |
% \nmbibSetCiteall{\nmbibLink{\nmbibKEY}{authors}{\nmbibNAME} |
| 408 |
% (\nmbibLink{\nmbibKEY}{timeline}{\nmbibDATE}) |
| 409 |
% [\nmbibLink{\nmbibKEY}{sequence}{\nmbibNUM}]} |
| 410 |
% \end{verbatim} |
| 411 |
% which produces the following result: \citeall{Daly:Natbib}. |
| 412 |
% |
| 413 |
% \DescribeMacro{\nmbibSetBiblabel}% |
| 414 |
% The command \cs{nmbibSetBiblabel}\marg{type}{pattern} is used to set |
| 415 |
% the format of the label in the reference list of the given type. |
| 416 |
% The \marg{pattern} parameter uses the same tokens as \cs{nmbibSetCiteall}. |
| 417 |
% The default is |
| 418 |
% \begin{verbatim} |
| 419 |
%\nmbibSetBiblabel{timeline}{[\nmbibDATE: |
| 420 |
% \nmbibLink{\nmbibKEY}{authors}{\nmbibNAME}; |
| 421 |
% \nmbibLink{\nmbibKEY}{sequence}{\nmbibNUM}]} |
| 422 |
%\nmbibSetBiblabel{authors}{[\nmbibNAME\ |
| 423 |
% (\nmbibLink{\nmbibKEY}{timeline}{\nmbibDATE}); |
| 424 |
% \nmbibLink{\nmbibKEY}{sequence}{\nmbibNUM}]} |
| 425 |
%\nmbibSetBiblabel{sequence}{[\nmbibNUM: |
| 426 |
% \nmbibLink{\nmbibKEY}{authors}{\nmbibNAME} |
| 427 |
% (\nmbibLink{\nmbibKEY}{timeline}{\nmbibDATE})]} |
| 428 |
% \end{verbatim} |
| 429 |
% To suppress the label for any type, use an empty pattern: |
| 430 |
% |\nmbibSetBiblabel{authors}{}|. To use numerical labels only for a |
| 431 |
% sequential list, issue |\nmbibSetBiblabel{sequence}{[\nmbibNUM]}| |
| 432 |
% etc. |
| 433 |
% |
| 434 |
% \DescribeMacro{nmbibYearSuffixOff}% |
| 435 |
% \DescribeMacro{nmbibYearSuffixOn}% |
| 436 |
% If there are several works with the same authors and year, the |
| 437 |
% package adds suffixes to the year numbers, like 2003a and 2003b. By |
| 438 |
% default these suffixes are printed both in the labels \emph{and} in |
| 439 |
% the bibliographic entries themselves. The command |
| 440 |
% \cs{nmbibYearSuffixOff} deletes these suffixes from the bibliography |
| 441 |
% entries (but not from labels). The command \cs{nmbibYearSuffixOff} |
| 442 |
% restores them. |
| 443 |
% |
| 444 |
% |
| 445 |
%\subsection{Auxillary script} |
| 446 |
%\label{sec:script} |
| 447 |
% |
| 448 |
% To integrate the package with IDEs like \TeX Shop, we provide a |
| 449 |
% simple script |nmbibtex| which compiles all bibliographies. Its |
| 450 |
% usage is very simple: |
| 451 |
% \begin{verbatim} |
| 452 |
% nmbibtex FILE |
| 453 |
% \end{verbatim} |
| 454 |
% where |FILE| is the file name without prefixes. |
| 455 |
% |
| 456 |
% |
| 457 |
%\StopEventually{\clearpage\nmbibYearSuffixOff |
| 458 |
% \multibibliography{nmbib}% |
| 459 |
% \multibibliographystyle{timeline}{chronoplainnm}% |
| 460 |
% \multibibliographystyle{sequence}{unsrtnm}% |
| 461 |
% \multibibliographystyle{authors}{plainnm}% |
| 462 |
% \printbibliography{sequence}% |
| 463 |
% \printbibliography{authors}% |
| 464 |
% \printbibliography{timeline}} |
| 465 |
% |
| 466 |
% \clearpage |
| 467 |
% |
| 468 |
% \section{Implementation} |
| 469 |
% \label{sec:implementation} |
| 470 |
% |
| 471 |
% |
| 472 |
%\subsection{Declarations} |
| 473 |
%\label{sec:decl} |
| 474 |
% |
| 475 |
% We start with declaration, who we are: |
| 476 |
% |
| 477 |
% |
| 478 |
% \begin{macrocode} |
| 479 |
%<style>\NeedsTeXFormat{LaTeX2e} |
| 480 |
%<*gobble> |
| 481 |
\ProvidesFile{nmbib.dtx} |
| 482 |
%</gobble> |
| 483 |
%<style>\ProvidesPackage{nmbib} |
| 484 |
%<*style> |
| 485 |
[2015/07/27 v1.04 Multibibliography support for LaTeX] |
| 486 |
% \end{macrocode} |
| 487 |
% |
| 488 |
% |
| 489 |
% |
| 490 |
%\subsection{Loading packages} |
| 491 |
%\label{sec:loading} |
| 492 |
% |
| 493 |
% We send all options to |natbib| |
| 494 |
% \begin{macrocode} |
| 495 |
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{natbib}} |
| 496 |
\ProcessOptions\relax |
| 497 |
% \end{macrocode} |
| 498 |
% and call |natbib| |
| 499 |
% \begin{macrocode} |
| 500 |
\RequirePackage{natbib} |
| 501 |
% \end{macrocode} |
| 502 |
% |
| 503 |
% |
| 504 |
% |
| 505 |
% |
| 506 |
%\subsection{Preliminary Definitions and opening aux files} |
| 507 |
%\label{sec:opening} |
| 508 |
% |
| 509 |
% \begin{macro}{\NMBIB@types} |
| 510 |
% The comma-separated collection of types: right now we have three |
| 511 |
% of them. |
| 512 |
% \begin{macrocode} |
| 513 |
\def\NMBIB@types{timeline,sequence,authors} |
| 514 |
% \end{macrocode} |
| 515 |
% |
| 516 |
% \end{macro} |
| 517 |
% |
| 518 |
% |
| 519 |
% |
| 520 |
% \begin{macro}{\multibibliographyfilename} |
| 521 |
% Defining the names for bibliography files |
| 522 |
% \begin{macrocode} |
| 523 |
\def\multibibliographyfilename#1#2{% |
| 524 |
\expandafter\edef\csname NMBIB@#1@filename\endcsname{#2}} |
| 525 |
\@onlypreamble{\multibibliographyfilename} |
| 526 |
% \end{macrocode} |
| 527 |
% \end{macro} |
| 528 |
% |
| 529 |
% \begin{macro}{\NMBIB@@timeline@filename} |
| 530 |
% \begin{macro}{\NMBIB@@sequence@filename} |
| 531 |
% \begin{macro}{\NMBIB@@authors@filename} |
| 532 |
% The file names for aux files (without |.aux| extension) |
| 533 |
% \begin{macrocode} |
| 534 |
\@for\@tempa:=\NMBIB@types\do{% |
| 535 |
\expandafter\multibibliographyfilename{\@tempa}{\jobname-\@tempa}} |
| 536 |
% \end{macrocode} |
| 537 |
% \end{macro} |
| 538 |
% \end{macro} |
| 539 |
% \end{macro} |
| 540 |
% |
| 541 |
% |
| 542 |
% \begin{macro}{\NMBIB@timeline@aux} |
| 543 |
% \begin{macro}{\NMBIB@sequence@aux} |
| 544 |
% \begin{macro}{\NMBIB@authors@aux} |
| 545 |
% We introduce the output streams |
| 546 |
% \begin{macrocode} |
| 547 |
\@for\@tempa:=\NMBIB@types\do{% |
| 548 |
\expandafter\newwrite\csname NMBIB@\@tempa @aux\endcsname} |
| 549 |
% \end{macrocode} |
| 550 |
% We open and close them at the beginning and end of the document |
| 551 |
% \begin{macrocode} |
| 552 |
\AtBeginDocument{% |
| 553 |
\if@filesw |
| 554 |
\@for\@tempa:=\NMBIB@types\do{% |
| 555 |
\immediate\openout\csname NMBIB@\@tempa @aux\endcsname |
| 556 |
\csname NMBIB@\@tempa @filename\endcsname.aux |
| 557 |
\immediate\write\csname NMBIB@\@tempa @aux\endcsname{\relax}}% |
| 558 |
\fi} |
| 559 |
\AtEndDocument{% |
| 560 |
\if@filesw |
| 561 |
\@for\@tempa:=\NMBIB@types\do{% |
| 562 |
\immediate\closeout\csname NMBIB@\@tempa @aux\endcsname}% |
| 563 |
\fi} |
| 564 |
% \end{macrocode} |
| 565 |
% |
| 566 |
% \end{macro} |
| 567 |
% \end{macro} |
| 568 |
% \end{macro} |
| 569 |
% |
| 570 |
% \begin{macro}{\multibibliographystyle} |
| 571 |
% Define the bibliographystyle for the corresponding list. Note the |
| 572 |
% trick with \cs{@begindocumenthook}, which allows us to write the |
| 573 |
% files only after the files are opened. |
| 574 |
% \begin{macrocode} |
| 575 |
\def\multibibliographystyle#1#2{% |
| 576 |
\ifx\@begindocumenthook\@undefined\else |
| 577 |
\expandafter\AtBeginDocument |
| 578 |
\fi |
| 579 |
{\if@filesw |
| 580 |
\immediate\write\csname NMBIB@#1@aux\endcsname{% |
| 581 |
\string\bibstyle{#2}}% |
| 582 |
\fi}} |
| 583 |
% \end{macrocode} |
| 584 |
% |
| 585 |
% \end{macro} |
| 586 |
% |
| 587 |
% |
| 588 |
% |
| 589 |
% \begin{macro}{\multibibliography} |
| 590 |
% Writing bibliography data to the aux files |
| 591 |
% \begin{macrocode} |
| 592 |
\def\multibibliography#1{% |
| 593 |
\ifx\@begindocumenthook\@undefined\else |
| 594 |
\expandafter\AtBeginDocument |
| 595 |
\fi |
| 596 |
{\if@filesw |
| 597 |
\@for\@tempa:=\NMBIB@types\do{% |
| 598 |
\immediate\write\csname NMBIB@\@tempa @aux\endcsname |
| 599 |
{\string\bibdata{#1}}}% |
| 600 |
\fi}} |
| 601 |
% \end{macrocode} |
| 602 |
% |
| 603 |
% \end{macro} |
| 604 |
% |
| 605 |
% \begin{macro}{\nmbibBasetype} |
| 606 |
% \begin{macro}{\NMBIB@bibcite@type} |
| 607 |
% The macro \cs{nmbibBasetype} sets the type that is used for the |
| 608 |
% citation command: |
| 609 |
% \begin{macrocode} |
| 610 |
\def\nmbibBasetype#1{\gdef\NMBIB@bibcite@type{#1}} |
| 611 |
\nmbibBasetype{sequence} |
| 612 |
% \end{macrocode} |
| 613 |
% |
| 614 |
% \end{macro} |
| 615 |
% \end{macro} |
| 616 |
% |
| 617 |
% \begin{macro}{\NMBIB@timeline@cite@suffix} |
| 618 |
% \begin{macro}{\NMBIB@sequence@cite@suffix} |
| 619 |
% \begin{macro}{\NMBIB@authors@cite@suffix} |
| 620 |
% \begin{macro}{\NMBIB@alias@cite@suffix} |
| 621 |
% The macro \cs{NMBIB@TYPE@cite@suffix} keeps the suffix added to |
| 622 |
% the hyperlink |cite|: |
| 623 |
% \begin{macrocode} |
| 624 |
\@for\@tempa:=\NMBIB@types\do{% |
| 625 |
\expandafter\edef\csname NMBIB@\@tempa |
| 626 |
@cite@suffix\endcsname{\@tempa}} |
| 627 |
\def\NMBIB@alias@cite@suffix{authors} |
| 628 |
% \end{macrocode} |
| 629 |
% |
| 630 |
% \end{macro} |
| 631 |
% \end{macro} |
| 632 |
% \end{macro} |
| 633 |
% \end{macro} |
| 634 |
% |
| 635 |
% \begin{macro}{\nmbibRedirectLinks} |
| 636 |
% The macro \cs{nmbibRedirectLinks}\marg{from}\marg{to} redefines |
| 637 |
% the suffix: |
| 638 |
% \begin{macrocode} |
| 639 |
\def\nmbibRedirectLinks#1#2{% |
| 640 |
\expandafter\edef\csname NMBIB@#1@cite@suffix\endcsname{#2}} |
| 641 |
% \end{macrocode} |
| 642 |
% |
| 643 |
% \end{macro} |
| 644 |
% |
| 645 |
%\subsection{Citation commands} |
| 646 |
%\label{sec:citex} |
| 647 |
% |
| 648 |
% |
| 649 |
% \begin{macro}{\NAT@set@cites} |
| 650 |
% The command |\NAT@set@cites| is used by |natbib| to set up |
| 651 |
% citation styles. It is added to the |begindocument| hook, so we |
| 652 |
% need to disable it here: |
| 653 |
% \begin{macrocode} |
| 654 |
\def\NAT@set@cites{} |
| 655 |
\let\@cite\NAT@cite |
| 656 |
\let\@citex\NAT@citex |
| 657 |
\let\@biblabel\NAT@biblabel |
| 658 |
\let\@bibsetup\NAT@bibsetup |
| 659 |
\let\NAT@space\NAT@spacechar |
| 660 |
\let\NAT@penalty\@empty |
| 661 |
\renewcommand\NAT@idxtxt{\NAT@name\NAT@spacechar\NAT@open\NAT@date\NAT@close} |
| 662 |
\def\natexlab#1{#1} |
| 663 |
% \end{macrocode} |
| 664 |
% |
| 665 |
% \end{macro} |
| 666 |
% |
| 667 |
% \begin{macro}{\ifNMBIB@printyearsuffix} |
| 668 |
% \changes{v1.02}{2015/04/24}{Added macro} |
| 669 |
% Whether to print the year suffix |
| 670 |
% \begin{macrocode} |
| 671 |
\newif\ifNMBIB@printyearsuffix |
| 672 |
\NMBIB@printyearsuffixtrue |
| 673 |
% \end{macrocode} |
| 674 |
% |
| 675 |
% \end{macro} |
| 676 |
% |
| 677 |
% \begin{macro}{\nmbibYearSuffixOn} |
| 678 |
% \changes{v1.02}{2015/04/24}{Added macro} |
| 679 |
% Switching on the suffixes |
| 680 |
% \begin{macrocode} |
| 681 |
\def\nmbibYearSuffixOn{\NMBIB@printyearsuffixtrue} |
| 682 |
% \end{macrocode} |
| 683 |
% |
| 684 |
% \end{macro} |
| 685 |
% |
| 686 |
% \begin{macro}{\nmbibYearSuffixOff} |
| 687 |
% \changes{v1.02}{2015/04/24}{Added macro} |
| 688 |
% Switching off the suffixes |
| 689 |
% \begin{macrocode} |
| 690 |
\def\nmbibYearSuffixOff{\NMBIB@printyearsuffixfalse} |
| 691 |
% \end{macrocode} |
| 692 |
% |
| 693 |
% \end{macro} |
| 694 |
% |
| 695 |
% |
| 696 |
% |
| 697 |
% \begin{macro}{\NAT@sort@cites} |
| 698 |
% The command \cs{NAT@sort@cites} sorts the citations and writes |
| 699 |
% them to the aux file. We want to write them to another file |
| 700 |
% instead. |
| 701 |
% \begin{macrocode} |
| 702 |
\renewcommand\NAT@sort@cites[1]{% |
| 703 |
\let\NAT@cite@list\@empty |
| 704 |
\@for\@citeb:=#1\do{\expandafter\NAT@star@cite\@citeb\@@}% |
| 705 |
\if@filesw |
| 706 |
\@for\@tempa:=\NMBIB@types\do{% |
| 707 |
\expandafter\immediate\expandafter\write\expandafter |
| 708 |
\csname NMBIB@\@tempa @aux\endcsname |
| 709 |
\expandafter{\expandafter\string\expandafter\citation\expandafter{\NAT@cite@list}}}% |
| 710 |
\fi |
| 711 |
\@ifnum{\NAT@sort>\z@}{% |
| 712 |
\expandafter\NAT@sort@cites@\expandafter{\NAT@cite@list}% |
| 713 |
}{}% |
| 714 |
}% |
| 715 |
% \end{macrocode} |
| 716 |
% |
| 717 |
% \end{macro} |
| 718 |
% |
| 719 |
% |
| 720 |
% \begin{macro}{\nmbibcitenumber} |
| 721 |
% This command is written to the main |aux| file and contains the |
| 722 |
% number of the citation (since different lists may produce |
| 723 |
% different numbers). We store the number in the macro |
| 724 |
% |\nmbib@num@KEY\@extra@binfo|. We also use |natbib| warnings |
| 725 |
% about multiple citations. |
| 726 |
% \begin{macrocode} |
| 727 |
\def\nmbibcitenumber#1#2{% |
| 728 |
\@ifundefined{nmbib@num@#1\@extra@binfo}{\relax}{% |
| 729 |
\NAT@citemultiple |
| 730 |
\PackageWarningNoLine{natbib}{Citation `#1' multiply defined}% |
| 731 |
}% |
| 732 |
\global\@namedef{nmbib@num@#1\@extra@binfo}{#2}} |
| 733 |
\AtEndDocument{\let\nmbibcitenumber\NMBIB@testnum} |
| 734 |
% \end{macrocode} |
| 735 |
% |
| 736 |
% \end{macro} |
| 737 |
% |
| 738 |
% \begin{macro}{\NMBIB@testnum} |
| 739 |
% Testing whether citation number have been changed. |
| 740 |
% \begin{macrocode} |
| 741 |
\newcommand\NMBIB@testnum[2]{% |
| 742 |
\def\NAT@temp{#2}% |
| 743 |
\expandafter \ifx \csname nmbib@num@#1\@extra@binfo\endcsname\NAT@temp |
| 744 |
\else |
| 745 |
\ifNAT@swa \NAT@swafalse |
| 746 |
\PackageWarningNoLine{natbib}{% |
| 747 |
Citation(s) may have changed.\MessageBreak |
| 748 |
Rerun to get citations correct% |
| 749 |
}% |
| 750 |
\fi |
| 751 |
\fi |
| 752 |
}% |
| 753 |
% \end{macrocode} |
| 754 |
% |
| 755 |
% \end{macro} |
| 756 |
% |
| 757 |
% \begin{macro}{\NAT@parse} |
| 758 |
% The |natbib| command \cs{NAT@parse} parses the \cs{bibcite} |
| 759 |
% arguments and stores them in the corresponding macros. However, |
| 760 |
% the citation number may be wrong since it might be taken from a |
| 761 |
% wrong list. Therefore we use the number from \cs{nmbibcitenumber} |
| 762 |
% instead. |
| 763 |
% \begin{macrocode} |
| 764 |
\let\NAT@parse@orig=\NAT@parse\relax |
| 765 |
\renewcommand\NAT@parse[1]{\NAT@parse@orig{#1}% |
| 766 |
\@ifundefined{nmbib@num@#1\@extra@binfo}{\def\NAT@num{0}}{% |
| 767 |
\edef\NAT@num{\csname nmbib@num@#1\@extra@binfo\endcsname}}} |
| 768 |
% \end{macrocode} |
| 769 |
% |
| 770 |
% \end{macro} |
| 771 |
% |
| 772 |
% |
| 773 |
% \begin{macro}{\nmbibLink} |
| 774 |
% The command \cs{nmbibLink}\marg{key}\marg{type}\marg{text} is like |
| 775 |
% \cs{NAT@hyper@}, but on the user level: |
| 776 |
% \begin{macrocode} |
| 777 |
\def\nmbibLink#1#2#3{% |
| 778 |
\hyper@natlinkstart{#1\@extra@b@citeb-\csname |
| 779 |
NMBIB@#2@cite@suffix\endcsname}#3\hyper@natlinkend} |
| 780 |
% \end{macrocode} |
| 781 |
% |
| 782 |
% \end{macro} |
| 783 |
% |
| 784 |
% \begin{macro}{\NAT@citexnum} |
| 785 |
% We use \cs{NAT@citexnum} to cite numbers: |
| 786 |
% \begin{macrocode} |
| 787 |
\def\NAT@citexnum[#1][#2]#3{% |
| 788 |
\NAT@reset@parser |
| 789 |
\NAT@sort@cites{#3}% |
| 790 |
\NAT@reset@citea |
| 791 |
\@cite{\def\NAT@num{-1}\let\NAT@last@yr\relax\let\NAT@nm\@empty |
| 792 |
\@for\@citeb:=\NAT@cite@list\do |
| 793 |
{\@safe@activestrue |
| 794 |
\edef\@citeb{\expandafter\@firstofone\@citeb\@empty}% |
| 795 |
\@safe@activesfalse |
| 796 |
\@ifundefined{b@\@citeb\@extra@b@citeb}{% |
| 797 |
{\reset@font\bfseries?} |
| 798 |
\NAT@citeundefined\PackageWarning{natbib}% |
| 799 |
{Citation `\@citeb' on page \thepage \space undefined}}% |
| 800 |
{\let\NAT@last@num\NAT@num\let\NAT@last@nm\NAT@nm |
| 801 |
\NAT@parse{\@citeb}% |
| 802 |
\ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{% |
| 803 |
\let\NAT@name=\NAT@all@names |
| 804 |
\global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}% |
| 805 |
\fi |
| 806 |
\ifNAT@full\let\NAT@nm\NAT@all@names\else |
| 807 |
\let\NAT@nm\NAT@name\fi |
| 808 |
\ifNAT@swa |
| 809 |
\@ifnum{\NAT@ctype>\@ne}{% |
| 810 |
\@citea |
| 811 |
\NMBIB@hyper@{alias}{\@ifnum{\NAT@ctype=\tw@}{\NAT@test{\NAT@ctype}}{\NAT@alias}}% |
| 812 |
}{% |
| 813 |
\@ifnum{\NAT@cmprs>\z@}{% |
| 814 |
\NAT@ifcat@num\NAT@num |
| 815 |
{\let\NAT@nm=\NAT@num}% |
| 816 |
{\def\NAT@nm{-2}}% |
| 817 |
\NAT@ifcat@num\NAT@last@num |
| 818 |
{\@tempcnta=\NAT@last@num\relax}% |
| 819 |
{\@tempcnta\m@ne}% |
| 820 |
\@ifnum{\NAT@nm=\@tempcnta}{% |
| 821 |
\@ifnum{\NAT@merge>\@ne}{}{\NAT@last@yr@mbox}% |
| 822 |
}{% |
| 823 |
\advance\@tempcnta by\@ne |
| 824 |
\@ifnum{\NAT@nm=\@tempcnta}{% |
| 825 |
\ifx\NAT@last@yr\relax |
| 826 |
\def@NAT@last@yr{\@citea}% |
| 827 |
\else |
| 828 |
\def@NAT@last@yr{--\NAT@penalty}% |
| 829 |
\fi |
| 830 |
}{% |
| 831 |
\NAT@last@yr@mbox |
| 832 |
}% |
| 833 |
}% |
| 834 |
}{% |
| 835 |
\@tempswatrue |
| 836 |
\@ifnum{\NAT@merge>\@ne}{\@ifnum{\NAT@last@num=\NAT@num\relax}{\@tempswafalse}{}}{}% |
| 837 |
\if@tempswa\NAT@citea@mbox\fi |
| 838 |
}% |
| 839 |
}% |
| 840 |
\NAT@def@citea |
| 841 |
\else |
| 842 |
\ifcase\NAT@ctype |
| 843 |
\ifx\NAT@last@nm\NAT@nm \NAT@yrsep\NAT@penalty\NAT@space\else |
| 844 |
\@citea \NAT@test{\@ne}\NAT@spacechar\NAT@mbox{\NAT@super@kern\NAT@@open}% |
| 845 |
\fi |
| 846 |
\if*#1*\else#1\NAT@spacechar\fi |
| 847 |
\NAT@mbox{\NMBIB@hyper@{sequence}{{\citenumfont{\NAT@num}}}}% |
| 848 |
\NAT@def@citea@box |
| 849 |
\or |
| 850 |
\NMBIB@hyper@citea@space{sequence}{\NAT@test{\NAT@ctype}}% |
| 851 |
\or |
| 852 |
\NAT@hyper@citea@space{sequence}{\NAT@test{\NAT@ctype}}% |
| 853 |
\or |
| 854 |
\NAT@hyper@citea@space{alias}{\NAT@alias}% |
| 855 |
\fi |
| 856 |
\fi |
| 857 |
}% |
| 858 |
}% |
| 859 |
\@ifnum{\NAT@cmprs>\z@}{\NAT@last@yr}{}% |
| 860 |
\ifNAT@swa\else |
| 861 |
\@ifnum{\NAT@ctype=\z@}{% |
| 862 |
\if*#2*\else\NAT@cmt#2\fi |
| 863 |
}{}% |
| 864 |
\NAT@mbox{\NAT@@close}% |
| 865 |
\fi |
| 866 |
}{#1}{#2}% |
| 867 |
}% |
| 868 |
% \end{macrocode} |
| 869 |
% |
| 870 |
% \end{macro} |
| 871 |
% |
| 872 |
% |
| 873 |
% |
| 874 |
% |
| 875 |
% |
| 876 |
% \begin{macro}{\NMBIB@hyper@} |
| 877 |
% This is the replacement for \cs{NAT@hyper@} |
| 878 |
% \begin{macrocode} |
| 879 |
\def\NMBIB@hyper@#1#2{% |
| 880 |
\nmbibLink{\@citeb}{#1}{#2}} |
| 881 |
% \end{macrocode} |
| 882 |
% |
| 883 |
% \end{macro} |
| 884 |
% |
| 885 |
% \begin{macro}{\NMBIB@hyper@citea} |
| 886 |
% This is the replacement for \cs{NAT@hyper@citea}: |
| 887 |
% \begin{macrocode} |
| 888 |
\def\NMBIB@hyper@citea#1#2{% |
| 889 |
\@citea |
| 890 |
\NMBIB@hyper@{#1}{#2}% |
| 891 |
\NAT@def@citea |
| 892 |
}% |
| 893 |
% \end{macrocode} |
| 894 |
% |
| 895 |
% \end{macro} |
| 896 |
% |
| 897 |
% \begin{macro}{\NMBIB@hyper@citea@space} |
| 898 |
% The replacement for \cs{NAT@hyper@citea@space} |
| 899 |
% \begin{macrocode} |
| 900 |
\def\NMBIB@hyper@citea@space#1#2{% |
| 901 |
\@citea |
| 902 |
\NMBIB@hyper@{#1}{#2}% |
| 903 |
\NAT@def@citea@space |
| 904 |
}% |
| 905 |
% \end{macrocode} |
| 906 |
% |
| 907 |
% \end{macro} |
| 908 |
% |
| 909 |
% \begin{macro}{\def@NAT@last@yr} |
| 910 |
% Another |natbib| macro to redefine |
| 911 |
% \begin{macrocode} |
| 912 |
\def\def@NAT@last@yr#1{% |
| 913 |
\protected@edef\NAT@last@yr{% |
| 914 |
#1% |
| 915 |
\noexpand\mbox{% |
| 916 |
\noexpand\hyper@natlinkstart{\@citeb\@extra@b@citeb-\NMBIB@sequence@cite@suffix}% |
| 917 |
{\noexpand\citenumfont{\NAT@num}}% |
| 918 |
\noexpand\hyper@natlinkend |
| 919 |
}% |
| 920 |
}% |
| 921 |
}% |
| 922 |
% \end{macrocode} |
| 923 |
% |
| 924 |
% \end{macro} |
| 925 |
% |
| 926 |
% |
| 927 |
% \begin{macro}{\NAT@citea@mbox} |
| 928 |
% This is used in numerical citations |
| 929 |
% \begin{macrocode} |
| 930 |
\def\NAT@citea@mbox{% |
| 931 |
\@citea\mbox{\NMBIB@hyper@{sequence}{{\citenumfont{\NAT@num}}}}% |
| 932 |
}% |
| 933 |
% \end{macrocode} |
| 934 |
% |
| 935 |
% \end{macro} |
| 936 |
% |
| 937 |
% \begin{macro}{\NMBIB@citex} |
| 938 |
% And now the heart of |natbib|\dots |
| 939 |
% \begin{macrocode} |
| 940 |
\def\NMBIB@citex% |
| 941 |
[#1][#2]#3{% |
| 942 |
\NAT@reset@parser |
| 943 |
\NAT@sort@cites{#3}% |
| 944 |
\NAT@reset@citea |
| 945 |
\@cite{\let\NAT@nm\@empty\let\NAT@year\@empty |
| 946 |
\@for\@citeb:=\NAT@cite@list\do |
| 947 |
{\@safe@activestrue |
| 948 |
\edef\@citeb{\expandafter\@firstofone\@citeb\@empty}% |
| 949 |
\@safe@activesfalse |
| 950 |
\@ifundefined{b@\@citeb\@extra@b@citeb}{\@citea% |
| 951 |
{\reset@font\bfseries ?}\NAT@citeundefined |
| 952 |
\PackageWarning{natbib}% |
| 953 |
{Citation `\@citeb' on page \thepage \space undefined}\def\NAT@date{}}% |
| 954 |
{\let\NAT@last@nm=\NAT@nm\let\NAT@last@yr=\NAT@year |
| 955 |
\NAT@parse{\@citeb}% |
| 956 |
\ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{% |
| 957 |
\let\NAT@name=\NAT@all@names |
| 958 |
\global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}% |
| 959 |
\fi |
| 960 |
\ifNAT@full\let\NAT@nm\NAT@all@names\else |
| 961 |
\let\NAT@nm\NAT@name\fi |
| 962 |
\ifNAT@swa\ifcase\NAT@ctype |
| 963 |
\if\relax\NAT@date\relax |
| 964 |
\@citea\NMBIB@hyper@{authors}{\NAT@nmfmt{\NAT@nm}}% |
| 965 |
\NMBIB@hyper@{timeline}{\NAT@date}% |
| 966 |
\else |
| 967 |
\ifx\NAT@last@nm\NAT@nm\NAT@yrsep |
| 968 |
\ifx\NAT@last@yr\NAT@year |
| 969 |
\def\NAT@temp{{?}}% |
| 970 |
\ifx\NAT@temp\NAT@exlab\PackageWarningNoLine{natbib}% |
| 971 |
{Multiple citation on page \thepage: same authors and |
| 972 |
year\MessageBreak without distinguishing extra |
| 973 |
letter,\MessageBreak appears as question mark}\fi |
| 974 |
\NMBIB@hyper@{timeline}{\NAT@exlab}% |
| 975 |
\else\unskip\NAT@spacechar |
| 976 |
\NMBIB@hyper@{timeline}{\NAT@date}% |
| 977 |
\fi |
| 978 |
\else |
| 979 |
\@citea\NMBIB@hyper@{authors}{% |
| 980 |
\NAT@nmfmt{\NAT@nm}% |
| 981 |
\hyper@natlinkbreak{% |
| 982 |
\NAT@aysep\NAT@spacechar}{\@citeb\@extra@b@citeb |
| 983 |
}}% |
| 984 |
\NMBIB@hyper@{timeline}{\NAT@date |
| 985 |
}% |
| 986 |
\fi |
| 987 |
\fi |
| 988 |
\or\@citea\NMBIB@hyper@{authors}{\NAT@nmfmt{\NAT@nm}}% |
| 989 |
\or\@citea\NMBIB@hyper@{timeline}{\NAT@date}% |
| 990 |
\or\@citea\NMBIB@hyper@{alias}{\NAT@alias}% |
| 991 |
\fi \NAT@def@citea |
| 992 |
\else |
| 993 |
\ifcase\NAT@ctype |
| 994 |
\if\relax\NAT@date\relax |
| 995 |
\@citea\NMBIB@hyper@{authors}{\NAT@nmfmt{\NAT@nm}}% |
| 996 |
\else |
| 997 |
\ifx\NAT@last@nm\NAT@nm\NAT@yrsep |
| 998 |
\ifx\NAT@last@yr\NAT@year |
| 999 |
\def\NAT@temp{{?}}% |
| 1000 |
\ifx\NAT@temp\NAT@exlab\PackageWarningNoLine{natbib}% |
| 1001 |
{Multiple citation on page \thepage: same authors and |
| 1002 |
year\MessageBreak without distinguishing extra |
| 1003 |
letter,\MessageBreak appears as question mark}\fi |
| 1004 |
\NMBIB@hyper@{timeline}{\NAT@exlab}% |
| 1005 |
\else |
| 1006 |
\unskip\NAT@spacechar |
| 1007 |
\NMBIB@hyper@{timeline}{\NAT@date}% |
| 1008 |
\fi |
| 1009 |
\else |
| 1010 |
\@citea\NMBIB@hyper@{authors}{% |
| 1011 |
\NAT@nmfmt{\NAT@nm}% |
| 1012 |
\hyper@natlinkbreak{\NAT@spacechar\NAT@@open\if*#1*\else#1\NAT@spacechar\fi}% |
| 1013 |
{\@citeb\@extra@b@citeb}}% |
| 1014 |
\NMBIB@hyper@{timeline}{\NAT@date |
| 1015 |
}% |
| 1016 |
\fi |
| 1017 |
\fi |
| 1018 |
\or\@citea\NMBIB@hyper@{authors}{\NAT@nmfmt{\NAT@nm}}% |
| 1019 |
\or\@citea\NMBIB@hyper@{timeline}{\NAT@date}% |
| 1020 |
\or\@citea\NMBIB@hyper@{alias}{\NAT@alias}% |
| 1021 |
\fi |
| 1022 |
\if\relax\NAT@date\relax |
| 1023 |
\NAT@def@citea |
| 1024 |
\else |
| 1025 |
\NAT@def@citea@close |
| 1026 |
\fi |
| 1027 |
\fi |
| 1028 |
}}\ifNAT@swa\else\if*#2*\else\NAT@cmt#2\fi |
| 1029 |
\if\relax\NAT@date\relax\else\NAT@@close\fi\fi}{#1}{#2}} |
| 1030 |
\let\@citex\NMBIB@citex |
| 1031 |
% \end{macrocode} |
| 1032 |
% \end{macro} |
| 1033 |
% |
| 1034 |
% \begin{macro}{\citealn} |
| 1035 |
% Alternative numerical citation command: |
| 1036 |
% \begin{macrocode} |
| 1037 |
\newcommand\citealn[1]{[\citenum{#1}]} |
| 1038 |
% \end{macrocode} |
| 1039 |
% |
| 1040 |
% \end{macro} |
| 1041 |
% |
| 1042 |
% \begin{macro}{\nmbibSetCiteall} |
| 1043 |
% Setting the format of \cs{citeall} |
| 1044 |
% \begin{macrocode} |
| 1045 |
\def\nmbibSetCiteall#1{\def\NMBIB@citeallformat{#1}} |
| 1046 |
\nmbibSetCiteall{\nmbibLink{\nmbibKEY}{authors}{\nmbibNAME} % |
| 1047 |
(\nmbibLink{\nmbibKEY}{timeline}{\nmbibDATE}) % |
| 1048 |
[\nmbibLink{\nmbibKEY}{sequence}{\nmbibNUM}]} |
| 1049 |
% \end{macrocode} |
| 1050 |
% |
| 1051 |
% \end{macro} |
| 1052 |
% |
| 1053 |
% |
| 1054 |
% \begin{macro}{\citeall} |
| 1055 |
% The full cite command |
| 1056 |
% \begin{macrocode} |
| 1057 |
\DeclareRobustCommand\citeall |
| 1058 |
{\begingroup\@ifnextchar*{\NAT@fulltrue\@citeall}{\NAT@fullfalse\@citeall*}} |
| 1059 |
\def\@citeall#1{\@ifnextchar[{\@@citeall}{\@@citeall[]}} |
| 1060 |
\def\@@citeall[#1]{\@ifnextchar[{\@@@citeall[#1]}{\@@@citeall[][#1]}} |
| 1061 |
\def\@@@citeall[#1][#2]#3{% |
| 1062 |
\NAT@reset@parser |
| 1063 |
\NAT@sort@cites{#3}% |
| 1064 |
\NAT@reset@citea |
| 1065 |
\@cite{% |
| 1066 |
\@for\@citeb:=\NAT@cite@list\do |
| 1067 |
{\@safe@activestrue |
| 1068 |
\edef\@citeb{\expandafter\@firstofone\@citeb\@empty}% |
| 1069 |
\@safe@activesfalse |
| 1070 |
\@ifundefined{b@\@citeb\@extra@b@citeb}{\@citea% |
| 1071 |
{\reset@font\bfseries ?}\NAT@citeundefined |
| 1072 |
\PackageWarning{natbib}% |
| 1073 |
{Citation `\@citeb' on page \thepage \space undefined}\def\NAT@date{}}% |
| 1074 |
{\NAT@parse{\@citeb}% |
| 1075 |
\ifNAT@full\let\NAT@nm\NAT@all@names\else |
| 1076 |
\let\NAT@nm\NAT@name\fi |
| 1077 |
\edef\nmbibKEY{\@citeb}% |
| 1078 |
\edef\nmbibDATE{\NAT@date}% |
| 1079 |
\edef\nmbibNAME{\NAT@nm}% |
| 1080 |
\edef\nmbibNUM{\NAT@num}% |
| 1081 |
\@citea\NMBIB@citeallformat |
| 1082 |
\def\@citea{; }% |
| 1083 |
}}\if*#2*\else\NAT@cmt#2\fi}{#1}{#2}} |
| 1084 |
% \end{macrocode} |
| 1085 |
% |
| 1086 |
% \end{macro} |
| 1087 |
% |
| 1088 |
% |
| 1089 |
%\subsection{Processing bibliography} |
| 1090 |
%\label{sec:processing_bibliography} |
| 1091 |
% |
| 1092 |
% \begin{macro}{\timelinerefname} |
| 1093 |
% \changes{v1.01}{2015/01/27}{Typo corrected} |
| 1094 |
% Reference list for chrono ordering |
| 1095 |
% \begin{macrocode} |
| 1096 |
\providecommand{\timelinerefname}{Chronological List of References} |
| 1097 |
% \end{macrocode} |
| 1098 |
% \end{macro} |
| 1099 |
% \begin{macro}{\timelinebibname} |
| 1100 |
% \changes{v1.04}{2015/07/27}{Typo corrected} |
| 1101 |
% Reference list for chrono ordering |
| 1102 |
% \begin{macrocode} |
| 1103 |
\providecommand{\timelinebibname}{Chronological Bibliography} |
| 1104 |
% \end{macrocode} |
| 1105 |
% \end{macro} |
| 1106 |
% \begin{macro}{\sequencerefname} |
| 1107 |
% Reference list for sequential ordering |
| 1108 |
% \begin{macrocode} |
| 1109 |
\providecommand{\sequencerefname}{Sequential List of References} |
| 1110 |
% \end{macrocode} |
| 1111 |
% \end{macro} |
| 1112 |
% \begin{macro}{\sequencebibname} |
| 1113 |
% Reference list for sequential ordering |
| 1114 |
% \begin{macrocode} |
| 1115 |
\providecommand{\sequencebibname}{Sequential Bibliography} |
| 1116 |
% \end{macrocode} |
| 1117 |
% \end{macro} |
| 1118 |
% \begin{macro}{\authorsrefname} |
| 1119 |
% Reference list for alph ordering |
| 1120 |
% \begin{macrocode} |
| 1121 |
\providecommand{\authorsrefname}{Alphabetic List of References} |
| 1122 |
% \end{macrocode} |
| 1123 |
% \end{macro} |
| 1124 |
% \begin{macro}{\authorsbibname} |
| 1125 |
% Reference list for alph ordering |
| 1126 |
% \begin{macrocode} |
| 1127 |
\providecommand{\authorsbibname}{Alphabetic Bibliography} |
| 1128 |
% \end{macrocode} |
| 1129 |
% \end{macro} |
| 1130 |
% |
| 1131 |
% |
| 1132 |
% \begin{macro}{\ifNMBIB@writenumber} |
| 1133 |
% The switch whether to write the citation number to the |aux| |
| 1134 |
% file. Should be true for sequence, false otherwise. |
| 1135 |
% \begin{macrocode} |
| 1136 |
\newif\ifNMBIB@writenumber |
| 1137 |
\NMBIB@writenumberfalse |
| 1138 |
% \end{macrocode} |
| 1139 |
% |
| 1140 |
% \end{macro} |
| 1141 |
% |
| 1142 |
% \begin{macro}{\NMBIB@setup@authors} |
| 1143 |
% Set up alphabetical-style reference list |
| 1144 |
% \begin{macrocode} |
| 1145 |
\def\NMBIB@setup@authors{% |
| 1146 |
\NMBIB@writenumberfalse} |
| 1147 |
% \end{macrocode} |
| 1148 |
% \end{macro} |
| 1149 |
% |
| 1150 |
% \begin{macro}{\NMBIB@setup@timeline} |
| 1151 |
% Timeline reference list looks like alhpabetical |
| 1152 |
% \begin{macrocode} |
| 1153 |
\let\NMBIB@setup@timeline\NMBIB@setup@authors |
| 1154 |
% \end{macrocode} |
| 1155 |
% \end{macro} |
| 1156 |
% |
| 1157 |
% \begin{macro}{\NMBIB@setup@sequence} |
| 1158 |
% Sequential citations are numerical |
| 1159 |
% \begin{macrocode} |
| 1160 |
\def\NMBIB@setup@sequence{% |
| 1161 |
\NMBIB@writenumbertrue} |
| 1162 |
% \end{macrocode} |
| 1163 |
% \end{macro} |
| 1164 |
% |
| 1165 |
% |
| 1166 |
% |
| 1167 |
% \begin{macro}{\printbibliography} |
| 1168 |
% \changes{v1.02}{2015/04/24}{Added suppression of suffixes} |
| 1169 |
% The actual printing of the bibliography of the given type. Note |
| 1170 |
% that we need to reset \cs{natexlab} afterwards---just in case it |
| 1171 |
% is used outside the bibliography. |
| 1172 |
% \begin{macrocode} |
| 1173 |
\def\printbibliography#1{% |
| 1174 |
\def\NMBIB@current@type{#1}% |
| 1175 |
\def\@biblabel{\csname NMBIB@#1@biblabel\endcsname} |
| 1176 |
\edef\NMBIB@current@cite@suffix{\csname NMBIB@#1@cite@suffix\endcsname}% |
| 1177 |
\csname NMBIB@setup@#1\endcsname |
| 1178 |
\ifx\NMBIB@current@type\NMBIB@bibcite@type |
| 1179 |
\def\natexlab@real##1{##1}% |
| 1180 |
\else |
| 1181 |
\def\natexlab@real##1{\NAT@exlab}% |
| 1182 |
\fi |
| 1183 |
\edef\refname{\csname #1refname\endcsname}% |
| 1184 |
\edef\bibname{\csname #1bibname\endcsname}% |
| 1185 |
\@input@{\csname NMBIB@#1@filename\endcsname.bbl}% |
| 1186 |
\def\natexlab##1{##1}} |
| 1187 |
% \end{macrocode} |
| 1188 |
% |
| 1189 |
% \end{macro} |
| 1190 |
% |
| 1191 |
% \begin{macro}{\bibitem} |
| 1192 |
% Normally \cs{bibitem} is defined as \cs{@lbibitem}. We want first |
| 1193 |
% to calculate the biblabel |
| 1194 |
% \begin{macrocode} |
| 1195 |
\def\bibitem{\@ifnextchar[{\@@lbibitem}{\@@lbibitem[]}}% |
| 1196 |
% \end{macrocode} |
| 1197 |
% \end{macro} |
| 1198 |
% |
| 1199 |
% |
| 1200 |
% \begin{macro}{\@@lbibitem} |
| 1201 |
% \changes{v1.02}{2015/04/24}{Added suppression of suffixes} |
| 1202 |
% The macro \cs{@@lbibitem} calculates \cs{NAT@exlab} and |
| 1203 |
% calls \cs{@lbibitem}: |
| 1204 |
% \begin{macrocode} |
| 1205 |
\def\@@lbibitem[#1]#2{% |
| 1206 |
\let\natexlab\natexlab@real |
| 1207 |
\NAT@parse{#2}% |
| 1208 |
\def\nmbibKEY{#2}% |
| 1209 |
\edef\nmbibDATE{\NAT@date}% |
| 1210 |
\edef\nmbibNAME{\NAT@name}% |
| 1211 |
\edef\nmbibNUM{\NAT@num}% |
| 1212 |
\@lbibitem[#1]{#2}% |
| 1213 |
\ifNMBIB@printyearsuffix\else\def\natexlab##1{}\fi} |
| 1214 |
% \end{macrocode} |
| 1215 |
% |
| 1216 |
% \end{macro} |
| 1217 |
% |
| 1218 |
% \begin{macro}{\NAT@exlab} |
| 1219 |
% Before the package is loaded, \cs{NAT@exlab} should not give an |
| 1220 |
% error: |
| 1221 |
% \begin{macrocode} |
| 1222 |
\providecommand\NAT@exlab{} |
| 1223 |
% \end{macrocode} |
| 1224 |
% |
| 1225 |
% \end{macro} |
| 1226 |
% |
| 1227 |
% \begin{macro}{\NAT@wrout} |
| 1228 |
% The original \cs{NAT@wrout} writes to aux file the information |
| 1229 |
% from the bbl file. Here we check whether we need to do this and |
| 1230 |
% whether to write the number: |
| 1231 |
% \begin{macrocode} |
| 1232 |
\renewcommand\NAT@wrout[5]{% |
| 1233 |
\if@filesw |
| 1234 |
\ifx\NMBIB@current@type\NMBIB@bibcite@type |
| 1235 |
{\let\protect\noexpand\let~\relax |
| 1236 |
\immediate |
| 1237 |
\write\@auxout{\string\bibcite{#5}{{#1}{#2}{{#3}}{{#4}}}}}\fi |
| 1238 |
\ifNMBIB@writenumber |
| 1239 |
{\let\protect\noexpand\let~\relax |
| 1240 |
\immediate |
| 1241 |
\write\@auxout{\string\nmbibcitenumber{#5}{#1}}}\fi |
| 1242 |
\fi |
| 1243 |
\ignorespaces} |
| 1244 |
% \end{macrocode} |
| 1245 |
% |
| 1246 |
% \end{macro} |
| 1247 |
% |
| 1248 |
% \begin{macro}{\NAT@anchor} |
| 1249 |
% The command \cs{NAT@anchor}\marg{KEY}\marg{text} creates a |
| 1250 |
% hyperlink if the package |hyperref| is loaded. Here we redefine |
| 1251 |
% it to create cites in the style |KEY-TYPE|: |
| 1252 |
% \begin{macrocode} |
| 1253 |
\def\NAT@anchor#1#2{% |
| 1254 |
\hyper@natanchorstart{#1\@extra@b@citeb-\NMBIB@current@cite@suffix}% |
| 1255 |
\def\@tempa{#2}\@ifx{\@tempa\@empty}{}{\@biblabel{#2}}% |
| 1256 |
\hyper@natanchorend |
| 1257 |
}% |
| 1258 |
% \end{macrocode} |
| 1259 |
% |
| 1260 |
% \end{macro} |
| 1261 |
% |
| 1262 |
% \begin{macro}{\nmbibSetBiblabel} |
| 1263 |
% Setting biblabel for the list |
| 1264 |
% \begin{macrocode} |
| 1265 |
\def\nmbibSetBiblabel#1#2{% |
| 1266 |
\expandafter\def\csname NMBIB@#1@biblabel\endcsname##1{#2}} |
| 1267 |
% \end{macrocode} |
| 1268 |
% |
| 1269 |
% \end{macro} |
| 1270 |
% |
| 1271 |
% \begin{macro}{\NMBIB@timeline@biblabel} |
| 1272 |
% \begin{macro}{\NMBIB@sequence@biblabel} |
| 1273 |
% \changes{v1.01}{2015/01/27}{Punctiuation changed} |
| 1274 |
% \begin{macro}{\NMBIB@authors@biblabel} |
| 1275 |
% The default labels |
| 1276 |
% \begin{macrocode} |
| 1277 |
\nmbibSetBiblabel{timeline}{[\nmbibDATE: |
| 1278 |
\nmbibLink{\nmbibKEY}{authors}{\nmbibNAME}; |
| 1279 |
\nmbibLink{\nmbibKEY}{sequence}{\nmbibNUM}]} |
| 1280 |
\nmbibSetBiblabel{authors}{[\nmbibNAME\ |
| 1281 |
(\nmbibLink{\nmbibKEY}{timeline}{\nmbibDATE}); |
| 1282 |
\nmbibLink{\nmbibKEY}{sequence}{\nmbibNUM}]} |
| 1283 |
\nmbibSetBiblabel{sequence}{[\nmbibNUM: |
| 1284 |
\nmbibLink{\nmbibKEY}{authors}{\nmbibNAME} |
| 1285 |
(\nmbibLink{\nmbibKEY}{timeline}{\nmbibDATE})]} |
| 1286 |
% \end{macrocode} |
| 1287 |
% |
| 1288 |
% \end{macro} |
| 1289 |
% \end{macro} |
| 1290 |
% \end{macro} |
| 1291 |
% |
| 1292 |
% |
| 1293 |
%\subsection{Ending the Style} |
| 1294 |
%\label{sec:end} |
| 1295 |
% |
| 1296 |
% |
| 1297 |
% |
| 1298 |
% \begin{macrocode} |
| 1299 |
%</style> |
| 1300 |
% \end{macrocode} |
| 1301 |
%\Finale |
| 1302 |
%\clearpage |
| 1303 |
% |
| 1304 |
%\PrintChanges |
| 1305 |
%\clearpage |
| 1306 |
%\PrintIndex |
| 1307 |
% |
| 1308 |
\endinput |
| 1309 |
|