Began transition to natbib
[latex-mlastyle.git] / mlastyle.bst
index c7b9598e3507156a52e13b834892e7433e31b3ae..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
@@ -31,11 +32,16 @@ ENTRY
     type
     volume
     year
+    % New fields
+    url
+    accessdate
+    urlpath
+    version
   }
   { 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}
@@ -49,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
@@ -380,7 +389,7 @@ FUNCTION {format.date}
     }
     { month empty$
        'year
-       { month " " * year * }
+       { month "~" * year * }
       if$
     }
   if$
@@ -447,16 +456,19 @@ FUNCTION {format.number.series}
 % Changed edition to MLA abbreviation
 FUNCTION {format.edition}
 { edition empty$
-    { "" }
+    { version empty$
+       { "" }
+       { "Vers.~" version *}
+      if$
+    }
     { edition "l" change.case$ 's := edition 't :=
-      "" "9th" "ninth" "8th" "eighth" "7th" "seventh" "6th" "sixth" "5th" "fifth" "4th" "fourth" "3rd" "third" "2nd" "second" "1st" "first"
+      ""
+      "10th" "tenth" "9th" "ninth" "8th" "eighth" "7th" "seventh" "6th" "sixth"
+      "5th" "fifth" "4th" "fourth" "3rd" "third" "2nd" "second" "1st" "first"
       {duplicate$ empty$ { pop$ #0 }{ #1 } if$ }{ s = { 't := }{ pop$ } if$ }
       while$
-%        output.state mid.sentence =
-%      { edition "l" change.case$ " ed." * }
-%      { edition "t" change.case$ " ed." * }
-%      if$
-    t " ed." *
+      t " ed." *
+      "edition and version" version either.or.check
     }
   if$
 }
@@ -601,6 +613,22 @@ FUNCTION {format.tr.number}
   if$
 }
 
+FUNCTION {format.url}
+{ url empty$
+    { "" }
+    { accessdate empty$
+       { "There's a url but no accessdate in " cite$ * warning$ "" }
+       { accessdate " " * }
+      if$
+      "$<$\url{" * url * "}$>$" *
+      urlpath empty$
+       'skip$
+       { do.period " Path: " * urlpath * }
+      if$
+    }
+  if$
+}
+
 FUNCTION {format.article.crossref}
 { %key empty$
     %{ journal empty$
@@ -613,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 * "}" *
 }
 
@@ -659,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 * "}" *
 }
 
@@ -682,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 * "}" *
 }
 
@@ -790,6 +816,8 @@ FUNCTION {article}
     }
   if$
   new.block
+  format.url output
+  new.block
   note output
   fin.entry
 }
@@ -818,6 +846,8 @@ FUNCTION {book}
     }
   if$
   new.block
+  format.url output
+  new.block
   note output
   fin.entry
 }
@@ -862,6 +892,8 @@ FUNCTION {inbook}
       format.book.crossref output.nonnull
     }
   if$
+  new.block
+  format.url output
   note output
   fin.entry
 }
@@ -897,6 +929,8 @@ FUNCTION {incollection}
     }
   if$
   new.block
+  format.url output
+  new.block
   note output
   fin.entry
 }
@@ -942,6 +976,8 @@ FUNCTION {inproceedings}
     }
   if$
   new.block
+  format.url output
+  new.block
   note output
   fin.entry
 }
@@ -980,6 +1016,8 @@ FUNCTION {manual}
   if$
   format.date output
   new.block
+  format.url output
+  new.block
   note output
   fin.entry
 }
@@ -996,6 +1034,8 @@ FUNCTION {mastersthesis}
   address output
   format.date "year" output.check
   new.block
+  format.url output
+  new.block
   note output
   fin.entry
 }
@@ -1004,11 +1044,14 @@ FUNCTION {misc}
 { output.bibitem
   format.authors output
   title howpublished new.block.checkb
-  format.title output after.sentence 'output.state :=
-  howpublished new.block.checka
+  format.title output
+  new.block
+  %howpublished new.block.checka
   howpublished output
   format.date output
   new.block
+  format.url output
+  new.block
   note output
   fin.entry
   empty.misc.check
@@ -1026,6 +1069,8 @@ FUNCTION {phdthesis}
   address output
   format.date "year" output.check
   new.block
+  format.url output
+  new.block
   note output
   fin.entry
 }
@@ -1061,6 +1106,8 @@ FUNCTION {proceedings}
     }
   if$
   new.block
+  format.url output
+  new.block
   note output
   fin.entry
 }
@@ -1086,6 +1133,8 @@ FUNCTION {unpublished}
   new.block
   format.title "title" output.check
   new.block
+  format.url output
+  new.block
   note "note" output.check
   format.date output
   fin.entry
@@ -1317,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 := }
@@ -1409,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}