Help us understand the problem. What is going on with this article?

Visual Studio CodeでTeX

More than 1 year has passed since last update.

素晴らしいextensionに感謝

前提条件: MacTeX等をインストール済で,latexmk --helpコマンドがターミナルから打てること.

英語のみであればそのままでも良いが,日本語用にuplatexを使っている場合は以下のようにvscodeの設定を上書きする.これは英語の場合tex->pdfのところが,日本ではtex->dvi->pdfという方式が主流のため.

"latex-workshop.latex.toolchain": [
    {
        "command": "latexmk",
        "args": [
            "-latex=uplatex", 
            "-synctex=1",
            "-interaction=nonstopmode",
            "-file-line-error",
            "-pdfdvi",
            "%DOC%"
        ]
    }
]

加えて,latexmkがdvipdfmxを扱えるように,~/.latexmkrcに以下の記述を行う.

~/.latexmkrc
#!/usr/bin/env perl
$dvipdf = 'dvipdfmx %O -o %D %S';

これによってvscodeでtexが書けるようになる.pdfの表示もvscode内で完結でき,更新すると自動で再コンパイルしてくれる.補完も非常に高性能.

追記

vscode関連のバグによって\b(backspace)の文字コードが入り込んでしまい,コンパイルに失敗するようになることがある.対症療法としては制御文字をvscodeで表示する設定にすれば気づくことが可能.

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away