Suppose i have a main repertory 'main' containing a file 'main.tex' and a child repertory named 'subfile' himself containing a file called 'subfile1.tex'. Thanks to this link https://fr.sharelatex.com/learn/Multi-file_LaTeX_projects i can write in subfile1.tex using the preambule of main.tex writing this first line in subfile1.tex :
\documentclass[../main.tex]{subfiles}
Now i would like to create an arborescence from the main directory. Imagine i would like to create a subfolder of the repertory 'subile' called 'subsubfile' and place inside it a file called 'subsubfile1.tex'. Now i shoul write in the preambule of 'subsubfile1.tex' :
\documentclass[../../main.tex]{subfiles}
And i can continue the process... So it is boring to count each time the hierarchy and to add the corresponding number of '../' before 'main.tex'. Isn't there an automatic way of doing it ?
In fact it is not just an artificial example. I use Zim Wiki whose syntaxe create $subfolder_{ij}$ of a $folder_i$ to construct a subtopic j of a topic i. So the tree hierarchy is complex (can be quite deep) and change in the time while i am adding new child topics. But the main repertory called 'main' is always at the same absolute Path inside my dropbox folder (it is the root folder in Dropbox Folder) .
1)I first thought to place an absolute path:
\documentclass['C:/Users/Eric/Dropbox/main/main.tex']{subfiles}
but this line of code isn't recoginsed
2) Since i used my folder on different OS (linux and windows) a relative path would be better but it should
\documentclass[/Users/Eric/Dropbox/main/main]{subfiles}works fine – samcarter_is_at_topanswers.xyz Apr 15 '18 at 11:24\documentclass[C:/path/to/file.tex]{subfiles}works for me. – Max Meijer Sep 20 '20 at 12:58