I am considering whether to to try to use subfiles with memoir, biber, and xelatex. Before I try, I wanted to ask: does this kind of setup work with subfiles?

Usually I would just try it myself and see, but this question on SE has made me hesitate because it suggests that similar setup does not work, then a self-answer, which is marked as accepted, has an "EDIT" that says that it only works to compile the mainfile but not the individual subfiles. But compiling the subfiles is of course the whole point of using subfiles.

In other words, what I want to know is whether subfiles a robust package that should work with all these different complex packages and software -- or is it really just designed for simple LaTeX documents without automated bibliography, Unicode, or other complications?

2 Answers 2


Answer to the main question: Yes, the subfiles package will most likely work. I edited the almost correct answer of B Hos to make his example work. The crucial point when using subfiles is to ensure that the paths are correct; here it meant to wrap the command \subfix around the bibliography file. See the docs for details.

The problem in the old thread is actually not a subfiles problem but related to the specific TeX editor used: How to tell it what the current main file is, for typesetting and displaying? Otherwise, posts older than two years are probably not useful anymore, as both, LaTeX and the subfiles package, changed considerably in October 2020.

General remark: Do you have a good reason for using the subfiles package? To structure the source of a large document, the most robust way is still to use \input (and to a lesser extent \include), and to comment/uncomment these \input statements as needed. The main document may look like


to typeset the introduction only. With a really large document, the included files may consist of \inputs themselves. Since \input is built in to (La)TeX, it works seamlessly with all packages and all TeX tools (including editors).

  • In my setup, I have a sections/ directory where I put an ever-changing collection of files, each one added or renamed as I draft and move around sections or chapters of a book. I then have a simple script to generate a file with the necessary \input commands for everything that is in sections/. So it is trickier to just comment things out -- or rather that commenting is overwritten each time I write the script. But you're probably right that it may nevertheless be the simplest way to do it. Oct 10, 2022 at 16:23

I used TeX Studio, default compiler and XeLaTeX both worked. In addition to the example below I tried the article class.




\title{Subfiles package example}
\date{ }

    \section{Second section}





    author={Potter, Joe},
    journaltitle={Alpine Journal},

    author={Anderson, Joan},
  • Were you able to get the bibliography to work when compiling the subfile? You didn't include bibliography.bib, so I added it in the same directory as main.tex. But then running biber (after running xelatex) on introduction.tex, I get "ERROR - Cannot find 'bibliography.bib'!" Oct 10, 2022 at 4:03
  • 1
    @AlexRoberts I corrected the example, it should work now.
    – gernot
    Oct 10, 2022 at 11:18

You must log in to answer this question.

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