I'm using biblatex with the authoryear-comp style. By default, the \cite
command prints citations with no parentheses. I would like to keep this behavior while putting any postnote in parenthes following the citation, like this: See Author 2020 (postnote). For other citation commands I still want the regular punctuation (a comma, by default), e.g. \textcite
should produce Author (2020, postnote) and \parencite
should produce (Author 2020, postnote).
I have tried to achieve this by redefining \cite
with \DeclareCiteCommand
so that it doesn't call the postnote
bibmacro (which inserts postnotedelim
) but instead calls a new macro that wraps the argument in parenthese. But when I do this I get an undesired semicolon in front of my postnote. I can make this go away with \nopunct
but I still get an undesired space, which does not go away even if I add \unspace
. I don't understand where all this punctuation is coming from since I am not calling postnotedelim
.
MWE:
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{myarticle,
author = {Doe, John},
year = {2020},
title = {The Title}}
\end{filecontents*}
\usepackage[style=authoryear-comp]{biblatex}
\addbibresource{\jobname.bib}
\DeclareFieldFormat{plainpostnote}{#1}
\newbibmacro{parenpostnote}{%
\iffieldundef{postnote}
{}
{\addspace\mkbibparens{%\nopunct\unspace
\printfield[plainpostnote]{postnote}}}}
\DeclareCiteCommand{\cite} %
{\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite}}
{}
{\usebibmacro{parenpostnote}}
\begin{document}
This is plain \cite[note]{myarticle} and this is text: \textcite[note]{myarticle} and this is parenthetical \parencite[note]{myarticle}.
\end{document}
Output:
Desired output: This is plain Doe 2020 (note) and this is text: Doe (2020, note) and this is parenthetical (Doe 2020, note).