
我正在用 Lyx 和 BibTex 來撰寫我的論文,以創建我的參考書目。我的 .bib 是由 Mendeley 產生的。因此,我嘗試管理的是找到一種方法來更改我的 IEEEtran.bst 樣式檔案以忽略 BibTeX 的月份。
目前輸出包括發布月份和年份:
...,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
對於@article
,format.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$
}
對於@inproceedings
,format.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}
結果: