aboutsummaryrefslogtreecommitdiff
path: root/icite.dtx
blob: db2d34b8edc84b23a528a9b4a6de83fc730900e1 (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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
% \iffalse meta-comment
% vim: textwidth=75
%<*internal>
\iffalse
%</internal>
%<*readme>
|
-------:| -----------------------------------------------------------------
  icite:| Make Indices locorum citatorum
 Author:| Robert Alessi
 E-mail:| alessi@robertalessi.net
License:| Released under the GNU General Public License v3 or later
    See:| http://www.gnu.org/licenses/


Short description:
Some text about the package: probably the same as the abstract.
%</readme>
%<*internal>
\fi
\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
  \expandafter\begingroup
\fi
%</internal>
%<*install>
\input docstrip.tex
\keepsilent
\askforoverwritefalse
\preamble

Copyright (C) 2019 by Robert Alessi <alessi@robertalessi.net>

Please send error reports and suggestions for improvements to Robert
Alessi <alessi@robertalessi.net>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see
<http://www.gnu.org/licenses/>.

This work consists of the file icite.dtx and a Makefile.
Running "make" generates the derived files README, icite.pdf and icite.sty.
Running "make inst" installs the files in the user's TeX tree.
Running "make install" installs the files in the local TeX tree.

\endpreamble

\usedir{tex/latex/icite}
\generate{
  \file{\jobname.sty}{\from{\jobname.dtx}{package}}
}
%</install>
%<install>\endbatchfile
%<*internal>
\usedir{source/latex/icite}
\generate{
  \file{\jobname.ins}{\from{\jobname.dtx}{install}}
}
\nopreamble\nopostamble
\usedir{doc/latex/icite}
\generate{
  \file{README.txt}{\from{\jobname.dtx}{readme}}
}
\ifx\fmtname\nameofplainTeX
  \expandafter\endbatchfile
\else
  \expandafter\endgroup
\fi
%</internal>
% \fi
%
% \iffalse
%<*driver>
\ProvidesFile{icite.dtx}
%</driver>
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{icite}
%<*package>
    [2019/02/22 v1.00 Make Indices locorum citatorum]
%</package>
%<*driver>
\documentclass{ltxdoc}
\usepackage[letterpaper,margin=25mm,left=50mm,nohead]{geometry}
\usepackage{\jobname}
\usepackage{metalogox}
\usepackage{hyperxmp}
\usepackage{uri}
\usepackage[numbered]{hypdoc}
\hypersetup{unicode=true, colorlinks, allcolors=blue,
  linktocpage=true, pdfauthor={Robert Alessi}, pdftitle={The
    icite package}, pdfcontactemail={alessi@robertalessi.net},
  pdfcontacturl={http://www.robertalessi.net/icite},
  pdfcopyright={Copyright (C) 2019 Robert Alessi
    <alessi@robertalessi.net>. This document is licensed under the
    Creative Commons Attribution-ShareAlike 4.0 International
    License. To view a copy of this license, visit
    http://creativecommons.org/licenses/by-sa/4.0/ or send a letter to
    Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.},
  pdflicenseurl={https://creativecommons.org/licenses/by-sa/4.0/legalcode},
  pdfmetalang={en-US}, pdftype={Text}, pdfkeywords={bibtex, biblatex,
    indexing}}
\usepackage[lot]{multitoc}
\usepackage{fontspec}
\setmainfont{Old Standard}[RawFeature={+ss05;+ss06}]
\usepackage{newunicodechar}
\newunicodechar{ǧ}{ǧ} % Old Standard does not include ǧ/Ǧ
\newunicodechar{Ǧ}{Ǧ} %
\usepackage{csquotes}
\usepackage{hologo,metalogox}
\usepackage{relsize}
\usepackage{units}
\usepackage{minted}
\usepackage[contents]{colordoc}
\newcommand{\package}[1]{\textsf{#1}\index{#1=#1 (package)}}
\usepackage{tikz}
\usepackage[breakable, skins, xparse, minted]{tcolorbox}
\tcbset{colback=white, boxrule=.15mm, colframe=red!50!white, left=6mm,
  breakable}
\usepackage{etoc}
\etocsettocdepth{paragraph}
\newcommand{\icitetableofcontents}{%
  \begingroup
  \etocsetstyle{section}{}{}
  {\etocsavedsectiontocline{%
      \numberline{\etocnumber}\etocname}{\etocpage}}{}
  \etocsetstyle{subsection}{}{}
  {\etocsavedsubsectiontocline{%
      \numberline{\etocnumber}\etocname}{\etocpage}}{}%
  \etocsetstyle{subsubsection}{}{}
  {\etocsavedsubsubsectiontocline{%
      \numberline{\etocnumber}\etocname}{\etocpage}}{}%
  \etocsetstyle{paragraph}{}{\leftskip2cm\rightskip 2.2em \parfillskip
    0pt plus 1fil\relax \nobreak}
  {\noindent\etocname{} \etocpage{} }{\par}%
  \etocmulticolstyle[2]{\section*{Contents}}
  \pdfbookmark[1]{Contents}{toc}
  \tableofcontents
  \endgroup}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
%\OnlyDescription
\begin{document}
  \DocInput{\jobname.dtx}
 \PrintChanges
 \PrintIndex
\end{document}
%</driver>
% \fi
%
% \GetFileInfo{\jobname.dtx}
% \DoNotIndex{\newcommand,\newenvironment}
%
% \title{\tcbox[colframe=black, enhanced, tikznode, drop lifted
% shadow, colback=white, boxrule=.25mm]{%
% The \textsf{icite} package\\
% \emph{Indices locorum citatorum}\\
% \fileversion\ --- \filedate}}
%  
% \author{Robert Alessi \\
% \href{mailto:alessi@robertalessi.net?Subject=icite package}%
% {\texttt{alessi@robertalessi.net}}}
% 
% \date{}
%
% \maketitle
% \footnotesize
% \icitetableofcontents
% \normalsize
%
%\changes{v1.00}{2019/02/22}{First public release}
%
% \begin{abstract}
% ==== Put abstract text here. ====
% \end{abstract}
%
% \section{Usage}
%
% ==== Put descriptive text here. ====
%
% \DescribeMacro{\dummyMacro}
% This macro does nothing.\index{doing nothing|usage} It is merely an
% example.  If this were a real macro, you would put a paragraph here
% describing what the macro is supposed to do, what its mandatory and
% optional arguments are, and so forth.
% \DescribeEnv{dummyEnv}
% This environment does nothing.  It is merely an example.
% If this were a real environment, you would put a paragraph here
% describing what the environment is supposed to do, what its
% mandatory and optional arguments are, and so forth.
%\iffalse
%<*example>
%\fi
\begin{tcblisting}{minted options=linenos}
  \emph{tchic}
\end{tcblisting}
%\iffalse
%</example>
%\fi
%\iffalse
%<*example>
%\fi
\begin{tcblisting}{minted options=linenos, listing only}
\vroum[tchic]{tchic}
\end{tcblisting}
%\iffalse
%</example>
%\fi
%
%\StopEventually{}
%
% \section{Implementation}
%
% \iffalse
%<*package>
% \fi
% Declare the global options, and define them:
%    \begin{macrocode}
\RequirePackage{xkeyval}
\DeclareOptionX{citecmd}[cite]{\def\ic@dfltcit{#1}}
\ExecuteOptionsX{citecmd}
\ProcessOptionsX\relax
%    \end{macrocode}
% The following packages are required by \package{icite}:
%    \begin{macrocode}
\RequirePackage{etoolbox}
\RequirePackage{xstring}
\RequirePackage{xparse}
\RequirePackage{usebib}
%    \end{macrocode}
% Define fields to be used by \package{icite}:
%    \begin{macrocode}
\define@reuse@key{author}
\define@reuse@key{indexauthor}
\define@reuse@key{sortname}
\define@reuse@key{title}
\define@reuse@key{shorttitle}
\define@reuse@key{indextitle}
\define@reuse@key{indexsorttitle}
\define@reuse@key{entrysubtype}
%    \end{macrocode}
% This is the same as \cs{usebibentry} from \package{ebib}, but it
% does not return an error if the entry field is not found:
%    \begin{macrocode}
\def\get@bibentry#1#2{\@ifundefined{reuse@#1@#2}{}
  {\@nameuse{reuse@#1@#2}}}
%    \end{macrocode}
% \DescribeMacro{\icite} \cs{icite} both inserts a formatted citation
% and an entry in the \emph{index locorum citatorum}. It is to be used
% in place of any \hologo{BibTeX} or Bib\LaTeX\ citation command the
% syntax of which is
% \cs{command}\oarg{pre}\oarg{post}\marg{key}. \cs{icite} further
% accepts an optional argument should one wish to specify the
% citation command to be used, like so:\\
% \cs{icite}\oarg{pre}\oarg{post}\marg{key}\oarg{command}\\
% Only standard citation commands are accepted, with the exception of
% qualified citation lists or so-called \enquote*{multicite} commands.
%    \begin{macrocode}
\NewDocumentCommand{\icite@index}{m}{\index{#1}}
\NewDocumentCommand{\icite}{o o m O{\ic@dfltcit}}{%
  \edef\@author{\get@bibentry{#3}{author}}%
  \edef\@indexauthor{\get@bibentry{#3}{indexauthor}}%
  \edef\@sortname{\get@bibentry{#3}{sortname}}%
  \edef\@indexsorttitle{\get@bibentry{#3}{indexsorttitle}}%
  \edef\@indextitle{\get@bibentry{#3}{indextitle}}%
  \edef\@shorttitle{\get@bibentry{#3}{shorttitle}}%
  \edef\@title{\get@bibentry{#3}{title}}%
  \ifx\@indexauthor\empty
      \def\@useauthor{\@author}%
    \else
      \def\@useauthor{\@indexauthor}%
    \fi
  \ifx\@sortname\empty
    \def\@sortedauthor{\@useauthor}%
  \else
    \def\@sortedauthor{{\@sortname}@\@useauthor}%
  \fi
  \ifx\@indextitle\empty
    \ifx\@shorttitle\empty
      \def\@usetitle{\@title}%
    \else
      \def\@usetitle{\@shorttitle}%
    \fi
  \else
    \def\@usetitle{\@indextitle}%
  \fi
  \ifx\@indexsorttitle\empty
    \def\@sortedtitle{\@usetitle}%
  \else
    \def\@sortedtitle{{\@indexsorttitle}@\@usetitle}%
  \fi
  \IfNoValueTF{#1}%
  {\index{\@sortedauthor!\@sortedtitle}%
    \csname #4\endcsname{#3}}
  {\IfNoValueTF{#2}%
    {\index{\@sortedauthor!\@sortedtitle!#1}%
      \csname #4\endcsname[{#1}]{#3}}
    {\index{\@sortedauthor!\@sortedtitle!#2}%
      \csname #4\endcsname[#1][{#2}]{#3}}%
  }%
}
%    \end{macrocode}
% \iffalse
%</package>
% \fi
%\Finale
\endinput