VSCode and LaTeX workshop

Reference VSCode で最高の LaTeX 環境を作る - Qiita

  • Jump from source to preview: Ctrl+Alt+j (Command+Opt+j)
  • Jump from preview to source : Ctrl+click (Command+click)
  • .latexmkrc
    "latex-workshop.view.pdf.viewer": "tab",
    "latex-workshop.intellisense.package.enabled": true,
    "latex-workshop.view.pdf.zoom": "page-width",
    "latex-workshop.latex.clean.fileTypes": [
        "*.aux",
        "*.bbl",
        "*.blg",
        "*.idx",
        "*.ind",
        "*.lof",
        "*.lot",
        "*.out",
        "*.toc",
        "*.acn",
        "*.acr",
        "*.alg",
        "*.glg",
        "*.glo",
        "*.gls",
        "*.ist",
        "*.fls",
        "*.log",
        "*.fdb_latexmk",
        "*.snm",
        "*.nav",
        "*.dvi",
        "*.synctex.gz"
    ],
    "latex-workshop.latex.outDir": "out",
    "latex-workshop.latex.recipes": [
        {
            "name": "latexmk",
            "tools": [
                "latexmk"
            ]
        },
    ],
    "latex-workshop.latex.tools": [
        {
            "name": "latexmk",
            "command": "latexmk",
            "args": [
                "-silent",
                "--shell-escape",
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-pdf",
                "-outdir=%OUTDIR%",
                "%DOC%"
            ],
        },
    ],

.latexmkrc

#!/usr/bin/env perl

# LaTeX
$latex = 'xelatex -synctex=1 -shell-escape -halt-on-error -file-line-error %O %S';
$max_repeat = 5;

# BibTeX
$bibtex = 'bibtex %O %S';
$biber = 'biber --bblencoding=utf8 -u -U --output_safechars %O %S';

# index
$makeindex = 'mendex %O -o %D %S';

# DVI / PDF
$dvipdf = 'xdvipdfmx %O -o %D %S';
$pdf_mode = 3;

# preview
$pvc_view_file_via_temporary = 0;
if ($^O eq 'linux') {
    $dvi_previewer = "xdg-open %S";
    $pdf_previewer = "xdg-open %S";
} elsif ($^O eq 'darwin') {
    $dvi_previewer = "open -a Skim %S";
    $pdf_previewer = "open -a Skim %S";
} else {
    $dvi_previewer = "start %S";
    $pdf_previewer = "start %S";
}

# clean up
$clean_full_ext = "%R.synctex.gz"

VSCode and rewrap

Alt (Opt) + q to rewrap.

 "[latex]": {
    "editor.formatOnSave": true,
    "editor.formatOnPaste": true,
    "files.trimTrailingWhitespace": true,
    "editor.rulers": [80],
    "rewrap.wholeComment": true,
    "rewrap.autoWrap.enabled": true,
    "rewrap.wrappingColumn": 80,
  },

Formatting error on mac

[LaTeX] [Mojave] Mac で latexindent が上手く動作しないときの対処法 - Qiita

You must have `pygmentize' installed ...

minted - Pygmentize not installed error on Visual Studio Code - TeX - LaTeX Stack Exchange