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: Tassilo Horn
Subject: Re: [AUCTeX] RefTeX + knitr: Multi-document with master *.Rnw file
Date: Wed, 14 Oct 2015 10:36:03 +0200
User-agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux)

David O'Shaughnessy <address@hidden> writes:

Hi David,

>>> 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.
>
> 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)?

Maybe, but I only tested very briefly.  I have never used knitr and just
made up some test files.  Do you have some minimal sample files I could
use for testing?

> Although I have fixed my referencing problem by setting
> reftex-default-bibliography in ~/.emacs (not ideal but it works for
> now).

Yes, that's the other thing I also have thought about.  You could also
set that buffer-locally as a file-local variable.  But of course that's
only concerned with citations and not references/toc.

> 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.

Yes, totally unaware.  RefTeX only knows about the include commands in
`reftex-include-file-commands'.

,----[ C-h v reftex-include-file-commands RET ]
| reftex-include-file-commands is a variable defined in ‘reftex-vars.el’.
| Its value is ("include" "input")
| 
|   This variable may be risky if used as a file-local variable.
| 
| Documentation:
| LaTeX commands which input another file.
| The file name is expected after the command, either in braces or separated
| by whitespace.
| 
| You can customize this variable.
`----

And as you can see, it expects include commands to be in TeX format,
i.e., it automatically constructs regexps matching \include{filename}
and \input{filename} but not
<<arbitray-stuff, child='filename', more-stuff>>=.

> Is there a way to bring these inserts into the reftex ToC list?

Not with the current version of RefTeX in Emacs Git master branch.  I
could add some additional variable `reftex-extra-include-file-regexps`
where you could add, e.g., a regexp like

  "<<[[:word:],[:space:]]+?child='\\([^']+\\)'[[:word:],[:space:]]*?>>="

which would match the filename in your above example.

Bye,
Tassilo




reply via email to

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