1

Let me start off by saying that I am aware that variants of this question have been asked many times before (at least in 1, 2, 3, 4, 5, 6, 7, 8), yet despite trying all of the solutions I've read, my error persists.

I recently updated a great deal of my software, so I strongly suspect that one of those updates triggered this problem as everything was working fine beforehand.

Current software: macOS Ventura 13.1, TexLive 2022, all packages up to date via TexLive Utility. Problem persists across both VS Code + LaTeX Workshop (my usual editor) and the default TexShop. Let me know if I can provide any further details.

MWE and Steps to Reproduce

File hierarchy:

main.tex
main.bib
--> chapter1.tex

Contents of main.tex:

\documentclass{report}

\usepackage{biblatex}
\addbibresource{main.bib}
\usepackage{subfiles}

\begin{document}

This citation works: \textcite{bib:Book}.
\subfile{Chapter1/chapter1.tex}

\end{document}

Contents of main.bib:

@book{bib:Book,
    author = {John Smith},
    title  = {A Book},
    year   = {2023}
}

Contents of chapter1.tex:

\documentclass[../main.tex]{subfiles}

\begin{document}

This one only works in the main document: \textcite{bib:Book}.

\end{document}

Run pdflatex -> biber -> pdflatex (x2) (or the default latexmk) on main.tex, and then chapter1.tex. Both citations render fine in main.tex; the one citation in the subfile renders as "bib:Bookempty citation." Additional errors include "Citation 'bib:Book' on page 1 undefined" and "There were undefined references." Even the log says "ERROR - Cannot find 'main.bib'!" after compilation.

Note that the error does not persist if I move chapter1.tex to the same directory as main.tex. Indeed, it appears as if subfiles is not adjusting the relative .bib path for the subfile, that is, the subfile is looking for main.bib in its folder instead of the root folder.

Is this a bug in a new update? Is there something I'm missing? Preferably, I'd rather not put a copy of main.bib in every folder :)

Any and all thoughts welcome, thanks in advance!

Last note: My GF just encountered an analogous issue. She is using subfiles + graphicx and has now had to put her External Images folder in both the root directory and the subfiles directory to be able to input images in both places. She did not update all of her software this morning, and her issue is likewise reproducible across both VS Code and TexShop (OS X Catalina 10.15.5), so I am at a loss.

1 Answer 1

2

I don't follow subfiles' development closely, but I'm pretty sure there are no recent biblatex changes that have an impact here.

Things should work if you use \subfix{...} around the .bib file name to help the involved packages figure out that file name is always relative to the main file. Hence, main.tex should be

\documentclass{report}

\usepackage{biblatex}
\usepackage{subfiles}

\addbibresource{\subfix{main.bib}}

\begin{document}

This citation works: \textcite{bib:Book}.
\subfile{Chapter1/chapter1.tex}

\end{document}

When using subfiles package, where it the proper location to add the bibliography files? suggests that this procedure has been necessary at least since February 2021 (see also ST3: no bib files found in a subfile). A quick look at the GitHub repository suggests that the manual has recommended using \subfix with \addbibresource since 2019.

Note that subfiles patches the \bibliography command, which is considered a legacy command in biblatex, to include \subfix, so if you use \bibliography{main} as in https://tex.stackexchange.com/a/514240/35864 you can get away not having an explicit \subfix.

In either case I'd suggest issuing \addbibresource/\bibliography only after subfiles is loaded.

1
  • That worked! Thanks so much -- had no idea about subfix.
    – Shady Puck
    Jan 6, 2023 at 14:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .