2

I write my documents using Overleaf. Now I want to switch to VS code.

My document contains many tables (longtable) with a large number of references. Furthermore the document contains a glossary, many *.svg files. In Overleaf this document is compiled without errors with lualatex.

Overleaf is using latexmk. How do I have to rewrite the settings.json that Overleaf and vs-code produces the same results for Lualatex, biber and the glossaries?

$biber main.tex

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

I don't know how to make the beaver work.

Here my 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

OS: Alma Luinux 9 Code-server: v4.12.0 Extension Version: v9.10.0 Tex distribution: 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.

JamesT
  • 3,169
Aaron
  • 161
  • 1
    Biber needs to be called on the base name of the main file of your project/document (without the file extension). So biber main.tex should be biber main. I don't know anything about VS Code, though. But according to https://github.com/James-Yu/LaTeX-Workshop/wiki/Compile your settings look OK-ish. Double check them with https://tex.stackexchange.com/q/154751/35864 just to be sure. – moewe May 12 '23 at 11:24
  • 2
    Overleaf uses latexmk, so you may want to also use that tool locally. https://tex.stackexchange.com/a/468433/35864 shows how you can configure VS Code for latexmk. – moewe May 12 '23 at 11:26
  • (Use latexmk -pdflua instead of latexmk if you want to run LuaLaTeX with latexmk.) – moewe May 12 '23 at 12:15

1 Answers1

3

I use VS Code when I am finishing documents as the errors/duplicate labels functionality is really good plus source control. I believe your issue is being caused by the fact that the LaTeX extension for VS Code uses bibtex as the bibliography backend by default so you need to specify biblatex like so in your settings:

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

I cannot see in your provided settings.json that you have specified that so I think that is the issue (could be wrong though). For example, my document (using the diff2 recipe with lualatex, biber, makeglossaries) compiles well with these options:

"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" ],

The options here:

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

Automatically cleans aux files and whatever extensions you have, you can add or delete that section if you like.


The FAQ for VSCode biblatex/biber found on TeX.SE at this link has been updated and includes further links and guides to intellisense for future readers.

JamesT
  • 3,169
  • 1
    If the guidance at https://tex.stackexchange.com/q/154751/35864 is missing something important to get Biber to run with VS Code, it would be brilliant if you could update it so that it actually works for people. I have the feeling that many people have recently started using LaTeX with VS Code and having the correct configuration in our FAQ would really help them. – moewe May 12 '23 at 11:55
  • I will do that now for you @moewe, thanks for all the work on biblatex and biber – JamesT May 12 '23 at 11:56
  • 1
    Thank you very much! – moewe May 12 '23 at 12:05
  • The code snippet works perfectly. My document has 1000 pages. I have inserted chapter by chapter. 400 pages run through without error. If I add another chapter where I load a lot of fonts and images, the compiler stops. Maybe it's because I have too little RAM memory and too little CPU power?

    4 vCores CPU 8 GB RAM 160 GB SSD

    – Aaron May 12 '23 at 15:11
  • @Aaron I think that sounds like a new question and is likely not because of VS Code, more then likely an issue with your code in that problematic chapter. VS Code will run forever if needs be, it's not like Overleaf where it times out. I would reduce the problematic chapter down and then ask a new question on why it is crashing. Also if this answer or any answer helped then please feel free to tick it correct so we all get rep and the site keeps clean :) – JamesT May 12 '23 at 15:40
  • 1
    @Aaron if anything, VS Code would just take longer to compile, my document which is heavy graphics takes 4 minutes so I can imagine your 1000 page document taking a lot longer, your computer performance isn't an issue it must be the chapter – JamesT May 12 '23 at 15:40