#author("2017-05-10T05:32:20+09:00","default:hoge","hoge")
#author("2017-06-08T04:35:05+09:00","default:hoge","hoge")
[[Emacs]] > AUCTeX

AUCTeX is an extensible package for writing and formatting TeX files in GNU Emacs and XEmacs.
It supports many different TeX macro packages, including AMS-TeX, LaTeX, Texinfo, ConTeXt, and docTeX (dtx files). 

Emacs 用の TeX, LaTeX, ConTeXt 入力支援環境.&br;
コマンド補完などの機能を持つ.&br;

-[[AUCTeX - Sophisticated document creation:https://www.gnu.org/software/auctex/]]
-[[TwitterSearch:AUCTeX]]
-[[TwitterSearch.ja:AUCTeX]]
-[[EmacsWiki:AUCTeX]]
-[[TeXWiki:AUCTeX]]
-[https://mano.xyz/post/2016-09-05-win10-texlive-emacs-auctex-sumatra/ Windows 10 で TeXLive + Emacs + AUCTeX + SumatraPDF の快適 TeX 環境を構築する]
-[https://twitter.com/tnoda_/status/619442000748658688 Emacs/AUCTeX/Skim で Mac OS X 上に今風な TeX 執筆環境をつくった]
-[https://ryogan.org/blog/2015/12/30/mac-os-x-el-capitan-%E3%81%AE-auctex-%E3%81%AE%E8%A8%AD%E5%AE%9A/ Mac OS X El Capitan の AUCTeX の設定]
-https://tex.stackexchange.com/questions/316787/getting-synctex-to-work-with-emacs-auctex-and-skim-os-x-el-capitan

----
#contents
----

**Download [#u289cce3]

latest

-http://git.savannah.gnu.org/cgit/auctex.git/snapshot/master.zip
-http://git.savannah.gnu.org/cgit/auctex.git/snapshot/master.tar.gz
-http://git.savannah.gnu.org/cgit/auctex.git/snapshot/master.tar.bz2
-http://git.savannah.gnu.org/cgit/auctex.git/snapshot/master.tar.xz

mirror

-http://ftpmirror.gnu.org/auctex/
-http://www.ctan.org/tex-archive/support/auctex/

**Installing AUCTeX [#o8e525fa]

***Emacs package manager [#a36d3009]

-[[GNU ELPA - auctex:https://elpa.gnu.org/packages/auctex.html]]

 M-x package-install RET auctex RET

あるいは

 M-x list-packages RET でリストを表示して auctex を選択

***Build AUCTeX [#qcd11f70]

-[http://at-aka.blogspot.jp/2016/09/auctex-mac.html 最新 AUCTeX を Mac でコンパイルする]

**Repository [#b86230a7]

GNU AUCTeX

-http://git.savannah.gnu.org/cgit/auctex.git/
-http://git.savannah.gnu.org/gitweb/?p=auctex.git

ELPA

-http://git.savannah.gnu.org/cgit/emacs/elpa.git/?h=externals/auctex
-http://git.savannah.gnu.org/gitweb/?p=emacs/elpa.git;a=tree;hb=refs/heads/externals/auctex

**Changelog [#if93ec30]

AUCTeX manual

-https://www.gnu.org/software/auctex/manual/auctex.html#Changes
-https://www.gnu.org/software/auctex/manual/auctex.html#Changes-and-New-Features

GNU AUCTeX

-http://git.savannah.gnu.org/cgit/auctex.git/log/
-http://git.savannah.gnu.org/gitweb/?p=auctex.git;a=shortlog
-http://git.savannah.gnu.org/gitweb/?p=auctex.git;a=log

ELPA

-http://git.savannah.gnu.org/cgit/emacs/elpa.git/log/?h=externals/auctex
-http://git.savannah.gnu.org/gitweb/?p=emacs/elpa.git;a=shortlog;h=refs/heads/externals/auctex
-http://git.savannah.gnu.org/gitweb/?p=emacs/elpa.git;a=log;h=refs/heads/externals/auctex

**Issues [#ma2cd615]

-http://lists.gnu.org/archive/html/bug-auctex/
-http://www.mail-archive.com/bug-auctex@gnu.org/

**Settings for Windows [#if27a403]

 ;;
 ;; AUCTeX
 ;;
 (with-eval-after-load 'tex-jp
   (setq TeX-engine-alist '((pdfuptex "pdfupTeX"
                                      "ptex2pdf -u -e -ot \"-kanji=utf8 -no-guess-input-enc %S %(mode)\""
                                      "ptex2pdf -u -l -ot \"-kanji=utf8 -no-guess-input-enc %S %(mode)\""
                                      "euptex")))
   (setq japanese-TeX-engine-default 'luatex)
   ;(setq japanese-TeX-engine-default 'xetex)
   ;(setq japanese-TeX-engine-default 'pdfuptex)
   (setq TeX-view-program-list '(("SumatraPDF"
                                  "powershell -Command \"& {$r = Write-Output %o;$t = Write-Output %b;$o = [System.String]::Concat('\"\"\"',[System.IO.Path]::GetFileNameWithoutExtension($r),'.pdf','\"\"\"');$b = [System.String]::Concat('\"\"\"',[System.IO.Path]::GetFileNameWithoutExtension($t),'.tex','\"\"\"');Start-Process SumatraPDF -ArgumentList ('-reuse-instance',$o,'-forward-search',$b,%n)}\"")))
   (setq TeX-view-program-selection '((output-dvi "SumatraPDF")
                                      (output-pdf "SumatraPDF")))
   (setq japanese-LaTeX-default-style "bxjsarticle")
   ;(setq japanese-LaTeX-default-style "ltjsarticle")
   ;(setq japanese-LaTeX-default-style "jlreq")
   (dolist (command '("pTeX" "pLaTeX" "pBibTeX" "jTeX" "jLaTeX" "jBibTeX" "Mendex"))
     (delq (assoc command TeX-command-list) TeX-command-list)))
 (setq preview-image-type 'dvipng)
 (setq TeX-source-correlate-method
       '((dvi . synctex)
         (pdf . synctex)))
 (setq TeX-source-correlate-start-server t)
 (add-hook 'LaTeX-mode-hook 'TeX-source-correlate-mode)
 (add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
 (add-hook 'LaTeX-mode-hook
           (function (lambda ()
                       (add-to-list 'TeX-command-list
                                    '("Latexmk"
                                      "latexmk %t"
                                      TeX-run-TeX nil (latex-mode) :help "Run Latexmk"))
                       (add-to-list 'TeX-command-list
                                    '("Latexmk-LuaLaTeX"
                                      "latexmk -e \"$lualatex=q/lualatex -cmdx %%O %S %(mode) %%S/\" -e \"$bibtex=q/upbibtex %%O %%B/\" -e \"$biber=q/biber %%O --bblencoding=utf8 -u -U --output_safechars %%B/\" -e \"$makeindex=q/upmendex %%O -o %%D %%S/\" -norc -gg -pdflua %t"
                                      TeX-run-TeX nil (latex-mode) :help "Run Latexmk-LuaLaTeX"))
                       (add-to-list 'TeX-command-list
                                    '("Latexmk-LuajitLaTeX"
                                      "latexmk -e \"$lualatex=q/luajitlatex -cmdx %%O %S %(mode) %%S/\" -e \"$bibtex=q/upbibtex %%O %%B/\" -e \"$biber=q/biber %%O --bblencoding=utf8 -u -U --output_safechars %%B/\" -e \"$makeindex=q/upmendex %%O -o %%D %%S/\" -norc -gg -pdflua %t"
                                      TeX-run-TeX nil (latex-mode) :help "Run Latexmk-LuajitLaTeX"))
                       (add-to-list 'TeX-command-list
                                    '("Latexmk-XeLaTeX"
                                      "latexmk -e \"$xelatex=q/xelatex %%O %S %(mode) %%S/\" -e \"$bibtex=q/upbibtex %%O %%B/\" -e \"$biber=q/biber %%O --bblencoding=utf8 -u -U --output_safechars %%B/\" -e \"$makeindex=q/upmendex %%O -o %%D %%S/\" -norc -gg -pdfxe %t"
                                      TeX-run-TeX nil (latex-mode) :help "Run Latexmk-XeLaTeX"))
                       (add-to-list 'TeX-command-list
                                    '("Latexmk-pdfLaTeX"
                                      "latexmk -e \"$pdflatex=q/pdflatex %%O %S %(mode) %%S/\" -e \"$bibtex=q/bibtex %%O %%B/\" -e \"$biber=q/biber %%O --bblencoding=utf8 -u -U --output_safechars %%B/\" -e \"$makeindex=q/makeindex %%O -o %%D %%S/\" -norc -gg -pdf %t"
                                      TeX-run-TeX nil (latex-mode) :help "Run Latexmk-pdfLaTeX"))
                       (add-to-list 'TeX-command-list
                                    '("Latexmk-upLaTeX-pdfdvi"
                                      "latexmk -e \"$latex=q/uplatex %%O -kanji=utf8 -no-guess-input-enc %S %(mode) %%S/\" -e \"$bibtex=q/upbibtex %%O %%B/\" -e \"$biber=q/biber %%O --bblencoding=utf8 -u -U --output_safechars %%B/\" -e \"$makeindex=q/upmendex %%O -o %%D %%S/\" -e \"$dvipdf=q/dvipdfmx %%O -o %%D %%S/\" -norc -gg -pdfdvi %t"
                                      TeX-run-TeX nil (latex-mode) :help "Run Latexmk-upLaTeX-pdfdvi"))
                       (add-to-list 'TeX-command-list
                                    '("Latexmk-upLaTeX-pdfps"
                                      "latexmk -e \"$latex=q/uplatex %%O -kanji=utf8 -no-guess-input-enc %S %(mode) %%S/\" -e \"$bibtex=q/upbibtex %%O %%B/\" -e \"$biber=q/biber %%O --bblencoding=utf8 -u -U --output_safechars %%B/\" -e \"$makeindex=q/upmendex %%O -o %%D %%S/\" -e \"$dvips=q/dvips %%O -z -f %%S | convbkmk -u > %%D/\" -e \"$ps2pdf=q/ps2pdf.exe %%O %%S %%D/\" -norc -gg -pdfps %t"
                                      TeX-run-TeX nil (latex-mode) :help "Run Latexmk-upLaTeX-pdfps"))
                       (add-to-list 'TeX-command-list
                                    '("SumatraPDF"
                                      "powershell -Command \"& {$r = Write-Output %o;$t = Write-Output %b;$o = [System.String]::Concat('\"\"\"',[System.IO.Path]::GetFileNameWithoutExtension($r),'.pdf','\"\"\"');$b = [System.String]::Concat('\"\"\"',[System.IO.Path]::GetFileNameWithoutExtension($t),'.tex','\"\"\"');Start-Process SumatraPDF -ArgumentList ('-reuse-instance',$o,'-forward-search',$b,%n)}\""
                                      TeX-run-discard-or-function t t :help "Forward search with SumatraPDF"))
                       (add-to-list 'TeX-command-list
                                    '("fwdsumatrapdf"
                                      "fwdsumatrapdf %s.pdf \"%b\" %n"
                                      TeX-run-discard-or-function t t :help "Forward search with SumatraPDF"))
                       (add-to-list 'TeX-command-list
                                    '("TeXworks"
                                      "synctex view -i \"%n:0:%b\" -o %s.pdf -x \"texworks --position=%%{page+1} %%{output}\""
                                      TeX-run-discard-or-function t t :help "Run TeXworks"))
                       (add-to-list 'TeX-command-list
                                    '("TeXstudio"
                                      "synctex view -i \"%n:0:%b\" -o %s.pdf -x \"texstudio --pdf-viewer-only --page %%{page+1} %%{output}\""
                                      TeX-run-discard-or-function t t :help "Run TeXstudio"))
                       (add-to-list 'TeX-command-list
                                    '("Firefox"
                                      "powershell -Command \"& {$r = Write-Output %o;$o = [System.String]::Concat('\"\"\"',[System.IO.Path]::GetFileNameWithoutExtension($r),'.pdf','\"\"\"');Start-Process firefox -ArgumentList ('-new-window',$o)}\""
                                      TeX-run-discard-or-function t t :help "Run Mozilla Firefox"))
                       (add-to-list 'TeX-command-list
                                    '("Chrome"
                                      "powershell -Command \"& {$r = Write-Output %s.pdf;$o = [System.String]::Concat('\"\"\"',[System.IO.Path]::GetFullPath($r),'\"\"\"');Start-Process chrome -ArgumentList ('--new-window',$o)}\""
                                      TeX-run-discard-or-function t t :help "Run Chrome PDF Viewer"))
                       (add-to-list 'TeX-command-list
                                    '("pdfopen"
                                      "tasklist /fi \"IMAGENAME eq AcroRd32.exe\" /nh | findstr \"AcroRd32.exe\" > nul && pdfopen --r15 --file %s.pdf && pdfclose --r15 --file %s.pdf & synctex view -i \"%n:0:%b\" -o %s.pdf -x \"pdfopen --r15 --file %%{output} --page %%{page+1}\""
                                      TeX-run-discard-or-function t t :help "Run Adobe Acrobat Reader DC")))))
 
 ;;
 ;; RefTeX with AUCTeX
 ;;
 (add-hook 'LaTeX-mode-hook 'turn-on-reftex)
 (setq reftex-plug-into-AUCTeX t)