auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUCTeX] RefTeX + knitr: Multi-document with master *.Rnw file


From: David O'Shaughnessy
Subject: Re: [AUCTeX] RefTeX + knitr: Multi-document with master *.Rnw file
Date: Wed, 14 Oct 2015 15:18:09 +1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 12/10/15 22:31, Tassilo Horn wrote:
> David O'Shaughnessy <address@hidden> writes:
> 
> Hi David,
> 
>> I have a multi-document structure that is a mixture of .tex and .Rnw
>> files. The main file (master.Rnw) calls the child .tex files with;
>> \include{file.tex}
>>
>> and the child .Rnw files (which are knitted) with;
>> <<chunk, child='file.Rnw'>>=
>> @
>>
>> I include my biblatex references in master.Rnw with;
>> \addbibresource{references.bib}
>>
>> I compile it all with a Makefile, and it works very smoothly. However,
>> I am having trouble getting RefTeX to play nice with this setup.
>> There are two problems:
>>
>> 1) In Emacs, reftex-citation does not recognize my bibliography when
>> inside child documents. I can fix this by setting TeX-master to
>> "master.tex", but not "master.Rnw", which leads to problem 2
>>
>> 2) While setting the master document as "master.tex" enables inserting
>> citations via reftex-citation in child documents, it breaks reftex-toc
>> by sending me into "master.tex" instead of "master.Rnw" (if I select a
>> ToC entry from the master file). Then I run the risk of making edits in
>> master.tex only to have them overwritten by master.Rnw when I do a
>> compile (which knits the contents of master.Rnw to master.tex).
>>
>> Is there a way to make RefTeX understand that the master file is an
>> .Rnw file?
> 
> I've just tried doing that by putting the following local variables
> section into the included tex files:
> 
> %%% Local Variables:
> %%% mode: latex
> %%% TeX-master: "test.Rnw"
> %%% TeX-default-extension: "Rnw"
> %%% End:
> 
> That seems to work although I only tested very briefly.
> 
> Bye,
> Tassilo

For some reason that doesn't work for me. reftex-toc is only aware of
the entire multi-document structure if I use;

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "master.tex"
%%% TeX-default-extension: "tex"
%%% End:

whereas;
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "master.Rnw"
%%% TeX-default-extension: "Rnw"
%%% End:

leaves reftex-toc only showing the structure for whatever child document
is in the buffer. Maybe my Emacs is too old (24.3.1)? Although I have
fixed my referencing problem by setting reftex-default-bibliography in
~/.emacs (not ideal but it works for now).

The other thing regarding reftex-toc is the inclusion of Rnw parts via
knitr;
<<chunk-name, child='child.Rnw'>>=
@

It seems to me that reftex-toc is unaware of these inserts. Is there a
way to bring these inserts into the reftex ToC list?

Thanks,

Dave.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]