[Tex/LaTex] Biblatex Bibliography: How to make year bold and put editor in parentheses

biblatex

First question, so tell me all the things I do wrong!

So thanks to @moewe (Bold the last names authors/editors in a biblatex bibliography (but only the ones in front of the title)) my bibliography looks almost as I want it to. Two more things:

a) how do I put the "editor"-remark (in my German example "Hrsg.") in parentheses, without the comma after the name

b) how do I make the year bold?

So now it looks like: Lastname, Firstname, Hrsg. (YEAR): […]

It should look like: Lastname, Firstname (Hrsg.) (YEAR): […]

\documentclass[11pt, a4paper, ngerman, headsepline]{scrreprt}

\usepackage[utf8]{inputenc}

\usepackage[T1]{fontenc}

\usepackage[ngerman]{babel}

%biblatex
\usepackage[
backend=biber,
style=authoryear-icomp,
ibidpage=true,
natbib,
ibidtracker=true,
idemtracker=true,
maxbibnames=9,
maxcitenames=2,
dashed=false
]
{biblatex}

\addbibresource{lit_test.bib}

%divide names by slash
\let\oldmultinamedelim\multinamedelim
\let\oldfinalnamedelim\finalnamedelim
\renewcommand*{\multinamedelim}{\addslash}
\renewcommand*{\finalnamedelim}{\addslash}

%last name bold
\DeclareNameAlias{sortname}{family-given-fb}
\DeclareNameFormat{family-given-fb}{%
    \renewcommand*{\mkbibnamefamily}[1]{\mkbibbold{##1}}%
    \ifgiveninits
    {\usebibmacro{name:family-given}
        {\namepartfamily}
        {\namepartgiveni}
        {\namepartprefix}
        {\namepartsuffix}}
    {\usebibmacro{name:family-given}
        {\namepartfamily}
        {\namepartgiven}
        {\namepartprefix}
        {\namepartsuffix}}%
    \usebibmacro{name:andothers}}

%colon insted of period after year
\renewcommand*{\labelnamepunct}{\addcolon\space}

\begin{document}

\cite{Hirsch}

\printbibliography

\end{document}

Best Answer

Add the following redefinitions of macros from authoryear.bbx to your preamble

The part for a) is a slightly modernised version of lockstep's answer to biblatex: How to remove the comma before ed./eds.?

\makeatletter
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DeclareFieldFormat{parensbold}{\mkbibparens{\mkbibbold{#1}}}
\newbibmacro*{bbx:editor}[1]{%
  \ifboolexpr{
    test \ifuseeditor
    and
    not test {\ifnameundef{editor}}
  }
    {\usebibmacro{bbx:dashcheck}
       {\bibnamedash}
       {\printnames{editor}%
        \setunit{\addspace}%
        \usebibmacro{bbx:savehash}}%
     \usebibmacro{#1}%
     \clearname{editor}%
     \setunit{\printdelim{nameyeardelim}}}%
    {\global\undef\bbx@lasthash
     \usebibmacro{labeltitle}%
     \setunit*{\printdelim{nonameyeardelim}}}%
  \usebibmacro{date+extrayear}}

\renewbibmacro*{date+extrayear}{%
  \iffieldundef{\thefield{datelabelsource}year}
    {}
    {\printtext[parensbold]{%
       \iffieldsequal{year}{\thefield{datelabelsource}year}
         {\printdateextralabel}%
         {\printfield{labelyear}%
          \printfield{extrayear}}}}}%
\makeatother
Related Question