I have following example directory structure.

-       ArticleA
-   -       FileOnlyInArticleA.tex
-   -       Introduction.tex
-   -       main.tex
-   -       MainAsChapter.tex
-   -       RelatedWork.tex
-   -
-       ArticleB
-           FileOnlyInArticleB.tex
-           Introduction.tex
-           main.tex
-           MainAsChapter.tex
-           RelatedWork.tex

ArticleA , ArticleB is article document class while thesis is book document class. main.tex is main file for directories. I input other files from this main file. They work normal as individually.

I am trying to include ArticleA and ArticleB to thesis. I added MainAsChapter.tex to ArticleA and ArticleB. MainAsChapter.tex does not contain any latex document commands except inputs.

When I try to input following command in thesis/main.


last line works but input commands in ArticleA/MainAsChapter are interpreted as coming from thesis directory. It include Introduction and RelatedWork files from thesis directory and can not find for example FileOnlyInArticleA.

If I use


I get following error

! LaTeX Error: File `FileOnlyInArticleA.tex' not found.

If I use


I do not get any error but input commands in MainAsChapter include Introduction, RelatedWork from MainInThesis. So I get following output.

Introduction Thesis
Related Work Thesis
Introduction Thesis
Related Work Thesis

Second Introduction and RelatedWork should come from ArticleA.

Manual of import mentions that

Depending on on how your TEX system is configured, if a file with the same name as the import file exists in the current directory or in the TEXINPUTS path, that other file will be read in preference to one in the import directory.

Correct Usage is


This gives me , expected output of

Introduction Thesis
Related Work Thesis
Introduction ArticleA
Related Work ArticleA 

1 Answer 1


The current directory is not changed by \input. Files are searched first in the current directory (normally the main file directory) and then in predefined directories (where the packages etc. lie). This search path can be changed using the TEXINPUTS environment variable.

I think you can achieve what you are trying to do using the import package which allows relatives \inputs from imported files. See the package manual for the details.

You must log in to answer this question.

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