0

I'm trying to manipulate my bibliography using biber. I want authors and years to be printed completely in bold face. However, I could only make names (and prefixes etc.) bold but could not figure out how to do the same thing with the "and"s between authors' names. I got the same problem with the year of publication.

This is what I did so far:

\usepackage[backend=biber,
style=authoryear,
citestyle=apa]{biblatex}
\addbibresource{mybib.bib}
....
\begingroup
\setlength\bibitemsep{10pt}
\renewcommand{\labelnamepunct}{\addcolon\space}
\renewcommand*{\mkbibnamefamily}[1]{\textbf{#1}}
\renewcommand*{\mkbibnamegiven}[1]{\textbf{#1}}
\renewcommand*{\mkbibnameprefix}[1]{\textbf{#1}}
\renewcommand*{\mkbibnamesuffix}[1]{\textbf{#1}}
\printbibliography 
\addcontentsline{toc}{chapter}{Bibliography}
\endgroup    

I would be so glad if somebody could help me here!

Edit: For the sake of completeness, I already found a solution to print the year (and parantheses around it) in bold type:

\DeclareFieldFormat{parens}{\bfseries{\mkbibparens{#1}}} 
\DeclareFieldFormat{date}{\bfseries{#1}} 
  • Welcome to TeX.SX! BTW: \addcontentsline after \printbibliography would add the last page of the bibliography to the ToC not the first. See bibintoc in the biblatex manual for information about how to add the bibliography into the ToC. – Schweinebacke Sep 4 '17 at 9:17
  • Thanks, I did not notice that so far but changed it now! – Jonathan Sep 4 '17 at 9:37
  • style=authoryear, citestyle=apa is neither here nor there. A document like this will not conform with APA style. Does only style=authoryear not give you what you need? – moewe Sep 4 '17 at 12:24
  • \DeclareFieldFormat{parens}{\bfseries{\mkbibparens{#1}}} will potentially make much more bold than just the parentheses around the year. It will make all parentheses typeset by biblatex bold. – moewe Sep 4 '17 at 13:13
  • If you want the entire 'label', i.e. names and year bold, use Bibliography with biblatex: how to achieve bold labels using the authoryear-style? – moewe Sep 4 '17 at 13:28
1

In your preamble, add these lines

\DeclareNameAlias{sortname}{given-family-bold}
\DeclareNameFormat{given-family-bold}{\mkbibbold{%
  \ifgiveninits
    {\usebibmacro{name:given-family}{\namepartfamily}{\namepartgiveni}
{\namepartprefix}{\namepartsuffix}}
    {\usebibmacro{name:given-family}{\namepartfamily}{\namepartgiven}
{\namepartprefix}{\namepartsuffix}}%
  \usebibmacro{name:andothers}}}

The MWE

\documentclass[12pt,a4paper]{report}
\usepackage{lipsum}
\usepackage[backend=biber,style=authoryear,citestyle=apa]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{test1,
author    = {Goossens, Michel and Mittelbach, Frank and Samarin, Alexander},
title     = {The LaTeX Companion},
publisher = {Addison-Wesley},
location  = {Reading, Mass.},
year      = {1994},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\DeclareNameAlias{sortname}{given-family-bold}

\DeclareNameFormat{given-family-bold}{\mkbibbold{%
  \ifgiveninits
    {\usebibmacro{name:given-family}{\namepartfamily}{\namepartgiveni}{\namepartprefix}{\namepartsuffix}}
    {\usebibmacro{name:given-family}{\namepartfamily}{\namepartgiven}{\namepartprefix}{\namepartsuffix}}%
    \usebibmacro{name:andothers}}}

\begin{document}
\chapter{Test}
Test paragraph, just random words \parencite{test1}. \lipsum[1-2]

\setlength\bibitemsep{10pt}
\printbibliography 

\end{document}

As the OP wants the bibliography to be sorted lastname, firstname, firstname lastname and firstname lastname, as @moewe pointed out in https://tex.stackexchange.com/a/178877/35864 -- these lines should go in the preamble.

\DeclareNameAlias{sortname}{family-given/given-family-bold}
\DeclareNameFormat{family-given/given-family-bold}{\mkbibbold{%
  \ifnumequal{\value{listcount}}{1}
    {\ifgiveninits
      {\usebibmacro{name:family-given}
        {\namepartfamily}
        {\namepartgiveni}
        {\namepartprefix}
        {\namepartsuffix}}
      {\usebibmacro{name:family-given}
        {\namepartfamily}
        {\namepartgiven}
        {\namepartprefix}
        {\namepartsuffix}}%
      \ifboolexpe{%
        test {\ifdefvoid\namepartgiven}
        and
        test {\ifdefvoid\namepartprefix}}
      {}
      {\usebibmacro{name:revsdelim}}}
    {\ifgiveninits
      {\usebibmacro{name:given-family}
        {\namepartfamily}
        {\namepartgiveni}
        {\namepartprefix}
        {\namepartsuffix}}
      {\usebibmacro{name:given-family}
        {\namepartfamily}
        {\namepartgiven}
        {\namepartprefix}
        {\namepartsuffix}}}%
      \usebibmacro{name:andothers}}}
  • Thanks for your help! The problem is (thats why I included all the other command only right before my bibliography) that using this command makes all the "and"s in my citations bold. My citations should have a regular typeface while my bibliography should show bold authors and years – Jonathan Sep 4 '17 at 9:41
  • I did not check the citation. I edited the answer. It should make the authors and the "and" string bold on bibliography but not on the citation. – M. Ridha Siregar Sep 4 '17 at 10:44
  • Use \parencite{foo} instead of (\cite{foo}) – moewe Sep 4 '17 at 12:23
  • @moewe Absolutely, parencite gives the parentheses :-) – M. Ridha Siregar Sep 4 '17 at 12:46
  • Thanks a lot again, it nearly looks how I imagined it now! Just one last thing, is there a simple way to not change the ordering of given and family names of authors? Before, the ordering for the first author was "lastname, firstname", for following authors "firstname lastname". Thats how I want it to look like. Your code however makes all authors' names look like "firstname lastname" (or the other way around if we change "given" and "family"). I tried to split the code between the first author's name and all the following authors' names but could not make it work so far. – Jonathan Sep 4 '17 at 13:04

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.