Visual Studio Code > LaTeX
Repository †Changelog †
Issues †
Usage †TeX ファイルを保存すると自動的にビルドされる ビルドに成功すると
と表示される ファイルの内容を変更して Ctrl+S で保存するとビルドコマンドが実行されます。ファイルの内容を変更していない状態でビルドコマンドを実行したい場合は Ctrl+Alt+B でビルドコマンドを実行します。 Ctrl+Alt+V あるいは右上の PDF ファイルのアイコンを左クリックで指定した PDF ビューアで PDF ファイルを表示します。 タブで開く場合は右側に新しいタブで PDF ファイルを表示します。 ブラウザで開く場合は既定のブラウザで PDF ファイルを表示します。 Ctrl+Alt+J で forward search,Ctrl+左クリックで inverse search を行います。 Ctrl+Alt+X あるいは左側の Activity Bar の TeX アイコンをクリックで以下のリストが表示されリストの項目から Action を選択すると実行されます。
Settings †Ctrl+Comma で Settings タブを開きます。 「設定の検索」で「Tools」を入力して「Latex-workshop > Latex: Tools」を探して「settings.json で編集」をクリックします。 左側に既定のユーザー設定、右側にユーザー設定 (settings.json) が開かれます。 左側に表示されている既定のユーザー設定の latex-workshop.latex.tools は以下のように設定されています。 "latex-workshop.latex.tools": [ { "name": "latexmk", "command": "latexmk", "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "-pdf", "%DOC%" ] }, { "name": "pdflatex", "command": "pdflatex", "args": [ "-synctex=1", "-interaction=nonstopmode", "-file-line-error", "%DOC%" ] }, { "name": "bibtex", "command": "bibtex", "args": [ "%DOCFILE%" ] } ] Windows で Latexmk-upLaTeX を使用する場合は右側に表示されている settings.json の {} の中に以下の設定を追加・保存して既定のユーザー設定を上書きします。 "latex-workshop.latex.tools": [ { "name": "latexmk", "command": "latexmk", "args": [ "-e", "$latex=q/uplatex %O -kanji=utf8 -no-guess-input-enc -synctex=1 -interaction=nonstopmode -file-line-error %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", "-pdfdvi", "%DOC%" ] } ] Windows で Latexmk-LuaLaTeX を使用する場合は右側に表示されている settings.json の {} の中に以下の設定を追加・保存して既定のユーザー設定を上書きします。 "latex-workshop.latex.tools": [ { "name": "latexmk", "command": "latexmk", "args": [ "-e", "$lualatex=q/lualatex %O -synctex=1 -interaction=nonstopmode -file-line-error %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", "-pdflua", "%DOC%" ] } ] macOS, Linux で Latexmk-upLaTeX を使用する場合は右側に表示されている settings.json の {} の中に以下の設定を追加・保存して既定のユーザー設定を上書きします。 "latex-workshop.latex.tools": [ { "name": "latexmk", "command": "latexmk", "args": [ "-e", "$latex=q/uplatex %O -synctex=1 -interaction=nonstopmode -file-line-error %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", "-pdfdvi", "%DOC%" ] } ] macOS, Linux で Latexmk-LuaLaTeX を使用する場合は右側に表示されている settings.json の {} の中に以下の設定を追加・保存して既定のユーザー設定を上書きします。 "latex-workshop.latex.tools": [ { "name": "latexmk", "command": "latexmk", "args": [ "-e", "$lualatex=q/lualatex %O -synctex=1 -interaction=nonstopmode -file-line-error %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", "-pdflua", "%DOC%" ] } ] タブで PDF を開く †settings.json の {} の中に以下の設定を追加・保存します。 "latex-workshop.view.pdf.viewer": "tab" 既定のブラウザで PDF を開く †settings.json の {} の中に以下の設定を追加・保存します。 "latex-workshop.view.pdf.viewer": "browser" SumatraPDF との連携 †forward search †settings.json の {} の中に以下の設定を追加・保存します。 "latex-workshop.view.pdf.viewer": "external", "latex-workshop.view.pdf.external.command": { "command": "C:/Program Files/SumatraPDF/SumatraPDF.exe", "args": [ "-reuse-instance", "%PDF%" ] }, "latex-workshop.view.pdf.external.synctex": { "command": "C:/Program Files/SumatraPDF/SumatraPDF.exe", "args": [ "-reuse-instance", "-forward-search", "%TEX%", "%LINE%", "%PDF%" ] } inverse search †SumatraPDF の [☰] > [設定(S)] > [オプション(O)...] の「逆順検索コマンドラインの設定」に以下の設定をします。 "C:\Program Files\Microsoft VS Code\bin\code.cmd" -g "%f:%l" |