From 0e9519fa29b1c9c5abe2fe50bd53e253b65684fe Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Thu, 14 Mar 2019 15:19:53 +0100
Subject: not-a-bugfix: biblatex citation commands cannot be found inside \if
 ... \fi, otherwise autopunct becomes inoperative

---
 icite.dtx | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

(limited to 'icite.dtx')

diff --git a/icite.dtx b/icite.dtx
index 6415227..2b63455 100644
--- a/icite.dtx
+++ b/icite.dtx
@@ -194,6 +194,7 @@ Running "make install" installs the files in the local TeX tree.
 \documentclass{ltxdoc}
 \usepackage{filecontents}
 \begin{filecontents*}{\jobname.xdy}
+(merge-rule "\*" "" :eregexp)
 (markup-locclass-list :open "\tabto{3.5cm}" :sep ", ")
 \end{filecontents*}
 \begin{filecontents*}{\jobname.bib}
@@ -416,7 +417,7 @@ Running "make install" installs the files in the local TeX tree.
 %</driver>
 % \fi
 %
-% \CheckSum{316}
+% \CheckSum{0}
 %
 % \CharacterTable
 %  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -1028,6 +1029,11 @@ Running "make install" installs the files in the local TeX tree.
 \RequirePackage{datatool}
 \RequirePackage{usebib}
 %    \end{macrocode}
+% If |nobibengine| is set to true, then \cs{ic@dfltcit} will be
+% redefined by \cs{icite} to \cs{ic@nullcmd} which does nothing.
+%    \begin{macrocode}
+\NewDocumentCommand{\ic@nullcmd}{O{}O{}m}{}
+%    \end{macrocode}
 % Define fields to be used by \package{icite}:
 %    \begin{macrocode}
 \define@reuse@key{author}
@@ -1086,6 +1092,9 @@ 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\ic@argiv{#4}%
+  \edef\ic@null{ic@nullcmd}%
+  \ifno@bibengine\let\ic@argiv\ic@null\else\fi%
   \edef\@shorthand{\get@bibentry{#3}{shorthand}}%
   \edef\@subtype{\get@bibentry{#3}{entrysubtype}}%
   \edef\@author{\get@bibentry{#3}{author}}%
@@ -1148,8 +1157,8 @@ Running "make install" installs the files in the local TeX tree.
     \@shorthand%
     \fi%
     \else%
-    \csname #4\endcsname{#3}%
     \fi%
+    \csname\ic@argiv\endcsname{#3}%
   }
   {\IfNoValueTF{#2}%
     {\DTLifdbempty{icite@indices}{%
@@ -1180,8 +1189,8 @@ Running "make install" installs the files in the local TeX tree.
       \@shorthand, {#1}%
       \fi%
       \else%
-      \csname #4\endcsname[{#1}]{#3}%
       \fi%
+      \csname\ic@argiv\endcsname[{#1}]{#3}%
     }
     {\DTLifdbempty{icite@indices}{%
         \ifno@index\else
@@ -1211,8 +1220,8 @@ Running "make install" installs the files in the local TeX tree.
       #1 \@shorthand, {#2}%
       \fi
       \else%
-      \csname #4\endcsname[#1][{#2}]{#3}%
       \fi%
+      \csname\ic@argiv\endcsname[#1][{#2}]{#3}%
     }%
   }%
 }
-- 
cgit v1.2.3

