# Biblatex: Declare new driver with new fields

For several reasons I need to declare within a LaTeX-document by help of biblatex a new driver with new fields.

E.g. the following BibTeX-entry may be given:

\begin{filecontents}{\jobname.bib}
@aloa{chris,
fu = {Hawaii},
fubo = {Hawaiiboooo},
year = {2015}}
\end{filecontents}


Then I'd like to define in the LaTeX-document something like:

\DeclareBibliographyDriver{aloa}{%
\newunit\newblock
\printfield{fu}%
\newunit\newblock
\printfield{fubo}%
\newunit\newblock
\printfield{year}%
\finentry}


And then I'd like to cite the entry in such a way that I get as output in the reference list:

Hawaii Hawaiiboooo 2015

A minimal example would be like:

\documentclass{article}

\begin{filecontents}{\jobname.bib}
@aloa{chris,
fu = {Hawaii},
fubo = {Hawaiiboooo},
year = {2015}}
\end{filecontents}

\usepackage[backend=bibtex8]{biblatex}

\DeclareBibliographyDriver{aloa}{%
\newunit\newblock
\printfield{fu}%
\newunit\newblock
\printfield{fubo}%
\newunit\newblock
\printfield{year}%
\finentry}

\bibliography{\jobname.bib}

\begin{document}
\nocite{chris}
\printbibliography
\end{document}


Is it possible to do this in the LaTeX-file only (with bibtex and not biber)?

It is possible to create new drivers and new entry fields in biblatex even whithout biber.

When the backend is not biber, biblatex uses a special .bst file biblatex.bst to generate the .bbl file, thus one has to modify biblatex.bst. Here is the procedure:

1) locate biblatex.bst and make copy of it and rename the copy (i.e., mybiblatex.bst) and put the renamed copy somewhere where bibtex is able to locate it (a simple solution is to put in the same folder/directory of the latex file).

2) in the local copy locate ENTRY and add the fields you want to add:

ENTRY {
entryset
...
fu
fubo
}


this instructs bibtex that fu and fubo are bibtex fields.

3) locate in local copy FUNCTION {output.fields.3} and create a new function

FUNCTION {output.myfields} {
"fu"    fu    output:write:field
"fubo"  fubo  output:write:field
}


this function instructs bibtex how to treat the new field. for each line the first two arguments are the name of the new field(s); for the third argument, you an use output:write:<type>, where <type> is one of name, field, verb, list or year, depending on the datatype of the entry.

4) locate in the local copy the function FUNCTION {output:entry}. Add to this function output.myfields, so it should look like

FUNCTION {output:entry}{
...
output.fields.3
output.myfields
output.compat.1
...
}


5) for each new driver <driver> add the line

FUNCTION {<driver>} { type$output:entry }  in the example, this should be FUNCTION {aloa} {type$ output:entry}


\makeatletter
\def\blx@auxinit@bibtex#1{%
\blx@auxwrite\blx@auxout@bibtex
{\def\do##1{,\blx@stripbib{##1}}}
{\ifx\blx@auxout@bibtex\@mainaux
\else
\blx@msg@aux
\fi
\string\bibstyle{mybiblatex}\blx@nl
\string\bibdata{%
\blx@ctrlfile@bibtex\blxauxsuffix
\ifx#1\@empty
\else
\dolistloop#1%
\fi}\blx@nl
\string\citation{biblatex-control}}}
\makeatother


this is to tell bibtex to use mybiblatex.bst instead of the default biblatex.bst.

Here is output the on the MWE

• Thank you so much! That's perfect! Exactly what I wanted... – Christian May 13 '15 at 14:07