Skip to content

Instantly share code, notes, and snippets.

@sudodo
Forked from Ikuyadeu/vscode-latex.md
Created November 29, 2023 23:20
Show Gist options
  • Save sudodo/c5e8b02c928de10c7f00ed935b02dbcb to your computer and use it in GitHub Desktop.
Save sudodo/c5e8b02c928de10c7f00ed935b02dbcb 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.toolchain": [
        {
            "command": "ptex2pdf",
            "args": [
                "-l",
                "-ot",
                "-kanji=utf8 -synctex=1",
                "%DOC%"
            ]
        },
        {
            "command": "pbibtex",
            "args": [
                "%DOCFILE%",
                "-kanji=utf8"
            ]
        },
        {
            "command": "ptex2pdf",
            "args": [
                "-l",
                "-ot",
                "-kanji=utf8 -synctex=1",
                "%DOC%"
            ]
        },
        {
            "command": "ptex2pdf",
            "args": [
                "-l",
                "-ot",
                "-kanji=utf8 -synctex=1",
                "%DOC%"
            ]
        }
],
"editor.renderControlCharacters": true

"editor.renderControlCharacters": trueはMacのSierraを利用して場合に見えない記号を表示するために必要, そうでなければ消しても大丈夫

  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