Typeset Pinyin in TeX

Use \atop

$$ \def\py#1#2{\text{\scriptsize{#2}}\atop\text{\;#1\;}} {\py{关}{gu\=an}} {\py{雎}{j\=u}} \\~\\ {\py{关}{gu\=an}} {\py{关}{gu\=an}} {\py{雎}{j\=u}} {\py{鸠}{ji\=u}} {\py{,}{}} {\py{在}{z\`ai}} {\py{河}{h\'e}} {\py{之}{zh\=\i}} {\py{洲}{zh\=ou}} {\py{。}{}} \\~\\ {\py{窈}{y\v{a}o}} {\py{窕}{ti\v{a}o}} {\py{淑}{sh\=u}} {\py{女}{n\v{\"u}}} {\py{,}{}} {\py{君}{j\=un}} {\py{子}{z\v\i}} {\py{好}{h\v{a}o}} {\py{逑}{qi\'u}} {\py{。}{}} $$
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
\def\py#1#2{\text{\scriptsize{#2}}\atop\text{\;#1\;}}
{\py{}{gu\=an}}  {\py{}{j\=u}}     \\~\\
{\py{}{gu\=an}}  {\py{}{gu\=an}}
{\py{}{j\=u}}    {\py{}{ji\=u}}    {\py{}{}}
{\py{}{z\`ai}}   {\py{}{h\'e}}
{\py{}{zh\=\i}}  {\py{}{zh\=ou}}   {\py{}{}} \\~\\
{\py{}{y\v{a}o}} {\py{}{ti\v{a}o}}
{\py{}{sh\=u}}   {\py{}{n\v{\"u}}} {\py{}{}}
{\py{}{j\=un}}   {\py{}{z\v\i}}
{\py{}{h\v{a}o}} {\py{}{qi\'u}}    {\py{}{}}

Use \overset

$$ \def\py#1#2{\overset{\text{#2}}{\text{\;#1\;}}} {\py{关}{gu\=an}} {\py{雎}{j\=u}} \\ {\py{关}{gu\=an}} {\py{关}{gu\=an}} {\py{雎}{j\=u}} {\py{鸠}{ji\=u}} , {\py{在}{z\`ai}} {\py{河}{h\'e}} {\py{之}{zh\=\i}} {\py{洲}{zh\=ou}} 。 \\ {\py{窈}{y\v{a}o}} {\py{窕}{ti\v{a}o}} {\py{淑}{sh\=u}} {\py{女}{n\v{\"u}}} , {\py{君}{j\=un}} {\py{子}{z\v\i}} {\py{好}{h\v{a}o}} {\py{逑}{qi\'u}} 。 $$
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
\def\py#1#2{\overset{\text{#2}}{\text{\;#1\;}}}
{\py{}{gu\=an}}  {\py{}{j\=u}}       \\
{\py{}{gu\=an}}  {\py{}{gu\=an}}
{\py{}{j\=u}}    {\py{}{ji\=u}}{\py{}{z\`ai}}   {\py{}{h\'e}}
{\py{}{zh\=\i}}  {\py{}{zh\=ou}}\\
{\py{}{y\v{a}o}} {\py{}{ti\v{a}o}}
{\py{}{sh\=u}}   {\py{}{n\v{\"u}}}{\py{}{j\=un}}   {\py{}{z\v\i}}
{\py{}{h\v{a}o}} {\py{}{qi\'u}}

Note: Wrap the code in <div>$$ and $$</div>.