How can I reference an external LaTeX chapter using reftex in Emacs?
Pregunta
I'm editing a chapter that is part of a larger LaTeX project that includes multiple chapters, and I'm trying to use C-c ) to put in a cross reference, but reftex finds only the labels in the current buffer (chapter). According to the reftex manual, pressing x
will tell reftex to look in an external document, but that works only if you use the xr package, which I do not need for my document.
Suggestions?
Solución
If you use AuCTeX you can use a file local variable to let the chapter file know about the main file and get all labels to be able to refer across all the document. See http://www.gnu.org/software/auctex/manual/auctex/Multifile.html
Otros consejos
I ended up putting this at the end of all of my *.tex files that are sourced by the master file:
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "relative/path/to/master/tex/file"
%%% End:
This tells reftex/auctex where to look for the master file.
You may also need to put
(add-hook 'LaTeX-mode-hook (function turn-on-reftex))
(setq reftex-plug-into-AUCTeX t)
in your ~/.emacs file. I'm not sure this is necessary, but it apparently adds good functionality.