# Chicago-style citations of CJK documents #2

I'm regularly citing East Asian material in styles similar to HJAS (but sometimes in the author-date style). This has been possible thanks to the ingenious solution offered in Chicago-style citations of CJK documents (e.g. American Oriental Society): Name order; transcribed/translated titles.

However, I noticed a problem with the solution given in that question:

When I have 2 CJK names that have the same family name but different given name, the names are not disambiguated. Ideally, I would like them to be disambiguated by adding the given name to the family name (not including the CJK characters): e.g., Zhao Jie 2011 and Zhao Suisheng 2011, but they are both rendered as Zhao 2011.

(To clarify, I would like them disambiguated also in case they have the same names but the publications cited have different dates; I chose this example simply because the problem appears most clearly here.)

MWE (based on the previous question):

\documentclass{article}
\usepackage{xeCJK}
\setCJKmainfont{HanaMinA}%SimSun
% Sets uniquelist=minyear and uniquename=minfull
\usepackage[authordate,backend=biber,bibencoding=utf8]{biblatex-chicago}

% List of name affixes excluding Roman numerals

\newcommand{\ifnameaffix}[1]{%
\ifboolexpr{ test {\ifrmnum{#1}} or test {\ifinlist{#1}{\nameaffixlist}} }}

% Based on definitions from biblatex.def
\DeclareNameFormat{labelname}{%
\ifboolexpr{ test {\ifblank{#7}} or test {\ifnameaffix{#7}} }
{\ifcase\value{uniquename}%
\usebibmacro{name:last}{#1}{#3}{#5}{#7}%
\or
\ifuseprefix
{\usebibmacro{name:first-last}{#1}{#4}{#5}{#8}}
{\usebibmacro{name:first-last}{#1}{#4}{#6}{#8}}%
\or
\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}%
\fi}%
{\ifnumequal{\value{uniquename}}{0}%
{\usebibmacro{name:cjk}{#1}{}{}}
{\usebibmacro{name:cjk}{#1}{#3}{}}}%
\usebibmacro{name:andothers}}

\DeclareNameFormat{first-last}{%
\ifboolexpr{ test {\ifblank{#7}} or test {\ifnameaffix{#7}} }
{\iffirstinits
{\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}}
{\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}}
{\usebibmacro{name:cjk}{#1}{#3}{#7}}%
\usebibmacro{name:andothers}}

\DeclareNameFormat{last-first}{%
\ifboolexpr{ test {\ifblank{#7}} or test {\ifnameaffix{#7}} }
{\iffirstinits
{\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}}
{\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}}
{\usebibmacro{name:cjk}{#1}{#3}{#7}}%
\usebibmacro{name:andothers}}

\DeclareNameFormat{last-first/first-last}{%
\ifboolexpr{ test {\ifblank{#7}} or test {\ifnameaffix{#7}} }
{\ifnumequal{\value{listcount}}{1}
{\iffirstinits
{\usebibmacro{name:last-first}{#1}{#4}{#5}{#7}}
{\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}}%
\ifblank{#3#5}
{}
{\usebibmacro{name:revsdelim}}}
{\iffirstinits
{\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}}
{\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}}}}
{\usebibmacro{name:cjk}{#1}{#3}{#7}}%
\usebibmacro{name:andothers}}

\newbibmacro*{name:cjk}[3]{%
\usebibmacro{name:delim}{#2#3#1}%
\usebibmacro{name:hook}{#2#3#1}%
\mkbibnamelast{#1}%
\ifblank{#2}{}{\bibnamedelimd\mkbibnamefirst{#2}}%
\ifblank{#3}{}{\bibnamedelimd\mkbibnameaffix{#3}}}

% 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}}%

\DeclareFieldFormat{usere}{\mkbibparens{#1}}

\begin{filecontents}{\jobname.bib}
@book{zhaos,
title={A Nation-State by Construction: Dynamics of Modern Chinese Nationalism},
author={Zhao, 趙歲升, Suisheng},
isbn={9780804750011},
year={2011},
publisher={Stanford University Press}}
@article{zhaoj,
author = {Zhao, 赵杰, Jie},
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 = {Li, 李无未, Wuwei 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}}
\end{filecontents}

\begin{document}
\noindent
\textcite{li,zhaos,zhaoj} \\
\citeauthor{li,zhaos,zhaoj} \\
\fullcite{li,zhaos,zhaoj}
\printbibliography
\end{document}


Output:

Based on the second part of my answer to CJK Bibliography Problem, Biblatex-Chicago, which uses the new extended name format, we just need to redefine the format for labelname.

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

\DeclareNameFormat{labelname}{%
\ifcase\value{uniquename}%
\usebibmacro{name:family}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}%
\or
\ifdefvoid{\namepartcjk}
{\ifuseprefix
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffixi}}
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefixi}
{\namepartsuffixi}}}
{\usebibmacro{name:cjk-nocjk}
{\namepartfamily}{\namepartgiven}{\namepartcjk}}%
\or
\ifdefvoid{\namepartcjk}
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}
{\usebibmacro{name:name:cjk-nocjk}
{\namepartfamily}{\namepartgiven}{\namepartcjk}}%
\fi
\usebibmacro{name:andothers}}


for citations and

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


for other names in the bibliography where western names are in 'first last' order.

In total

\documentclass{article}
\usepackage[fallback]{xeCJK}
\setmainfont[Ligatures={Common, TeX}]{Times New Roman}
\setCJKmainfont[Scale=1]{SimSun}

\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=趙歲升},
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=赵杰},
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=李无未 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}}
\end{filecontents*}

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

% 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\mkbibnamecjk{#3}}}

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

\DeclareNameFormat{labelname}{%
\ifcase\value{uniquename}%
\usebibmacro{name:family}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}%
\or
\ifdefvoid{\namepartcjk}
{\ifuseprefix
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefix}
{\namepartsuffixi}}
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiveni}
{\namepartprefixi}
{\namepartsuffixi}}}
{\usebibmacro{name:cjk-nocjk}
{\namepartfamily}{\namepartgiven}{\namepartcjk}}%
\or
\ifdefvoid{\namepartcjk}
{\usebibmacro{name:given-family}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}
{\usebibmacro{name:name:cjk-nocjk}
{\namepartfamily}{\namepartgiven}{\namepartcjk}}%
\fi
\usebibmacro{name:andothers}}

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

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

\DeclareNameFormat{family-given/given-family}{%
\ifdefvoid{\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:cjk}{\namepartfamily}{\namepartgiven}{\namepartcjk}}%
\usebibmacro{name:andothers}}

\DeclareFieldFormat[book]{title}{%
\mkbibemph{#1}%

\DeclareFieldFormat{booktitle}{%
\mkbibemph{#1}%

\DeclareFieldFormat{maintitle}{%
\mkbibemph{#1}%

\DeclareFieldFormat[article]{title}{%
\iffieldundef{title}{}{\mkbibquote{#1}}%

\DeclareFieldFormat{usere}{\mkbibparens{#1}}

\begin{document}
\cite{zhaos,jim,li,zhaoj}

\printbibliography
\end{document}


gives

• Thank you! That works. Now I just have to edit all the entries in my bibliography database (the file is currently 33528 lines long...) – Mårten Sep 8 '17 at 14:17
• Sorry to bother you again. I noticed that it only works with author, not editor. An entry with both CJK author and CJK editor will not produce the right names for the editor (it gives the name in Western order, without the CJK). Any ideas? – Mårten Sep 8 '17 at 14:24
• @Mårten Have a look at the edit. Now all name formats should support CJK names. – moewe Sep 8 '17 at 15:00
• Fantastic, it looks perfect! Thank you so much. – Mårten Sep 8 '17 at 15:18
• Thank you for this code, moewe! On the biblatex roadmap, found in the biblatex wiki on sourceforge, I’ve seen a “multi-script” goal, but it has not been realized as of yet. Your solution implies quite some code in the preamble, and the generation of an extra (dbx) file (that gets overwritten and therefore makes xelatex produce a warning). And it’s code that I, being a mere user, don’t understand, so I’d be happy to see it hidden in a package (and also documented). Hence: Is it likely that a solution (similar or different to yours) will be implemented in biblatex anytime soon (@PLK)? ;-) – Philipp Sep 28 '17 at 6:41