[Tex/LaTex] Biblatex: changing the order of entries

biblatex

I switched to biblatex only recently and I'm still struggling with understanding how to do things properly. My question is: How to change the order of entries/units/blocks in the bibliography? The style I'm using is "numeric". Now, the default order is:

B. B. Aggarwal, Y. Takada, and O. V. Oommen. “From chemoprevention
to chemotherapy: common targets and common goals”. In: Expert Opin
Investig Drugs
13.10 (Oct. 2004), pp. 1327–1338.

Basically, I need commas as separators, a comma between the journal title and the volume; "In:" should be removed, the volume and the number should have prefixes and comma as a separator, and, finally, the date should go at the end, without the brackets. Something like this:

B. B. Aggarwal, Y. Takada, and O. V. Oommen, “From chemoprevention
to chemotherapy: common targets and common goals”, Expert Opin
Investig Drugs
, vol. 13, no. 10, pp. 1327–1338, Oct. 2004.

If there is a step-by-step tutorial about how to customize bibliography or how to crate a bibliography style for use with biblatex, I'll be most grateful for it. Thanks.

Here's a code for testing purposes:

\begin{filecontents}{mybib.bib}
@article{Aggarwal2004b,
author = {Aggarwal, B. B. and Takada, Y. and Oommen, O. V.},
journal = {Expert Opin Investig Drugs},
month = oct,
number = {10},
pages = {1327--1338},
publisher = {Informa Pharma Science},
title = {{From chemoprevention to chemotherapy: common targets and common goals}},
volume = {13},
year = {2004}
}
\end{filecontents}
\documentclass{article}
\usepackage[style=numeric]{biblatex}
\bibliography{mybib}  
\begin{document}
Test~\cite{Aggarwal2004b}.
\printbibliography
\end{document}

Best Answer

Add the following to your preamble (or the configuration file biblatex.cfg):

% Commas as separators
\renewcommand*{\newunitpunct}{\addcomma\space}

% Comma before and after journal volume
\renewbibmacro*{volume+number+eid}{%
  \setunit*{\addcomma\space}% NEW
  \printfield{volume}%
%  \setunit*{\adddot}% DELETED
  \setunit*{\addcomma\space}% NEW
  \printfield{number}%
  \setunit{\addcomma\space}%
  \printfield{eid}}

% Prefixes for journal volume and number
\DeclareFieldFormat[article]{volume}{\bibstring{volume}~#1}% volume of a journal
\DeclareFieldFormat[article]{number}{\bibstring{number}~#1}% number of a journal

% Comma before date; date not in parentheses
\renewbibmacro*{issue+date}{%
  \setunit*{\addcomma\space}% NEW
%  \printtext[parens]{% DELETED
    \iffieldundef{issue}
      {\usebibmacro{date}}
      {\printfield{issue}%
       \setunit*{\addspace}%
%       \usebibmacro{date}}}% DELETED
       \usebibmacro{date}}% NEW
  \newunit}

% Issue/date macros removed after journal number
\renewbibmacro*{journal+issuetitle}{%
  \usebibmacro{journal}%
  \setunit*{\addspace}%
  \iffieldundef{series}
    {}
    {\newunit
     \printfield{series}%
     \setunit{\addspace}}%
  \usebibmacro{volume+number+eid}%
%  \setunit{\addspace}% DELETED
%  \usebibmacro{issue+date}% DELETED
%  \setunit{\addcolon\space}% DELETED
%  \usebibmacro{issue}% DELETED
  \newunit}

% "In:" removed for articles; issue/date macros added after note+pages macro
\DeclareBibliographyDriver{article}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{bytranslator+others}%
  \newunit\newblock
  \printfield{version}%
  \newunit\newblock
%  \usebibmacro{in:}% DELETED
  \usebibmacro{journal+issuetitle}%
  \newunit
  \usebibmacro{byeditor+others}%
  \newunit
  \usebibmacro{note+pages}%
  \setunit{\addspace}% NEW
  \usebibmacro{issue+date}% NEW
  \setunit{\addcolon\space}% NEW
  \usebibmacro{issue}% NEW
  \newunit\newblock
  \iftoggle{bbx:isbn}
    {\printfield{issn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \usebibmacro{finentry}}

Note that I removed "In:" only for articles - it should still show up e.g. in an @incollection entry. Also note that moving the date immediately after the page numbers may be misleading (the year in your example may be mistaken for page 2004).

As for step-by-step tutorials, the best way is to a) thoroughly study the biblatex documentation and b) delve into biblatex.def and standard.bbx. For those fluent in German, there are also the excellent tutorials by Dominik Waßenhoven.

EDIT: Herbert has provided a more elegant way to remove "In" only for articles.