Sublime Text 3でLaTeXToolsに変更を加えて日本語pLaTeX文書の組版(Windows版)

いろいろやってみたが、一番ポピュラーなLaTeXToolsを使う方法をメモするのを忘れていた。

LaTeXToolsに変更を加えるには、Packages/User にLaTeXTools.sublime-settings という自分用の設定ファイルを作る。これは、Sublime Text 3からLaTeXToolsの設定メニューに入ると作成用のメニューがあるので、それを選ぶと自動的に作られる。変更はこちらに行い、本体はいじらない。変更箇所としては、TeXLiveをインストールした場所の指定、TeXのdistroとしてMikTeXじゃなくてTeXLiveを選んでいること、そして、日本語LaTeXを使うために、command に変更を加える。

まずは、TeXLiveの場所、PDFのPreviewerとしてSumatraPDFを設定、などなど。

// ------------------------------------------------------------------
// Platform settings: adapt as needed for your machine
// ------------------------------------------------------------------

	"osx": 	{
		// Path used when invoking tex & friends; MUST include $PATH
		"texpath" : "$PATH:/Library/TeX/texbin:/usr/texbin:/usr/local/bin:/opt/local/bin"
		// Path to PDF viewer, if needed
		// TODO think about it. Also, maybe configure it here!
	},


	"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" : "C:\\texlive\\2016\\bin\\win32;$PATH",
		// TeX distro: "miktex" or "texlive"
		"distro" : "texlive",
		// Command to invoke Sumatra. If blank, "SumatraPDF.exe" is used (it has to be on your PATH)
		"sumatra": "",
		// 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
	},

	"linux" : {
		// Path used when invoking tex & friends; MUST include $PATH
		"texpath" : "$PATH:/usr/texbin",
		// Command to invoke Python. Useful if you have Python installed in a
		// non-standard location or want to use a particular version of python.
		// Both Python2 and Python3 are supported, but must have the DBus bindings
		// installed.
		"python": "",
		// The name of the ST2 or ST3 executable. On Ubuntu, both subl and sublime-text are
		// available for ST2; adjust as needed for other platforms, and for ST3
		"sublime": "sublime-text",
		// How long to wait after evince or okular has launched before sending a sync message
		// in seconds, floating point; choose 2.0 or 3.0 on a slower machine, 0.5 on a fast one
		// Note: only tweak this if sync after launching the PDF viewer does not seem to work,
		// or if the PDF viewer opens instantly and you don't want to wait.
		// Default: 1.5 (works on my MBP4,1...)
		"sync_wait": 1.5,
		// Command to invoke Sublime Text. Used if the keep_focus toggle is true.
		// If blank, "subl" or "sublime_text" will be used.
		"sublime_executable": "",
		// how long (in ms) 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
	},

次に、builder settings のところに、latexmk を呼び出すときに使う command を定義する。これで完了。

	// OPTION: "builder_settings"
	// Specify builder-dependent settings and preferences
	// Possible values: see README or documentation provided with
	// third-party build engine.
	// Builder setting can be general or OS-dependent

	"builder_settings" : {

		// General settings:
		// See README or third-party documentation
		"command" : ["latexmk", "-cd",
			"-e", "$latex = 'platex %O -no-guess-input-enc -kanji=utf8 -interaction=nonstopmode -synctex=1 %S'",
			"-e", "$biber = 'biber %O --bblencoding=utf8 -u -U --output_safechars %B'",
			"-e", "$bibtex = 'pbibtex %O %B'",
			"-e", "$makeindex = 'pmendex %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
		}
	},

コメントを残す

メールアドレスが公開されることはありません。