Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When working with emacs+AUCTeX I would like to consider a project with one main.tex in which you have many include's. Is it possible somehow to open the included files from within the buffer where main.tex is loaded? Somehow make emacs understand that


in main.tex is a filename (with relative path) and open it either by clicking on it or hitting some keybinding when the courser is within the curly brackets?

A "bonus" question is probably the next step, that is to have some integrated "project manager" in emacs, where the included files are listed and one can browse the projects components. Does it sound reasonable? feasible? Any ideas?

share|improve this question
To clarify your question you may want to provide an example setup and describe exactly what you want to happen with it. –  N.N. May 7 '12 at 10:03
@N.N. Is it clearer? As an example think of org-mode and how you can C-c C-o a link in an org outline, and emacs opens the file/URL/etc. –  Dror May 7 '12 at 10:33
Yes, it is clearer. I guess one could write a function to do that if there is no way to do it directly. –  N.N. May 7 '12 at 11:12
I'm pretty sure reftex allows you to do exactly this. Let me check… –  Seamus May 7 '12 at 11:46

3 Answers 3

up vote 7 down vote accepted

I use find-file-at-point. It also works for #includes in C, sometimes imports in Python, URLs, etc.

(global-set-key (kbd "C-x f") 'find-file-at-point) ;; I hardly ever set the fill-column
share|improve this answer
A preliminary test suggest that this IS what I was looking for! Thanks! –  Dror May 8 '12 at 18:13

With reftex, C-c = will open a little table of contents. Once you've compiled the document, reftex should include the section headings of included files. You can use this menu to open included files. Indeed, if you press enter on a particular section, reftex will open the included file and put the pointer at the beginning of that section.

share|improve this answer
I know this option, and am using it. My bad that I didn't mention it. Anyway, having this option in mind I explicitly asked about opening the included document from "within" the buffer. Once again, sorry for my sloppiness. –  Dror May 7 '12 at 14:05
In addition, when the included file is nothing but a TikZ code, then this won't show up in the TOC generated by RefTeX. Clicking the included filename in this case should open the file with the TikZ code in another buffer. –  Dror May 8 '12 at 14:18
Yes, refTeX is looking for sectioning commands. I guess if you put your tikz code in a figure environment with a label, refTeX would find it then (when you pressed l to make it show all the labels) –  Seamus May 9 '12 at 9:31

If you have the included file with a specified TeX-master at the end, emacs/AUC-TeX automatically loads the corresponding "main.tex", too (at least with my version). Of course, this is not quite what you want, but I think it is a good idea to set the TeX-master for the child files: you can also compile them directly and emacs invoces the pdflatex on the correct main file etc.

For the "browser" thing, I use "speedbar" which gives you a list of all files in the directly (tree-like) and you can easily jump to sections/subsections etc inside the files.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.