Is it possible to create a new command by \newcommand
or \def
"inside" the .bib-file?
I am using LuaLaTeX and biblatex and organize my bibliography with BibDesk on a mac. I also store information about reprints of paper x in collection y. I add this information in the Addendum
-field of biblatex by something like
\bibstring{reprintin}\intitlepunct\addspace\citeauthor{author:1986}\labelnamepunct\addspace\citetitle{author:1986}\addcomma\space\citeyear{author:1986}
etc.
For that I had to define some bibstrings in the preamble fo the .tex-files:
\NewBibliographyString{reprintin}
\DefineBibliographyStrings{american}{
reprintin = {Reprint in},
}
\DefineBibliographyStrings{british}{
reprintin = {Reprint in},
}
\DefineBibliographyStrings{german}{
reprintin = {Nachdruck in},
}
\DefineBibliographyStrings{ngerman}{
reprintin = {Nachdruck in},
}
I now would like to create a newcommand \bibreprintin
that allows me to just prompt in the addendum-field \bibreprintin{author:1986}
instead of entering the above code bibstring{reprintin} ...
.
Thereby I'd enable myself to change the look of the reprint-information later with "one click" should it become necessary later, and also make it safe that all reprint information for all publications in my bibliorgaphy look the same.
My question now is, if there is any possibility to use commands like \def
, \newcommand
, and \NewBibliographyString
inside the .bib-file (for this is only one file) and not just inside every single .tex-file (for these are many different files I am working on).
Best Answer
You can define (La)TeX commands in the
bib
file via@preamble
and theexecute
field. The latter is intended for definitions on a per-entry basis.New bibliography strings should be initialized elsewhere, in one of:
biblatex.cfg
)tex
file)lbx
files)bbx
orcbx
)For your case Ulrike's suggestion (the configuration file) seems most appropriate.
Reprints are now best handled with the "related entries" feature in the soon-to-be-released development versions of
biblatex
andbiber
. Here's an example (using only thetex
file, for simplicity).Related entry information is formatted by the bibliography macro
related:default
defined inbiblatex.def
. This format can be overridden by defining a bibliography macrorelated:<relatedtype>
that takes the related entry key as a single argument. The following will emulate the formatting you currently do in theaddendum
field.