0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

vscode編

Last updated at Posted at 2025-07-10

拡張機能

vscodeでtexを編集するときに必須の拡張機能2つです
Japanese Language Pack for Visual Studio Code LaTeX Workshop
Japanese Language Pack for Visual Studio Codeでvscodeを日本語化します。
LaTeX Workshopを入れることでやることが減って、texの編集に集中できます。

vscodeを再起動することで拡張機能を反映することができます。

設定

Ctrl+Shift+pでコマンドパレットを開いた後、settingsと入力し基本設定:ユーザー設定を開く(JSON)からsettings.jsonを開き、下のコードを貼り付けてください。

settings.json
{
  "latex-workshop.latex.autoBuild.run": "onSave",
  "latex-workshop.latex.recipe.default": "CompLite",
  "latex-workshop.view.pdf.viewer": "tab",
  "latex-workshop.latex.tools": [
    {
      "name": "platex",
      "command": "platex",
      "args": [
        "-file-line-error",
        "-halt-on-error",
        "%DOC%.tex"
      ]
    },
    {
      "name": "dvipdfmx",
      "command": "dvipdfmx",
      "args": ["%DOC%.dvi"]
    }
  ],
  "latex-workshop.latex.recipes": [
    {
      "name": "CompLite",
      "tools": ["platex","dvipdfmx"]
    }
  ]
}

この設定をするとctrl+sでtexファイルを保存すると、PDFが作られます。vscode上からPDFを確認することも可能です。
コンパイルに失敗すると、間違いがあるところに、赤い線が引かれるので修正して保存するとPDFファイルの完成です。

設定の説明

"latex-workshop.latex.autoBuild.run": "onSave":ファイルを保存したときにPDFが生成されるようにします
"latex-workshop.latex.recipe.default": "CompLite":デフォルトのレシピを設定します。
"latex-workshop.view.pdf.viewer": "tab":vscode内でPDFを見るように設定します。
"latex-workshop.latex.tools":ptalexとdvipdfmxの設定をします。
"latex-workshop.latex.recipes":recipeが実行されたときに使うtoolを設定します

フラッグの説明 `"-file-line-error"`:vscodeがエラーの場所を認識できるようにします。 `-halt-on-error`:エラーが起きたときにコンパイルを中止します。 `%DOC%`:latex-workshopで定義されたプレースホルダーです。コンパイルされたtexファイルの拡張子なしpathに変換されます。

latex-workshopのGitHub

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?