Skip to content

Instantly share code, notes, and snippets.

@taktak
Forked from Ikuyadeu/vscode-latex.md
Created September 7, 2018 11:51
Show Gist options
  • Save taktak/d1dd0b4a0a1c836122f7fa9cb9430a89 to your computer and use it in GitHub Desktop.
Save taktak/d1dd0b4a0a1c836122f7fa9cb9430a89 to your computer and use it in GitHub Desktop.
VSCode でLatexの日本語環境を作る

https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop に書いてあったbibのコンパイルを日本語に対応.

  1. VSCodeやLatexをインストールしてなければインストール(https://code.visualstudio.com/)
  2. Latex-Workshopをインストール(https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop)
  3. settings.json(Windows: ファイル > 基本設定 > 設定, Mac: Code > 基本設定 > 設定)の[ ]の間に以下を追加
    "latex-workshop.latex.tools": [
        {
            "command": "ptex2pdf",
            "args": [
                "-l",
                "-ot",
                "-kanji=utf8 -synctex=1",
                "%DOC%"
            ],
            "name": "Step 1: ptex2pdf"
        },
        {
            "command": "pbibtex",
            "args": [
                "%DOCFILE%",
                "-kanji=utf8"
            ],
            "name": "Step 2: pbibtex"
        },
        {
            "command": "ptex2pdf",
            "args": [
                "-l",
                "-ot",
                "-kanji=utf8 -synctex=1",
                "%DOC%"
            ],
            "name": "Step 3: ptex2pdf"
        },
        {
            "command": "ptex2pdf",
            "args": [
                "-l",
                "-ot",
                "-kanji=utf8 -synctex=1",
                "%DOC%"
            ],
            "name": "Step 4: ptex2pdf"
        }
    ],
    "latex-workshop.latex.recipes": [
        {
            "name": "toolchain",
            "tools": [
                "Step 1: ptex2pdf",
                "Step 2: pbibtex",
                "Step 3: ptex2pdf",
                "Step 4: ptex2pdf"
            ]
        }
    ],
    "latex-workshop.view.pdf.viewer": "tab",
   "editor.renderControlCharacters": true
  • "editor.renderControlCharacters": trueはMacのSierraを利用している場合に見えない記号を表示するために必要, そうでなければ消しても大丈夫
  • もしbibファイルがないなら
"latex-workshop.latex.tools": [
        {
            "command": "ptex2pdf",
            "args": [
                "-l",
                "-ot",
                "-kanji=utf8 -synctex=1",
                "%DOC%"
            ]
        }
],
"latex-workshop.latex.recipes": [
{
    "name": "toolchain",
    "tools": [
        "Step 1: ptex2pdf"
    ]
}],
"latex-workshop.view.pdf.viewer": "tab",
"editor.renderControlCharacters": true

だけで十分

  1. ファイルを保存またはF1キーを押してBuild Latex Projectを入力,実行するとコンパイルされる.
  2. F1キーの後, View PDF File in new tabでPDFを見れる.
  3. エラーが出た場合は 表示-> 統合ターミナルで下に端末が出るのでその中の出力を確認
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment