diff options
-rw-r--r-- | icite.dtx | 79 |
1 files changed, 70 insertions, 9 deletions
@@ -91,6 +91,7 @@ Running "make install" installs the files in the local TeX tree. | |||
91 | %<*driver> | 91 | %<*driver> |
92 | \documentclass{ltxdoc} | 92 | \documentclass{ltxdoc} |
93 | \usepackage[letterpaper,margin=25mm,left=50mm,nohead]{geometry} | 93 | \usepackage[letterpaper,margin=25mm,left=50mm,nohead]{geometry} |
94 | \usepackage{dox} | ||
94 | \usepackage{\jobname} | 95 | \usepackage{\jobname} |
95 | \usepackage{metalogox} | 96 | \usepackage{metalogox} |
96 | \usepackage{hyperxmp} | 97 | \usepackage{hyperxmp} |
@@ -228,14 +229,25 @@ Running "make install" installs the files in the local TeX tree. | |||
228 | % \begin{macrocode} | 229 | % \begin{macrocode} |
229 | \RequirePackage{xkeyval} | 230 | \RequirePackage{xkeyval} |
230 | \DeclareOptionX{citecmd}[cite]{\def\ic@dfltcit{#1}} | 231 | \DeclareOptionX{citecmd}[cite]{\def\ic@dfltcit{#1}} |
232 | \newif\ifdefault@index | ||
233 | \newif\ifno@index | ||
234 | \DeclareOptionX{defaultindex}[loccit]{ | ||
235 | \edef\@tempa{#1} | ||
236 | \edef\@none{none} | ||
237 | \ifx\@tempa\@none | ||
238 | \no@indextrue | ||
239 | \else | ||
240 | \default@indextrue | ||
241 | \def\ic@dfltind{#1} | ||
242 | \fi | ||
243 | } | ||
231 | \ExecuteOptionsX{citecmd} | 244 | \ExecuteOptionsX{citecmd} |
232 | \ProcessOptionsX\relax | 245 | \ProcessOptionsX\relax |
233 | % \end{macrocode} | 246 | % \end{macrocode} |
234 | % The following packages are required by \package{icite}: | 247 | % The following packages are required by \package{icite}: |
235 | % \begin{macrocode} | 248 | % \begin{macrocode} |
236 | \RequirePackage{etoolbox} | ||
237 | \RequirePackage{xstring} | ||
238 | \RequirePackage{xparse} | 249 | \RequirePackage{xparse} |
250 | \RequirePackage{datatool} | ||
239 | \RequirePackage{usebib} | 251 | \RequirePackage{usebib} |
240 | % \end{macrocode} | 252 | % \end{macrocode} |
241 | % Define fields to be used by \package{icite}: | 253 | % Define fields to be used by \package{icite}: |
@@ -255,6 +267,27 @@ Running "make install" installs the files in the local TeX tree. | |||
255 | \def\get@bibentry#1#2{\@ifundefined{reuse@#1@#2}{} | 267 | \def\get@bibentry#1#2{\@ifundefined{reuse@#1@#2}{} |
256 | {\@nameuse{reuse@#1@#2}}} | 268 | {\@nameuse{reuse@#1@#2}}} |
257 | % \end{macrocode} | 269 | % \end{macrocode} |
270 | % Create a new database which \package{icite} will use to connect | ||
271 | % Bib\LaTeX\ \enquote*{subtypes} to indices. | ||
272 | % \begin{macrocode} | ||
273 | \DTLnewdb{icite@indices} | ||
274 | % \end{macrocode} | ||
275 | % \DescribeMacro{\IndexSubtypeAs} \cs{IndexSubtypeAs} take two mandatory | ||
276 | % arguments: 1. Any given keyword used to specify an | ||
277 | % \enquote*{entrysubtype} in the bibliographical database and 2. The | ||
278 | % index in which the authors matching that subtype must go. This | ||
279 | % command is to be found in the preamble only. | ||
280 | % \begin{macrocode} | ||
281 | \NewDocumentCommand{\IndexSubtypeAs}{m m}{% | ||
282 | \DTLnewrow{icite@indices} | ||
283 | \DTLnewdbentry{icite@indices}{subtype}{#1} | ||
284 | \DTLnewdbentry{icite@indices}{index}{#2} | ||
285 | } | ||
286 | \@onlypreamble\IndexSubtypeAs | ||
287 | \AtBeginDocument{ | ||
288 | \DTLifdbempty{icite@indices}{\IndexSubtypeAs{\relax}{\relax}}{} | ||
289 | } | ||
290 | % \end{macrocode} | ||
258 | % \DescribeMacro{\icite} \cs{icite} both inserts a formatted citation | 291 | % \DescribeMacro{\icite} \cs{icite} both inserts a formatted citation |
259 | % and an entry in the \emph{index locorum citatorum}. It is to be used | 292 | % and an entry in the \emph{index locorum citatorum}. It is to be used |
260 | % in place of any \hologo{BibTeX} or Bib\LaTeX\ citation command the | 293 | % in place of any \hologo{BibTeX} or Bib\LaTeX\ citation command the |
@@ -266,8 +299,8 @@ Running "make install" installs the files in the local TeX tree. | |||
266 | % Only standard citation commands are accepted, with the exception of | 299 | % Only standard citation commands are accepted, with the exception of |
267 | % qualified citation lists or so-called \enquote*{multicite} commands. | 300 | % qualified citation lists or so-called \enquote*{multicite} commands. |
268 | % \begin{macrocode} | 301 | % \begin{macrocode} |
269 | \NewDocumentCommand{\icite@index}{m}{\index{#1}} | ||
270 | \NewDocumentCommand{\icite}{o o m O{\ic@dfltcit}}{% | 302 | \NewDocumentCommand{\icite}{o o m O{\ic@dfltcit}}{% |
303 | \edef\@subtype{\get@bibentry{#3}{entrysubtype}}% | ||
271 | \edef\@author{\get@bibentry{#3}{author}}% | 304 | \edef\@author{\get@bibentry{#3}{author}}% |
272 | \edef\@indexauthor{\get@bibentry{#3}{indexauthor}}% | 305 | \edef\@indexauthor{\get@bibentry{#3}{indexauthor}}% |
273 | \edef\@sortname{\get@bibentry{#3}{sortname}}% | 306 | \edef\@sortname{\get@bibentry{#3}{sortname}}% |
@@ -295,17 +328,45 @@ Running "make install" installs the files in the local TeX tree. | |||
295 | \def\@usetitle{\@indextitle}% | 328 | \def\@usetitle{\@indextitle}% |
296 | \fi | 329 | \fi |
297 | \ifx\@indexsorttitle\empty | 330 | \ifx\@indexsorttitle\empty |
298 | \def\@sortedtitle{\@usetitle}% | 331 | \def\@sortedtitle{{\@usetitle}@\emph{\@usetitle}}% |
299 | \else | 332 | \else |
300 | \def\@sortedtitle{{\@indexsorttitle}@\@usetitle}% | 333 | \def\@sortedtitle{{\@indexsorttitle}@\emph{\@usetitle}}% |
301 | \fi | 334 | \fi |
302 | \IfNoValueTF{#1}% | 335 | \IfNoValueTF{#1}% |
303 | {\index{\@sortedauthor!\@sortedtitle}% | 336 | {\DTLforeach*{icite@indices}{\icite@subtype=subtype,\icite@index=index}{% |
304 | \csname #4\endcsname{#3}} | 337 | \ifx\icite@subtype\@subtype% |
338 | \index[\icite@index]{\@sortedauthor!\@sortedtitle}% | ||
339 | \else% | ||
340 | \ifno@index\else | ||
341 | \ifdefault@index% | ||
342 | \index[\ic@dfltind]{\@sortedauthor!\@sortedtitle}% | ||
343 | \else% | ||
344 | \index{\@sortedauthor!\@sortedtitle}% | ||
345 | \fi\fi\fi}% | ||
346 | \csname #4\endcsname{#3}% | ||
347 | } | ||
305 | {\IfNoValueTF{#2}% | 348 | {\IfNoValueTF{#2}% |
306 | {\index{\@sortedauthor!\@sortedtitle!#1}% | 349 | {\DTLforeach*{icite@indices}{\icite@subtype=subtype,\icite@index=index}{% |
350 | \ifx\icite@subtype\@subtype% | ||
351 | \index[\icite@index]{\@sortedauthor!\@sortedtitle!#1}% | ||
352 | \else% | ||
353 | \ifno@index\else | ||
354 | \ifdefault@index% | ||
355 | \index[\ic@dfltind]{\@sortedauthor!\@sortedtitle!#1}% | ||
356 | \else% | ||
357 | \index{\@sortedauthor!\@sortedtitle!#1}% | ||
358 | \fi\fi\fi}% | ||
307 | \csname #4\endcsname[{#1}]{#3}} | 359 | \csname #4\endcsname[{#1}]{#3}} |
308 | {\index{\@sortedauthor!\@sortedtitle!#2}% | 360 | {\DTLforeach*{icite@indices}{\icite@subtype=subtype,\icite@index=index}{% |
361 | \ifx\icite@subtype\@subtype% | ||
362 | \index[\icite@index]{\@sortedauthor!\@sortedtitle!#2}% | ||
363 | \else% | ||
364 | \ifno@index\else | ||
365 | \ifdefault@index% | ||
366 | \index[\ic@dfltind]{\@sortedauthor!\@sortedtitle!#2}% | ||
367 | \else% | ||
368 | \index{\@sortedauthor!\@sortedtitle!#2}% | ||
369 | \fi\fi\fi}% | ||
309 | \csname #4\endcsname[#1][{#2}]{#3}}% | 370 | \csname #4\endcsname[#1][{#2}]{#3}}% |
310 | }% | 371 | }% |
311 | } | 372 | } |