LoginSignup
1
1

自分のLaTeX文書編集環境(主にVScode)を公開してみる

Posted at

はじめに

これは私のLaTeX文書の編集環境を公開してみるものであり,内容の解説を意図したものではありません。(もちろん、ある程度は解説します。)
この記事を作成した目的は大きく分けて2つで、

  • 人に教えるため
  • 初心者でも便利な編集環境を作成できるようにする

世の中に存在する「TeXのVScode環境構築ガイド」のような記事は解説が多く、結局何をすればよいのか分からないという状況に陥りがちです。もちろんそれらの記事を否定したいわけではなく、必要最小限の情報だけを提供することでそれらとは別の役割を果たすことをこの記事は目標としています。
ちなみに、1つめの「人に教えるため」というのは人のパソコンにLaTeXの環境を作ることが多いので、記事としてまとめてあると便利だなという非常に個人的な理由です。
もしこの記事だけでわからなければ、記事の最後に参考にした記事等を並べておくので、そちらを参考にしてください

前提

TeXLive2023とVScodeをインストールしてください。それぞれについての説明は他の記事・サイトに任せます。

  • TeXLive2023のインストール
    このサイトを見てもらえばわかると思います。

  • VScodeのインストール
    このサイトにアクセスして各OSに対応したものを選択してインストーラーをダウンロード、ダブルクリックなどで実行すればokです。

VScodeはいやだ!という人へ

VScodeはいやだ!という人へ

VScodeは複雑そうなイメージがありますよね。もし問題が生じたときにどう対処していいのかわからないという不安がありますよね。ちょっと前の私もまさにその状態で、texを使う際に実は別のエディタを使っていました。
TeXstudioというtex文書専用のエディタがあります。
macでも動きますが、どちらかというとWindowsの方が適しています。
このサイトにアクセスしてインストーラーをダウンロード、実行すればインストール完了です。
このサイトの通りに初期設定をすればもうtexを使えるようになります。
macの場合はインストールしてきたtexstudioをアプリフォルダに移動させる必要があるのと、
このサイトの下の方にあるコマンド(下の画像)をターミナルで実行する必要があります。
image.png

VScodeの設定(必須編)

やらなければならないことは3つあります。

  • LaTeX-Workshopのインストール
  • settings.jsonの設定
  • .latexmkrcの作成

順に説明していきます。

LaTeX-Workshopのインストール

ではインストールしたVScodeを開いてみましょう。
( インストールしたときの記憶が残ってないので分からないのですが、ログイン等が必要だったら、してください。)

VScodeを開くと、左端に次のようなタブがあると思うので、そのうちの3+1の正方形からなっている図形(下記画像では下から2番目)をクリックします。
image.png
そうしたら、LaTeX Workshopと検索して、出て来たものをインストールします。

settings.jsonの設定

Ctrl+Shift+PをしてpousetjsとするとPreferences: Open User Settings (JSON)が表示されるのでこれを選択して、{}(中かっこ)があると思うので、その中に以下の内容をコピペします。

長くてじゃまなので折りたたんでおきます。:

