My question is similar to this one, but I have a problem with relative paths when including files.
Assume I have three projects which all start with
\documentclass[12pt,a4paper]{article}
\usepackage[]{}
...
\usepackage[]{}
\begin{document}
...
\input{parts/chapter1}
...
\includegraphics{graphics/figure1.eps}
...
\end{document}
All these projects include own relative paths to other resources, e.g. graphics and chapters.
My goal is to build a new file that will contain all three including everything between \begin{document}
and \end{document}
, such that I can work on my three small projects and easily compile them into my PhD Thesis.
I could get it working with package catchfilebetweentags, but with full paths only. I also found another package import that helps to recognize relative paths. But I do not know how to combine these two packages. Can one help?
A simple example:
main.tex
\documentclass[12pt,a4paper]{article}
\usepackage{import}
\begin{document}
1.Hello World
\subimport{test/}{inputFile.tex}
\end{document}
test/inputFile.tex
\documentclass[12pt,a4paper]{article}
\begin{document}
2.Hello World\\
\input{inputFile2.tex}
\end{document}
test/inputFile2.tex
3.Hello World
It would work if I commented \documentclass[12pt,a4paper]{article}
, \begin{document}
, \end{document}
in inputFile.tex. But then I cannot compile inputFile.tex independently.
Best Answer
I got it working with
import
package and linux terminal commandsed
that creates inputFileDis.tex with the text between\begin{document}
and\end{document}
from inputFile.tex:which I need to run every time before I compile main.tex.
Then main.tex
test/inputFile.tex
test/inputFileDis.tex
test/inputFile2.tex
Does anyone have better solution in mind?