Began transition to natbib
[latex-mlastyle.git] / mlastyle.bst
index f74f8fd7f2c5931097fb5d5d23c6b0e1a72f1225..15e90d09fa889752d02adc566cd8eedd151b3330 100644 (file)
@@ -1,4 +1,5 @@
-% BibTeX standard bibliography style `plain'
+% BibTeX bibliography style `mlastyle'
+% Based on BibTeX standard bibliography style `plain'
        % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
        % Copyright (C) 1985, all rights reserved.
        % Copying of this file is authorized only if either
@@ -40,7 +41,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 citealt.used url.used }
 
 % Rearranged such that true values require capital letters
 FUNCTION {init.consts}
@@ -54,6 +55,9 @@ FUNCTION {init.consts}
   #1 'author.last :=
   #2 'author.flast :=
   %#3 'author.firstlast :=
+
+  #0 'citealt.used :=
+  #0 'url.used :=
 }
 
 STRINGS { s t u } % Added u
@@ -616,7 +620,7 @@ FUNCTION {format.url}
        { "There's a url but no accessdate in " cite$ * warning$ "" }
        { accessdate " " * }
       if$
-      "$<$" * url * "$>$" *
+      "$<$\url{" * url * "}$>$" *
       urlpath empty$
        'skip$
        { do.period " Path: " * urlpath * }
@@ -637,7 +641,7 @@ FUNCTION {format.article.crossref}
     %}
     %{ "In " key * }
   %if$
-  pages empty$ { " \citeN" } { " \citeN[" format.chapter.pages * "]" * } if$
+  pages empty$ { " \citealt" } { " \citealt[" format.chapter.pages * "]" * } if$
   "{" * crossref * "}" *
 }
 
@@ -683,8 +687,7 @@ FUNCTION {format.book.crossref}
 %    }
 %    { format.crossref.editor * }
 %  if$
-  %" \citeN{" * crossref * "}" *
-  pages empty$ { " \citeN" } { " \citeN[" format.chapter.pages * "]" * } if$
+  pages empty$ { " \citealt" } { " \citealt[" format.chapter.pages * "]" * } if$
   "{" * crossref * "}" *
 }
 
@@ -706,8 +709,7 @@ FUNCTION {format.incoll.inproc.crossref}
 %    }
 %    { "In " format.crossref.editor * }
 %  if$
-%  " \citeN{" * crossref * "}" *
-  pages empty$ { " \citeN" } { " \citeN[" format.chapter.pages * "]" * } if$
+  pages empty$ { " \citealt" } { " \citealt[" format.chapter.pages * "]" * } if$
   "{" * crossref * "}" *
 }
 
@@ -1364,6 +1366,8 @@ FUNCTION {init.vars}
 
 FUNCTION {forward.author.dup.check}
 {
+  url empty$ 'skip$ { url.used #1 + 'url.used := } if$
+  crossref empty$ 'skip$ { citealt.used #1 + 'citealt.used := } if$
   author empty$
     { editor empty$ { organization field.or.null 'a := }{ editor 'a :=} if$}
     { author 'a := }
@@ -1456,12 +1460,20 @@ REVERSE {reverse.author}
 %ITERATE {longest.label.pass}
 
 FUNCTION {begin.bib}
-{ preamble$ empty$
+{
+  citealt.used
+    { "\ifx\undefined\citealt\let\citealt\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}