From c10cc18e325fd90ef6e5881f7c8c168ed808a7a9 Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Mon, 11 Mar 2019 15:26:31 +0100
Subject: let nobibengine option use shorthand field to insert citations

---
 icite.dtx | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

(limited to 'icite.dtx')

diff --git a/icite.dtx b/icite.dtx
index 8c843c8..e3acb10 100644
--- a/icite.dtx
+++ b/icite.dtx
@@ -1016,6 +1016,7 @@ Running "make install" installs the files in the local TeX tree.
 \define@reuse@key{indextitle}
 \define@reuse@key{indexsorttitle}
 \define@reuse@key{entrysubtype}
+\define@reuse@key{shorthand}
 %    \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:
@@ -1063,6 +1064,7 @@ Running "make install" installs the files in the local TeX tree.
 % qualified citation lists or so-called \enquote*{multicite} commands.
 %    \begin{macrocode}
 \NewDocumentCommand{\icite}{o o m O{\ic@dfltcit}}{%
+  \edef\@shorthand{\get@bibentry{#3}{shorthand}}%
   \edef\@subtype{\get@bibentry{#3}{entrysubtype}}%
   \edef\@author{\get@bibentry{#3}{author}}%
   \edef\@indexauthor{\get@bibentry{#3}{indexauthor}}%
@@ -1117,7 +1119,12 @@ Running "make install" installs the files in the local TeX tree.
         \index{\@sortedauthor!\@sortedtitle}%
         \fi\fi%
         \fi}}
-    \ifno@bibengine\@useauthor, \TitleStyle{\@usetitle}%
+    \ifno@bibengine
+    \ifx\@shorthand\empty%
+    \@useauthor, \TitleStyle{\@usetitle}%
+    \else%
+    \@shorthand%
+    \fi%
     \else%
     \csname #4\endcsname{#3}%
     \fi%
@@ -1144,7 +1151,12 @@ Running "make install" installs the files in the local TeX tree.
           \index{\@sortedauthor!\@sortedtitle!#1}%
           \fi\fi%
           \fi}}%
-      \ifno@bibengine\@useauthor, \TitleStyle{\@usetitle}, {#1}%
+      \ifno@bibengine
+      \ifx\@shorthand\empty%
+      \@useauthor, \TitleStyle{\@usetitle}, {#1}%
+      \else%
+      \@shorthand, {#1}%
+      \fi%
       \else%
       \csname #4\endcsname[{#1}]{#3}%
       \fi%
@@ -1170,7 +1182,12 @@ Running "make install" installs the files in the local TeX tree.
           \index{\@sortedauthor!\@sortedtitle!#2}%
           \fi\fi%
           \fi}}%
-      \ifno@bibengine #1 \@useauthor, \TitleStyle{\@usetitle}, {#2}%
+      \ifno@bibengine
+      \ifx\@shorthand\empty%
+      #1 \@useauthor, \TitleStyle{\@usetitle}, {#2}%
+      \else%
+      #1 \@shorthand, {#2}%
+      \fi
       \else%
       \csname #4\endcsname[#1][{#2}]{#3}%
       \fi%
-- 
cgit v1.2.3

