For several years now, I have been typesetting scholarly work that makes use of East Asian source materials with xelatex, and creating bibliographies through the use of biber/Biblatex-Chicago. The initial problem with this set-up was that Biblatex-Chicago does not natively understand how to handle East Asian names, particularly the fact that the surname comes first. This problem was solved several years ago by an incredibly useful bit of code written by Audrey: Chicago-style citations of CJK documents (e.g. American Oriental Society): Name order; transcribed/translated titles. I have been using this code almost every day for three years.
I have now had to get a new computer (Windows 10 64bit), and that has meant downloading a new version of MikTeX and a new version of TeXStudio. All of a sudden, I find that my old files no longer compile: in particular, the bit of code that Audrey wrote to fix the bibliographic presentation of East Asian names now seems to crash the compiler.
Files thus compile without Audrey's code, but they produce the wrong result. For instance:
\documentclass{article}
\usepackage{xltxtra}
\usepackage[fallback]{xeCJK}
\usepackage{xunicode-addon}
\setmainfont[Ligatures={Common, TeX}]{Times New Roman}
\setCJKmainfont[Scale=1]{SimSun}
\usepackage[notes,strict,annotation,cmsdate=both,isbn=false,
backend=biber,bibencoding=utf8]{biblatex-chicago}
\begin{filecontents}{\jobname.bib}
@book{zhaos,
title={A Nation-State by Construction: Dynamics of Modern Chinese Nationalism},
author={Zhao, 趙歲升, Suisheng},
isbn={9780804750011},
year={2011},
address={Stanford}
publisher={Stanford University Press}}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\cite{zhaos}
\printbibliography
\end{document}
This compiles fine, but it produces the wrong result:
Suisheng Zhao 趙歲升, A Nation-State by Construction: Dynamics of Modern Chinese Nationalism (Stanford: Stanford University Press, 2011)
References
Zhao, Suisheng, 趙歲升. A Nation-State by Construction: Dynamics of Modern Chinese Nationalism. Stanford: Stanford University Press, 2011.
What I need is rather
Zhao Suisheng 趙歲升, A Nation-State by Construction: Dynamics of Modern Chinese Nationalism (Stanford University Press, 2011)
References
Zhao Suisheng 趙歲升. A Nation-State by Construction: Dynamics of Modern Chinese Nationalism. Stanford: Stanford University Press, 2011.
This problem used to be solved by Audrey's code, which I would add to make the following example (this is the code that will not compile):
\documentclass{article}
\usepackage{xltxtra}
\usepackage[fallback]{xeCJK}
\usepackage{xunicode-addon}
\setmainfont[Ligatures={Common, TeX}]{Times New Roman}
\setCJKmainfont[Scale=1]{SimSun}
\usepackage[notes,strict,annotation,cmsdate=both,isbn=false, backend=biber,bibencoding=utf8]{biblatex-chicago}
\begin{filecontents}{\jobname.bib}
@book{zhaos,
title={A Nation-State by Construction: Dynamics of Modern Chinese Nationalism},
author={Zhao, 趙歲升, Suisheng},
isbn={9780804750011},
year={2011},
address = {Stanford}
publisher={Stanford University Press}}
\end{filecontents}
\addbibresource{\jobname.bib}
\forcsvlist{\listadd\nameaffixlist}{Junior,Senior}
\newcommand{\ifnameaffix}[1]{%
\ifboolexpr{ test {\ifrmnum{#1}} or test {\ifinlist{#1}{\nameaffixlist}} }}
% Based on definitions from biblatex.def
\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}}}
\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}}
\DeclareFieldFormat[book]{title}{%
\mkbibemph{#1}%
\iffieldundef{titleaddon}{\isdot}{\nopunct}}
\DeclareFieldFormat{booktitle}{%
\mkbibemph{#1}%
\iffieldundef{booktitleaddon}{}{\nopunct}}
\DeclareFieldFormat{maintitle}{%
\mkbibemph{#1}%
\iffieldundef{maintitleaddon}{}{\nopunct}}
\DeclareFieldFormat[article]{title}{%
\iffieldundef{title}{}{\mkbibquote{#1}}%
\iffieldundef{titleaddon}{\isdot}{\nopunct}}
\DeclareFieldFormat{usere}{\mkbibparens{#1}}
\begin{document}
\cite{zhaos}
\printbibliography
\end{document}
When I try to compile this code, I get an error log that is too long to copy here, but the relevant parts seem to be:
! Illegal parameter number in definition of \blx@defformat@d.
<to be read again>
7
l.35 ^^I\ifboolexpr{ test {\ifblank{#7
}} or test {\ifnameaffix{#7}} }
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.
! Illegal parameter number in definition of \blx@defformat@d.
<to be read again>
7
l.35 ...st {\ifblank{#7}} or test {\ifnameaffix{#7
}} }
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.
! Illegal parameter number in definition of \blx@defformat@d.
<to be read again>
4
l.37 ^^I^^I{\usebibmacro{name:first-last}{#1}{#4
}{#5}{#7}}
You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.
It goes on like that for a long time. Can anyone please tell me what has gone wrong, and what can be done to fix it?