Diary/2021-1-2
plain/bibtexでの日本語文献対応
bibtexのplainで,日本語文献を列挙しようとするとあれこれ表記がおかしなことに.
とりあえず,ラストオーサーの前の and は何とかしようと,
日本語と英語を混ぜられるようにbibtexスタイルファイルを改造しよう を参考に修正.
bstって,こういう文法だったんだ.
miyo@tama:% diff -up /usr/local/texlive/2020/texmf-dist/bibtex/bst/base/plain.bst plainS.bst --- /usr/local/texlive/2020/texmf-dist/bibtex/bst/base/plain.bst 2010-12-14 10:20:07.000000000 +0900 +++ plainS.bst 2021-01-02 13:19:02.460806929 +0900 @@ -31,17 +31,19 @@ ENTRY type volume year + isjapanese } {} { label } -INTEGERS { output.state before.all mid.sentence after.sentence after.block } +INTEGERS { output.state before.all mid.sentence after.sentence after.block japanese.flag} FUNCTION {init.state.consts} { #0 'before.all := #1 'mid.sentence := #2 'after.sentence := #3 'after.block := + #0 'japanese.flag := } STRINGS { s t } @@ -191,14 +193,26 @@ FUNCTION {format.names} { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := nameptr #1 > { namesleft #1 > - { ", " * t * } + { japanese.flag #0 = + { ", " * t * } + { "," * t * } + if$ + } { numnames #2 > - { "," * } - 'skip$ + { japanese.flag #0 = + { ", " * } + { "," * } + if$ + } + 'skip$ if$ t "others" = { " et~al." * } - { " and " * t * } + { japanese.flag #0 = + { " and " * t * } + { "" * t * } + if$ + } if$ } if$ @@ -553,6 +567,10 @@ FUNCTION {article} new.block note output fin.entry + isjapanese empty$ + {skip$} + {#1 'japanese.flag :=} + if$ } FUNCTION {book}