I know that using the xpinyin
package can solve this, but I need to use Lualatex, which is not supported.
At first I used the following code:
\documentclass{ctexart}
\usepackage{amsmath}
\newcommand\zhuyin[2]{$\overset{\textrm{#1}}{#2}$}
\begin{document}
\zhuyin{tiān}{天}
\end{document}
For general Chinese characters, it works very well.
But now I have some rare characters that need to be annotated, they are in the Unicode Extension B area, which means that the normal font does not include them (I've tried fonts like Source Han Sans): 𧉍(U+2724D), 𧉆(U+27246). On my system, it seems that only simsunb.ttf can display them. I'm having trouble changing the font in mathematical mode. I tried the following code and it failed:
\documentclass{ctexart}
\usepackage{amsmath}
\newcommand\zhuyin[2]{$\overset{\textrm{#1}}{#2}$}
\newfontfamily{\zyextb}{simsunb.ttf}[NFSSFamily=simsunb]
\DeclareMathAlphabet{\mathzy}{TU}{simsunb}{m}{n}
\begin{document}
%I also tried \zhuyin{jí}{\zyextb 𧉆}
\zhuyin{jí}{\mathzy 𧉆}
\end{document}
Can you help me?
luatexja
(developed for Japanese + LuaTeX) for Chinese typesetting too.luatexja
(according to the manual) has an add-onluatexja-ruby
package for typesetting pronunciation annotations. Maybe you can look into that?