| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% =================================================================== |
| 4 |
% splitbib.dtx |
| 5 |
% |
| 6 |
% Nicolas MARKEY <[email protected]> |
| 7 |
% 2005/12/22 |
| 8 |
% v1.17 |
| 9 |
% |
| 10 |
% =================================================================== |
| 11 |
% |
| 12 |
% \charactertable |
| 13 |
% {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 |
| 14 |
% 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 |
| 15 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 16 |
% Exclamation \! Double quote \" Hash (number) \# |
| 17 |
% Dollar \$ Percent \% Ampersand \& |
| 18 |
% Acute accent \' Left paren \( Right paren \) |
| 19 |
% Asterisk \* Plus \+ Comma \, |
| 20 |
% Minus \- Point \. Solidus \/ |
| 21 |
% Colon \: Semicolon \; Less than \< |
| 22 |
% Equals \= Greater than \> Question mark \? |
| 23 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 24 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 25 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 26 |
% Right brace \} Tilde \~} |
| 27 |
% |
| 28 |
% |
| 29 |
% This file is built for \LaTeXe, so we make sure an error is |
| 30 |
% generated when it is used with another format |
| 31 |
% \begin{macrocode} |
| 32 |
%<+package>\NeedsTeXFormat{LaTeX2e} |
| 33 |
% \end{macrocode} |
| 34 |
% |
| 35 |
% Now announce the package name and version: |
| 36 |
% \begin{macrocode} |
| 37 |
%<*dtx> |
| 38 |
\ProvidesFile{splitbib.dtx} |
| 39 |
%</dtx> |
| 40 |
%<+package>\ProvidesPackage{splitbib} |
| 41 |
[2005/12/22 v1.17 Splits bibliography into categories] |
| 42 |
% \end{macrocode} |
| 43 |
% |
| 44 |
% |
| 45 |
% \begin{macrocode} |
| 46 |
%<*driver> |
| 47 |
\documentclass{ltxdoc} |
| 48 |
\usepackage{boxedminipage} |
| 49 |
\usepackage{splitbib} |
| 50 |
\usepackage[dvips]{graphicx} |
| 51 |
% \end{macrocode} |
| 52 |
% We do want an index, using linenumbers |
| 53 |
% \begin{macrocode} |
| 54 |
\CheckSum{1860} |
| 55 |
\StopEventually{} |
| 56 |
\EnableCrossrefs |
| 57 |
\CodelineIndex |
| 58 |
\DoNotIndex{\begin,\begingroup,\endgroup,\framebox,\fboxsep,\hbox,\long} |
| 59 |
\DoNotIndex{\newif} |
| 60 |
\DoNotIndex{\gdef,\@arabic,\@empty,\@firstofone,\@for,\@ifundefined,\@tempa,\@tempb} |
| 61 |
\DoNotIndex{\@tempboxa,\addtocounter,\advance,\baselineskip,\bfseries,\bigskip} |
| 62 |
\DoNotIndex{\chapter,\csname,\def,\do,\edef,\end,\endcsname,\endlist,\expandafter} |
| 63 |
\DoNotIndex{\ifx,\else,\fi,\ifdim,\ifnum,\ifx,\fi,\fi,\fi} |
| 64 |
\DoNotIndex{\gdef,\hfill,\hskip,\ignorespaces,\immediate,\Large,\let,\list,% |
| 65 |
\medskip,\message,\newcounter,\newdimen,\noindent,\null,\par,\relax,% |
| 66 |
\renewcommand,\setbox,\setcounter,\setlength,\settowidth,\smallskip,\stepcounter,% |
| 67 |
\string,\textwidth,\the,\unskip,\value,\vspace,\vskip,\vrule,\vbox,\wd,\xdef} |
| 68 |
% \end{macrocode} |
| 69 |
% |
| 70 |
% \begin{macrocode} |
| 71 |
\def\package#1{\texttt{#1.sty}} |
| 72 |
\def\cmpt#1{\texttt{#1}} |
| 73 |
\def\ext#1{\texttt{.#1}} |
| 74 |
\def\env#1{\texttt{#1}} |
| 75 |
\def\news#1{\textsf{#1}} |
| 76 |
\def\btcmd#1{\texttt{#1\$}} |
| 77 |
\begin{document} |
| 78 |
\DocInput{splitbib.dtx} |
| 79 |
\end{document} |
| 80 |
%</driver> |
| 81 |
% \end{macrocode} |
| 82 |
% \fi |
| 83 |
% \GetFileInfo{splitbib.dtx} |
| 84 |
% |
| 85 |
% \changes{0.99}{2004/06/18}{First release candidate} |
| 86 |
% \changes{0.99b}{2004/06/29}{Added \cmd\SBalias} |
| 87 |
% \changes{0.99c}{2004/06/30}{Added strict option + |
| 88 |
% multiple category management} |
| 89 |
% \changes{0.99d}{2004/07/04}{Added reorder option} |
| 90 |
% \changes{1.00}{2004/07/21}{Added the "export" option + |
| 91 |
% comment management + |
| 92 |
% published on CTAN} |
| 93 |
% \changes{1.10}{2004/08/14}{Protect arguments against |
| 94 |
% expansion when exporting} |
| 95 |
% \changes{1.11}{2005/02/22}{\string\NMSB@currprefix was also |
| 96 |
% not expanded in v1.10. This led to |
| 97 |
% wrong references when extra prefixes |
| 98 |
% were used.} |
| 99 |
% \changes{1.12}{2005/02/25}{} |
| 100 |
% \changes{1.13}{2005/08/16}{} |
| 101 |
% \changes{1.14}{2005/11/26}{[export] doesn't export the number |
| 102 |
% if it will be computed correctly.} |
| 103 |
% \changes{1.15}{2005/11/27}{fix a bug in option reorder} |
| 104 |
% \changes{1.16}{2005/12/12}{fix a stupid bug in previous version} |
| 105 |
% \changes{1.17}{2005/12/22}{fix another bug related to reorder, |
| 106 |
% fix a bug with label prefixes} |
| 107 |
% |
| 108 |
% |
| 109 |
% \title{Split your bibliography into categories |
| 110 |
% \thanks{This file has version number \fileversion, |
| 111 |
% last revised \filedate.}} |
| 112 |
% |
| 113 |
% \author{ Nicolas Markey \\ |
| 114 |
% \texttt{[email protected]}} |
| 115 |
% |
| 116 |
% \date{\today} |
| 117 |
% |
| 118 |
% \maketitle |
| 119 |
% |
| 120 |
% \begin{abstract} |
| 121 |
% This package allows for sorting a bibliography into categories and |
| 122 |
% subcategories. This is interesting for lists of publications, for |
| 123 |
% grouping references by subject, by year,~... An option allows to export |
| 124 |
% the resulting bibliography as a \ext{bbl}~like file. |
| 125 |
% \end{abstract} |
| 126 |
% |
| 127 |
% \section{Introduction} |
| 128 |
% |
| 129 |
% Up to now, there exists several ways for sorting bibliographic references |
| 130 |
% into categories: |
| 131 |
% \begin{itemize} |
| 132 |
% \item Using a bibliographic style allowing it. |
| 133 |
% There exists a few such styles, but then you'll need to add a |
| 134 |
% "category" field in each entry of your \ext{bib}~file. |
| 135 |
% Moreover, grouping criteria might change from one document to the |
| 136 |
% other, and modifying categories requires that you modify your |
| 137 |
% \ext{bib}~file, which is a long and tedious task; |
| 138 |
% \item \package{multibib}, by Thorsten Hansen, allows to create several |
| 139 |
% bibliographies, by defining several \cmd\cite{} commands. This however |
| 140 |
% has several limitations: Duplicate labels, risk of citing one reference |
| 141 |
% in two different categories,~... |
| 142 |
% \item Typesetting the bibliography by hand, which should eventually give |
| 143 |
% you exactly what you want, if you're patient enough... |
| 144 |
% \end{itemize} |
| 145 |
% |
| 146 |
% \package{splitbib} offers a new, original way of doing this with \LaTeX. |
| 147 |
% It uses a \env{category} environment for defining categories. Up to two |
| 148 |
% such environments can be nested. Those environments take one mandatory |
| 149 |
% argument defining the "title" of the category. Within a category, command |
| 150 |
% \cmd\SBentries{} defines the entries that should appear in that category. |
| 151 |
% With the \texttt{reorder} option, this will also define the order in |
| 152 |
% which references should appear (the default is to keep the order of the |
| 153 |
% original \ext{bbl}~file within each (sub)category). |
| 154 |
% |
| 155 |
% Then, when a reference appears in a \env{thebibliography} environment, |
| 156 |
% it is moved in its category. A warning may be echoed in case a reference |
| 157 |
% appears in two categories. On the contrary, if a reference has not been |
| 158 |
% assigned a category, it is put in a ``miscellaneous'' category. |
| 159 |
% |
| 160 |
% \section{How does it work?} |
| 161 |
% |
| 162 |
% \subsection{Once upon a time...} |
| 163 |
% |
| 164 |
% The starting point of this package is a selection sorting algorithm |
| 165 |
% initially proposed |
| 166 |
% by Josselin Noirel on \news{fr.comp.text.tex}, and that I made more |
| 167 |
% performant |
| 168 |
% by using a quicksort algorithm. A discussion followed about the |
| 169 |
% usefulness of such a command... |
| 170 |
% |
| 171 |
% \subsection{The link between sorting and categories} |
| 172 |
% |
| 173 |
% As mentionned previously, some bibliographic styles handle categories. This |
| 174 |
% is achieved by adding a prefix to the \btcmd{sort.key} string used by |
| 175 |
% Bib\TeX{} for sorting bibliographic items. We use the same idea here, using |
| 176 |
% a numeric value for each category. Another numeric value is appended to the |
| 177 |
% category entry, in order to keep the initial order within each category. |
| 178 |
% |
| 179 |
% \subsection{In practice} |
| 180 |
% |
| 181 |
% Defining categories is achieved with a \env{category} environment. |
| 182 |
% The argument of this environment defines the title of that new category. |
| 183 |
% An optional argument allows to define a prefix for the labels of each entry |
| 184 |
% in that category. |
| 185 |
% |
| 186 |
% Within a category, the \cmd\SBentries~command defines which entries should |
| 187 |
% appear in that category. It is a comma-separated list of internal keys. |
| 188 |
% |
| 189 |
% Everything else should be transparent for the user. Several important |
| 190 |
% remarks though: |
| 191 |
% \begin{itemize} |
| 192 |
% \item \package{splitbib} redefines \cmd\bibitem{} and the |
| 193 |
% \env{thebibliography} environment. More precisely, |
| 194 |
% \cmd\begin\marg{thebibliography} does almost nothing, \cmd\bibitem~just |
| 195 |
% stores the references (but echoes nothing), and |
| 196 |
% \cmd\end\marg{thebibliography} sorts and outputs the bibliography. |
| 197 |
% \item Since this package deeply redefines \cmd\bibitem{} and the |
| 198 |
% \env{thebibliography} environment, it must be loaded \emph{after} |
| 199 |
% packages that redefine those commands. In particular \package{apalike}, |
| 200 |
% \package{natbib} or \package{jurabib}; |
| 201 |
% \item \package{natbib} and \package{jurabib} use very special formats |
| 202 |
% for the optional argument |
| 203 |
% of \cmd\bibitem. In order to fully use their features, you should load |
| 204 |
% \package{splitbib} with the \texttt{export} argument, so that their original |
| 205 |
% definitions of \cmd\bibitem{} will be used when processing the bibliography. |
| 206 |
% Globally speaking, the \texttt{export} option should make \package{splitbib} |
| 207 |
% compatible with many type of bibliography; |
| 208 |
% \item Since |
| 209 |
% it is possible to add a prefix to reference labels, the argument of the |
| 210 |
% \env{thebibliography} environment is irrelevant. Therefore, the longest |
| 211 |
% label will be re-computed, or can be forced; |
| 212 |
% \item Last, several styles for |
| 213 |
% category titles are predefined, but you can define your own style |
| 214 |
% by redefining \cmd\SBtitle~and \cmd\SBsubtitle. |
| 215 |
% \end{itemize} |
| 216 |
% |
| 217 |
% \subsection{An example} |
| 218 |
% |
| 219 |
% An example is shown on figure~\ref{example}. It contains the basic commands |
| 220 |
% for a simple use of \package{splitbib}. |
| 221 |
% |
| 222 |
% \begin{figure}[!htp] |
| 223 |
% \noindent\begin{boxedminipage}{\textwidth} |
| 224 |
% \def\MacroFont{\fontsize{7pt}{8pt}\selectfont\ttfamily} |
| 225 |
% \begin{minipage}[t]{.45\linewidth} |
| 226 |
% \begin{verbatim} |
| 227 |
% \documentclass{article} |
| 228 |
% \usepackage{splitbib} |
| 229 |
% |
| 230 |
% \begin{category}[A]{First category} |
| 231 |
% \SBentries{entry1,entry4} |
| 232 |
% \end{category} |
| 233 |
% \begin{category}[B]{Second category} |
| 234 |
% \begin{category}{First sub-category} |
| 235 |
% \SBentries{entry2,entry6} |
| 236 |
% \end{category} |
| 237 |
% \begin{category}{Second sub-category} |
| 238 |
% \SBentries{entry5,entry3} |
| 239 |
% \end{category} |
| 240 |
% \end{category} |
| 241 |
% |
| 242 |
% \begin{document} |
| 243 |
% We cite~\cite{entry1,entry3,entry4,% |
| 244 |
% entry5}. Note that we cite neither |
| 245 |
% \verb+entry2+ nor \verb+entry6+, |
| 246 |
% even though they have been assigned |
| 247 |
% a category. |
| 248 |
% \end{verbatim} |
| 249 |
% \end{minipage} |
| 250 |
% \hfil\vrule\hfil |
| 251 |
% \begin{minipage}[t]{.45\linewidth} |
| 252 |
% \begin{verbatim} |
| 253 |
% defined in the last category. The first |
| 254 |
% sub-category will then not appear in the |
| 255 |
% bibliography. |
| 256 |
% |
| 257 |
% % \def\SBlongestlabel{A1} |
| 258 |
% \SBtitlestyle{bar} |
| 259 |
% \SBsubtitlestyle{none} |
| 260 |
% \begin{thebibliography}{1} |
| 261 |
% \bibitem{entry1} This is the first entry. |
| 262 |
% |
| 263 |
% \bibitem{entry3} This is the third entry. |
| 264 |
% |
| 265 |
% \bibitem{entry4} This is the fourth one. |
| 266 |
% |
| 267 |
% \bibitem{entry5} This is the last one. |
| 268 |
% |
| 269 |
% \end{thebibliography} |
| 270 |
% \end{document} |
| 271 |
% \end{verbatim} |
| 272 |
% \end{minipage} |
| 273 |
% \end{boxedminipage} |
| 274 |
% \vskip5mm |
| 275 |
% |
| 276 |
% \noindent\begin{boxedminipage}{\linewidth} |
| 277 |
% \vskip5mm |
| 278 |
% \centering\begin{minipage}{.7\linewidth} |
| 279 |
% \begin{category}[A]{First category} |
| 280 |
% \SBentries{entry1,entry4} |
| 281 |
% \end{category} |
| 282 |
% \begin{category}[B]{Second category} |
| 283 |
% \begin{category}{First sub-category} |
| 284 |
% \SBentries{entry2,entry6} |
| 285 |
% \end{category} |
| 286 |
% \begin{category}{Second sub-category} |
| 287 |
% \SBentries{entry5,entry3} |
| 288 |
% \end{category} |
| 289 |
% \end{category} |
| 290 |
% |
| 291 |
% \fontsize{7pt}{8pt}\selectfont |
| 292 |
% We cite~\cite{entry1,entry3,entry4,entry5}. |
| 293 |
% Note that we cite neither \texttt{entry2} nor |
| 294 |
% \texttt{entry6}, even though they have been |
| 295 |
% defined in the last category. The first |
| 296 |
% sub-category will then not appear in the |
| 297 |
% bibliography. |
| 298 |
% |
| 299 |
% % \def\SBlongestlabel{A1} |
| 300 |
% \SBtitlestyle{bar} |
| 301 |
% \SBsubtitlestyle{none} |
| 302 |
% \begin{thebibliography}{1} |
| 303 |
% \bibitem{entry1} This is the first entry. |
| 304 |
% |
| 305 |
% \bibitem{entry3} This is the third entry. |
| 306 |
% |
| 307 |
% \bibitem{entry4} This is the fourth one. |
| 308 |
% |
| 309 |
% \bibitem{entry5} This is the last one. |
| 310 |
% |
| 311 |
% \end{thebibliography} |
| 312 |
% \end{minipage} |
| 313 |
% \vskip5mm\par\vbox{} |
| 314 |
% \end{boxedminipage} |
| 315 |
% \caption{An example using \package{splitbib}}\label{example} |
| 316 |
% \end{figure} |
| 317 |
% |
| 318 |
% |
| 319 |
% |
| 320 |
% \newpage |
| 321 |
% \section{The code} |
| 322 |
% \begin{macro}{\ifNMSB@strict} |
| 323 |
% \begin{macro}{strict} |
| 324 |
% \begin{macro}{nonstrict} |
| 325 |
% \begin{macro}{\ifNMSB@ownorder} |
| 326 |
% \begin{macro}{reorder} |
| 327 |
% \begin{macro}{keeporder} |
| 328 |
% \begin{macro}{\ifNMSB@export} |
| 329 |
% \begin{macro}{export} |
| 330 |
% \begin{macro}{noexport} |
| 331 |
% \begin{macro}{\ifNMSB@newchap} |
| 332 |
% \begin{macro}{newchap} |
| 333 |
% \begin{macro}{newsec} |
| 334 |
% \begin{macro}{nonewchap} |
| 335 |
% \begin{macro}{nonewsec} |
| 336 |
% \package{splitbib} understands four options: \begin{itemize} |
| 337 |
% \item \texttt{nonstrict} is to disallow multiple categories for one entry. |
| 338 |
% Default is to |
| 339 |
% allow it: In that case, \package{splitbib} won't complain, but \LaTeX{} |
| 340 |
% will find multiply defined labels. In the other case, if an entry is |
| 341 |
% declared in several categories, only the first one will be used, and |
| 342 |
% \package{splitbib} will warn you about the problem. |
| 343 |
% \item \texttt{reorder} tells \package{splitbib} to use the order the entries |
| 344 |
% appear in the \cmd\SBentries\ as the output order. The default is to |
| 345 |
% keep the order the references appear in the \ext{bib}~file within each |
| 346 |
% (sub)categories. With \texttt{reorder}, entries that have no category |
| 347 |
% will be omitted. |
| 348 |
% \item\texttt{export} will export the new \env{thebibliography} environment |
| 349 |
% into an \ext{sbb}~file, similar to the \ext{bbl}~file, but with |
| 350 |
% categories. The default is not to create that file, but you should consider |
| 351 |
% adding this option if you encounter compilation problems. |
| 352 |
% \item\texttt{nonewchap} and \texttt{nonewsec} prevent \env{thebibliography} |
| 353 |
% to start a new chapter or section. |
| 354 |
% \end{itemize} |
| 355 |
% \begin{macrocode} |
| 356 |
\newif\ifNMSB@strict\NMSB@strictfalse |
| 357 |
\DeclareOption{strict}{\NMSB@stricttrue} |
| 358 |
\DeclareOption{nonstrict}{\NMSB@strictfalse} |
| 359 |
\newif\ifNMSB@ownorder\NMSB@ownorderfalse |
| 360 |
\DeclareOption{reorder}{\NMSB@ownordertrue} |
| 361 |
\DeclareOption{keeporder}{\NMSB@ownorderfalse} |
| 362 |
\newif\ifNMSB@export\NMSB@exportfalse |
| 363 |
\DeclareOption{export}{\NMSB@exporttrue} |
| 364 |
\DeclareOption{noexport}{\NMSB@exportfalse} |
| 365 |
\newif\ifNMSB@newchap\NMSB@newchaptrue |
| 366 |
\DeclareOption{newchap}{\NMSB@newchaptrue} |
| 367 |
\DeclareOption{newsec}{\NMSB@newchaptrue} |
| 368 |
\DeclareOption{nonewchap}{\NMSB@newchapfalse} |
| 369 |
\DeclareOption{nonewsec}{\NMSB@newchapfalse} |
| 370 |
\ProcessOptions* |
| 371 |
% \end{macrocode} |
| 372 |
% \end{macro} |
| 373 |
% \end{macro} |
| 374 |
% \end{macro} |
| 375 |
% \end{macro} |
| 376 |
% \end{macro} |
| 377 |
% \end{macro} |
| 378 |
% \end{macro} |
| 379 |
% \end{macro} |
| 380 |
% \end{macro} |
| 381 |
% \end{macro} |
| 382 |
% \end{macro} |
| 383 |
% \end{macro} |
| 384 |
% \end{macro} |
| 385 |
% \end{macro} |
| 386 |
% \begin{macro}{NMSB@catlevelone} |
| 387 |
% \begin{macro}{NMSB@catleveltwo} |
| 388 |
% These two counters are used for numbering categories. Their initial value is |
| 389 |
% set to~$10$ here. We require that the category number always has two digits, |
| 390 |
% because it is important to ensure that the sorting number we will generate |
| 391 |
% all have the same number of digits (because the~11th entry in the first |
| 392 |
% category should be numberred differently from the 1st entry in the~11th |
| 393 |
% category). The definition below allows up to 89~categories (in fact, 90, but |
| 394 |
% one is reserved as the "misc" category), and $89\times |
| 395 |
% 89$ subcategories, which should be |
| 396 |
% sufficient. It this is not, be aware that modifying the values below is not |
| 397 |
% sufficient, and that several other values has to be updated. |
| 398 |
% \begin{macrocode} |
| 399 |
\newcounter{NMSB@catlevelone} |
| 400 |
\newcounter{NMSB@catleveltwo} |
| 401 |
\setcounter{NMSB@catlevelone}{10} |
| 402 |
\setcounter{NMSB@catleveltwo}{10} |
| 403 |
% \end{macrocode} |
| 404 |
% \end{macro} |
| 405 |
% \end{macro} |
| 406 |
% \begin{macro}{NMSB@catlevel} |
| 407 |
% This counter counts the nesting depth of categories. This depth is |
| 408 |
% limited to~$2$, and nesting $3$~categories raises an error. |
| 409 |
% \begin{macrocode} |
| 410 |
\newcounter{NMSB@catlevel} |
| 411 |
\setcounter{NMSB@catlevel}{0} |
| 412 |
% \end{macrocode} |
| 413 |
% \end{macro} |
| 414 |
% \begin{macro}{SBresetdepth} |
| 415 |
% When using numerical labels, this defines when the label counter |
| 416 |
% has to be reset. $0$ means "never", $1$ means "at each new level-$1$ |
| 417 |
% category", and $2$ means "at each new category". |
| 418 |
% \begin{macrocode} |
| 419 |
\newcounter{SBresetdepth} |
| 420 |
\setcounter{SBresetdepth}{0} |
| 421 |
% \end{macrocode} |
| 422 |
% \end{macro} |
| 423 |
% \begin{macro}{NMSB@ent} |
| 424 |
% \begin{macro}{NMSB@maxent} |
| 425 |
% \begin{macro}{\NMSB@initent} |
| 426 |
% \begin{macro}{NMSB@tok} |
| 427 |
% \cmpt{NMSB@ent} will be the number of the current entry. \cmpt{NMSB@maxent} |
| 428 |
% is the |
| 429 |
% max value, computed from the initial value {\makeatletter\cmd\NMSB@initent} |
| 430 |
% in order to |
| 431 |
% always have the same number of digits. Here, we allow up to 900 entries per |
| 432 |
% category or subcategory. If you \emph{really} need more, you'll probably |
| 433 |
% also have to modify the memory limits of \LaTeX{} anyway. However, as regards |
| 434 |
% \package{splitbib}, this can be achieved by simply replacing "100" below by, |
| 435 |
% say, "1000". |
| 436 |
% {\makeatletter\cmd\NMSB@tok}~is a token that will be used to protect commands against expansion. |
| 437 |
% \begin{macrocode} |
| 438 |
\newcounter{NMSB@ent} |
| 439 |
\newcounter{NMSB@maxent} |
| 440 |
\def\NMSB@initent{100} |
| 441 |
\newtoks\NMSB@tok |
| 442 |
\setcounter{NMSB@maxent}{\NMSB@initent0} |
| 443 |
\addtocounter{NMSB@maxent}{-1} |
| 444 |
\setcounter{NMSB@ent}{\NMSB@initent} |
| 445 |
% \end{macrocode} |
| 446 |
% \end{macro} |
| 447 |
% \end{macro} |
| 448 |
% \end{macro} |
| 449 |
% \end{macro} |
| 450 |
% \begin{macro}{\NMSB@longest} |
| 451 |
% \begin{macro}{\NMSB@reallylongest} |
| 452 |
% \begin{macro}{\NMSB@reallylongestlabel} |
| 453 |
% Those variables are used when computing the longest label. This is done in |
| 454 |
% two phases: first when reading \cmd\bibitem{}s. It is just an approximation, |
| 455 |
% since we can't know numeric labels at that time. Exact computation is done |
| 456 |
% at a second time, |
| 457 |
% when writing bibliographic references. This second computation uses |
| 458 |
% {\makeatletter\cmd\NMSB@reallylongest and \cmd\NMSB@reallylongestlabel}. |
| 459 |
% \begin{macrocode} |
| 460 |
\newdimen\NMSB@longest |
| 461 |
\newdimen\NMSB@reallylongest |
| 462 |
\setlength{\NMSB@longest}{0pt} |
| 463 |
\setlength{\NMSB@reallylongest}{0pt} |
| 464 |
\def\NMSB@reallylongestlabel{} |
| 465 |
% \end{macrocode} |
| 466 |
% \end{macro} |
| 467 |
% \end{macro} |
| 468 |
% \end{macro} |
| 469 |
% \begin{macro}{\NMSBtitle@99} |
| 470 |
% \begin{macro}{\NMSBprefix@9999} |
| 471 |
% \begin{macro}{\NMSB@currprefixtok} |
| 472 |
% \begin{macro}{\NMSB@currprefixlevelonetok} |
| 473 |
% \begin{macro}{\SBmisctitle} |
| 474 |
% \begin{macro}{\SBmiscprefix} |
| 475 |
% Some macros for handling titles and prefix. "Misc" commands will be used |
| 476 |
% for bibliographic entries whose category has not been defined. |
| 477 |
% \begin{macrocode} |
| 478 |
\expandafter\def\csname NMSBtitle@99\endcsname{\SBmisctitle} |
| 479 |
\expandafter\def\csname NMSBprefix@9999\endcsname{\SBmiscprefix} |
| 480 |
\def\SBmisctitle{Miscellaneous} |
| 481 |
\def\SBmiscprefix{} |
| 482 |
\newtoks\NMSB@currprefixtok |
| 483 |
\newtoks\NMSB@currprefixlevelonetok |
| 484 |
% \end{macrocode} |
| 485 |
% \end{macro} |
| 486 |
% \end{macro} |
| 487 |
% \end{macro} |
| 488 |
% \end{macro} |
| 489 |
% \end{macro} |
| 490 |
% \end{macro} |
| 491 |
% \begin{macro}{\NMSB@prevcat} |
| 492 |
% \begin{macro}{\NMSB@prevcatlevelone} |
| 493 |
% Those commands will be used for detecting category changes. |
| 494 |
% \begin{macrocode} |
| 495 |
\def\NMSB@prevcat{0} |
| 496 |
\def\NMSB@prevcatlevelone{0} |
| 497 |
% \end{macrocode} |
| 498 |
% \end{macro} |
| 499 |
% \end{macro} |
| 500 |
% \begin{macro}{\NMSB@missingcat} |
| 501 |
% \begin{macro}{\NMSB@doublecat} |
| 502 |
% Those two commands will contain entries that are \cmd\cite{}d but have not |
| 503 |
% category, or that have two categories, resp. |
| 504 |
% \begin{macrocode} |
| 505 |
\def\NMSB@missingcat{} |
| 506 |
\def\NMSB@doublecat{} |
| 507 |
% \end{macrocode} |
| 508 |
% \end{macro} |
| 509 |
% \end{macro} |
| 510 |
% \begin{macro}{\NMSB@valuelist} |
| 511 |
% The list of entries that appear in \cmd\SBentries, and that will be sorted. |
| 512 |
% \begin{macrocode} |
| 513 |
\let\NMSB@valuelist\relax |
| 514 |
% \end{macrocode} |
| 515 |
% \end{macro} |
| 516 |
% \begin{macro}{\SBabovesepwidth} |
| 517 |
% \begin{macro}{\SBbelowsepwidth} |
| 518 |
% Width of lines for the ``rules'' style. |
| 519 |
% \begin{macrocode} |
| 520 |
\newdimen\SBabovesepwidth |
| 521 |
\newdimen\SBbelowsepwidth |
| 522 |
\setlength{\SBabovesepwidth}{.4pt} |
| 523 |
\setlength{\SBbelowsepwidth}{.4pt} |
| 524 |
% \end{macrocode} |
| 525 |
% \end{macro} |
| 526 |
% \end{macro} |
| 527 |
% \begin{macro}{\NMSB@penalty} |
| 528 |
% \begin{macro}{\NMSB@halfpenalty} |
| 529 |
% Penalties inserted after category titles, in order to avoid lonely titles at |
| 530 |
% bottom of pages. |
| 531 |
% \begin{macrocode} |
| 532 |
\def\NMSB@penalty{5000} |
| 533 |
\def\NMSB@halfpenalty{500} |
| 534 |
% \end{macrocode} |
| 535 |
% \end{macro} |
| 536 |
% \end{macro} |
| 537 |
% \begin{macro}{\NMSB@warnnocateg} |
| 538 |
% \begin{macro}{\NMSB@warndblcateg} |
| 539 |
% \begin{macro}{\NMSB@warnwronglongest} |
| 540 |
% \begin{macro}{\NMSB@errtoomanycat} |
| 541 |
% \begin{macro}{\NMSB@errtoomanyent} |
| 542 |
% \begin{macro}{\NMSB@errcattoodepp} |
| 543 |
% \begin{macro}{\NMSB@errentriesoutsidecat} |
| 544 |
% \begin{macro}{\NMSB@errentrieswithoptinsidecat} |
| 545 |
% \begin{macro}{\NMSB@erraliasoutsidecat} |
| 546 |
% \begin{macro}{\NMSB@erraliasalreadydef} |
| 547 |
% \begin{macro}{\NMSB@erraliasundefined} |
| 548 |
% Errors or warning... Names should be explicit. |
| 549 |
% \begin{macrocode} |
| 550 |
\def\NMSB@warnnocateg#1,\end{% |
| 551 |
\message{---- Splitbib warning ----^^J% |
| 552 |
-- The following bib entries have no category: #1^^J}} |
| 553 |
\def\NMSB@warndblcateg#1,\end{% |
| 554 |
\message{---- Splitbib warning ----^^J% |
| 555 |
-- The following bib entries have several categories: #1^^J% |
| 556 |
-- The first one will be used.^^J}} |
| 557 |
\def\NMSB@warnwronglongest{% |
| 558 |
\expandafter\NMSB@tok\expandafter{\NMSB@reallylongestlabel} |
| 559 |
\message{---- Splitbib warning ----^^J% |
| 560 |
-- The longest label appears to be [\the\NMSB@tok] |
| 561 |
instead of} |
| 562 |
\@ifundefined{SBlongestlabel}{}{\message{(forced)}} |
| 563 |
\expandafter\NMSB@tok\expandafter{\NMSB@longestlabel} |
| 564 |
\message{[\the\NMSB@tok]^^J}} |
| 565 |
\def\NMSB@errtoomanycat#1{% |
| 566 |
\message{---- Splitbib error ----^^J% |
| 567 |
-- You defined too many level-#1 categories (max = 89).^^J}} |
| 568 |
\def\NMSB@errtoomanyent{% |
| 569 |
\setcounter{NMSB@maxent}{\NMSB@initent0} |
| 570 |
\addtocounter{NMSB@maxent}{-\NMSB@initent} |
| 571 |
\message{---- Splitbib error ----^^J% |
| 572 |
-- You defined too many entries in one category % |
| 573 |
(max = \theNMSB@maxent)^^J}} |
| 574 |
\def\NMSB@errcattoodeep{% |
| 575 |
\message{---- Splitbib error ----^^J |
| 576 |
-- Only two category depth allowed.^^J}} |
| 577 |
\def\NMSB@errentriesoutsidecat{% |
| 578 |
\message{---- Splitbib error ----^^J |
| 579 |
-- \string\SBentries outside category environment.^^J}} |
| 580 |
\def\NMSB@errentrieswithoptinsidecat{% |
| 581 |
\message{----Splitbib error ----^^J |
| 582 |
-- \string\SBentries with optional argument inside category env.^^J}} |
| 583 |
\def\NMSB@erraliasoutsidecat{% |
| 584 |
\message{----Splitbib error ----^^J |
| 585 |
-- \string\SBalias used outside category environment.^^J}} |
| 586 |
\def\NMSB@erraliasalreadydef#1{% |
| 587 |
\message{----Splitbib error ----^^J |
| 588 |
-- Alias #1 multiply defined.^^J}} |
| 589 |
\def\NMSB@erraliasundefined#1{% |
| 590 |
\message{----Splitbib error ----^^J |
| 591 |
-- Alias #1 undefined.^^J}} |
| 592 |
\def\NMSB@errcommentoutsidecat{% |
| 593 |
\message{----Splitbib error ----^^J |
| 594 |
-- \string\SBcomment used outside category environment.^^J}} |
| 595 |
% \end{macrocode} |
| 596 |
% \end{macro} |
| 597 |
% \end{macro} |
| 598 |
% \end{macro} |
| 599 |
% \end{macro} |
| 600 |
% \end{macro} |
| 601 |
% \end{macro} |
| 602 |
% \end{macro} |
| 603 |
% \end{macro} |
| 604 |
% \end{macro} |
| 605 |
% \end{macro} |
| 606 |
% \end{macro} |
| 607 |
% \begin{macro}{\SBtitle} |
| 608 |
% \begin{macro}{\SBsubtitle} |
| 609 |
% \begin{macro}{\SBtitlestyle} |
| 610 |
% \begin{macro}{\SBsubtitlestyle} |
| 611 |
% \begin{macro}{\NMSB@titlestyle} |
| 612 |
% \begin{macro}{\NMSB@subtitlestyle} |
| 613 |
% \begin{macro}{\SBtitlefont} |
| 614 |
% \begin{macro}{\SBsubtitlefont} |
| 615 |
% \begin{macro}{\NMSB@stylebox} |
| 616 |
% \begin{macro}{\NMSB@stylebar} |
| 617 |
% \begin{macro}{\NMSB@styledash} |
| 618 |
% \begin{macro}{\NMSB@stylenone} |
| 619 |
% \begin{macro}{\NMSB@stylesimple} |
| 620 |
% Macros for (sub)title styles. The arguments are the numbers of the category |
| 621 |
% and subcategory. Of course, it is also possible to add titles in the |
| 622 |
% headers, in the table of contents,~... |
| 623 |
% \begin{macrocode} |
| 624 |
\def\SBtitlestyle#1{\gdef\NMSB@titlestyle{#1}} |
| 625 |
\def\SBsubtitlestyle#1{\gdef\NMSB@subtitlestyle{#1}} |
| 626 |
\def\NMSB@titlestyle{bar} |
| 627 |
\def\NMSB@subtitlestyle{dash} |
| 628 |
\def\SBtitle#1{\def\NMSB@level{title}% |
| 629 |
\csname NMSB@style\NMSB@titlestyle\endcsname{}{#1}} |
| 630 |
\def\SBsubtitle#1#2{\def\NMSB@level{subtitle}% |
| 631 |
\csname NMSB@style\NMSB@subtitlestyle\endcsname{}{#2}} |
| 632 |
\def\SBtitlefont#1{{\bfseries\Large #1}} |
| 633 |
\def\SBsubtitlefont#1{{\bfseries #1}} |
| 634 |
\def\NMSB@stylebox#1#2{\hskip-\leftmargin% |
| 635 |
\vbox{% |
| 636 |
\medskip\par |
| 637 |
{\null\hfill |
| 638 |
\setlength\fboxsep{\baselineskip}% |
| 639 |
\framebox[\textwidth]{% |
| 640 |
\csname SB\NMSB@level font\endcsname{#1#2}}% |
| 641 |
\hfill\null}}% |
| 642 |
\bigskip} |
| 643 |
\def\NMSB@stylebar#1#2{\hskip-\leftmargin% |
| 644 |
\vbox{% |
| 645 |
\medskip\par |
| 646 |
\vrule height \SBabovesepwidth depth 0pt width \textwidth |
| 647 |
\vskip.3\baselineskip\par\noindent |
| 648 |
{\null\hfill |
| 649 |
\csname SB\NMSB@level font\endcsname{#1#2}% |
| 650 |
\hfill\null}% |
| 651 |
\vskip-.4\baselineskip\par\noindent |
| 652 |
\vrule height \SBbelowsepwidth depth 0pt width \textwidth}} |
| 653 |
\def\NMSB@styledash#1#2{\unskip\hskip-\leftmargin% |
| 654 |
\vbox{% |
| 655 |
\smallskip\noindent |
| 656 |
{\null\hfill |
| 657 |
\csname SB\NMSB@level font\endcsname{---~#1#2~---}} |
| 658 |
\hfill\null} |
| 659 |
\par} |
| 660 |
\def\NMSB@stylenone#1#2{% |
| 661 |
\vspace{-2\itemsep}\vspace{-\baselineskip}} |
| 662 |
\def\NMSB@stylesimple#1#2{\hskip-\leftmargin% |
| 663 |
\csname SB\NMSB@level font\endcsname{#1#2} |
| 664 |
} |
| 665 |
% \end{macrocode} |
| 666 |
% \end{macro} |
| 667 |
% \end{macro} |
| 668 |
% \end{macro} |
| 669 |
% \end{macro} |
| 670 |
% \end{macro} |
| 671 |
% \end{macro} |
| 672 |
% \end{macro} |
| 673 |
% \end{macro} |
| 674 |
% \end{macro} |
| 675 |
% \end{macro} |
| 676 |
% \end{macro} |
| 677 |
% \end{macro} |
| 678 |
% \end{macro} |
| 679 |
% \begin{macro}{\category} |
| 680 |
% \begin{macro}{\endcategory} |
| 681 |
% \begin{macro}{\NMSB@category} |
| 682 |
% \begin{macro}{\lNMSB@category} |
| 683 |
% Definition of the \env{category} environment. While not too deep, we |
| 684 |
% increase the |
| 685 |
% category number and define the corresponding title and prefix. |
| 686 |
% \begin{macrocode} |
| 687 |
\def\category{\@ifnextchar[{\@lNMSBcategory}{\@lNMSBcategory[]}} |
| 688 |
\def\@lNMSBcategory[#1]#2{% |
| 689 |
\stepcounter{NMSB@catlevel}% |
| 690 |
\ifnum\theNMSB@catlevel>2\relax |
| 691 |
\NMSB@errcattoodeep |
| 692 |
\addtocounter{NMSB@catlevel}{-1}% |
| 693 |
\fi |
| 694 |
\ifnum\theNMSB@catlevel=1\relax |
| 695 |
\ifnum\theNMSB@catlevelone=98\relax |
| 696 |
\NMSB@errtoomanycat{one}% |
| 697 |
\else |
| 698 |
\stepcounter{NMSB@catlevelone}% |
| 699 |
\fi |
| 700 |
\setcounter{NMSB@catleveltwo}{10}% |
| 701 |
\expandafter\gdef\csname NMSBprefix@\theNMSB@catlevelone |
| 702 |
\endcsname{#1}% |
| 703 |
\expandafter\gdef\csname NMSBtitle@\theNMSB@catlevelone |
| 704 |
\endcsname{#2}% |
| 705 |
\else |
| 706 |
\ifnum\theNMSB@catleveltwo=98\relax |
| 707 |
\NMSB@errtoomanycat{two}% |
| 708 |
\else |
| 709 |
\stepcounter{NMSB@catleveltwo}% |
| 710 |
\fi |
| 711 |
\expandafter\let\expandafter\NMSB@tempentry\csname |
| 712 |
NMSBprefix@\theNMSB@catlevelone\endcsname |
| 713 |
\expandafter\NMSB@tok\expandafter{\NMSB@tempentry} |
| 714 |
\expandafter\xdef\csname NMSBprefix@\theNMSB@catlevelone |
| 715 |
\theNMSB@catleveltwo\endcsname{\the\NMSB@tok #1}% |
| 716 |
\expandafter\gdef\csname NMSBtitle@\theNMSB@catlevelone |
| 717 |
\theNMSB@catleveltwo\endcsname{#2}% |
| 718 |
\fi |
| 719 |
} |
| 720 |
\def\@NMSBcategory#1{% |
| 721 |
\stepcounter{NMSB@catlevel} |
| 722 |
\ifnum\theNMSB@catlevel>2\relax |
| 723 |
\NMSB@errcattoodeep |
| 724 |
\addtocounter{NMSB@catlevel}{-1}% |
| 725 |
\fi |
| 726 |
\ifnum\theNMSB@catlevel=1\relax |
| 727 |
\ifnum\theNMSB@catlevelone=98\relax |
| 728 |
\NMSB@errtoomanycat{one}% |
| 729 |
\else |
| 730 |
\stepcounter{NMSB@catlevelone}% |
| 731 |
\fi |
| 732 |
\setcounter{NMSB@catleveltwo}{10} |
| 733 |
\expandafter\gdef\csname NMSBtitle@\theNMSB@catlevelone |
| 734 |
\endcsname{#1}% |
| 735 |
\else |
| 736 |
\ifnum\theNMSB@catleveltwo=98\relax |
| 737 |
\NMSB@errtoomanycat{two}% |
| 738 |
\else |
| 739 |
\stepcounter{NMSB@catleveltwo}% |
| 740 |
\fi |
| 741 |
\expandafter\ifx\csname NMSBprefix@\theNMSB@catlevelone\endcsname |
| 742 |
\relax |
| 743 |
\else |
| 744 |
\expandafter\let\expandafter\NMSB@tempentry\csname |
| 745 |
NMSBprefix@\theNMSB@catlevelone\endcsname |
| 746 |
\expandafter\NMSB@tok\expandafter{\NMSB@tempentry}% |
| 747 |
\expandafter\xdef\csname NMSBprefix@\theNMSB@catlevelone |
| 748 |
\theNMSB@catleveltwo\endcsname{\the\NMSB@tok}% |
| 749 |
\fi |
| 750 |
\expandafter\gdef\csname NMSBtitle@\theNMSB@catlevelone |
| 751 |
\theNMSB@catleveltwo\endcsname{#1}% |
| 752 |
\fi |
| 753 |
} |
| 754 |
\def\endcategory{\addtocounter{NMSB@catlevel}{-1}} |
| 755 |
% \end{macrocode} |
| 756 |
% \end{macro} |
| 757 |
% \end{macro} |
| 758 |
% \end{macro} |
| 759 |
% \end{macro} |
| 760 |
% \begin{macro}{\SBalias} |
| 761 |
% This defines an alias for the category, so that you can add new |
| 762 |
% items in that category afterwards, by using the optional argument of |
| 763 |
% \cmd\SBentries. |
| 764 |
% \begin{macrocode} |
| 765 |
\def\SBalias#1{% |
| 766 |
\ifnum\theNMSB@catlevel<1\relax |
| 767 |
\NMSB@erraliasoutsidecat |
| 768 |
\else |
| 769 |
\expandafter\ifx\csname NMSBalias@#1\endcsname\relax |
| 770 |
\ifnum\theNMSB@catlevel=1\relax |
| 771 |
\expandafter\xdef\csname NMSBalias@#1\endcsname{% |
| 772 |
\theNMSB@catlevelone 10}% |
| 773 |
\else |
| 774 |
\expandafter\xdef\csname NMSBalias@#1\endcsname{% |
| 775 |
\theNMSB@catlevelone\theNMSB@catleveltwo}% |
| 776 |
\fi |
| 777 |
\else |
| 778 |
\NMSB@erraliasalreadydef{#1}% |
| 779 |
\fi |
| 780 |
\fi |
| 781 |
} |
| 782 |
% \end{macrocode} |
| 783 |
% \end{macro} |
| 784 |
% \begin{macro}{\SBcomment} |
| 785 |
% Command \cmd\SBcomment~allows you to put a comment at the beginning of each |
| 786 |
% category. That comment will be put into a \env{minipage} for the moment, but |
| 787 |
% that behavior should depend on the style of titles and subtitles. I'll do |
| 788 |
% that shortly. |
| 789 |
% \begin{macrocode} |
| 790 |
\long\def\SBcomment#1{% |
| 791 |
\ifnum\theNMSB@catlevel<1\relax |
| 792 |
\NMSB@errcommentoutsidecat |
| 793 |
\else |
| 794 |
\ifnum\theNMSB@catlevel=1\relax |
| 795 |
\expandafter\gdef\csname NMSBcomment@\theNMSB@catlevelone |
| 796 |
\endcsname{#1}% |
| 797 |
\else |
| 798 |
\expandafter\gdef\csname NMSBcomment@\theNMSB@catlevelone |
| 799 |
\theNMSB@catleveltwo\endcsname{#1}% |
| 800 |
\fi |
| 801 |
\fi |
| 802 |
} |
| 803 |
% \end{macrocode} |
| 804 |
% \end{macro} |
| 805 |
% \begin{macro}{\SBentries} |
| 806 |
% \begin{macro}{\NMSB@entries@withoptarg} |
| 807 |
% \begin{macro}{\NMSB@entries@incatenv} |
| 808 |
% Command \cmd\SBentries~for defining entries that should appear |
| 809 |
% in that category. It should be either used with an optional argument |
| 810 |
% outside a \env{category}~environment, or without its optional |
| 811 |
% argument inside a \env{category}~environment. |
| 812 |
% \begin{macrocode} |
| 813 |
\def\SBentries{\@ifnextchar[ |
| 814 |
{\NMSB@entries@withoptarg}% |
| 815 |
{\NMSB@entries@incatenv}} |
| 816 |
\def\NMSB@entries@withoptarg[#1]#2{% |
| 817 |
\ifnum\theNMSB@catlevel>0\relax |
| 818 |
\NMSB@errentrieswithoptinsidecat |
| 819 |
\else |
| 820 |
\@for\@citeb:=#2\do{% |
| 821 |
\expandafter\ifx\csname NMSBcateg@\@citeb\endcsname\relax |
| 822 |
\expandafter\ifx\csname NMSBalias@#1\endcsname\relax |
| 823 |
\NMSB@erraliasundefined{#1}% |
| 824 |
\else |
| 825 |
\expandafter\xdef\csname NMSBcateg@\@citeb\endcsname{% |
| 826 |
\csname NMSBalias@#1\endcsname}% |
| 827 |
\ifNMSB@ownorder |
| 828 |
\expandafter\xdef\csname NMSBcateg@\@citeb\endcsname{% |
| 829 |
\csname NMSBcateg@\@citeb\endcsname\theNMSB@ent}% |
| 830 |
\stepcounter{NMSB@ent}% |
| 831 |
\ifnum\theNMSB@ent=\theNMSB@maxent\relax |
| 832 |
\NMSB@errtoomanyent |
| 833 |
\fi |
| 834 |
\fi |
| 835 |
\fi |
| 836 |
\else |
| 837 |
\ifNMSB@strict |
| 838 |
\xdef\NMSB@doublecat{\NMSB@doublecat \@citeb,}% |
| 839 |
\else |
| 840 |
\expandafter\ifx\csname NMSBalias@#1\endcsname\relax |
| 841 |
\NMSB@erraliasundefined{#1}% |
| 842 |
\else |
| 843 |
\expandafter\xdef\csname NMSBcateg@\@citeb\endcsname{% |
| 844 |
\csname NMSBcateg@\@citeb\endcsname,% |
| 845 |
\csname NMSBalias@#1\endcsname}% |
| 846 |
\ifNMSB@ownorder |
| 847 |
\expandafter\xdef\csname NMSBcateg@\@citeb\endcsname{% |
| 848 |
\csname NMSBcateg@\@citeb\endcsname\theNMSB@ent}% |
| 849 |
\stepcounter{NMSB@ent}% |
| 850 |
\ifnum\theNMSB@ent=\theNMSB@maxent\relax |
| 851 |
\NMSB@errtoomanyent |
| 852 |
\fi |
| 853 |
\fi |
| 854 |
\fi |
| 855 |
\fi |
| 856 |
\fi}% |
| 857 |
\fi |
| 858 |
} |
| 859 |
\def\NMSB@entries@incatenv#1{% |
| 860 |
\ifnum\theNMSB@catlevel<1\relax |
| 861 |
\NMSB@errentriesoutsidecat |
| 862 |
\else |
| 863 |
\@for\@citeb:=#1\do{% |
| 864 |
\expandafter\ifx\csname NMSBcateg@\@citeb\endcsname\relax |
| 865 |
\ifnum\theNMSB@catlevel=2\relax |
| 866 |
\expandafter\xdef\csname NMSBcateg@\@citeb\endcsname{% |
| 867 |
\theNMSB@catlevelone\theNMSB@catleveltwo}% |
| 868 |
\else |
| 869 |
\expandafter\xdef\csname NMSBcateg@\@citeb\endcsname{% |
| 870 |
\theNMSB@catlevelone10}% |
| 871 |
\fi% |
| 872 |
\ifNMSB@ownorder |
| 873 |
\expandafter\xdef\csname NMSBcateg@\@citeb\endcsname{% |
| 874 |
\csname NMSBcateg@\@citeb\endcsname\theNMSB@ent}% |
| 875 |
\stepcounter{NMSB@ent}% |
| 876 |
\ifnum\theNMSB@ent=\theNMSB@maxent\relax\NMSB@errtoomanyent\fi |
| 877 |
\fi |
| 878 |
\else |
| 879 |
\ifNMSB@strict |
| 880 |
\xdef\NMSB@doublecat{\NMSB@doublecat \@citeb,}% |
| 881 |
\else |
| 882 |
\ifnum\theNMSB@catlevel=2\relax |
| 883 |
\expandafter\xdef\csname NMSBcateg@\@citeb\endcsname{% |
| 884 |
\csname NMSBcateg@\@citeb\endcsname,% |
| 885 |
\theNMSB@catlevelone\theNMSB@catleveltwo}% |
| 886 |
\else |
| 887 |
\expandafter\xdef\csname NMSBcateg@\@citeb\endcsname{% |
| 888 |
\csname NMSBcateg@\@citeb\endcsname,% |
| 889 |
\theNMSB@catlevelone10}% |
| 890 |
\fi |
| 891 |
\fi |
| 892 |
\ifNMSB@ownorder |
| 893 |
\expandafter\xdef\csname NMSBcateg@\@citeb\endcsname{% |
| 894 |
\csname NMSBcateg@\@citeb\endcsname\theNMSB@ent}% |
| 895 |
\stepcounter{NMSB@ent}% |
| 896 |
\ifnum\theNMSB@ent=\theNMSB@maxent\relax\NMSB@errtoomanyent\fi |
| 897 |
\fi |
| 898 |
\fi}% |
| 899 |
\fi |
| 900 |
} |
| 901 |
% \end{macrocode} |
| 902 |
% \end{macro} |
| 903 |
% \end{macro} |
| 904 |
% \end{macro} |
| 905 |
% \begin{macro}{\NMSBorig@@lbibitem} |
| 906 |
% \begin{macro}{\NMSBorig@@bibitem} |
| 907 |
% \begin{macro}{\NMSBrealorig@@bibitem} |
| 908 |
% Keep track of the original \cmd\bibitem~commands. |
| 909 |
% \begin{macrocode} |
| 910 |
\let\@NMSBrealorig@@bibitem\@bibitem |
| 911 |
\let\@NMSBorig@@lbibitem\@lbibitem |
| 912 |
\def\@NMSBorig@@bibitem#1{\item\if@filesw \immediate\write\@auxout |
| 913 |
{\string\bibcite{#1}{\the\NMSB@currprefixtok\the\value{\@listctr}}}% |
| 914 |
\fi\ignorespaces} |
| 915 |
% \end{macrocode} |
| 916 |
% \end{macro} |
| 917 |
% \end{macro} |
| 918 |
% \end{macro} |
| 919 |
% \begin{macro}{\NMSB@getcateg} |
| 920 |
% \begin{macro}{\NMSB@getent} |
| 921 |
% Those macros retrive the category and entry number from their concatenation. |
| 922 |
% This is used when reordering. |
| 923 |
% \begin{macrocode} |
| 924 |
\def\NMSB@getcateg#1#2#3#4#5-{#1#2#3#4} |
| 925 |
\def\NMSB@getent#1#2#3#4#5-{#5} |
| 926 |
% \end{macrocode} |
| 927 |
% \end{macro} |
| 928 |
% \end{macro} |
| 929 |
% \begin{macro}{\@lbibitem} |
| 930 |
% \begin{macro}{\@bibitem} |
| 931 |
% These are the new \cmd\bibitem~commands. They won't print |
| 932 |
% anything. Instead, they write their arguments in different commands |
| 933 |
% named after the number of the current |
| 934 |
% entry. Longest label is also evaluated. |
| 935 |
% \begin{macrocode} |
| 936 |
\def\@lbibitem[#1]#2#3\par{% |
| 937 |
\expandafter\ifx\csname NMSBcateg@#2\endcsname\relax |
| 938 |
\expandafter\gdef\csname NMSBcateg@#2\endcsname{9999}% |
| 939 |
\edef\NMSB@missingcat{\NMSB@missingcat #2,}% |
| 940 |
% \ifNMSB@ownorder |
| 941 |
% \expandafter\xdef\csname NMSBcateg@#2\endcsname{% |
| 942 |
% \csname NMSBcateg@#2\endcsname\theNMSB@maxent}% |
| 943 |
% \fi |
| 944 |
\fi |
| 945 |
\let\@tempa\relax |
| 946 |
\ifNMSB@ownorder |
| 947 |
\edef\NMSB@temp{\csname NMSBcateg@#2\endcsname}% |
| 948 |
\@for\NMSB@local:=\NMSB@temp\do{% |
| 949 |
\ifx\relax\@tempa\relax |
| 950 |
\edef\@tempa{\expandafter\NMSB@getcateg\NMSB@local-}% |
| 951 |
\else |
| 952 |
\edef\@tempa{\@tempa,\expandafter\NMSB@getcateg\NMSB@local-}% |
| 953 |
\fi |
| 954 |
}% |
| 955 |
\else |
| 956 |
\edef\@tempa{\csname NMSBcateg@#2\endcsname}% |
| 957 |
\fi |
| 958 |
\expandafter\ifx\csname NMSBprefix@\@tempa\endcsname\relax |
| 959 |
\def\@tempb{#1}% |
| 960 |
\else |
| 961 |
\expandafter\let\expandafter\NMSB@tempentry\csname |
| 962 |
NMSBprefix@\@tempa\endcsname |
| 963 |
\expandafter\NMSB@tok\expandafter{\NMSB@tempentry #1}% |
| 964 |
\edef\@tempb{\the\NMSB@tok}% |
| 965 |
\fi |
| 966 |
\@ifundefined{SBlongestlabel}{% |
| 967 |
\setbox\@tempboxa=\hbox{\@tempb}% |
| 968 |
\ifdim\NMSB@longest<\wd\@tempboxa |
| 969 |
\setlength\NMSB@longest{\wd\@tempboxa}% |
| 970 |
\global\let\NMSB@longestlabel\@tempb |
| 971 |
\fi}{}% |
| 972 |
\ifNMSB@ownorder |
| 973 |
\edef\NMSB@temp{\csname NMSBcateg@#2\endcsname}% |
| 974 |
\@for\NMSB@local:=\NMSB@temp\do{% |
| 975 |
\edef\NMSB@tempb{\expandafter\NMSB@getent\NMSB@local-} |
| 976 |
\expandafter\xdef\csname NMSBkey@\NMSB@tempb\endcsname{#2}% |
| 977 |
\global\expandafter\let\csname NMSBlabel@\NMSB@tempb\endcsname |
| 978 |
\@tempb |
| 979 |
\expandafter\gdef\csname NMSBentry@\NMSB@tempb\endcsname{#3}% |
| 980 |
\ifx\relax\NMSB@valuelist\relax |
| 981 |
\xdef\NMSB@valuelist{\NMSB@local}% |
| 982 |
\else |
| 983 |
\xdef\NMSB@valuelist{\NMSB@valuelist,\NMSB@local}% |
| 984 |
\fi}% |
| 985 |
\else |
| 986 |
\expandafter\xdef\csname NMSBkey@\theNMSB@ent\endcsname{#2}% |
| 987 |
\global\expandafter\let\csname NMSBlabel@\theNMSB@ent\endcsname |
| 988 |
\@tempb |
| 989 |
\expandafter\gdef\csname NMSBentry@\theNMSB@ent\endcsname{#3}% |
| 990 |
\@for\NMSB@item:=\@tempa\do{% |
| 991 |
\ifx\relax\NMSB@valuelist\relax |
| 992 |
\xdef\NMSB@valuelist{\NMSB@item\theNMSB@ent}% |
| 993 |
\else |
| 994 |
\xdef\NMSB@valuelist{\NMSB@valuelist,\NMSB@item\theNMSB@ent}% |
| 995 |
\fi}% |
| 996 |
\stepcounter{NMSB@ent}% |
| 997 |
\ifnum\theNMSB@ent=\theNMSB@maxent\relax\NMSB@errtoomanyent\fi |
| 998 |
\fi |
| 999 |
} |
| 1000 |
\def\@bibitem#1#2\par{% |
| 1001 |
\expandafter\ifx\csname NMSBcateg@#1\endcsname\relax |
| 1002 |
\expandafter\gdef\csname NMSBcateg@#1\endcsname{9999}% |
| 1003 |
% \ifNMSB@ownorder |
| 1004 |
% \expandafter\xdef\csname NMSBcateg@#1\endcsname{% |
| 1005 |
% \csname NMSBcateg@#1\endcsname\theNMSB@maxent}% |
| 1006 |
% \fi |
| 1007 |
\edef\NMSB@missingcat{\NMSB@missingcat #1,}% |
| 1008 |
\fi |
| 1009 |
\def\@tempa{}% |
| 1010 |
\ifNMSB@ownorder |
| 1011 |
\edef\NMSB@temp{\csname NMSBcateg@#1\endcsname}% |
| 1012 |
\@for\NMSB@local:=\NMSB@temp\do{% |
| 1013 |
\ifx\relax\@tempa\relax |
| 1014 |
\edef\@tempa{\expandafter\NMSB@getcateg\NMSB@local-}% |
| 1015 |
\else |
| 1016 |
\edef\@tempa{\@tempa,\expandafter\NMSB@getcateg\NMSB@local-}% |
| 1017 |
\fi}% |
| 1018 |
\else |
| 1019 |
\edef\@tempa{\csname NMSBcateg@#1\endcsname}% |
| 1020 |
\fi |
| 1021 |
\@ifundefined{SBlongestlabel}{% |
| 1022 |
\expandafter\ifx\csname NMSBprefix@\@tempa\endcsname\relax |
| 1023 |
\let\@tempb\NMSB@initiallongestlabel |
| 1024 |
\else |
| 1025 |
\expandafter\let\expandafter\NMSB@tempentry\csname |
| 1026 |
NMSBprefix@\@tempa\endcsname |
| 1027 |
\expandafter\expandafter\expandafter\NMSB@tok |
| 1028 |
\expandafter\expandafter\expandafter{% |
| 1029 |
\expandafter\NMSB@tempentry |
| 1030 |
\NMSB@initiallongestlabel}% |
| 1031 |
\edef\@tempb{\the\NMSB@tok}% |
| 1032 |
\fi |
| 1033 |
\setbox\@tempboxa=\hbox{\@tempb}% |
| 1034 |
\ifdim\NMSB@longest<\wd\@tempboxa |
| 1035 |
\setlength\NMSB@longest{\wd\@tempboxa}% |
| 1036 |
\global\let\NMSB@longestlabel\@tempb |
| 1037 |
\fi}{}% |
| 1038 |
\ifNMSB@ownorder |
| 1039 |
\edef\NMSB@temp{\csname NMSBcateg@#1\endcsname}% |
| 1040 |
\@for\NMSB@local:=\NMSB@temp\do{% |
| 1041 |
\edef\NMSB@tempb{\expandafter\NMSB@getent\NMSB@local-} |
| 1042 |
\expandafter\xdef\csname NMSBkey@\NMSB@tempb\endcsname{#1}% |
| 1043 |
\expandafter\gdef\csname NMSBentry@\NMSB@tempb\endcsname{#2}% |
| 1044 |
\ifx\relax\NMSB@valuelist\relax |
| 1045 |
\xdef\NMSB@valuelist{\NMSB@local}% |
| 1046 |
\else |
| 1047 |
\xdef\NMSB@valuelist{\NMSB@valuelist,\NMSB@local}% |
| 1048 |
\fi}% |
| 1049 |
\else |
| 1050 |
\expandafter\xdef\csname NMSBkey@\theNMSB@ent\endcsname{#1}% |
| 1051 |
\expandafter\gdef\csname NMSBentry@\theNMSB@ent\endcsname{#2}% |
| 1052 |
\@for\NMSB@item:=\@tempa\do{% |
| 1053 |
\ifx\relax\NMSB@valuelist\relax |
| 1054 |
\xdef\NMSB@valuelist{\NMSB@item\theNMSB@ent}% |
| 1055 |
\else |
| 1056 |
\xdef\NMSB@valuelist{\NMSB@valuelist,\NMSB@item\theNMSB@ent}% |
| 1057 |
\fi}% |
| 1058 |
\stepcounter{NMSB@ent}% |
| 1059 |
\ifnum\theNMSB@ent=\theNMSB@maxent\relax\NMSB@errtoomanyent\fi |
| 1060 |
\fi |
| 1061 |
} |
| 1062 |
% \end{macrocode} |
| 1063 |
% \end{macro} |
| 1064 |
% \end{macro} |
| 1065 |
% \begin{macro}{\NMSB@afterfi} |
| 1066 |
% \begin{macro}{\NMSB@afterelse} |
| 1067 |
% \begin{macro}{\NMSB@empty} |
| 1068 |
% \begin{macro}{\NMSB@pivot} |
| 1069 |
% \begin{macro}{\NMSB@qsort} |
| 1070 |
% \begin{macro}{\NMSB@resort} |
| 1071 |
% \begin{macro}{\NMSB@sort} |
| 1072 |
% \begin{macro}{\NMSB@sortlt} |
| 1073 |
% The sorting commands. This is an implementation of the quicksort |
| 1074 |
% algorithm. |
| 1075 |
% \begin{macrocode} |
| 1076 |
\def\NMSB@afterfi#1\fi{\fi#1} |
| 1077 |
\def\NMSB@afterelse#1\else#2\fi{\fi#1} |
| 1078 |
\def\NMSB@empty{} |
| 1079 |
\def\NMSB@pivot#1#2#3#4#5,{% |
| 1080 |
\ifx\relax#5\NMSB@empty% |
| 1081 |
\ifx\relax#3\relax\else\NMSB@resort{#1}{#3}, \fi% |
| 1082 |
#2% |
| 1083 |
\ifx\relax#4\relax\else,\NMSB@resort{#1}{#4}\fi% |
| 1084 |
\else% |
| 1085 |
\ifnum#5#1#2 \NMSB@afterelse{\NMSB@afterfi{% |
| 1086 |
\NMSB@pivot{#1}{#2}{#3#5,}{#4}}}% |
| 1087 |
\else% |
| 1088 |
\NMSB@afterfi{\NMSB@afterfi{% |
| 1089 |
\NMSB@pivot{#1}{#2}{#3}{#4#5,}}}% |
| 1090 |
\fi |
| 1091 |
\fi |
| 1092 |
}% |
| 1093 |
\def\NMSB@qsort#1#2,{% |
| 1094 |
\ifx\relax#2\relax\else |
| 1095 |
\NMSB@afterfi{\NMSB@pivot{#1}{#2}{}{}}\fi} |
| 1096 |
\def\NMSB@resort#1#2{\NMSB@qsort{#1}#2\relax,} |
| 1097 |
\def\NMSBsort#1#2{\NMSB@qsort{#1}#2,\relax,} |
| 1098 |
\def\NMSBsortlt#1{\NMSBsort{<}{#1}} |
| 1099 |
% \end{macrocode} |
| 1100 |
% \end{macro} |
| 1101 |
% \end{macro} |
| 1102 |
% \end{macro} |
| 1103 |
% \end{macro} |
| 1104 |
% \end{macro} |
| 1105 |
% \end{macro} |
| 1106 |
% \end{macro} |
| 1107 |
% \end{macro} |
| 1108 |
% \begin{macro}{\NMSB@writecatbib} |
| 1109 |
% Macros for writing unexpanded commands into the \ext{sbb}~file. |
| 1110 |
% \begin{macrocode} |
| 1111 |
\long\def\NMSB@writecatbib#1{% |
| 1112 |
\NMSB@tok{#1}% |
| 1113 |
\immediate\write\NMSB@catbib{\the\NMSB@tok}} |
| 1114 |
% \end{macrocode} |
| 1115 |
% \end{macro} |
| 1116 |
% \begin{macro}{\NMSB@writeentry} |
| 1117 |
% \begin{macro}{\NMSB@writelist} |
| 1118 |
% Those macros are to write one entry, and the list of entries, respectively. |
| 1119 |
% When writing an entry, we have to detect category-changes, for writing |
| 1120 |
% the (sub)title. |
| 1121 |
% {\makeatletter\cmd\NMSB@writeentry}~is becoming more and more complex, |
| 1122 |
% but it mainly detects category changes, writes category titles if needed, |
| 1123 |
% and writes a \cmd\bibitem. |
| 1124 |
% \begin{macrocode} |
| 1125 |
\def\NMSB@writeentry#1#2#3#4#5,{\ifx\relax #5\relax |
| 1126 |
\else |
| 1127 |
\def\NMSB@currcat{#1#2#3#4}% |
| 1128 |
\def\NMSB@currcatlevelone{#1#2}% |
| 1129 |
\ifx\NMSB@currcatlevelone\NMSB@prevcatlevelone\else |
| 1130 |
\expandafter\ifx\csname NMSBtitle@\NMSB@currcatlevelone |
| 1131 |
\endcsname\relax |
| 1132 |
\else |
| 1133 |
\ifNMSB@export |
| 1134 |
\if@filesw |
| 1135 |
\immediate\write\NMSB@catbib{% |
| 1136 |
\string\par\string\addpenalty{-\NMSB@penalty}% |
| 1137 |
\string\relax^^J% |
| 1138 |
\string\item[]% |
| 1139 |
\string\SBtitle}% |
| 1140 |
\expandafter\let\expandafter\NMSB@tempentry |
| 1141 |
\csname NMSBtitle@\NMSB@currcatlevelone\endcsname |
| 1142 |
\expandafter\NMSB@writecatbib\expandafter{% |
| 1143 |
\expandafter{\NMSB@tempentry}}% |
| 1144 |
\immediate\write\NMSB@catbib{\string\relax^^J% |
| 1145 |
\string\par\string\addpenalty{\NMSB@penalty}% |
| 1146 |
\string\relax}% |
| 1147 |
\expandafter\ifx\csname |
| 1148 |
NMSBcomment@\NMSB@currcatlevelone\endcsname\relax |
| 1149 |
\else |
| 1150 |
\immediate\write\NMSB@catbib{\string\vskip2ex^^J% |
| 1151 |
\string\hspace{-\leftmargin}\string\relax^^J% |
| 1152 |
\string\begin{minipage}{\textwidth}^^J% |
| 1153 |
\string\addtolength\string\parindent{20pt}^^J% |
| 1154 |
\string\noindent} |
| 1155 |
\expandafter\let\expandafter\NMSB@tempentry |
| 1156 |
\csname NMSBcomment@\NMSB@currcatlevelone\endcsname |
| 1157 |
\expandafter\NMSB@writecatbib\expandafter{% |
| 1158 |
\NMSB@tempentry^^J}% |
| 1159 |
\immediate\write\NMSB@catbib{\string\end{minipage}^^J% |
| 1160 |
\string\par\string\addpenalty{\NMSB@penalty} |
| 1161 |
\string\vskip2ex} |
| 1162 |
\fi |
| 1163 |
\fi |
| 1164 |
\else |
| 1165 |
\par\addpenalty{-\NMSB@penalty}% |
| 1166 |
\item[]% |
| 1167 |
\SBtitle{\csname NMSBtitle@\NMSB@currcatlevelone\endcsname} |
| 1168 |
\par\addpenalty{\NMSB@penalty}% |
| 1169 |
\expandafter\ifx\csname |
| 1170 |
NMSBcomment@\NMSB@currcatlevelone\endcsname\relax |
| 1171 |
\else |
| 1172 |
\vskip2ex\hspace{-\leftmargin}\begin{minipage}{\textwidth}% |
| 1173 |
\addtolength\parindent{20pt}\noindent% |
| 1174 |
\csname NMSBcomment@\NMSB@currcatlevelone\endcsname |
| 1175 |
\end{minipage}% |
| 1176 |
\par\addpenalty{\NMSB@penalty}\vskip2ex |
| 1177 |
\fi |
| 1178 |
\fi |
| 1179 |
\fi |
| 1180 |
\xdef\NMSB@prevcatlevelone{#1#2}% |
| 1181 |
\ifnum\theSBresetdepth>0\relax |
| 1182 |
\setcounter{\@listctr}{0}% |
| 1183 |
\fi |
| 1184 |
\expandafter\ifx\csname NMSBprefix@\NMSB@prevcatlevelone |
| 1185 |
\endcsname\relax |
| 1186 |
\NMSB@currprefixlevelonetok{\relax}% |
| 1187 |
\else |
| 1188 |
\expandafter\expandafter\expandafter\NMSB@currprefixlevelonetok |
| 1189 |
\expandafter\expandafter\expandafter{% |
| 1190 |
\csname NMSBprefix@\NMSB@prevcatlevelone\endcsname}% |
| 1191 |
\fi |
| 1192 |
\fi |
| 1193 |
\ifx\NMSB@currcat\NMSB@prevcat\else |
| 1194 |
\ifnum\NMSB@currcat=9999\else |
| 1195 |
\expandafter\ifx\csname NMSBtitle@\NMSB@currcat\endcsname |
| 1196 |
\relax |
| 1197 |
\else |
| 1198 |
\ifNMSB@export |
| 1199 |
\if@filesw |
| 1200 |
\immediate\write\NMSB@catbib{% |
| 1201 |
\string\par\string\addpenalty{-\NMSB@halfpenalty}% |
| 1202 |
\string\relax^^J% |
| 1203 |
\string\item[]% |
| 1204 |
\string\SBsubtitle}% |
| 1205 |
\expandafter\let\expandafter\NMSB@tempentrya |
| 1206 |
\csname NMSBtitle@\NMSB@currcatlevelone\endcsname |
| 1207 |
\expandafter\let\expandafter\NMSB@tempentryb |
| 1208 |
\csname NMSBtitle@\NMSB@currcat\endcsname |
| 1209 |
\expandafter\NMSB@writecatbib\expandafter{% |
| 1210 |
\expandafter{\NMSB@tempentrya}} |
| 1211 |
\expandafter\NMSB@writecatbib\expandafter{% |
| 1212 |
\expandafter{\NMSB@tempentryb}} |
| 1213 |
\immediate\write\NMSB@catbib{\string\relax^^J% |
| 1214 |
\string\par\string\addpenalty{\NMSB@penalty}% |
| 1215 |
\string\relax}% |
| 1216 |
\expandafter\ifx\csname |
| 1217 |
NMSBcomment@\NMSB@currcat\endcsname\relax |
| 1218 |
\else |
| 1219 |
\immediate\write\NMSB@catbib{\string\vskip2ex^^J% |
| 1220 |
\string\hspace{-\leftmargin}\string\relax^^J% |
| 1221 |
\string\begin{minipage}{\textwidth}^^J% |
| 1222 |
\string\addtolength\string\parindent{20pt}^^J% |
| 1223 |
\string\noindent} |
| 1224 |
\expandafter\let\expandafter\NMSB@tempentry |
| 1225 |
\csname NMSBcomment@\NMSB@currcat\endcsname |
| 1226 |
\expandafter\NMSB@writecatbib\expandafter{% |
| 1227 |
\NMSB@tempentry^^J}% |
| 1228 |
\immediate\write\NMSB@catbib{\string\end{minipage}^^J% |
| 1229 |
\string\par\string\addpenalty{\NMSB@penalty}% |
| 1230 |
\string\vskip2ex} |
| 1231 |
\fi |
| 1232 |
\fi |
| 1233 |
\else |
| 1234 |
\par\addpenalty{-\NMSB@halfpenalty}% |
| 1235 |
\item[] |
| 1236 |
\SBsubtitle{\csname NMSBtitle@\NMSB@currcatlevelone\endcsname}% |
| 1237 |
{\csname NMSBtitle@\NMSB@currcat\endcsname}% |
| 1238 |
\par\addpenalty{\NMSB@penalty}% |
| 1239 |
\expandafter\ifx\csname |
| 1240 |
NMSBcomment@\NMSB@currcat\endcsname\relax |
| 1241 |
\else |
| 1242 |
\vskip2ex\hspace{-\leftmargin}\begin{minipage}{\textwidth}% |
| 1243 |
\addtolength\parindent{20pt}\noindent% |
| 1244 |
\csname NMSBcomment@\NMSB@currcat\endcsname |
| 1245 |
\end{minipage}% |
| 1246 |
\par\addpenalty{\NMSB@penalty}\vskip2ex |
| 1247 |
\fi |
| 1248 |
\fi |
| 1249 |
\fi |
| 1250 |
\fi |
| 1251 |
\xdef\NMSB@prevcat{#1#2#3#4}% |
| 1252 |
\ifnum\theSBresetdepth>1\relax |
| 1253 |
\setcounter{\@listctr}{0}% |
| 1254 |
\fi |
| 1255 |
\expandafter\ifx\csname NMSBprefix@\NMSB@currcat\endcsname\relax |
| 1256 |
\expandafter\NMSB@currprefixtok\expandafter{% |
| 1257 |
\the\NMSB@currprefixlevelonetok}% |
| 1258 |
\else |
| 1259 |
\expandafter\expandafter\expandafter\NMSB@currprefixtok |
| 1260 |
\expandafter\expandafter\expandafter{% |
| 1261 |
\csname NMSBprefix@\NMSB@currcat\endcsname} |
| 1262 |
\fi |
| 1263 |
\fi |
| 1264 |
\expandafter\ifx\csname NMSBlabel@#5\endcsname\relax |
| 1265 |
\ifNMSB@export |
| 1266 |
\if@filesw |
| 1267 |
\stepcounter\@listctr |
| 1268 |
\immediate\write\NMSB@catbib{% |
| 1269 |
\string\bibitem}% |
| 1270 |
\expandafter\ifx\expandafter\relax\the\NMSB@currprefixtok |
| 1271 |
\else |
| 1272 |
\expandafter\expandafter\expandafter\def |
| 1273 |
\expandafter\expandafter\expandafter\NMSB@tempentry |
| 1274 |
\expandafter\expandafter\expandafter{% |
| 1275 |
\expandafter\the\expandafter\NMSB@currprefixtok |
| 1276 |
\the\value{\@listctr}}% |
| 1277 |
\expandafter\NMSB@writecatbib\expandafter{% |
| 1278 |
\expandafter[\NMSB@tempentry]}% |
| 1279 |
\fi |
| 1280 |
\immediate\write\NMSB@catbib{% |
| 1281 |
{\csname NMSBkey@#5\endcsname}} |
| 1282 |
\expandafter\let\expandafter\NMSB@tempentry |
| 1283 |
\csname NMSBentry@#5\endcsname% |
| 1284 |
\expandafter\NMSB@writecatbib\expandafter{% |
| 1285 |
\NMSB@tempentry^^J^^J} |
| 1286 |
\fi |
| 1287 |
\else |
| 1288 |
\@NMSBorig@@bibitem{\csname NMSBkey@#5\endcsname}% |
| 1289 |
\csname NMSBentry@#5\endcsname |
| 1290 |
\fi |
| 1291 |
\setbox\@tempboxa=\hbox{\the\NMSB@currprefixtok\the\value{\@listctr}}% |
| 1292 |
\ifdim\NMSB@reallylongest<\wd\@tempboxa |
| 1293 |
\setlength{\NMSB@reallylongest}{\wd\@tempboxa}% |
| 1294 |
\xdef\NMSB@reallylongestlabel{% |
| 1295 |
\expandafter\ifx\expandafter\relax\the\NMSB@currprefixtok |
| 1296 |
\else\the\NMSB@currprefixtok\fi\the\value{\@listctr}}% |
| 1297 |
\fi |
| 1298 |
\else |
| 1299 |
\ifNMSB@export |
| 1300 |
\if@filesw |
| 1301 |
\immediate\write\NMSB@catbib{% |
| 1302 |
\string\bibitem} |
| 1303 |
\expandafter\let\expandafter\NMSB@tempentry |
| 1304 |
\csname NMSBlabel@#5\endcsname |
| 1305 |
\expandafter\NMSB@writecatbib\expandafter{% |
| 1306 |
\expandafter[\NMSB@tempentry]}% |
| 1307 |
\immediate\write\NMSB@catbib{% |
| 1308 |
{\csname NMSBkey@#5\endcsname}}% |
| 1309 |
\expandafter\let\expandafter\NMSB@tempentry |
| 1310 |
\csname NMSBentry@#5\endcsname% |
| 1311 |
\expandafter\NMSB@writecatbib\expandafter{% |
| 1312 |
\NMSB@tempentry^^J^^J} |
| 1313 |
\fi |
| 1314 |
\else |
| 1315 |
\@NMSBorig@@lbibitem[\csname NMSBlabel@#5\endcsname]% |
| 1316 |
{\csname NMSBkey@#5\endcsname}% |
| 1317 |
\csname NMSBentry@#5\endcsname |
| 1318 |
\fi |
| 1319 |
\setbox\@tempboxa=\hbox{\csname NMSBlabel@#5\endcsname}% |
| 1320 |
\ifdim\NMSB@reallylongest<\wd\@tempboxa |
| 1321 |
\setlength{\NMSB@reallylongest}{\wd\@tempboxa}% |
| 1322 |
\expandafter\let\expandafter\NMSB@reallylongestlabel\csname |
| 1323 |
NMSBlabel@#5\endcsname |
| 1324 |
\fi |
| 1325 |
\fi |
| 1326 |
\fi |
| 1327 |
} |
| 1328 |
\def\NMSB@writelist#1{% |
| 1329 |
\@for\NMSB@curritem:=#1\do{% |
| 1330 |
\edef\NMSB@curritem{\expandafter |
| 1331 |
\@firstofone\NMSB@curritem\@empty}% |
| 1332 |
\expandafter\NMSB@writeentry\NMSB@curritem ,}} |
| 1333 |
% \end{macrocode} |
| 1334 |
% \end{macro} |
| 1335 |
% \end{macro} |
| 1336 |
% \begin{macro}{\@NMSBorig@thebibliography} |
| 1337 |
% \begin{macro}{\@NMSBorig@endthebibliography} |
| 1338 |
% \begin{macro}{\thebibliography} |
| 1339 |
% \begin{macro}{\endthebibliography} |
| 1340 |
% \cmd\thebibliography~does not really use its argument. It's simply used for |
| 1341 |
% approximating the longest label. Note that |
| 1342 |
% \cmd\endthebibliography~writes the entries, since sorting has to be |
| 1343 |
% done after \cmd\bibitem{}s have treated all the entries. |
| 1344 |
% \begin{macrocode} |
| 1345 |
\let\@NMSBorig@thebibliography\thebibliography |
| 1346 |
\let\@NMSBorig@endthebibliography\endthebibliography |
| 1347 |
\def\thebibliography#1{% |
| 1348 |
\setcounter{NMSB@ent}{\NMSB@initent}% |
| 1349 |
\@ifundefined{SBlongestlabel}{% |
| 1350 |
\gdef\NMSB@initiallongestlabel{#1}}{% |
| 1351 |
\global\let\NMSB@longestlabel\SBlongestlabel |
| 1352 |
\setbox\@tempboxa=\hbox{\SBlongestlabel}% |
| 1353 |
\setlength{\NMSB@longest}{\wd\@tempboxa}}% |
| 1354 |
\ifNMSB@export |
| 1355 |
\if@filesw |
| 1356 |
\newwrite\NMSB@catbib |
| 1357 |
\immediate\openout\NMSB@catbib \jobname.sbb\relax |
| 1358 |
\expandafter\NMSB@tok\expandafter{\SBlongestlabel} |
| 1359 |
\immediate\write\NMSB@catbib{% |
| 1360 |
\string\begin{thebibliography}{% |
| 1361 |
\@ifundefined{SBlongestlabel}{#1}{\the\NMSB@tok}}} |
| 1362 |
\fi |
| 1363 |
\fi |
| 1364 |
} |
| 1365 |
\def\endthebibliography{% |
| 1366 |
\ifNMSB@export |
| 1367 |
\usecounter{enumiv}% |
| 1368 |
\else |
| 1369 |
\ifNMSB@newchap |
| 1370 |
\@ifundefined{chapter}{\section*{\refname}}{\chapter*{\bibname}}% |
| 1371 |
\fi |
| 1372 |
\list{\@biblabel{\the\NMSB@currprefixtok\@arabic\c@enumiv}\hfill}{% |
| 1373 |
\settowidth\labelwidth{\@biblabel{\NMSB@longestlabel}}% |
| 1374 |
\leftmargin\labelwidth |
| 1375 |
\advance\leftmargin\labelsep |
| 1376 |
\@openbib@code |
| 1377 |
\usecounter{enumiv}% |
| 1378 |
\let\p@enumiv\@empty |
| 1379 |
\renewcommand\theenumiv{\@arabic\c@enumiv}}% |
| 1380 |
\fi |
| 1381 |
\edef\NMSB@sortedvaluelist{% |
| 1382 |
\expandafter\NMSBsortlt\expandafter{\NMSB@valuelist}}% |
| 1383 |
\expandafter\NMSB@writelist\expandafter{\NMSB@sortedvaluelist}% |
| 1384 |
\ifNMSB@export |
| 1385 |
\if@filesw |
| 1386 |
\immediate\write\NMSB@catbib{% |
| 1387 |
\string\end{thebibliography}} |
| 1388 |
\immediate\closeout\NMSB@catbib |
| 1389 |
\fi |
| 1390 |
\begingroup |
| 1391 |
\ifNMSB@newchap\else |
| 1392 |
\@ifundefined{chapter}{\def\section##1##2{}}{\def\chapter##1##2{}}% |
| 1393 |
\fi |
| 1394 |
\let\thebibliography\@NMSBorig@thebibliography |
| 1395 |
\let\endthebibliography\@NMSBorig@endthebibliography |
| 1396 |
\let\@lbibitem\@NMSBorig@@lbibitem |
| 1397 |
\let\@bibitem\@NMSBrealorig@@bibitem |
| 1398 |
\@input@{\jobname.sbb} |
| 1399 |
\endgroup |
| 1400 |
\else |
| 1401 |
\endlist |
| 1402 |
\fi |
| 1403 |
\ifx\NMSB@missingcat\NMSB@empty\else |
| 1404 |
\expandafter\NMSB@warnnocateg\NMSB@missingcat\end |
| 1405 |
\fi |
| 1406 |
\ifNMSB@strict |
| 1407 |
\ifx\NMSB@doublecat\NMSB@empty\else |
| 1408 |
\expandafter\NMSB@warndblcateg\NMSB@doublecat\end |
| 1409 |
\fi |
| 1410 |
\fi |
| 1411 |
\ifdim\NMSB@reallylongest=\NMSB@longest\relax\else |
| 1412 |
\NMSB@warnwronglongest |
| 1413 |
\fi |
| 1414 |
} |
| 1415 |
% \end{macrocode} |
| 1416 |
% \end{macro} |
| 1417 |
% \end{macro} |
| 1418 |
% \end{macro} |
| 1419 |
% \end{macro} |
| 1420 |
% \setcounter{IndexColumns}{2} |
| 1421 |
% \IfFileExists{splitbib.ind}{}{% |
| 1422 |
% \message{Please run "makeindex -s gind.ist splitbib.idx" for the index.}} |
| 1423 |
% \PrintIndex |
| 1424 |
% \Finale |
| 1425 |
\endinput |