6

I use Aquamacs and TeX Live 2009 to edit my LaTeX files. As my publications tend to get quite big, I want to structure the source folder containing all my LaTeX files. Like e.g.

  • [bib]
  • [images]
  • [chapters]
    • chapter1.tex
    • chapter2.tex
  • main.tex

One can define the %%% TeX-master: "main" local variable at the end of each "sub" file to define a master file that contains all headers etc. That works fine if the subfiles are in the same directory as the main file. If I try to define the main file here (e.g. main.tex in chapter1.tex), LaTeX cannot find the specified file.

What can I do in this case?

Eric
  • 1,594
  • 1
  • 15
  • 29

3 Answers3

8

In Aquamacs' menu bar go to Latex / Multifile/Parsing / Reset Buffer or Shortcut ^C ^N. When specifying %%% TeX-master: "../main" in one of the chapters in the subfolders, the main tex file is correctly compiled!

Eric
  • 1,594
  • 1
  • 15
  • 29
3

Just an idea (not tested):

%%% TeX-master: "../main"

.. is the usual Unix shortcut for one directory level above. I don't know if this works for the TeX-master variable of AUCTeX, but it is worth a try.

Paŭlo Ebermann
  • 73,284
  • 20
  • 146
  • 210
  • In fact, it is ;) The problem was, that you have to reset your buffer in order to get Aquamacs to recognize, that the variable has changed (see following post). Thank you for your reply! – Eric Sep 27 '11 at 04:24
0

The main latex file which contains all the headers and gets compile can include all the chapter files via:

[...]
\input{chapters/chapter1.tex}
\input{chapters/chapter2.tex}
\input{chapters/chapterTitleOfChapter.tex}
[...]

You do not need to have each chapter include the main file. Or am I missing something you are doing?

Sardathrion - against SE abuse
  • 17,269
  • 27
  • 101
  • 156
  • 1
    Thank you for your reply. Yes, it is usual to include all the chapter like this. The reason why I want to define the TeX-Master variable is, that I don't have to jump back to the Main-buffer every time I want to compile my file. If the subpage is in the same directory, I click compile (in the chapter buffer) and aquamacs compiles the main-file for me. It doesn't, when the subpage is in a subdirectory... – Eric Sep 26 '11 at 16:28