settings.jsonの内容
settings.json
    "[latex]": {
        // settings as an editor
        "editor.wordWrap": "on",
        "editor.wordSeparators": "{}&",
        "editor.tabSize": 2,
        "editor.insertSpaces": true,
        "editor.detectIndentation": false,
        "editor.suggestSelection": "recentlyUsedByPrefix",
        "editor.quickSuggestions": {
          "other": true,
          "comments": false,
          "strings": false
        },
        "editor.unicodeHighlight.invisibleCharacters": true,
        "editor.stickyScroll.enabled": true,
        "editor.formatOnPaste": false,
        "editor.snippetSuggestions": "top",
    },
    "latex-workshop.latex.recipes": [
        {
            "name": "#latexmk",
            "tools": [
                "latexmk"
            ]
        },
        {
            "name": "#upLaTeX: 2 times Build",
            "tools": [
                "uplatex=non-synctex",
                "uplatex2pdf",
            ]
        },
        {
            "name": "#upLaTeX: 3 times Build",
            "tools": [
                "uplatex=non-synctex",
                "uplatex=non-synctex",
                "uplatex2pdf",
            ]
        },
        {
            "name": "#upLaTeX: ALL Build",
            "tools": [
                "uplatex=non-synctex",
                "upbibtex",
                "uplatex=non-synctex",
                "uplatex=non-synctex",
                "uplatex2pdf",
            ]
        },
    ],
    "latex-workshop.latex.tools": [
        {
            "name": "latexmk",
            "command": "latexmk",
            "args": [
                "-latex=uplatex",
                "-pdfdvi",
                "-synctex=1",
                "-interaction=nonstopmode",
                "-outdir=%OUTDIR%",
                "%DOCFILE%"
            ],
        },
        {// upLaTeX non-Synctex mode
            "name": "uplatex=non-synctex",
            "command": "uplatex",
            "args": [
                "-kanji=utf8",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-outdir=%OUTDIR%",
                "%DOCFILE%",
            ]
        },
        {// upLaTeX ptex2pdf mode
            "name": "uplatex2pdf",
            "command": "ptex2pdf",
            "args": [
                "-u",
                "-l",
                "-ot",
                "-kanji=utf8",
                "-synctex=1",
                // "-interaction=nonstopmode",
                // "-file-line-error",
                "-outdir=%OUTDIR%",
                "%DOCFILE%",
            ]
        },
        {// upBibTeX
            "name": "upbibtex",
            "command": "upbibtex",
            "args": [
                "-kanji=utf8",
                "-outdir=%OUTDIR%",
                "%DOCFILE%",
            ]
        },
    ],
    "latex-workshop.latex.clean.fileTypes":[
        "*.aux",
        "*.fdb_latexmk",
        "*.fls",
    ],
    "latex-workshop.latex.autoBuild.run": "never",
    "latex-workshop.latex.recipe.default": "lastUsed",
    "latex-workshop.latex.autoClean.run": "onBuilt",
    "latex-workshop.latex.clean.method": "glob",
    "latex-workshop.latex.autoBuild.cleanAndRetry.enabled": true,
    "latex-workshop.latex.rootFile.doNotPrompt": true,

    "latex-workshop.intellisense.package.enabled": true,
    "latex-workshop.intellisense.includegraphics.preview.enabled": true,
    "latex-workshop.message.information.show": true,
    "latex-workshop.view.pdf.viewer": "tab",
    "latex-workshop.hover.preview.mathjax.extensions": [
        "boldsymbol",
        "mhchem",
        "mathtools",
        "physics",
        "cases",
        "verb",
    ],

どの部分がどのような役割を果たしているのか、大雑把に説明しておきます。後で色々と知った後に設定を見直す際に活用してください。

まず[latex]:{…}の部分はテキストエディターとしてのVScodeの設定を書いていて、「latex文書を書いている際にはこの設定を有効化するよ」ということを言っています。
この部分は、あると便利ですが、この部分はなくても構いません。

次に、
"latex-workshop.latex.recipes":[…]"latex-workshop.latex.tools":[…]の部分はどうやってtexファイルを処理してpdf化するかの方法を指定しています。
なくてはならないですが、もちろん他の指定方法もあり、人によって設定がバラバラだったりします。(これがTeXの地味にヤバいところ…)

また、"latex-workshop.latex.clean.fileTypes":[…]の部分とlatex-workshop.latex.~でまとまっている部分は、その処理方法に色々と注文をつけています。
重要な部分です。

最後の部分は、texファイルを編集する際に編集を快適化する、予測変換機能やpdfのプレビュー方法を指定しています。

latexの設定ではないので省略したのですが、VScodeを今回初めて入れたという人は、加えて

settings.json
    "editor.suggest.snippetsPreventQuickSuggestions": false,
    "editor.bracketPairColorization.enabled": true,

を書いておくと良いです。

知識がある人への注:
LaTeX-Workshopの仕様変更があり、9.9.0以降では中間ファイルの削除が上手くいかないことが起こり得ます。その時にはsettings.jsonに
"latex-workshop.latex.clean.method":glob
を追加してください。

latexmkrcの作成

いや、別にVScodeじゃないんですけど、必要なことに変わりはないので、ここに書きます。
ローカルディスクのユーザーのUSER NAMEに行って、( つまりC:/Users/<USER NAME>のことです).latexmkrcというファイルを作って保存します。

