1

I have the following: one file as a preamble (ccc.tex) and two other files that share that preamble. One of the files is the main file (aaa.tex), and the other I use it to generate particular parts of the final document (e.g., figures, tables, etc.).

The structure is as follows:

folderA
|
|__ ccc.tex
|__ aaa.tex
|__ folderB
    |
    |__ bbb.tex

the files' content is as follows:

ccc.tex

\documentclass{article}

\usepackage{biblatex}
\addbibresource{biblio.bib} % or
%\bibliography{biblio}

aaa.tex

\input{ccc}

\begin{document}

\cite{test:2000}

\printbibliography

\end{document}

bbb.tex

\RequirePackage{import}
\subimport{../}{ccc}

%\addbibresource{../biblio.bib} % uncomment on or the other to work
%\bibliography{../biblio}

\begin{document}

some text~\cite{test:2000}.

\printbibliography

\end{document}

So my question is: is it possible to use biblatex without needing to specify \addbibresource{../biblio.bib} or \bibliography{../biblio} in bbb.tex?

Note that, I tried the previous approach with other packages (e.g., acro) and it worked without the need to change anything in the bbb.tex.

3

The following work-flow did it for me

  • Make sure you are in folderA/folderB, i.e. cd folderA/folderB
  • Call pdflatex bbb, you'll get the temp files in folderA/folderB next to bbb.tex
  • Call Biber biber --input-directory=.. bbb, that tells Biber to also look in .., i.e. folderA for files it can't find in the current directory, in particular ../biblio.bib is found
  • Call pdflatex bbb again

Alternatively

  • Go to folderA
  • Call pdflatex -output-directory=folderB bbb
  • Call biber bbb
  • pdflatex -output-directory=folderB bbb

also works (on MikTeX, I didn't test with TeX live).


Biber goes searching for .bib files as follows

  1. Absolute filename
  2. In the --input-directory, if specified
  3. In the --output-directory, if specified
  4. Relative to current directory
  5. In the same directory as the control file
  6. Using kpsewhich for supported formats, if available

The .bcf is searched for similarly, but of course the step 5 is missing.

Naturally the problem was that if you call biber in folderA/folderB the relative file name of your .bib file is ../biblio.bib. While import patches certain commands such as \in­put, \in­clude and \in­clude­graph­ics to be aware of the changing path if they are called from within a \subimport, there is no interface that tells biblatex to prefix all paths in \addbibresource commands it gets from subimport with ../.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.