I finally found the root cause for issue #734
It seems like having %!TEX TS-program = xelatex directive as the first line breaks all citation references, i.e. gives "reference undefined" errors for citations. Minimal example:
%!TEX TS-program = xelatex
\documentclass{article}
\usepackage{biblatex}
\addbibresource{bibliography/Bibliography.bib}
\begin{document}
Let's look at \cite{adams1980hitchhiker}.
\printbibliography
\end{document}
and in bibliography/Bibliography.bib:
@book{adams1980hitchhiker,
title={The hitchhiker's guide to the galaxy},
author={Adams, Douglas},
isbn={9780517542095},
lccn={80014572},
series={Hitchhiker's Guide to the Galaxy Series},
year={1980},
publisher={Harmony Books},
}
It gives errors but works if you remove the line %!TEX TS-program = xelatex.
Apparently this directive is understood by many editors: https://tex.stackexchange.com/questions/78101/when-and-why-should-i-use-tex-ts-program-and-tex-encoding
Best solution: LaTeX Workshop also understands these directives
Good solution: LaTeX Workshop just ignores these directives so at least their presence don't break anything.
The README actually says:
Suppose there is a line % !TEX program = xelatex in the root file. Upon building the project, LaTeX Workshop will parse the root file and figure out that xelatex should be used. Arguments are included to invoke the compiler.
So it should be supported already? It just doesn't work for me.
Ok I finally got it to work. It's probably my own fault, I just couldn't understand the README initially. I needed to put % !BIB program = biber in the header as well, then it worked!
For reference: At first I made my own recipe, pretty much mimicking the defaults but using xelatex instead of latexmk and biber instead of bibtex. It works, even when %!TEX TS-program = xelatex (I'll never understand why made a difference / didn't work before, but that's probably because it wasn't running bibtex/biber properly afterwards).
Anyway running with this recipe worked for me (and perhaps they could be included as part of the included recipes, but not the default build?):
// XeLaTeX + Biber recipe
"latex-workshop.latex.tools": [
{
"name": "xelatex",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
]
},
{
"name": "biber",
"command": "biber",
"args": ["%DOCFILE%"]
}
],
"latex-workshop.latex.recipes": [
{
"name": "xelatex -> biber -> xelatex*2",
"tools": [
"xelatex",
"biber",
"xelatex",
"xelatex"
]
}
]
All of this also worked and is probably the recommended way to do it? But it also worked by adding the extra biber line, i.e. having:
% !TEX TS-program = xelatex
% !BIB program = biber
So case closed, it all seems to work as expected! 馃憤
Most helpful comment
Ok I finally got it to work. It's probably my own fault, I just couldn't understand the README initially. I needed to put
% !BIB program = biberin the header as well, then it worked!For reference: At first I made my own recipe, pretty much mimicking the defaults but using
xelatexinstead oflatexmkandbiberinstead ofbibtex. It works, even when%!TEX TS-program = xelatex(I'll never understand why made a difference / didn't work before, but that's probably because it wasn't running bibtex/biber properly afterwards).Anyway running with this recipe worked for me (and perhaps they could be included as part of the included recipes, but not the default build?):
All of this also worked and is probably the recommended way to do it? But it also worked by adding the extra biber line, i.e. having:
So case closed, it all seems to work as expected! 馃憤