3
1

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 1 year has passed since last update.

VSCodeにおけるLaTex環境構築(mac)

Last updated at Posted at 2021-12-17

概要

mac上のVSCodeでlatexを使えるようになるまでの手順を紹介する.

1. Tex Liveのインストール

Mac用のTex Live (MacTex)は次のリンクからダウンロードできる.

ダウンロードが終わったら,インストーラにしたがってインストールを行う.

ダウンロードとインストールには1時間以上かかる.

2. LaTeX Workshopのインストール

VSCodeの拡張機能であるLaTeX Workshopをインストールする.

3. settings.jsonに設定を追加する

settings.jsonの開き方は以下を参照.

settings.jsonに次を追加することで,保存時に自動的にpdfを生成してくれるようになる.


  // latex settings
  "latex-workshop.latex.tools": [
    {
      "name": "Step 1: ptex2pdf",
      "command": "ptex2pdf",
      "args": [
        "-interaction=nonstopmode",
        "-l",
        "-ot",
        "-kanji=utf8 -synctex=1",
        "%DOCFILE%.tex"
      ]
    },
    {
      "name": "Step 2: pbibtex",
      "command": "pbibtex",
      "args": [
        "%DOCFILE%",
        "-kanji=utf8"
      ]
    },
    {
      "name": "Step 3: ptex2pdf",
      "command": "ptex2pdf",
      "args": [
        "-interaction=nonstopmode",
        "-l",
        "-ot",
        "-kanji=utf8 -synctex=1",
        "%DOCFILE%.tex"
      ]
    },
    {
      "name": "Step 4: ptex2pdf",
      "command": "ptex2pdf",
      "args": [
        "-interaction=nonstopmode",
        "-l",
        "-ot",
        "-kanji=utf8 -synctex=1",
        "%DOCFILE%.tex"
      ]
    },
    {
      "name": "ptex2pdf",
      "command": "ptex2pdf",
      "args": [
        "-interaction=nonstopmode",
        "-l",
        "-ot",
        "-kanji=utf8 -synctex=1",
        "%DOC%",
      ]
    }
  ],
  "latex-workshop.latex.recipes": [
    {
      "name": "make_ptex2pdf",
      "tools": [
        "ptex2pdf"
      ]
    }
    // {
    //     "name": "toolchain",
    //     "tools": [
    //         "Step 1: ptex2pdf",
    //         "Step 2: pbibtex",
    //         "Step 3: ptex2pdf",
    //         "Step 4: ptex2pdf"
    //     ]
    // },
  ],
  "latex-workshop.view.pdf.viewer": "tab",
  "latex-workshop.latex.autoClean.run": "onFailed",

bibを含めてpdf化したい場合は,make_ptex2pdfではなく,toolchainの方を用いる.

4. latexindentのインストール

brew install perl
brew install cpanm
cpanm Log::Log4perl Log::Dispatch::File YAML::Tiny File::HomeDir Unicode::GCString

3
1
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
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?