From 0e9519fa29b1c9c5abe2fe50bd53e253b65684fe Mon Sep 17 00:00:00 2001 From: Robert Alessi 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 --- Makefile | 8 ++++---- icite.dtx | 17 +++++++++++++---- samples/icite-biblatex.tex | 33 +++++++++++++++++++++++---------- samples/icite-nobiblatex.tex | 34 ++++++++++++++++++++++++---------- 4 files changed, 64 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index a628307..028aea7 100644 --- a/Makefile +++ b/Makefile @@ -26,13 +26,13 @@ $(NAME).pdf: $(NAME).dtx cp $(PWD)/samples/*.bib $(PWD)/TMP lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-biblatex.tex lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-biblatex.tex - texindy $(PWD)/TMP/pr-sources.idx + texindy -M $(PWD)/TMP/icite-biblatex.xdy $(PWD)/TMP/pr-sources.idx biber $(PWD)/TMP/icite-biblatex lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-biblatex.tex lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-biblatex.tex lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-nobiblatex.tex lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-nobiblatex.tex - texindy $(PWD)/TMP/pr-sources.idx + texindy -M $(PWD)/TMP/icite-nobiblatex.xdy $(PWD)/TMP/pr-sources.idx lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-nobiblatex.tex lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-nobiblatex.tex mv TMP/*.pdf samples/ @@ -42,13 +42,13 @@ samples: cp $(PWD)/samples/*.bib $(PWD)/TMP lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-biblatex.tex lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-biblatex.tex - texindy $(PWD)/TMP/pr-sources.idx + texindy -M $(PWD)/TMP/icite-biblatex.xdy $(PWD)/TMP/pr-sources.idx biber $(PWD)/TMP/icite-biblatex lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-biblatex.tex lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-biblatex.tex lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-nobiblatex.tex lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-nobiblatex.tex - texindy $(PWD)/TMP/pr-sources.idx + texindy -M $(PWD)/TMP/icite-nobiblatex.xdy $(PWD)/TMP/pr-sources.idx lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-nobiblatex.tex lualatex --output-dir=$(PWD)/TMP --shell-escape samples/icite-nobiblatex.tex mv TMP/*.pdf samples/ 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. % % \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}% }% }% } diff --git a/samples/icite-biblatex.tex b/samples/icite-biblatex.tex index e52cb8b..678f9f4 100644 --- a/samples/icite-biblatex.tex +++ b/samples/icite-biblatex.tex @@ -1,3 +1,8 @@ +\RequirePackage{filecontents} +\begin{filecontents*}{\jobname.xdy} +(merge-rule "\*" "" :eregexp) +(markup-locclass-list :open ": " :sep ", ") +\end{filecontents*} % Compile with --shell-escape \documentclass{article} \usepackage[english]{babel} @@ -20,7 +25,11 @@ \IndexSubtypeAs{ancient}{pr-sources} \bibinput{bibsample} -\usepackage[xindy]{imakeidx} +\usepackage{classics} +\newclassic{plat}{#1|#1|#1} +\newclassic{arist}{#1|\textit{#1}|#1} + +\usepackage[xindy,nonewpage]{imakeidx} \makeindex[name=pr-sources, title={Index locorum citatorum}] \usepackage[style=oxnotes]{biblatex} @@ -43,6 +52,10 @@ The relevant part of the preamble which is used here follows: \IndexSubtypeAs{ancient}{pr-sources} \bibinput{bibsample} +\usepackage{classics} +\newclassic{plat}{#1|#1|#1} +\newclassic{arist}{#1|\textit{#1}|#1} + \usepackage[xindy]{imakeidx} \makeindex[name=pr-sources, title={Index locorum citatorum}] @@ -65,19 +78,19 @@ The relevant part of the preamble which is used here follows: \section*{Body text} Plato, \emph{Laches}: first -citation\icite[179a1--4]{Plato:Laches}. And -another\icite[179c5--180a1]{Plato:Laches}, and -another\icite[181b5--181c3]{Plato:Laches}. +citation\icite[\plat{179}[a][1--4]]{Plato:Laches}. And +another\icite[\plat*{179}[c][5]{180}[a][1]]{Plato:Laches}, and +another\icite[\plat*{181}[b][5]{181}[c][3]]{Plato:Laches}. Plato, \emph{Theaetetus}: first -citation\icite[142c2--142d3]{Plato:Theaetetus}. And -another\icite[142d4--5]{Plato:Theaetetus}, and -another\icite[143b5]{Plato:Theaetetus}. +citation\icite[\plat*{142}[c][2]{142}[d][3]]{Plato:Theaetetus}. And +another\icite[\plat{142}[d][4--5]]{Plato:Theaetetus}, and +another\icite[\plat{143}[b][5]]{Plato:Theaetetus}. Aristotle, \emph{Politica}: first -citation\icite[1252a25--1252.b27]{Aristotle:Politica}. And -another\icite[1253a5]{Aristotle:Politica}, and -another\icite[1253a30--39]{Aristotle:Politica}. +citation\icite[\arist*{1252}[a][25]{1252}[b][27]]{Aristotle:Politica}. And +another\icite[\arist{1253}[a][5]]{Aristotle:Politica}, and +another\icite[\arist{1253}[a][30--39]]{Aristotle:Politica}. This passage should not be indexed\icite[44--78]{Reynolds.Wilson1994}. diff --git a/samples/icite-nobiblatex.tex b/samples/icite-nobiblatex.tex index 6893247..baf2973 100644 --- a/samples/icite-nobiblatex.tex +++ b/samples/icite-nobiblatex.tex @@ -1,3 +1,8 @@ +\RequirePackage{filecontents} +\begin{filecontents*}{\jobname.xdy} +(merge-rule "\*" "" :eregexp) +(markup-locclass-list :open ": " :sep ", ") +\end{filecontents*} % Compile with --shell-escape \documentclass{article} \usepackage[english]{babel} @@ -21,7 +26,11 @@ \IndexSubtypeAs{ancient}{pr-sources} \bibinput{bibsample} -\usepackage[xindy]{imakeidx} +\usepackage{classics} +\newclassic{plat}{#1|#1|#1} +\newclassic{arist}{#1|\textit{#1}|#1} + +\usepackage[xindy,nonewpage]{imakeidx} \makeindex[name=pr-sources, title={Index locorum citatorum}] \begin{document} @@ -42,6 +51,10 @@ The relevant part of the preamble which is used here follows: \IndexSubtypeAs{ancient}{pr-sources} \bibinput{bibsample} +\usepackage{classics} +\newclassic{plat}{#1|#1|#1} +\newclassic{arist}{#1|\textit{#1}|#1} + \usepackage[xindy]{imakeidx} \makeindex[name=pr-sources, title={Index locorum citatorum}] \end{Verbatim} @@ -61,19 +74,20 @@ The relevant part of the preamble which is used here follows: \section*{Body text} Plato, \emph{Laches}: first -citation.\footnote{\icite[179a1--4]{Plato:Laches}.} And -another,\footnote{\icite[179c5--180a1]{Plato:Laches}.} -and another.\footnote{\icite[181b5--c3]{Plato:Laches}.} +citation.\footnote{\icite[\plat{179}[a][1--4]]{Plato:Laches}.} And +another,\footnote{\icite[\plat*{179}[c][5]{180}[a][1]]{Plato:Laches}.} +and another.\footnote{\icite[\plat*{181}[b][5]{181}[c][3]]{Plato:Laches}.} Plato, \emph{Theaetetus}: first -citation.\footnote{\icite[142c2--d3]{Plato:Theaetetus}.} -And another,\footnote{\icite[142d4--5]{Plato:Theaetetus}.} -and another.\footnote{\icite[143b5]{Plato:Theaetetus}.} +citation.\footnote{\icite[\plat*{142}[c][2]{142}[d][3]]{Plato:Theaetetus}.} +And another,\footnote{\icite[\plat{142}[d][4--5]]{Plato:Theaetetus}.} +and another.\footnote{\icite[\plat{143}[b][5]]{Plato:Theaetetus}.} Aristotle, \emph{Politica}: first citation.\footnote{% - \icite[1252a25--b27]{Aristotle:Politica}.} And -another,\footnote{\icite[1253a5]{Aristotle:Politica}.} and -another.\footnote{\icite[1253a30--39]{Aristotle:Politica}.} + \icite[\arist*{1252}[a][25]{1252}[b][27]]{Aristotle:Politica}.} And +another,\footnote{\icite[\arist{1253}[a][5]]{Aristotle:Politica}.} +and another.\footnote{% + \icite[\arist{1253}[a][30--39]]{Aristotle:Politica}.} This passage should not be indexed.\footnote{\icite[44--78]{Reynolds.Wilson1994}.} -- cgit v1.2.3