I need to add a new field in the @book
or @InProceedings
entries:
this field is "tome", for I have for instance the following title:
Francesco Bertolini, Società di trasmissione orale: mito e folclore, in Lo spazio letterario della Grecia antica, a cura di G. Cambiano, L. Canfora e D. Lanza, vol. I, tomo I, Salerno, Roma 1992, pp. 47--75.
So the following code is not enough:
@InProceedings{ bertolini:1992,
author = "Francesco Bertolini",
title = "Società di trasmissione orale: mito e folclore",
booktitle = "Lo spazio letterario della Grecia antica",
editor = "G. Cambiano and L. Canfora and D. Lanza",
publisher = "Salerno",
location = "Roma",
year = "1992",
volume = "1,
pages = "47--75",
}
Using othes codes, I was able only to produce the "tome" field, but with a general trouble about the other fields:
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\step[fieldsource=tome,fieldtarget=usera]
}
}
}
\DeclareFieldFormat{usera}{tomo\space{#1}}
\DeclareBibliographyDriver{book}{%
\usebibmacro{author/editor}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit\newblock
\usebibmacro{journal+issuetitle}%
\setunit{\bibpagespunct}%
\printfield{pages}%
\newunit\newblock
\printfield{usera}%
\usebibmacro{finentry}}
\renewcommand*{\finentrypunct}{}
(useful for articles, but not for my case). By real, I'm not able to understand which bibmascros I have to invocate…
I tried to write a biblatex-tome.dbx
:
\ProvidesFile{biblatex-tome.dbx}
\DeclareDatamodelFields[type=field,datatype=literal,skipout=false]{tome}
\DeclareDatamodelEntryfields{tome}
Inside the main .tex
file I put just this code:
\DeclareFieldFormat{tome}{\mkbibacro{tome}\addcolon\space #1}
\newcommand*{\patchmoretome}[1]{
\xpatchbibdriver{#1}%
{\printfield{tome}}
{\printfield{tome}%
\newunit\newblock
\printfield{tome}}%
{\typeout{patching #1 to include more tome succeded}}%
{\typeout{patching #1 to include more tome failed}}%
}
% patch all drivers
\patchmoretome{article}
\patchmoretome{book}
\patchmoretome{collection}
\patchmoretome{inbook}
\patchmoretome{incollection}
\patchmoretome{inproceedings}
\patchmoretome{manual}
\patchmoretome{periodical}
\patchmoretome{proceedings}
\patchmoretome{report}
\patchmoretome{thesis}
but it doesn't print the field in bibliographic entry. So I'm very confused about a (re)writing of driver
Best Answer
Use an existing field (
part
)If you use the
part
field for tome information1, there is not a lot to be done in the standard styles. If you have a non-standard/custom style that moves around thepart
information though, you would need to tell us more about it.These four lines should do what you want. They redefine the string part to be "tomo" and print ", tomo #" after the volume.
All the standard styles use the sequence
to print
part
information, so we should be fine.(Normally, putting
\addcomma
and the like in\DeclareFieldFormat
is frowned upon, but thepart
field seems to be special insofar that the default format is{.#1}
and that there is no other punctuation inserted betweenvolume
andpart
by any of the standard styles.)Your
bib
entry would beFull MWE
1 The
biblatex
documentation states on page 21, §2.2.2 Data Fields,Map the field to an existing field (
part
)You could also map the field
tome
topart
thus creating an alias for input purposesThe sample entry might look like this then
For more general purposes,
biblatex
defines the five generic fieldsusera
touserf
(as well aslista
tolistf
for lists fields andnamea
tonamec
for names). While it might be awkward to use these fields in the input.bib
file, where more useful names are expected, they are useful for internal remapping.Declare a new field
If you absolutely insist on creating a new data field
tome
, create a new datamodel file,tome.dbx
, with the following content and put it somewhere LaTeX can find it (this is necessary since version 2.9, before that it was possible to use datamodel commands directly in the document, but this is not guaranteed to work and therefore strongly discouraged, see Data model macro cannot be used in preamble; LaTeX will be able to find the.dbx
file if you place it in the same folder as your main.tex
document, other options to make the file globally available are discussed in https://texfaq.org/FAQ-inst-wlcf).(In the MWE below this file is created automatically using the
filecontents
package.)We then have to load
biblatex
with the optiondatamodel=tome
in order to get load the correct datamodel wheretome
is defined. Alternatively, you can put the above lines intobiblatex-dm.cfg
(see How to include price in bibliography?).Again we use localisation strings
We will then have to patch all the drivers/macros to include
tome
information, that is quite a task...We
renew
some macrosAnd add tome to the drivers
MWE
That much hassle probably is not worth it as we have
part
that seems to do what you want rather well.