Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.