summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/multibbl/multibbl.dtx
blob: 523867dd0d0780923e0ac4b46f6f81b1e0a4f9d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%\iffalse
%
% (c) copyright  2001-2004 Apostolos Syropoulos
% This software is derived from original software by the LaTeX3 Project.
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or any later version.
%
% Please report errors or suggestions for improvement to
%    
%    Apostolos Syropoulos
%    366, 28th October Str.
%    GR-671 00 Xanthi, GREECE
%    apostolo@ocean1.ee.duth.gr or apostolo@obelix.ee.duth.gr
%\changes{v1.1}{2004/07/27}{Added percent symbols to avoid unnecessary
%                           wait space.}
%\fi
% \CheckSum{125}
% \iffalse This is a Metacomment
%
%    \begin{macrocode}
%<*driver>
\documentclass{ltxdoc}
\GetFileInfo{multibbl.drv}
\begin{document}
   \DocInput{multibbl.dtx}
\end{document}
%</driver>
%    \end{macrocode}
% \fi
%
%\title{The ``multibbl'' package}
%\author{Apostolos Syropoulos\\366, 28th October Str.\\
%GR-671 00 Xanthi, HELLAS\\ 
%Email:\texttt{apostolo@obelix.ee.duth.gr}\\ or \\
%\hphantom{Email:}\texttt{apostolo@ocean1.ee.duth.gr}}
% \date{2004/07/27}
%\maketitle
% \begin{abstract}
% The package ``multibbl'' redefines the standard commands bibliographic
% commands so that one can generate multiply reference sections. Each
% section has it own auxiliary file (for use with BibTeX) and title.
% \end{abstract}
%\MakeShortVerb{\|}
%\StopEventually{}
%\section{Introduction}
% This package has been designed for people who write a document that
% has references in languages that use different scripts. For example,
% if one prepares a book in Greek, then his/her document may have 
% references in Greek and in English. In this particular case, it makes
% no sense to sort the references and have only one bibliography section.
% It is better to have two bibliography sections: one for the Greek 
% references and on for the English references. Moreover, it is possible
% to have references in more than two scripts. Then we obviously, need
% three or even more bibliography sections. By the redefining the standard
% \LaTeX\ user interface commands, this package makes it possible to have
% two or more bibliography sections in one document. Naturally, one can
% use this package for documents that use only one script, just in case
% there is a need to have multiply bibliography sections. 
%
% \section{The code}
% 
% As usual, we first have to identify the package:
%    \begin{macrocode}
%<package>
\NeedsTeXFormat{LaTeX2e}[1996/01/01]
\ProvidesPackage{multibbl}[2007/07/27\space v1.1]
\typeout{Package: `multibbl' v1.1\space <2004/07/27> (A. Syropoulos)}
%    \end{macrocode}
%
%\begin{macro}{\newbibliography}
% Now we have to define a new command which has one argument: the name of 
% a new auxiliary file. If that file does not exist, it simply creates 
% this file.
%    \begin{macrocode}
\def\newbibliography#1{\begingroup
  \if@filesw \expandafter\newwrite\csname #1@auxfile\endcsname
  \expandafter\immediate\openout \csname #1@auxfile\endcsname #1.aux\relax
  \typeout{Writing auxiliary file #1.aux }\fi \endgroup}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\@citex}
% The command |\@citex| is used internally to process the arguments of
% the |\cite| command. Since, the later command has now two required 
% arguments, the name of an auxiliary file and the usual citation labels,
% we have to redefine the |\@citex| command so that these labels are 
% written into the auxiliary file, just in case we want to generate the
% bibliography with BibTeX. What we actually do is to replace the code
% \begin{verbatim}
% \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
% \end{verbatim}
% with the code
% \begin{verbatim}
%  \@ifundefined{#2@auxfile}{}{\expandafter\immediate%
%        \write\csname #2@auxfile\endcsname{\string\citation{\@citeb}}}%
% \end{verbatim} 
% This code checks whether we have defined the control sequence
% |#2@auxfile|, where |#2| is the first required argument, i.e., the
% name of the auxiliary file, and if it is it writes the citation
% labels to this file.
%    \begin{macrocode}
\def\@citex[#1]#2#3{%
  \let\@citea\@empty
  \@cite{\@for\@citeb:=#3\do
    {\@citea\def\@citea{,\penalty\@m\ }%
     \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
     \@ifundefined{#2@auxfile}{}{\expandafter\immediate%
        \write\csname #2@auxfile\endcsname{\string\citation{\@citeb}}}%
     \@ifundefined{b@\@citeb}{\mbox{\reset@font\bfseries ?}%
       \G@refundefinedtrue
       \@latex@warning
         {Citation `\@citeb' on page \thepage \space undefined}}%
       {\hbox{\csname b@\@citeb\endcsname}}}}{#1}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\bibliography}
% The |\bibliography| command has been redefined to take three required
% arguments: the first is the name of the auxiliary file, the second is
% the argument that the standard command has and the third is the 
% the title of the bibliographic section, i.e., what will appear
% in the running heads, etc. In order to do this, we have to redefine the
% commands |\bibname| and |\refname|, which are used to typeset the running
% heads, etc.
%    \begin{macrocode}
\def\bibliography#1#2#3{%
   \@ifundefined{#1@auxfile}{}{\expandafter\immediate%
     \write\csname #1@auxfile\endcsname{\string\bibdata{#2}}}%
  \def\bibname{#3}%
  \def\refname{#3}%
  \@input@{#1.bbl}}
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\bibliographystyle}
% The |\bibliographystyle| command has two arguments: the name of an
% auxiliary file and the name of a bibliographic style. With this
% command one can specify the bibliographic style each bibliography section
% will have. Although, at first sight it makes no sense to use different
% bibliographic styles. However, we believe that this feature may be proved
% useful in cases where it is not possible to distinguish to which 
% bibliography section each citation belongs to. 
%    \begin{macrocode}
\def\bibliographystyle#1#2{%
  \ifx\@begindocumenthook\@undefined\else
    \expandafter\AtBeginDocument
  \fi
  \@ifundefined{#1@auxfile}{}{\expandafter\immediate%
     \write\csname #1@auxfile\endcsname{\string\bibstyle{#2}}}}%
%    \end{macrocode}
%\end{macro}
%
%\begin{macro}{\nocite}
% The |\nocite| command has been redefined so that it has two required
% arguments: the name of an auxiliary file and the standard argument.
%    \begin{macrocode}
\def\nocite#1#2{\@bsphack
  \@for\@citeb:=#2\do{%
    \edef\@citeb{\expandafter\@firstofone\@citeb}%
    \@ifundefined{#1@auxfile}{}{\expandafter\immediate%
        \write\csname #1@auxfile\endcsname{\string\citation{\@citeb}}}%
    \@ifundefined{b@\@citeb}{\G@refundefinedtrue
        \@latex@warning{Citation `\@citeb' undefined}}{}}%
  \@esphack}
%    \end{macrocode}
%\end{macro}
% Although it is not necessary to explicitly terminate a
% package, we believe it is good practice to do it.
%    \begin{macrocode}
\endinput
%</package>
%    \end{macrocode}
% \section*{Acknowledgment}
% I thank Antonis Tsolomitis for checking this usability of this package. 
% \section*{Dedication}
% To the fond memory of my late brother Mikhail Syropoulos.
% \Finale