Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have migrated recently to biblatex and am trying to understand the many possibilities to tune and tweak the appearance of references in the bibliography. For example, for a work in a collection with a certain volume entry, I want to change the appearance of this volume in the bibliography.

I came along the renewbibmacro construction. Hence I added in the preamble of my document

\renewbibmacro*{volume}{%
    \printtext{VOLUMEMACRO}\space\printfield{volume}%
}%

This didn't result in anything, whereas using the DeclareFieldFormat did work:

\DeclareFieldFormat{volume}{\printtext{VOLUMEDECLARE} #1}

However, it didn't apply to the volume field in the article. When I used the renewbibmacro for author, it did work for an article:

\renewbibmacro*{author}{%
    \printtext{anon}%
}

I have searched this forum, as well as the biblatex manual, but could not find a concise overview on how to use these renewbibmacro and DeclareFieldFormat functions. Hence I am posting this myself. So I am interested to learn about the usage of this constructions, and what fields can and cannot be changed this way.

A MWE that shows that the DeclareFieldFormat for volume applies to the collection only, and that the renewbibmacro for author works:

\documentclass[10pt, english]{report}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[backend=biber,style=authoryear]{biblatex}

\begin{filecontents}{abib.bib}
@article{some:article:1964,
    author   = "Mister Smart",
    title    = {A very difficult narrative of sub-atomic particles in the diary of Louis XIV},
    journal  = {Journal for Advanced Thinking},
    volume   = "41",
    number   = "3",
    year     = "1964",
    pages    = "307--323"
}    
@collection{collection:mass:histroical:vol1,
    options      = useeditor,
    title     = {Collections of the Massachusetts Historical Society},
    volume    = {i},
    series    = {third series},
    address   = {Boston},
    year      = 1896,
    sorttitle = {Collections of the Massachusetts Historical Society},
    shorthand = {Collections MHS Vol.~1},
    publisher = {Massachusetts Historical Society}
}
\end{filecontents}

\addbibresource{./abib.bib}

\DeclareFieldFormat{volume}{\printtext{VOLUMEDECLARE} #1}

%\newbibmacro*{volume}{%
%  \printtext{VOLUMEMACRO}\space\printfield{volume}%
%}%

\renewbibmacro*{author}{%
  \printtext{anon}%
}

\begin{document}
Test ~\textcite{some:article:1964} and~\textcite{collection:mass:histroical:vol1}.
\printbibliography
\end{document}
share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

You have to differ between bibmacros, its field formats and bibdrivers.

  • bibdrivers (file standard.bbx) are macros which print out the different entries, whereby each entry type (like book, article; except familiar ones) has its own macro.
  • bibmacros are the biblatex basic macros which i.e. collect data for one specific topic: The printed author information maybe needs to be replaced by the editor information if no author is given etc.

  • field formats work on a lower level. They are set for specific entry fields (author, title, year), while the bibmacros/bibdrivers patch them together. You can set field formats globally for all entry types or only for specific entry types, i.e. only emphasize the title field for the entry type book (just set it in square brackets).

To your MWE/code snippets:

\renewbibmacro*{volume}{%
    \printtext{VOLUMEMACRO}\space\printfield{volume}%
}%

That code snippet won't do anything since a) there never was a macro volume declared, and b) it wouldn't make much sense to declare one, since it only prints out information + a basic string.

\DeclareFieldFormat{volume}{\printtext{VOLUMEDECLARE} #1}

That is the right way to do it, since volume is a field...

But: If you want to have that format for all entry types, including the formats which already have been set, you have to overwrite all existing formats by used the starred version:

\DeclareFieldFormat*{volume}{\printtext{VOLUMEDECLARE} #1}

Following code snippet doesn't make sense, since it replaces all author information by your anon string:

\renewbibmacro*{author}{%
    \printtext{anon}%
}
share|improve this answer
    
Thank you very much for this detailed explanation. I was assuming wrongly that all entry fields (author, volume, title) in an entry type would have the same interface functions for making changes. Now I look further in the biblatex manual, the difference between a list entry as author and a field entry as volume become clear. My example for author was just an experiment to see if I could change the author field this way. –  wdrenth Jul 12 at 17:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.