I want to provide some structure for my thesis source files. I decided to use nested directories. Every directory contains main.tex index file to be imported by a file in the parent directory.
From Path to External Files in Nested \input I learned about import package, however it is not working for me.
For the simplest case
/
+- main.tex: |\documentclass{report}
| |\usepackage{import}
| |\begin{document}
| |main
| |
| |\subimport{a}{main.tex}
| |\end{document}
+- a/
+- main.tex: |a main
I expect to have result like:
main
a main
Instead, I get the following error during compilation:
$ pdflatex main
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian)
restricted \write18 enabled.
entering extended mode
(./main.tex
LaTeX2e <2011/06/27>
Babel <3.9h> and hyphenation patterns for 5 languages loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/report.cls
Document Class: report 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/import/import.sty) (./main.aux)
(./main.tex
! LaTeX Error: Can be used only in preamble.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.1 \documentclass
{report}
\subimport{a}{main} nor \subimport{a/}{main} neither works.
How can I tell the import package not to look for import files in the root directory? Also I wonder, if the issue won't occur in subdirectories too (at the moment I was unable to cause it).
\importat all? just use\input{a/main}but i see no advantage in giving multiple files the same name. – David Carlisle Feb 08 '17 at 21:00\inputcommands with relative paths. – TeXnician Feb 08 '17 at 21:14\input{b}(in/a/a.texincluded in/main.texwith\input{a/a}) to include/a/b.tex. Result:LaTeX Error: File \b.tex' not found` – abukaj Feb 08 '17 at 21:28\inputfile is? – abukaj Feb 08 '17 at 21:41