Inspired by LaTeX package ruby @egreg's suggestion to the problem (Displaying pinyin over Chinese characters, without impacting word spacing) I implemented the following command with example of usage:
\documentclass[a5paper]{article}
\usepackage[heading]{ctex}
\newcommand{\annote}[2]{%
\leavevmode
\vbox{\offinterlineskip
\halign{%\hfil
##\hfil\cr
\strut#2\cr
\noalign{\vskip-0.3ex}%
\strut#1\cr}%
}%
}
\begin{document}
\noindent \annote{床前}{In front my couch,} \annote{明月光,}{there's moonlight}\\
\annote{疑是地上霜。}{It looks like frost on the ground}\\
\annote{举头望}{Looking up} \annote{明月,}{the moon}\\
\annote{低头思}{Looking down missing} \annote{故乡。}{my hometown}
\end{document}
My purpose is to add an annotation to a text phrase. It seems working, but sometimes, I ran into a problem when compiling a LaTeX file with the command, my Ubuntu machine would completely be frozen.
Would you please help me to review and improve?
Here is the output, when it works with XeLaTeX:
