| 1 |
% \iffalse |
| 2 |
% $Id: multibibliography.dtx,v 1.10 2013-05-30 02:22:26 boris Exp $ |
| 3 |
% |
| 4 |
%% Copyright 2013, Michael Cohen <[email protected]> |
| 5 |
%% and Yannis Haralambous, <[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 Michael Cohen |
| 18 |
%% |
| 19 |
%% This work consists of the file multibibliography.dtx, the |
| 20 |
%% derived file multibibliography.sty, and the files |
| 21 |
%% chronological.bst and multibibliography.pl |
| 22 |
%% |
| 23 |
%<*gobble> |
| 24 |
% \fi |
| 25 |
% \CheckSum{193} |
| 26 |
% |
| 27 |
% |
| 28 |
%% \CharacterTable |
| 29 |
%% {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 |
| 30 |
%% 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 |
| 31 |
%% Digits \0\1\2\3\4\5\6\7\8\9 |
| 32 |
%% Exclamation \! Double quote \" Hash (number) \# |
| 33 |
%% Dollar \$ Percent \% Ampersand \& |
| 34 |
%% Acute accent \' Left paren \( Right paren \) |
| 35 |
%% Asterisk \* Plus \+ Comma \, |
| 36 |
%% Minus \- Point \. Solidus \/ |
| 37 |
%% Colon \: Semicolon \; Less than \< |
| 38 |
%% Equals \= Greater than \> Question mark \? |
| 39 |
%% Commercial at \@ Left bracket \[ Backslash \\ |
| 40 |
%% Right bracket \] Circumflex \^ Underscore \_ |
| 41 |
%% Grave accent \` Left brace \{ Vertical bar \| |
| 42 |
%% Right brace \} Tilde \~} |
| 43 |
% |
| 44 |
%\iffalse |
| 45 |
% \begin{macrocode} |
| 46 |
\documentclass{ltxdoc} |
| 47 |
\usepackage[breaklinks,colorlinks,linkcolor=black,citecolor=black, |
| 48 |
pagecolor=black,urlcolor=black]{hyperref} |
| 49 |
\usepackage{multibibliography} |
| 50 |
\PageIndex |
| 51 |
\CodelineIndex |
| 52 |
\RecordChanges |
| 53 |
\EnableCrossrefs |
| 54 |
\begin{document} |
| 55 |
\DocInput{multibibliography.dtx} |
| 56 |
\end{document} |
| 57 |
% \end{macrocode} |
| 58 |
%</gobble> |
| 59 |
% \fi |
| 60 |
% \MakeShortVerb{|} |
| 61 |
% \GetFileInfo{multibibliography.sty} |
| 62 |
% |
| 63 |
% \changes{v1.03}{2013/05/29}{Rewrote multibibliography.pl: no more |
| 64 |
% temp files} |
| 65 |
% |
| 66 |
% \title{The Multibibliography Package\thanks{\copyright 2013 Michael |
| 67 |
% Cohen and Yannis Haralambous}} |
| 68 |
% \author{Michael Cohen\thanks{[email protected]} \and |
| 69 |
% Yannis Haralambous\thanks{[email protected]} |
| 70 |
% \and Boris Veytsman \thanks{[email protected]}} |
| 71 |
% \date{\filedate, \fileversion} |
| 72 |
% \maketitle |
| 73 |
% |
| 74 |
% \begin{abstract} |
| 75 |
% Conventional standards for bibliography styles entail a forced |
| 76 |
% choice between index and name/year citations and corresponding |
| 77 |
% references. We reject this false dichotomy, and describe a |
| 78 |
% multibibliography, comprising alphabetic, sequenced, and even |
| 79 |
% chronological orderings of references. An extended inline |
| 80 |
% citation format is also proposed to integrate such heterogeneous |
| 81 |
% styles, and is usable and useful even without separate |
| 82 |
% bibliographies. |
| 83 |
% \end{abstract} |
| 84 |
% \changes{v1.02}{2013/03/26}{Fixed the bug in multibibliography.pl |
| 85 |
% that prevented correct handling of accents} |
| 86 |
% |
| 87 |
% \tableofcontents |
| 88 |
% |
| 89 |
% \clearpage |
| 90 |
% |
| 91 |
%\section{Introduction} |
| 92 |
%\label{sec:intro} |
| 93 |
% |
| 94 |
% This package illustrates our novel system for a multibibliography, which |
| 95 |
% combines alphabetic, sequenced, and chronological ordering of |
| 96 |
% references. The rationale for the system is provided in the |
| 97 |
% enclosed TUG paper. This package provides the code for the |
| 98 |
% system. |
| 99 |
% |
| 100 |
%\section{User Interface} |
| 101 |
%\label{sec:interface} |
| 102 |
% |
| 103 |
% The installation of the class follows the usual |
| 104 |
% practice~\cite{TeXFAQ} for \LaTeX{} packages: |
| 105 |
% \begin{enumerate} |
| 106 |
% \item Run \textsf{latex} on |multibibliography.ins|. This will produce the file |
| 107 |
% |multibibliography.sty|. |
| 108 |
% \item Put the file |multibibliography.sty| to |
| 109 |
% the place where \LaTeX{} can find it (see |
| 110 |
% \cite{TeXFAQ} or the documentation for your \TeX{} |
| 111 |
% system).\label{item:install} |
| 112 |
% \item Put the file |chronological.bst| to the place where Bib\TeX\ |
| 113 |
% can find it (see |
| 114 |
% \cite{TeXFAQ} or the documentation for your \TeX{} |
| 115 |
% system). |
| 116 |
% \item Put the file |multibibliography.pl| into the place where |
| 117 |
% binaries are stored on your system. |
| 118 |
% \item Update the database of file names. Again, see \cite{TeXFAQ} |
| 119 |
% or the documentation for your \TeX{} system for the system-specific |
| 120 |
% details.\label{item:update} |
| 121 |
% \item The files |multibibliography.pdf| and |tug-paper.pdf| provide |
| 122 |
% the documentation for the package |
| 123 |
% \end{enumerate} |
| 124 |
% As an alternative to items~\ref{item:install} and~\ref{item:update} |
| 125 |
% you can just put the files in the working directory where your |
| 126 |
% |.tex| file is. |
| 127 |
% |
| 128 |
% |
| 129 |
% |
| 130 |
% To use this package, add to the preamble of your document |
| 131 |
% the line |\usepackage{multibibliography}|. After |latex|'ing the |
| 132 |
% file, instead of running |
| 133 |
% \begin{verbatim} |
| 134 |
% bibtex FILE |
| 135 |
% \end{verbatim} |
| 136 |
% run |
| 137 |
% \begin{verbatim} |
| 138 |
% multibibliography.pl FILE.tex |
| 139 |
% \end{verbatim} |
| 140 |
% Then proceed in the usual way (run |latex| until the labels converge). |
| 141 |
% |
| 142 |
% \DescribeMacro{\bibliographysequence} |
| 143 |
% \DescribeMacro{\bibliographytimeline} |
| 144 |
% The file defines two new commands: |
| 145 |
% \cmd{\bibliographysequence}\marg{bib-files} and |
| 146 |
% \cmd{\bibliographytimeline}\marg{bib-files} which are similar to the |
| 147 |
% standard |\bibliography| command, but produce the reference lists |
| 148 |
% ordered according to the sequence of citations or chronologically. |
| 149 |
% They use |unsrt.bst| and |chronological.bst| styles |
| 150 |
% correspondingly. An example of usage can be found in the file |
| 151 |
% |tug-paper.tex|: |
| 152 |
% \begin{verbatim} |
| 153 |
% \renewcommand\refname{References sorted by name} |
| 154 |
% \bibliographystyle{apalike} |
| 155 |
% \bibliography{multibibliography} |
| 156 |
% |
| 157 |
% \renewcommand\refname{References sorted by appearance} |
| 158 |
% \bibliographysequence{multibibliography} |
| 159 |
% |
| 160 |
% \renewcommand\refname{References sorted by year} |
| 161 |
% \bibliographytimeline{multibibliography} |
| 162 |
% |
| 163 |
% \end{verbatim} |
| 164 |
% |
| 165 |
% |
| 166 |
%\StopEventually{\clearpage |
| 167 |
% \bibliography{multibibliography} |
| 168 |
% \bibliographystyle{unsrt}} |
| 169 |
% |
| 170 |
% \clearpage |
| 171 |
% |
| 172 |
% \section{Implementation} |
| 173 |
% \label{sec:implementation} |
| 174 |
% |
| 175 |
% |
| 176 |
%\subsection{Declarations} |
| 177 |
%\label{sec:decl} |
| 178 |
% |
| 179 |
% We start with declaration, who we are: |
| 180 |
% |
| 181 |
% |
| 182 |
% \begin{macrocode} |
| 183 |
%<style>\NeedsTeXFormat{LaTeX2e} |
| 184 |
%<*gobble> |
| 185 |
\ProvidesFile{multibibliography.dtx} |
| 186 |
%</gobble> |
| 187 |
%<style>\ProvidesPackage{multibibliography} |
| 188 |
%<*style> |
| 189 |
[2013/05/29 v1.03 Multibibliography support for LaTeX] |
| 190 |
% \end{macrocode} |
| 191 |
% |
| 192 |
% |
| 193 |
% |
| 194 |
%\subsection{Hyperref Patching} |
| 195 |
%\label{sec:hyperref} |
| 196 |
% |
| 197 |
% \begin{macro}{\NAT@parse} |
| 198 |
% \changes{v1.01}{2013/02/28}{Introduced the command} |
| 199 |
% Hyperref redefines a lot of bibliography related commands. |
| 200 |
% Fortunately, there is a mechanism in hyperref to prevent this: if |
| 201 |
% hyperref sees natbib, it defers to it. Well, we can dupe hyperref |
| 202 |
% into thinking natbib is loaded: |
| 203 |
% \begin{macrocode} |
| 204 |
\providecommand\NAT@parse[1]{} |
| 205 |
% \end{macrocode} |
| 206 |
% \end{macro} |
| 207 |
% |
| 208 |
% \begin{macro}{\@extra@binfo} |
| 209 |
% \changes{v1.01}{2013/02/28}{Introduced the command} |
| 210 |
% This is a hook defined by natbib. We preserve it just in case: |
| 211 |
% \begin{macrocode} |
| 212 |
\providecommand*\@extra@binfo{} |
| 213 |
% \end{macrocode} |
| 214 |
% |
| 215 |
% \end{macro} |
| 216 |
% |
| 217 |
% \begin{macro}{\@extra@b@citeb} |
| 218 |
% \changes{v1.01}{2013/02/28}{Introduced the command} |
| 219 |
% Another natbib hook: |
| 220 |
% \begin{macrocode} |
| 221 |
\providecommand*\@extra@b@citeb{} |
| 222 |
% \end{macrocode} |
| 223 |
% |
| 224 |
% \end{macro} |
| 225 |
% |
| 226 |
% \begin{macro}{\@BIBLABEL} |
| 227 |
% \changes{v1.01}{2013/02/28}{Introduced the command} |
| 228 |
% This is a hyperref hook |
| 229 |
% \begin{macrocode} |
| 230 |
\providecommand*{\@BIBLABEL}{\@biblabel} |
| 231 |
% \end{macrocode} |
| 232 |
% |
| 233 |
% \end{macro} |
| 234 |
% |
| 235 |
% |
| 236 |
% In case hyperref is not loaded, we provide some noops |
| 237 |
% \begin{macrocode} |
| 238 |
\AtBeginDocument{ |
| 239 |
\ifx\hyper@@link\@undefined |
| 240 |
\providecommand\@skiphyperreftrue{}% |
| 241 |
\providecommand\@skiphyperreffalse{}% |
| 242 |
\let\H@item\item |
| 243 |
\providecommand\Hy@raisedlink[1]{#1}% |
| 244 |
\let\hyper@anchorstart\@gobble |
| 245 |
\providecommand\hyper@@link[4][]{#4}% |
| 246 |
\providecommand{\hyper@anchorend}{}% |
| 247 |
\providecommand{\@currentHref}{}% |
| 248 |
\fi} |
| 249 |
% \end{macrocode} |
| 250 |
% |
| 251 |
% |
| 252 |
%\subsection{Checking for backref} |
| 253 |
%\label{sec:backref} |
| 254 |
% |
| 255 |
% \begin{macro}{\if@BR@tocstarted} |
| 256 |
% \changes{v1.02}{2013/03/26}{Added macro} |
| 257 |
% Backref rewrites |.brf| file with each iteration. So we need to |
| 258 |
% make sure we call |\BR@starttoc| no more than once |
| 259 |
% \begin{macrocode} |
| 260 |
\newif\if@BR@tocstarted |
| 261 |
\@BR@tocstartedfalse |
| 262 |
% \end{macrocode} |
| 263 |
% |
| 264 |
% \end{macro} |
| 265 |
% |
| 266 |
% |
| 267 |
% \begin{macro}{\if@backref@loaded} |
| 268 |
% \changes{v1.02}{2013/03/26}{Added macro} |
| 269 |
% We need to check whether backref is loaded: |
| 270 |
% \begin{macrocode} |
| 271 |
\newif\if@backref@loaded |
| 272 |
\AtBeginDocument{% |
| 273 |
\@ifpackageloaded{backref}{\@backref@loadedtrue |
| 274 |
\let\BR@starttoc@orig\BR@starttoc |
| 275 |
\def\BR@starttoc{\if@BR@tocstarted\else |
| 276 |
\BR@starttoc@orig\@BR@tocstartedtrue\fi} |
| 277 |
}{\@backref@loadedfalse}} |
| 278 |
% \end{macrocode} |
| 279 |
% |
| 280 |
% \end{macro} |
| 281 |
% |
| 282 |
%\subsection{Creating Bibliography Labels} |
| 283 |
%\label{sec:MBbibcite} |
| 284 |
% |
| 285 |
% \begin{macro}{\MBbibcite} |
| 286 |
% \changes{v1.01}{2013/02/28}{Introduced the command} |
| 287 |
% \changes{v1.02}{2013/03/26}{Added backref code} |
| 288 |
% The standard |\bibcite| command has two arguments: the label and |
| 289 |
% the typeset represenation. Our command has four arguments: |
| 290 |
% sequence number, name, date, label. We also write |\backcite| to |
| 291 |
% the aux file if backref is called. |
| 292 |
% \begin{macrocode} |
| 293 |
\def\MBbibcite#1#2#3#4{% |
| 294 |
\@newl@bel{b}{#1\@extra@binfo}{% |
| 295 |
\hyper@@link[cite]{}{cite.#1\@extra@b@citeb}{#3}, |
| 296 |
\hyper@@link[cite]{}{cite.#1\@extra@b@citeb-timeline}{#4}: |
| 297 |
\hyper@@link[cite]{}{cite.#1\@extra@b@citeb-sequence}{#2}% |
| 298 |
\if@filesw |
| 299 |
\if@backref@loaded\phantomsection |
| 300 |
\immediate\write\@mainaux{% |
| 301 |
\string\backcite{#1}{{\thepage}{\@currentlabel}{\@currentHref}}}\fi\fi |
| 302 |
}% |
| 303 |
}% |
| 304 |
% \end{macrocode} |
| 305 |
% |
| 306 |
% \end{macro} |
| 307 |
% |
| 308 |
%\subsection{Bibliography Commands} |
| 309 |
%\label{sec:default} |
| 310 |
% |
| 311 |
% The default command is defined for references sorted by |
| 312 |
% name---it is invoked by |\bibliography|. |
| 313 |
% |
| 314 |
% \begin{macro}{\@lbibitem} |
| 315 |
% \changes{v1.01}{2013/02/28}{Redefined} |
| 316 |
% \changes{v1.02}{2013/03/26}{Added interlinks} |
| 317 |
% By default |\@lbibitem| typesets the optional argument, creates a |
| 318 |
% hyperanchor and writes a command into the aux file. The following |
| 319 |
% uses hyperref code: |
| 320 |
% \begin{macrocode} |
| 321 |
\def\@lbibitem[#1]#2{% |
| 322 |
\gdef\MB@sequence{}% |
| 323 |
\gdef\MB@name{}% |
| 324 |
\gdef\MB@name{}% |
| 325 |
\def\MBlabel##1##2##3{##2, |
| 326 |
\hyper@@link[cite]{}{cite.#2\@extra@b@citeb-timeline}{##3}: |
| 327 |
\hyper@@link[cite]{}{cite.#2\@extra@b@citeb-sequence}{##1}% |
| 328 |
\gdef\MB@sequence{##1}% |
| 329 |
\gdef\MB@name{##2}% |
| 330 |
\gdef\MB@date{##3}% |
| 331 |
}% |
| 332 |
\@skiphyperreftrue |
| 333 |
\H@item[% |
| 334 |
\ifx\Hy@raisedlink\@empty |
| 335 |
\hyper@anchorstart{cite.#2\@extra@b@citeb}% |
| 336 |
\@BIBLABEL{#1}% |
| 337 |
\hyper@anchorend |
| 338 |
\else |
| 339 |
\Hy@raisedlink{% |
| 340 |
\hyper@anchorstart{cite.#2\@extra@b@citeb}\hyper@anchorend |
| 341 |
}% |
| 342 |
\@BIBLABEL{#1}% |
| 343 |
\fi |
| 344 |
\hfill |
| 345 |
]% |
| 346 |
\@skiphyperreffalse |
| 347 |
\if@filesw |
| 348 |
\begingroup |
| 349 |
\let\protect\noexpand |
| 350 |
\immediate\write\@auxout{% |
| 351 |
\string\MBbibcite{#2}{\MB@sequence}{\MB@name}{\MB@date}% |
| 352 |
}% |
| 353 |
\endgroup |
| 354 |
\fi |
| 355 |
\ignorespaces |
| 356 |
} |
| 357 |
% \end{macrocode} |
| 358 |
% |
| 359 |
% \end{macro} |
| 360 |
% |
| 361 |
% |
| 362 |
% |
| 363 |
% \begin{macro}{\bibliographysequence} |
| 364 |
% \changes{v1.01}{2013/02/28}{Added hyperref-compatible code} |
| 365 |
% \changes{v1.02}{2013/03/26}{Added interlinks} |
| 366 |
% When we order by sequence, we do not write anything to the aux |
| 367 |
% file |
| 368 |
% \begin{macrocode} |
| 369 |
\def\bibliographysequence#1{% |
| 370 |
\def\@lbibitem[##1]##2{% |
| 371 |
\def\MBlabel####1####2####3{####1: |
| 372 |
\hyper@@link[cite]{}{cite.##2\@extra@b@citeb}{####2}, |
| 373 |
\hyper@@link[cite]{}{cite.##2\@extra@b@citeb-timeline}{####3}}% |
| 374 |
\@skiphyperreftrue |
| 375 |
\H@item[% |
| 376 |
\ifx\Hy@raisedlink\@empty |
| 377 |
\hyper@anchorstart{cite.##2\@extra@b@citeb-sequence}% |
| 378 |
\@BIBLABEL{##1}% |
| 379 |
\hyper@anchorend |
| 380 |
\else |
| 381 |
\Hy@raisedlink{% |
| 382 |
\hyper@anchorstart{cite.##2\@extra@b@citeb-sequence}\hyper@anchorend |
| 383 |
}% |
| 384 |
\@BIBLABEL{##1}% |
| 385 |
\fi |
| 386 |
\hfill |
| 387 |
]% |
| 388 |
\@skiphyperreffalse |
| 389 |
\ignorespaces |
| 390 |
} |
| 391 |
\@input@{\jobname-sequence.bbl}} |
| 392 |
% \end{macrocode} |
| 393 |
% \end{macro} |
| 394 |
% |
| 395 |
% \begin{macro}{\bibliographytimeline} |
| 396 |
% \changes{v1.01}{2013/02/28}{Added hyperref-compatible code} |
| 397 |
% \changes{v1.02}{2013/03/26}{Added interlinks} |
| 398 |
% This is the ordering by timeline: |
| 399 |
% \begin{macrocode} |
| 400 |
\def\bibliographytimeline#1{% |
| 401 |
\def\@lbibitem[##1]##2{% |
| 402 |
\def\MBlabel####1####2####3{% |
| 403 |
\hyper@@link[cite]{}{cite.##2\@extra@b@citeb}{####2}, |
| 404 |
####3: |
| 405 |
\hyper@@link[cite]{}{cite.##2\@extra@b@citeb-sequence}{####1}}% |
| 406 |
\@skiphyperreftrue |
| 407 |
\H@item[% |
| 408 |
\ifx\Hy@raisedlink\@empty |
| 409 |
\hyper@anchorstart{cite.##2\@extra@b@citeb-timeline}% |
| 410 |
\@BIBLABEL{##1}% |
| 411 |
\hyper@anchorend |
| 412 |
\else |
| 413 |
\Hy@raisedlink{% |
| 414 |
\hyper@anchorstart{cite.##2\@extra@b@citeb-timeline}\hyper@anchorend |
| 415 |
}% |
| 416 |
\@BIBLABEL{##1}% |
| 417 |
\fi |
| 418 |
\hfill |
| 419 |
]% |
| 420 |
\@skiphyperreffalse |
| 421 |
\ignorespaces |
| 422 |
} |
| 423 |
\@input@{\jobname-timeline.bbl}} |
| 424 |
% \end{macrocode} |
| 425 |
% |
| 426 |
% \end{macro} |
| 427 |
% |
| 428 |
%\subsection{Ending the Style} |
| 429 |
%\label{sec:end} |
| 430 |
% |
| 431 |
% |
| 432 |
% |
| 433 |
% \begin{macrocode} |
| 434 |
%</style> |
| 435 |
% \end{macrocode} |
| 436 |
%\Finale |
| 437 |
%\clearpage |
| 438 |
% |
| 439 |
%\PrintChanges |
| 440 |
%\clearpage |
| 441 |
%\PrintIndex |
| 442 |
% |
| 443 |
\endinput |