For the up-to-date XHTML version of this web page, go here. This is a legacy HTML 4 version.
Mark Alford. Last updated: 2004-Aug-27
Chinese, Japanese, and Korean language support is available in LaTeX via the CJK package. These are the steps that I followed to get Japanese. They work for CJK-4.5.2 (2004-04-29 version) under Fedora Core 2 and Fedora Core 1, and they worked previously for CJK-4.4.0 (Apr 2001) under RedHat 6.2, 7.x, 8.0.
I did everything as root, because I was adding CJK as a system-wide component, although I put it in a separate tree, /usr/local/share/texmf/, so that it is not mixed up with teTeX and does not get clobbered when teTeX is upgraded. But if the sysadmin has set up the TeX search paths correctly (see below) you should be able to install CJK for your personal use by putting everything in $HOME/texmf/ and $HOME/bin/, without being root.
----
TEXMFLOCAL = /usr/local/share/texmf
HOMETEXMF = $HOME/texmf % optional
TEXMF = {$HOMETEXMF,!!$TEXMFLOCAL,!!$TEXMFMAIN}
----
> cp -r ~/cjk-current/texinput /usr/local/share/texmf/tex/latex/CJK
> cd ~/cjk-current/utils/hbf2gf
> ./configure --prefix=/usr/local/ \
--with-kpathsea-include=/usr/include \
--with-kpathsea-lib=/usr/lib
> make
> make install
The with-kpathsea-include dir
is wherever kpathsea/kpathsea.h
lives, and the with-kpathsea-lib dir is
wherever libkpathsea.a lives.
> cd /usr/local/share/ > cp ~/CJK_fonts/kanji48.tar.gz . > tar -zxf kanji48.tar.gz > rm kanji48.tar.gzSince kanji48.tar.gz contains the files in the proper directory structure, it is sufficient to unpack it in a dir that contains the target texmf dir.
---- MISCFONTS = .;$TEXMF/fonts/misc//;$TEXMF/fonts/hbf// ----For non-root installation it may be possible to set this as an environment variable (see ~/cjk-current/doc/INSTALL and man hbf2gf). You can tell what kpathsea is doing by looking at debugging output obtained by setenv KPATHSEA_DEBUG -1. I expected to have to add a new variable, HBF2GFINPUTS = $TEXMF/hbf2gf// to texmf.cnf, which tells it where to find .cfg files, but it works fine without it.
> mktexlsr # (same as "texhash")
> latex japanese_template.cjk This is TeX, Version 3.14159 (Web2C 7.4.5) (./japanese_template.cjk LaTeX2e <2001/06/01> BabelYou should see Japanese!and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (/usr/local/share/texmf/tex/latex/CJK/CJK.sty (/usr/local/share/texmf/tex/latex/CJK/mule/MULEenc.sty) (/usr/local/share/texmf/tex/latex/CJK/CJK.enc)) (/usr/share/texmf/tex/latex/base/article.cls Document Class: article 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size12.clo)) (/usr/local/share/texmf/tex/latex/CJK/ruby.sty) (./japanese_template.aux) (/usr/local/share/texmf/tex/latex/CJK/standard.bdg) (/usr/local/share/texmf/tex/latex/CJK/standard.enc) (/usr/local/share/texmf/tex/latex/CJK/standard.chr) (/usr/local/share/texmf/tex/latex/CJK/JIS/c40song.fd) [1] (./japanese_template.aux) ) Output written on japanese_template.dvi (1 page, 632 bytes). Transcript written on japanese_template.log. > xdvi japanese_template
> rpm -qi emacs-leimIf necessary, download the rpm file (eg from rpmfind) and install it.
> cd ~/cjk-current/utils/lisp > cp cjktilde.el /usr/local/share/emacs/site-lisp/ > cp emacs-20.3/cjk-enc.el /usr/local/share/emacs/site-lisp/
---- (setq load-path (cons "/usr/local/share/emacs/site-lisp" load-path)) (load-library "cjk-enc") (global-set-key "\C-c\C-w" 'cjk-write-file) ; CTRL C CTRL W writes CJK file ----
----
%-*- coding: emacs-mule -*-
\documentclass[12pt]{article}
\usepackage[overlap, CJK]{ruby}
\CJKencfamily{JIS}{song}
\renewcommand{\rubysep}{-0.3ex}
\begin{document}
Insert English and Japanese text here.
\end{document}
----
Note that we specify the coding in a TeX comment on the first line.
(Alternatively, this can be done by
explicit commands to emacs.)
Possible codings include emacs-mule, japanese-euc, japanese-shift-jis, and
probably others. When you load the file into emacs, it will automatically
detect the coding and display the characters correctly.
(Options ->) mule -> select input methodAnd then select japanese. After that, you can toggle back and forth between english and japanese input methods with (Options ->) mule -> toggle input method or CTRL-\.
> latex file.cjk # [NOT file.tex!]Then you can use xdvi, dvips, etc to view and print it.
Please sent comments, corrections, improvements to alford(at)wuphys.wustl.edu. Thanks to those who have done so, including Paul Wyatt of Toshiba.
revalidate