SublimeText / LaTeXTools

LaTeX plugin for Sublime Text
https://latextools.readthedocs.io/
2k stars 362 forks source link

Bibliography doesn't get printed when using biblatex and \nocite{*} #1565

Open jlvermeulen opened 1 year ago

jlvermeulen commented 1 year ago

I have a document which doesn't use any citations, but has a list of references that should be printed. However, even when using \nocite{*}, biber does not get run by the basic builder. Here's a MWE:

test.tex

\documentclass{article}

\usepackage{biblatex}

\addbibresource{test.bib}

\begin{document}
Test. \nocite{*}

\printbibliography
\end{document}

test.bib

@inproceedings{test1,
    author="Last, First and Aaa, Aa",
    title="Test 1",
    booktitle={Some Proceedings},
    year={2022},
}

@inproceedings{test2,
    author="Last, F. and Zzz, Z.",
    title="Test 2",
    booktitle={Some Other Proceedings},
    year={2022},
}

Running it with the basic builder generates a pdf that only contains the text "Test." with the warning "LaTeX Warning: Empty bibliography on input line 10." It doesn't seem to matter where I put the \nocite{*} (biblatex lets you put it in the preamble, that also doesn't work).

A workaround is to insert an actual \cite{}, compile, remove the \cite{} and compile again, but it would be nice if this just worked.

HKervadec commented 1 year ago

I suppose you would need to add another elif in there?

        if CITATIONS_REGEX.search(self.out):
            run_bibtex = True
            # are we using biblatex?
            m = BIBLATEX_REGEX.search(self.out)
            if m:
                bibtex = m.group(1).lower()
                if bibtex == 'biber':
                    use_bibtex = False
        # check for natbib as well
        elif (
            'Package natbib Warning: There were undefined citations'
                in self.out):
            run_bibtex = True

The .log contains:

LaTeX Warning: Empty bibliography on input line 9.

[1

{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./test.aux)

LaTeX Warning: There were undefined references.

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

So perhaps matching either "LaTeX Warning: There were undefined references." or "Package biblatex Warning: Please (re)run Biber on the file:" would do the trick?

merchantrayyan commented 1 year ago

Doesn't look like anyone's tried their hand at this yet. If there's anyone assigning issues still, I'd like to take this. If not, I suppose I'll just take it on anyways.

vinograd0v commented 1 year ago

I had the same problem, "\nocite{}" doesnt work properly, i find a solution doing \nocite{"some of your reference"} before the \nocite{}, that solve the problem for me and its a quickly solution