--- Begin Message ---
Subject: |
Re: [AUCTeX] Inverse Search with Evince & DBUS |
Date: |
Thu, 31 Mar 2011 21:02:04 +0200 |
Antoine Levitt <address@hidden> writes:
Hi Antoine,
> Great work, inverse search works out of the box, and I'm now able to
> ctrl-click in evince and get to the right location in emacs. Thanks!
Thank you.
> I haven't been able to make direct search work, though. Doc says
>
> Forward search happens automatically upon calling the viewer, [...]
>
> But that doesn't work using evince and (setq
> TeX-source-correlate-method 'synctex) (it always gets to the first
> page, and calls evince with -p 1 for some reason). Any pointers?
Hm, I have the exact same problem. But it used to work!
Let's see... Oh, I think its because of the directory structure. The
doc I'm testing with is a multifile one:
master.tex
master.pdf
master.synctex.gz
sections/sec1.tex
sections/sec2.tex
sections/sec3.tex
When I run the synctex command AUCTeX creates, I get this:
--8<---------------cut here---------------start------------->8---
$ synctex view -i 222:0:sections/sec3.tex -o master.pdf
This is SyncTeX command line utility, version 1.2
SyncTeX Warning: No tag for sections/sec3.tex
--8<---------------cut here---------------end--------------->8---
If I run it on the master.tex file, I get results.
--8<---------------cut here---------------start------------->8---
synctex view -i 22:0:master.tex -o master.pdf
--8<---------------cut here---------------end--------------->8---
Testing again with a single-file doc, the -p %(outpage) is correctly
expanded...
So it seems that forward search doesn't work with multifile
documents. :-(
Checking a bit more... Oh, that one works:
--8<---------------cut here---------------start------------->8---
$ synctex view -i 222:0:./sections/sec3.tex -o master.pdf
--8<---------------cut here---------------end--------------->8---
Note the "./". However, this does not work:
--8<---------------cut here---------------start------------->8---
synctex view -i 22:0:./master.tex -o master.pdf
This is SyncTeX command line utility, version 1.2
SyncTeX Warning: No tag for ./master.tex
--8<---------------cut here---------------end--------------->8---
So it seems, one has to use ./ for files in other directories, but it
has to be omitted for files in the current directory. That's a bit
strange...
Bye,
Tassilo
--- End Message ---
--- Begin Message ---
Subject: |
Re: [AUCTeX] Inverse Search with Evince & DBUS |
Date: |
Fri, 01 Apr 2011 08:28:10 +0200 |
Antoine Levitt <address@hidden> writes:
Hi again,
> I haven't been able to make direct search work, though. Doc says
>
> Forward search happens automatically upon calling the viewer, e.g. by
> typing C-c C-v (TeX-view). This will open the viewer or bring it to
> front and display the output page corresponding to the position of point
> in the source file. AUCTeX will automatically pass the necessary command
> line options to the viewer for this to happen.
>
> But that doesn't work using evince and (setq TeX-source-correlate-method
> 'synctex) (it always gets to the first page, and calls evince with -p 1
> for some reason). Any pointers?
My answer from yesterday didn't hit Gmane yet. Anyway, the problem
seems to be with multifile TeX docs, where the current file that is
given to synctex is in some subdir.
synctex view -i master.tex -o master.pdf # Works
synctex view -i sections/foo.tex -o master.pdf # Does not work
synctex view -i ./sections/foo.tex -o master.pdf # Works
synctex view -i ./master.tex -o master.pdf # Does not work
Here's a patch that makes synctex happy.
--8<---------------cut here---------------start------------->8---
Index: tex.el
===================================================================
RCS file: /sources/auctex/auctex/tex.el,v
retrieving revision 5.675
diff -r5.675 tex.el
1580,1583c1580,1589
< (file-relative-name
< (buffer-file-name)
< (file-name-directory
< (TeX-active-master))))
---
> (let ((file (file-relative-name
> (buffer-file-name)
> (file-name-directory
> (TeX-active-master)))))
> ;; Syntex requires files in the current
> ;; dir as foo.tex, but files in some
> ;; subdir as ./bar/foo.tex.
> (if (file-name-directory file)
> (concat "./" file)
> file)))
--8<---------------cut here---------------end--------------->8---
And here's a ChangeLog entry:
--8<---------------cut here---------------start------------->8---
2011-04-01 Tassilo Horn <address@hidden>
* tex.el (TeX-synctex-output-page): Provide tex file arguments in
subdirs with leading ./ which synctex requires.
--8<---------------cut here---------------end--------------->8---
Bye,
Tassilo
--- End Message ---