事象発生日:2017-04-20
記事公開日:-
アクセス数:17946
WindowsのLaTeX環境をどうにかしたかったので,Sublimeで編集,ビルドをできるようにした.
参考サイトもあったのだがそれだけでは動かなかったので,試行錯誤した結果をここでまとめる.
PDFビュアーとしてSumatra PDFを使用する.他のものを使う場合は該当箇所を適宜変更すること.
Microsoft Windows 10 Home (64bit)
Sublime Text Build 3126 (portable version)
Ghostscript v9.07
W32TeX
Latexmk Version 4.39
W32TeXにデフォルトで入っている.
Perl 5, version 22, subversion 1
Latexmkを使用するために必須.
Sumatra PDF Portable v3.1.2 (PDF Viewer)
inverse searchが使いたかった.
なお,
Perl (${perl_path}\bin)
W32TeX (${w32tex_path}\bin)
Latexmk (${latexmk_path}\bin)
Ghostscript (${gs_path}\bin, ${gs_path}\lib)
のパスが通ってることは前提とする.
LaTeXTools Plugin version 3.13.5 (2017-03-31) (Sublime Package)
Sumatra PDF v3.1.2 64-bit (PDF Viewer)
Sublimeのメニュー [Preferences] → [Package Control] → install package と入力 → LaTeXTools と入力し,インストール.
Sublimeのメニュー [Preferences] → [Package Settings] → [LaTeXTools] → [Settings - User] を選択.「ユーザーディレクトリにコピーを作りますか?」という感じのことを聞かれるが,Yesを選択.
この設定ファイルをいじっていく.
Platform settings: adapt as needed for your machine の windows の項を以下に変更.
([Settings - Default] で209行目に対応)
"windows": {
// Path used when invoking tex & friends; "" is fine for MiKTeX
// For TeXlive 2011 (or other years) use
// "texpath" : "C:\\texlive\\2011\\bin\\win32;$PATH",
"texpath" : "",
// TeX distro: "miktex" or "texlive"
"distro" : "miktex",
// Command to invoke Sumatra. If blank, "SumatraPDF.exe" is used (it has to be on your PATH)
"sumatra": "${SumatraPDF_path}\\SumatraPDFPortable.exe",
// Command to invoke Sublime Text. Used if the keep_focus toggle is true.
// If blank, "subl.exe" or "sublime_text.exe" will be used.
"sublime_executable": "",
// how long (in seconds) to wait after the jump_to_pdf command completes
// before switching focus back to Sublime Text. This may need to be
// adjusted depending on your machine and configuration.
"keep_focus_delay": 0.5
},
Build engine settings の builder_settings の項を以下に変更.
([Settings - Default] で398行目に対応)
"builder_settings" : {
// General settings:
// See README or third-party documentation
"command" : ["latexmk", "-cd",
"-e", "$latex = 'uplatex %O -interaction=nonstopmode -synctex=1 %S'",
"-e", "$biber = 'biber %O --bblencoding=utf8 -u -U --output_safechars %B'",
"-e", "$bibtex = 'upbibtex %O %B'",
"-e", "$makeindex = 'makeindex %O -o %D %S'",
"-e", "$dvipdf = 'dvipdfmx %O -o %D %S'",
"-f", "-norc", "-gg", "-pdfdvi"],
// (built-ins): true shows the log of each command in the output panel
"display_log" : false,
// Platform-specific settings:
"osx" : {
// See README or third-party documentation
},
"windows" : {
// See README or third-party documentation
},
"linux" : {
// See README or third-party documentation
}
},
Sublimeのメニュー [Preferences] → [Package Settings] → [LaTeXTools] → [Check System] を選択.
すると以下のような結果が表示される.
Variable Value
-------- -----
PATH ${環境変数のPATH}
Program Location Status Version
------- -------- ------ -------
sublime ${sublime_path}\sublime_text.exe available Sublime Text Build 3126
texify missing unavailable
pdflatex ${w32tex_path}\bin\pdflatex.exe available pdfTeX 3.14159265-2.6-1.40.15 (TeX Live 2014/W32TeX)
xelatex ${w32tex_path}\bin\xelatex.exe available XeTeX 3.14159265-2.6-0.99991 (TeX Live 2014/W32TeX)
lualatex ${w32tex_path}\bin\lualatex.exe available This is LuaTeX, Version beta-0.79.1 (TeX Live 2014/W32TeX) (rev 4971)
biber ${w32tex_path}\bin\biber.exe available biber version: 1.8
bibtex ${w32tex_path}\bin\bibtex.exe available BibTeX 0.99d (TeX Live 2014/W32TeX)
bibtex8 ${w32tex_path}\bin\bibtex8.exe available This is 8-bit Big BibTeX version 0.99d
kpsewhich ${w32tex_path}\bin\kpsewhich.exe available kpathsea version 6.2.0
convert restart required unavailable
ghostscript ${gs_path}\bin\gswin32c.exe available GPL Ghostscript 9.07 (2013-02-14)
Builder Status
------- ------
traditional available
Builder Setting Value
--------------- -----
command ['latexmk', '-cd', '-e', "$latex = 'uplatex %O -interaction=nonstopmode -synctex=1 %S'", '-e', "$biber = 'biber %O --bblencoding=utf8 -u -U --output_safechars %B'", '-e', "$bibtex = 'upbibtex %O %B'", '-e', "$makeindex = 'makeindex %O -o %D %S'", '-e', "$dvipdf = 'dvipdfmx %O -o %D %S'", '-f', '-norc', '-gg', '-pdfdvi']
display_log False
linux {}
osx {}
windows {}
TeX Root
--------
${とある.texのあったパス.最後にビルドしたファイルパス?}
LaTeX Engine
------------
pdflatex
Viewer Status Location
------ ------ --------
sumatra available ${PDF_viewer_path}
Sublime上で,Ctrl + b でビルドが可能.
Ctrl + Shift + b でビルドオプションの選択が可能となるが,今回の設定ではそのなかでも "LaTeX - Traditional" を想定している.
PDFビュアーとしてSumatra PDFを使用している場合,ビルド時の.texファイル上のカーソル位置がハイライトされ,Sumatra PDFが更新される.
レジストリを汚したくないので,基本的にPoetableソフトを使う人間なのだが,Sumatra PDF Portable Versionでは,inverse searchが使えないことが判明.
まあ,Portableソフトではすべて相対パス化する必要があり,絶対パス指定できないので当たり前といえば当たり前だが....ユーザーオプションとしては残して欲しかった....
というわけで,Sumatra PDFの通常バージョンをインストール.
さらに「」で設定した ${SumatraPDF_path} を変更する.
そして,Sumatra PDFのメニュー → [設定] → [オプション] → [逆順検索コマンドラインの設定] を,"${sublime_path}\sublime_text.exe" "%f:%l" と設定する.
PDFビュアーはなんでもいいのだが,Adobe Readerのようなファイルをロックするものは使いにくい.
ファイルをロックされていると,PDFを開いたままのPDFコンパイルができなくなってしまう.
名前
Email (※公開されることはありません)
コメント