TransWikia.com

Russian and Chinese in the same document

TeX - LaTeX Asked by user21359 on March 21, 2021

I’m writing a document that is going to required having Russian, Chinese characters, and English. I’m using CJK and babel and example code is below:

documentclass[12pt]{article}
usepackage[margin=1in]{geometry}
usepackage[T1,T2A]{fontenc}
usepackage[utf8]{inputenc}
usepackage[russian, english]{babel}
usepackage{CJK}
usepackage{setspace}
doublespacing
usepackage{natbib}
begin{document}
слово
begin{CJK}{UTF8}{gbsn}
你好
end{CJK}

слово

end{document}

The Russian that becomes before the CJK environment shows up fine, but anything afterwards doesn’t display properly.

3 Answers

Just use CJKutf8 package instead.

documentclass{article}
usepackage[T1,T2A]{fontenc}
usepackage[utf8]{inputenc}
usepackage[russian, english]{babel}
usepackage{CJKutf8}

begin{document}
слово
begin{CJK}{UTF8}{gbsn}
你好
end{CJK}

слово

end{document}

Or, a XeTeX solution using xeCJK pacakge is also acceptable. See also How does one type Chinese in LaTeX?

Correct answer by Leo Liu on March 21, 2021

Multilingual typesetting

Code

documentclass[12pt]{article}
usepackage[margin=1in]{geometry}
usepackage[T1,T2A]{fontenc}
usepackage[utf8]{inputenc}
usepackage[russian, english]{babel}% note - it is recommended to specify the variant of English required to avoid unexpected divergence depending on the version of babel e.g. american or british
usepackage[encapsulated]{CJK}
usepackage{setspace}
doublespacing
usepackage{natbib}
begin{document}
selectlanguage{russian}
слово

begin{CJK}{UTF8}{gbsn}
你好
end{CJK}

selectlanguage{english}
Here is some text in English.

selectlanguage{russian}
слово

end{document}

Explanation

The encapsulated option is required because you are using specialised encodings outside of the CJK environments. For details run

texdoc cjk

Notes

  • You should switch languages using either selectlanguage{<language>} (for a general switch until further notice) or foreignlanguage{<language>}{<some text>} (if you just want to typeset a small amount of text in another language).
  • You have defined english as the main language. So you need to switch to Russian even if it is the first language used in the document. Passing english is not a great idea because it is ambiguous and has different effects with different versions of babel. Better to specify the variant required such as british or american.
  • If Russian should be the main language, you should use something like:

    usepackage[british,russian]{babel}

    The last language passed to babel is assumed to be the first language used and the main language for the document.

Answered by cfr on March 21, 2021

A simple way to display Chinese characters is to use the kotex package.

usepackage{kotex}

The good thing about this package is that you don't need to encapsulate your Chinese characters. You can just write things like

你好

and they will display correctly in the PDF.

Answered by Paul Jones on March 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP