# How can I succeed in including a few Chinese ideograph text characters while using pdflatex? [duplicate]

I am using TexLive 2015 on Debian Jessie with what I believe to be a complete installation (including Debian packages such as cjk-latex, texlive-fonts-extra, and latex-cjk-chinese-arphic-bsmi00lp).

I have a predominantly English document in which I would like to insert just a very few Chinese ideograph characters:

• dragon, 龍, U+F9C4 (byte pattern e9 be 8d in UTF-8)
• dream, 夢, U+5922 (byte pattern e5 a4 a2 in UTF-8)
• fish, 魚, U+9B5A (byte pattern e9 ad 9a in UTF-8)

Running file -bi myfile.tex reports text/x-tex; charset=utf-8. Near the top, my file contains

\usepackage[utf8]{inputenc}
\usepackage{CJKutf8}


I also defined

\newcommand{\chinesechar}[1]{{\CJKfamily{bsmi}#1}}


When I attempt to use this in the body of my document, compilation with pdflatex is successful:

\chinesechar{} => nothing is output

\chinesechar{abc} => the 3 characters "abc" are output

Then, I have tried two ways of inserting the dragon character directly into the file. The first way was to use emacs' built-in command C-x 8 RET f9c4 to insert the dragon character into the file. The second way was to start with abc, then use a hex editor to change the three bytes into e9 9b a8 (which is the UTF-8 encoding of U+f9c4). In either case, I will then see dashed square brackets representing the ideograph, and will the same error message upon running pdflatex:

Package inputenc Error: Unicode char \u8:[] not set up for use with LaTeX. (Except, the [] that appears is dashed, not solid. Even outside the editor, the Chinese character when pasted from this web question appears with the dashed square brackets in the terminal (which is xterm).)

(Note: Someone commented below that I should use a smarter editor, but I believe this problem is more correctly understood as being with the subsequent processing of the character by LaTeX rather than the task of entering the character itself into the editor.)

Changing \usepackage[utf8]{inputenc} to \usepackage[utf8x]{inputenc} merely yields a different error under pdflatex:

LaTeX error: Option clash for package inputenc.


I have seen XeLaTeX mentioned as a good option for documents in which Chinese is the main language, but attempting to switch also caused me problems. Viewing the content of other questions posted on this site such as such as How can I write an English document with a few words of Thai, Japanese, and Chinese? has not enabled me to achieve my goal.

How to insert three Chinese characters? has been suggested as a potential duplicate of this question. I do not see it as such: I was asking about using text rather than images. That said, I am open to the possibility that what I would like to do cannot in fact be done using text, that instead one must use images as outlined in that post. Thus, I went and attempted to try that solution. Specifically, I wrote this file using dragon (龍):

\documentclass{standalone}
\usepackage{CJK}
\begin{document}
\begin{CJK}{UTF8}{gbsn}
龍
\end{CJK}
\end{document}


(I also tried using dream (夢) and fish(魚) alone on the line.)

When I run pdflatex on the above file using dream (U+5922) or fish (U+9B5A), a .pdf file is output, but viewing it (with evince) shows no character. [However, trying rain (U+96E8) does in fact work!]

when I run pdflatex on the above file using dragon (U+F9C4), I end up seeing

This is METAFONT, Version 2.7182818 (Tex Live 2015/dev/Debian) (preloaded base=mf)

kpathsea: Running mktexmf gbsnuf9
! I can't find file gbsnuf9'.
<*> ...=ljfour; mag:=1; nonstopmode; input gbsnuf9

Please type another input file name
! Emergency stop.
<*> ...=ljfour; mag:=1; nonstopmode; input gbsnuf9

Transcript written on mfput.log.
grep: gbsnuf9.log: No such file or directory
mktextfm: mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input gbsnuf9' failed to make gbsnuf9.tfm.
kpathsea: Appending font creation commands to missfont.log.

relax
l.12 龍


So, this workaround appears to not work.

To summarize the question: How can I succeed in including a few Chinese ideograph characters (ideally, as actual text) while using pdflatex?

## marked as duplicate by egreg, Mensch, Jesse, Martin Schröder, WernerSep 12 '15 at 0:09

• After all if there are only a few ideographs, include them as images. (They are literally images in fact.) Otherwise if you want to insert Unicode characters into files, you should firstly try to copy-and-paste, say, 龍 through some smarter editor. – Symbol 1 Jul 13 '15 at 3:26

I am not sure whether this can help, but I use the following:

%%%
%%% Load CJKutf8 to be able to print Chinese characters
%%% Provide command \zh to enable us to write Chinese characters
%%%
%
\let\internalBegin\begin%
\let\internalEnd\end%
%
%%% Our text is UTF-8 encoded.
\RequirePackage[utf8]{inputenc}%
%
\RequirePackage{CJKutf8}%
%
%%%
%%% Print some text in Chinese characters
%%% #1 the text to print
\protected\gdef\zh#1{\internalBegin{CJK}{UTF8}{gbsn}#1\internalEnd{CJK}}%


I found that originally somewhere on the web, but forgot where (thus I cannot add a proper citation).

Argh, I overlooked @egreg's comment. I guess that was also the location where I originally got my suggestion from...(?)