[Tex/LaTex] How to write an English document with a few words of Thai, Japanese, and Chinese

cjkfontslanguagesunicode

I'm writing a document which is 99% English but needs a few words of other languages, including Thai, Japanese, and Chinese. I've had success with the latter two, but I'm stuck on Thai. Here's a MNWE:

\documentclass{article}

\usepackage{CJKutf8}

\begin{document}

Japanese: \begin{CJK}{UTF8}{min}結核\end{CJK}
Chinese: \begin{CJK}{UTF8}{bsmi}結核\end{CJK}
Thai: \begin{CJK}{UTF8}{gar}ไข้เด็งกี\end{CJK}   % <-- fail 

\end{document}

Compiling this fails with:

LaTeX Font Warning: Font shape `C70/gar/m/n' undefined
(Font)              using `C70/song/m/n' instead on input line 9.

(/usr/local/texlive/2013/texmf-dist/tex/latex/cjk/texinput/UTF8/c70song.fd)
./b0rken.tex:9: Undefined control sequence.
try@size@range ...extract@rangefontinfo font@info 
                                                  <-*>@nil <@nnil 
l.9 Thai: \begin{CJK}{UTF8}{gar}ไข
                                      ้เด็งกี\end{CJK}  % <-- ...

Commenting out the "fail" line leads to successful compile with Japanese and Chinese characters where they should be in the output.

This is using MacTeX 2013. I do have the cjk and fonts-tlwg packages installed. I also have several c90* files present, including c90gar.fd
and c90nrsr.fd.

I do need to stay with normal pdfTeX rather than XeTeX.

Best Answer

To use Thai fonts, we do not need to load CJK package, but babel package.

To use the fonts in C90 encoding, we can use thaicjk option of babel package.

\documentclass{article}

\usepackage[utf8x]{inputenc}

% English is the main language
\usepackage[thaicjk,english]{babel}
\addto\extrasthaicjk{\fontencoding{C90}\selectfont}

% Hack into CJKutf8 package for an option clash error
\makeatletter
\@namedef{opt@inputenc.sty}{utf8}
\makeatother
\usepackage{CJKutf8}

\begin{document}

Japanese: \begin{CJK}{UTF8}{min}結核\end{CJK}
Chinese: \begin{CJK}{UTF8}{bsmi}結核\end{CJK}
Thai: \foreignlanguage{thaicjk}{ไข้เด็งกี}

\end{document}

Or, we can also use the fonts in LTH encoding. In this case we need to use thai option of babel. See document of babel-thai.

\documentclass{article}

\usepackage[utf8x]{inputenc}

% English is the main language
\usepackage[thai,english]{babel}

% Hack into CJKutf8 package for an option clash error
\makeatletter
\@namedef{opt@inputenc.sty}{utf8}
\makeatother
\usepackage{CJKutf8}

\begin{document}

Japanese: \begin{CJK}{UTF8}{min}結核\end{CJK}
Chinese: \begin{CJK}{UTF8}{bsmi}結核\end{CJK}
Thai: \textthai{ไข้เด็งกี}

\end{document}