从 Overleaf 切换到 VS-Code

从 Overleaf 切换到 VS-Code

我使用 Overleaf 编写文档。现在我想切换到 VS code。

我的文档包含许多表格(longtable),其中包含大量参考资料。此外,文档还包含词汇表和许多 *.svg 文件。在 Overleaf 中,使用 lualatex 编译此文档时没有出现错误。

Overleaf 使用的是 latexmk。我该如何重写 settings.json 才能让 Overleaf 和 vs-code 对 Lualatex、biber 和词汇表产生相同的结果?

$biber main.tex
    
INFO - This is Biber 2.19
INFO - Logfile is 'main.tex.blg'
ERROR - Cannot find 'main.tex.bcf'!
INFO - ERRORS: 1

我不知道怎样让海狸工作。

这是我的 settings.json

{
    "latex-workshop.latex.autoClean.run": "onBuilt",
    "latex-workshop.view.pdf.viewer": "tab",
    "latex-workshop.view.pdf.internal.synctex.keybinding": "double-click",
    "latex-workshop.latex.autoBuild.run": "onSave",
    "files.autoSave": "afterDelay",
    "files.autoSaveDelay": 30000,
    "latex-workshop.latex.recipes": [
        {
            "name": "lualatex -> biber -> makeglossaries -> lualatex 2x",
            "tools": [
                "lualatex",
                "biber",
                "makeglossaries",
                "lualatex",
                "lualatex"
            ]
        }
    ],
    "latex-workshop.latex.tools": [
        {
            "name": "lualatex",
            "command": "lualatex",
            "args": [
                "-shell-escape",
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-pdf",
                "%DOC%"
            ]
        },
        {
            "name": "biber",
            "command": "biber",
            "args": [
                "%DOCFILE%"
            ]
        },
        {
            "name": "makeglossaries",
            "command": "makeglossaries",
            "args": [
                "%DOCFILE%"
            ]
        }
    ],
    "files.exclude": {
        "**/.git": true,
        "**/*.aux": true,
        "**/*.bbl": true,
        "**/*.bcf": true,
        "**/*.blg": true,
        "**/*.fdb_latexmk": true,
        "**/*.fls": true,
        "**/*.glg": true,
        "**/*.glo": true,
        "**/*.gls": true,
        "**/*.glsdefs": true,
        "**/*.idx": true,
        "**/*.ilg": true,
        "**/*.ind": true,
        "**/*.lof": true,
        "**/*.log": true,
        "**/*.lot": true,
        "**/*.mw": true,
        "**/*.nlo": true,
        "**/*.nls": true,
        "**/*.out": true,
        "**/*.run.xml": true,
        "**/*.synctex.gz": true,
        "**/*.thm": true,
        "**/*.toc": true,
        "**/*.xdy": true
    },
    "editor.minimap.enabled": false,
} 


%% Bibliography
\usepackage[backend=biber,style=alphabetic]{biblatex}
\addbibresource{bibliography/bibliography.bib}


\nocite{*}
\printbibliography[heading=bibintoc,type=book,title={Literatur}]
\cleardoublepage
\printbibliography[heading=bibintoc,type=misc,title={Normen}]
\cleardoublepage
\printbibliography[heading=bibintoc,type=online,title={Internet}]
\cleardoublepage

操作系统:Alma Luinux 9 代码服务器:v4.12.0 扩展版本:v9.10.0 Tex 发行版:TeX Live 2023

Error Message: 

Package longtable Warning: Table widths have changed. Rerun LaTeX.

 [273] (./main.aux)

LaTeX Warning: There were undefined references.


LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.


Package biblatex Warning: Please (re)run Biber on the file:
(biblatex)                main
(biblatex)                and rerun LaTeX afterwards.

答案1

我在完成文档时使用 VS Code,因为它的错误/重复标签功能非常好,而且还有源代码控制。我认为您的问题是由于 VS Code 的 LaTeX 扩展默认用作参考书目后端而导致的,因此您需要在设置中像这样bibtex指定:biblatex

"latex-workshop.intellisense.citation.backend": "biblatex",

我在您的提供中看不到settings.json您指定了这一点,所以我认为这就是问题所在(但可能是错误的)。例如,我的文档(使用diff2带有lualatexbiber、 的配方makeglossaries)可以使用以下选项很好地编译:

