基于代码使用 biblatex 配置参考书目和美国微生物学会 (ASM) 的 BibTeX 格式 – 按时间顺序排列,作者以粗体显示 我正在尝试配置参考书目,使其看起来像 ASM 示例:
- Caserta E、Haemig HAH、Manias DA、Tomsic J、Grundy FJ、Henkin TM、Dunny GM。2012 年。体内和体外分析PrgX信息素受体蛋白对信息素反应prgQ启动子的调控。细菌学杂志。194:3386-3394。
到目前为止我能够获得以下代码:
\documentclass[american, 12pt]{article}
\usepackage[latin1]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage{xpatch}
\usepackage[style=numeric,subentry,sorting=none,backend=bibtex,firstinits=true,terseinits=true,url=false,doi=false,isbn=false,maxbibnames=99]{biblatex}
\addbibresource{\jobname.bib}
\AtBeginBibliography{%
\renewcommand*{\finalnamedelim}{%
\ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
\addspace\mkbibbold{\bibstring{}}}%
\renewcommand*{\mkbibnamelast}[1]{\mkbibbold{#1}}%
\renewcommand*{\mkbibnamefirst}[1]{\mkbibbold{#1}}%
}
\DeclareFieldFormat[article]{volume}{\mkbibbold{#1}}
\DeclareNameAlias{default}{last-first}
\DeclareFieldFormat
[article,inbook,incollection,inproceedings,patent,thesis,unpublished]
{title}{{#1\isdot}}
\renewbibmacro{in:}{}
% remove the \addot if you don't want a dot before the year.
\xapptobibmacro{author}{\adddot\addspace\printfield{year}}{\typeout{successfully patched bibmacro{author} to include year}}{\typeout{failed to patch bibmacro{author} to include year}}
\xapptobibmacro{editor}{\adddot\addspace\printfield{year}}{\typeout{successfully patched bibmacro{editor} to include year}}{\typeout{failed to patch bibmacro{editor} to include year}}
\DeclareFieldFormat{date}{\scriptsize{#1}}
\DeclareFieldFormat{pages}{#1}
\AtEveryBibitem{\clearfield{month}}
\AtEveryBibitem{\clearfield{day}}
\begin{filecontents}{\jobname.bib}
@article{ho1995,
author = {David D. Ho and Avidan U. Neumann and Alan S. Perelson and Wen Chen and John M. Leonard and Martin Markowitz},
title = {Rapid turnover of plasma virions and CD4 lymphocytes in HIV-1 infection},
journal = {Nature},
volume = {373},
number = {6510},
page = {123-126},
date = {1995},
}
@article{testartlong,
author = {Arnold Uthor and William Riter and Rita Esearcher and Steven C. Ientist and Stuart T. Udent and Peter R. Ofessor and Lewis E. C. Turer},
title = {An Article about Articles},
journal = {Journal of Articles},
volume = {8},
number = {2},
page = {1-5},
date = {2010},
}
@article{testart,
author = {Arnold Uthor and William Riter},
title = {A Very Interesting Article},
journal = {Journal of Articles},
volume = {7},
number = {3},
page = {1-5},
date = {2010},
}
@book{testbook,
author = {Walter Ordsmith},
editor = {Eddie Ditor},
title = {The Work},
subtitle = {Subtitle},
date = {1983},
}
@online{testonline,
author = {Bernie Logger},
title = {A Very Opinionated Blog Post},
url = {http://example.com},
year = {2013},
}
\end{filecontents}
\begin{document}
Let's cite \cite{ho1995}.
\printbibliography
\end{document}
我如何才能删除括号 [1] 以在参考书目中得到 1. 的数字,以及如何隐藏页码后参考文献末尾的日期?感谢您的建议。
答案1
我可以部分回答:将此行添加到您的序言中将抑制括号并添加一个点:
\DeclareFieldFormat{labelnumberwidth}{#1\adddot}
至于在作者姓名后面加上日期,这有点复杂(至少对我来说是这样——也许有人能给出更好的解决方案)。首先,它包括查看 standard.bbx 中的不同 \DeclareBibliographyDriver 命令,并隐藏负责日期的宏,必要时替换它们。
我举几个例子:对于书籍类,有一个
\usebibmacro{publisher+location+date}
你必须用
\usebibmacro{publisher+location}
后者未由 biblatex 定义。因此,您必须定义一个 \newbibmacro*{publisher+location},其成分与前者相同,但您需要删除倒数第二个命令 \usebibmacro{date}。这将解决 book、collection、inbook、incollection 和 manual 的问题。
类似的其他 bibmacro 必须以相同的方式替换:location+date(小册子、未出版);event+venue+date((在)诉讼中);organization+location+date(杂项);institution+location+date(报告、论文)。对于专利(?)和在线,只需隐藏 \usebibmacro{date}。
文章的情况略有不同:负责打印日期的是 journal+issuetitle 宏;在宏定义的末尾,您必须将 \usebibmacro{issue+date} 替换为 \usebibmacro{issue}。
其次,在参考书目驱动程序中,在提到作者/译者的行之后,有这样一行:
\setunit{\labelnamepunct}\newblock
在其上方插入以下两行:
\newunit
\usebibmacro{date}
就这些。希望我说得清楚了。我再补充一下,你不需要使用 xpatch 来解决此问题。
结果:
添加于 01/30:这是我用来重新定义 journal+issue 宏的代码:
\renewbibmacro*{journal+issuetitle}{%
\usebibmacro{journal}%
\setunit*{\addspace}%
\iffieldundef{series}
{}
{\newunit
\printfield{series}%
\setunit{\addspace}}%
\usebibmacro{volume+number+eid}%
\setunit{\addspace}%
\usebibmacro{issue}%+date
\setunit{\addcolon\space}%
\usebibmacro{issue}%
\newunit}
答案2
浏览所有书目驱动程序并进行更改非常繁琐(记住:永远不要直接更改样式,而要更改重命名的副本;不是修改原始文件standard.bbx
或biblatex.def
),但由于 awesomexpatch
软件包和biblatex
的功能,这并不总是必要的。在这种情况下,我们也可以避免它。
加载biblatex
\usepackage[style=numeric, subentry, sorting=none, backend=biber, firstinits=true, terseinits=true, url=false, doi=false, isbn=false, maxbibnames=999]{biblatex}
您需要使用 biber 才能使用terseinits=true
。
要获取不带括号的标签编号,请使用
\DeclareFieldFormat{labelnumberwidth}{#1\adddot}
这将为您提供“last f”名称,而“last”和“f”之间没有任何逗号。没有特殊的最后和,只有标准逗号。
\DeclareNameAlias{default}{last-first}
\renewcommand*{\revsdnamepunct}{}
\renewcommand*{\finalnamedelim}{\multinamedelim}
我们用粗体显示作者(正如 @lockstep 所建议的使用 biblatex 的参考书目:如何使用 authoryear 样式实现粗体标签?)
\xpretobibmacro{author}{\mkbibbold\bgroup}{}{}
\xapptobibmacro{author}{\egroup}{}{}
\xpretobibmacro{editor}{\mkbibbold\bgroup}{}{}
\xapptobibmacro{editor}{\egroup}{}{}
然后我们将年份附加到作者/编辑者宏中
% remove the \addperiod if you don't want a dot before the year.
\xapptobibmacro{author}
{\printtext[bold]{\addperiod\addspace}\printfield{year}}
{\typeout{successfully patched bibmacro{author} to include year}}
{\typeout{failed to patch bibmacro{author} to include year}}
\xapptobibmacro{editor}
{\printtext[bold]{\addperiod\addspace}\printfield{year}}
{\typeout{successfully patched bibmacro{editor} to include year}}
{\typeout{failed to patch bibmacro{editor} to include year}}
删除标题周围的引号、文章中的“in”和粗体卷号。
\DeclareFieldFormat[article, inbook, incollection, inproceedings, patent, thesis, unpublished]{title}{#1\isdot}
\renewbibmacro{in:}{}
\DeclareFieldFormat[article]{volume}{\mkbibbold{#1}}
为了避免打印两次日期,我们在最后隐藏它
\renewbibmacro*{date}{}
\renewbibmacro*{issue+date}{%
\iffieldundef{issue}
{}
{\printtext[parens]{\printfield{issue}}}%
\newunit}
我们希望页面字段不带任何“p”或“pp”,但前面有一个冒号。
\DeclareFieldFormat{pages}{#1}
\renewcommand*{\bibpagespunct}{\addcolon}
这给出
\documentclass[american, 12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage{xpatch}
\usepackage{filecontents}
\usepackage[style=numeric, subentry, sorting=none, backend=biber, firstinits=true, terseinits=true, url=false, doi=false, isbn=false, maxbibnames=999]{biblatex}
\begin{filecontents*}{\jobname.bib}
@article{ho1995,
author = {David D. Ho and Avidan U. Neumann and Alan S. Perelson and Wen Chen and John M. Leonard and Martin Markowitz},
title = {Rapid turnover of plasma virions and CD4 lymphocytes in HIV-1 infection},
journal = {Nature},
volume = {373},
number = {6510},
pages = {123-126},
date = {1995},
}
@article{casertPrgQPrgX,
author = {Enrico Caserta and Heather A. H. Haemig and Dawn A. Manias and Jerneja Tomsic and Frank J. Grundy and Tina M. Henkin and Gary M. Dunny},
title = {\emph{In Vivo} and \emph{In Vitro} Analyses of Regulation of the Pheromone-Responsive \emph{prgQ} Promoter by the PrgX Pheromone Receptor Protein},
journaltitle= {J. Bacteriol},
volume = {194},
number = {13},
date = {2012-07},
pages = {3386-3394},
doi = {10.1128/JB.00364-12},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\DeclareFieldFormat{labelnumberwidth}{#1\adddot}
\DeclareNameAlias{default}{last-first}
\renewcommand*{\revsdnamepunct}{}
\renewcommand*{\finalnamedelim}{\multinamedelim}
\xpretobibmacro{author}{\mkbibbold\bgroup}{}{}
\xapptobibmacro{author}{\egroup}{}{}
\xpretobibmacro{editor}{\mkbibbold\bgroup}{}{}
\xapptobibmacro{editor}{\egroup}{}{}
% remove the \addperiod if you don't want a dot before the year.
\xapptobibmacro{author}
{\printtext[bold]{\addperiod\addspace}\printfield{year}}
{\typeout{successfully patched bibmacro{author} to include year}}
{\typeout{failed to patch bibmacro{author} to include year}}
\xapptobibmacro{editor}
{\printtext[bold]{\addperiod\addspace}\printfield{year}}
{\typeout{successfully patched bibmacro{editor} to include year}}
{\typeout{failed to patch bibmacro{editor} to include year}}
\DeclareFieldFormat[article,inbook,incollection,inproceedings,patent,thesis,unpublished]{title}{{#1\isdot}}
\renewbibmacro{in:}{}
\DeclareFieldFormat[article]{volume}{\mkbibbold{#1}}
\renewbibmacro*{date}{}
\renewbibmacro*{issue+date}{%
\iffieldundef{issue}
{}
{\printtext[parens]{\printfield{issue}}}%
\newunit}
\DeclareFieldFormat{pages}{#1}
\renewcommand*{\bibpagespunct}{\addcolon}
\begin{document}
Let's cite \cite{ho1995,casertPrgQPrgX}.
\printbibliography
\end{document}
答案3
这是一个相当古老的话题,但我在自己搜索 bibtex/biblatex 文件以重现 ASM 期刊参考文献样式时偶然发现了它
我按照@moewe 的说明进行了操作,并将所有内容整合在一起tex 文件可在我的 github 上找到,它可能不是最佳的,但目前它可以正确复制书籍、文章和收藏条目
\usepackage[style=numeric, subentry, sorting=none, backend=biber, firstinits=true, terseinits=true, url=false, doi=true, isbn=false, maxbibnames=999, eprint=false]{biblatex}
\DeclareFieldFormat{labelnumberwidth}{#1\adddot}
\DeclareNameAlias{default}{last-first}
\renewcommand*{\revsdnamepunct}{}
\renewcommand*{\finalnamedelim}{\multinamedelim}
%Get rid of quotation marks around titles
\DeclareFieldFormat[article, book, patent, thesis, unpublished]{title}{#1\isdot}
\DeclareFieldFormat[inbook, incollection, inproceedings]{title}{#1\addcomma}
\DeclareFieldFormat{booktitle}{#1}
%have vol:pag for article
\DeclareFieldFormat[article]{volume}{#1\addcolon}
\DeclareFieldFormat[article]{pages}{\addcolon#1}
%No ``in'' for articles, italic In for the rest
\renewbibmacro{in:}{
\ifentrytype{article}{}
{\printtext{{\itshape In}\space}}
}
% Append the year to the author/editor macros
\usepackage{xpatch}
\xapptobibmacro{author}
{\printtext[]{\addperiod\addspace}\printfield{year}}
{\typeout{successfully patched bibmacro{author} to include year}}
{\typeout{failed to patch bibmacro{author} to include year}}
\xapptobibmacro{editor}
{\printtext[]{\addperiod\addspace}\printfield{year}}
{\typeout{successfully patched bibmacro{editor} to include year}}
{\typeout{failed to patch bibmacro{editor} to include year}}
%and remove date at end
\renewbibmacro*{date}{}
\renewbibmacro*{issue+date}{%
\iffieldundef{issue}
{}
{\printtext[parens]{\printfield{issue}}}%
\newunit}
%remove the number, only volume (format is VOL:Pin-Pfin)
\renewbibmacro*{volume+number+eid}{%
\printfield{volume}
}
%no editors for articles
\renewbibmacro*{byeditor+others}{%
}
% want full doi url
% http://latex-community.org/forum/viewtopic.php?t=28552
\DeclareFieldFormat{doi}{%
\ifhyperref
{\href{https://doi.org/#1}{\nolinkurl{https://doi.org/#1}}}
{\nolinkurl{#1}}
}
%redefine book and incollection formats
\DeclareBibliographyDriver{incollection}{%
\usebibmacro{author}%
\newunit\newblock
\printfield{title}%
\newunit\newblock
\printfield{pages}
\newunit\newblock
\usebibmacro{byeditor+booktitle+publisher}%
\finentry}
\DeclareBibliographyDriver{book}{%
\usebibmacro{author}%
\newunit\newblock
\printfield{title}%
\newunit\newblock
\usebibmacro{publisher+location}%
\finentry}
\renewbibmacro*{byeditor+booktitle+publisher}{
\usebibmacro{in:}\ifnameundef{editor}{}{\printnames{editor}\space(ed),\space}%
\printfield{booktitle}\adddot\space%
\printlist{publisher}%
\iflistundef{location}{\adddot}{\addcomma\space}%
\printlist{location}%
}
\renewbibmacro*{publisher+location}{
\printlist{publisher}%
\iflistundef{location}{\adddot}{\addcomma\space}%
\printlist{location}%
}
注意:最新的 ASM 格式不再有粗体作者