
Я пишу свою диссертацию с помощью Lyx и BibTex для создания моей библиографии. Мой .bib сгенерирован Mendeley. Поэтому я пытаюсь найти способ изменить мой файл стиля IEEEtran.bst, чтобы игнорировать месяцы для BibTeX.
На данный момент выходной материал включает месяц и год публикации:
..., дек 2017
Но мне нужно удалить месяцы для каждой записи. Поскольку файл .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}
Результат: