3

I am trying to display the year and also the parentheses in bold

Author (year):

Here is a MWE

\documentclass[12pt, bibliography=totocnumbered, listof=totoc]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[ngerman]{babel}
\usepackage{csquotes}

\usepackage{filecontents}

%Bibliotheken
\usepackage
[style=ext-authoryear,labelnumber, useprefix=true,
sorting=nyt,maxbibnames=9,maxcitenames=3,uniquelist=false, backend=biber, 
doi=false,isbn=false,url=false,
uniquename=false,bibencoding=utf8, date=year, giveninits=true, terseinits=false, dashed=false]
{biblatex}


%Colon after year
\renewcommand{\labelnamepunct}{\mkbibbold{\addcolon}\space}

%Year and parantheses in bold
\DeclareFieldFormat{date}{\mkbibbold{#1}}
\DeclareFieldFormat{parens}{\mkbibbold{\mkbibparens{#1}}}


\begin{filecontents}{\jobname2.bib}
@Article{Hansen2011,
  author  = {Hansen, Peter R. and Lunde, Asger and Nason, James M.},
  title   = {The Model Confidence Set},
  journal = {Econometrica},
  year    = {2011},
  volume  = {79},
  number  = {2},
  pages   = {453-497},
  url     = {https://EconPapers.repec.org/RePEc:ecm:emetrp:v:79:y:2011:i:2:p:453-497},
}

\end{filecontents}
\addbibresource{\jobname2.bib} 

\begin{document}
\textcite{Hansen2011}
\printbibliography
\end{document}

I tried using \mkbibbold in some way, but it didnt work well. A short explanation would be great.

4

biblatex-ext defines additional formats for fields, and among them biblabeldate which controls the "format for the labeldate in the bibliography for authoryear-like styles", so that's what you have to use for your purpose:

\DeclareFieldFormat{biblabeldate}{\mkbibbold{\mkbibparens{#1}}}

Besides that, even though you technically can redefine nametitledelim with \renewcommand, as nametitledelim is a context sensitive delimiter, in using \renewcommand you lose this context sensitivity. So, you are better off using the proper dedicated \DeclareDelimFormat:

\DeclareDelimFormat[bib,biblist]{nametitledelim}{\addcolon\space}

(for this to include the colon in bold font, as set in the formatting directive for biblabeldate the option punctfont=true is required).

In full:

\documentclass[12pt, bibliography=totocnumbered, listof=totoc]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[ngerman]{babel}
\usepackage{csquotes}

\usepackage{filecontents}

%Bibliotheken
\usepackage
[style=ext-authoryear,labelnumber, useprefix=true,
sorting=nyt,maxbibnames=9,maxcitenames=3,uniquelist=false, backend=biber,
doi=false,isbn=false,url=false,
uniquename=false,bibencoding=utf8, date=year, giveninits=true, terseinits=false,
dashed=false, punctfont=true]
{biblatex}


%Colon after year
\DeclareDelimFormat[bib,biblist]{nametitledelim}{\addcolon\space}

%Year and parantheses in bold
\DeclareFieldFormat{biblabeldate}{\mkbibbold{\mkbibparens{#1}}}


\begin{filecontents}{\jobname2.bib}
@Article{Hansen2011,
  author  = {Hansen, Peter R. and Lunde, Asger and Nason, James M.},
  title   = {The Model Confidence Set},
  journal = {Econometrica},
  year    = {2011},
  volume  = {79},
  number  = {2},
  pages   = {453-497},
  url     = {https://EconPapers.repec.org/RePEc:ecm:emetrp:v:79:y:2011:i:2:p:453-497},
}

\end{filecontents}
\addbibresource{\jobname2.bib}

\begin{document}
\textcite{Hansen2011}
\printbibliography
\end{document}

enter image description here

  • \DeclareDelimFormat[bib,biblist]{nametitledelim}... would be prettier than \renewcommand{\labelnamepunct}.... If you set the punctfont option to true it should not even be necessary to add the \mkbibbold, the format of the previous field would automatically be applied to the following punctuation. – moewe Dec 30 '18 at 7:39
  • @moewe The answer's "prettification" is duly done. Thank you! Btw, if I'm not mistaken, this must be my first biblatex-ext answer. :-) – gusbrs Dec 30 '18 at 10:28
  • The \setpunctfont{\textbf} is superfluous since you are using \mkbibbold in the field format. The \mkbib... commands execute the appropriate \setpunctfont automatically. – moewe Dec 30 '18 at 15:44
  • @moewe I see, neat. As a matter of fact, I didn't really know punctfont existed (or didn't remember...). But, in general, is it usually safe to assume that the following punctuation mark will obey the previous field formatting directive? It is not really intuitive (true, it makes sense in light of the punctuation tracker). – gusbrs Dec 30 '18 at 16:09
  • If punctfont is active and all field formats use the \mkbib... commands then the following punctuation command will use the same font (italic, bold, upright). If it works properly this is quite intuitive I think, at least if you want this to happen. – moewe Dec 30 '18 at 16:15

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.