[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX] RefTeX + knitr: Multi-document with master *.Rnw file
From: |
Tassilo Horn |
Subject: |
Re: [AUCTeX] RefTeX + knitr: Multi-document with master *.Rnw file |
Date: |
Mon, 12 Oct 2015 14:31:57 +0200 |
User-agent: |
Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux) |
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