I am trying to insert "and" before the last author in citations using biblatex-chicago (0.9.9c).
MWE:
Code: Select all
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[
backend=biber,
authordate,
doi=false,
url=false,
isbn=false,
bibencoding=UTF8,
texencoding=auto,
maxnames=2,
maxbibnames=99,
minnames=1
]{biblatex-chicago}
\addbibresource{biblatex-examples.bib}
% To have commas in multiple citation instead of semicolons
\renewcommand\multicitedelim{\addcomma\space}
\renewcommand*{\newunitpunct}{\addcomma\space}
\begin{document}
\textcite{knuth:ct:a}. And one more, \textcite{knuth:ct:a, knuth:ct:a}.
\textcite{knuth:ct:a, markey, knuth:ct:a}
\printbibliography
\end{document}
I tried several approaches form TeX.sx. For example, this piece of code which works great but disables all other modifications to
\textcite
. For instance, repeated citation now show only a year instead of full repeated citation and same authors but different years show up as author (year), year.Code: Select all
\newcounter{cbx:totalcite}
\newbibmacro{textcite:count}{%
\iffirstcite
{\setcounter{cbx:totalcite}{1}}
{\addtocounter{cbx:totalcite}{1}}}
\newbibmacro{textcite:delim}{%
\iffirstcite
{}
{\iflastcite
{\ifnumgreater{\value{cbx:totalcite}}{2}
{\finalandcomma\space\bibstring{and}\space}
{\addspace\bibstring{and}\space}}
{\addcomma\space}}}
\def\iffirstcite{%
\ifboolexpr{ ( test {\ifnumequal{\value{multicitetotal}}{0}}
and test {\ifnumequal{\value{citecount}}{1}} )
or ( test {\ifnumgreater{\value{multicitetotal}}{0}}
and test {\ifnumequal{\value{multicitecount}}{1}}
and test {\ifnumequal{\value{citecount}}{1}} ) }}
\def\iflastcite{%
\ifboolexpr{ test {\ifnumequal{\value{citecount}}{\value{citetotal}}}
and test {\ifnumequal{\value{multicitecount}}{\value{multicitetotal}}} }}
\DeclareCiteCommand{\textcite}
{\boolfalse{cbx:parens}}% <precode>
{\usebibmacro{citeindex}% <loopcode>
\usebibmacro{textcite:count}%
\usebibmacro{textcite:delim}%
\usebibmacro{textcite}}
{\ifbool{cbx:parens}
{\bibcloseparen\global\boolfalse{cbx:parens}}
{}}% <sepcode>
{\usebibmacro{textcite:postnote}}% <postcode>
\DeclareMultiCiteCommand{\textcites}{\textcite}{}
Code: Select all
\makeatletter
\newbibmacro*{textcite}{%
\iffieldequals{namehash}{\cbx@lasthash}
{\multicitedelim}
{\cbx@tempa
\ifnameundef{labelname}
{\printfield[citetitle]{labeltitle}}
{\printnames{labelname}}%
\addspace\bibopenbracket}%
\ifnumequal{\value{citecount}}{1}
{\usebibmacro{prenote}}
{}%
\usebibmacro{cite}%
\savefield{namehash}{\cbx@lasthash}%
\ifnumequal{\value{citecount}}{\value{citetotal}-1}
{\gdef\cbx@tempa{\bibclosebracket\addspace\bibstring{and}\addspace}}%
{\gdef\cbx@tempa{\bibclosebracket\multicitedelim}}%
}
\makeatother
Code: Select all
! Undefined control sequence.
<argument> \cbx@tempa
\ifnameundef {labelname} {\printfield [citetitle]{labe...
Thank you,
Arsenio