[Tex/LaTex] How to get et al. beginning with the 2nd citation with biblatex-chicago

biberbiblatexbiblatex-chicagochicago-style

I am trying to get "et al." after the second citation but so far haven't found a solution that works for me despite the many working examples I have found across the Internet including this one: biblatex – et al. beginning from second citation?. Note that I am using TeXShop version 3.65 (where biber is invoked by %!BIB TS-program = biber), biber version 2.1 and TeXlive 2015.

I will be happy for a solution that encompasses footnotes as well. Below is MWE

%!TEX TS-program = xelatex
%!BIB TS-program = biber
%!TEX encoding = UTF-8 Unicode

\documentclass[hidelinks,12pt]{article}
\usepackage[authordate,
    citetracker=true,
    sortcites=true, 
    sorting=ynt, 
    pagetracker=true,
    backref=true,
    minnames=1,
    maxbibnames=10,
    minbibnames=7,
    uniquelist=true,
    uniquename=allfull,
        maxcitenames=3]
        {biblatex-chicago}
\usepackage{xpatch}
\usepackage{filecontents}
\usepackage {hyperref}  

%bibfile        
\begin{filecontents}{myfile.bib}
@article{miscztyn2005history,
  title      = {The History of Economic Growth: An Econometric Perspective},
  author     = {Miscztyn, Martinez and Shirleen, Venucci and Alfred, Villanueva},
  journal    = {World Economics Review},
  volume     = {56},
  number     = {3},
  pages      = {234--257},
  year       = {2005},
  publisher  = {Elsevier},
}
\end{filecontents}

%add bibfile
\addbibresource{myfile.bib}

\AtEveryCitekey{\ifciteseen{}{\clearfield{namehash}}}

\xpatchbibmacro{cite}
{\printnames{labelname}}
{\ifciteseen
{\printnames{labelname}}
{\printnames[][1-99]{labelname}}}
{}
{}

\xpatchbibmacro{textcite}
{\printnames{labelname}}
{\ifciteseen
{\printnames{labelname}}
{\printnames[][1-99]{labelname}}}
{}
{}

\begin{document}
This is the first citation \textcite{miscztyn2005history}. Names of all authors are displayed as specified in maxcitenames. Beginning with the second citation, I want to get Miscztyn et al. (2005). Instead, I am getting \textcite{miscztyn2005history} repeated just as with the first citation.

\begin{refcontext}[sorting=nyt]                     
\printbibliography                           
\end{refcontext}
\end{document}

Best Answer

On way to tackle this problem is to

1) set the default number of cites names maxcitenames=1

2) and for all cites, occuring the first time, increase this number \AtEveryCitekey{\ifciteseen{}{\defcounter{maxnames}{99}}}

%!TEX TS-program = xelatex
%!BIB TS-program = biber
%!TEX encoding = UTF-8 Unicode

\documentclass[hidelinks,12pt]{article}
\usepackage[authordate,
citetracker=true,
sortcites=true, 
sorting=ynt, 
pagetracker=true,
backref=true,
minnames=1,
maxbibnames=10,
minbibnames=7,
uniquelist=true,
uniquename=allfull,
maxcitenames=1]
{biblatex-chicago}
\usepackage{xpatch}
\usepackage{filecontents}
\usepackage{hyperref}  

%bibfile        
\begin{filecontents}{myfile.bib}
    @article{miscztyn2005history,
        title={The History of Economic Growth: An Econometric                 Perspective},
        author={Miscztyn, Martinez and Shirleen, Venucci and Alfred, Villanueva},
        journal={World Economics Review},
        vol={56},
        number={3},
        pages={234--257},
        year={2005},
        publisher={Elsevier}
    }
\end{filecontents}

%add bibfile
\addbibresource{myfile.bib}

\AtEveryCitekey{\ifciteseen{}{\defcounter{maxnames}{99}}}

\xpatchbibmacro{cite}
{\printnames{labelname}}
{\ifciteseen
    {\printnames{labelname}}
    {\printnames{labelname}}}
{}
{}

\xpatchbibmacro{textcite}
{\printnames{labelname}}
{\ifciteseen
    {\printnames{labelname}}
    {\printnames{labelname}}}
{}
{}

\begin{document}
    This is the first citation \textcite{miscztyn2005history}. Names of all authors are displayed as specified in maxcitenames. Beginning with the second citation, I want to get Miscztyn et al. (2005). Instead, I am getting \textcite{miscztyn2005history} repeated just as with the first citation.

    \begin{refcontext}[sorting=nyt]                     
        \printbibliography                           
    \end{refcontext}
\end{document}

enter image description here