I am using the package xpinyin
for displaying pinyin, a Chinese phonetic script above Chinese characters. This seems to work well, but I want to change the font of the phonetic script. I found some code in the package documentation, although that one is Chinese only:
\xpinyinsetup{ratio=0.5, vsep=1em, multiple={\color{red}}, font=Liberation Sans}
The Chinese in the documentation is still too high level for me, so I simply guess this is what it does:
- make the pinyin hal the size of the main font
- vertical separation of 1em, pinyin is separated by 1em from the Chinese character below
- if there are multiple pinyins for one character (多音字) then the pinyin will be the most likely one and colored red
- use the font
Liberation Sans
However, I don't know if you can simply leave a space between Liberation
and Sans
. The main problem is the following result:
(In this picture I used Arial
because it's a short enough name to be readable.)
So I thought: "This must be a font issue." I tried using the Liberation Sans
font in Libre Office, to check whether it could display the missing vocals with tones. There it was able to display it without indicating a change of font, but I don't know if it hides this information and maybe the font really cannot dislay those vocals.
Also notice how somehow the font name was added into the phonetic script. This might be intentional, although it rather seems like a bug. I don't understand the documentation though.
How can I make xpinyin display correctly without having the font name in the phonetic script of the first character?
Here some example code:
\documentclass[10pt, a4paper, parskip=full]{article} % twoside can be added if two sided margin layout is desired
\usepackage[a4paper,vmargin={30mm, 20mm},hmargin={30mm, 25mm},includeheadfoot]{geometry}
\usepackage{amsmath}
\usepackage[UTF8]{ctex}
\usepackage{xpinyin}
\xpinyinsetup{ratio=0.5, vsep=1em, multiple={\color{red}}, font=Liberation Sans}
\usepackage{fontspec,xunicode}
\setCJKmainfont[]{WenQuanYi Micro Hei}
\defaultfontfeatures{Mapping=tex-text, Scale=MatchLowercase} % what does this do? -- influences how quotes are rendered
\setmainfont[Scale=1]{Open Sans}
\setmonofont{Liberation Mono}
\DeclareMathSizes{10}{10}{8}{7}
\usepackage[english, ngerman]{babel}
\selectlanguage{ngerman}
\begin{document}
\begin{pinyinscope}
我有一个送给你的礼物.
\end{pinyinscope}
\end{document}