Very new to LaTeX and only limited exposure via pandoc,
I'm converting markdown English article that contains Japanese and Korean bibliography sources to PDF via LaTeX using pandoc, which allows the use of a LaTeX template. I very often use CJK (Chinese/Japanese/Korean) bibliography sources (bibtex files exported from Zotero and modified for CJK needs) which contain extra information such as the author and title name in the original characters, romanization and translation.
To get this to work in my workflow, I was delighted to find this question/answer, which was extremely helpful: Chicago-style citations of CJK documents (e.g. American Oriental Society): Name order; transcribed/translated titles
However, I'm not able to replicate the results shown there, with the sample provided there, using pandoc.
The main problem is that the translation of the title, the "usere" data in the bibtex bibliography, does not appear in the final conversion with pandoc.
To see what I'm seeing:
Sample Markdown file test.md:
This is a test.[@zhaoj, 22] Another test.[@li, 14]
# References
Sample Bibtex file bib.bib (taken from the StackExchange post):
@article{zhaoj,
author = {Zhao, 赵杰, Jie},
title = {Qingdai Manwen de wenzi tese ji yinyun, yinbian tedian},
titleaddon = {清代满文的文字特色及音韵、音变特点},
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},
address = {Beijing},
title = {Riben Hanyu yinyun xue shi},
titleaddon = {日本汉语音韵学史},
usere = {History of the study of Chinese phonology in Japan},
date = {2011}}
Sample TeX template template.tex for pandoc essentially just using the solution provided in the above link:
\documentclass{article}
\usepackage{xeCJK}
\setCJKmainfont{Kai}
\usepackage[authordate,backend=biber,bibencoding=utf8]{biblatex-chicago}
\forcsvlist{\listadd\nameaffixlist}{Junior,Senior}
\newcommand{\ifnameaffix}[1]{%
\ifboolexpr{ test {\ifrmnum{#1}} or test {\ifinlist{#1}{\nameaffixlist}} }}
\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}}}
\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}
\end{document}
And finally, the pandoc command used to make it all work:
pandoc --template=template.tex --latex-engine=xelatex test.md --biblio=bib.bib -o test.pdf
The result is almost there but
- missing the "usere" translation of the titles,
- unlike the output in the link above, surrounds both the romanized and original Chinese with quotation marks, and
appears to add an extra comma here and there:
pandoc conversion output http://huginn.net/t/latex-output.png
For those of us out there writing academic articles that use Japanese, Chinese, and Korean sources, help with this would be really appreciated. I'd love to compile the suggestions made in the link above and answers here in a post to provide a tutorial for future users who have a similar situation. Thanks in advance for the help.
usereetc. – PLK Jun 20 '13 at 19:53