- 追加された行はこの色です。
- 削除された行はこの色です。
[[Emacs]] > YaTeX
*[[YaTeX:https://www.yatex.org/]] → Windows の Emacs で C-c ' を入力してもエラー行にジャンプしないなどの問題が発生する場合は [[Org mode>Emacs/Org mode]] または [[TeX mode>Emacs/TeX mode]] または [[AUCTeX]] を使用する [#o2c95a66]
#ref(https://www.yatex.org/yalogo.gif,right,around,nolink,YaTeX)
&color(White,#5F2F2F){ ''◆CONTENTS◆'' };&br;
#contents
#img(,clear)
*YaTeX とは [#q88fd71b]
YaTeX(野鳥)は Emacs の TeX モードです.
-[[YaTeX (Yet Another TeX mode for Emacs):https://www.yatex.org/]] (公式ページ)
--[[『野鳥』クイックリファレンス:https://www.yatex.org/yatexref.txt]]
--[[Yet Another tex-mode for Emacs - Table of Contents:https://www.yatex.org/info/yatexj_toc.html]]
**リリース情報 [#w889e1b2]
[[yatex: tags:https://www.yatex.org/hgrepos/hgweb.cgi/yatex/tags]] を参照.~
Emacs 24.3 以降を使用している場合は YaTeX 1.77 以降を使用してください.~
Emacs 24.4 以降を使用している場合は YaTeX 1.78 以降を使用してください.~
**[[ChangeLog:https://www.yatex.org/yatex-new.txt]] [#n0cf386c]
-[[YaTeX Mercurial Repositories:https://www.yatex.org/hgrepos/hgweb.cgi/yatex/]]
--[[コミットログ:https://www.yatex.org/hgrepos/hgweb.cgi/yatex/shortlog/]]
--[[変更点:https://www.yatex.org/hgrepos/hgweb.cgi/yatex/file/tip/yatex.new]]
--[[What's new in Japanese:https://www.yatex.org/yatex-new.txt]]
-https://github.com/emacsmirror/yatex
--[[コミットログ:https://github.com/emacsmirror/yatex/commits/]]
-http://twilog.org/hiroseyuuji/search?word=YaTeX
-http://twilog.org/ryseto/search?word=YaTeX
**スクリーンショット [#c84d00bd]
//#ref(http://oku.edu.mie-u.ac.jp/tex/file.php/2/moddata/forum/2/1712/LaTeXMathPreviewScreenshot.png,nolink,latex-math-preview.el)
#ref(http://www.emacswiki.org/pics/static/LaTeXMathPreviewScreenshot.png,nolink,latex-math-preview.el)
*注意点 [#x8b18a1c]
**" を入力しようとすると `` が入力される → C-q " [#ibf10abb]
-[[Emacs + YaTeX でダブルクォーテーションを入力:http://tetu1984.hateblo.jp/entry/20090123/1232651566]]
YaTeX, TeX mode, AUCTeX では " を入力しようとすると `` が入力されます.~
`` ではなく " を入力したい場合は C-q " (Ctrl-Q を入力した後で " を入力) とします.~
*不具合 [#m12f4e1b]
**YaTeX 1.77.7 で C-c C-g を入力して SumatraPDF で forward search をしようとすると Not enough arguments for format string と表示されて forward search ができない → yatexprc.el を修正する [#vf49c2d2]
//**YaTeX 1.77.7 で C-c C-g を入力して SumatraPDF で forward search をしようとすると Not enough arguments for format string と表示されて forward search ができない → yatexprc.el を修正する [#vf49c2d2]
//
//YaTeX 1.77.7 で C-c C-g を入力して SumatraPDF で forward search をしようとすると Not enough arguments for format string と表示されて forward search ができません.~
//yatexprc.el を修正します.~
//yatexprc.el の
// ((string-match "sumatra" previewer) ;;??
//の次の行の
// (format "%s \"%s.pdf\" -forward-search \"%s\" %d %s"
//を以下のように修正します.~
// (format "%s \"%s.pdf\" -forward-search \"%s\" %d"
//
//**YaTeX 1.77.7 で C-c C-g を入力して qpdfview で forward search をしようとすると Could not match file type of '#src:hoge.tex:行番号:0' ! と表示されて forward search ができない → yatexprc.el を修正する [#ka79bca3]
//
//YaTeX 1.77.7 で C-c C-g を入力して qpdfview で forward search をしようとすると Could not match file type of '#src:hoge.tex:行番号:0' ! と表示されて forward search ができません.~
//yatexprc.el を修正します.~
//yatexprc.el の
// ((string-match "qpdfview" previewer) ;;??
//の次の行の
// (format "%s '%s.pdf' '#src:%s:%d:0'"
//を以下のように修正します.~
// (format "%s '%s.pdf#src:%s:%d:0'"
//
//**YaTeX 1.77.7 で C-c C-g を入力して Okular で forward search をしようとすると forward search ができない → yatexprc.el を修正する [#l5f1c74e]
//
//YaTeX 1.77.7 で C-c C-g を入力して Okular で forward search をしようとすると forward search ができません.~
//yatexprc.el を修正します.~
//yatexprc.el の
// ((string-match "okular" previewer) ;;?
//の次の行の
// (format "%s '%s.pdf' '#src:%d' '%s'"
// previewer bnr line cf)))))
//を以下のように修正します.~
// (format "%s '%s.pdf#src:%d %s/%s'"
// previewer bnr line pdir cf)))))
YaTeX 1.77.7 で C-c C-g を入力して SumatraPDF で forward search をしようとすると Not enough arguments for format string と表示されて forward search ができません.~
yatexprc.el を修正します.~
yatexprc.el の
((string-match "sumatra" previewer) ;;??
の次の行の
(format "%s \"%s.pdf\" -forward-search \"%s\" %d %s"
を以下のように修正します.~
(format "%s \"%s.pdf\" -forward-search \"%s\" %d"
**YaTeX 1.78, 1.77, 1.76 で Windows の Emacs で C-c ' を入力してもエラー行にジャンプしない → [[AUCTeX]] を使用する [#w3a7f06f]
**YaTeX 1.77.7 で C-c C-g を入力して qpdfview で forward search をしようとすると Could not match file type of '#src:hoge.tex:行番号:0' ! と表示されて forward search ができない → yatexprc.el を修正する [#ka79bca3]
YaTeX 1.77.7 で C-c C-g を入力して qpdfview で forward search をしようとすると Could not match file type of '#src:hoge.tex:行番号:0' ! と表示されて forward search ができません.~
yatexprc.el を修正します.~
yatexprc.el の
((string-match "qpdfview" previewer) ;;??
の次の行の
(format "%s '%s.pdf' '#src:%s:%d:0'"
を以下のように修正します.~
(format "%s '%s.pdf#src:%s:%d:0'"
**YaTeX 1.77.7 で C-c C-g を入力して Okular で forward search をしようとすると forward search ができない → yatexprc.el を修正する [#l5f1c74e]
YaTeX 1.77.7 で C-c C-g を入力して Okular で forward search をしようとすると forward search ができません.~
yatexprc.el を修正します.~
yatexprc.el の
((string-match "okular" previewer) ;;?
の次の行の
(format "%s '%s.pdf' '#src:%d' '%s'"
previewer bnr line cf)))))
を以下のように修正します.~
(format "%s '%s.pdf#src:%d %s/%s'"
previewer bnr line pdir cf)))))
**YaTeX 1.77, 1.76 で Windows の Emacs で C-c ' を入力してもエラー行にジャンプしない → [[AUCTeX]] を使用する [#w3a7f06f]
YaTeX 1.77, 1.76 で Windows の Emacs で C-c ' を入力してもエラー行にジャンプしません.~
YaTeX 1.78, 1.77, 1.76 で Windows の Emacs で C-c ' を入力してもエラー行にジャンプしません.~
Linux の Emacs や YaTeX 1.75, 1.74 では C-c ' を入力するとエラー行にジャンプします.~
エラー行にジャンプしたい場合は [[AUCTeX]] を使用してください.~
どうしても YaTeX でエラー行にジャンプしたい場合は
~/.emacs.d/init.el に
(if (eq system-type 'windows-nt)
(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c ptex2pdf -u -l -ot \"-kanji=utf8 -no-guess-input-enc -synctex=1\"")
(setq tex-command "ptex2pdf -u -l -ot \"-synctex=1\""))
を設定して texmf.cnf に
TEXEDIT = emacsclientw --no-wait +%d "%s"
を設定 (emacsclientw.exe の存在するディレクトリに PATH を設定していない場合はフルパスで指定) して Emacs を起動して
M-x server-start
を実行します.~
タイプセットしてエラーが発生したときに e を入力して Enter を押すとエラー行にジャンプできます.~
*ダウンロード [#g0fb682c]
-[[YaTeX リリース版:https://www.yatex.org/]]
-[[YaTeX テスト版:http://www.gentei.org/~yuuji/bin/yatexcurrent.cgi]]
*インストール [#b2ec65b9]
**Windows [#n699538a]
64-bit Windows の場合は~
[[NTEmacs64:https://github.com/chuntaro/NTEmacs64]] または [[emacs-w64:http://emacsbinw64.sourceforge.net/]]~
32-bit Windows の場合は~
[[NTEmacs:http://cha.la.coocan.jp/doc/NTEmacs.html]] または [[emacs-24.4-bin-i686-pc-mingw32.zip:http://ftp.gnu.org/gnu/emacs/windows/]]~
をインストールします.~
[[YaTeX リリース版:https://www.yatex.org/]] または [[YaTeX テスト版:http://www.gentei.org/~yuuji/bin/yatexcurrent.cgi]] をダウンロードして展開します.~
展開したフォルダー名を yatex に変更します.~
Emacs を起動して
C-x C-f ~/
で,ホームディレクトリ (~/) の場所を確認します.~
yatex フォルダーをコピーして ~/.emacs.d/site-lisp/ にペーストします.(~/.emacs.d/site-lisp/ が無ければ新規に作成します.)
----
~
└─.emacs.d
└─site-lisp
└─yatex
----
***設定 [#edc51324]
~/.emacs.d/init.el に設定を記述します.~
プレビューと forward search は [[SumatraPDF]] を使用します.~
SumatraPDF を前面に表示したくない場合は [[SumatraPDF/fwdsumatrapdf]] の fwdsumatrapdf.exe を使用します.~
SumatraPDF の inverse search については [[Emacs#SumatraPDF との連携#inverse search>Emacs#a06810d6]] を参照してください.~
----
;;
;; YaTeX
;;
(add-to-list 'load-path "~/.emacs.d/site-lisp/yatex")
(autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t)
(setq auto-mode-alist
(append '(("\\.tex$" . yatex-mode)
("\\.ltx$" . yatex-mode)
("\\.cls$" . yatex-mode)
("\\.sty$" . yatex-mode)
("\\.clo$" . yatex-mode)
("\\.bbl$" . yatex-mode)) auto-mode-alist))
(setq YaTeX-inhibit-prefix-letter t)
(setq YaTeX-kanji-code nil)
(setq YaTeX-latex-message-code 'utf-8)
(setq YaTeX-use-LaTeX2e t)
(setq YaTeX-use-AMS-LaTeX t)
(setq YaTeX-dvi2-command-ext-alist
'(("TeXworks\\|texworks\\|texstudio\\|mupdf\\|SumatraPDF\\|Preview\\|Skim\\|TeXShop\\|evince\\|okular\\|zathura\\|qpdfview\\|Firefox\\|firefox\\|chrome\\|chromium\\|Adobe\\|Acrobat\\|AcroRd32\\|acroread\\|pdfopen\\|xdg-open\\|open\\|start" . ".pdf")))
(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c ptex2pdf -u -l -ot \"-kanji=utf8 -no-guess-input-enc -synctex=1\"")
;(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c pdflatex -synctex=1")
;(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c lualatex -synctex=1")
;(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c luajitlatex -synctex=1")
;(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c xelatex -synctex=1")
;(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c latexmk")
;(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c latexmk -e \"$latex=q/uplatex %O -kanji=utf8 -no-guess-input-enc -synctex=1 %S/\" -e \"$bibtex=q/upbibtex %O %B/\" -e \"$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/\" -e \"$makeindex=q/mendex %O -U -o %D %S/\" -e \"$dvipdf=q/dvipdfmx %O -o %D %S/\" -norc -gg -pdfdvi")
;(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c latexmk -e \"$latex=q/uplatex %O -kanji=utf8 -no-guess-input-enc -synctex=1 %S/\" -e \"$bibtex=q/upbibtex %O %B/\" -e \"$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/\" -e \"$makeindex=q/mendex %O -U -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")
;(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c latexmk -e \"$pdflatex=q/pdflatex %O -synctex=1 %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")
;(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c latexmk -e \"$pdflatex=q/lualatex %O -synctex=1 %S/\" -e \"$bibtex=q/bibtexu %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")
;(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c latexmk -e \"$pdflatex=q/luajitlatex %O -synctex=1 %S/\" -e \"$bibtex=q/bibtexu %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")
;(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c latexmk -e \"$pdflatex=q/xelatex %O -synctex=1 %S/\" -e \"$bibtex=q/bibtexu %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")
(setq bibtex-command "rundll32 shell32,ShellExec_RunDLL cmd /c latexmk -e \"$latex=q/uplatex %O -kanji=utf8 -no-guess-input-enc -synctex=1 %S/\" -e \"$bibtex=q/upbibtex %O %B/\" -e \"$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/\" -e \"$makeindex=q/mendex %O -U -o %D %S/\" -e \"$dvipdf=q/dvipdfmx %O -o %D %S/\" -norc -gg -pdfdvi")
(setq makeindex-command "rundll32 shell32,ShellExec_RunDLL cmd /c latexmk -e \"$latex=q/uplatex %O -kanji=utf8 -no-guess-input-enc -synctex=1 %S/\" -e \"$bibtex=q/upbibtex %O %B/\" -e \"$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/\" -e \"$makeindex=q/mendex %O -U -o %D %S/\" -e \"$dvipdf=q/dvipdfmx %O -o %D %S/\" -norc -gg -pdfdvi")
(setq dvi2-command "rundll32 shell32,ShellExec_RunDLL SumatraPDF -reuse-instance")
;(setq dvi2-command "texworks")
;(setq dvi2-command "texstudio --pdf-viewer-only")
(setq tex-pdfview-command "rundll32 shell32,ShellExec_RunDLL SumatraPDF -reuse-instance")
;(setq tex-pdfview-command "texworks")
;(setq tex-pdfview-command "texstudio --pdf-viewer-only")
(setq dviprint-command-format "powershell -Command \"& {$r = Write-Output %s;$p = [System.String]::Concat('\"\"\"',[System.IO.Path]::GetFileNameWithoutExtension($r),'.pdf','\"\"\"');Start-Process pdfopen -ArgumentList ('--rxi','--file',$p)}\"")
(defun sumatrapdf-forward-search ()
(interactive)
(progn
(process-kill-without-query
(start-process
"sumatrapdf"
nil
"rundll32"
"shell32,ShellExec_RunDLL"
"SumatraPDF"
"-reuse-instance"
(expand-file-name
(concat (file-name-sans-extension (or YaTeX-parent-file
(save-excursion
(YaTeX-visit-main t)
buffer-file-name)))
".pdf"))
"-forward-search"
(buffer-name)
(number-to-string (save-restriction
(widen)
(count-lines (point-min) (point))))))))
(add-hook 'yatex-mode-hook
'(lambda ()
(define-key YaTeX-mode-map (kbd "C-c s") 'sumatrapdf-forward-search)))
(defun fwdsumatrapdf-forward-search ()
(interactive)
(progn
(process-kill-without-query
(start-process
"fwdsumatrapdf"
nil
"fwdsumatrapdf"
(expand-file-name
(concat (file-name-sans-extension (or YaTeX-parent-file
(save-excursion
(YaTeX-visit-main t)
buffer-file-name)))
".pdf"))
(buffer-name)
(number-to-string (save-restriction
(widen)
(count-lines (point-min) (point))))))))
(add-hook 'yatex-mode-hook
'(lambda ()
(define-key YaTeX-mode-map (kbd "C-c f") 'fwdsumatrapdf-forward-search)))
(add-hook 'yatex-mode-hook
'(lambda ()
(auto-fill-mode -1)))
;;
;; RefTeX with YaTeX
;;
;(add-hook 'yatex-mode-hook 'turn-on-reftex)
(add-hook 'yatex-mode-hook
'(lambda ()
(reftex-mode 1)
(define-key reftex-mode-map (concat YaTeX-prefix ">") 'YaTeX-comment-region)
(define-key reftex-mode-map (concat YaTeX-prefix "<") 'YaTeX-uncomment-region)))
----
>
|COLOR(#FFF):BGCOLOR(#22D):CENTER:~メニュー [YaTeX]|COLOR(#FFF):BGCOLOR(#22D):CENTER:~入力 (setq YaTeX-inhibit-prefix-letter t)|COLOR(#FFF):BGCOLOR(#22D):CENTER:~機能|
|Process -> LaTeX|C-c C-t j または C-c C-t C-j|upLaTeX (ptex2pdf)|
|Process -> BibTeX|C-c C-t b RET|upbibtex, biber (Latexmk-pdfupLaTeX)|
|Process -> makeindex|C-c C-t i RET|mendex (Latexmk-pdfupLaTeX)|
|Process -> Preview|C-c C-t p RET RET|PDF プレビュー|
|Process -> lpr|C-c C-t l RET|Adobe Reader で PDF プレビューまたは印刷|
||C-c C-g または C-c s または M-x sumatrapdf-forward-search RET|SumatraPDF で forward search|
||C-c s または M-x sumatrapdf-forward-search RET|SumatraPDF で forward search|
||C-c f または M-x fwdsumatrapdf-forward-search RET|fwdsumatrapdf で forward search|
<
**OS X [#p7238e02]
-[[emacsでyatexを使う簡単な方法(Mac):http://ganmacs.hatenablog.com/entry/2013/09/07/225350]]
-[[TeXLive2013 +Emacs + YaTex の設定をした:http://d.hatena.ne.jp/tnil/20130823/1377230350]]
-[[EmacsとSkim.appでTeX・PDFシンクロ:http://d.hatena.ne.jp/setoryohei/20110102/1294003836]]
-[[emacs_and_tex:https://github.com/ryseto/emacs_and_tex]]
-[[Retina を活かす Emacs へ移行2:http://milanista224.blogspot.jp/2013/07/retina-emacs243.html]]
を参照.
[[Emacs.app:http://www.muskmelon.jp/?page_id=79]] をインストールします.~
[[YaTeX リリース版:https://www.yatex.org/]] または [[YaTeX テスト版:http://www.gentei.org/~yuuji/bin/yatexcurrent.cgi]] をダウンロードして展開します.~
展開したフォルダー名を yatex に変更します.~
Emacs を起動して
C-x C-f ~/
で,ホームディレクトリ (~/) の場所を確認します.
yatex フォルダーをコピーして ~/.emacs.d/site-lisp/ にペーストします.(~/.emacs.d/site-lisp/ が無ければ新規に作成します.)
----
~
└─.emacs.d
└─site-lisp
└─yatex
----
***設定 [#qe563613]
~/.emacs.d/init.el に設定を記述します.~
プレビューと forward search は [[Skim]] を使用します.~
Skim の inverse search については [[Emacs#Skim との連携#inverse search>Emacs#e9c08b3d]] を参照してください.~
----
;;
;; YaTeX
;;
(add-to-list 'load-path "~/.emacs.d/site-lisp/yatex")
(autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t)
(setq auto-mode-alist
(append '(("\\.tex$" . yatex-mode)
("\\.ltx$" . yatex-mode)
("\\.cls$" . yatex-mode)
("\\.sty$" . yatex-mode)
("\\.clo$" . yatex-mode)
("\\.bbl$" . yatex-mode)) auto-mode-alist))
(setq YaTeX-inhibit-prefix-letter t)
(setq YaTeX-kanji-code nil)
(setq YaTeX-latex-message-code 'utf-8)
(setq YaTeX-use-LaTeX2e t)
(setq YaTeX-use-AMS-LaTeX t)
(setq YaTeX-dvi2-command-ext-alist
'(("TeXworks\\|texworks\\|texstudio\\|mupdf\\|SumatraPDF\\|Preview\\|Skim\\|TeXShop\\|evince\\|okular\\|zathura\\|qpdfview\\|Firefox\\|firefox\\|chrome\\|chromium\\|Adobe\\|Acrobat\\|AcroRd32\\|acroread\\|pdfopen\\|xdg-open\\|open\\|start" . ".pdf")))
(setq tex-command "/usr/texbin/ptex2pdf -u -l -ot '-synctex=1'")
;(setq tex-command "/usr/texbin/pdflatex -synctex=1")
;(setq tex-command "/usr/texbin/lualatex -synctex=1")
;(setq tex-command "/usr/texbin/luajitlatex -synctex=1")
;(setq tex-command "/usr/texbin/xelatex -synctex=1")
;(setq tex-command "/usr/texbin/latexmk")
;(setq tex-command "/usr/texbin/latexmk -e '$latex=q/uplatex %O -synctex=1 %S/' -e '$bibtex=q/upbibtex %O %B/' -e '$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/' -e '$makeindex=q/mendex %O -U -o %D %S/' -e '$dvipdf=q/dvipdfmx %O -o %D %S/' -norc -gg -pdfdvi")
;(setq tex-command "/usr/texbin/latexmk -e '$latex=q/uplatex %O -synctex=1 %S/' -e '$bibtex=q/upbibtex %O %B/' -e '$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/' -e '$makeindex=q/mendex %O -U -o %D %S/' -e '$dvips=q/dvips %O -z -f %S | convbkmk -u > %D/' -e '$ps2pdf=q/ps2pdf %O %S %D/' -norc -gg -pdfps")
;(setq tex-command "/usr/texbin/latexmk -e '$pdflatex=q/pdflatex %O -synctex=1 %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")
;(setq tex-command "/usr/texbin/latexmk -e '$pdflatex=q/lualatex %O -synctex=1 %S/' -e '$bibtex=q/bibtexu %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")
;(setq tex-command "/usr/texbin/latexmk -e '$pdflatex=q/luajitlatex %O -synctex=1 %S/' -e '$bibtex=q/bibtexu %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")
;(setq tex-command "/usr/texbin/latexmk -e '$pdflatex=q/xelatex %O -synctex=1 %S/' -e '$bibtex=q/bibtexu %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")
(setq bibtex-command "/usr/texbin/latexmk -e '$latex=q/uplatex %O -synctex=1 %S/' -e '$bibtex=q/upbibtex %O %B/' -e '$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/' -e '$makeindex=q/mendex %O -U -o %D %S/' -e '$dvipdf=q/dvipdfmx %O -o %D %S/' -norc -gg -pdfdvi")
(setq makeindex-command "/usr/texbin/latexmk -e '$latex=q/uplatex %O -synctex=1 %S/' -e '$bibtex=q/upbibtex %O %B/' -e '$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/' -e '$makeindex=q/mendex %O -U -o %D %S/' -e '$dvipdf=q/dvipdfmx %O -o %D %S/' -norc -gg -pdfdvi")
(setq dvi2-command "/usr/bin/open -a Skim")
;(setq dvi2-command "/usr/bin/open -a Preview")
;(setq dvi2-command "/usr/bin/open -a TeXShop")
;(setq dvi2-command "/Applications/TeXworks.app/Contents/MacOS/TeXworks")
;(setq dvi2-command "/Applications/texstudio.app/Contents/MacOS/texstudio --pdf-viewer-only")
(setq tex-pdfview-command "/usr/bin/open -a Skim")
;(setq tex-pdfview-command "/usr/bin/open -a Preview")
;(setq tex-pdfview-command "/usr/bin/open -a TeXShop")
;(setq tex-pdfview-command "/Applications/TeXworks.app/Contents/MacOS/TeXworks")
;(setq tex-pdfview-command "/Applications/texstudio.app/Contents/MacOS/texstudio --pdf-viewer-only")
(setq dviprint-command-format "/usr/bin/open -a \"Adobe Reader\" `echo %s | gsed -e \"s/\\.[^.]*$/\\.pdf/\"`")
(defun skim-forward-search ()
(interactive)
(progn
(process-kill-without-query
(start-process
"displayline"
nil
"/Applications/Skim.app/Contents/SharedSupport/displayline"
(number-to-string (save-restriction
(widen)
(count-lines (point-min) (point))))
(expand-file-name
(concat (file-name-sans-extension (or YaTeX-parent-file
(save-excursion
(YaTeX-visit-main t)
buffer-file-name)))
".pdf"))
buffer-file-name))))
(add-hook 'yatex-mode-hook
'(lambda ()
(define-key YaTeX-mode-map (kbd "C-c s") 'skim-forward-search)))
(add-hook 'yatex-mode-hook
'(lambda ()
(auto-fill-mode -1)))
;;
;; RefTeX with YaTeX
;;
;(add-hook 'yatex-mode-hook 'turn-on-reftex)
(add-hook 'yatex-mode-hook
'(lambda ()
(reftex-mode 1)
(define-key reftex-mode-map (concat YaTeX-prefix ">") 'YaTeX-comment-region)
(define-key reftex-mode-map (concat YaTeX-prefix "<") 'YaTeX-uncomment-region)))
----
>
|COLOR(#FFF):BGCOLOR(#22D):CENTER:~メニュー [YaTeX]|COLOR(#FFF):BGCOLOR(#22D):CENTER:~入力 (setq YaTeX-inhibit-prefix-letter t)|COLOR(#FFF):BGCOLOR(#22D):CENTER:~機能|
|Process -> LaTeX|C-c C-t j または C-c C-t C-j|upLaTeX (ptex2pdf)|
|Process -> BibTeX|C-c C-t b RET|upbibtex, biber (Latexmk-pdfupLaTeX)|
|Process -> makeindex|C-c C-t i RET|mendex (Latexmk-pdfupLaTeX)|
|Process -> Preview|C-c C-t p RET RET|PDF プレビュー|
|Process -> lpr|C-c C-t l RET|Adobe Reader で PDF プレビューまたは印刷|
||C-c C-g または C-c s または M-x skim-forward-search RET|Skim で forward search|
<
**Linux [#e2cbcccd]
[[YaTeX リリース版:https://www.yatex.org/]] または [[YaTeX テスト版:http://www.gentei.org/~yuuji/bin/yatexcurrent.cgi]] をダウンロードして展開します.~
展開したフォルダー名を yatex に変更します.~
Emacs を起動して
C-x C-f ~/
で,ホームディレクトリ (~/) の場所を確認します.
yatex フォルダーをコピーして ~/.emacs.d/site-lisp/ にペーストします.(~/.emacs.d/site-lisp/ が無ければ新規に作成します.)
----
~
└─.emacs.d
└─site-lisp
└─yatex
----
***設定 [#nec42ee2]
~/.emacs.d/init.el に設定を記述します.~
fwdevince は [[Evince/fwdevince]] の fwdevince を使用します.~
Evince の inverse search については [[Emacs#Evince との連携#inverse search>Emacs#vecb4fd9]] を参照してください.~
----
;;
;; YaTeX
;;
(add-to-list 'load-path "~/.emacs.d/site-lisp/yatex")
(autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t)
(setq auto-mode-alist
(append '(("\\.tex$" . yatex-mode)
("\\.ltx$" . yatex-mode)
("\\.cls$" . yatex-mode)
("\\.sty$" . yatex-mode)
("\\.clo$" . yatex-mode)
("\\.bbl$" . yatex-mode)) auto-mode-alist))
(setq YaTeX-inhibit-prefix-letter t)
(setq YaTeX-kanji-code nil)
(setq YaTeX-latex-message-code 'utf-8)
(setq YaTeX-use-LaTeX2e t)
(setq YaTeX-use-AMS-LaTeX t)
(setq YaTeX-dvi2-command-ext-alist
'(("TeXworks\\|texworks\\|texstudio\\|mupdf\\|SumatraPDF\\|Preview\\|Skim\\|TeXShop\\|evince\\|okular\\|zathura\\|qpdfview\\|Firefox\\|firefox\\|chrome\\|chromium\\|Adobe\\|Acrobat\\|AcroRd32\\|acroread\\|pdfopen\\|xdg-open\\|open\\|start" . ".pdf")))
(setq tex-command "ptex2pdf -u -l -ot '-synctex=1'")
;(setq tex-command "pdflatex -synctex=1")
;(setq tex-command "lualatex -synctex=1")
;(setq tex-command "luajitlatex -synctex=1")
;(setq tex-command "xelatex -synctex=1")
;(setq tex-command "latexmk")
;(setq tex-command "latexmk -e '$latex=q/uplatex %O -synctex=1 %S/' -e '$bibtex=q/upbibtex %O %B/' -e '$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/' -e '$makeindex=q/mendex %O -U -o %D %S/' -e '$dvipdf=q/dvipdfmx %O -o %D %S/' -norc -gg -pdfdvi")
;(setq tex-command "latexmk -e '$latex=q/uplatex %O -synctex=1 %S/' -e '$bibtex=q/upbibtex %O %B/' -e '$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/' -e '$makeindex=q/mendex %O -U -o %D %S/' -e '$dvips=q/dvips %O -z -f %S | convbkmk -u > %D/' -e '$ps2pdf=q/ps2pdf %O %S %D/' -norc -gg -pdfps")
;(setq tex-command "latexmk -e '$pdflatex=q/pdflatex %O -synctex=1 %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")
;(setq tex-command "latexmk -e '$pdflatex=q/lualatex %O -synctex=1 %S/' -e '$bibtex=q/bibtexu %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")
;(setq tex-command "latexmk -e '$pdflatex=q/luajitlatex %O -synctex=1 %S/' -e '$bibtex=q/bibtexu %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")
;(setq tex-command "latexmk -e '$pdflatex=q/xelatex %O -synctex=1 %S/' -e '$bibtex=q/bibtexu %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")
(setq bibtex-command "latexmk -e '$latex=q/uplatex %O -synctex=1 %S/' -e '$bibtex=q/upbibtex %O %B/' -e '$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/' -e '$makeindex=q/mendex %O -U -o %D %S/' -e '$dvipdf=q/dvipdfmx %O -o %D %S/' -norc -gg -pdfdvi")
(setq makeindex-command "latexmk -e '$latex=q/uplatex %O -synctex=1 %S/' -e '$bibtex=q/upbibtex %O %B/' -e '$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/' -e '$makeindex=q/mendex %O -U -o %D %S/' -e '$dvipdf=q/dvipdfmx %O -o %D %S/' -norc -gg -pdfdvi")
(setq dvi2-command "xdg-open")
;(setq dvi2-command "evince")
;(setq dvi2-command "xdg-open")
(setq dvi2-command "evince")
;(setq dvi2-command "okular --unique")
;(setq dvi2-command "zathura -s -x \"emacsclient --no-wait +%{line} %{input}\"")
;(setq dvi2-command "qpdfview --unique")
;(setq dvi2-command "texworks")
;(setq dvi2-command "texstudio --pdf-viewer-only")
(setq tex-pdfview-command "xdg-open")
;(setq tex-pdfview-command "evince")
;(setq tex-pdfview-command "xdg-open")
(setq tex-pdfview-command "evince")
;(setq tex-pdfview-command "okular --unique")
;(setq tex-pdfview-command "zathura -s -x \"emacsclient --no-wait +%{line} %{input}\"")
;(setq tex-pdfview-command "qpdfview --unique")
;(setq tex-pdfview-command "texworks")
;(setq tex-pdfview-command "texstudio --pdf-viewer-only")
(setq dviprint-command-format "xdg-open `echo %s | sed -e \"s/\\.[^.]*$/\\.pdf/\"`")
(defun evince-forward-search ()
(interactive)
(progn
(process-kill-without-query
(start-process
"fwdevince"
nil
"fwdevince"
(expand-file-name
(concat (file-name-sans-extension (or YaTeX-parent-file
(save-excursion
(YaTeX-visit-main t)
buffer-file-name)))
".pdf"))
(number-to-string (save-restriction
(widen)
(count-lines (point-min) (point))))
(buffer-name)))))
(add-hook 'yatex-mode-hook
'(lambda ()
(define-key YaTeX-mode-map (kbd "C-c e") 'evince-forward-search)))
(require 'dbus)
(defun un-urlify (fname-or-url)
"A trivial function that replaces a prefix of file:/// with just /."
(if (string= (substring fname-or-url 0 8) "file:///")
(substring fname-or-url 7)
fname-or-url))
(defun evince-inverse-search (file linecol &rest ignored)
(let* ((fname (un-urlify file))
(buf (find-file fname))
(line (car linecol))
(col (cadr linecol)))
(if (null buf)
(message "[Synctex]: %s is not opened..." fname)
(switch-to-buffer buf)
(goto-line (car linecol))
(unless (= col -1)
(move-to-column col)))))
(dbus-register-signal
:session nil "/org/gnome/evince/Window/0"
"org.gnome.evince.Window" "SyncSource"
'evince-inverse-search)
(defun okular-forward-search ()
(interactive)
(progn
(process-kill-without-query
(start-process
"okular"
nil
"okular"
"--unique"
(concat (expand-file-name
(concat (file-name-sans-extension (or YaTeX-parent-file
(save-excursion
(YaTeX-visit-main t)
buffer-file-name)))
".pdf"))
"#src:"
(number-to-string (save-restriction
(widen)
(count-lines (point-min) (point))))
(buffer-file-name))))))
(add-hook 'yatex-mode-hook
'(lambda ()
(define-key YaTeX-mode-map (kbd "C-c o") 'okular-forward-search)))
(defun zathura-forward-search ()
(interactive)
(progn
(process-kill-without-query
(start-process
"zathura"
nil
"zathura"
"--synctex-forward"
(concat (number-to-string (save-restriction
(widen)
(count-lines (point-min) (point))))
":0:"
(buffer-name))
(expand-file-name
(concat (file-name-sans-extension (or YaTeX-parent-file
(save-excursion
(YaTeX-visit-main t)
buffer-file-name)))
".pdf"))))))
(add-hook 'yatex-mode-hook
'(lambda ()
(define-key YaTeX-mode-map (kbd "C-c z") 'zathura-forward-search)))
(defun qpdfview-forward-search ()
(interactive)
(progn
(process-kill-without-query
(start-process
"qpdfview"
nil
"qpdfview"
"--unique"
(concat (expand-file-name
(concat (file-name-sans-extension (or YaTeX-parent-file
(save-excursion
(YaTeX-visit-main t)
buffer-file-name)))
".pdf"))
"#src:"
(buffer-name)
":"
(number-to-string (save-restriction
(widen)
(count-lines (point-min) (point))))
":0")))))
(add-hook 'yatex-mode-hook
'(lambda ()
(define-key YaTeX-mode-map (kbd "C-c q") 'qpdfview-forward-search)))
(add-hook 'yatex-mode-hook
'(lambda ()
(auto-fill-mode -1)))
;;
;; RefTeX with YaTeX
;;
;(add-hook 'yatex-mode-hook 'turn-on-reftex)
(add-hook 'yatex-mode-hook
'(lambda ()
(reftex-mode 1)
(define-key reftex-mode-map (concat YaTeX-prefix ">") 'YaTeX-comment-region)
(define-key reftex-mode-map (concat YaTeX-prefix "<") 'YaTeX-uncomment-region)))
----
>
|COLOR(#FFF):BGCOLOR(#22D):CENTER:~メニュー [YaTeX]|COLOR(#FFF):BGCOLOR(#22D):CENTER:~入力 (setq YaTeX-inhibit-prefix-letter t)|COLOR(#FFF):BGCOLOR(#22D):CENTER:~機能|
|Process -> LaTeX|C-c C-t j または C-c C-t C-j|upLaTeX (ptex2pdf)|
|Process -> BibTeX|C-c C-t b RET|upbibtex, biber (Latexmk-pdfupLaTeX)|
|Process -> makeindex|C-c C-t i RET|mendex (Latexmk-pdfupLaTeX)|
|Process -> Preview|C-c C-t p RET RET|PDF プレビュー|
|Process -> lpr|C-c C-t l RET|xdg-open で PDF プレビューまたは印刷|
||C-c C-g または C-c e または M-x evince-forward-search RET|Evince で forward search|
||C-c C-g または C-c o または M-x okular-forward-search RET|Okular で forward search|
||C-c o または M-x okular-forward-search RET|Okular で forward search|
||C-c z または M-x zathura-forward-search RET|zathura で forward search|
||C-c C-g または C-c q または M-x qpdfview-forward-search RET|qpdfview で forward search|
||C-c q または M-x qpdfview-forward-search RET|qpdfview で forward search|
<
*使い方 [#v90b1615]
さまざまな機能がありますので、まずは少しだけ。
**タイプセット・プレビュー [#r68a2a97]
(setq YaTeX-inhibit-prefix-letter t) を使用してください.~
(setq YaTeX-inhibit-prefix-letter nil) は,非推奨 (deprecated) です.~
YaTeX-inhibit-prefix-letter は t と nil でキーバインドが異なります.~
Linux Mint, Debian GNU/Linux, Vine Linux に収録されている YaTeX の最新版はデフォルトで t となっており,YaTeX の作者も t を推奨しています (YaTeX ML [yatex:04567] を参照).~
変更の理由は YaTeX が使用していたキーバインドがユーザー向けに予約されていた C-c letter に設定されていたためと思われます.~
----
[[Emacs Lispのコーディングの慣習:http://www.bookshelf.jp/texi/elisp-manual/21-2-8/jp/elisp_42.html#IDX3219]] より
----
-読者のメジャーモードでは、 C-c letter をキーとして定義しないこと。 これらのキー列はユーザー向けに予約済みである。 それら''だけ''がユーザー向けに予約されたキー列であり、 それらを禁止しないこと。
>
かわりに、C-c のあとにコントロール文字か数字文字か特定の句読点文字が続く キー列を定義する。 これらのキー列は、メジャーモード用に予約してある。
<
>
Emacs のすべてのモードをこの慣習に従うように変換するのは たいへんな作業量であった。 この慣習を捨てさるとその作業をむだにしてしまい、ユーザーにも不便である。
<
----
>
|COLOR(#FFF):BGCOLOR(#22D):CENTER:~メニュー [YaTeX]|COLOR(#FFF):BGCOLOR(#22D):CENTER:~入力 (setq YaTeX-inhibit-prefix-letter t)|COLOR(#FFF):BGCOLOR(#22D):CENTER:~機能|
|Process -> LaTeX|C-c C-t j または C-c C-t C-j|タイプセット|
|Process -> LaTeX+PDF|C-c C-t d|latex + dvipdfmx|
|Process -> Kill LaTeX|C-c C-t k|タイプセットを中断|
|Process -> Preview|C-c C-t p RET RET|プレビュー|
|Process -> BibTeX|C-c C-t b RET|BibTeX|
|Process -> makeindex|C-c C-t i RET|MakeIndex|
|Process -> lpr|C-c C-t l RET|LPR (印刷)|
||C-c C-g|forward search|
||C-c '|エラー行にジャンプ|
||M-x yatex|親ファイルの再設定|
<
----
&color(#2E20DE,#2E20DE){%%% %%%};[[&ref(http://upload.wikimedia.org/wikipedia/commons/thumb/0/08/EmacsIcon.svg/200px-EmacsIcon.svg.png,around,28x28,GNU Emacs - GNU Project - Free Software Foundation (FSF));>http://www.gnu.org/software/emacs/]]&color(#2E20DE,#2E20DE){%%% &color(Black){''emacs@YaTeX''}; &color(#2E20DE,#2E20DE){%%%[ &color(Black){''◛''}; ]%%%};&color(#2E20DE,#2E20DE){%%%[ &color(Black){''▭''}; ]%%%};&color(#DD4444,#DD4444){%%%[ &color(White){''×''}; ]%%%};%%%};&br;
&color(Black,#DAE0FE){%%% ファイル 編集 オプション バッファ ツール YaTeX Ref ヘルプ %%%};&br;
...&br;
-U\--- ''yatex.tex'' Top L1 (やてふ Ref)--------------------------------&br;
J)latex R)egion E)nv B)ibtex mk(I)dx latex+p(D)f K)ill P)review S)earch V)iewErr L)pr&br;
----
**補完 [#g3780d28]
(setq YaTeX-inhibit-prefix-letter t) を使用してください.~
(setq YaTeX-inhibit-prefix-letter nil) は,非推奨 (deprecated) です.~
>
|COLOR(#FFF):BGCOLOR(#22D):CENTER:~メニュー [YaTeX]|COLOR(#FFF):BGCOLOR(#22D):CENTER:~入力 (setq YaTeX-inhibit-prefix-letter t)|COLOR(#FFF):BGCOLOR(#22D):CENTER:~補完|
|Environment -> リストから選択|C-c C-b SPC|begin 型補完|
|Environment region -> リストから選択|C-c B SPC|指定領域に対して begin 型補完|
|Section type -> リストから選択|C-c C-s|section 型補完|
|Section type region (long name) -> リストから選択|C-c S|指定領域に対して section 型補完|
||C-c C-e|end 補完|
<
補完を使わないと
\begin{itemize}
\item AUCTeX
\item YaTeX
\end{今度からはちゃんと ^C b を使いましょう}
と言われます.
begin 型補完を使うのを忘れた場合は
\begin{itemize}
\item AUCTeX
\item YaTeX
の時に end 補完を使うと
\end{itemize}
を補完してくれます.
**タイプセット方式の変更 [#m8567380]
>
|COLOR(#FFF):BGCOLOR(#22D):CENTER:~入力|COLOR(#FFF):BGCOLOR(#22D):CENTER:~タイプセット方式|
|M-x set-variable RET tex-command RET "latexmk" RET|latexmk|
|M-x set-variable RET tex-command RET "pdflatex -synctex=1" RET|pdflatex|
|M-x set-variable RET tex-command RET "lualatex -synctex=1" RET|lualatex|
|M-x set-variable RET tex-command RET "luajitlatex -synctex=1" RET|luajitlatex|
|M-x set-variable RET tex-command RET "xelatex -synctex=1" RET|xelatex|
<
**タイプセット方式の確認 [#k374ed95]
>
|COLOR(#FFF):BGCOLOR(#22D):CENTER:~入力|
|M-x describe-variable RET tex-command RET|
<
**その他 [#za795743]
[[『野鳥』クイックリファレンス:https://www.yatex.org/yatexref.txt]] もご覧下さい.~
詳細は [[Yet Another tex-mode for Emacs - Table of Contents:https://www.yatex.org/info/yatexj_toc.html]] をご覧下さい.~
[[瀬戸 亮平:http://d.hatena.ne.jp/setoryohei/]] さんの [[YaTeX demo:http://d.hatena.ne.jp/setoryohei/20120106]] で YaTeX の機能が紹介されています.~
*ソースのサンプル [#q88c5ad1]
ヘッダー部分に用途別に追加してみました.テンプレートとしても使えるかもしれません.
%% -*- coding: utf-8-unix -*-
%#!ptex2pdf -u -l -ot "-kanji=utf8 -no-guess-input-enc -synctex=1" hogehoge
% #!tasklist /fi "IMAGENAME eq AcroRd32.exe" /nh | findstr "AcroRd32.exe" > nul && pdfopen --rxi --file hogehoge.pdf && pdfclose --rxi --file hogehoge.pdf & ptex2pdf -u -l hogehoge && pdfopen --rxi --file hogehoge.pdf
%#BIBTEX upbibtex hogehoge
%#MAKEINDEX mendex -U hogehoge
%#LPR if exist "C:\Program Files\Adobe\Reader 11.0\Reader\AcroRd32.exe" ("C:\Program Files\Adobe\Reader 11.0\Reader\AcroRd32.exe" /p hogehoge.pdf) else "C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" /p hogehoge.pdf
% #LPR acroread.bat /p hogehoge.pdf
\documentclass[uplatex]{jsarticle}
\begin{document}
Welcom to YaTeX World!
\end{document}
%%% Local Variables:
%%% TeX-master: "hogehoge"
%%% End:
PDF ファイルでの印刷が多くなってきているので,LPR も PDF ファイルに対応させてみました.~
パスの通ったところに,acroread.bat というファイル名で以下のスクリプトを保存します.~
@echo off
REM USAGE: acroread.bat [options] filename
if exist "C:\Program Files\Adobe\Reader 11.0\Reader\AcroRd32.exe" (
"C:\Program Files\Adobe\Reader 11.0\Reader\AcroRd32.exe" %1 %2 %3 %4 %5 %6 %7 %8 %9
) else (
"C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" %1 %2 %3 %4 %5 %6 %7 %8 %9
)
*~/.emacs.d/init.el 見せてください. [#uc0145ec]
あくまで一例です。~
ぜひ修正、加筆お願いします。~
**‘load-path’に yatex.el が存在するフォルダー (ディレクトリ) を追加 [#pe637e19]
(add-to-list 'load-path "~/.emacs.d/site-lisp/yatex")
** *.texで自動的にYaTeXモード [#d7fc1e0e]
(setq auto-mode-alist
(append '(("\\.tex$" . yatex-mode)) auto-mode-alist))
(autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t)
または
(setq auto-mode-alist
(cons (cons "\\.tex$" 'yatex-mode) auto-mode-alist))
(autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t)
**YaTeX-inhibit-prefix-letter [#j42805c2]
(setq YaTeX-inhibit-prefix-letter t) を使用してください.~
(setq YaTeX-inhibit-prefix-letter nil) は,非推奨 (deprecated) です.~
(setq YaTeX-inhibit-prefix-letter t)
**Kanji code [#j78164d5]
YaTeX-kanji-code を nil 以外にすると''指定した文字コード以外の TeX ファイルも指定した文字コードで保存されてしまう''ので nil を指定することをおすすめします.
-[[8.4.3 文字エンコーディングの設定:http://hwb.ecc.u-tokyo.ac.jp/current/literacy/editor/emacs/encoding/]]
-http://www.mzks.org/wiki/index.php?Emacs
;;; nil=YaTeX-kanji-code が nil なら coding-system に感知しない
;;; 0=no-converion -> Emacs 内部で使用されている文字コードで保存される (Emacs 23 以降では utf-8-emacs)
;;; 1=Shift JIS (Shift_JIS)
;;; 2=JIS (ISO-2022-JP)
;;; 3=EUC (EUC-JP)
;;; 4=UTF-8
(setq YaTeX-kanji-code nil)
**LaTeX でタイプセットしたときに出力されるメッセージの文字コードを指定 (*YaTeX-typesetting* バッファの文字コードの指定) [#v14da95b]
(setq YaTeX-latex-message-code 'utf-8)
**TeX typeset [#h9687728]
***upLaTeX (ptex2pdf) [#u98acf96]
(if (eq system-type 'windows-nt)
(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c ptex2pdf -u -l -ot \"-kanji=utf8 -no-guess-input-enc -synctex=1\"")
(setq tex-command "ptex2pdf -u -l -ot \"-synctex=1\""))
***pdfLaTeX [#haa09a91]
(if (eq system-type 'windows-nt)
(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c pdflatex -synctex=1")
(setq tex-command "pdflatex -synctex=1"))
***LuaLaTeX [#r2c74452]
(if (eq system-type 'windows-nt)
(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c lualatex -synctex=1")
(setq tex-command "lualatex -synctex=1"))
***LuaJITLaTeX [#kfa37927]
(if (eq system-type 'windows-nt)
(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c luajitlatex -synctex=1")
(setq tex-command "luajitlatex -synctex=1"))
***XeLaTeX [#h279d9b8]
(if (eq system-type 'windows-nt)
(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c xelatex -synctex=1")
(setq tex-command "xelatex -synctex=1"))
***Latexmk [#me8a1b75]
(if (eq system-type 'windows-nt)
(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c latexmk")
(setq tex-command "latexmk"))
***Latexmk-pdfupLaTeX [#bc88da07]
(if (eq system-type 'windows-nt)
(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c latexmk -e \"$latex=q/uplatex %O -kanji=utf8 -no-guess-input-enc -synctex=1 %S/\" -e \"$bibtex=q/upbibtex %O %B/\" -e \"$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/\" -e \"$makeindex=q/mendex %O -U -o %D %S/\" -e \"$dvipdf=q/dvipdfmx %O -o %D %S/\" -norc -gg -pdfdvi")
(setq tex-command "latexmk -e '$latex=q/uplatex %O -synctex=1 %S/' -e '$bibtex=q/upbibtex %O %B/' -e '$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/' -e '$makeindex=q/mendex %O -U -o %D %S/' -e '$dvipdf=q/dvipdfmx %O -o %D %S/' -norc -gg -pdfdvi"))
***Latexmk-pdfupLaTeX2 [#od385031]
(if (eq system-type 'windows-nt)
(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c latexmk -e \"$latex=q/uplatex %O -kanji=utf8 -no-guess-input-enc -synctex=1 %S/\" -e \"$bibtex=q/upbibtex %O %B/\" -e \"$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/\" -e \"$makeindex=q/mendex %O -U -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")
(setq tex-command "latexmk -e '$latex=q/uplatex %O -synctex=1 %S/' -e '$bibtex=q/upbibtex %O %B/' -e '$biber=q/biber %O --bblencoding=utf8 -u -U --output_safechars %B/' -e '$makeindex=q/mendex %O -U -o %D %S/' -e '$dvips=q/dvips %O -z -f %S | convbkmk -u > %D/' -e '$ps2pdf=q/ps2pdf %O %S %D/' -norc -gg -pdfps"))
***Latexmk-pdfLaTeX [#n70096b8]
(if (eq system-type 'windows-nt)
(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c latexmk -e \"$pdflatex=q/pdflatex %O -synctex=1 %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")
(setq tex-command "latexmk -e '$pdflatex=q/pdflatex %O -synctex=1 %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"))
***Latexmk-LuaLaTeX [#d4a80fb8]
(if (eq system-type 'windows-nt)
(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c latexmk -e \"$pdflatex=q/lualatex %O -synctex=1 %S/\" -e \"$bibtex=q/bibtexu %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")
(setq tex-command "latexmk -e '$pdflatex=q/lualatex %O -synctex=1 %S/' -e '$bibtex=q/bibtexu %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"))
***Latexmk-LuaJITLaTeX [#wfb7e387]
(if (eq system-type 'windows-nt)
(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c latexmk -e \"$pdflatex=q/luajitlatex %O -synctex=1 %S/\" -e \"$bibtex=q/bibtexu %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")
(setq tex-command "latexmk -e '$pdflatex=q/luajitlatex %O -synctex=1 %S/' -e '$bibtex=q/bibtexu %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"))
***Latexmk-XeLaTeX [#gac50540]
(if (eq system-type 'windows-nt)
(setq tex-command "rundll32 shell32,ShellExec_RunDLL cmd /c latexmk -e \"$pdflatex=q/xelatex %O -synctex=1 %S/\" -e \"$bibtex=q/bibtexu %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")
(setq tex-command "latexmk -e '$pdflatex=q/xelatex %O -synctex=1 %S/' -e '$bibtex=q/bibtexu %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"))
**upbibtex の指定 [#q198d21d]
(setq bibtex-command "upbibtex")
**biber の指定 [#o3f4bd25]
(setq bibtex-command "biber --bblencoding=utf8 -u -U --output_safechars")
**mendex の指定 [#i3950de0]
(setq makeindex-command "mendex -U")
**YaTeX-dvi2-command-ext-alist [#x19206ad]
(setq YaTeX-dvi2-command-ext-alist
'(("TeXworks\\|texworks\\|texstudio\\|mupdf\\|SumatraPDF\\|Preview\\|Skim\\|TeXShop\\|evince\\|okular\\|zathura\\|qpdfview\\|Firefox\\|firefox\\|chrome\\|chromium\\|Adobe\\|Acrobat\\|AcroRd32\\|acroread\\|pdfopen\\|xdg-open\\|open\\|start" . ".pdf")))
**dvi2-command (C-c C-t j でタイプセットしたあとで C-c C-t p すると表示される PDF ビューア) [#t737f278]
***SumatraPDF [#d0c29303]
(setq dvi2-command "rundll32 shell32,ShellExec_RunDLL SumatraPDF -reuse-instance")
***TeXworks [#v93f2569]
(if (eq system-type 'darwin)
(setq dvi2-command "/Applications/TeXworks.app/Contents/MacOS/TeXworks")
(setq dvi2-command "texworks"))
***TeXstudio [#y5d1ba30]
(if (eq system-type 'darwin)
(setq dvi2-command "/Applications/texstudio.app/Contents/MacOS/texstudio --pdf-viewer-only")
(setq dvi2-command "texstudio --pdf-viewer-only"))
***MuPDF [#n79f13fd]
(setq dvi2-command "mupdf")
***Firefox (PDF.js) [#r971ee00]
(if (eq system-type 'windows-nt)
(setq dvi2-command "powershell -Command \"& {$p = [System.String]::Concat('\"\"\"',[System.IO.Path]::GetFileName($args),'\"\"\"');Start-Process firefox -ArgumentList ('-new-window',$p)}\"")
(setq dvi2-command "firefox -new-window"))
***Chrome/Chromium PDF Viewer (PDFium) [#r552a7fd]
(if (eq system-type 'windows-nt)
(setq dvi2-command "powershell -Command \"& {$p = [System.String]::Concat('\"\"\"',[System.IO.Path]::GetFullPath($args),'\"\"\"');Start-Process chrome -ArgumentList ('--new-window',$p)}\"")
(setq dvi2-command "chromium --new-window"))
***Preview [#j3fea9fe]
(setq dvi2-command "/usr/bin/open -a Preview")
***Skim [#vb4cc051]
(setq dvi2-command "/usr/bin/open -a Skim")
***TeXShop [#w3687acc]
(setq dvi2-command "/usr/bin/open -a TeXShop")
***Evince [#k6ed9ab5]
(setq dvi2-command "evince")
***Okular [#uf59e41d]
(setq dvi2-command "okular --unique")
***zathura [#g500937c]
(setq dvi2-command "zathura -s -x \"emacsclient --no-wait +%{line} %{input}\"")
***qpdfview [#ze129dad]
(setq dvi2-command "qpdfview --unique")
**tex-pdfview-command (C-c C-t d でタイプセットしたあとで C-c C-t p すると表示される PDF ビューア) [#ia0437ce]
***SumatraPDF [#i2f07080]
(setq tex-pdfview-command "rundll32 shell32,ShellExec_RunDLL SumatraPDF -reuse-instance")
***TeXworks [#y4efa0cf]
(if (eq system-type 'darwin)
(setq tex-pdfview-command "/Applications/TeXworks.app/Contents/MacOS/TeXworks")
(setq tex-pdfview-command "texworks"))
***TeXstudio [#wb93592a]
(if (eq system-type 'darwin)
(setq tex-pdfview-command "/Applications/texstudio.app/Contents/MacOS/texstudio --pdf-viewer-only")
(setq tex-pdfview-command "texstudio --pdf-viewer-only"))
***MuPDF [#q15298f3]
(setq tex-pdfview-command "mupdf")
***Firefox (PDF.js) [#j10835f3]
(if (eq system-type 'windows-nt)
(setq tex-pdfview-command "powershell -Command \"& {$p = [System.String]::Concat('\"\"\"',[System.IO.Path]::GetFileName($args),'\"\"\"');Start-Process firefox -ArgumentList ('-new-window',$p)}\"")
(setq tex-pdfview-command "firefox -new-window"))
***Chrome/Chromium PDF Viewer (PDFium) [#k977257b]
(if (eq system-type 'windows-nt)
(setq tex-pdfview-command "powershell -Command \"& {$p = [System.String]::Concat('\"\"\"',[System.IO.Path]::GetFullPath($args),'\"\"\"');Start-Process chrome -ArgumentList ('--new-window',$p)}\"")
(setq tex-pdfview-command "chromium --new-window"))
***Preview [#u986e521]
(setq tex-pdfview-command "/usr/bin/open -a Preview")
***Skim [#c9ac9d17]
(setq tex-pdfview-command "/usr/bin/open -a Skim")
***TeXShop [#g2f83bb4]
(setq tex-pdfview-command "/usr/bin/open -a TeXShop")
***Evince [#j390cbe8]
(setq tex-pdfview-command "evince")
***Okular [#y8537029]
(setq tex-pdfview-command "okular --unique")
***zathura [#v709670e]
(setq tex-pdfview-command "zathura -s -x \"emacsclient --no-wait +%{line} %{input}\"")
***qpdfview [#l8d529be]
(setq tex-pdfview-command "qpdfview --unique")
**use LaTeX2e and AMS-LaTeX [#s49fcef1]
YaTeX 1.78 以降は YaTeX-use-AMS-LaTeX が t になりました.~
AMS-LaTeX がうまく動作しない場合は YaTeX をロードする前に設定してみてください.(参照 [[その1:https://twitter.com/hiroseyuuji/status/173544126686572544]], [[その2:https://twitter.com/liquid_amber/status/173975511570194432]])
(setq YaTeX-use-LaTeX2e t)
(setq YaTeX-use-AMS-LaTeX t)
**font latex hook [#j998f541]
(add-hook 'yatex-mode-hook
'(lambda ()
(require 'font-latex)
(font-latex-setup)))
**RefTeX mode [#iabc8ab6]
(add-hook 'yatex-mode-hook 'turn-on-reftex)
または
(add-hook 'yatex-mode-hook '(lambda () (reftex-mode t)))
YaTeX の comment region, uncomment region, insert parens region のキーバインドを優先させる場合は以下のようにします.(参照 [[YaTeXとRefTeXの共存:http://ubutun.blogspot.jp/2011/06/yatexreftex.html]])
(add-hook 'yatex-mode-hook
'(lambda ()
(reftex-mode 1)
(define-key reftex-mode-map (concat YaTeX-prefix ">") 'YaTeX-comment-region)
(define-key reftex-mode-map (concat YaTeX-prefix "<") 'YaTeX-uncomment-region)
(define-key reftex-mode-map (concat YaTeX-prefix ")") 'YaTeX-insert-parens-region)))
**auto fill mode [#ua5c62a9]
on の場合
(add-hook 'yatex-mode-hook '(lambda () (auto-fill-mode t) (setq fill-column 70)))
off の場合
(add-hook 'yatex-mode-hook '(lambda () (auto-fill-mode -1)))
**color [#ee4c8027]
;(setq YaTeX-use-font-lock t)
; section color
;(setq YaTeX-hilit-sectioning-face '(light時のforecolor/backcolor dark時の forecolor/backcolor))
;(setq YaTeX-hilit-sectioning-face '(white/snow3 snow1/snow3))
(add-hook 'yatex-mode-hook
'(lambda () (require 'font-latex)
(font-latex-setup)
(progn
(modify-syntax-entry ?% "<" (syntax-table))
(modify-syntax-entry 10 ">" (syntax-table))
(make-variable-buffer-local 'outline-level)
(setq outline-level 'latex-outline-level)
(make-variable-buffer-local 'outline-regexp)
(setq outline-regexp
(concat "[ \t]*\\\\\\(documentstyle\\|documentclass\\|chapter\\|"
"section\\|subsection\\|subsubsection\\|paragraph\\)"
"\\*?[ \t]*[[{]")
))))
**outline-minor-mode [#nf399cda]
(add-hook 'yatex-mode-hook '(lambda () (outline-minor-mode t)))
(setq-default outline-level 'outline-level)
(defun latex-outline-level ()
(save-excursion
(looking-at outline-regexp)
(let ((title (buffer-substring (match-beginning 1) (match-end 1))))
(cond ((equal (substring title 0 4) "docu") 20)
((equal (substring title 0 4) "para") 15)
((equal (substring title 0 4) "chap") 0)
((equal (substring title 0 4) "appe") 0)
(t (length title))))))
**misc mode [#w545e459]
(add-hook 'yatex-mode-load-hook
(function
(lambda ()
(YaTeX-define-key "w" 'sdic-describe-word)
(YaTeX-define-key "\C-w" 'YaTeX-switch-mode-menu))))
**math-sign の追加 [#teb10e47]
(setq
YaTeX-math-sign-alist-private
'(
("q" "Q" "(Q)")
("z" "Z" "ZZ")
("t""text""text")
("qu" "quad" "__")
("qq" "qquad" "____")
("ls" "varlimsup" "___\nlim")
("li" "varliminf" "lim\n---")
("il" "varinjlim" "lim\n-->")
("pl" "varprojlim" "lim\n<--")
("st" "text{ s.t. }" "s.t.")
("bigop" "bigoplus" "_\n(+)~")
("bigot" "bigotimes" "_\n(x)\n ~")
))
**テンプレート [#pff757f3]
; ~/.LaTeX-templateは新規ファイル作成時に自動挿入するファイル名
(setq YaTeX-template-file "~/.LaTeX-template")
** \textit{...}など対するフォント変更 [#j27c726d]
なぜか,\textbf{...}以外の\textXX{...}のフォント変更がうまく働いていないようなので少々 ~/.emacs.d/init.el に追加。ついでに\emph{...}にも対応。
// どなたか、開発元に連絡してくださるかたがいらっしゃいませんか。
// よろしくお願いします。
;ここはすでにyatex19.elに記述されてる
;(add-to-list 'YaTeX-hilit-patterns-alist
; '(YaTeX-19-region-section-type "\\\\textbf\\>" bold))
(add-to-list 'YaTeX-hilit-patterns-alist
'(YaTeX-19-region-section-type "\\\\textgt\\>" bold))
(add-to-list 'YaTeX-hilit-patterns-alist
'(YaTeX-19-region-section-type "\\\\textit\\>" italic))
(add-to-list 'YaTeX-hilit-patterns-alist
'(YaTeX-19-region-section-type "\\\\textsl\\>" italic))
(add-to-list 'YaTeX-hilit-patterns-alist
'(YaTeX-19-region-section-type "\\\\emph\\>" italic))
(add-to-list 'YaTeX-hilit-patterns-alist
'(YaTeX-19-region-section-type "\\\\texttt\\>" tt))
**SumatraPDF との連携 (forward search) → YaTeX 1.77.5 以降は SumatraPDF の forward search に対応しています [#ra95ecfb]
**SumatraPDF との連携 (forward search) [#ra95ecfb]
***SumatraPDF を前面に表示したい場合 [#x4a4f83a]
(defun sumatrapdf-forward-search ()
(interactive)
(progn
(process-kill-without-query
(start-process
"sumatrapdf"
nil
"rundll32"
"shell32,ShellExec_RunDLL"
"SumatraPDF"
"-reuse-instance"
(expand-file-name
(concat (file-name-sans-extension (or YaTeX-parent-file
(save-excursion
(YaTeX-visit-main t)
buffer-file-name)))
".pdf"))
"-forward-search"
(buffer-name)
(number-to-string (save-restriction
(widen)
(count-lines (point-min) (point))))))))
(add-hook 'yatex-mode-hook
'(lambda ()
(define-key YaTeX-mode-map (kbd "C-c s") 'sumatrapdf-forward-search)))
SumatraPDF の forward search は C-c s または M-x sumatrapdf-forward-search RET をタイプします.
***SumatraPDF を前面に表示したくない場合 [#d9c64d40]
(defun fwdsumatrapdf-forward-search ()
(interactive)
(progn
(process-kill-without-query
(start-process
"fwdsumatrapdf"
nil
"fwdsumatrapdf"
(expand-file-name
(concat (file-name-sans-extension (or YaTeX-parent-file
(save-excursion
(YaTeX-visit-main t)
buffer-file-name)))
".pdf"))
(buffer-name)
(number-to-string (save-restriction
(widen)
(count-lines (point-min) (point))))))))
(add-hook 'yatex-mode-hook
'(lambda ()
(define-key YaTeX-mode-map (kbd "C-c f") 'fwdsumatrapdf-forward-search)))
fwdsumatrapdf は [[SumatraPDF/fwdsumatrapdf]] の fwdsumatrapdf.exe を使用します.~
fwdsumatrapdf での forward search は C-c f または M-x fwdsumatrapdf-forward-search RET をタイプします.
**Skim との連携 (forward search) → YaTeX 1.77.5 以降は Skim の forward search に対応しています [#f978a43b]
**Skim との連携 (forward search) → YaTeX 1.78 以降は Skim の forward search に対応しています [#f978a43b]
(defun skim-forward-search ()
(interactive)
(progn
(process-kill-without-query
(start-process
"displayline"
nil
"/Applications/Skim.app/Contents/SharedSupport/displayline"
(number-to-string (save-restriction
(widen)
(count-lines (point-min) (point))))
(expand-file-name
(concat (file-name-sans-extension (or YaTeX-parent-file
(save-excursion
(YaTeX-visit-main t)
buffer-file-name)))
".pdf"))
buffer-file-name))))
(add-hook 'yatex-mode-hook
'(lambda ()
(define-key YaTeX-mode-map (kbd "C-c s") 'skim-forward-search)))
displayline での forward search は C-c s または M-x skim-forward-search RET をタイプします.
-[[skim-forward-search.el:https://gist.github.com/ryseto/5710882]], [[EmacsとSkim.appでTeX・PDFシンクロ:http://d.hatena.ne.jp/setoryohei/20110102/1294003836]] も参照してください.
**Evince との連携 (forward and inverse search) [#g214bbe8]
-https://gitorious.org/latex-math-preview/synctex-for-evince-yatex/source/synctex-for-evince-yatex.el
**Evince との連携 (forward search) → YaTeX 1.77.5 以降は Evince の forward search に対応しています [#h118b5e5]
**Evince との連携 (forward search) → YaTeX 1.78 以降は Evince の forward search に対応しています [#h118b5e5]
(defun evince-forward-search ()
(interactive)
(progn
(process-kill-without-query
(start-process
"fwdevince"
nil
"fwdevince"
(expand-file-name
(concat (file-name-sans-extension (or YaTeX-parent-file
(save-excursion
(YaTeX-visit-main t)
buffer-file-name)))
".pdf"))
(number-to-string (save-restriction
(widen)
(count-lines (point-min) (point))))
(buffer-name)))))
(add-hook 'yatex-mode-hook
'(lambda ()
(define-key YaTeX-mode-map (kbd "C-c e") 'evince-forward-search)))
fwdevince は [[Evince/fwdevince]] の fwdevince を使用します.~
fwdevince での forward search は C-c e または M-x evince-forward-search RET をタイプします.
//-[[SyncTeXの設定。 Emacs(YaTeX) + Evince:http://ubutun.blogspot.jp/2012/05/synctex-emacsyatex-evince.html]] も参照してください.
**Evince との連携 (inverse search) [#tfced2b6]
Evince の inverse search については [[Emacs#Evince との連携#inverse search>Emacs#vecb4fd9]] を参照してください.~
**Okular との連携 (forward search) → YaTeX 1.77.6 以降は Okular の forward search に対応しています [#o8772291]
**Okular との連携 (forward search) [#o8772291]
(defun okular-forward-search ()
(interactive)
(progn
(process-kill-without-query
(start-process
"okular"
nil
"okular"
"--unique"
(concat (expand-file-name
(concat (file-name-sans-extension (or YaTeX-parent-file
(save-excursion
(YaTeX-visit-main t)
buffer-file-name)))
".pdf"))
"#src:"
(number-to-string (save-restriction
(widen)
(count-lines (point-min) (point))))
(buffer-file-name))))))
(add-hook 'yatex-mode-hook
'(lambda ()
(define-key YaTeX-mode-map (kbd "C-c o") 'okular-forward-search)))
okular での forward search は C-c o または M-x okular-forward-search RET をタイプします.
**zathura との連携 (forward search) [#j4034f6b]
(defun zathura-forward-search ()
(interactive)
(progn
(process-kill-without-query
(start-process
"zathura"
nil
"zathura"
"--synctex-forward"
(concat (number-to-string (save-restriction
(widen)
(count-lines (point-min) (point))))
":0:"
(buffer-name))
(expand-file-name
(concat (file-name-sans-extension (or YaTeX-parent-file
(save-excursion
(YaTeX-visit-main t)
buffer-file-name)))
".pdf"))))))
(add-hook 'yatex-mode-hook
'(lambda ()
(define-key YaTeX-mode-map (kbd "C-c z") 'zathura-forward-search)))
zathura での forward search は C-c z または M-x zathura-forward-search RET をタイプします.
**qpdfview との連携 (forward search) → YaTeX 1.77.6 以降は qpdfview の forward search に対応しています [#ic7abdb4]
**qpdfview との連携 (forward search) [#ic7abdb4]
(defun qpdfview-forward-search ()
(interactive)
(progn
(process-kill-without-query
(start-process
"qpdfview"
nil
"qpdfview"
"--unique"
(concat (expand-file-name
(concat (file-name-sans-extension (or YaTeX-parent-file
(save-excursion
(YaTeX-visit-main t)
buffer-file-name)))
".pdf"))
"#src:"
(buffer-name)
":"
(number-to-string (save-restriction
(widen)
(count-lines (point-min) (point))))
":0")))))
(add-hook 'yatex-mode-hook
'(lambda ()
(define-key YaTeX-mode-map (kbd "C-c q") 'qpdfview-forward-search)))
qpdfview での forward search は C-c q または M-x qpdfview-forward-search RET をタイプします.
*その他(改造など) [#q5a5c09f]
**includegraphicsにclipオプションを追加 [#r1cf7758]
yatexadd.elのYaTeX:includegraphicsの最後を下記のように変更
(if (string= "" str) "[clip]"
(concat "[" str ",clip]")) ;
**コンパイルプログラムの使い分け [#ga20e87e]
普段は ptex2pdf (uplatex + dvipdfmx) を使っていても,投稿先のスタイルシートによっては pdflatex を前提としているものがあります.~
TeX ソースの先頭行に例えば,
%#!pdflatex
と書いておくと、普段は typeset の時に ptex2pdf (uplatex + dvipdfmx) で処理されていても,この場合だけ pdflatex で処理してくれます.
記述例をいくつかあげると,Windows では、
%#!ptex2pdf -u -l -ot "-kanji=utf8 -no-guess-input-enc -synctex=1" hogehoge
としたり,GNU/Linux, UNIXでは,
%#!ptex2pdf -u -l -ot "-synctex=1" hogehoge
としたりできます.
*関連リンク [#fcad5d2d]
-[http://www-he.scphys.kyoto-u.ac.jp/member/shotakaha/dokuwiki/doku.php?id=toolbox:emacs:yatex:start YaTeX [ShotakahaDokuWiki]]
-[http://qiita.com/ynakayama/items/706ae9e59c1b6fd3e3d2 モダンな日本語 TeX 環境を整える]
-[http://ubutun.blogspot.jp/2014/06/ubuntu-1404emacs.html Ubuntu 14.04でのEmacsの設定]
-[[Linux Mintを導入する(8):http://note.chiebukuro.yahoo.co.jp/detail/n220718]]
-[[NTEmacsでYaTeXによるフルパス内に日本語を含む .tex のタイプセット:http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q12106481462]], [[(再)NTEmacsでYaTeXによるフルパス内に日本語を含む .tex のタイプセット:http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q11106826351]]
-[[文字コード毎の tex-command and bibtex-command 切り替え for yatex:http://meq-yo.sblo.jp/article/64863422.html]]
-[[YaTeX の設定と利用法:http://www.proton.jp/main/latex/yatex.html]]
-[[yatex-modeでPDFプレビュー:http://d.hatena.ne.jp/hico_horiuchi/20130329/1364563601]]
-[[YaTeXモードで句読点と全角英数字を変換して保存するEmacsLisp:http://d.hatena.ne.jp/FromAtom/20130112/1358009997]]
-[[Emacsへフォーカス:http://d.hatena.ne.jp/eggtoothcroc/20121106/p1]]
-[[YaTeXメモ:http://d.hatena.ne.jp/su48us/20120731]]
-[[YaTeX でタイプセットからプレビューまで一括して行う:http://ryo1miya.hatenablog.com/entry/20120614/1339697123]]
-[[Yatex導入:http://blogs.yahoo.co.jp/echotechsoft/158191.html]]
-[[Emacs+YaTex-導入編:http://d.hatena.ne.jp/tukasa1919/20110507/1304783879]]
-[[Emacs+YaTeX-使い方編:http://d.hatena.ne.jp/tukasa1919/20110509/1304937507]]
-[[YaTeX reftex-modeの動作について:http://oku.edu.mie-u.ac.jp/tex/mod/forum/discuss.php?d=308]]
-[[YaTeX World (野鳥わぁるど):http://www.nk.rim.or.jp/~naru/yatex/]] (成宮 隆之 さん)
-[[yatex キー操作:http://www.cosmo.sci.hokudai.ac.jp/~kk/emacs/yatex_key.html]]
-[[LaTeX on Linux with Emacs, YaTeX, BibTeX, RefTeX:http://www.eis.t.u-tokyo.ac.jp/~hara/tex/tex.html]] (原 貴弘 さん)
-[[YaTeXとRefTeXの共存:http://ubutun.blogspot.com/2011/06/yatexreftex.html]]
-[[SyncTeXの設定。 Emacs(YaTeX) + Evince:http://ubutun.blogspot.jp/2012/05/synctex-emacsyatex-evince.html]]
-[[SweaveでエディタとDVIビューア間の相互移動 - RjpWiki:http://www.okada.jp.org/RWiki/?Sweave%A4%C7%A5%A8%A5%C7%A5%A3%A5%BF%A4%C8DVI%A5%D3%A5%E5%A1%BC%A5%A2%B4%D6%A4%CE%C1%EA%B8%DF%B0%DC%C6%B0]]
-[[MacWiki - CarbonEmacsAndYatex:http://macwiki.sourceforge.jp/wiki/index.php/CarbonEmacsAndYatex]]
-[[EmacsとSkim.appでTeX・PDFシンクロ:http://d.hatena.ne.jp/setoryohei/20110102/1294003836]]
-http://d.hatena.ne.jp/munepi/searchdiary?word=YaTeX
-[[yatex-modeになったときにマイナーモードcdlatexを起動する:http://d.hatena.ne.jp/daharu/20111106/1320562641]]
-[[YaTeX の気になる所:http://d.hatena.ne.jp/setoryohei/20120127/1327680856]]
-[[File #osqaqi27-12106:http://www.sourcepod.com/osqaqi27-12106]]
-[[TeX Memo [Internet Archive]:http://web.archive.org/web/20100601184838/http://homepages.inf.ed.ac.uk/s0675112/tex_memo.html]]