6

I want to write a document in english and some words in chinese using pdfLaTeX.

Here a MWE:

\documentclass{article}
\usepackage[UTF8]{ctex}
\begin{document}
nǔrén\v{a}amùtūou 
\end{document}

This shows up as in the image below:

enter image description here

As you can see after the ǔ or the ū LaTeX puts automatically a free space even if it's not written in the code, but not after \v{a}.

1) Why happens this?

2) How can I avoid this problem? (As you can imagine its not easy to make the change every time)

Thank you for any suggestions.

1 Answer 1

6

ctex package loads CJKutf8 package with pdfLaTeX. CJKutf8 package loads inputenc with utf8 option. However, unicode characters like ǔ is not defined in utf8.def, so CJK package treats these characters as CJK wide symbols, using a CJK font. That's the problem.

To fix the problem, you can define these unicode characters yourself:

% pdfLaTeX
\documentclass{article}
\usepackage[UTF8]{ctex}
\usepackage{newunicodechar}
\newunicodechar{ǚ}{\v{\"u}} % or: \DeclareUnicodeCharacter{01DA}{\v{\"u}}
\newunicodechar{ū}{\={u}}
\newunicodechar{ǎ}{\v{a}}
\usepackage[T1]{fontenc} % necessary for \v{\"u}

\begin{document}
女人nǚrén

奶奶nǎinai

秃头tūtóu
\end{document}

A better solution is to use XeLaTeX instead of pdfLaTeX. It's much easier to deal with unicode characters in XeTeX.

% XeLaTeX
\documentclass{article}
\usepackage[UTF8]{ctex}

\begin{document}
女人nǚrén

奶奶nǎinai

秃头tūtóu
\end{document}

See also xpinyin package to input pinyin easier.

Related question:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .