Bibliography(参考資料)にURLを出力したい場合はalphaurl.bstが便利。 .bibでurl = {http://exapmle.com}などと書いておいて、 .texで\bibliographystyle{alphaurl}と指定すればよい。

今回はDOIを出力したくなったので、alphaurl.bstを基に、URLの代わりにDOI を表示するスタイルをでっちあげた。 \bibliographystyle{alphaurl-doi}として使う。

変更点

  • ENTRYにdoiを加える

  • FUNCTION {format.doi}を定義する(FUNCTION {format.url}を参考に)

  • FUNCTION {output.doi}を定義する(FUNCTION {output.url}を参考に)

  • FUNCTION {webpage}にformat.doiを加える

  • 次の関数内のoutput.urlをoutput.doiに置き換える。

    • FUNCTION {article}
    • FUNCTION {book}
    • FUNCTION {incollection}
    • FUNCTION {inproceedings}
    • FUNCTION {misc}
    • FUNCTION {proceedings}

パッチ

--- alphaurl.bst
+++ alphaurl-doi.bst
@@ -38,6 +38,7 @@
     year
     url % urlbst.pl
     lastchecked
+    doi
   }
   {}
   { label extra.label sort.label }
@@ -130,6 +131,13 @@
   if$
 }

+FUNCTION {format.doi}
+{ doi empty$
+    { "" }
+    { "DOI: \url{" doi * "}" * }
+  if$
+}
+
 FUNCTION {format.lastchecked}
 { lastchecked empty$
     { "" }
@@ -630,6 +638,17 @@
   if$
 }

+%% DOI
+FUNCTION {output.doi}
+{ doi empty$
+    'skip$
+    { new.block
+      format.doi output
+      format.lastchecked output
+    }
+  if$
+}
+
 % Webpage entry type.
 % Title and url fields required;
 % author, note, year, month, and lastchecked fields optional
@@ -660,6 +679,8 @@
   new.block
   format.url "url" output.check
   new.block
+  format.doi % DOI
+  new.block
   note output
   fin.entry
 }
@@ -681,8 +702,10 @@
       format.pages output
     }
   if$
+%   new.block
+%   output.url % urlbst.pl
   new.block
-  output.url % urlbst.pl
+  output.doi % DOI
   new.block
   note output
   fin.entry
@@ -715,8 +738,10 @@
   if$
   format.edition output
   format.date "year" output.check
+%   new.block
+%   output.url % urlbst.pl
   new.block
-  output.url % urlbst.pl
+  output.doi % DOI
   new.block
   note output
   fin.entry
@@ -795,8 +820,10 @@
       format.chapter.pages output
     }
   if$
+%   new.block
+%   output.url % urlbst.pl
   new.block
-  output.url % urlbst.pl
+  output.doi % DOI
   new.block
   note output
   fin.entry
@@ -831,8 +858,10 @@
       format.pages output
     }
   if$
+%   new.block
+%   output.url % urlbst.pl
   new.block
-  output.url % urlbst.pl
+  output.doi % DOI
   new.block
   note output
   fin.entry
@@ -904,6 +933,8 @@
   new.block
   output.url % urlbst.pl
   new.block
+  output.doi % DOI
+  new.block
   note output
   fin.entry
   empty.misc.check
@@ -959,6 +990,8 @@
   new.block
   output.url % urlbst.pl
   new.block
+  output.doi % DOI
+  new.block
   note output
   fin.entry
 }

表記を変えたいだけならほんの少し書き換えれば済む。

--- alphaurl.bst
+++ alphaurl-simple.bst
@@ -126,7 +126,7 @@ FUNCTION {inbrackets}
 FUNCTION {format.url}
 { url empty$
     { "" }
-    { "Available from World Wide Web: \url{" url * "}" * }
+    { "URL: \url{" url * "}" * }
   if$
 }