メモ帳を使う場合は、拡張子をすべてのファイルにしてファイル名を.latexmkrc.として保存すればよいです。(保存後に最後の.は消えます)

そのファイルに次の内容をコピペします。

.latexmkrcの内容
.latexmkrc
#!/usr/bin/env perl

# LaTeX
$latex = 'uplatex -kanji=utf8 -no-guess-input-enc -halt-on-error -file-line-error %O %S';
$max_repeat = 5;

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

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

# DVI / PDF
$dvipdf = 'dvipdfmx %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 %S";
    $pdf_previewer = "open %S";
} else {
    $dvi_previewer = "start %S";
    $pdf_previewer = "start %S";
}

VScodeの設定 (選択編)

今から述べることは別に書かなくてもよいです。
「こういう設定をして、私は編集を効率化している」という紹介です。もちろん害はないので、ぜひ採用してもらえたらなと思っています。

することは2つです。

  • キーボードショートカットの設定
  • スニペットの登録

キーボードショートカットの設定

Ctrl+Shift+Pをしてkeyboardと入力するとPreferences:Open Keyboard Shortcuts (JSON)と出てくると思うので、それを選択します。

そこにある[]の中に次の内容をコピペします。

キーボードショートカットの内容
keybindings.json
    {
        "key": "ctrl+alt+t",
        "command": "latex-workshop.recipes",
        "when": "editorLangId == latex",
    },
    {
        "key": "ctrl+shift+k",
        "command": "latex-workshop.kill",
        "when": "editorLangId == latex",
    },
    {
        "key": "ctrl+shift+e",
        "command": "latex-workshop.compilerlog",
        "when": "workbench.panel.output.active && editorLangId == latex",
    },
    {
        //  Resettings build shortcut: same shortcut for TeXworks.
        //  This command will execute the last recipe executed.
        //  settings "latex-workshop.recipe.default": "lastUsed" at settings.json.
        "key": "f5",
        "command": "latex-workshop.build",
        "when": "editorLangId == latex"
    },

スニペットの登録

Ctrl+Alt+P をして、user snippets と入力すると
Preferences: Configure User Snippets が表示されるのでこれを選択します。
また、言語は LaTeX を選択します。

latex.jsonが開かれると思うので、その{}の中に次の内容をコピペします。

