branch: externals/auctex commit d0908cb48082ff6e35496f41c97aee58e60bec7e Author: Ikumi Keita <ik...@ikumi.que.jp> Commit: Ikumi Keita <ik...@ikumi.que.jp>
Fix auto selection of japanese TeX engine * tex-jp.el (japanese-latex-mode-initialization): Use `LaTeX-match-class-option' to detect uplatex option given to jsarticle, jsreport and jsbook class. (The root of this problem is the same as Bug#25563) (): Quit appending to `LaTeX-command-style' because this made the user's intentional selection of `TeX-engine' ineffective with regard to the selection of the executable names. Fix copyright year. ; Add Ikumi Keita to maintainer of tex-jp.el. * doc/auctex.texi (Japanese): Add description of Japanese TeX engine: How to use, change and set the value of the engine. Add description of the customize options related to the encoding of Japanese TeX documents. --- doc/auctex.texi | 122 +++++++++++++++++++++++++++++++++++++++++++++++--------- tex-jp.el | 24 ++++------- 2 files changed, 110 insertions(+), 36 deletions(-) diff --git a/doc/auctex.texi b/doc/auctex.texi index 6410004..ebd8512 100644 --- a/doc/auctex.texi +++ b/doc/auctex.texi @@ -4547,29 +4547,94 @@ If nil do it the other way round. @cindex ASCII p@TeX{} @cindex p@TeX{} @cindex p@LaTeX{} +@cindex up@TeX{} +@cindex up@LaTeX{} @cindex @file{tex-jp.el} @vindex TeX-default-mode +@vindex TeX-parse-self +@vindex TeX-engine +@vindex TeX-engine-alist @vindex japanese-TeX-engine-default @vindex japanese-LaTeX-default-style - -To write Japanese text with @AUCTeX{}, you need to have versions of -@TeX{} and Emacs that support Japanese. There exist at least two -variants of @TeX{} for Japanese text (NTT j@TeX{} and ASCII p@TeX{}). -@AUCTeX{} can be used with @acronym{MULE, MULtilingual Enhancement to GNU -Emacs} supported Emacsen. - -To use the Japanese @TeX{} variants, simply activate -@code{japanese-plain-tex-mode} or @code{japanese-latex-mode} and -everything should work. If not, send mail to Masayuki Ataka -@samp{<ataka@@milk.freemail.ne.jp>}, who kindly donated the code for -supporting Japanese in @AUCTeX{}. None of the primary @AUCTeX{} +@vindex japanese-TeX-use-kanji-opt-flag +@vindex TeX-japanese-process-input-coding-system +@vindex TeX-japanese-process-output-coding-system + +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 j@TeX{}, ASCII p@TeX{} and +up@TeX{}. On XEmacs, @AUCTeX{} needs @acronym{MULE, MULtilingual +Enhancement to GNU Emacs} feature to deal with Japanese text. + +To use the Japanese @TeX{} engines, activate +@code{japanese-plain-tex-mode} or @code{japanese-latex-mode}. If it +doesn't work, send mail to Masayuki Ataka +@samp{<masayuki.ataka@@gmail.com>} or Ikumi Keita +@samp{<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 @code{TeX-parse-self} for typical Japanese +@LaTeX{} users. When enabled, @code{japanese-latex-mode} selects the +suitable Japanese @TeX{} engine automatically based on the class file +name (such as @code{jbook}, @code{jsarticle} and @code{tjreport}) and +its option. @pxref{Parsing Files} + +It is important to select the suitable Japanese @TeX{} engine because +the selected engine determines the command name such as @samp{platex} +and @samp{uptex} to typeset the document. If you find that wrong +command is used, check the value of @code{TeX-engine} on that buffer. +If the value does not suit the current document, change the value by the +@samp{TeXing Options} submenu below the @samp{Command} menu. +@pxref{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: + +@enumerate +@item +If you use a specific engine (almost) exclusively, customize the option +@code{japanese-TeX-engine-default}. + +@defopt japanese-TeX-engine-default +The default TeX engine in Japanese @TeX{} mode. + +The default value is @samp{ptex}. +@end defopt +@item +If you want to set the engine on a per file basis, use the file local +variables to set @code{TeX-engine}. + +Here is a sample code to set @code{TeX-engine} to @samp{uptex}: + +@example +%%% Local Variables: +%%% mode: japanese-latex +%%% TeX-engine: uptex +%%% End: +@end example +@end enumerate + +In the both cases above, the valid value is one of @samp{ptex}, +@samp{jtex} and @samp{uptex}. + +You can override the command names associated with the above three +engines or define your own engine by customizing +@code{TeX-engine-alist}. @xref{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 +@code{j-article} document class deliberately with ASCII p@LaTeX{}, +@AUCTeX{} selects NTT j@LaTeX{} command if @code{TeX-parse-self} is +enabled, because @code{j-article} originally belongs to NTT j@LaTeX{}. +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. @defopt TeX-default-mode -Mode to enter for a new file when it cannott be determined whether the +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, @@ -4579,18 +4644,37 @@ set the variable like this: @end lisp @end defopt -@defopt japanese-TeX-engine-default -The default TeX engine in Japanese @TeX{} mode. - -The default value is @samp{ptex}. -@end defopt - @defopt japanese-LaTeX-default-style The default style/class when creating a new Japanese @LaTeX{} document. The default value is @samp{"jarticle"}. @end defopt +It is recommended also for Japanese users to customize the option +@code{TeX-PDF-from-DVI} to @code{"Dvipdfmx"}. @xref{Processor Options} + +There are three customize options with regard to the encoding of +Japanese text. + +@defopt japanese-TeX-use-kanji-opt-flag +If non-nil, @AUCTeX{} adds @code{-kanji} option to the typesetting +command when @code{TeX-engine} is @samp{ptex}. +@end defopt + +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. + +@defopt TeX-japanese-process-input-coding-system +If non-nil, used for encoding input to Japanese @TeX{} process. +When @code{nil}, @AUCTeX{} tries to choose suitable coding system. +@end defopt + +@defopt TeX-japanese-process-output-coding-system +If non-nil, used for decoding output from Japanese @TeX{} process. +When @code{nil}, @AUCTeX{} tries to choose suitable coding system. +@end defopt + The former customize options @code{japanese-TeX-command-default} and @code{japanese-LaTeX-command-default} are obsolete. Use @code{japanese-TeX-engine-default} instead. If you need to customize diff --git a/tex-jp.el b/tex-jp.el index a42cbe8..6cabd2f 100644 --- a/tex-jp.el +++ b/tex-jp.el @@ -1,10 +1,12 @@ ;;; tex-jp.el --- Support for Japanese TeX. -*- coding: iso-2022-jp-unix; -*- -;; Copyright (C) 1999, 2001-2007, 2012, 2016 Free Software Foundation, Inc. +;; Copyright (C) 1999, 2001-2008, 2012-2013, 2016-2017 +;; Free Software Foundation, Inc. ;; Author: KOBAYASHI Shinji <k...@flab.fujitsu.co.jp>, ;; Hidenobu Nabetani <n...@debian.or.jp> ;; Maintainer: Masayuki Ataka <masayuki.at...@gmail.com> +;; Ikumi Keita <ikumike...@jcom.home.ne.jp> ;; Keywords: tex ;; This file is part of AUCTeX. @@ -261,16 +263,6 @@ For detail, see `TeX-command-list', to which this list is appended." "jlatex" '("/jtex/" "/jbibtex/bst/")) '("/usr/share/texmf/jtex/" "/usr/share/texmf/jbibtex/bst/"))) -;; $B=gD4$K9T$1$PITMW$K$J$k!#(B -(setq LaTeX-command-style - (append '(("\\`u[jt]\\(article\\|report\\|book\\)\\'\\|\\`uplatex\\'" - "%(PDF)uplatex %S%(PDFout)") - ("\\`[jt]s?\\(article\\|report\\|book\\)\\'" - "%(PDF)platex %(kanjiopt)%S%(PDFout)") - ("\\`j-\\(article\\|report\\|book\\)\\'" - "%(PDF)jlatex %S%(PDFout)")) - LaTeX-command-style)) - (defcustom japanese-TeX-error-messages t "*If non-nil, explain TeX error messages in Japanese." :group 'AUCTeX-jp @@ -325,7 +317,7 @@ See also a user custom option `TeX-japanese-process-input-coding-system'." ;; for upLaTeX ("ujarticle") ("ujreport") ("ujbook") ("utarticle") ("utreport") ("utbook")) - "*List of Japanese document styles." + "*List of Japanese document classes." :group 'AUCTeX-jp :type '(repeat (group (string :format "%v")))) @@ -524,14 +516,12 @@ Set `japanese-TeX-mode' to t, and enter `TeX-latex-mode'." (when japanese-TeX-mode ; (setq TeX-command-default japanese-LaTeX-command-default) (TeX-engine-set - ;; class file $BL>$KMj$k$N$O@5$7$$$N$+!)(B - ;; jLaTeX $B$K$b(B jarticle $B$O0l1~$"$k$7!"(BpLaTeX $B$G$b<+J,$G(B j-article $B$r(B - ;; $B%$%s%9%H!<%k$7$F;H$C$F$$$1$J$$K!$O$J$$!#(B (cond - ((TeX-match-style "\\`u[jt]\\(article\\|report\\|book\\)\\'\\|\\`uplatex\\'") + ((TeX-match-style "\\`u[jt]\\(article\\|report\\|book\\)\\'") 'uptex) ((TeX-match-style "\\`[jt]s?\\(article\\|report\\|book\\)\\'") - 'ptex) + (if (LaTeX-match-class-option "\\`uplatex\\'") + 'uptex 'ptex)) ((TeX-match-style "\\`j-\\(article\\|report\\|book\\)\\'") 'jtex) (t japanese-TeX-engine-default)))