[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX] How to get forward-search from .Rnw documents with Okular?
From: |
Marius Hofert |
Subject: |
[AUCTeX] How to get forward-search from .Rnw documents with Okular? |
Date: |
Mon, 27 Aug 2012 16:17:20 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) |
Dear AUCTeX experts,
I am working with Ubuntu 12.04, Emacs 24 (with AUCTeX), and Okular 0.14. I have
forward-search (jumping from .tex to .pdf) and backward-search (jumping from
.pdf to .tex) enabled via the Okular -> Settings -> Editor -> Emacs client and
by some more settings. One of these settings is
,----[ Okular command ]
| okular --unique %o#src:%n`pwd`/./%b
`----
(see
http://mathieu.3maisons.org/wordpress/how-to-configure-emacs-and-auctex-to-work-with-a-pdf-viewer).
I
made this available on C-c C-v via
,----
| (setq TeX-view-program-list
| '(("Okular" "okular --unique %o#src:%n`pwd`/./%b")))
`----
In multi-file projects (involving, say master.tex and chapter.tex), I use
,----[ in chapter.tex ]
| %%% Local Variables:
| %%% mode: latex
| %%% TeX-master: "book.tex"
| %%% End:
`----
and
,----[ in master.tex ]
| %%% Local Variables:
| %%% mode: latex
| %%% TeX-master: t
| %%% End:
`----
With these settings, I get forward- and backward-search even in multi-file
projects, so everything works fine.
Now, let's go one step further. Assume you have a master file "master.tex" with
a
chapter "chapter.Rnw" which is now an Sweave (.Rnw). One problem is that the
standard backward-search jumps to chapter.tex and not chapter.Rnw anymore,
although changes (like corrections of errors) must be made in chapter.Rnw and
not chapter.tex which is created from chapter.Rnw. This problem can be solved
using the R package patchDVI from Duncan Murdoch. I attached a minimal example
of a project involving patchDVI/Sweave. One needs one additional file
(wrapper.Rnw) which specifies all .Rnw files in the project. Furthermore,
chapter.Rnw has to specify some settings. The project is compiled via
,----[ calling patchDVI's SweavePDF ]
| Rscript -e "patchDVI::SweavePDF('%t', encoding='utf8')"
`----
One then gets backward-search from master.pdf to chapter.Rnw, which is very
nice.
The question now is how to get forward search from chapter.Rnw to
master.pdf. Since chapter.Rnw is also in latex-mode, my hope was that the above
Okular command "okular --unique %o#src:%n`pwd`/./%b" would already do it, but I
obtain
,----
| "Output file "chapter.pdf" does not exist."
`----
Okay, obviously the master document master.pdf is not found/seen. I then tried
the Local Variables trick above, but I still obtain the above message.
How can the okular call be adjusted so that forward-search works? Somehow the %o
does not expand to the master.pdf (but chapter.pdf instead -- which of course
does not exist).
Although this question touches several areas, I decided to post it here (I hope
this is okay), since I saw the meanings of %o, %n ... explained in
/usr/share/emacs23/site-lisp/auctex/tex.el and thus made the connection to
AUCTeX.
Cheers,
Marius
wrapper.Rnw
Description: Binary data
master.tex
Description: Text Data
chapter.Rnw
Description: Binary data
- [AUCTeX] How to get forward-search from .Rnw documents with Okular?,
Marius Hofert <=