# CJK Bibliography Problem, Biblatex-Chicago author-date style

The solution given to this question on how to cite items in East Asian languages using biblatex-chicago's notes option is excellent. However, it doesn't work when instead of notes (= references in footnotes, either abbreviated or full length), one uses author-date (parenthetical citations). The problem is the way in which biblatex-chicago disambiguates between authors with the same surname, first name, and CJK script form of the name. What biblatex-chicago does is to disambiguate by adding the initial of the first name in front of the surname, with the first character from the CJK script form of the name following the name. Ideally, what would be needed is disambiguation by, in case only the surname is identical, printing {Surname} {First name} {Date}, or, in case both surname and first name are the same, but not CJK script form of the name, by printing {Surname} {First name} {CJK script form of name} {Date}.

MWE, with the solution from the aforementioned question included:

\documentclass[utf8,12pt,a4paper,oneside]{article}
\usepackage{setspace}
\usepackage{xltxtra}
\usepackage[fallback]{xeCJK}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\newcommand{\mainfont}[0]{Linux Libertine O}
\setmainfont[Ligatures={Required,Contextual,Common,TeX},Contextuals={Alternate},Numbers={OldStyle}]{\mainfont}
\newcommand{\mainfontCJK}[0]{HanaMinA}\setCJKmainfont[Scale=0.9]{\mainfontCJK}
\setCJKfallbackfamilyfont{\CJKrmdefault}[Scale=0.9]
{NanumMyeongjo}
\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt
\usepackage[bibencoding=utf8,idemtracker=constrict,loccittracker=constrict,compresspages,longcrossref=false,booklongxref=true,authordate,cmsdate=both,strict,isbn=false,backend=biber,hyperref=false,mincrossrefs=2]{biblatex-chicago}
%Enabling CJK names (http://tex.stackexchange.com/questions/320693/cjk-bibliography-problem-biblatex-chicago/320738#320738 ):
\newcommand{\ifnameaffix}[1]{%
\ifboolexpr{ test {\ifrmnum{#1}} or test {\xifinlist{#1}{\nameaffixlist}} }}
% Based on definitions from biblatex.def
\newbibmacro*{name:cjk}[3]{%
\usebibmacro{name:delim}{#2#3#1}%
\usebibmacro{name:hook}{#2#3#1}%
\mkbibnamefamily{#1}%
\ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{#2}}%
\ifdefvoid{#3}{}{\bibnamedelimd\mkbibnamesuffix{#3}}}
\DeclareNameFormat{given-family}{%
\ifboolexpr{ test {\ifdefvoid{\namepartsuffix}} or test {\ifnameaffix{\namepartsuffix}} }
{\ifgiveninits
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffix}}
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}}
{\usebibmacro{name:cjk}{\namepartfamily}{\namepartgiven}{\namepartsuffix}}%
\usebibmacro{name:andothers}}
\DeclareNameFormat{family-given}{%
\ifboolexpr{ test {\ifdefvoid{\namepartsuffix}} or test {\ifnameaffix{\namepartsuffix}} }
{\ifgiveninits
{\usebibmacro{name:family-given}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffix}}
{\usebibmacro{name:family-given}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}}
{\usebibmacro{name:cjk}{\namepartfamily}{\namepartgiven}{\namepartsuffix}}%
\usebibmacro{name:andothers}}
\DeclareNameFormat{family-given/given-family}{%
\ifboolexpr{ test {\ifdefvoid{\namepartsuffix}} or test {\ifnameaffix{\namepartsuffix}} }
{\ifnumequal{\value{listcount}}{1}
{\ifgiveninits
{\usebibmacro{name:family-given}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffix}}
{\usebibmacro{name:family-given}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}
\ifboolexpe{%
test {\ifdefvoid\namepartgiven}
and
test {\ifdefvoid\namepartprefix}}
{}
{\usebibmacro{name:revsdelim}}}
{\ifgiveninits
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffix}}
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}}}
{\usebibmacro{name:cjk}{\namepartfamily}{\namepartgiven}{\namepartsuffix}}%
\usebibmacro{name:andothers}}
% Based on definitions from biblatex-chicago cbx
\DeclareFieldFormat[book]{title}{%
\mkbibemph{#1}%
\DeclareFieldFormat{booktitle}{%
\mkbibemph{#1}%
\DeclareFieldFormat{maintitle}{%
\mkbibemph{#1}%
\DeclareFieldFormat[article]{title}{%
\iffieldundef{title}{}{\mkbibquote{#1}}%
%Addition for functionality with inbook and bookinbook etc:
\DeclareFieldFormat[inbook]{title}{%
\iffieldundef{title}{}{\mkbibquote{#1}}%
\DeclareFieldFormat[bookinbook]{title}{%
\iffieldundef{title}{}{\mkbibquote{#1}}%
\DeclareFieldFormat[unpublished]{title}{%
\iffieldundef{title}{}{\mkbibquote{#1}}%
\DeclareFieldFormat[thesis]{title}{%
\iffieldundef{title}{}{\mkbibquote{#1}}%
%This makes translation brackets into parentheses:
\DeclareFieldFormat{usere}{\mkbibparens{#1}}
\begin{filecontents}{bibliography.bib}
@book{Book1,
title = {Shuming},
author = {Zhang, 章學成, Xuecheng},
location = {Beijing},
publisher = {Zhonghua Shuju},
date = {2017},
}
@book{Book2,
title = {Shuming er},
author = {Zhang, 張學成, Xuecheng},
location = {Shanghai},
publisher = {Shangwu Yinshuguan},
date = {2016},
}
@book{Book3,
title = {Sŏmyŏng},
author = {Zhang, 장학성, Haksŏng},
location = {Shanghai},
publisher = {Shangwu Yinshuguan},
date = {2016},
}
\end{filecontents}
\begin{document}
\parencite{Book1} \parencite{Book2} \parencite{Book3}
\printbibliography
\end{document}


The Korean entry is especially interesting, as it only takes the first graph from the hangul syllable (ㅈ from 장), which is never seen in Korean.

NOTE 1: I asked questions related to this issue in reference to an earlier version of biblatex: here (answered wonderfully) and here (unanswered).

NOTE 2: Link to HanaMin font.

• Would it be an option for you to use the second part of my answer that works from v3.5 on? That makes coding things a bit more intuitive. – moewe Sep 8 '17 at 10:08
• Unfortunately, there is currently no system to tell which of multiple name parts makes a name unique. So if we consider the given name and the CJK part we only know that adding one of the two will make things unique, not which. – moewe Sep 8 '17 at 10:45
• @moewe Thank you! I approved the answer in tex.stackexchange.com/questions/233053/… – Mårten Sep 8 '17 at 14:18
• See also github.com/plk/biblatex/issues/623. I think we need something like that to be able to do what you want here. – moewe Sep 8 '17 at 15:31
• @moewe I see. Such a function would be very useful for people working with East Asian materials. Thanks for taking the time to look into it! – Mårten Sep 11 '17 at 7:56

biblatex 3.8/Biber 2.8 allow you to fully customize the unqiuename function. See https://github.com/plk/biblatex/issues/623 for technical discussions. 93-nameparts.tex features an extended discussion of the new features.

The gist of it is that while previously the uniquename information was based on the given and family name parts, it can now be generated from any defined name part. So we can use the CJK part of a name for disambiguation as well.

The input and many technicalities are as in Chicago-style citations of CJK documents #2. With the exception that CJK names are now explicitly marked with nametemplates=cjk, so name detection does not go via checking if a CJK part is defined, but via \ifsortingnamekeytemplatename and \ifuniquenametemplatename.

The interesting new portions of the code are

\DeclareUniquenameTemplate[cjk]{
\namepart[base=true]{family}
\namepart[disambiguation=full]{given}
\namepart[disambiguation=full]{cjk}
}


to define the CJK uniquename scheme which respects the cjk part of a name as well and does not abbreviate the given or cjk part. And

\newbibmacro{labelname:cjk}{%
\iffieldequalstr{uniquepart}{base}%
{\usebibmacro{name:cjk}
{\namepartfamily}
{\empty}
{\empty}}
{\iffieldequalstr{uniquepart}{given}%
{\usebibmacro{name:cjk}
{\namepartfamily}
{\namepartgiven}
{\empty}}
{\usebibmacro{name:cjk}
{\namepartfamily}
{\namepartgiven}
{\namepartcjk}}}}

\DeclareNameFormat{labelname}{%
\ifuniquenametemplatename{cjk}
{\usebibmacro{labelname:cjk}}
{\usebibmacro{labelname:western}}%
\usebibmacro{name:andothers}}


for the labelname. Based on the uniquepart value the macro decides how much of a name needs to be printed.

\documentclass[a4paper]{article}
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
\setsansfont{Linux Biolinum O}
\usepackage[fallback]{xeCJK}
\setCJKmainfont{Malgun Gothic}

\usepackage{filecontents}
\begin{filecontents*}{chicago-authordate.dbx}
\ProvidesFile{chicago-authordate.dbx}[2016/07/24 extended name format for biblatex]
\DeclareDatamodelConstant[type=list]{nameparts}{prefix,family,suffix,given,cjk}
\end{filecontents*}

\begin{filecontents*}{\jobname.bib}
@book{zhaos,
title={A Nation-State by Construction: Dynamics of Modern Chinese Nationalism},
author={given=Suisheng, family=Zhao, cjk=趙歲升, nametemplates=cjk},
isbn={9780804750011},
year={2011},
publisher={Stanford University Press}}
@book{jim,
title={Lorem},
author={Smith, Junior, Jim},
year={2009},
publisher={Stanford University Press}}
@article{zhaoj,
author={given=Jie, family=Zhao, cjk=赵杰, nametemplates=cjk},
title = {Qingdai Manwen de wenzi tese ji yinyun, yinbian tedian},
usere = {Scriptual specificities of Manchu writing in the Qing period
and characteristics of phonology and sound change},
shorttitle = {Manwen de wenzi tese},
journal = {Manzu yanjiu},
volume = {102},
number = {1},
date = {2011},
pages = {7--12}}
@book{li,
author={given=Wuwei, family=Li, cjk=李无未, nametemplates=cjk and Brown, Junior, Bob and Doe, III, John},
publisher = {Shangwu yinshuguan},
title = {Riben Hanyu yinyun xue shi},
usere = {History of the study of Chinese phonology in Japan},
date = {2011}}

@book{Book1,
title = {Shuming},
author = {family=Zhang, cjk=章學成, given=Xuecheng, nametemplates=cjk},
location = {Beijing},
publisher = {Zhonghua Shuju},
date = {2017},
}
@book{Book2,
title = {Shuming er},
author = {family=Zhang, cjk=張學成, given=Xuecheng, nametemplates=cjk},
location = {Shanghai},
publisher = {Shangwu Yinshuguan},
date = {2016},
}
@book{Book3,
title = {Sŏmyŏng},
author = {family=Zhang, cjk=장학성, given=Haksŏng, nametemplates=cjk},
location = {Shanghai},
publisher = {Shangwu Yinshuguan},
date = {2016},
}
\end{filecontents*}

\usepackage[authordate,backend=biber]{biblatex-chicago}

\DeclareSortingNamekeyTemplate[cjk]{
\keypart{
\namepart{family}
}
\keypart{
\namepart{given}
}
\keypart{
\namepart{cjk}
}
}

\DeclareUniquenameTemplate[cjk]{
\namepart[base=true]{family}
\namepart[disambiguation=full]{given}
\namepart[disambiguation=full]{cjk}
}

\newbibmacro*{name:cjk}[3]{%
\usebibmacro{name:delim}{#2#3#1}%
\usebibmacro{name:hook}{#2#3#1}%
\mkbibnamefamily{#1}%
\ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{#2}}%
\ifdefvoid{#3}{}{\bibnamedelimd\mkbibnamecjk{#3}}}

\newbibmacro{labelname:western}{%
\ifcase\value{uniquename}%
\usebibmacro{name:family}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}%
\or
\ifuseprefix
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffixi}}
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefixi}
{\namepartsuffixi}}%
\or
\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}%
\fi
\usebibmacro{name:andothers}}

\newbibmacro{labelname:cjk}{%
\iffieldequalstr{uniquepart}{base}%
{\usebibmacro{name:cjk}
{\namepartfamily}
{\empty}
{\empty}}
{\iffieldequalstr{uniquepart}{given}%
{\usebibmacro{name:cjk}
{\namepartfamily}
{\namepartgiven}
{\empty}}
{\usebibmacro{name:cjk}
{\namepartfamily}
{\namepartgiven}
{\namepartcjk}}}}

\DeclareNameFormat{labelname}{%
\ifuniquenametemplatename{cjk}
{\usebibmacro{labelname:cjk}}
{\usebibmacro{labelname:western}}%
\usebibmacro{name:andothers}}

\DeclareNameFormat{family-given}{%
\ifsortingnamekeytemplatename{cjk}
{\usebibmacro{name:cjk}{\namepartfamily}{\namepartgiven}{\namepartcjk}}
{\ifgiveninits
{\usebibmacro{name:family-given}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffix}}
{\usebibmacro{name:family-given}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}}%
\usebibmacro{name:andothers}}

\DeclareNameFormat{given-family}{%
\ifsortingnamekeytemplatename{cjk}
{\usebibmacro{name:cjk}{\namepartfamily}{\namepartgiven}{\namepartcjk}}
{\ifgiveninits
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffix}}
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}}%
\usebibmacro{name:andothers}}

\DeclareNameFormat{family-given/given-family}{%
\ifsortingnamekeytemplatename{cjk}
{\usebibmacro{name:cjk}{\namepartfamily}{\namepartgiven}{\namepartcjk}}
{\ifnumequal{\value{listcount}}{1}
{\ifgiveninits
{\usebibmacro{name:family-given}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffix}}
{\usebibmacro{name:family-given}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}
\ifboolexpe{%
test {\ifdefvoid\namepartgiven}
and
test {\ifdefvoid\namepartprefix}}
{}
{\usebibmacro{name:revsdelim}}}
{\ifgiveninits
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffix}}
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}}}
\usebibmacro{name:andothers}}

% Based on definitions from biblatex-chicago cbx
\DeclareFieldFormat[book]{title}{%
\mkbibemph{#1}%
\DeclareFieldFormat{booktitle}{%
\mkbibemph{#1}%
\DeclareFieldFormat{maintitle}{%
\mkbibemph{#1}%
\DeclareFieldFormat[article]{title}{%
\iffieldundef{title}{}{\mkbibquote{#1}}%
%Addition for functionality with inbook and bookinbook etc:
\DeclareFieldFormat[inbook]{title}{%
\iffieldundef{title}{}{\mkbibquote{#1}}%
\DeclareFieldFormat[bookinbook]{title}{%
\iffieldundef{title}{}{\mkbibquote{#1}}%
\DeclareFieldFormat[unpublished]{title}{%
\iffieldundef{title}{}{\mkbibquote{#1}}%