5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VScodeでLaTeXをタイプセットする時の設定

Last updated at Posted at 2019-05-26

概要

VScodeで$\rm\LaTeX$をタイプセット(コンパイル)する際に,settings.jsonを工夫することでより便利にする方法です.
(個人的な備忘録を兼ねています.)

setting.jsonの内容

bibtexを使用する場合

ptex2pdf→pbibtex→ptex2pdfが必須となります.

settings.json
{
    "latex-workshop.latex.tools": [
        {
            "command": "ptex2pdf",
            "args": [
                "-l",
                "-ot",
                "-kanji=utf8 -synctex=1",
                "-interaction=nonstopmode",
                "%DOC%"
            ],
            "name": "Step 1: ptex2pdf"
        },
        {
            "command": "pbibtex",
            "args": [
                "%DOCFILE%",
                "-kanji=utf8"
            ],
            "name": "Step 2: pbibtex"
        },
        {
            "command": "ptex2pdf",
            "args": [
                "-l",
                "-ot",
                "-kanji=utf8 -synctex=1",
                "-interaction=nonstopmode",
                "%DOC%"
            ],
            "name": "Step 3: ptex2pdf"
        },
        {
            "command": "ptex2pdf",
            "args": [
                "-l",
                "-ot",
                "-kanji=utf8 -synctex=1",
                "-interaction=nonstopmode",
                "%DOC%"
            ],
            "name": "Step 4: ptex2pdf"
        }
    ],
    "latex-workshop.latex.recipes": [
        {
            "name": "ptex2pdf+pbibtex",
            "tools": [
                "Step 1: ptex2pdf",
                "Step 2: pbibtex",
                "Step 3: ptex2pdf",
                "Step 4: ptex2pdf"
            ]
        }
    ],
}

bibtexを使用しない場合

\label{}\ref{}の対応付けのために2回タイプセットを行っています.

settings.json
{
    "latex-workshop.latex.tools": [
        {
            "command": "ptex2pdf",
            "args": [
                "-l",
                "-ot",
                "-kanji=utf8 -synctex=1",
                "-interaction=nonstopmode",
                "%DOC%"
            ],
            "name": "Step 1: ptex2pdf"
        },
        {
            "command": "ptex2pdf",
            "args": [
                "-l",
                "-ot",
                "-kanji=utf8 -synctex=1",
                "-interaction=nonstopmode",
                "%DOC%"
            ],
            "name": "Step 2: ptex2pdf"
        }
    ],
    "latex-workshop.latex.recipes": [
        {
            "name": "platex*2",
            "tools": [
                "Step 1: ptex2pdf",
                "Step 2: ptex2pdf"
            ]
        }
    ],
}

参考:settings.jsonでコメントアウトをする方法

VScodeのsettings.jsonは、jsonc仕様なので/* */でコメントアウトが出来ます.

settings.json
/*
hoge
*/
5
2
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
5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?