12

Currently, I am writing a large report. In my previous ones, I always had the chapters and the main file (thesis.tex) in the same directory as the individual chapters. This time, however, I created a subfolder called "chapters" and put the chapter .tex files in there. But obviously, the command

%!TEX root = thesis.tex"`

which I previously put at the beginning of each chapter.tex, does not work anymore. Since I work on the report from different locations, I can not define an absolute path but need to define a relative one. I tried %!TEX root = ../thesis.tex and /%!TEX root = thesis.tex, both of which do not work.

I found threads and solutions for \input and other commands, none of which solve by problem, though. If anyone was able to shed some light here, I'd be very thankful!

1

3 Answers 3

19

Try %!TEX root = ../thesis.tex

5
  • 1
    Thanks, that's actually what I tried to do. Unfortunately, that does not work...
    – ribrob710
    Commented Dec 6, 2013 at 12:55
  • Try again with a minimal example and directory structure. This should definitely work.
    – Ingmar
    Commented Dec 6, 2013 at 13:17
  • I get the error message "the file {parent directory}/chapters/../thesis.tex could not be read".
    – ribrob710
    Commented Dec 6, 2013 at 15:15
  • The path in the error message is correct, though? Have you checked permissions?
    – Ingmar
    Commented Dec 6, 2013 at 16:46
  • Permission is not a problem, the thing is that tex interprets ../ as a folder called .. As a result it does not try to access the parent directory but the subfolder .. in the chapters folder.
    – ribrob710
    Commented Dec 8, 2013 at 11:16
5

Although this is an old question, it seems still actual. I stepped over the same problem and

../thesis.tex

did not do it for me. Since I am using Windows, I tried a backslash instead:

..\thesis.tex

and guess what - that did it. Hope that helps you Windows users out there ;-)

3

Not sure if you still need help and maybe my solution is not what you need, but here it goes: The structure in my project basically looks like

/.../MScThesis/chapters/partI

The main.tex (in your case thesis.tex) file is in the MScThesis folder and the written stuff itself is in a sub-sub-folder.

I use

% !TEX root =  ../../main.tex 

and that works fine. Basically varying the amount of "../" until you reach the right folder above. So in case you have more than just one subfolder, this should do the trick. I have no idea what your chapter-folder looks like so maybe this is a useless answer, but well :)

0

You must log in to answer this question.

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