# Mixing Chinese Characters with English (Main Language) in 2019 | What is the “State of the Art”?

• I have a English document (in UTF8) and want to place in some placed Chinese translations (single words: symbols and pinyin, which is the Latin character version).
• Ideally, I want to use pdflatex (or lualatex) if that is possible.
• What is the start of the art / best practice for including (little) Chinese text bits in a mainly English document using pdflatex or lualatex?
• I am looking for a robust solution that may be feasible for some years.
• I am also open if you recommend not to do that if this a not well supported use case for LaTeX.

\documentclass{article}

\begin{document}

This is an English text about apples
(Pinyin: \Pinying{píng guǒ}))

\end{document}


The question may be to broad or even stupid - this is mainly due to my inexperience in this area. I am looking for some advice and some MWEs to start with.

Related

## Update 1: Follow-up Question

babel: Language "pinyin"

## Update 2: fontspec vs. babelfont

I have noticed that David did not use fontspec in his answer - I am not an expert in fonts but I usually see fontspec when using luatex. I found the explanation in the babel manual:

Here's a babel implementation showing English (australian) as main language, simplified and traditional Chinese, and Pinyin.

It will compile with XeLaTeX and LuaLaTeX. Though be aware that the Chinese fonts are huge and it takes the LuaTeX font loader a long time and a lot of RAM to build the cache. So long, that I can't actually compile this on my computer with LuaLaTeX. (I have a 5 year old MacBook Air with 4GB RAM running Linux. My machine just runs out of resources and kills the process.)

\documentclass{article}
\usepackage[pinyin,australian]{babel}

\babelprovide[main,import,language=Default]{australian}
\babelprovide[import,language=Chinese Simplified]{chinese-simplified}

\babelfont{rm}{Noto Serif}
\babelfont{sf}{Noto Sans}
\babelfont[chinese-simplified]{rm}{Noto Serif CJK SC}
\babelfont[chinese-simplified]{sf}{Noto Sans CJK SC}

\begin{document}

\section{Roman Family}

Australian English.

\foreignlanguage{chinese-simplified}{汉语。}
\foreignlanguage{pinyin}{Pīnyīn.}
\renewcommand*{\familydefault}{\sfdefault}
\sffamily

\section{Sans Serif Family}

Australian English.

\foreignlanguage{chinese-simplified}{汉语。}
\foreignlanguage{pinyin}{Pīnyīn.}

\end{document}


I have a feeling the language= settings shouldn't be needed, but at least with my version of babel, they still are. In the future, I'd guess that this will work without explicitly specifying the language.

# XeLaTeX output

Notice the difference in how the Chinese full stop is rendered in simplified and traditional Chinese.

• That's a great answer. I will try to compile it on my computer. I need to install noto fonts first. – Dr. Manuel Kuehner Jul 15 at 4:48
• Do you have experience with the \usepackage{xpinyin} tex.stackexchange.com/questions/471491? Would you recommend using it? – Dr. Manuel Kuehner Jul 15 at 5:08
• @Dr.ManuelKuehner, sorry, I haven't used xpinyin. Looks like an interesting package though. – David Purton Jul 15 at 10:37
• Hi, I can compile it now. (1) I do get the warning Package babel Warning: Unknown language 'pinyi' - do you know where I can get pinyin.ldf? (2) I had to copy the fonts into [...] AppData\Local\Programs\MiKTeX 2.9\fonts\opentype\google\noto - do you know why? I also installed them normally as system fonts but that wasn't enough apparently. Please tell me, if I should ask a new question rather than using the comment function. – Dr. Manuel Kuehner Jul 15 at 17:51
• @Dr.ManuelKuehner, I don't know about fonts and Macs. I have the fonts installed as system fonts in the usual way on my Linux machine. For pinyin.ldf, I think it's in the cjk package. (Makre sure you spelt it right: it's pinyin, not pinyi like your error message.) – David Purton Jul 16 at 0:33

With pdflatex:

\documentclass{article}
\usepackage{CJKutf8}

\newcommand{\chinese}[1]{\begin{CJK}{UTF8}{bsmi}#1\end{CJK}}

\begin{document}

This is an English text about apples
Pinyin: píng guǒ)

\end{document}


With xelatex:

\documentclass{article}
\usepackage{xeCJK}

\setCJKmainfont{Songti SC} % use a font you have that covers Chinese

\begin{document}

This is an English text about apples

• @Dr.ManuelKuehner I'm not sure: xeCJK exploits character classes, which are not supported in LuaTeX. – egreg Jul 14 at 18:01
• I don't think this adequately deals with differences between simplified and traditional Chinese. You need to use different font settings (or different fonts). And I notice babel has hyphenation patterns for pinyin (though I don't know how significant this is). – David Purton Jul 15 at 2:17