28
votes
Accepted
What is best practice to set up Multi-file tex documents?
I think that the multifile howto is pretty easy, but as commented, it depends on what you want to achieve or how you organize your contents in the hard disk. Also, you must be aware that some packages ...
12
votes
Bibliographies when using subfiles
I also used Audrey's approach (https://tex.stackexchange.com/a/107111/85983) for a while, but I got annoyed of having to write \printbibliography at the end of each subfile. Now I'm using the ...
9
votes
Accepted
In TeXstudio, how to compile only the subfile?
You can use a magic comment called %!TeX root at the beginning of your subfile.tex to override the default root detection by TXS. This way, when you are in subfile.tex and press compile, TXS will ...
8
votes
path of figures in different directories with subfile latex
If you add \providecommand{\main}{..} in each of your subfiles before documentclass and \providecommand{\main}{.} in the same position in the main file, you can now replace every relative paths with, ...
8
votes
Accepted
How not to switch context when working on hierarchical documents in TeXStudio?
TeXStudio offers the option to declare a file as the master file. This is done in "Options > Root Document". This should also work in Texmaker.
8
votes
Accepted
Chapter bibliography using subfiles
Sub-bibliographies work with subfiles from version 1.5 onwards, available from Github or from CTAN. See its documentation. Note that it is no longer necessary to manipulate the path of files oneself. ...
8
votes
Problem with packages subfiles and import.sty after using TexLive Utility for updating
That is due to the recent addition to import.sty:
% Check for "./" currdir, and make \import@path@fix ensure trailing /
(see third-last paragraph of the manual too).
I don't know why one would ...
7
votes
Bbl file not generated
If you use TeXMaker, you should run bibtex or biblatex to generate the bbl file. It is not done automatically.
What I used to do, is first run pdflatex and then bibtex followed by two times pdflatex. ...
7
votes
How to work and compile efficiently in a multi-file project in Texworks?
You can use magical comments just as !TeX root=mainfile.tex with relative path as first line of your subfile.
Let's say you have the following document tree:
thesis.tex
chapters/
- chapone.tex
- ...
7
votes
Accepted
Subfiles package - two levels (subfile in subfile)
Answer 1
Don't worry about paths yourself, but make tex find the files for you by modifing the input path.
% !TeX root = main.tex
\documentclass{article}
\usepackage[english]{babel}
\usepackage[utf8]...
7
votes
Subfiles failing with custom class
This problem is resolved in version 1.2 (dated 2018/07/31) of the package, now available from CTAN. If your LaTeX system does not provide an integrated update mechanism, download the files subfiles....
7
votes
Accepted
Problem with packages subfiles and import.sty after using TexLive Utility for updating
The new import package code mis-handles an empty path segment and looks in the root of the filesystem rather than the current directory and unfortunately subfiles uses this form.
I think this gets ...
6
votes
path of figures in different directories with subfile latex
I approach this type of problem in this way. I have a command defined in the preamble that (re)sets the graphics path ...
\newcommand*{\resetfigpath}[1]{
\graphicspath{{#1/figures/}}
}
I call ...
6
votes
Latexdiff with subfiles
2 years after the question was asked, but I ended up writing a batch file for solving this in a windows environment:
@echo off
setlocal
set "old_path=..\..\tags\old_version\my_folder\"
set "new_path=...
6
votes
Bibliographies when using subfiles
Since version 2.0 of subfiles, one can also use the condition macro \ifSubfilesClassLoaded{}{} to do something similar as Audrey's approach (https://tex.stackexchange.com/a/107111/85983).
With my ...
6
votes
Accepted
Trouble when using the subfiles and wrapfig packages together
You need to make sure that the paragraph ends while wrapfig is in scope, subfiles probably ought to make \end{document} end the paragraph but it doesn't so unless you change the package you need a ...
6
votes
Is there a way to always compile the main document?
(Tom from Overleaf Support here.)
To me it seems that always wanting to compile the main file quite defies the purpose of using subfiles, but if you wish, you can do that by replacing
\documentclass[.....
5
votes
Subfolders and Subfiles
Inspired by the link that Timothy provided, I've come up with something slightly different:
main.tex:
\documentclass{article}
\usepackage{subfiles}
\usepackage{graphicx}
\begin{document}
% First ...
5
votes
How do I get consecutive section numbering for an entire document using subfiles?
Using the refcount and xr (or xr-hyper if you are using hyperref) packages in the main file, you could automatically retrieve the correct chapter (or whatever counter you want) number from the main ...
5
votes
Accepted
Possible ways to split up and then recombine lecture notes
Using subfiles you can get correct page numbering by using the zref-xr package.
Assuming your main file is main.tex:
\documentclass{book}
\usepackage{lipsum}
\usepackage{subfiles}
\usepackage{...
5
votes
Accepted
Does subfiles work with memoir?
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 ...
5
votes
Accepted
How to make bibliography to work in subfiles of a subfile?
If your goal is to print the complete bibliography at the end of every subfile, a simpler thing to do is the following:
Remove all \biblio... and \IfSubfil... commands from your current files.
Change ...
5
votes
Including standalone tikz in beamer
You never “can simply include” a file with \documentclass or other preamble code “with \input” into another document, because only one \documentclass per document is allowed and \documentclass inside ...
5
votes
Accepted
Including standalone tikz in beamer
You could use the standalone package:
\documentclass[aspectratio=169]{beamer}
\usepackage{tikz}
\usepackage{standalone}
\begin{document}
\begin{frame}
\input{stand.tex}
\end{frame}
\end{document}
(...
4
votes
Subfiles in subdirectory, file not found
I came accross the same problem you did when i compiled my first multi-file document using the subfiles package.
Since I am not a long term latex user i do not fully understand the mechanics of the ...
4
votes
Reference list from file for citations
\input is not the right tool; you can use catchfile instead to save the file contents in a macro that you can then expand at the right time.
\begin{filecontents}{\jobname-biblist1.tex}
ref1,ref2
\end{...
4
votes
Accepted
how to handle subfiles picture in latex
You need to add the search path to the image in the main document.
Assuming that:
(1) dolphin-book-2020.tex is in the directory BOOK
(2) The chapters are in BOOK/chapters
(3) The images are in BOOK/...
4
votes
Does subfiles work with memoir?
I used TeX Studio, default compiler and XeLaTeX both worked.
In addition to the example below I tried the article class.
Main.tex:
\documentclass{memoir}
\usepackage{blindtext}
\usepackage{lipsum}
\...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
subfiles × 277standalone × 25
cross-referencing × 20
include × 20
bibliographies × 19
input × 18
graphics × 13
bibtex × 13
biblatex × 12
compiling × 12
import × 12
table-of-contents × 9
chapters × 9
overleaf × 9
paths × 9
multiple-files × 9
tikz-pgf × 8
packages × 8
natbib × 7
texstudio × 7
preamble × 7
xr × 7
directory × 7
hyperref × 6
fancyhdr × 6