I wish to add a new entry to the biblatex
bibliography type @online
. For example,
@online{abc,
author = {A Author},
title = {Some lengthy title that's awesome},
url = {http://tex.stackexchange.com},
breakurl = {}
}
I've added a breakurl
field (that could be blank), that I want to condition on when using the online
bibliography driver to possibly insert a line break. However, I'm unable to successfully achieve this, even after following the guidelines in Add field "tome" to biblatex entries.
Here is a minimal example:
\documentclass{article}
\usepackage{filecontents,showframe}
\usepackage{biblatex}
\begin{filecontents*}{mybib.bib}
@online{abc,
author = {A Author},
title = {Some lengthy title that's awesome},
url = {http://tex.stackexchange.com},
breakurl = {}
}
\end{filecontents*}
\addbibresource{mybib.bib}
% https://tex.stackexchange.com/q/163303/5764
\DeclareDatamodelFields[type=field,datatype=verbatim,nullok=true]{breakurl}
\DeclareDatamodelEntryfields{breakurl}
\DeclareFieldFormat[online]{breakurl}{}% Used as a boolean variable
\begin{document}
\nocite{*}
\printbibliography
\end{document}
After compiling with biber
, the breakurl
field is not visible in the .bbl
:
\refsection{0}
\sortlist{nty}{nty}
\entry{abc}{online}{}
\name{author}{1}{}{%
{{hash=1318a946c3fffa54cec1130748f21c17}{Author}{A\bibinitperiod}{A}{A\bibinitperiod}{}{}{}{}}%
}
\strng{namehash}{1318a946c3fffa54cec1130748f21c17}
\strng{fullhash}{1318a946c3fffa54cec1130748f21c17}
\field{sortinit}{A}
\field{sortinithash}{b685c7856330eaee22789815b49de9bb}
\field{labelnamesource}{author}
\field{labeltitlesource}{title}
\field{title}{Some lengthy title that's awesome}
\verb{url}
\verb http://tex.stackexchange.com
\endverb
\endentry
\endsortlist
\endrefsection
The motivation behind adding a new field is that it can easily be ignored by biber
or by the driver. An alternative would be to include such line breaks as part of the field entries in the @online
source, but that is not acceptable.
The more general question would be: How can I add a field to an existing biblatex
type?
.dbx
file that you then load in the options:\usepackage[datamodel=mydbxfile]{biblatex}
. I'd probably also do:\DeclareDatamodelEntryfields[online]{breakurl}
since this seems like a fairly specific use.\breakurl
which expands to nothing when you are not using it?