如何修改 unsrtnat.bst

如何修改 unsrtnat.bst

我使用unsrtnat.bst并且需要更改形式:

NW Ashcroft. Phys. Rev. Lett.,92,187002.(2004 年)。

NW Ashcroft。物理评论快报。92,187002 (2004)。

因此,我需要删除期刊标题后的逗号、页码后的点,并加粗卷号。

下面我介绍FUNCTION {format.date}

FUNCTION {format.date}
{ year duplicate$ empty$
    { "empty year in " cite$ * warning$
       pop$ "" }
    'skip$
  if$
  month empty$
    'skip$
    { month
      " " * swap$ *
    }
  if$
  duplicate$ empty$ 'skip$ %% added
  { "(" swap$ * ")" *}     %% added
if$
  extra.label *
}

FUNCTION {article}

FUNCTION {article}
{ output.bibitem
  format.authors "author" output.check
  author format.key output
  new.block
  format.title "title" output.check
  new.block
  crossref missing$
    { journal emphasize "journal" output.check
      eid empty$
        { format.vol.num.pages output }
        { format.vol.num.eid output }
      if$
      new.block                        %% added
      format.date "year" output.check
    }
    { format.article.crossref output.nonnull
      eid empty$
        { format.pages output }
        { format.eid output }
      if$
    }
  if$
  format.issn output
  format.doi output
  format.url output
  new.block
  note output
  fin.entry
}

答案1

获得大胆的音量

  1. 您必须定义一个新函数来以粗体形式打印内容。这可以通过以下方式实现

    FUNCTION {bold}%%new func to print the argument with \textbf{}
    { duplicate$ empty$
        { pop$ "" }
        { "\textbf{" swap$ * "}" * }
      if$
    }
    
  2. 修改文章音量输出

    FUNCTION {format.vol.num.pages}
    { volume bold%%changed field.or.null to bold
      number empty$
        'skip$
        { "\penalty0 (" number * ")" * *
          volume empty$
            { "there's a number but no volume in " cite$ * warning$ }
            'skip$
          if$
        }
      if$
      pages empty$
        'skip$
        { duplicate$ empty$
            { pop$ format.pages }
            { ":\penalty0 " * pages n.dashify * }
          if$
        }
      if$
    }
    
  3. 可以使用以下丑陋的技巧删除 journal 后面的逗号:

    a. 为日记定义一个新功能
    b. 不进行标点符号检查

    FUNCTION {format.journal.article}
    { journal empty$
        'skip$
       { ". \emph{" journal * "}" * * }
      if$
    }
    
    FUNCTION {article}
    { output.bibitem
      format.authors "author" output.check
      author format.key output
      new.block
      format.title "title" output.check
      new.block
      crossref missing$
        { format.journal.article
          eid empty$
            { format.vol.num.pages output }
            { format.vol.num.eid output }
          if$
          format.date "year" output.check
        }
        { format.article.crossref output.nonnull
          eid empty$
            { format.pages output }
            { format.eid output }
          if$
        }
      if$
      format.issn output
      format.doi output
      format.url output
      new.block
      note output
      fin.entry
    }
    

经过所有这些修改后,我的示例提供:

在此处输入图片描述

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[numbers]{natbib}
\usepackage{hyperref}
\usepackage{filecontents}
\begin{filecontents}{refs.bib}
@article{PhysRevLett.92.187002,
  author = {Ashcroft, N. W.},
  journal = {Phys. Rev. Lett.},
  volume = {92},
  issue = {18},
  pages = {187002},
  numpages = {4},
  year = {2004},
  publisher = {American Physical Society}
}
  title = {Hydrogen Dominant Metallic Alloys: High Temperature Superconductors?},
  doi = {10.1103/PhysRevLett.92.187002},
  url = {http://link.aps.org/doi/10.1103/PhysRevLett.92.187002},
  month = {May},
\end{filecontents}
\begin{document}

这需要做一些事情,我真的推荐biblatex


biblatex初始点:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[style=numeric,sorting=none]{biblatex}
\usepackage{hyperref}
\usepackage{filecontents}
\begin{filecontents}{refs.bib}
@article{PhysRevLett.92.187002,
  author = {Ashcroft, N. W.},
  journal = {Phys. Rev. Lett.},
  volume = {92},
  pages = {187002},
  numpages = {4},
  year = {2004},
  publisher = {American Physical Society}
}
  title = {Hydrogen Dominant Metallic Alloys: High Temperature Superconductors?},
  doi = {10.1103/PhysRevLett.92.187002},
  url = {http://link.aps.org/doi/10.1103/PhysRevLett.92.187002},
  month = {May},
\end{filecontents}
\addbibresource{refs.bib}
\begin{document}


\cite{PhysRevLett.92.187002}

\printbibliography


\end{document}

相关内容