2

I have encountered two issues which might be related:

first of all I'm wondering if it is possible to have a better/clean solution to changing the intext cite style of biber. My required format is: (LAST_NAME YEAR) or (LAST_NAME YEAR: PAGENUMBER). I have achieved that by the following commands (using \parencite):

\DeclareFieldFormat{postnote}{#1} %remove p
\DeclareFieldFormat{multipostnote}{#1} %remove pp
\renewcommand*{\nameyeardelim}{\addspace} %just space between name and year
\renewcommand*{\postnotedelim}{\addcolon\space} %colon after year

Is there a cleaner/better way to change the cite style in biber (probably my solution is bound to produce problems?)? In natbib there was \setcitestyle{notesep={: }} and \setcitestyle{aysep={}} but I need it in biber.

Secondly I would like to change the hyperref box to the WHOLE Cite, but currently it only extend to the year:

enter image description here

Is it possible (although probably not useful for multi-author-quotes) to extend the hyperref box to everything within the parenthesis?

Here the MWE:

\documentclass{scrartcl}
\usepackage[style=authoryear]{biblatex}
\usepackage{hyperref}

\DeclareFieldFormat{postnote}{#1} %remove p
\DeclareFieldFormat{multipostnote}{#1} %remove pp
\renewcommand*{\nameyeardelim}{\addspace} %just space between name and year
\renewcommand*{\postnotedelim}{\addcolon\space} %colon after year

\addbibresource{biblatex-examples.bib}

\begin{document}

\parencite[1--2]{aristotle:poetics}

\parencite{aristotle:poetics}

\newpage

\printbibliography

\end{document}

Cheers!

4

As you have there two questions, I'll give you different sorts of advice regarding each of them.

As to the first, the redefinition of delimiters. biblatex has two "types" of delimiters, some are context sensitive, others are not. nameyeardelim is one of those context sensitive ones. In biblatex.def you'll find its definitions as:

\DeclareDelimFormat{nameyeardelim}{\addspace}
\DeclareDelimFormat[textcite]{nameyeardelim}{\addspace}
\DeclareDelimFormat[bib,biblist]{nameyeardelim}{\addspace}

You notice the definition is done for each of different types of context. Of course, the definition in this case, is the same. But the possibility of defining it separately is built-in. So, if you do:

\renewcommand*{\nameyeardelim}{\addspace}

It will work, but this context sensitivity characteristic of the delimiter is gone, and you probably are getting more than what you asked for. So, you should use instead the proper interface for context sensitive delimiters of biblatex. For example, if you want the change to apply to parencites:

\DeclareDelimFormat[parencite]{nameyeardelim}{\addspace}

supplying the contexts as the case may be.

\postnotedelim, on the contrary, is a "plain" delimiter, defined in biblatex.def as:

\newcommand*{\postnotedelim}{\addcomma\space}

So, here, clearly there is no harm in redefining it with \renewcommand*. It is actually the natural way to do it.

As to postnote and multipostnote, you are there in the right direction, \DeclareFieldFormat is the right tool for the job. But some improvement can be made. The original definition of those are (in a recent version of biblatex):

\DeclareFieldFormat{postnote}{\mkpageprefix[pagination][\mknormrange]{#1}}
\DeclareFieldFormat{multipostnote}{\mkpageprefix[pagination][\mknormrange]{#1}}

\mkpageprefix, as the name suggests, is indeed responsible for adding "p."/"pp." or similar, as the case may be. So, removing it is what you want. But the above field formatting directives are also doing a second job, with \mknormrange, which parses the postnote argument for page ranges and normalises them. So, you would get better results with:

\DeclareFieldFormat{postnote}{\mknormrange{#1}}
\DeclareFieldFormat{multipostnote}{\mknormrange{#1}}

Regarding your second question, of hyperlinking the whole citation, and not just the year, there are plenty of questions and corresponding solutions here on the site. See, for example:

hyperlink name with biblatex authoryear (biblatex 1.4b)

hyperlink name with biblatex authoryear

Biblatex, authoryear-comp, and hyperlinks

Note, however, that the issue is less trivial than it looks. PLK left a comment in one of Audrey's answers saying "Hmm, I rather think it should be the default." But the issue was later discussed in biblatex's issue tracker (https://github.com/plk/biblatex/issues/428) and the conclusion there seems to be there was good reason in the choice to hyperlink only the year, and the issue was closed as "wontfix".

Of course, you certainly can still get good alternatives in one of the links above, if you'd like to do it.

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.