更改书目字段的值

更改书目字段的值

我正在使用 Citavi 创建我的 bib 文件。申请人Citavi 中的专利字段导出到holderbibtex 字段。有许多以“Glaxo Group, Ltd.”形式出现的条目,Citavi 将其导出为

holder = {{Glaxo Group}, Ltd.}

biblatex(使用chem-angew)将其打印为“L. Glaxo Group”。

因为我无法更改 Citavi 导出的输出,并且每次从 Citavi 导出时我都不想手动更改我的 bib 文件,所以我需要让我的代码将字段的值更改为

holder = {{Glaxo Group, Ltd.}}

或者类似,或者只有holder字段不使用缩写名称并打印“姓氏,名字”,我猜。

后者我通过声明自己的名称格式patentcompany并在更新的 bibmacro 中使用该格式来实现byholder(请参阅下面的 MWE)。但我仍然想知道:

holder是否可以按上面所述修改字段的内容?

梅威瑟:

\documentclass{article} 

\usepackage[backend=biber, style=chem-angew]{biblatex}

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@patent{Bertani.2007,
  abstract = {Iodierung ist Preparation 60, PDF-S. 95},
  author = {Bertani, Barbara and Bonanomi, Giorgio and Capelli, Anna Maria and Checchia, Anna and Di Fabio, Romano and Gentile, Gabriella and Micheli, Fabrizio and Pasquarello, Alessandra and Tedesco, Giovanna and Terreni, Silvia},
    year = {2007},
    title = {Azabicyclo[3.1.0]hexyl Derivatives as Modulators of Dopamine D3 Receptors},
    Holder = {{Glaxo Group}, Ltd.},
    number = {WO 2007/113232 A1},
    type = {Patent}
}

@patent{Chobanian.2009,
    author = {Chobanian, Harry and Lin, Linus S. and Liu, Ping and Chioda, Marc D. and Devita, Robert J. and Nargund, Ravi P. and Guo, Yan},
    year = {2009},
    title = {Oxazole derivatives useful as inhibitors of faah},
    Holder = {{Merck {\&} Co.}, Inc.},
    number = {WO 2010/017079 A1},
    type = {Patent}
}

@patent{Hongu.2002,
  author = {Hongu, Mitsuya and Hosaka, Thoshihiro and Kashiwagi, Toshihiko and Kono, Rikako and Kobayashi, Hiroyuki},
  year = {2002},
  title = {Imidazole, thiazole and oxazole derivatives and their use for the manufacture of a medicament for the treatment and/or prevention of pollakiuria or urinary incontinence},
  Holder = {{Tanabe Seiyaku Co.}, Ltd.},
  number = {WO 2002/083111 A2},
  type = {Patent}
}
\end{filecontents*}

\addbibresource{\jobname.bib}

\DeclareNameFormat{patentcompany}{%
  \nameparts{#1}%
  \usebibmacro{name:family-given}
    {\namepartfamily}
    {\namepartgiven}
    {\namepartprefix}
    {\namepartsuffix}%
  \usebibmacro{name:andothers}%
  }
\renewbibmacro*{byholder}{%
  \ifnameundef{holder}%
    {}
    {\printtext[parens]{\printnames[patentcompany]{holder}}}
  }

\begin{document}
  \nocite{*}

  \printbibliography
\end{document}

答案1

这肯定应该在输入端修复。也许在 Citavi 中输入信息时自己添加正确数量的括号就足够了,即写入

{Glaxo Group, Ltd.}

而不是Glaxo Group, Ltd.{Glaxo Group}, Ltd.。如果这没有帮助,或者 Citavi 忽略了这个括号,你应该向 Citavi 的人投诉。Biber 和 BibTeX 的一个众所周知的功能是“公司”名称应该全部用花括号括起来,以避免它们被拆分并解析为具有家族和名字的名称。参见在书目条目的“作者”字段中使用“公司作者”(完整拼写出姓名)和 §2.3.3公司作者和编辑biblatex文档. 文献在讨论holder名单时甚至明确提到了这一点(第 20 页)

请注意,公司持有人需要用额外的括号括起来,详情请参阅§2.3.3。

如果我理解正确的话,Citavi 是一款商业软件,您(或您的机构)需要为它付费。

这是源映射中的 RegEx,它尝试为您修复问题。

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldsource=holder,
            match=\regexp{\A\{(.+)\},\s+(.+)\Z},
            replace=\regexp{\{$1,\x20$2\}}]
    }
  }
}

将所有holder形式的 s{Blah}, Blub转换为{Bla, Blub}。即使对于 ,这也出奇地顺利{Merck {\&} Co.}, Inc.,但我不能保证它不会因更奇怪的输入而崩溃。

\documentclass{article} 
\usepackage[backend=biber, style=chem-angew]{biblatex}
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@patent{Bertani.2007,
  abstract = {Iodierung ist Preparation 60, PDF-S. 95},
  author = {Bertani, Barbara and Bonanomi, Giorgio and Capelli, Anna Maria and Checchia, Anna and Di Fabio, Romano and Gentile, Gabriella and Micheli, Fabrizio and Pasquarello, Alessandra and Tedesco, Giovanna and Terreni, Silvia},
    year = {2007},
    title = {Azabicyclo[3.1.0]hexyl Derivatives as Modulators of Dopamine D3 Receptors},
    Holder = {{Glaxo Group}, Ltd.},
    number = {WO 2007/113232 A1},
    type = {patent},
}

@patent{Chobanian.2009,
    author = {Chobanian, Harry and Lin, Linus S. and Liu, Ping and Chioda, Marc D. and Devita, Robert J. and Nargund, Ravi P. and Guo, Yan},
    year = {2009},
    title = {Oxazole derivatives useful as inhibitors of faah},
    Holder = {{Merck {\&} Co.}, Inc.},
    number = {WO 2010/017079 A1},
    type = {Patent},
}

@patent{Hongu.2002,
  author = {Hongu, Mitsuya and Hosaka, Thoshihiro and Kashiwagi, Toshihiko and Kono, Rikako and Kobayashi, Hiroyuki},
  year = {2002},
  title = {Imidazole, thiazole and oxazole derivatives and their use for the manufacture of a medicament for the treatment and/or prevention of pollakiuria or urinary incontinence},
  Holder = {{Tanabe Seiyaku Co.}, Ltd.},
  number = {WO 2002/083111 A2},
  type = {Patent},
}
\end{filecontents*}

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldsource=holder,
            match=\regexp{\A\{(.+)\},\s+(.+)\Z},
            replace=\regexp{\{$1,\x20$2\}}]
    }
  }
}

\addbibresource{\jobname.bib}

\begin{document}
  \nocite{*}

  \printbibliography
\end{document}

在此处输入图片描述

相关内容