VSCode로 LaTeX를 빌드할 수 있도록 허용

환경



Windows 10 Home
Visual Studio Code 버전 1.51.1
LaTeX Workshop v8.14.0

발생한 문제



Visual Studio Code에 LaTeX Workshop을 넣어 빌드하려고 하면 다음과 같은 오류가 나왔다.

그래서 Open compiler log를 클릭하여 출력을 보면 다음과 같은 표시가.
No pages of output.
Transcript written on c:/Users/ユーザー名/Desktop/textest/1.log.
Latexmk: Log file says no output from latex
Latexmk: For rule 'pdflatex', no output was made
Collected error summary (may duplicate other messages):
  pdflatex: Command for 'pdflatex' gave return code 1
      Refer to 'c:/Users/ユーザー名/Desktop/textest/1.log' for details
Latexmk: Use the -f option to force complete processing,
 unless error was exceeding maximum runs, or warnings treated as errors.
=== TeX engine is 'pdfTeX'
Latexmk: Errors, so I did not complete making targets

분명히 Latexmk에서 pdflatex가 호출되었습니다. TeXworks를 사용했을 때 pdflatex는 일본어를 다룰 수 없다는 제약이 있었음을 기억하고 그 때와 마찬가지로 ptex2pdf를 사용하도록 변경했다.

해결책



다음은 settings.json에 기술되어 있다.

settings.json
{
    "latex-workshop.latex.recipes": [
        {
            "name": "ptex2pdf",
            "tools": [
                "ptex2pdf"
            ]
        }
    ],
    "latex-workshop.latex.tools": [
        {
            "name": "ptex2pdf",
            "command": "ptex2pdf",
            "args": [
                "-l",
                "-ot",
                "-kanji=utf8 -synctex=1",
                "%DOC%"
            ]
        }
    ],
    "latex-workshop.view.pdf.viewer": "tab",
}

이제 Visual Studio Code에서 빌드를 할 수 있게 되어 PDF의 미리보기도 할 수 있게 되었다.

참고



TeXworks/설정
VSCode 플러그인 "LaTeX Workshop"설정

좋은 웹페이지 즐겨찾기