I'm trying to make a document with both English words, pinyin translation and chinese characters.

Is it possible to write the code in pinyin (or something similar) and get the corresponding characters when you compile?


In code: jǔ -> In document: 举


In code: ju3 -> In document: 举

//Pinyin describes the English way of pronouncing a Chinese character. The character 举 sounds like "ju".

If this is the wrong forum please tell

  • 2
    ju3 could mean a lot of things: 举 to hold, 矩 rectangle, and so on. So I don't think your request is feasible because of this. Many different Chinese characters share the same “pinyin”. Jan 23, 2019 at 15:53

1 Answer 1


This would not really be feasible, because there can be many characters with the same pronunciation (pinyin). So e.g. ma3 (or mǎ) may be 马 or 码 or 玛 ……

But perhaps you can do it the other way round: Type the Chinese characters, and the xpinyin package can annotate it with the pinyin. Here's an example from the documentation:


Sooner or later you'll come across characters that can have more than one pronunciation. In that case you can specify the pinyin explicitly:

\xpinyin*{小树\xpinyin{长}{zhang3}大了, 枝梢变\xpinyin{长}{chang2}了}

sample output of xpinyin

  • 2
    +1. I'd remove the space in 小树长大了 though Jan 23, 2019 at 15:49
  • That was my fear, but thank you anyway! Jan 23, 2019 at 16:14
  • @RuixiZhang Gah why didn't I see that. Anyway it's a long story; see thetype.com/2017/08/11606/#pinyin-size for a good discussion of typesetting pinyin, if you're interested.
    – imnothere
    Jan 24, 2019 at 6:04
  • 1
    That Type is Beautiful (TIB) article is what inspires me to learn more about typography. In fact, I have a proposal to support loose setting (疏排, see github.com/CTeX-org/ctex-kit/issues/387) to reproduce the 1st grade Chinese text shown in that TIB article ;). Jan 24, 2019 at 23:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .