Textmate 2 and Latex

latextextmate

How can I set the main file in Textmate 2 in order to make it compile my complete dissertation and not the file I am editing?

Best Answer

You need to tell your Latex editor where the main file of your dissertation is placed, in regard to the document you are editing. To define it, add this command to the header of the .tex file that you are editing:

%!TEX root = ../Main.tex

Just edit the path to your main file (in this example "../Main.tex") from the file you are editing. I usually have a file "main.tex" as master document and I link the chapters or sections of the document which are placed in sub-folder.

To try it out, open the menu Bundles -> Latex -> Project Management -> Open Master File With this line in the head the main.tex file will open. Then you can compile it directly from the included .tex file with Bundles -> Latex -> Typeset and View