I want to display pinyin (romanized form) over Chinese characters. However, the two methods I know (using stackrel
or tabular
both change the spacing between characters. This demonstrates the problem:
\documentclass[a5paper]{article}
\usepackage{ctexcap}
\usepackage{stackrel}
\setCJKmainfont{Adobe Heiti Std}
\newcommand{\mymacroone}[1]{$\stackrel{a}{\textrm{#1}}$}
\newcommand{\mymacrotwo}[1]{\begin{tabular}{l}a\\#1\end{tabular}}
\begin{document}
\Huge \noindent 床前明月光,疑是地上霜。举头望明月,低头思故乡。 \\
\mymacroone{床}\mymacroone{前}\mymacroone{明}\mymacroone{月}\mymacroone{光},\mymacroone{疑}\mymacroone{是}\mymacroone{地}\mymacroone{上}\mymacroone{霜}。\mymacroone{举}\mymacroone{头}\mymacroone{望}\mymacroone{明}\mymacroone{月},\mymacroone{低}\mymacroone{头}\mymacroone{思}\mymacroone{故}\mymacroone{乡}。 \\
\mymacrotwo{床}\mymacrotwo{前}\mymacrotwo{明}\mymacrotwo{月}\mymacrotwo{光},\mymacrotwo{疑}\mymacrotwo{是}\mymacrotwo{地}\mymacrotwo{上}\mymacrotwo{霜}。\mymacrotwo{举}\mymacrotwo{头}\mymacrotwo{望}\mymacrotwo{明}\mymacrotwo{月},\mymacrotwo{低}\mymacrotwo{头}\mymacrotwo{思}\mymacrotwo{故}\mymacrotwo{乡}。 \\
\end{document}
Each of the three lines should be displaying the same.
- With
stackrel
, the words are spaced too closely together. This problem is not created bystackrel
. It is from having math mode withtextrm{}
inside. - With
tabular
, the words are spaced too far apart, they do not properly break at the end of the line, and it has a strange vertical and horizontal alignment problems. Usingstackrel
would be ideal.
How can I place pinyin above Chinese characters without changing the spacing between the characters (at least in situations where the pinyin is shorter than the characters)?
tabular
with column specification@{}l@{}
instead of justl
. This removes the column separation (or spacing). I can't test it myself, since I don't have the appropriate editor installed.@{}l@{}
, the line usingtabular
appears with the same spacing as withstackrel
.cjk
tag if you usexecjk
tag. Then the question would be easier to be find for others.