如何删除 nar 样式中年份周围的括号?

如何删除 nar 样式中年份周围的括号?

我正在使用在线 LaTeX 编辑器 overleaf 创建文档。引用应如下所示:[21]

当我使用nar参考书目样式时:

\bibliographystyle{nar}
\bibliography{sample-bibliography.bib}

我的参考如下:

[21]  Gallais,  J.  F.,  Kizhvatov,  I.,  and  Tunstall,  M.  (2011)  Im-
proved trace-driven cache-collision attacks against embedded
AES  implementations.  In Information  Security  Applications pp. 243–257 Springer.

但我想删除年份周围的括号,使其看起来像这样:

[21]  Gallais,  J.  F.,  Kizhvatov,  I.,  and  Tunstall,  M.  2011  Im-
proved trace-driven cache-collision attacks against embedded
AES  implementations.  In Information  Security  Applications pp. 243–257 Springer.

如何删除参考文献中年份周围的括号?

对于上述引用[21]和参考文献样式,我还可以使用其他样式吗?

答案1

您需要复制nar.bst文件与主.tex文件放在同一文件夹中并进行编辑。

相关代码是format.date第 行附近375的函数nar.bst。原始函数是:

FUNCTION {format.date}
{ year empty$
    { month empty$
    { "" }
    { "there's a month but no year in " cite$ * warning$
      month
    }
      if$
    }
    { month empty$
%   'year originally
    {"(" year ")" * * } % TDS
    {"(" month ", " year ")" * * * * } % TDS
      if$
    }
  if$
}

在年份中添加括号的行是:

{"(" year ")" * * } % TDS

删除括号,将其更改为:

{ year } % TDS

但是,如果您的 bib 条目包含month字段,则打印日期的行是下一行:

{"(" month ", " year ")" * * * * } % TDS

如果您也想从这里删除括号,那么您必须将其更改为:

{ month ", " year * * } % TDS

它将打印为month, year。如果您想要其他格式,请告诉我,我会添加它。

编辑后的功能将是:

FUNCTION {format.date}
{ year empty$
    { month empty$
    { "" }
    { "there's a month but no year in " cite$ * warning$
      month
    }
      if$
    }
    { month empty$
%   'year originally
    { year } % TDS
    { month ", " year * * } % TDS
      if$
    }
  if$
}

只需将其替换到您的副本中nar.bst即可。为了方便起见,以下是编辑后的版本:https://pastebin.com/76Lhhr8U

测试文档:

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@InProceedings{gallais2011,
  author = {Gallais, Jean-Fran{\c{c}}ois and Kizhvatov, Ilya and Tunstall, Michael},
  editor = {Chung, Yongwha and Yung, Moti},
  title = {Improved Trace-Driven Cache-Collision Attacks against Embedded AES Implementations},
  booktitle = {Information Security Applications},
  year = {2011},
  publisher = {Springer Berlin Heidelberg},
  address = {Berlin, Heidelberg},
  pages = {243--257},
  isbn = {978-3-642-17955-6}
}
\end{filecontents}
\begin{document}
\pagestyle{empty}
\cite{gallais2011}
\bibliographystyle{nar}
\bibliography{\jobname.bib}
\end{document}

输出:

在此处输入图片描述

相关内容