【Latex】スキルステーションを使用する: (3) Vscodeを使用してLaTeXを設定する

導入

  • texliveをインストールする
  • vscodeをインストールする
  • SumatraPdf をインストールする

1 texlive をインストールする

オンライン LaTeX エディター: https://www.overleaf.com
TeX Live ダウンロード: https://www.tug.org/texlive/acquire-iso.html
MikTeX ダウンロード: https://miktex.org/download
LaTeX 数式エディター エディター: https://latex.codecogs.com/eqneditor/editor.php
LaTeX のそれほど短くない入門: https://github.com/CTeX-org/lshort-zh-cn

ここに画像の説明を挿入
ここに画像の説明を挿入

2 vscodeをインストールする

著者の以前のブログを参照してください: [Ubuntu] Anaconda+vscode をインストールする

2.1 プラグインのインストール

  • Chinese 、中国語インターフェイスに使用されます
  • LaTeX Workshop 、必須のプラグイン
    ここに画像の説明を挿入
    ここに画像の説明を挿入

2.2 構成

プラグインのインストール後、vscodeを再起動し、左下の歯車をクリックして設定を開き、設定ファイルsettings.jsonを開き、以下のように操作して設定ファイルを開いて変更し、次のコードを貼り付け
ここに画像の説明を挿入
ここに画像の説明を挿入
ますそれ

{
    
    
    "latex-workshop.latex.autoBuild.run": "never",
    "latex-workshop.showContextMenu": true,
    "latex-workshop.intellisense.package.enabled": true,
    "latex-workshop.message.error.show": false,
    "latex-workshop.message.warning.show": false,
    "latex-workshop.latex.tools": [
        {
    
    
            "name": "xelatex",
            "command": "xelatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOCFILE%"
            ]
        },
        {
    
    
            "name": "pdflatex",
            "command": "pdflatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOCFILE%"
            ]
        },
        {
    
    
            "name": "latexmk",
            "command": "latexmk",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-pdf",
                "-outdir=%OUTDIR%",
                "%DOCFILE%"
            ]
        },
        {
    
    
            "name": "bibtex",
            "command": "bibtex",
            "args": [
                "%DOCFILE%"
            ]
        }
    ],
    "latex-workshop.latex.recipes": [
        {
    
    
            "name": "XeLaTeX",
            "tools": [
                "xelatex"
            ]
        },
        {
    
    
            "name": "PDFLaTeX",
            "tools": [
                "pdflatex"
            ]
        },
        {
    
    
            "name": "BibTeX",
            "tools": [
                "bibtex"
            ]
        },
        {
    
    
            "name": "LaTeXmk",
            "tools": [
                "latexmk"
            ]
        },
        {
    
    
            "name": "xelatex -> bibtex -> xelatex*2",
            "tools": [
                "xelatex",
                "bibtex",
                "xelatex",
                "xelatex"
            ]
        },
        {
    
    
            "name": "pdflatex -> bibtex -> pdflatex*2",
            "tools": [
                "pdflatex",
                "bibtex",
                "pdflatex",
                "pdflatex"
            ]
        },
    ],
    "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"
    ],
    "latex-workshop.latex.autoClean.run": "onFailed",
    "latex-workshop.latex.recipe.default": "lastUsed",
    "latex-workshop.view.pdf.internal.synctex.keybinding": "double-click",
    "zotero.latexCommand": "cite",
}

3 Sumatra PDF をインストールする

公式サイトからダウンロードして直接インストール
ここに画像の説明を挿入

3.1 vscodeの設定

次のコードを設定ファイル settings.json に追加します。最後の中括弧の前の位置に注意してください。

  "latex-workshop.view.pdf.viewer": "external",
  "latex-workshop.view.pdf.external.viewer.command":
         "D:/AppData/SumatraPDF/SumatraPDF.exe",  //注意修改路径,为安装的 SumatraPdf 的路径
  "latex-workshop.view.pdf.external.viewer.args": [
          "%PDF%"
      ],

3.2 逆方向検索の設定

逆検索は、ドキュメントに対応するソース コードの場所をすばやく見つけるのに役立ちます。次のコードを settings.json に追加します。これも最後の中括弧の前にあります。

   "latex-workshop.view.pdf.external.synctex.command":
       "D:/AppData/SumatraPDF/SumatraPDF.exe",  //注意修改路径
   "latex-workshop.view.pdf.external.synctex.args": [
       "-forward-search",
        "%TEX%",
       "%LINE%",
       "%PDF%",
   ],

SumatraPdf ソフトウェアで構成を行い、設定から詳細オプションを開くと、構成ファイルがポップアップ表示されます。構成ファイルの最後に次のコードを追加するだけです。

InverseSearchCmdLine = "D:\Microsoft VS Code\Code.exe" "D:\Microsoft VS Code\resources\app\out\cli.js"  --ms-enable-electron-run-as-node -r -g "%f:%l"
EnableTeXEnhancements = true

次に、 PDF ドキュメントの双击vscode ソース コード部分にジャンプできます。

おすすめ

転載: blog.csdn.net/qq_44703886/article/details/132619098
おすすめ