IEEETran.bst ファイルを変更して日付の月を無視するにはどうすればよいでしょうか?

IEEETran.bst ファイルを変更して日付の月を無視するにはどうすればよいでしょうか?

私は Lyx を使って論文を執筆しており、参考文献の作成には BibTex を使用しています。.bib は Mendeley で生成されています。そこで、私が管理しようとしているのは、BibTeX の月を無視するように IEEEtran.bst スタイル ファイルを変更する方法を見つけることです。

現時点では、出力には発行月と発行年が含まれます。

...、2017 年 12 月

しかし、各エントリの月を削除する必要があります。.bibファイルは Mendeley によって生成されるため、変更しても機能しません。また、Mendeley はこれらの情報を自動的に更新するため、手動で月を削除しても機能しません。

IEEETran ファイル内の日付の関数は次のようになります。

FUNCTION {format.date}
{
  month "month" bibinfo.check duplicate$ empty$
  year  "year" bibinfo.check duplicate$ empty$
    { swap$ 'skip$
        { this.to.prev.status
          this.status.std
          cap.status.std
         "there's a month but no year in " cite$ * warning$ }
      if$
      *
    }
    { this.to.prev.status
      this.status.std
      cap.status.std
      swap$ 'skip$
        {
          swap$
          " " * swap$
        }
      if$
      *
    }
  if$
}

問題は、月を無視するには何を変更すればよいのかよくわからないことです。削除する部分のさまざまな組み合わせを試しました。しかし、まだ解決策が見つかりません... 誰か助けてくれませんか?

答え1

については@articleformat.date次のように変更する必要があります。

FUNCTION {format.date}
{
  "" duplicate$ empty$
  year  "year" bibinfo.check duplicate$ empty$
    { swap$ 'skip$
        { this.to.prev.status
          this.status.std
          cap.status.std
         "there's a month but no year in " cite$ * warning$ }
      if$
      *
    }
    { this.to.prev.status
      this.status.std
      cap.status.std
      swap$ 'skip$
        {
          swap$
          " " * swap$
        }
      if$
      *
    }
  if$
}

および については@inproceedingsformat.address.org.or.pub.date変更する必要があります。

FUNCTION {format.address.org.or.pub.date}
{ 't :=
  ""
  year empty$
    { "empty year in " cite$ * warning$ }
    { skip$ }
  if$
  address empty$ t empty$ and
  year empty$ and month empty$ and
    { skip$ }
    { this.to.prev.status
      this.status.std
      cap.status.std
      address "address" bibinfo.check *
      t empty$
        { skip$ }
        { punct.period 'prev.status.punct :=
          space.large 'prev.status.space :=
          address empty$
            { skip$ }
            { ": " * }
          if$
          t *
        }
      if$
      year empty$ month empty$ and
        { skip$ }
        { t empty$ address empty$ and
            { skip$ }
            { ", " * }
          if$
          month empty$
            { year empty$
                { skip$ }
                { year "year" bibinfo.check * }
              if$
            }
            { year empty$
                 { skip$ }
                 { " " * year "year" bibinfo.check * }
              if$
            }
          if$
        }
      if$
    }
  if$
}

ここに画像の説明を入力してください

\documentclass[journal]{IEEEtran}
\usepackage{filecontents}
\begin{filecontents}{refs.bib}
@article{fuext1,
    year={2004},
    month={May},
    booktitle={$23^{rd}$ International Conference on the Theory and Applications of Cryptographic Techniques (EUROCRYPT)},
    volume={3027},
    title={Fuzzy Extractors: How to Generate Strong Keys from Biometrics and Other Noisy Data},
    publisher={{LNCS}, Springer Berlin Heidelberg},
    author={Dodis, Yevgeniy and Reyzin, Leonid and Smith, Adam},
    address={Interlaken, Switzerland},
    pages={523-540},
}

@inproceedings{fuext2,
    year={2004},
    month={May},
    booktitle={$23^{rd}$ International Conference on the Theory and Applications of Cryptographic Techniques (EUROCRYPT)},
    volume={3027},
    title={Fuzzy Extractors: How to Generate Strong Keys from Biometrics and Other Noisy Data},
    author={Dodiz, Yevgeniy and Reyzin, Leonid and Smith, Adam},
    address={Interlaken, Switzerland, {LNCS}, Springer Berlin Heidelberg},
    pages={523-540},
}
\end{filecontents}

\begin{document}
Article \cite{fuext1} and Proceedings \cite{fuext2}.
\bibliographystyle{IEEEtran}
\bibliography{refs}
\end{document}

答え2

BibTeX 構文はかなりわかりにくい場合があります。最も簡単な解決策は、より基本的な参考文献スタイルからより単純な構文の関数をコピーすることです。

以下は から変更されますabbrvnat.bst:

FUNCTION {format.date}
{ year  "year" bibinfo.check duplicate$ empty$
    { "empty year in " cite$ * warning$
       pop$ "" }
    'skip$
  if$
}

IEEEtran.bstエントリには別の日付書式設定関数が使用されるためinproceedings、これも編集する必要があることに注意してください。

FUNCTION {format.address.org.or.pub.date}
{ 't :=
  ""
  year empty$
    { "empty year in " cite$ * warning$ }
    { skip$ }
  if$
  address empty$ t empty$ and
  year empty$ and month empty$ and
    { skip$ }
    { this.to.prev.status
      this.status.std
      cap.status.std
      address "address" bibinfo.check *
      t empty$
        { skip$ }
        { punct.period 'prev.status.punct :=
          space.large 'prev.status.space :=
          address empty$
            { skip$ }
            { ": " * }
          if$
          t *
        }
      if$
      year empty$ month empty$ and
        { skip$ }
        { t empty$ address empty$ and
            { skip$ }
            { ", " * }
          if$
          month empty$
            { year empty$
                { skip$ }
                { year "year" bibinfo.check * }
              if$
            }
            { year empty$ % removed printing the month string here
                 { skip$ }
                 { " " * year "year" bibinfo.check * }
              if$
            }
          if$
        }
      if$
    }
  if$
}

修正された を使用した MWE IEEEtran.bst:

\documentclass{article}
\begin{filecontents}{\jobname.bib}
@article{articlemonth,
  author = {Mary Jones},
  title = {First Things},
  journal = {Journal of Things},
  month = {jan},
  year = {2017}
}

@inproceedings{proceedingsmonth,
  author = {Joe Peterson},
  title = {Briefly Explained},
  booktitle = {Conference of Briefness},
  month = {feb},
  year = {2017}
}
\end{filecontents}
\begin{document}
See \cite{articlemonth,proceedingsmonth}.

\bibliographystyle{IEEEtranmod}
\bibliography{\jobname}
\end{document}

結果:

ここに画像の説明を入力してください

関連情報