[OS X TeX] CJK package on Mac

Bruno Voisin bvoisin at mac.com
Tue Dec 4 05:11:04 EST 2007

Le 4 déc. 07 à 08:03, Jung-Tsung Shen a écrit :

> Thanks very much for the prompt reply. Here's the files:
> TeX file:
> http://www.stanford.edu/~jushen/Chinese_3.tex
> (* the chinese characters would not display correctly even I save the
> file locally and re-open again)
> log file:
> http://www.stanford.edu/~jushen/Chinese_3.log
> missing font:
> http://www.stanford.edu/~jushen/missfont.log
> [...]
> Following Peter and Bruno's comments, and went through the log file
> (which I don't understand) I think it's indeed font problem as they
> pointed out.

Downloading and attempting to process your files:

- Regarding the encoding of Chinese_3.tex, I have the impression this  
is Traditional Chinese, isn't it? I tried several of the other  
encodings TeXShop offers:

Unicode (UTF-8)
Traditional Chinese (MacOS)
Simplified Chinese (MacOS)
Traditional Chinese (Windows, DOS)
Simplified Chinese (Windows, DOS)
Chinese (GBK)
Simplified Chinese (GB 2312)
Chinese (GB 18030)

and Traditional Chinese (MacOS) seemed to make sense.

- I get the same type of errors (in pdfTeX mode) as you do:

> (/usr/local/texlive/2007/texmf-dist/tex/latex/CJK/CJK.sty
> (/usr/local/texlive/2007/texmf-dist/tex/latex/CJK/mule/MULEenc.sty)
> (/usr/local/texlive/2007/texmf-dist/tex/latex/CJK/CJK.enc)) (./ 
> Chinese_3.aux)
> (/usr/local/texlive/2007/texmf-dist/tex/latex/CJK/standard.bdg)
> (/usr/local/texlive/2007/texmf-dist/tex/latex/CJK/Bg5/Bg5.enc)
> (/usr/local/texlive/2007/texmf-dist/tex/latex/CJK/Bg5/Bg5.chr)
> (/usr/local/texlive/2007/texmf-dist/tex/latex/CJK/Bg5/c00song.fd)
> (/usr/local/texlive/2007/texmf-dist/tex/latex/CJK/Bg5/ 
> c00kai.fd)kpathsea: Running mktextfm b5ka1206
> /usr/local/texlive/2007/texmf/web2c/mktexnam: Could not map typeface  
> abbreviation 5k for b5ka1206.
> /usr/local/texlive/2007/texmf/web2c/mktexnam: Need to update /usr/ 
> local/texlive/2007/texmf-dist/fonts/map/fontname/special.map?
> mktextfm: Running hbf2gf -g b5ka1206 600
> Couldn't find `ntukai48.hbf'
> hbf2gf (CJK ver. 4.7.0)
> grep: b5ka1206.log: No such file or directory
> mktextfm: `hbf2gf -g b5ka1206 600' failed to make b5ka1206.tfm.
> kpathsea: Appending font creation commands to missfont.log.
> LaTeX Font Warning: Font shape `C00/song/m/n'
> (Font)              in size <12> not available.
> (Font)              Font shape `C00/kai/m/n'
> (Font)              tried instead on input line 9.
> ! Font C00/kai/m/n/12/06=b5ka1206 at 12.0pt not loadable: Metric  
> (TFM) file not
>  found.
> <to be read again>
>                    relax
> l.9 \maketitle

and many more of the same. Fonts are looked for which are not present:  
TeX attempts to launch special scripts (hbf2gf here, probably calling  
MetaFont in turn) to generate them on-the-fly, but it fails because  
some files aren't found.

It's either TeX that's not working as it should, or fonts which need  
to be downloaded and installed separately. The installation  
instructions at /Library/TeX/Documentation/texmf-dist-doc/latex/CJK/ 
doc/INSTALL mentions additional downloads:

> . Have you downloaded the needed font packages (either ps, hbf or  
> ttf)? See
>   also contrib/wadalab/DNP.txt for the Japanese Wadalab fonts. Have  
> you
>   moved the TFM files into your TFM-tree (or updated TFMINPUTS  
> accordingly)?
>   Ditto for VF files if needed.
> . Have you installed ttf2pk and ttf2tfm from the FreeType 1 package  
> (only
>   needed for TrueType fonts)? Note that FreeType 2 won't work.
> . Have you run ttf2tfm to create the proper TFM files from your  
> TrueType
>   fonts? This won't be done automatically via mktextfm or MakeTeXTFM!
> . Have you updated the ttfonts.map file for ttf2pk? Have you updated  
> the
>   various hbf2gf config files? Have you copied them to the right  
> places?
>   Don't forget to install ttf2pk's SFD and other data files which  
> define the
>   various CJK subfonts and encodings.
> . Have you modified and installed the script files for automatic font
>   generation (not necessary for teTeX 1.0 or newer)?
> . If you want Thai support, have you followed the instructions given  
> in
>   thaifont.txt?

I thought TeXLive had all this pre-installed and properly set up, but  
I'm beginning to wonder.

Unfortunately, given I know absolutely nothing about the Chinese  
language or fonts, I won't be able to help more. The ideal situation  
would be that somebody on this list has already used the CJK package  
with MacTeX and TeXShop, and can henceforth help. Otherwise you may  
try the CJK mailing list mentioned at <http://cjk.ffii.org/>, maybe  
they have experience with OS X.

Two more things:

- I've looked through the documentation directory /Library/TeX/ 
Documentation/texmf-dist-doc/latex/CJK/doc/, but couldn't find my way  
around it. There are of numbers of .txt files describing parts of the  
installation, but most are obsolete already (referring to teTeX).  
There's a PDF file /Library/TeX/Documentation/texmf-dist-doc/latex/CJK/ 
doc/pdf/READMEb5.pdf which looks like a user's manual, but it's mostly  
in Chinese and I can't understand a word of it! There's also /Library/ 
TeX/Documentation/texmf-dist-doc/latex/CJK/doc/CJK.txt, maybe it's the  
missing English user's manual.

- CJK seems to have been designed with use through Emacs and Mule in  
mind. The INSTALL file mentions several Emacs-oriented components to  
be found in /Library/TeX/Root/texmf-dist/source/latex/CJK/utils/lisp/  
and installed somewhere. I'm no Emacs user, so again I have to stop  
here. Carbon Emacs <http://homepage.mac.com/zenitani/emacs-e.html> has  
been developed in Japan; maybe it includes these facilities for Asian  
languages already.

Wait, wait: looking a last time, I'm seeing the following in /Library/ 

> In this directory you find some hbf2gf configuration files for  
> common CJK
> bitmap fonts.
> No paths are specified for the HBF files -- under web2c you should  
> add the
> path for these fonts to the `MISCFONTS' variable in texmf.cnf; under  
> emTeX
> you should set the environment variable `HBFONTS'.
> The font paths used here in the config files of this directory are TDS
> compliant; only the `HBF_TARGET' environment variable is used (an  
> example
> would be `set HBF_TARGET=/usr/local/TeX/texmf/fonts').

So it seems serious configuration work has to be done before the  
binary hbf2gf is able to create PK font files on the fly. Whether this  
work remains to be done, or is pre-done on TeXLive, remains to be  
found. There is indeed a MISCFONTS variable in /Library/TeX/Root/texmf/ 

> MISCFONTS = .;$TEXMF/fonts/misc//

And the directory /Library/TeX/Root/texmf-dist/fonts/misc/cns does  
indeed contain some hbf-related stuff, but I'm not sure it includes  
everything that's needed.

I'll have to stop here. Hope this helps though,

Bruno Voisin

More information about the MacOSX-TeX mailing list