You can solve this problem by using
Polymode<https://github.com/vitoshka/polymode>
.

;;; Emacs polymode
(setq load-path
      (append '("~/.emacs.d/polymode/"  "~/.emacs.d/polymode/modes")
              load-path))

(require 'poly-R)
(require 'poly-markdown)
(require 'poly-noweb)





On Thu, Jul 18, 2013 at 12:27 PM, Frank Harrell <f.harrell@vanderbilt.edu>wrote:

> Thanks.  That works - sort of.  My problems are -
>
> - how to get reftex-mode to auto start when entering an Rnw or .tex file
> - how to get the mode to persist
>
> Once reftex-mode is in effect I can do C-c = and it works fine.  But if I
> move the cursor to a line of R code reftex mode is deactivated and C-c = no
> longer works when I return the cursor to a LaTeX line.
>
> Frank
>
>
>
> On 07/18/2013 01:49 AM, Stephen Eglen wrote:
>
>> I have been stymied trying to figure out the optimum configuration of
>>> Emacs for use with ESS and AUCTeX.  In the old days I remember using
>>> Emacs with AUCTeX and easily getting a document overview showing
>>> \section, \subsection etc.  Now I can't see how to get a document
>>> overview.
>>>
>>
>> Hi Frank,
>>
>> AUCTEX's "C-c =" (M-x reftex-toc) should work still both in .tex
>> buffers, and .Rnw when you are in tex chunks.  Is that not working for
>> you?
>>
>> Stephen
>>
>>
>>
> --
> Frank E Harrell Jr Professor and Chairman      School of Medicine
>                    Department of Biostatistics Vanderbilt University
>
> ______________________________**________________
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/**listinfo/ess-help<https://stat.ethz.ch/mailman/listinfo/ess-help>
>



-- 
Ahmadou H. DICKO
statistician and applied economist (ISE)
PhD student in Climate change economics
Faculty of economics and managment - Cheikh Anta Diop University
West African Science Service Center on Climate Change and Adaptated Land
Use (WASCAL)
Center for Development Research (ZEF) - University of Bonn
email : ahmadou.dicko@ucad.edu.sn
twitter : @dickoah
github : github/dickoa <https://github.com/dickoa>
tel : +221 33 827 55 16
portable: +221 77 123 81 69



-- 
Ahmadou H. DICKO
statistician and applied economist (ISE)
PhD student in Climate change economics
Faculty of economics and managment - Cheikh Anta Diop University
West African Science Service Center on Climate Change and Adaptated Land
Use (WASCAL)
Center for Development Research (ZEF) - University of Bonn
email : ahmadou.dicko@ucad.edu.sn
twitter : @dickoah
github : github/dickoa <https://github.com/dickoa>
tel : +221 33 827 55 16
portable: +221 77 123 81 69

	[[alternative HTML version deleted]]

