Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm writing a document in English. However, I need to use a few words of both Japanese and Russian. In principle, it seems to work, but as soon as I used Japanese characters, I cannot use Russian characters afterwards. Please note that it is crucial for me that the document compiles using pdflatex.

Here are two minimal examples to illustrate my problem.

This one works:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T2A,T1]{fontenc}
\usepackage{CJK}

\begin{document}
{\fontencoding{T2A}\selectfont ф}
\begin{CJK}{UTF8}{min}
ル
\end{CJK}
\end{document}

But this doesn't:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T2A,T1]{fontenc}
\usepackage{CJK}

\begin{document}
  {\fontencoding{T2A}\selectfont ф}
  \begin{CJK}{UTF8}{min}
  ル
  \end{CJK}
  {\fontencoding{T2A}\selectfont ф}
\end{document}

I cannot figure out why. In the second case, I get this error message:

! Undefined control sequence.
\CJK@XX ...r `#1\endcsname {`#2}\CJK@ignorespaces 
                                                  \fi 
l.12   {\fontencoding{T2A}\selectfont ф
                                        }

I cannot find any explanation and I would really appreciate any help.

share|improve this question
    
I suggest XeLaTeX (with xeCJK) or LuaLaTeX (with luatexja-fontspec). –  Leo Liu Jun 13 '13 at 1:30

2 Answers 2

Hmm seems like CJK package is making some definitions global when perhaps it shouldn't. You can reset the inputenc settings like so:

enter image description here

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T2A,T1]{fontenc}
\usepackage{CJK}

\begin{document}
  {\fontencoding{T2A}\selectfont ф}
  \begin{CJK}{UTF8}{min}
  ル
  \end{CJK}%
\sbox0{\input{utf8.def}}%
  {\fontencoding{T2A}\selectfont ф}
\end{document}
share|improve this answer
    
Thank you very much, that works perfectly. :-) –  Pete Jun 11 '13 at 18:15
1  
@Pete Welcome to tex.sx! If David’s answer solved your problem, you can accept it by clicking on the check below the vote count. –  doncherry Jun 11 '13 at 22:38

David Carlisle's solution works, but it is not as good as it could be.

In fact, there's a CJKutf8 package which solves the problem that inputenc and CJK packages may conflict.

Here's an example:

enter image description here

\documentclass{article}
\usepackage[T2A]{fontenc}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK}{UTF8}{min}

ру́сский: абвгдеАБВГДЕ

English: abcdefABCDEF

日本語:ぁぃぅぇぉか

\clearpage\end{CJK}
\end{document}

NOTES:

  1. Please always use CJK environment globally, unless you know what you are doing.
    The extra \clearpage is used to solve an old sutle bug of CJK described in the package document.

  2. T2A font encoding is sufficient if you only use basic Latin letters used by English. However, if you need more accented letters, you can mix T1 and T2A font encodings manually.

  3. For multilingual documents, I think it is always preferrable to use XeLaTeX or LuaLaTeX. For XeLaTeX, use our xeCJK package to support automatical font selection and other features. For LuaLaTeX, use luatexja bundle to support similar features.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.