[ESS] A RefTeX question with Sweave multi-file (variable reftex-file-extensions)
Vitalie Spinu
spinuvit at gmail.com
Wed Dec 12 15:21:00 CET 2012
Hi Laurent,
Sorry for being late on this. I hope you have solved this yourself. If
not, the solution is to customize reftex-include-file-commands and add
SweaveInput to the list. It started working for me after a restart.
I didn't know about this till today, when I finally dived into it. I was
not even aware that reftex can recognize \input and \include. It never
worked for me. The reason is that reftex requires the file name to end
with .tex, but latex doesn't. So I was never appending .tex and, as a
consequence, was never seeing the full contents.
On a related theme, I have a problem with "C-c =" in slave
documents. That is, contents is blank when I invoke C-c = form the
included files. Does it work for you?
Thanks,
Vitalie
>> Laurent ESS <laurentESS at free.fr>
>> on Sun, 29 Jul 2012 23:19:09 +0200 wrote:
> Hi,
> I try for the first time to create a multi files Sweave document. All work
> fine to generate the pdf file. But I have an issue with the "C-c =" command when
> I want to work with the TOC for the file included par \SweaveInput. I use the
> latest Vincent Goulet emacs distribution, my OS is MS windows 7.
> As I read on the Sweave FAQ, I put in my .emacs.el, the code below :
> -----------------------------------------------------------------------------------
> (defun Rnw-mode ()
> (require 'ess-noweb)
> (noweb-mode)
> (if (fboundp 'R-mode)
> (setq noweb-default-code-mode 'R-mode)))
> (add-to-list 'auto-mode-alist '("\\.Rnw\\'" . Rnw-mode))
> (add-to-list 'auto-mode-alist '("\\.Snw\\'" . Rnw-mode))
> ;; Make TeX and RefTeX aware of rnw and Rnw files
> (setq reftex-file-extensions
> '(("rnw" "Rnw" "tex" ".tex" ".ltx") ("bib" ".bib")))
> (setq TeX-file-extensions
> '("rnw" "Rnw" "tex" "sty" "cls" "ltx" "texi" "texinfo"))
> ------------------------------------------------------------------------------------------------------------
> When I use C-c = the files are not found (I set the variable
> reftex-toc-include-file-boundaries to see the name of every file in the TOC) :
> output (see below for the structure of my files ) :
> -------------------------------------------------------------------------------------------------------------
> File main.rnw starts here
> 1 Introduction
> File file2 was not found
> 2 Conclusion
> File main.rnw ends here
> --------------------------------------------------------------------------------------------------------------
> My main file : main.rnw
> ---------------------------
> \begin{document}
> \section{introduction}
> \SweaveInput{addfile1.rnw}
> \include{addfile2.tex}
> \section{conclusion}
> \end{document}
> ;;; Local Variables: ***
> ;;; TeX-master: t ***
> ;;; End: ***
> --------------------------------
> My file included with \SweaveInput : addfile1.rnw
> \section{addfile1}
> <<plot1,echo=TRUE>>=
> plot(1:10)
> @
> %%% Local Variables:
> %%% TeX-master: "main.rnw"
> %%% End:
> ------------------------------------------------
> My file included with \Include : addfile2.tex
> \section{addfile2}
> %%% Local Variables:
> %%% TeX-master: "main.rnw"
> %%% End:
> When I use C-c = the files are not found.
> File main.rnw starts here
> 1 Introduction
> File file2 was not found
> 2 Conclusion
> File main.rnw ends here
> -------------------------------------------------------------------------------------------------------------
> If I comment the reftex-file-extensions line :
> ;; Make TeX and RefTeX aware of Snw and Rnw files
> ;;(setq reftex-file-extensions
> ;; '(("rnw" "Rnw" "tex" ".tex" ".ltx") ("bib" ".bib")))
> (setq TeX-file-extensions
> '("rnw" "Rnw" "tex" "sty" "cls" "ltx" "texi" "texinfo"))
> ------------------------------------------------------------------------------
> When I use C-c = addfile2.tex is found but not the addfile1.rnw :
> ------------------------------------------------------------------------------
> output :
> -----------
> File main.rnw starts here
> 1 Introduction
> File addfile2.tex starts here
> 2 addfile2
> File addfile2.tex ends here
> 3 conclusion
> File main.rnw ends here
> -------------------------------------------------------------------------------
> So, I try to set the variable reftex-file-include-commands to ("include"
> "input" "SweaveInput"), but it doesn't work.
> I have been searching for a day (I don't know very well emacs-Auctex-Reftex).
> Thank you very much for your help.
> Best regards
> Laurent
> ______________________________________________
> ESS-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
More information about the ESS-help
mailing list