スニペットの内容
latex.json
	//Snippets for latex
	//You can search snippets by typing "prefix" in vscode.

	"Snippett.show.categories":{
		"prefix": "snippetcategories",
		"body": [
			"% categories of snippets->",
			"% category : prefix",
			"Template : tmpshow",
			"Documentclass : clsshow",
			"Packages : pkgshow",
			"Macros : mcrshow",
			"Environment : envshow",
			"Command : cmdshow",
		],
	},

	/////////////////////////////////////////////
	//Snippets for Templates/////////////////////
	/////////////////////////////////////////////

	"Template.show":{
		"prefix":"tmpshow",
		"body":[
			"% Templates->",
			"% name : prefix",
			"report_main : report",
			"report_sub : subreport",
			"test : test",
			"gnuplot : gnuplot",
		],
		"description": "Show snippets for templates"
	},
	////
	"Template.report_main":{
		"prefix": "report",
		"body": [
			"\\RequirePackage{plautopatch}",
			"\\documentclass[uplatex,dvipdfmx,titlepage]{jsarticle}",
			"",
			"\\usepackage{subfiles}% If you don't want to split files, you don't need this package.",
			"\\graphicspath{{${1:path_to_imagefolder(from main_file)}}",
			"",
			"\\title{${2:title}}",
			"\\author{${3:Haruto Shimojo}}",
			"\\date{${4:\\today}}",
			"",
			"\\numberwithin{equation}{subsection}",
			"\\numberwithin{figure}{subsection}",
			"\\numberwithin{table}{subsection}",
			"",
			"\\begin{document}",
			"\t\\maketitle",
			"\t${0}",
			"\\end{document}",
		],
		"description": "Insert report(main) template"
	},
	"Template.report_sub":{
		"prefix":"subreport",
		"body":[
			"\\documentclass[${1:path_to_mainfile}]{subfiles}",
			"\\graphicspath{{${2:path_to_imagefolder(from subfile)}}",
			"\\setcounter{section}{${3:first section number -1}}",
			"${4:packages and commands}",
			"\\begin{document}",
			"\t\\section{${5:section name}}",
			"\t${0}",
			"\\end{document}",
		],
		"description": "Insert report(sub) template"
	},
	"Template.test":{
		"prefix": "test",
		"body": [
			"\\documentclass[uplatex,dvipdfmx]{jsarticle}",
			"\\usepackage{amsmath,physics2}",
			"${1:packages and commands}",
			"\\begin{document}",
			"\t${0}",
			"\\end{document}",
		],
		"description": "Insert test template"
	},
	"Template.gnuplot":{
		"prefix": "gnuplot",
		"body": [
			"\\documentclass[uplatex,dvipdfmx]{jsarticle}",
			"\\pagestyle{empty}",
			"\\usepackage{gnuplot-lua-tikz}",
			"\\begin{document}",
			"\t${0}",
			"\\end{document}",
		],
		"description": "Insert gnuplot template"
	},

	/////////////////////////////////////////
	//Snippets for Documentclasses///////////
	/////////////////////////////////////////

	"DeclareDocumentClass.show":{
		"prefix":"clsshow",
		"body":[
			"% Documentclasses->",
			"% name : prefix",
			"up_dvi_jsarticle : documentclass",
		],
		"description": "Show  snippets for documentclasses"
	},
	////
	"DeclareDocoumentClass.up_dvi_jsarticle":{
		"prefix": "documentclass",
		"body": [
			"\\RequirePackage{plautopatch}",
			"\\documentclass[${1:uplatex,dvipdfmx}]{${2:jsarticle}}",
			"",
			"${0}",
		],
		"description": "Insert document of [uplatex, dvipdfmx], {jsarticle}"
	},

	////////////////////////////////////////////
	//Snippets for in-preamble//////////////////
	////////////////////////////////////////////
	
	// In-preamble snippets are divided into two categories: "Packages" and "Macros".
	// "Packages" is for LaTeX packages (amsmath, graphicx etc).
	// "Macros" is for LaTeX macros (\newcommand, \renewcommand etc).

	//////Packages/////////////////////////////////////////////////////

	"Packages.show":{
		"prefix":"pkgshow",
		"body":[
			"% Packages->",
			"% name : prefix",
			"documentation : edit",
			"font_newt : font_newt",
			"mathematical_expression : math",
			"mathematical_expression_advanced : math_adv",
			"graphics : graphics",
			"tikz : tikz",
			"hyperref : hyperref",
			"physics : physics",
		],
		"description": "Show snippets for packages"
	},
	////
	"Packages.documentation":{
		"prefix": "edit",
		"body": [
			"\\usepackage{comment}",
			"\\usepackage{here}",
			"",
			"${0}",
		],
		"description": "Insert packages for documentation"
	},
	"Packages.font_newt":{
		"prefix": "font_newt",
		"body": [
			"\\usepackage{newtxtext,newtxmath}",
			"",
			"${0}",
		],
		"description": "Insert packages for font of TimesNewRoman"
	},
	"Packages.mathematical_expression":{
		"prefix": "math",
		"body": [
			"\\usepackage{amsmath,amssymb}",
			"\\usepackage{bm}",
			"\\usepackage{physics2}",
			"${0}",
		],
		"description": "Insert packages for mathematical expression"
	},
	"Packages.mathematical_expression_advanced":{
		"prefix": "math_adv",
		"body": [
			"\\usepackage{mathtools}",
			"\\usepackage{mathrsfs}",
			"\\usepackage{amsthm}",
			"\\usepackage{cancel}",
			"",
			"${0}",
		],
		"description": "Insert packages for mathematical expression (advanced)"
	},
	"Packages.graphics":{
		"prefix": "graphics",
		"body": [
			"\\usepackage[dvipdfmx]{graphicx}",
			"${0}",
		],
		"description": "Insert packages for graphics"
	},
	"Packages.tikz":{
		"prefix": "tikz",
		"body": [
			"\\usepackage{tikz}",
			"\\usetikzlibrary{calc,intersections,through,backgrounds,angles,quotes,shapes,positioning,arrows.meta}",
			"\\usepackage{circuitikz}",
			"",
			"${0}",
		],
		"description": "Insert packages for TikZ"
	},
	"Packages.hyperref":{
		"prefix": "hyperref",
		"body":[
			"\\usepackage{hyperref}",
			"\\usepackage{pxjahyper}",
			"\\hypersetup{",
			"\t colorlinks=true",
			"\t linkcolor=black",
			"\t urlcolor=blue",
			"\t citecolor=black",
			"}",
			"",
			"${0}",
		],
		"description": "Insert packages for hyperref"
	},
	"Packages.physics":{
		"prefix": "physics",
		"body": [
			"\\usepackage{siunitx}",
			"\\usepackage{tensor}",
			"\\usepackage[version=4]{mhchem}",
			"",
			"${0}",
		],
		"description": "Insert packages for physics"
	},

	//////Macros////////////////////////////////////////////////////////

	"Macros.show":{
		"prefix":"mcrshow",
		"body":[
			"% Macros->",
			"% name : prefix",
			"nucl_phys : nucl",
		],
		"description": "Show snippets for macros"
	},

	"Macros.nucl_phys":{
		"prefix": "nucl",
		"body": [
			"% macros for nuclear physics-----------------------",
			"\\newcommand{\\proton}{\\mathrm{p}}",
			"\\newcommand{\\electron}{\\mathrm{e}}",
			"\\newcommand{\\neutron}{\\mathrm{n}}",

			"\\newcommand{\\nuc}[2]{\\ce{^{#1}#2}}",
			"\\newcommand{\\isometricintextmode}[2]{${}^{#1\\mathrm{m}}$#2}",
			"\\newcommand{\\isometricinmathmode}[2]{{}^{#1\\mathrm{m}}#2}",
			"",
			"${0}",
		],
		"description": "Insert macros for nuclear physics"
	},




	////////////////////////////
	//Snippets for in-document//
	////////////////////////////

	// In-document snippets are divided into two categories: "Environment" and "Command".
	// "Environment" is for LaTeX environments (figure, table etc).
	// "Command" is for LaTeX commands (\int, \sum etc).

	//////Environment/////////////////////////////////////////////////////////

	"Environment.show":{
		"prefix":"envshow",
		"body":[
			"% Environment->",
			"% name : prefix",
			"figure : figure",
			"table : table",
			"minipage : minipage",
			"enumerate : enumerate",
			"itemize : itemize",
			"align : align",
			"align* : salign",
		],
		"description": "Show snippets for environment"
	},
	////
	"Environment.figure": {
		"prefix": "figure",
		"body": [
			"\\begin{figure}[H]",
			"\t\\centering",
			"\t\\includegraphics[scale=${1}]{${2}}",
			"\t\\caption{${3}}",
			"\t\\label{${4}}",
			"\\end{figure}",
			"${0}",
		],
		"description": "Insert graphics"
	},
	"Environment.table": {
		"prefix": "table",
		"body": [
			"\\begin{table}[H]",
			"\t\\centering",
			"\t\\begin{tabular}{${1:ccc}}",
			"\t\t\\hline\\hline",
			"\t\t${2:1} & ${3:2} & ${4:3}\\\\\\\\",
			"\t\t${5:4} & ${6:5} & ${7:6}\\\\\\\\",
			"\t\t\\hline\\hline",
			"\t\\end{tabular}",
			"\t\\caption{${8}}",
			"\t\\label{${9}}",
			"\\end{table}",
			"${0}",
		],
		"description": "Insert table"
	},
	"Environment.minipage":{
		"prefix": "minipage",
		"body": [
			"\\begin{figure}[H]",
			"\t\\begin{minipage}[H]{0.45\\columwidth}",
			"\t\t\\centering",
			"\t\t\\includegraphics[scale=${1}]{${2}}",
			"\t\t\\caption{${3}}",
			"\t\t\\label{${4}}",
			"\t\\end{minipage}",
			"\t\\begin{minipage}[H]{0.45\\columwidth}",
			"\t\t\\centering",
			"\t\t\\includegraphics[scale=${5}]{${6}}",
			"\t\t\\caption{${7}}",
			"\t\t\\label{${8}}",
			"\t\\end{minipage}",
			"\\end{figure}",
			"${0}",
		],
		"description": "Insert minipage"
	},
	"Environment.enumerate": {
		"prefix": "enumerate",
		"body": [
			"\\begin{enumerate}",
			"\t\\item ${1}",
			"\t\\item ${2}",
			"\\end{enumerate}",
			"${0}",
		],
		"description": "Insert enumerate"
	},
	"Environment.itemize": {
		"prefix": "itemize",
		"body": [
			"\\begin{itemize}",
			"\t\\item ${1}",
			"\t\\item ${2}",
			"\\end{itemize}",
			"${0}",
		],
		"description": "Insert itemize"
	},
	"Environment.align":{
		"prefix": "align",
		"body": [
			"\\begin{align}",
			"\t${1}",
			"\\end{align}",
			"${0}",
		],
		"description": "Insert align environment"
	},
	"Environment.align*":{
		"prefix": "salign",
		"body": [
			"\\begin{align*}",
			"\t${1}",
			"\\end{align*}",
			"${0}",
		],
		"description": "Insert align* environment"
	},

	//////Command/////////////////////////////////////////////////////////

	"Command.show":{
		"prefix":"cmdshow",
		"body":[
			"% Command->",
			"% name : prefix",
			"integral : integral",
			"sum : sum",
			"greek_letters : grkshow",
		],
		"description": "Show snippets for command"
	},
	////
	"Command.integral":{
		"prefix": "integral",
		"body": [
			"\\int_{${1:-\\infty}}^{${2:\\infty}} \\,${3:f(x)} d${4:x} ${0}",
		],
		"description": "Insert integral"
	},
	"Command.sum":{
		"prefix": "sum",
		"body": [
			"\\sum_{${1:i=1}}^{${2:n}} ${3:a_i} ${0}",
		],
		"description": "Insert sum"
	},
	"Command.greek_letters.show":{
		"prefix": "grkshow",
		"body": [

			"% greek letters->",
			"% name : prefix",
			"alpha : alpha",
			"beta : beta",
			"gamma : gamma",
			"delta : delta",
			"epsilon : epsilon",
			"zeta : zeta",
			"eta : eta",
			"theta : theta",
			"iota : iota",
			"kappa : kappa",
			"lambda : lambda",
			"mu : mu",
			"nu : nu",
			"xi : xi",
			"omicron : omicron",
			"pi : pi",
			"rho : rho",
			"sigma : sigma",
			"tau : tau",
			"upsilon : upsilon",
			"phi : phi",
			"chi : chi",
			"psi : psi",
			"omega : omega",
			"",
			"varepsilon : vepsilon",
			"vartheta : vtheta",
			"varrho : vrho",
			"varsigma : vsigma",
			"varphi : vphi",
			"",
			"Gamma : Gamma",
			"Delta : Delta",
			"Theta : Theta",
			"Lambda : Lambda",
			"Xi : Xi",
			"Pi : Pi",
			"Sigma : Sigma",
			"Upsilon : Upsilon",
			"Phi : Phi",
			"Psi : Psi",
			"Omega : Omega",
			"",
			"varDelta : vDelta",
		],
		"description": "Show snippets for greek letters embedded in math-mode"
	},
	"Command.greek_letters.alpha":{
		"prefix": "alpha",
		"body": [
			"\\(\\alpha\\)",
		],
		"description": "Insert alpha embedded in math-mode"
	},
	"Command.greek_letters.beta":{
		"prefix": "beta",
		"body": [
			"\\(\\beta\\)",
		],
		"description": "Insert beta embedded in math-mode"
	},
	"Command.greek_letters.gamma":{
		"prefix": "gamma",
		"body": [
			"\\(\\gamma\\)",
		],
		"description": "Insert gamma embedded in math-mode"
	},
	"Command.greek_letters.delta":{
		"prefix": "delta",
		"body": [
			"\\(\\delta\\)",
		],
		"description": "Insert delta embedded in math-mode"
	},
	"Command.greek_letters.epsilon":{
		"prefix": "epsilon",
		"body": [
			"\\(\\epsilon\\)",
		],
		"description": "Insert epsilon embedded in math-mode"
	},
	"Command.greek_letters.zeta":{
		"prefix": "zeta",
		"body": [
			"\\(\\zeta\\)",
		],
		"description": "Insert zeta embedded in math-mode"
	},
	"Command.greek_letters.eta":{
		"prefix": "eta",
		"body": [
			"\\(\\eta\\)",
		],
		"description": "Insert eta embedded in math-mode"
	},
	"Command.greek_letters.theta":{
		"prefix": "theta",
		"body": [
			"\\(\\theta\\)",
		],
		"description": "Insert theta embedded in math-mode"
	},
	"Command.greek_letters.iota":{
		"prefix": "iota",
		"body": [
			"\\(\\iota\\)",
		],
		"description": "Insert iota embedded in math-mode"
	},
	"Command.greek_letters.kappa":{
		"prefix": "kappa",
		"body": [
			"\\(\\kappa\\)",
		],
		"description": "Insert kappa embedded in math-mode"
	},
	"Command.greek_letters.lambda":{
		"prefix": "lambda",
		"body": [
			"\\(\\lambda\\)",
		],
		"description": "Insert lambda embedded in math-mode"
	},
	"Command.greek_letters.mu":{
		"prefix": "mu",
		"body": [
			"\\(\\mu\\)",
		],
		"description": "Insert mu embedded in math-mode"
	},
	"Command.greek_letters.nu":{
		"prefix": "nu",
		"body": [
			"\\(\\nu\\)",
		],
		"description": "Insert nu embedded in math-mode"
	},
	"Command.greek_letters.xi":{
		"prefix": "xi",
		"body": [
			"\\(\\xi\\)",
		],
		"description": "Insert xi embedded in math-mode"
	},
	"Command.greek_letters.omicron":{
		"prefix": "omicron",
		"body": [
			"\\(\\omicron\\)",
		],
		"description": "Insert omicron embedded in math-mode"
	},
	"Command.greek_letters.pi":{
		"prefix": "pi",
		"body": [
			"\\(\\pi\\)",
		],
		"description": "Insert pi embedded in math-mode"
	},
	"Command.greek_letters.rho":{
		"prefix": "rho",
		"body": [
			"\\(\\rho\\)",
		],
		"description": "Insert rho embedded in math-mode"
	},
	"Command.greek_letters.sigma":{
		"prefix": "sigma",
		"body": [
			"\\(\\sigma\\)",
		],
		"description": "Insert sigma embedded in math-mode"
	},
	"Command.greek_letters.tau":{
		"prefix": "tau",
		"body": [
			"\\(\\tau\\)",
		],
		"description": "Insert tau embedded in math-mode"
	},
	"Command.greek_letters.upsilon":{
		"prefix": "upsilon",
		"body": [
			"\\(\\upsilon\\)",
		],
		"description": "Insert upsilon embedded in math-mode"
	},
	"Command.greek_letters.phi":{
		"prefix": "phi",
		"body": [
			"\\(\\phi\\)",
		],
		"description": "Insert phi embedded in math-mode"
	},
	"Command.greek_letters.chi":{
		"prefix": "chi",
		"body": [
			"\\(\\chi\\)",
		],
		"description": "Insert chi embedded in math-mode"
	},
	"Command.greek_letters.psi":{
		"prefix": "psi",
		"body": [
			"\\(\\psi\\)",
		],
		"description": "Insert psi embedded in math-mode"
	},
	"Command.greek_letters.omega":{
		"prefix": "omega",
		"body": [
			"\\(\\omega\\)",
		],
		"description": "Insert omega embedded in math-mode"
	},
	"Command.greek_letters.vepsilon":{
		"prefix": "vepsilon",
		"body": [
			"\\(\\varepsilon\\)",
		],
		"description": "Insert varepsilon embedded in math-mode"
	},
	"Command.greek_letters.vtheta":{
		"prefix": "vtheta",
		"body": [
			"\\(\\vartheta\\)",
		],
		"description": "Insert vartheta embedded in math-mode"
	},
	"Command.greek_letters.vrho":{
		"prefix": "vrho",
		"body": [
			"\\(\\varrho\\)",
		],
		"description": "Insert varrho embedded in math-mode"
	},
	"Command.greek_letters.vsigma":{
		"prefix": "vsigma",
		"body": [
			"\\(\\varsigma\\)",
		],
		"description": "Insert varsigma embedded in math-mode"
	},
	"Command.greek_letters.vphi":{
		"prefix": "vphi",
		"body": [
			"\\(\\varphi\\)",
		],
		"description": "Insert varphi embedded in math-mode"
	},
	"Command.greek_letters.Gamma":{
		"prefix": "Gamma",
		"body": [
			"\\(\\Gamma\\)",
		],
		"description": "Insert Gamma embedded in math-mode"
	},
	"Command.greek_letters.Delta":{
		"prefix": "Delta",
		"body": [
			"\\(\\Delta\\)",
		],
		"description": "Insert Delta embedded in math-mode"
	},
	"Command.greek_letters.Theta":{
		"prefix": "Theta",
		"body": [
			"\\(\\Theta\\)",
		],
		"description": "Insert Theta embedded in math-mode"
	},
	"Command.greek_letters.Lambda":{
		"prefix": "Lambda",
		"body": [
			"\\(\\Lambda\\)",
		],
		"description": "Insert Lambda embedded in math-mode"
	},
	"Command.greek_letters.Xi":{
		"prefix": "Xi",
		"body": [
			"\\(\\Xi\\)",
		],
		"description": "Insert Xi embedded in math-mode"
	},
	"Command.greek_letters.Pi":{
		"prefix": "Pi",
		"body": [
			"\\(\\Pi\\)",
		],
		"description": "Insert Pi embedded in math-mode"
	},
	"Command.greek_letters.Sigma":{
		"prefix": "Sigma",
		"body": [
			"\\(\\Sigma\\)",
		],
		"description": "Insert Sigma embedded in math-mode"
	},
	"Command.greek_letters.Upsilon":{
		"prefix": "Upsilon",
		"body": [
			"\\(\\Upsilon\\)",
		],
		"description": "Insert Upsilon embedded in math-mode"
	},
	"Command.greek_letters.Phi":{
		"prefix": "Phi",
		"body": [
			"\\(\\Phi\\)",
		],
		"description": "Insert Phi embedded in math-mode"
	},
	"Command.greek_letters.Psi":{
		"prefix": "Psi",
		"body": [
			"\\(\\Psi\\)",
		],
		"description": "Insert Psi embedded in math-mode"
	},
	"Command.greek_letters.Omega":{
		"prefix": "Omega",
		"body": [
			"\\(\\Omega\\)",
		],
		"description": "Insert Omega embedded in math-mode"
	},
	"Command.greek_letters.vDelta":{
		"prefix": "vDelta",
		"body": [
			"\\(\\varDelta\\)",
		],
		"description": "Insert varDelta embedded in math-mode"
	},


スニペットは、その定義内容のprefixに書かれている文字列を書くと、bodyの内容が自動的に文書中に挿入されます。どんなものがあるかは実際に見てみてください。

スニペットの内容はおいおい追加していこうと思っています。
この記事のことを思い出したら立ち寄ってみてください。更新しているかもしれません。

使い方

ここではtexの記法については説明しません。(本題ではないので…)

適当な場所にフォルダを作って、それをVScodeで開きます。左上にカーソルを合わせると出てくるこれ(下画像)の一番左からtest.texを作って適当なコードを書きます。
image.png

私の設定では、F5でタイプセット(texファイルの処理)ができるのと、Ctrl+Shift+Kでもしタイプセットが終わらないときその処理を中断することができます。
(一応、あらかじめエラーが起きた際には処理を中断するような設定にはしています)
Ctrl+Sで上書き保存できるのと、Ctrl+Alt+Tでコンパイル方法を選択できます。
あと、Ctrl+Shift+Eでログを確認できます。

おそらく最初はコンパイル方法を聞かれるので、# latexmk を選択してください。

参考にした記事など

参考にした記事等を列挙しておきます。

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