[tex-live] MacOS X + CJK

John Tang Boyland boyland at cs.uwm.edu
Sun Jul 30 09:09:59 CEST 2006


Werner LEMBERG wrote:
] John Boyland wrote:
] > (2) Next I tried to use the main TeXLive distribution.
] >     I installed it (with sudo install-tl.sh) with all
] >     default options.  Then I sudo'd texconfig (rehash)
] >     just in case it still needed configuration.
] >
] >     But then when I run latex or pdflatex on a chinese CJK file,
] >     I get the output:
] > ....
] > (/usr/local/texlive/2005/texmf-dist/tex/latex/CJK/Bg5/Bg5.enc)
] > (/usr/local/texlive/2005/texmf-dist/tex/latex/CJK/Bg5/Bg5.chr)
] > (/usr/local/texlive/2005/texmf-dist/tex/latex/CJK/Bg5/c00song.fd)
] > (/usr/local/texlive/2005/texmf-dist/tex/latex/CJK/Bg5/c00kai.fd)
] >
] > LaTeX Font Warning: Font shape `C00/song/m/n'
] > (Font)              in size <17.28> not available.
] > (Font)              Font shape `C00/kai/m/n'
] > (Font)              tried instead on input line 9.
] >
] > kpathsea: Running mktextfm b5ka1207
] 
] Have a look into the file <texmf>/doc/latex/CJK/examples/README to see
] which fonts are available on the TeXLive CD.  You should try
] 
]   \CJK{Bg5}{bsmi}

OK.  I was using cjk-write-file which added 

\def\CJKhook{\CJKenc{GB}\CJKenc{Bg5}}\ifx\CJKpreproc\undefined\def\CJKpreproc{cjk-enc}\RequirePackage[global]{CJK}\AtBeginDocument{\begin{CJK}{}{}\CJKspace}\AtEndDocument{\end{CJK}}\else\CJKhook\fi

at the beginning of the file.  I tried putting in the \CJK command you
mentioned, but it still used ntukai48.  Maybe I put it in the wrong
place? Is ntukai48 some sort of default?  Fortunately, I was able to
find CJK-fonts.zip (which included ntukai48) in CTAN and installed
that.  Then once I copied ntukai48.{hbf,bin} into the current
directory, I got pdflatex to work.  (It seems strange that maketextfm
doesn't use kpathsea.)

I like using emacs for CJK things since it is able go display CJK
characters correctly, when (it seems) TeXShop doesn't know how.
Perhaps if I install cyberbit ?

In any case, I can use emacs and the AUCTeX hack in the CJK package for emacs:

(load-library "cjk-enc")

; using CJK with AUCTeX

  (defun TeX-run-CJK-LaTeX (name command file)
    "Create a process for NAME using COMMAND to format FILE with CJK/LaTeX."

; use next code line for Mule instead of the (balanced) expression
; containing `cjk-write-all-files'
; -- no multifile document support!
;   (cjk-write-file)

    (cjk-write-all-files (concat (TeX-master-directory)
                                 (file-name-nondirectory file)
                                 ".tex"))
    (TeX-run-LaTeX name command file))

  ;; replace the error source file `*.cjk' with `*.tex' (and `*-cjk.bib'
  ;; with `*.bib'), then C-c ` can be used as usual.

  (add-hook 'TeX-translate-location-hook
            '(lambda ()
               (if (string-match "\\(.*\\)\.cjk$" file)
                   (setq file
                         (concat
                           (substring file
                                      (match-beginning 1)
                                      (match-end 1))
                           ".tex"))
                 (if (string-match "\\(.*\\)-cjk\.bib$" file)
                     (setq file
                           (concat
                             (substring file
                                        (match-beginning 1)
                                        (match-end 1))
                             ".bib"))))))

  (require 'tex)
  (add-to-list 'TeX-command-list  
    '("CJKLaTeX" "%l '\\nonstopmode\\input{%s.cjk}'" TeX-run-CJK-LaTeX nil t))
  (add-to-list 'TeX-command-list  
    '("CJK" "pdf%l '\\nonstopmode\\input{%s.cjk}'" TeX-run-CJK-LaTeX nil t))

The last sexp is a little addition of mine to run pdflatex since it
seems dvi files are almost useless on a mac.  Almost certainly writing
"pdf%l" is just waiting to break when someone gives a path to the latex
processor.

Thanks for all the help.

John


More information about the tex-live mailing list