[Tex/LaTex] Latex: Pinyin below Chinese characters

cjklanguages

I would like to enter a Chinese (Simplified) Characters in a TeX doc that is rendered by XeTeX and have the Pinyin transcription automatically added below the according characters. So, I only enter the Chinese characters and the Pinyin should be looked up through a library.

I have seen that ChinesePod does something similar, so I imagined that someone else must have thought of that and written something for TeX already. Do you know any tools/packages for that for TeX?

Here is a picture of how it should look like: http://cl.ly/35Lr

Best Answer

Another package that does transcription is the xpinyin package: http://www.ctan.org/pkg/xpinyin. You can download it with Texlive 2012's build-in update utility. You need to compile your document with XeTeX or XeLaTeX, though. Luatex etc doesn't work.

For characters with multiple pronunciations such as 重 (can be pronounced zhòng or chóng), it will mark the default pronunciation in red in the pdf. Then there is the possibility to disambiguate it by typing \xpinyin{重}{chong2} After disambiguating all such cases, one can set the colour of all multi-pronunciation items to black by specifying \xpinyinsetup{multiple={\color{black}}} in the document preamble.