# Biblatex: changing the order of entries

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}

-

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

% Commas as separators

% Comma before and after journal volume
\renewbibmacro*{volume+number+eid}{%
\printfield{volume}%
\printfield{number}%
\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}{%
%  \printtext[parens]{% DELETED
\iffieldundef{issue}
{\usebibmacro{date}}
{\printfield{issue}%
%       \usebibmacro{date}}}% DELETED
\usebibmacro{date}}% NEW
\newunit}

% Issue/date macros removed after journal number
\renewbibmacro*{journal+issuetitle}{%
\usebibmacro{journal}%
\iffieldundef{series}
{}
{\newunit
\printfield{series}%
\usebibmacro{volume+number+eid}%
%  \usebibmacro{issue+date}% 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}%
\usebibmacro{issue+date}% NEW
\usebibmacro{issue}% NEW
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{issn}}
{}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\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.

-
+1 for mentioning my German tutorials (c; – just kidding. Very nice answer! BTW, I think it would be really nice to have some tutorial in English for biblatex customization. I have no time to translate my tutorials (and bring them up to date), but it would be great if anybody wanted to do this – I could at least offer my help. –  domwass Dec 9 '10 at 12:09
Well, guys, you just put those tutorials forward, we're all good friends with Google Translate ;) –  Meho R. Dec 9 '10 at 13:30
Your answer and comments are of great value to me, lockstep. Thanks a lot. –  aqua Dec 10 '10 at 9:50