"latex-workshop.latex.autoBuild.run": "never",
"latex-workshop.intellisense.citation.backend": "biblatex",

"latex-workshop.latex.tools": [
    {
        "name": "biber",
        "command": "biber",
        "args": [
            "%DOCFILE%"
        ],
        "env": {}
    },
    {
      "name": "makeglossaries",
      "command": "makeglossaries",
      "args": [
        "%DOCFILE%"
      ]
    },
    {
        "name": "lualatex",
        "command": "lualatex",
        "args": [
            "-synctex=1",
            "-interaction=nonstopmode",
            "-file-line-error",
            "%DOC%"
        ]
    },
  ],

"latex-workshop.latex.recipes": [
    {
        "name": "diff2",
        "tools": [
            "lualatex",
            "biber",
            "lualatex",
            "makeglossaries",
            "lualatex",
            "lualatex",
        ]
    },
    {
        "name": "lualatex",
        "tools": [
            "lualatex",
        ]
    },
    {
        "name": "lualatex3",
        "tools": [
            "lualatex",
            "lualatex",
            "lualatex",
        ]
    },
    {
        "name": "latexmk",
        "tools": [
            "latexmk"
        ]
    },
    {
        "name": "latexmk (latexmkrc)",
        "tools": [
            "latexmk_rconly"
        ]
    },
    {
        "name": "latexmk (lualatex)",
        "tools": [
            "lualatexmk"
        ]
    },
    {
        "name": "latexmk (xelatex)",
        "tools": [
            "xelatexmk"
        ]
    },
    {
        "name": "pdflatex -> bibtex -> pdflatex * 2",
        "tools": [
            "pdflatex",
            "bibtex",
            "pdflatex",
            "pdflatex"
        ]
    },
    {
        "name": "Compile Rnw files",
        "tools": [
            "rnw2tex",
            "latexmk"
        ]
    },
    {
        "name": "Compile Jnw files",
        "tools": [
            "jnw2tex",
            "latexmk"
        ]
    },
    {
        "name": "Compile Pnw files",
        "tools": [
            "pnw2tex",
            "latexmk"
        ]
    },
    {
        "name": "tectonic",
        "tools": [
            "tectonic"
        ]
    },

],

"output.smartScroll.enabled": false,
"latex-workshop.latex.clean.method": "glob",
"latex-workshop.latex.autoClean.run":"onBuilt",
"latex-workshop.latex.clean.fileTypes": [
    "%DOCFILE%.aux",
    "%DOCFILE%.bbl",
    "%DOCFILE%.blg",
    "%DOCFILE%.idx",
    "%DOCFILE%.ind",
    "%DOCFILE%.lof",
    "%DOCFILE%.lot",
    "%DOCFILE%.out",
    "%DOCFILE%.toc",
    "%DOCFILE%.acn",
    "%DOCFILE%.acr",
    "%DOCFILE%.alg",
    "%DOCFILE%.glg",
    "%DOCFILE%.glo",
    "%DOCFILE%.gls",
    "%DOCFILE%.fls",
    "%DOCFILE%.log",
    "%DOCFILE%.fdb_latexmk",
    "%DOCFILE%.snm",
    "%DOCFILE%.synctex(busy)",
    "%DOCFILE%.synctex.gz(busy)",
    "%DOCFILE%.nav",
    "%DOCFILE%.vrb",
    "%DOCFILE%.abb",
    "%DOCFILE%.abrn",
    "%DOCFILE%.bcf",
    "%DOCFILE%.dvi",
    "%DOCFILE%.ist",
    "%DOCFILE%.nom",
    "%DOCFILE%.ntn",
    "%DOCFILE%.run.xml",
    "%DOCFILE%.synctex.gz"
],

这里的选项:

"latex-workshop.latex.clean.method": "glob",
"latex-workshop.latex.autoClean.run":"onBuilt",
"latex-workshop.latex.clean.fileTypes": ["%DOCFILE%".abb, ...]

自动清理aux文件和任何扩展名,您可以根据需要添加或删除该部分。


VSCode 常见问题解答biblatex/biber位于TeX.SE 链接已更新并包含intellisense供未来读者使用的更多链接和指南。

相关内容