| 1 |
% \iffalse |
| 2 |
\NeedsTeXFormat{LaTeX2e}[1996/10/24] |
| 3 |
%<package>\ProvidesPackage{bibtopicprefix} |
| 4 |
%<package> [2006/10/22 v1.10 BibTopicPrefix Package (MS)] |
| 5 |
% |
| 6 |
%<*driver> |
| 7 |
\ProvidesFile{bibtopicprefix.drv} |
| 8 |
[2006/10/18 v1.00 Driver for BibTopicPrefix Package (MS)] |
| 9 |
\documentclass{ltxdoc} |
| 10 |
\usepackage{url} |
| 11 |
\usepackage{bibtopicprefix} |
| 12 |
\usepackage[T1]{fontenc} |
| 13 |
\usepackage{lmodern} |
| 14 |
\usepackage{microtype} |
| 15 |
\GetFileInfo{bibtopicprefix.sty} |
| 16 |
\EnableCrossrefs |
| 17 |
\RecordChanges % Gather update information |
| 18 |
%%\DisableCrossrefs% Say \DisableCrossrefs if index is ready |
| 19 |
\CodelineIndex % Index code by line number |
| 20 |
\OnlyDescription % comment out for implementation details |
| 21 |
%%\OldMakeIndex % use if your MakeIndex is pre-v2.9 |
| 22 |
\setcounter{IndexColumns}{2} |
| 23 |
\setlength{\IndexMin}{40ex} |
| 24 |
\setlength{\columnseprule}{.4pt} |
| 25 |
\addtolength{\oddsidemargin}{1cm} |
| 26 |
\addtolength{\textwidth}{-1cm} |
| 27 |
\begin{document} |
| 28 |
\DocInput{bibtopicprefix.dtx} |
| 29 |
\end{document} |
| 30 |
%</driver> |
| 31 |
% |
| 32 |
% Copyright 2006 by Martin Schr"oder |
| 33 |
% |
| 34 |
% This work may be distributed and/or modified under the conditions of |
| 35 |
% the LaTeX Project Public License, either version 1.3 of this license |
| 36 |
% or (at your option) any later version. The latest version of this |
| 37 |
% license is in |
| 38 |
% http://www.latex-project.org/lppl.txt |
| 39 |
% and version 1.3 or later is part of all distributions of LaTeX |
| 40 |
% version 2005/12/01 or later. |
| 41 |
% |
| 42 |
% This work has the LPPL maintenance status `maintained'. |
| 43 |
% |
| 44 |
% The Current Maintainer of this work is Martin Schr"oeder. |
| 45 |
% |
| 46 |
% This work consists of the files bibtopicprefix.dtx and |
| 47 |
% bibtopicprefix.ins and the derived file bibtopicprefix.sty |
| 48 |
% |
| 49 |
% For error reports in case of UNCHANGED versions see bibtopicprefix.ins |
| 50 |
% |
| 51 |
% \fi |
| 52 |
% |
| 53 |
% \CheckSum{119} |
| 54 |
% ^^A$Id: bibtopicprefix.dtx,v 1.3 2006/10/21 22:52:26 ms Exp $ |
| 55 |
% |
| 56 |
%% \CharacterTable |
| 57 |
%% {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 |
| 58 |
%% 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 |
| 59 |
%% Digits \0\1\2\3\4\5\6\7\8\9 |
| 60 |
%% Exclamation \! Double quote \" Hash (number) \# |
| 61 |
%% Dollar \$ Percent \% Ampersand \& |
| 62 |
%% Acute accent \' Left paren \( Right paren \) |
| 63 |
%% Asterisk \* Plus \+ Comma \, |
| 64 |
%% Minus \- Point \. Solidus \/ |
| 65 |
%% Colon \: Semicolon \; Less than \< |
| 66 |
%% Equals \= Greater than \> Question mark \? |
| 67 |
%% Commercial at \@ Left bracket \[ Backslash \\ |
| 68 |
%% Right bracket \] Circumflex \^ Underscore \_ |
| 69 |
%% Grave accent \` Left brace \{ Vertical bar \| |
| 70 |
%% Right brace \} Tilde \~} |
| 71 |
%% |
| 72 |
% |
| 73 |
% \pagestyle{headings} |
| 74 |
% |
| 75 |
% \newcommand{\bs} {\texttt{\symbol{'134}}} |
| 76 |
% \newcommand*{\env}[1] {\textsf{#1}} |
| 77 |
% \newcommand*{\option}[1] {\textsf{#1}} |
| 78 |
% \newcommand*{\package}[1] {\textsf{#1}} |
| 79 |
% \newcommand*{\bst}[1] {\textsf{#1}} |
| 80 |
% \newcommand*{\NEWfeature}[1]{% |
| 81 |
% \hskip 1sp \marginpar{\small\sffamily\raggedright |
| 82 |
% New feature\\#1}} |
| 83 |
% \newcommand*{\NEWdescription}[1]{% |
| 84 |
% \hskip 1sp \marginpar{\small\sffamily\raggedright |
| 85 |
% New description\\#1}} |
| 86 |
% |
| 87 |
% \renewcommand{\thefootnote}{\ensuremath{\fnsymbol{footnote}}} |
| 88 |
% |
| 89 |
% ^^A ----------------------------- |
| 90 |
% |
| 91 |
% \title{\unskip |
| 92 |
% The \textsf{BibTopicPrefix}-package^^A |
| 93 |
% \thanks{^^A |
| 94 |
% The version number of this file is \fileversion, |
| 95 |
% last revised \filedate.}^^A |
| 96 |
% } |
| 97 |
% \author{Martin Schr\"oder\\[0.5ex] |
| 98 |
% \normalsize Cr\"usemannallee 3\\ |
| 99 |
% \normalsize 28213 Bremen\\ |
| 100 |
% \normalsize Germany\\ |
| 101 |
% \normalsize [email protected]} |
| 102 |
% \date{\filedate} |
| 103 |
% \maketitle |
| 104 |
% |
| 105 |
% ^^A ----------------------------- |
| 106 |
% |
| 107 |
% \begin{abstract} |
| 108 |
% This package provides a way to prefix references from |
| 109 |
% bibliographies produced by the \package{bibtopic} |
| 110 |
% package\cite{bibtopic}. |
| 111 |
% \end{abstract} |
| 112 |
% |
| 113 |
% |
| 114 |
% ^^A ----------------------------- |
| 115 |
% |
| 116 |
% \tableofcontents |
| 117 |
% |
| 118 |
% ^^A ----------------------------- |
| 119 |
% |
| 120 |
% \section{Introduction} |
| 121 |
% ^^A |
| 122 |
% Suppose you want to split your literature in your document into |
| 123 |
% parts (this can be done with the \package{bibtopic} package) and you |
| 124 |
% want to make this split visible in the references in the document. |
| 125 |
% |
| 126 |
% This package loads \package{bibtopic} with the right option and then |
| 127 |
% defines a command \cs{bibprefix} which should be used inside the |
| 128 |
% \env{btSect} environment, whose argument is inserted before every |
| 129 |
% reference (e.\,g. [1] becomes [\meta{prefix}1]). |
| 130 |
% |
| 131 |
% |
| 132 |
% ^^A ----------------------------- |
| 133 |
% |
| 134 |
% \section{Usage} |
| 135 |
% ^^A |
| 136 |
% \DescribeMacro{\bibtopic} |
| 137 |
% Add an \mbox{\cs{usepackage\{}\package{bibtopicprefix}\texttt{\}}} |
| 138 |
% to your document and insert the command \cs{bibprefix}\marg{prefix} |
| 139 |
% at the start of every \env{btSect} environment. |
| 140 |
% \begin{quote} |
| 141 |
%\begin{verbatim} |
| 142 |
%\begin{btSect}{adlit} |
| 143 |
% \renewcommand{\bibprefix}{AD} |
| 144 |
% \section{Applicable Documents} |
| 145 |
% \btPrintCited |
| 146 |
%\end{btSect} |
| 147 |
%\begin{btSect}{rdlit} |
| 148 |
% \renewcommand{\bibprefix}{RD} |
| 149 |
% \section{Reference Documents} |
| 150 |
% \btPrintCited |
| 151 |
%\end{btSect} |
| 152 |
%\end{verbatim} |
| 153 |
% \end{quote} |
| 154 |
% The package works of course best with bibliography styles that |
| 155 |
% produce numerical references (like \bst{plain}). |
| 156 |
% |
| 157 |
% |
| 158 |
% ^^A ----------------------------- |
| 159 |
% |
| 160 |
% \section{Required packages} |
| 161 |
% ^^A |
| 162 |
% This package requires the following package: |
| 163 |
% \begin{description} |
| 164 |
% \item[\normalfont\package{bibtopic}\cite{bibtopic}] |
| 165 |
% It is loaded with the right option so that all bibliographies |
| 166 |
% are numbered indepedently. |
| 167 |
% \item[\normalfont\package{scrlfile}\cite{scrlfile}] |
| 168 |
% \changes{v1.10}{2006/10/22}{Use \package{scrlfile}} |
| 169 |
% This is used internally to handle the |
| 170 |
% \package{hyperref}\cite{hyperref} package. |
| 171 |
% \end{description} |
| 172 |
% |
| 173 |
% |
| 174 |
% ^^A ----------------------------- |
| 175 |
% |
| 176 |
% \StopEventually{^^A |
| 177 |
% |
| 178 |
% |
| 179 |
% ^^A ----------------------------- |
| 180 |
% |
| 181 |
% \section{Acknowledgements} |
| 182 |
% ^^A |
| 183 |
% Developement of this package was financed by the von Hoerner \& |
| 184 |
% Sulger GmbH. |
| 185 |
% |
| 186 |
% ^^A ----------------------------- |
| 187 |
% |
| 188 |
% \begin{thebibliography}{1} |
| 189 |
% \bibitem{babel} |
| 190 |
% Johannes Braams |
| 191 |
% \newblock Babel, a multilingual package for use with \LaTeX's |
| 192 |
% standard document classes |
| 193 |
% \newblock \url{CTAN: tex-archive/macros/latex/required/babel/}. |
| 194 |
% \bibitem{bibtopic} |
| 195 |
% Pierre Basso and Stefan Ulrich |
| 196 |
% \newblock \textsf{bibtopic.sty} |
| 197 |
% \newblock \url{CTAN: tex-archive/macros/latex/contrib/bibtopic/}. |
| 198 |
% \bibitem{hyperref} |
| 199 |
% Sebastian Rahtz and Heiko Oberdiek |
| 200 |
% \newblock Hypertext marks in \LaTeX{} |
| 201 |
% \newblock \url{CTAN: tex-archive/macros/latex/contrib/hyperref/}. |
| 202 |
% \bibitem{scrlfile} |
| 203 |
% Markus Kohm |
| 204 |
% \newblock \textsf{scrlfile.sty} |
| 205 |
% \newblock Part of KOMA-Script. |
| 206 |
% \newblock \url{CTAN: tex-archive/macros/latex/contrib/koma-script/}. |
| 207 |
% \end{thebibliography} |
| 208 |
% } |
| 209 |
% |
| 210 |
% ^^A ----------------------------- |
| 211 |
% |
| 212 |
% \section{The implementation} |
| 213 |
% \begin{macrocode} |
| 214 |
%<*package> |
| 215 |
% \end{macrocode} |
| 216 |
% |
| 217 |
% |
| 218 |
% ^^A ----------------------------- |
| 219 |
% |
| 220 |
% \subsection{Loading packages} |
| 221 |
% ^^A |
| 222 |
% We need the \package{scrlfile} package\cite{scrlfile}. |
| 223 |
% \changes{v1.10}{2006/10/22}{Load \package{scrlfile}} |
| 224 |
% \begin{macrocode} |
| 225 |
\RequirePackage{scrlfile} |
| 226 |
% \end{macrocode} |
| 227 |
% We need the \package{bibtopic} package\cite{bibtopic} and we have |
| 228 |
% to use the \option{sectcntreset} option to number every |
| 229 |
% bibliography seperately. |
| 230 |
% \begin{macrocode} |
| 231 |
\RequirePackage[sectcntreset]{bibtopic} |
| 232 |
% \end{macrocode} |
| 233 |
% |
| 234 |
% ^^A ----------------------------- |
| 235 |
% |
| 236 |
% \subsection{The macros} |
| 237 |
% ^^A |
| 238 |
% \begin{macro}{\bibprefix} |
| 239 |
% \cs{bibprefix} defines the prefix for all references henceforce. |
| 240 |
% \begin{macrocode} |
| 241 |
\newcommand{\bibprefix}{} |
| 242 |
% \end{macrocode} |
| 243 |
% \end{macro} |
| 244 |
% |
| 245 |
% \begin{macro}{\@bibitem} |
| 246 |
% We want to redefine \cs{\@bibitem} to add our prefix. |
| 247 |
% To do this we need to distinguish three cases: the use of the |
| 248 |
% \package{hyperref} package, the use of the \package{babel} package |
| 249 |
% and the default. |
| 250 |
% |
| 251 |
% We handle the \package{hyperref} package by activating our code |
| 252 |
% after \package{hyperref} with the help of \cs{AfterPackage*} from |
| 253 |
% \package{scrlfile}. |
| 254 |
% \changes{v1.10}{2006/10/22}{Handle \package{hyperref}} |
| 255 |
% \begin{macrocode} |
| 256 |
\AfterPackage*{hyperref}{% |
| 257 |
\CheckCommand*{\@bibitem}[1]{% |
| 258 |
\@skiphyperreftrue\H@item\@skiphyperreffalse |
| 259 |
\Hy@raisedlink{% |
| 260 |
\hyper@anchorstart{cite.#1}\relax\hyper@anchorend}% |
| 261 |
\if@filesw |
| 262 |
\begingroup |
| 263 |
\let\protect\noexpand |
| 264 |
\immediate\write\@auxout{% |
| 265 |
\string\bibcite{#1}{% |
| 266 |
\the\value{\@listctr}}% |
| 267 |
}% |
| 268 |
\endgroup |
| 269 |
\fi |
| 270 |
\ignorespaces |
| 271 |
}% |
| 272 |
\renewcommand*{\@bibitem}[1]{% |
| 273 |
\@skiphyperreftrue\H@item\@skiphyperreffalse |
| 274 |
\Hy@raisedlink{% |
| 275 |
\hyper@anchorstart{cite.#1}\relax\hyper@anchorend}% |
| 276 |
\if@filesw |
| 277 |
\begingroup |
| 278 |
\let\protect\noexpand |
| 279 |
\immediate\write\@auxout{% |
| 280 |
\string\bibcite{#1}{% |
| 281 |
\bibprefix\the\value{\@listctr}}% |
| 282 |
}% |
| 283 |
\endgroup |
| 284 |
\fi |
| 285 |
\ignorespaces |
| 286 |
}% |
| 287 |
}% |
| 288 |
% \end{macrocode} |
| 289 |
% |
| 290 |
% If \package{hyperref} is not used, we must distinguish between |
| 291 |
% \package{babel} and the default. \package{babel} saves \cs{@bibitem} |
| 292 |
% as \cs{org@@bibitem}, so we have to redefine that. |
| 293 |
% \changes{v1.10}{2006/10/22}{Handle \package{babel}} |
| 294 |
% \begin{macrocode} |
| 295 |
\@ifpackageloaded{hyperref}{}{% |
| 296 |
\@ifpackageloaded{babel} |
| 297 |
{% |
| 298 |
\CheckCommand*{\org@@bibitem}[1]{% |
| 299 |
\item\if@filesw \immediate\write\@auxout |
| 300 |
{\string\bibcite{#1}{% |
| 301 |
\the\value{\@listctr}}}% |
| 302 |
\fi\ignorespaces |
| 303 |
}% |
| 304 |
\renewcommand*{\org@@bibitem}[1]{% |
| 305 |
\item\if@filesw \immediate\write\@auxout |
| 306 |
{\string\bibcite{#1}{% |
| 307 |
\bibprefix\the\value{\@listctr}}}% |
| 308 |
\fi\ignorespaces |
| 309 |
}% |
| 310 |
}{% |
| 311 |
\CheckCommand*{\@bibitem}[1]{% |
| 312 |
\item\if@filesw \immediate\write\@auxout |
| 313 |
{\string\bibcite{#1}{% |
| 314 |
\the\value{\@listctr}}}% |
| 315 |
\fi\ignorespaces |
| 316 |
}% |
| 317 |
\renewcommand*{\@bibitem}[1]{% |
| 318 |
\item\if@filesw \immediate\write\@auxout |
| 319 |
{\string\bibcite{#1}{% |
| 320 |
\bibprefix\the\value{\@listctr}}}% |
| 321 |
\fi\ignorespaces |
| 322 |
}% |
| 323 |
}% |
| 324 |
} |
| 325 |
% \end{macrocode} |
| 326 |
% \end{macro} |
| 327 |
% |
| 328 |
% \begin{macro}{\@biblabel} |
| 329 |
% We redefine \cs{\@biblabel} to add our prefix. |
| 330 |
% \begin{macrocode} |
| 331 |
\renewcommand*{\@biblabel}[1]{[\bibprefix#1]} |
| 332 |
% \end{macrocode} |
| 333 |
% \end{macro} |
| 334 |
% |
| 335 |
% |
| 336 |
% ^^A ----------------------------- |
| 337 |
% |
| 338 |
% \begin{macrocode} |
| 339 |
%</package> |
| 340 |
% \end{macrocode} |
| 341 |
% \Finale |
| 342 |
% ^^A vim:tw=70:ts=2:et |