Added Id keyword
authorTim Pope <code@tpope.net>
Sat, 22 Nov 2003 05:54:34 +0000 (05:54 +0000)
committerTim Pope <code@tpope.net>
Sat, 22 Nov 2003 05:54:34 +0000 (05:54 +0000)
Updated copyright
Changed accessdate to urldate
Created and began using selective.enquote
Added support for preface, etc.
Stopped attempting to uppercase braces
Removed several unnecessary functions
Added abbreviations for revised and abridged editions
Added support for dictionary definitions
Switched to underlining booklet titles
Began purifying full author citation key
Unified crossrefs

mlastyle.bst

index 0beb5e44a7e513998abbf89fbc0e1b5ae9a13999..fb0778a5d1b1b3177b361ef0f5b9c49ba8cd2dfc 100644 (file)
@@ -1,13 +1,14 @@
+% $Id: mlastyle.bst,v 1.12 2003-11-22 05:54:34 tpope Exp $
 % 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.
+       % Copyright (C) 2003 Tim Pope, all rights reserved.
        % Copying of this file is authorized only if either
        % (1) you make absolutely no changes to your copy, including name, or
        % (2) if you do make changes, you name it something other than
        % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst.
        % This restriction helps ensure that all standard styles are identical.
-       % The file btxbst.doc has the documentation for this style.
+       % The file mlastyle.dvi has the documentation for this style.
 
 ENTRY
   { address
@@ -34,6 +35,7 @@ ENTRY
     year
     % New fields
     url
+    urldate
     accessdate
     urlpath
     version
@@ -61,6 +63,7 @@ FUNCTION {init.consts}
   #0 'citealp.used :=
   #0 'url.used :=
   " \ \ \ \ \unskip\unskip\unskip\unskip\unskip " 'empty.title :=
+  "" 'empty.title :=
 }
 
 FUNCTION {not}
@@ -84,7 +87,7 @@ FUNCTION {or}
 INTEGERS {chars i j}
 
 % text.length$ does not include braces
-% ...this is probably unnecessary
+% ...this function is probably unnecessary
 FUNCTION {num.chars}
 {
   #0 'chars :=
@@ -240,6 +243,11 @@ FUNCTION {field.or.null}
   if$
 }
 
+FUNCTION {sortify}
+{ purify$
+  "l" change.case$
+}
+
 FUNCTION {emphasize}
 { duplicate$ empty$
     { pop$ "" }
@@ -279,6 +287,10 @@ FUNCTION {enquote}
          i #1 + 'i :=
        }
       while$
+      j #1 =
+       { "odd number of quotation marks in " cite$ * warning$ }
+       'skip$
+      if$
       duplicate$ #1 #1 substring$ "`" =
        { "``\thinspace" swap$ * }
        { "``" swap$ *}
@@ -291,6 +303,19 @@ FUNCTION {enquote}
   if$
 }
 
+FUNCTION {selective.enquote}
+{ field.or.null duplicate$ sortify 's :=
+  s #1 #8 substring$ duplicate$ "rev. of " = swap$ "rev.~of " = or
+  s #1 #9 substring$ "rev.\ of " = or
+  s "introduction" = or
+  s "preface" = or
+  s "forward" = or
+  s "afterward" = or
+    'skip$
+    'enquote
+  if$
+}
+
 INTEGERS { nameptr namesleft numnames }
 
 FUNCTION {format.names.custom}
