1

I have three bibliographies, which utilize categories and keywords to separate all the entries

\printbibliography[title={Publications related to theses},category=cited,heading=subbibliography,keyword=ownpub]

\printbibliography[title={Publications unrelated to theses},category=notcited,heading=subbibliography,keyword=ownpub]

\printbibliography[heading=bibintoc,resetnumbers=true,notcategory=cited,notcategory=notcited,notkeyword=ownpub]

I want the first two to have different styles than the last one. I found the commands on the internet to modify the behaviour of the first two to work in the way I want it (bold author name and different style of numbering).

the numbering:

\DeclareFieldFormat{labelnumberwidth}{{#1\adddot}}

the name:

\newcommand{\makeauthorbold}[1]{%
\DeclareNameFormat{author}{%
  \edef\tempname{{Ferdinandy}}%
  \ifnumequal{\value{listcount}}{1}
    {\ifnumequal{\value{liststop}}{1}
      {\expandafter\ifstrequal\tempname{##1}{\textbf{##1\addcomma\addspace ##4\addcomma\isdot}}{##1\addcomma\addspace ##4\addcomma\isdot}}
      {\expandafter\ifstrequal\tempname{##1}{\textbf{##1\addcomma\addspace ##4}}{##1\addcomma\addspace ##4}}}
    {\ifnumless{\value{listcount}}{\value{liststop}}
      {\expandafter\ifstrequal\tempname{##1}{\textbf{\addcomma\addspace ##1\addcomma\addspace ##4}}{\addcomma\addspace ##1\addcomma\addspace ##4}}
      {\expandafter\ifstrequal\tempname{##1}{\textbf{\addcomma\addspace ##1\addcomma\addspace ##4\addcomma\isdot}}{\addcomma\addspace ##1\addcomma\addspace ##4\addcomma\isdot}}%
    }%
}%
}

Looking at the biblatex manual, I see that it is possible to apply a \DeclareFieldFormat based on the keywords, but it implies to me, that if I touch a field with this, I will have to supply the default behaviour myself (i.e. it is not possible to override default behaviour if my condition is true, I will have to supply both the true and the false condition).

\ifkeyword {〈keyword〉}{〈true〉}{〈false〉} Executes 〈true〉 if the 〈keyword〉 is found in the keywords field of the entry currently being processed, and 〈false〉 otherwise.

Is this true, or is there a way to override default behaviour for specific \printbibliography instances? The latter would be much more straightforward, then having to use several nested ifs (and very possible listing the default behaviour more than once). If true, where can I find the definitions of the default behaviours?

  • 1
    The defaults can be found in biblatex.def/standard.bbx (find them with kpsewhich). Can you maybe describe in more detail what you want/need and give a proper MWE? Otherwise your question is really hard to answer safe for the reference to the defaults. – moewe Jun 4 '17 at 16:59
  • Maybe it is enough to keep some of the redefinitions local for your purpose. Try to redefine the commands locally in a group before the respective \printbibliographys. – moewe Jun 4 '17 at 17:14
  • What do you mean by locally in a group? – fbence Jun 4 '17 at 17:15
  • 1
    You can do {\DeclareNameFormat{author}{foo}\printbibliography} - note the curly braces (presumably, at least, I couldn't test for lack of an MWE) to change the author format for only the following \printbibliography. – moewe Jun 4 '17 at 17:16
  • Wow, it works, good thought! Much more elegant than the savefieldformat, restorefieldformat solution. If you post it as an answer I'll accept that :) – fbence Jun 4 '17 at 17:22
2

You can keep the redefinitions local with grouping

{\DeclareFieldFormat{labelnumberwidth}{#1\adddot}
 \printbibliography[category=cited, keyword=ownpub]
 \printbibliography[category=notcited, keyword=ownpub]}

\printbibliography[resetnumbers=true, notcategory=cited, notcategory=notcited, notkeyword=ownpub]

or

\begingroup
  \DeclareFieldFormat{labelnumberwidth}{#1\adddot}
  \printbibliography[category=cited, keyword=ownpub]
  \printbibliography[category=notcited, keyword=ownpub]
\endgroup

\printbibliography[resetnumbers=true, notcategory=cited, notcategory=notcited, notkeyword=ownpub]

This might be more efficient than \seveformat/\restoreformat in some situations, but it might also be less elegant in some contexts.

1

I actually found a solution to this using savefieldformat and restorefieldformat. Doesn't seem very elegant though.

\savefieldformat{labelnumberwidth} %save current settings
\DeclareFieldFormat{labelnumberwidth}{{#1\adddot}} %modify for following printbibliographies

\printbibliography[title={Publications related to theses},category=cited,heading=subbibliography,keyword=ownpub]
\printbibliography[title={Publications unrelated to theses},category=notcited,heading=subbibliography,keyword=ownpub]

\restorefieldformat{labelnumberwidth} %restore what we saved

\printbibliography[heading=bibintoc,resetnumbers=true,notcategory=cited,notcategory=notcited,notkeyword=ownpub]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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