[ESS] A RefTeX question with Sweave multi-file (variable reftex-file-extensions)
Laurent ESS
laurentESS at free.fr
Sun Jul 29 23:19:09 CEST 2012
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
More information about the ESS-help
mailing list