Fonts & Character SetsJapanese and Russian Characters in the same Document

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
Post Reply
pefra
Posts: 3
Joined: Mon Jun 10, 2013 8:02 pm

Japanese and Russian Characters in the same Document

Post by pefra »

Hello,

I have a question that I did not find answered anywhere. 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. Here are two minimal examples to illustrate my problem.

This one works.

Code: Select all

\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

Code: Select all

\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

Code: Select all

! 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.


Best regards and thanks in advance,
Pete

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Japanese and Russian Characters in the same Document

Post by cgnieder »

Hi Pete, welcome to the LaTeX community!

I've never used CJK before so I don't no if this is a bug or if there is a recommended way, but if you call either \CJKnospace or \CJKspace then \CJK@ignorespaces is defined and the error is gone. The first one defines it to be \ignorespaces the second one to \@empty.

Code: Select all

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T2A,T1]{fontenc}
\usepackage{CJK}
\CJKnospace
\begin{document}
  {\fontencoding{T2A}\selectfont ф}
  \begin{CJK}{UTF8}{min}
  ル
  \end{CJK}
  {\fontencoding{T2A}\selectfont ф}
\end{document}
Regards
site moderator & package author
pefra
Posts: 3
Joined: Mon Jun 10, 2013 8:02 pm

Re: Japanese and Russian Characters in the same Document

Post by pefra »

@cgnieder: Thank you very much!

I found an alternative solution that resets the input encoding here:

http://tex.stackexchange.com/questions/ ... e-document

I am also not sure, but to me, this seems like a bug.

Best,

Pete
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Japanese and Russian Characters in the same Document

Post by cgnieder »

pefra wrote:http://tex.stackexchange.com/questions/118704/japanese-and-russian-characters-in-the-same-document
Thanks for that link. I'm sure you've simply forgotten it before ;)
Board Rules wrote:A crossposting is always contra-productive. But there is nothing really against it as long as it is mentioned. This means that a direct link has to be added. So other users who want to help are preserved from double efforts and waste of time.
Regards
site moderator & package author
pefra
Posts: 3
Joined: Mon Jun 10, 2013 8:02 pm

Japanese and Russian Characters in the same Document

Post by pefra »

@cgnieder: I am really sorry. I was probably too impatient and posted at tex.stackexchange.com when I got no reply here. I should have mentioned it then, and also I should have waited longer.

Once again, thank you very much and pardon my bad behaviour. :oops:

Pete
Post Reply