From 6e01df833d4597f0ed1626374c966ade890f7b4d Mon Sep 17 00:00:00 2001 From: Robert Alessi Date: Mon, 25 Feb 2019 19:34:35 +0100 Subject: introduced \icite --- icite.dtx | 73 ++++++++++++++++++++++++++++++++++++++++++++++----------------- 1 file 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. \keepsilent \askforoverwritefalse \preamble --------:| ----------------------------------------------------------------- - 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/ - -\endpreamble -\postamble Copyright (C) 2019 by Robert Alessi @@ -62,7 +53,7 @@ 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. -\endpostamble +\endpreamble \usedir{tex/latex/icite} \generate{ @@ -108,8 +99,8 @@ Running "make install" installs the files in the local TeX tree. \hypersetup{unicode=true, colorlinks, allcolors=blue, linktocpage=true, pdfauthor={Robert Alessi}, pdftitle={The icite package}, pdfcontactemail={alessi@robertalessi.net}, - pdfcontacturl={http://www.robertalessi.net/ekdosis}, - pdfcopyright={Copyright (C) 2018 Robert Alessi + pdfcontacturl={http://www.robertalessi.net/icite}, + pdfcopyright={Copyright (C) 2019 Robert Alessi . This document is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. To view a copy of this license, visit @@ -124,6 +115,8 @@ Running "make install" installs the files in the local TeX tree. \usepackage{newunicodechar} \newunicodechar{ǧ}{ǧ} % Old Standard does not include ǧ/Ǧ \newunicodechar{Ǧ}{Ǧ} % +\usepackage{csquotes} +\usepackage{hologo,metalogox} \usepackage{relsize} \usepackage{units} \usepackage{minted} @@ -240,6 +233,8 @@ Running "make install" installs the files in the local TeX tree. % \end{macrocode} % The following packages are required by \package{icite}: % \begin{macrocode} +\RequirePackage{etoolbox} +\RequirePackage{xstring} \RequirePackage{xparse} \RequirePackage{usebib} % \end{macrocode} @@ -247,6 +242,9 @@ Running "make install" installs the files in the local TeX tree. % \begin{macrocode} \define@reuse@key{author} \define@reuse@key{title} +\define@reuse@key{shorttitle} +\define@reuse@key{indextitle} +\define@reuse@key{indexsorttitle} % \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: @@ -254,18 +252,53 @@ Running "make install" installs the files in the local TeX tree. \def\get@bibentry#1#2{\@ifundefined{reuse@#1@#2}{} {\@nameuse{reuse@#1@#2}}} % \end{macrocode} -% \DescribeMacro{\icite} +% \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}}{% - \IfNoValueTF{#1} - {\index{\get@bibentry{#3}{author}!\emph{\get@bibentry{#3}{title}}}% + \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\@indextitle\empty + \ifx\@shorttitle\empty + \def\@usetitle{\@title}% + \else + \def\@usetitle{\@shorttitle}% + \fi + \else + \def\@usetitle{\@indextitle}% + \fi + \ifx\@indexsorttitle\empty + \IfNoValueTF{#1}% + {\index{\get@bibentry{#3}{author}!\@usetitle}% + \csname #4\endcsname{#3}} + {\IfNoValueTF{#2}% + {\index{\get@bibentry{#3}{author}!\@usetitle!#1}% + \csname #4\endcsname[{#1}]{#3}} + {\index{\get@bibentry{#3}{author}!\@usetitle!#2}% + \csname #4\endcsname[#1][{#2}]{#3}}% + }% + \else% + \IfNoValueTF{#1}% + {\index{\get@bibentry{#3}{author}!{\@indexsorttitle}@\@usetitle}% \csname #4\endcsname{#3}} - {\IfNoValueTF{#2} - {\index{\get@bibentry{#3}{author}!\emph{\get@bibentry{#3}{title}}!#1}% + {\IfNoValueTF{#2}% + {\index{\get@bibentry{#3}{author}!{\@indexsorttitle}@\@usetitle!#1}% \csname #4\endcsname[{#1}]{#3}} - {\index{\get@bibentry{#3}{author}!\emph{\get@bibentry{#3}{title}}!#2}% - \csname #4\endcsname[#1][{#2}]{#3}} - } + {\index{\get@bibentry{#3}{author}!{\@indexsorttitle}@\@usetitle!#2}% + \csname #4\endcsname[#1][{#2}]{#3}}% + }% + \fi% } % \end{macrocode} % \iffalse -- cgit v1.2.3