5.4.2 Using AUCTeX with Japanese TeX
To write Japanese text with AUCTeX, you need the versions of TeX and Emacs that support Japanese. AUCTeX supports three Japanese TeX engines by default: NTT jTeX, ASCII pTeX and upTeX.
To use the Japanese TeX engines, activate japanese-plain-tex-mode
or japanese-latex-mode
. If it doesnβt work, send mail to Masayuki Ataka β<masayuki.ataka@gmail.com>
β or Ikumi Keita β<ikumikeita@jcom.home.ne.jp>
β, who currently concern with stuff related to Japanese in AUCTeX. None of the primary AUCTeX maintainers understand Japanese, so they cannot help you.
It is recommended to enable TeX-parse-self
for typical Japanese LaTeX users. When enabled, japanese-latex-mode
selects the suitable Japanese TeX engine automatically based on the class file name (such as jbook
, jsarticle
and tjreport
) and its option. see Parsing Files.
It is important to select the suitable Japanese TeX engine because the selected engine determines the command name such as βplatex
β and βuptex
β to typeset the document. If you find that wrong command is used, check the value of TeX-engine
on that buffer. If the value does not suit the current document, change the value by the βTeXing Options
β submenu below the βCommand
β menu. see Processor Options.
To make the selected engine to persist across Emacs sessions, there are two ways from which you can choose one according to your needs:
If you use a specific engine (almost) exclusively, customize the option
japanese-TeX-engine-default
.user option
japanese-TeX-engine-defaultβThe default TeX engine in Japanese TeX mode.
The default value is β
ptex
β.If you want to set the engine on a per file basis, use the file local variables to set
TeX-engine
.Here is a sample code to set
TeX-engine
to βuptex
β:%%% Local Variables: %%% mode: japanese-latex %%% TeX-engine: uptex %%% End:
In the both cases above, the valid value is one of βptex
β, βjtex
β and βuptex
β.
You can override the command names associated with the above three engines or define your own engine by customizing TeX-engine-alist
. See Processor Options.
It is sometimes necessary to use an engine which differs from the one AUCTeX selects automatically. For example, even when you want to use j-article
document class deliberately with ASCII pLaTeX, AUCTeX selects NTT jLaTeX command if TeX-parse-self
is enabled, because j-article
originally belongs to NTT jLaTeX. In such cases, use the file local variable method above to select the engine you intend to use.
If you usually use AUCTeX in Japanese, setting the following variables is useful.
user option
TeX-default-modeβ
Mode to enter for a new file when it cannot be determined whether the file is plain TeX or LaTeX or what.
If you want to enter Japanese LaTeX mode whenever this may happen, set the variable like this:
(setq TeX-default-mode 'japanese-latex-mode)
user option
japanese-LaTeX-default-styleβ
The default style/class when creating a new Japanese LaTeX document.
The default value is β"jarticle"
β.
It is recommended also for Japanese users to customize the option TeX-PDF-from-DVI
to "Dvipdfmx"
. See Processor Options
There are three customize options with regard to the encoding of Japanese text.
user option
japanese-TeX-use-kanji-opt-flagβ
If non-nil, AUCTeX adds -kanji
option to the typesetting command when TeX-engine
is βptex
β.
Usually AUCTeX guesses the right coding systems for input to and output from the Japanese TeX process, but you can override them by the following two customize options.
user option
TeX-japanese-process-input-coding-systemβ
If non-nil, used for encoding input to Japanese TeX process. When nil
, AUCTeX tries to choose suitable coding system.
user option
TeX-japanese-process-output-coding-systemβ
If non-nil, used for decoding output from Japanese TeX process. When nil
, AUCTeX tries to choose suitable coding system.
The former customize options japanese-TeX-command-default
, japanese-LaTeX-command-default
and japanese-TeX-command-list
are removed from AUCTeX. Use japanese-TeX-engine-default
instead. If you need to customize the executable file name such as β"latex"
β, the options for them, or both, customize TeX-engine-alist
.
The following two additional font commands are available in LaTeX mode buffer.
C-c C-f g
β
Insert gothic face font command β\textgt{β}
β or β\mathgt{β}
β depending on the context.
C-c C-f m
β
Insert mincho font command β\textmc{β}
β or β\mathmc{β}
β depending on the context.
Although they are meaningful only with βptex
β and βuptex
β engines, it wonβt matter in buffers with other engines.
See βtex-jp.el
β for more information.