{ author.duplicate author.shared }
{ label }
-INTEGERS { output.state before.all mid.sentence after.sentence after.block after.title author.different author.last author.flast }
+INTEGERS { output.state before.all mid.sentence after.sentence after.block after.title author.different author.last author.flast citen.used url.used }
% Rearranged such that true values require capital letters
FUNCTION {init.consts}
#1 'author.last :=
#2 'author.flast :=
%#3 'author.firstlast :=
+
+ #0 'citen.used :=
+ #0 'url.used :=
}
STRINGS { s t u } % Added u
{ "There's a url but no accessdate in " cite$ * warning$ "" }
{ accessdate " " * }
if$
- "$<$" * url * "$>$" *
+ "$<$\url{" * url * "}$>$" *
urlpath empty$
'skip$
{ do.period " Path: " * urlpath * }
%if$
pages empty$ { " \citeN" } { " \citeN[" format.chapter.pages * "]" * } if$
"{" * crossref * "}" *
+ citen.used #1 + 'citen.used :=
}
FUNCTION {format.crossref.editor}
% }
% { format.crossref.editor * }
% if$
- %" \citeN{" * crossref * "}" *
pages empty$ { " \citeN" } { " \citeN[" format.chapter.pages * "]" * } if$
"{" * crossref * "}" *
+ citen.used #1 + 'citen.used :=
}
FUNCTION {format.incoll.inproc.crossref}
% }
% { "In " format.crossref.editor * }
% if$
-% " \citeN{" * crossref * "}" *
pages empty$ { " \citeN" } { " \citeN[" format.chapter.pages * "]" * } if$
"{" * crossref * "}" *
+ citen.used #1 + 'citen.used :=
}
FUNCTION {cite.title}
FUNCTION {forward.author.dup.check}
{
+ url empty$ 'skip$ { url.used #1 + 'url.used := } if$
+ crossref empty$ 'skip$ { citen.used #1 + 'citen.used := } if$
author empty$
{ editor empty$ { organization field.or.null 'a := }{ editor 'a :=} if$}
{ author 'a := }
%ITERATE {longest.label.pass}
FUNCTION {begin.bib}
-{ preamble$ empty$
+{
+ citen.used
+ { "\ifx\undefined\citeN\let\citeN\cite\fi" write$ newline$ }
+ 'skip$
+ if$
+ url.used
+ { "\ifx\undefined\url\let\url\relax\fi" write$ newline$ }
+ 'skip$
+ if$
+ preamble$ empty$
'skip$
{ preamble$ write$ newline$ }
if$
"\begin{thebibliography}{\rule{.5in}{0pt}}" write$ newline$
- "\ifx\undefined\citeN\let\citeN\cite\fi" write$ newline$
}
EXECUTE {begin.bib}