对 LaTeX 非常陌生,并且只通过 pandoc 进行过有限的接触,
我正在使用 pandoc 将包含日语和韩语书目来源的 markdown 英文文章通过 LaTeX 转换为 PDF,这允许使用 LaTeX 模板。我经常使用 CJK(中文/日语/韩语)书目来源(bibtex
从 Zotero 导出并根据 CJK 需求修改的文件),其中包含额外信息,例如原始字符中的作者和标题名称、罗马化和翻译。
为了使其在我的工作流程中发挥作用,我很高兴找到这个问题/答案,它非常有帮助:芝加哥风格的 CJK 文献引文(例如美国东方学会):姓名顺序;转录/翻译的标题
但是,我无法使用 pandoc 提供的示例复制那里显示的结果。
主要问题是标题的翻译,即bibtex
参考书目中的“usere”数据,没有出现在最终使用 pandoc 的转换中。
看看我所看到的:
Markdown 文件示例test.md
:
This is a test.[@zhaoj, 22] Another test.[@li, 14]
# References
Bibtex 文件示例bib.bib
(取自 StackExchange 帖子):
@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}}
pandoc 的示例 TeX 模板template.tex
本质上只是使用上面链接中提供的解决方案:
\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}
最后,使用 pandoc 命令使一切正常工作:
pandoc --template=template.tex --latex-engine=xelatex test.md --biblio=bib.bib -o test.pdf
结果几乎已经出来了,但是
- 缺少标题的“usere”翻译,
- 与上面链接中的输出不同,将罗马化的中文和原始中文都用引号引起来,并且
似乎在这里或那里添加了一个额外的逗号:
对于我们这些使用日语、中文和韩语资料撰写学术文章的人来说,如果能得到帮助,我们将不胜感激。我很乐意将上述链接中的建议和此处的答案汇编成一篇文章,为未来遇到类似情况的用户提供教程。提前感谢你的帮助。