# Biblatex citation style ASM

Bbased on the code in configuring bibliography with biblatex and BibTeX style for the American Society for Microbiology (ASM) – chronological order, authors bold I am trying to configure the bibliography so that looks like the ASM exsample:

1. Caserta E, Haemig HAH, Manias DA, Tomsic J, Grundy FJ, Henkin TM, Dunny GM. 2012. In vivo and in vitro analyses of regulation of the pheromone-responsive prgQ promoter by the PrgX pheromone receptor protein. J. Bacteriol. 194:3386-3394.

So far I was able to get the following code:

\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}

\AtBeginBibliography{%
\renewcommand*{\finalnamedelim}{%
\ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
\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}


How can I remove the bracket [1] to get 1. on the number in the biblography and how to suppress the date at the end of the reference after the pages? Thank you for your suggestions.

\DeclareFieldFormat{labelnumberwidth}{#1\adddot}


As for having the date after the author name, it's a bit more complicated (at least for me — maybe someone can give a better solution). It consists in firstly looking at the different \DeclareBibliographyDriver commands in standard.bbx and suppressing the macros that are in charge of the date, replacing them if necessary.
I give a couple of examples: for the book class, there is a

  \usebibmacro{publisher+location+date}


which you have to replace by

  \usebibmacro{publisher+location}


The latter is not defined by biblatex. So you have to define a \newbibmacro*{publisher+location} that will have the same ingredients as the former, except that you'll delete the last but one command, \usebibmacro{date}. That will settle the case of book, collection, inbook, incollection and manual.

Similar other bibmacros will have to be replaced in the same way : location+date (booklet, unpublished); event+venue+date ((in)proceedings); organization+location+date (misc); institution+location+date (report, thesis). For patent (?) and online, just suppress \usebibmacro{date}.

The case of article is a little different: the responsible for printing the date is the journal+issuetitle macro; towards the end of the macro definition, you'll have to replace a \usebibmacro{issue+date} by \usebibmacro{issue}.

Secondly, the bibliography drivers, just after the lines mentioning the author/translator, there is this line:

\setunit{\labelnamepunct}\newblock


Insert just above it these 2 lines:

\newunit
\usebibmacro{date}


That's all. I hope I've been clear. Let me add that you don't need to use xpatch for this solution.

Result:

Added on 01/30: here is the code I used to redefine the journal+issue macro:

\renewbibmacro*{journal+issuetitle}{%
\usebibmacro{journal}%
\iffieldundef{series}
{}
{\newunit
\printfield{series}%
\usebibmacro{volume+number+eid}%
\usebibmacro{issue}%+date
\usebibmacro{issue}%
\newunit}

• Where can I find this journal+issuetitle macro? – basil Jan 28 '14 at 22:20
• @basil: It's sdefined lines 766–783 of standard.bbx. Most macros are in this file and in biblatex.def. – Bernard Jan 28 '14 at 22:30
• sorry but in my case in the standard.bbx file looks the line 767 is something like: \newbibmacro*{publisher+location+date}{% \printlist{location}% \iflistundef{publisher} {\setunit*{\addcomma\space}} {\setunit*{\addcolon\space}}% \printlist{publisher}% \setunit*{\addcomma\space}% \usebibmacro{date}% \newunit} \newbibmacro*{institution+location+date}{% \printlist{location}% \iflistundef{institution} {\setunit*{\addcomma\space}} {\setunit*{\addcolon\space}}% \printlist{institution}% \setunit*{\addcomma\space}% \usebibmacro{date}% \newunit} – basil Jan 30 '14 at 19:20
• in my MiKTeX2.9 version – basil Jan 30 '14 at 19:30
• Maybe your editor doesn't count blank lines (I use WinEdt)? I have the very last version of biblatex (2.8a). You can search for "\newbibmacro*{journal+issuetitle}" in standard.bbx. In any case, it should be a little before the definition of publisher+location+date, which happens for me lines 817-825. I've added the modified code for this macro in my answer. – Bernard Jan 30 '14 at 22:10

Going through all the bibliography drivers and changing them is quite tiresome (remember: never change a style directly, always change a renamed copy; do not modify the original files standard.bbx or biblatex.def), but thanks to the awesome xpatch package and biblatex's capabilities this is not always necessary. We can also avoid it in this case.

Load biblatex

\usepackage[style=numeric, subentry, sorting=none, backend=biber, firstinits=true, terseinits=true, url=false, doi=false, isbn=false, maxbibnames=999]{biblatex}


You will need to use biber to be able to make use of terseinits=true.

To get a label number without brackets use

\DeclareFieldFormat{labelnumberwidth}{#1\adddot}


This will give you "last f" names without any commas between "last" and "f". There is no special final and, just the standard comma.

\DeclareNameAlias{default}{last-first}
\renewcommand*{\revsdnamepunct}{}
\renewcommand*{\finalnamedelim}{\multinamedelim}


We bolden the authors (as suggested by @lockstep in Bibliography with biblatex: how to achieve bold labels using the authoryear-style?)

\xpretobibmacro{author}{\mkbibbold\bgroup}{}{}
\xapptobibmacro{author}{\egroup}{}{}
\xpretobibmacro{editor}{\mkbibbold\bgroup}{}{}
\xapptobibmacro{editor}{\egroup}{}{}


Then we append the year to the author/editor macros

% remove the \addperiod if you don't want a dot before the year.
\xapptobibmacro{author}
{\typeout{successfully patched bibmacro{author} to include year}}
{\typeout{failed to patch bibmacro{author} to include year}}
\xapptobibmacro{editor}
{\typeout{successfully patched bibmacro{editor} to include year}}
{\typeout{failed to patch bibmacro{editor} to include year}}


Get rid of quotation marks around titles, no "in" and bold volumes for articles.

\DeclareFieldFormat[article, inbook, incollection, inproceedings, patent, thesis, unpublished]{title}{#1\isdot}
\renewbibmacro{in:}{}
\DeclareFieldFormat[article]{volume}{\mkbibbold{#1}}


To avoid printing the date twice, we suppress it at the end

\renewbibmacro*{date}{}
\renewbibmacro*{issue+date}{%
\iffieldundef{issue}
{}
{\printtext[parens]{\printfield{issue}}}%
\newunit}


We want the pages field without any "p" or "pp", but preceded by a colon.

\DeclareFieldFormat{pages}{#1}


This gives

\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*}

\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}
{\typeout{successfully patched bibmacro{author} to include year}}
{\typeout{failed to patch bibmacro{author} to include year}}
\xapptobibmacro{editor}
{\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}

\begin{document}
Let's cite \cite{ho1995,casertPrgQPrgX}.
\printbibliography
\end{document}


• I'm always happy to see xpatch at work. ;-) – egreg Jan 31 '14 at 14:55

It's a rather old thread but I stumbled on it on my own search for a bibtex/biblatex file to reproduce ASM journals reference style

I worked on the already advanced instructions from @moewe and I put everything together in a tex file available on my github, it's likely not optimal but for now it correctly reproduces book, article and incollection entries

\usepackage[style=numeric, subentry, sorting=none, backend=biber, firstinits=true, terseinits=true, url=false, doi=true, isbn=false, maxbibnames=999, eprint=false]{biblatex}

\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{booktitle}{#1}

%have vol:pag for article

%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}
{\typeout{successfully patched bibmacro{author} to include year}}
{\typeout{failed to patch bibmacro{author} to include year}}
\xapptobibmacro{editor}
{\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
}

%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}%