# two styles in biblatex with textcite, author (year) and (author, year)

I am using biblatex with the following commands, which produce Author (year) type citation using \textcite{} command. However, I have some places where I need (Author, year) type citation. How can I do this? Thanks.

\documentclass{article}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear,maxcitenames=2]{biblatex}

%This part is for citation style textcite
\DeclareCiteCommand{\textcite}
{\boolfalse{cbx:parens}}
{\usebibmacro{citeindex}%
\ifboolexpr{ ( not test {\iffieldundef{prenote}} and
test {\ifnumequal{\value{citecount}}{1}} ) or
( not test {\iffieldundef{postnote}} and
test {\ifnumequal{\value{citecount}}{\value{citetotal}}} ) }
{\usebibmacro{textcite}}
{\printtext[bibhyperref]{% Apply citation link to bibmacro output
\usebibmacro{textcite}%
\ifbool{cbx:parens}{\bibcloseparen\global\boolfalse{cbx:parens}}{}}}}
{\ifbool{cbx:parens}{\bibcloseparen\global\boolfalse{cbx:parens}}{}%
\multicitedelim}
{\usebibmacro{textcite:postnote}}

• You can just use \parencite instead of \cite. – Andrew Swann Aug 26 '13 at 19:53
• That does not yield what I want. I want Author, year in some places and Author (year) in others. Sorry its not a matter of whole parenthesis, rather, a comma as separator, not parenthesis. – Rabeya Khatoon Aug 26 '13 at 20:14
• You should update your question and clarify what you want. – lockstep Aug 26 '13 at 21:43

Using the authoryear citation style, \parencite uses the macro \nameyeardelim to store what should go between the name and the year in the citation.

In authoryear.cbx, the cite command \parencite is defined in the following way:

\DeclareCiteCommand{\parencite}[\mkbibparens]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite}}
{\multicitedelim}
{\usebibmacro{postnote}}


And in biblatex.def, we find

\newcommand*{\nameyeardelim}{\addspace}


You could define your own cite command to put a comma between the author and the year and put everything in parantheses, e.g. by redefining \nameyeardelim:

\DeclareCiteCommand{\myparencite}[\mkbibparens]
{\usebibmacro{prenote}}
\usebibmacro{citeindex}%
\usebibmacro{cite}%
{\multicitedelim}
{\usebibmacro{postnote}}


By changing \nameyeardelim back to simply \addspace after printing this citation, we avoid interference with other citations.

Using the filecontents package to produce a full example, this yields

\documentclass{article}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear]{biblatex}

%This part is for citation style textcite
\DeclareCiteCommand{\textcite}
{\boolfalse{cbx:parens}}
{\usebibmacro{citeindex}%
\ifboolexpr{ ( not test {\iffieldundef{prenote}} and
test {\ifnumequal{\value{citecount}}{1}} ) or
( not test {\iffieldundef{postnote}} and
test {\ifnumequal{\value{citecount}}{\value{citetotal}}} ) }
{\usebibmacro{textcite}}
{\printtext[bibhyperref]{% Apply citation link to bibmacro output
\usebibmacro{textcite}%
\ifbool{cbx:parens}{\bibcloseparen\global\boolfalse{cbx:parens}}{}}}}
{\ifbool{cbx:parens}{\bibcloseparen\global\boolfalse{cbx:parens}}{}%
\multicitedelim}
{\usebibmacro{textcite:postnote}}

\DeclareCiteCommand{\myparencite}[\mkbibparens]
{\usebibmacro{prenote}}
\usebibmacro{citeindex}%
\usebibmacro{cite}%
{\multicitedelim}
{\usebibmacro{postnote}}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}

@article{test,
title={something},
author={someone},
journal={some journal},
year={2013}
}

\end{filecontents}

\begin{document}
\textcite{test}
\parencite{test}
\myparencite{test}
\textcite{test}
\end{document}


And this results in

so \myparencite{test} puts a comma between the author and the year.