# How to change citation style to show name, year and page numbers all in parentheses

I'm trying to change the citation style so that it's shown in the following style: (Name, year, pages).

The closest I got was using the following code:

\documentclass[openany, a4paper, oneside, 10pt]{article}

\usepackage[backend=biber,style=authoryear-icomp , maxbibnames=9,
maxcitenames=2,backend=biber]{biblatex}

%I added the next 7 lines after researching them online
\usepackage{babel,csquotes,xpatch}
\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}
\xapptobibmacro{date+extrayear}{\nopunct}{}{}

\begin{document}

In 1988 C was totally awesome. \cite{park2019role}
According to \cite{ansari2018probabilistic} C++ was even better.

\printbibliography
\end{document}


The results are, for example: Park, 2019. What I'm looking for is: (Park, 2019, p.370-374). Here's also a photo of the result:

I'm citing only article and all pages are available in my .bib file. Here are the two mentioned in my example text:

@article{park2019role,
title={The role of satisfaction on customer reuse to airline services: An application of Big Data approaches},
author={Park, Eunil},
journal={Journal of Retailing and Consumer Services},
volume={47},
pages={370--374},
year={2019},
publisher={Elsevier}
}

@article{ansari2018probabilistic,
title={Probabilistic Topic Model for Hybrid Recommender Systems: A Stochastic Variational Bayesian Approach},
author={Ansari, Asim and Li, Yang and Zhang, Jonathan Z},
journal={Marketing Science},
volume={37},
number={6},
pages={987--1008},
year={2018},
publisher={INFORMS}
}


Any ideas?

• \parencite[370-374]{park2019role} – moewe Nov 16 '19 at 12:35
• Is there a way to automatically add the pages instead of manually? Like the year? – dataminor Nov 16 '19 at 12:37
• Technically yes, but this is usually not done. If you add pages in the citation postnote then these page references should point to an exact location, there is no point in giving the entire page range of an article. That would be the same as giving 1-100 for a book with 100 pages. – moewe Nov 16 '19 at 12:44
• OK I see. Thank you. Your solution gives me what I what, but not exactly how I want to get it. I'll consider this approach as a plan B if I don't find what I'm looking for. Thanks again. – dataminor Nov 16 '19 at 13:21
• One thing I only notice just now. You say you want "(Park, 2019, p.370-374)", yet you have code in your document that explicitly turns \parencite[370-374]{park2019role} into "Park, 2009: 370-374". Do you want a colon or a comma? Do you want the "p."/"S." page prefix or not? – moewe Nov 16 '19 at 14:04

Citations in parentheses can be obtained with \parencite

\parencite{park2019role}


In general if one adds page numbers in the citation directly with

\parencite[371-372]{park2019role}


the page reference pinpoints a particular section of the cited work that is relevant for this particular citation and not the complete page range of the cited work. A reader will likely not benefit from a page reference that just refers to the entire work as already shown in the bibliography. As such adding "pp. 370-374" in the example just amounts to added noise in the text.

\documentclass[a4paper, 10pt, ngerman]{article}

\usepackage{babel,csquotes}

\usepackage[backend=biber, style=authoryear-icomp,
maxbibnames=9, maxcitenames=2]{biblatex}

\begin{filecontents}{\jobname.bib}
@article{park2019role,
title   = {The role of satisfaction on customer reuse to airline services:
An application of Big Data approaches},
author  = {Park, Eunil},
journal = {Journal of Retailing and Consumer Services},
volume  = {47},
pages   = {370--374},
year    = {2019},
}
@article{ansari2018probabilistic,
title   = {Probabilistic Topic Model for Hybrid Recommender Systems:
A Stochastic Variational Bayesian Approach},
author  = {Ansari, Asim and Li, Yang and Zhang, Jonathan Z.},
journal = {Marketing Science},
volume  = {37},
number  = {6},
pages   = {987--1008},
year    = {2018},
}
\end{filecontents}

\begin{document}
In 1988 C was totally awesome. \parencite[372-373]{park2019role}
In 1990 C was still totally awesome. \parencite{park2019role}

According to \textcite{ansari2018probabilistic} C++ was even better.

\printbibliography
\end{document}


If you absolutely must have a page reference in your citations if you don't provide a postnote yourself, try the following

\documentclass[a4paper, 10pt, ngerman]{article}

\usepackage{babel,csquotes}

\usepackage[backend=biber, style=authoryear-icomp,
maxbibnames=9, maxcitenames=2]{biblatex}

\renewbibmacro*{cite:postnote}{%
\ifbool{cbx:loccit}
{}
{\setunit{\printdelim{postnotedelim}}%
\iffieldundef{postnote}
{\printfield{pages}}
{\printfield{postnote}}}}

\begin{filecontents}{\jobname.bib}
@article{park2019role,
title   = {The role of satisfaction on customer reuse to airline services:
An application of Big Data approaches},
author  = {Park, Eunil},
journal = {Journal of Retailing and Consumer Services},
volume  = {47},
pages   = {370--374},
year    = {2019},
}
@article{ansari2018probabilistic,
title   = {Probabilistic Topic Model for Hybrid Recommender Systems:
A Stochastic Variational Bayesian Approach},
author  = {Ansari, Asim and Li, Yang and Zhang, Jonathan Z.},
journal = {Marketing Science},
volume  = {37},
number  = {6},
pages   = {987--1008},
year    = {2018},
}
\end{filecontents}

\begin{document}
In 1988 C was totally awesome. \parencite[372-373]{park2019role}
In 1990 C was still totally awesome. \parencite{park2019role}

According to \textcite{ansari2018probabilistic} C++ was even better.

\printbibliography
\end{document}


At the moment this explicitly does not apply to \textcite citations, but that can be arranged by adding

\renewbibmacro*{textcite:postnote}{%
\ifbool{cbx:loccit}
{}
{\ifnameundef{labelname}
{\setunit{%
\global\booltrue{cbx:parens}%
\printdelim{extpostnotedelim}\bibopenparen}}
{\setunit{\printdelim{postnotedelim}}}%
\iffieldundef{postnote}
{\printfield{pages}}
{\printfield{postnote}}}%
\ifthenelse{\value{multicitecount}=\value{multicitetotal}}
{\setunit{}%
\printtext{%
\ifbool{cbx:parens}
{\bibcloseparen\global\boolfalse{cbx:parens}}
{}}}
{\setunit{%
\ifbool{cbx:parens}
{\bibcloseparen\global\boolfalse{cbx:parens}}
{}%
\textcitedelim}}}


Note that I removed parts of the code from the MWE as they were working against the desired output (\renewcommand*{\postnotedelim}{\addcolon\space}, \DeclareFieldFormat{postnote}{#1} and \DeclareFieldFormat{multipostnote}{#1}). I also simplified the code for the period before the year (the xpatch stuff).

• Thanks for the answer. This, without the last block of code, works like a charm for \parencite. I'm insisting on pages because it's required like this where I'm submitting the texts. – dataminor Nov 17 '19 at 9:29