Added call to \url{}
[latex-mlastyle.git] / mlastyle.bst
index f74f8fd7f2c5931097fb5d5d23c6b0e1a72f1225..f705a3204b04410f7726e8697ddb54c1eab3b85f 100644 (file)
@@ -40,7 +40,7 @@ ENTRY
   { 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}
@@ -54,6 +54,9 @@ FUNCTION {init.consts}
   #1 'author.last :=
   #2 'author.flast :=
   %#3 'author.firstlast :=
+
+  #0 'citen.used :=
+  #0 'url.used :=
 }
 
 STRINGS { s t u } % Added u
@@ -616,7 +619,8 @@ FUNCTION {format.url}
        { "There's a url but no accessdate in " cite$ * warning$ "" }
        { accessdate " " * }
       if$
-      "$<$" * url * "$>$" *
+      "$<$\url{" * url * "}$>$" *
+      url.used #1 + 'url.used :=
       urlpath empty$
        'skip$
        { do.period " Path: " * urlpath * }
@@ -639,6 +643,7 @@ FUNCTION {format.article.crossref}
   %if$
   pages empty$ { " \citeN" } { " \citeN[" format.chapter.pages * "]" * } if$
   "{" * crossref * "}" *
+  citen.used #1 + 'citen.used :=
 }
 
 FUNCTION {format.crossref.editor}
@@ -683,9 +688,9 @@ FUNCTION {format.book.crossref}
 %    }
 %    { 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}
@@ -706,9 +711,9 @@ 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}
@@ -1456,12 +1461,20 @@ REVERSE {reverse.author}
 %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}