5

I use square brackets around my citations (/parencite) from the answer to Biblatex, author-year, square brackets. So now I have

[Doe 1995]

in text. But I would like to have

[Doe (1995)]

in text. The way the bibliography is should not change. It now is like this:

Doe, J. (1995), ...

How do I achieve this?

10

That's a lot of brackets and braces, but here we go. :-) I suggest to use Audrey's answer to the linked question and to add a redefinition of the cite bibmacro (namely, to add parentheses to the cite:labelyear+extrayear bibmacro).

\documentclass{article}

\usepackage[style=authoryear]{biblatex}

\makeatletter

\newrobustcmd*{\parentexttrack}[1]{%
  \begingroup
  \blx@blxinit
  \blx@setsfcodes
  \blx@bibopenparen#1\blx@bibcloseparen
  \endgroup}

\AtEveryCite{%
  \let\parentext=\parentexttrack%
  \let\bibopenparen=\bibopenbracket%
  \let\bibcloseparen=\bibclosebracket}

\renewbibmacro*{cite}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
       {\usebibmacro{cite:label}%
        \setunit{\addspace}}
       {\printnames{labelname}%
        \setunit{\nameyeardelim}}%
%     \usebibmacro{cite:labelyear+extrayear}}% DELETED
     \printtext[parens]{\usebibmacro{cite:labelyear+extrayear}}}% ADDED
    {\usebibmacro{cite:shorthand}}}

\makeatother

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
  author = {Author, A.},
  year = {2001},
  title = {Alpha},
}
@misc{B02,
  author = {Buthor, B.},
  year = {2002},
  title = {Bravo},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\null\vfill\noindent
Filler text \parencite[see][59--63]{A01}. \\
Filler text \parencite[see][\pno~59 \parentext{last paragraph}]{A01}. \\
Filler text \parencite[see][\pno~59 \brackettext{last paragraph}]{A01}. \\
\parentext{Filler text \parencite[see][\pno~59 \parentext{last paragraph}]{A01}.} \\
\brackettext{Filler text \parencite[see][\pno~59 \parentext{last paragraph}]{A01}.} \\
\citeauthor{A01} show that this is filler text \parencite*{A01}. \\
\textcite[see][\pno~59 \parentext{last paragraph}]{A01} show that this is filler text. \\
Filler text \autocite{A01}. \\
\citeauthor{A01} show that this is filler text \autocite*{A01}. \\
Filler text.\smartcite[\pno~59 \brackettext{last paragraph}]{A01}
Filler text.\footnote{More filler text \smartcite[see][\pno~59 \brackettext{last paragraph}]{A01}.} \\
\parencites{A01,B02} \\
\textcites{A01,B02} \\

\printbibliography

\end{document}

enter image description here

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.