Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
VSCode でLatexの日本語環境を作る

https://github.com/James-Yu/LaTeX-Workshop/wiki/Install に書いてあった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"
    ],
    "name": "Step 1: ptex2pdf"
}],,
"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. エラーが出た場合は 表示-> 統合ターミナルで下に端末が出るのでその中の出力を確認
@Yukishita26

This comment has been minimized.

Copy link

commented Jan 21, 2019

bibファイルがない場合のコードで
"latex-workshop.latex.tools":"name": "Step 1: ptex2pdf,"が必要では?

@Ikuyadeu

This comment has been minimized.

Copy link
Owner Author

commented Mar 28, 2019

@Yukishita26 ありがとうございます.修正を行いました.

@qqhann

This comment has been minimized.

Copy link

commented Apr 23, 2019

「もしbibファイルがないなら」でlatex-workshop.latex.recipesが2度出てきますが意図的ですか?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.