@@ -335,8 +360,12 @@ FUNCTION {format.names.beginning}
     { namesleft #0 > }
     { nameptr #1 =
        { s nameptr "{vv~}{ll}{, ff}{, jj}" format.name$
-         duplicate$ #1 #1 substring$ "u" change.case$ swap$
-         #2 global.max$ substring$ * 't := }
+         duplicate$ #1 #1 substring$ duplicate$ "{" =
+           'skip$
+           { "u" change.case$ }
+         if$
+         swap$ #2 global.max$ substring$ * 't :=
+       }
        { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := }
       if$
       nameptr #1 >
@@ -413,7 +442,7 @@ FUNCTION {format.publisher}
 
 % Changed to preserve case and use quotes
 FUNCTION {format.title}
-{ title enquote
+{ title selective.enquote
 }
 
 FUNCTION {n.dashify}
@@ -458,7 +487,7 @@ FUNCTION {format.date}
   if$
 }
 
-INTEGERS {xx}
+%INTEGERS {xx}
 FUNCTION {format.btitle}
 { title emphasize
   %title num.chars int.to.str$ top$
@@ -514,13 +543,6 @@ FUNCTION {format.bvolume.or.num.series}
   if$
 }
 
-FUNCTION {format.number.series}
-{ volume empty$
-    { "" }
-    { "" }
-  if$
-}
-
 % Changed edition to MLA abbreviation
 FUNCTION {format.edition}
 { edition empty$
@@ -529,13 +551,14 @@ FUNCTION {format.edition}
        { "Vers.~" version *}
       if$
     }
-    { edition "l" change.case$ 's := edition 't :=
+    { edition sortify 's := edition 't :=
       ""
       "10th" "tenth" "9th" "ninth" "8th" "eighth" "7th" "seventh" "6th" "sixth"
       "5th" "fifth" "4th" "fourth" "3rd" "third" "2nd" "second" "1st" "first"
+      "Rev." "revised" "Abr." "abridged"
       {duplicate$ empty$ { pop$ #0 }{ #1 } if$ }{ s = { 't := }{ pop$ } if$ }
       while$
-      t " ed." *
+      t "\ ed." *
       "edition and version" version either.or.check
     }
   if$
@@ -626,6 +649,8 @@ FUNCTION {format.vol.num.pages}
 % chapter might be useful if type is set to "pars."
 FUNCTION {format.chapter.pages}
 { chapter empty$
+  type field.or.null sortify duplicate$ "def." = swap$ "definition" = or
+  or
     'format.pages
     { type empty$
        { "Chapter" }
@@ -640,17 +665,6 @@ FUNCTION {format.chapter.pages}
   if$
 }
 
-FUNCTION {format.in.ed.booktitle}
-{ booktitle empty$
-    { "" }
-    { editor empty$
-       { "In " booktitle emphasize * }
-       { booktitle emphasize add.period$ format.editors.mid * }
-      if$
-    }
-  if$
-}
-
 FUNCTION {empty.misc.check}
 { author empty$ title empty$ howpublished empty$
   month empty$ year empty$ note empty$
@@ -684,11 +698,16 @@ FUNCTION {format.tr.number}
 FUNCTION {format.url}
 { url empty$
     { "" }
-    { accessdate empty$
-       { "There's a url but no accessdate in " cite$ * warning$ "" }
-       { accessdate " " * }
+    { urldate empty$
+       { accessdate empty$
+           { "there's a url but no urldate in " cite$ * warning$ "\today" }
+           { "accessdate in " cite$ * " depreciated; use urldate instead" *
+             warning$ accessdate }
+           if$
+       }
+       { urldate }
       if$
-      "$<$\url{" * url * "}$>$" *
+      " $<$\url{" * url * "}$>$" *
       urlpath empty$
        'skip$
        { do.period " Path: " * urlpath * }
@@ -697,89 +716,12 @@ FUNCTION {format.url}
   if$
 }
 
-FUNCTION {format.article.crossref}
-{ %key empty$
-    %{ journal empty$
-       %{ "need key or journal for " cite$ * " to crossref " * crossref *
-       %  warning$
-       %  ""
-       %}
-       %{ "In {\em " journal * "\/}" * }
-      %if$
-    %}
-    %{ "In " key * }
-  %if$
-  pages empty$ { "\citealp" } { "\citealp[" format.chapter.pages * "]" * } if$
-  "{" * crossref * "}" *
-}
-
-FUNCTION {format.crossref.editor}
-{ editor #1 "{vv~}{ll}" format.name$
-  editor num.names$ duplicate$
-  #2 >
-    { pop$ " et~al." * }
-    { #2 <
-       'skip$
-       { editor #2 "{ff }{vv }{ll}{, jj}" format.name$ "others" =
-           { " et~al." * }
-           { " and " * editor #2 "{vv~}{ll}" format.name$ * }
-         if$
-       }
-      if$
-    }
-  if$
-}
-
-FUNCTION {format.book.crossref}
-{% volume empty$
-%    { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
-%      "In "
-%    }
-%    { "Vol." volume tie.or.space.connect add.period$
-%    }
-%  if$
-%  editor empty$
-%  editor field.or.null author field.or.null =
-%  or
-%    { key empty$
-%      { series empty$
-           %{ "need editor, key, or series for " cite$ * " to crossref " *
-           %  crossref * warning$
-           %  "" *
-           %}
-           %{ "{\em " * series * "\/}" * }
-         %if$
-%      }
-%      { key * }
-%      if$
-%    }
-%    { format.crossref.editor * }
-%  if$
+FUNCTION {format.crossref}
+{
   pages empty$ { "\citealp" } { "\citealp[" format.chapter.pages * "]" * } if$
   "{" * crossref * "}" *
 }
 
-FUNCTION {format.incoll.inproc.crossref}
-{% editor empty$
-%  editor field.or.null author field.or.null =
-%  or
-%    { key empty$
-%      { booktitle empty$
-%          { "need editor, key, or booktitle for " cite$ * " to crossref " *
-%            crossref * warning$
-%            ""
-%          }
-%          { "In {\em " booktitle * "\/}" * }
-%        if$
-%      }
-%      { "In " key * }
-%      if$
-%    }
-%    { "In " format.crossref.editor * }
-%  if$
-  pages empty$ { "\citealp" } { "\citealp[" format.chapter.pages * "]" * } if$
-  "{" * crossref * "}" *
-}
 
 FUNCTION {cite.title}
 { title empty$ journal empty$ not and
@@ -788,11 +730,12 @@ FUNCTION {cite.title}
        { "empty title and key in " cite$ * warning$ "" }
        { key empty$ {title}{key} if$
          type$ "book" =
+         type$ "booklet" =
          type$ "inbook" =
          type$ "manual" =
          type$ "phdthesis" =
          type$ "proceedings" =
-         or or or or
+         or or or or or
            { emphasize }
            { type$ "article" =
              %type$ "booklet" =
@@ -803,7 +746,7 @@ FUNCTION {cite.title}
              type$ "techreport" =
              type$ "unpublished" =
              or or or or or or
-               { enquote }
+               { selective.enquote }
                {}
              if$
            }
@@ -848,7 +791,7 @@ FUNCTION {cite.label}
       s
       "(" * empty.title *
       author.duplicate { cite.title * }{} if$
-      ")" * swap$ "{ff~}{vv~}{ll}{, jj}" format.names.custom *
+      ")" * swap$ "{ff~}{vv~}{ll}{, jj}" format.names.custom purify$ *
     }
   if$
       %}
@@ -878,13 +821,28 @@ FUNCTION {article}
   format.title "title" output.check
   new.block
   crossref missing$
-    { journal emphasize "journal" output.check after.title 'output.state :=
-      address empty$ skip$ { "[" address * "]" * output } if$
+    { type empty$
+       'skip$
+       { type sortify "review" =
+           { "Rev.\ of " booktitle emphasize * 
+           "booktitle" output.check new.block
+           }
+           { "Ignoring invalid type in " cite$ warning$ }
+         if$
+       }
+      if$
+      journal emphasize "journal" output.check after.title 'output.state :=
+      address empty$
+       'skip$
+       { "[" address * "]" * output
+         after.title 'output.state :=
+       }
+      if$
       %format.date "year" output.check
       %edition output
       format.vol.num.year.pages output
     }
-    { format.article.crossref output.nonnull
+    { format.crossref output.nonnull
       %format.pages output
     }
   if$
@@ -915,7 +873,7 @@ FUNCTION {book}
     }
     {% format.date "year" output
       new.block
-      format.book.crossref output.nonnull
+      format.crossref output.nonnull
     }
   if$
   new.block
@@ -929,7 +887,7 @@ FUNCTION {booklet}
 { output.bibitem
   format.authors output
   new.block
-  format.title "title" output.check
+  format.btitle "title" output.check
   howpublished address new.block.checkb
   howpublished output
   address output
@@ -960,9 +918,9 @@ FUNCTION {inbook}
       format.chapter.pages "chapter and pages" output.check
       %address output
     }
-    {% format.chapter.pages "chapter and pages" output.check
+    {
       new.block
-      format.book.crossref output.nonnull
+      format.crossref output.nonnull
     }
   if$
   new.block
@@ -976,10 +934,14 @@ FUNCTION {incollection}
   format.authors "author" output.check
   chapter empty$
     { new.block type output }
-    {}
+    'skip$
   if$
   new.block
   format.title "title" output.check
+  type field.or.null sortify duplicate$ "definition" = swap$ "def." = or
+    { new.block "Def.~" chapter field.or.null * "chapter" output.check } 
+    'skip$
+  if$
   new.block
   crossref missing$
     { 
@@ -997,7 +959,7 @@ FUNCTION {incollection}
       new.sentence
       format.chapter.pages output
     }
-    { format.incoll.inproc.crossref output.nonnull
+    { format.crossref output.nonnull
       %format.chapter.pages output
     }
   if$
@@ -1015,7 +977,7 @@ FUNCTION {inproceedings}
   format.title "title" output.check
   new.block
   crossref missing$
-    { %format.in.ed.booktitle "booktitle" output.check
+    {
       booktitle "booktitle" output.check
       new.sentence
       format.editors.mid output
@@ -1044,8 +1006,7 @@ FUNCTION {inproceedings}
       new.sentence
       format.pages output
     }
-    { format.incoll.inproc.crossref output.nonnull
-      %format.pages output
+    { format.crossref output.nonnull
     }
   if$
   new.block
@@ -1156,7 +1117,7 @@ FUNCTION {proceedings}
   if$
   new.block
   format.btitle "title" output.check
-  new.sentence
+  new.block
   format.bvolume.or.num.series output
   address empty$
     { editor empty$
@@ -1192,6 +1153,7 @@ FUNCTION {techreport}
   format.title "title" output.check
   new.block
   format.tr.number output.nonnull
+  new.block
   institution "institution" output.check
   address output
   format.date "year" output.check
@@ -1239,6 +1201,8 @@ MACRO {nov} {"Nov."}
 
 MACRO {dec} {"Dec."}
 
+% Currently left in to help with compatibility
+
 MACRO {acmcs} {"ACM Computing Surveys"}
 
 MACRO {acta} {"Acta Informatica"}
@@ -1282,11 +1246,6 @@ MACRO {tcs} {"Theoretical Computer Science"}
 
 READ
 
-FUNCTION {sortify}
-{ purify$
-  "l" change.case$
-}
-
 INTEGERS { len }
 
 FUNCTION {chop.word}
@@ -1324,7 +1283,14 @@ FUNCTION {sort.format.title}
 { 't :=
   "A " #2
     "An " #3
-      "The " #4 t chop.word
+      "The " #4
+       "Rev. of " #8
+         "Rev.~of " #8
+           "Rev.\ of " #9
+           t chop.word
+         chop.word
+       chop.word
+      chop.word
     chop.word
   chop.word
   sortify