aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2019-02-25 19:34:35 +0100
committerRobert Alessi <alessi@robertalessi.net>2019-02-25 19:34:35 +0100
commit6e01df833d4597f0ed1626374c966ade890f7b4d (patch)
tree2d6451d47725e6e7eeeadb45268eba81e49c103e
parent2c38c4359a6f5653a2fdbfcebe128256f23dfee1 (diff)
downloadicite-6e01df833d4597f0ed1626374c966ade890f7b4d.tar.gz
introduced \icite
-rw-r--r--icite.dtx73
1 files changed, 53 insertions, 20 deletions
diff --git a/icite.dtx b/icite.dtx
index adfbde7..cd2fd38 100644
--- a/icite.dtx
+++ b/icite.dtx
@@ -28,15 +28,6 @@ Some text about the package: probably the same as the abstract.
28\keepsilent 28\keepsilent
29\askforoverwritefalse 29\askforoverwritefalse
30\preamble 30\preamble
31-------:| -----------------------------------------------------------------
32 icite:| Make Indices locorum citatorum
33 Author:| Robert Alessi
34 E-mail:| alessi@robertalessi.net
35License:| Released under the GNU General Public License v3 or later
36 See:| http://www.gnu.org/licenses/
37
38\endpreamble
39\postamble
40 31
41Copyright (C) 2019 by Robert Alessi <alessi@robertalessi.net> 32Copyright (C) 2019 by Robert Alessi <alessi@robertalessi.net>
42 33
@@ -62,7 +53,7 @@ Running "make" generates the derived files README, icite.pdf and icite.sty.
62Running "make inst" installs the files in the user's TeX tree. 53Running "make inst" installs the files in the user's TeX tree.
63Running "make install" installs the files in the local TeX tree. 54Running "make install" installs the files in the local TeX tree.
64 55
65\endpostamble 56\endpreamble
66 57
67\usedir{tex/latex/icite} 58\usedir{tex/latex/icite}
68\generate{ 59\generate{
@@ -108,8 +99,8 @@ Running "make install" installs the files in the local TeX tree.
108\hypersetup{unicode=true, colorlinks, allcolors=blue, 99\hypersetup{unicode=true, colorlinks, allcolors=blue,
109 linktocpage=true, pdfauthor={Robert Alessi}, pdftitle={The 100 linktocpage=true, pdfauthor={Robert Alessi}, pdftitle={The
110 icite package}, pdfcontactemail={alessi@robertalessi.net}, 101 icite package}, pdfcontactemail={alessi@robertalessi.net},
111 pdfcontacturl={http://www.robertalessi.net/ekdosis}, 102 pdfcontacturl={http://www.robertalessi.net/icite},
112 pdfcopyright={Copyright (C) 2018 Robert Alessi 103 pdfcopyright={Copyright (C) 2019 Robert Alessi
113 <alessi@robertalessi.net>. This document is licensed under the 104 <alessi@robertalessi.net>. This document is licensed under the
114 Creative Commons Attribution-ShareAlike 4.0 International 105 Creative Commons Attribution-ShareAlike 4.0 International
115 License. To view a copy of this license, visit 106 License. To view a copy of this license, visit
@@ -124,6 +115,8 @@ Running "make install" installs the files in the local TeX tree.
124\usepackage{newunicodechar} 115\usepackage{newunicodechar}
125\newunicodechar{ǧ}{ǧ} % Old Standard does not include ǧ/Ǧ 116\newunicodechar{ǧ}{ǧ} % Old Standard does not include ǧ/Ǧ
126\newunicodechar{Ǧ}{Ǧ} % 117\newunicodechar{Ǧ}{Ǧ} %
118\usepackage{csquotes}
119\usepackage{hologo,metalogox}
127\usepackage{relsize} 120\usepackage{relsize}
128\usepackage{units} 121\usepackage{units}
129\usepackage{minted} 122\usepackage{minted}
@@ -240,6 +233,8 @@ Running "make install" installs the files in the local TeX tree.
240% \end{macrocode} 233% \end{macrocode}
241% The following packages are required by \package{icite}: 234% The following packages are required by \package{icite}:
242% \begin{macrocode} 235% \begin{macrocode}
236\RequirePackage{etoolbox}
237\RequirePackage{xstring}
243\RequirePackage{xparse} 238\RequirePackage{xparse}
244\RequirePackage{usebib} 239\RequirePackage{usebib}
245% \end{macrocode} 240% \end{macrocode}
@@ -247,6 +242,9 @@ Running "make install" installs the files in the local TeX tree.
247% \begin{macrocode} 242% \begin{macrocode}
248\define@reuse@key{author} 243\define@reuse@key{author}
249\define@reuse@key{title} 244\define@reuse@key{title}
245\define@reuse@key{shorttitle}
246\define@reuse@key{indextitle}
247\define@reuse@key{indexsorttitle}
250% \end{macrocode} 248% \end{macrocode}
251% This is the same as \cs{usebibentry} from \package{ebib}, but it 249% This is the same as \cs{usebibentry} from \package{ebib}, but it
252% does not return an error if the entry field is not found: 250% does not return an error if the entry field is not found:
@@ -254,18 +252,53 @@ Running "make install" installs the files in the local TeX tree.
254\def\get@bibentry#1#2{\@ifundefined{reuse@#1@#2}{} 252\def\get@bibentry#1#2{\@ifundefined{reuse@#1@#2}{}
255 {\@nameuse{reuse@#1@#2}}} 253 {\@nameuse{reuse@#1@#2}}}
256% \end{macrocode} 254% \end{macrocode}
257% \DescribeMacro{\icite} 255% \DescribeMacro{\icite} \cs{icite} both inserts a formatted citation
256% and an entry in the \emph{index locorum citatorum}. It is to be used
257% in place of any \hologo{BibTeX} or Bib\LaTeX\ citation command the
258% syntax of which is
259% \cs{command}\oarg{pre}\oarg{post}\marg{key}. \cs{icite} further
260% accepts an optional argument should one wish to specify the
261% citation command to be used, like so:\\
262% \cs{icite}\oarg{pre}\oarg{post}\marg{key}\oarg{command}\\
263% Only standard citation commands are accepted, with the exception of
264% qualified citation lists or so-called \enquote*{multicite} commands.
258% \begin{macrocode} 265% \begin{macrocode}
266\NewDocumentCommand{\icite@index}{m}{\index{#1}}
259\NewDocumentCommand{\icite}{o o m O{\ic@dfltcit}}{% 267\NewDocumentCommand{\icite}{o o m O{\ic@dfltcit}}{%
260 \IfNoValueTF{#1} 268 \edef\@indexsorttitle{\get@bibentry{#3}{indexsorttitle}}%
261 {\index{\get@bibentry{#3}{author}!\emph{\get@bibentry{#3}{title}}}% 269 \edef\@indextitle{\get@bibentry{#3}{indextitle}}%
270 \edef\@shorttitle{\get@bibentry{#3}{shorttitle}}%
271 \edef\@title{\get@bibentry{#3}{title}}%
272 \ifx\@indextitle\empty
273 \ifx\@shorttitle\empty
274 \def\@usetitle{\@title}%
275 \else
276 \def\@usetitle{\@shorttitle}%
277 \fi
278 \else
279 \def\@usetitle{\@indextitle}%
280 \fi
281 \ifx\@indexsorttitle\empty
282 \IfNoValueTF{#1}%
283 {\index{\get@bibentry{#3}{author}!\@usetitle}%
284 \csname #4\endcsname{#3}}
285 {\IfNoValueTF{#2}%
286 {\index{\get@bibentry{#3}{author}!\@usetitle!#1}%
287 \csname #4\endcsname[{#1}]{#3}}
288 {\index{\get@bibentry{#3}{author}!\@usetitle!#2}%
289 \csname #4\endcsname[#1][{#2}]{#3}}%
290 }%
291 \else%
292 \IfNoValueTF{#1}%
293 {\index{\get@bibentry{#3}{author}!{\@indexsorttitle}@\@usetitle}%
262 \csname #4\endcsname{#3}} 294 \csname #4\endcsname{#3}}
263 {\IfNoValueTF{#2} 295 {\IfNoValueTF{#2}%
264 {\index{\get@bibentry{#3}{author}!\emph{\get@bibentry{#3}{title}}!#1}% 296 {\index{\get@bibentry{#3}{author}!{\@indexsorttitle}@\@usetitle!#1}%
265 \csname #4\endcsname[{#1}]{#3}} 297 \csname #4\endcsname[{#1}]{#3}}
266 {\index{\get@bibentry{#3}{author}!\emph{\get@bibentry{#3}{title}}!#2}% 298 {\index{\get@bibentry{#3}{author}!{\@indexsorttitle}@\@usetitle!#2}%
267 \csname #4\endcsname[#1][{#2}]{#3}} 299 \csname #4\endcsname[#1][{#2}]{#3}}%
268 } 300 }%
301 \fi%
269} 302}
270% \end{macrocode} 303% \end{macrocode}
271% \iffalse 304% \iffalse