emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Reverse lookup from pdf to org?
@ 2014-03-25 10:07 Rainer M Krug
  2014-03-25 13:11 ` Suvayu Ali
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Rainer M Krug @ 2014-03-25 10:07 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 718 bytes --]

Hi

I am working on a longish document which will be converted to pdf, and I
am doing debugging of scripts at the moment.

Therefore I export the document to pdf, and look for errors there. Now I
have to find the corresponding section in the org file - possible, but
tedious.

Would it be possibler to include reverse-lookup in org, so that I click
in the pdf, and the cursor jumps to the position in the org document? I
really like this feature when e.g. using LyX. 

I have no idea how this could be implemented and if this would be
difficult, but I think this could be a useful feature for longer documents.

Cheers,

Rainer

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982

[-- Attachment #2: Type: application/pgp-signature, Size: 494 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reverse lookup from pdf to org?
  2014-03-25 10:07 Reverse lookup from pdf to org? Rainer M Krug
@ 2014-03-25 13:11 ` Suvayu Ali
  2014-03-27  8:18   ` Rainer M Krug
  2014-03-25 17:17 ` Brett Viren
  2014-03-25 18:56 ` Nick Dokos
  2 siblings, 1 reply; 14+ messages in thread
From: Suvayu Ali @ 2014-03-25 13:11 UTC (permalink / raw)
  To: emacs-orgmode

On Tue, Mar 25, 2014 at 11:07:54AM +0100, Rainer M Krug wrote:
> Hi
> 
> I am working on a longish document which will be converted to pdf, and I
> am doing debugging of scripts at the moment.
> 
> Therefore I export the document to pdf, and look for errors there. Now I
> have to find the corresponding section in the org file - possible, but
> tedious.
> 
> Would it be possibler to include reverse-lookup in org, so that I click
> in the pdf, and the cursor jumps to the position in the org document? I
> really like this feature when e.g. using LyX. 
> 
> I have no idea how this could be implemented and if this would be
> difficult, but I think this could be a useful feature for longer documents.

I think this is only possible with synctex.  See this thread:
<http://thread.gmane.org/gmane.emacs.orgmode/78111>

Hope this helps,

-- 
Suvayu

Open source is the future. It sets us free.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reverse lookup from pdf to org?
  2014-03-25 10:07 Reverse lookup from pdf to org? Rainer M Krug
  2014-03-25 13:11 ` Suvayu Ali
@ 2014-03-25 17:17 ` Brett Viren
  2014-03-25 18:56 ` Nick Dokos
  2 siblings, 0 replies; 14+ messages in thread
From: Brett Viren @ 2014-03-25 17:17 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 678 bytes --]

Rainer M Krug <Rainer@krugs.de> writes:

> Therefore I export the document to pdf, and look for errors there. Now I
> have to find the corresponding section in the org file - possible, but
> tedious.

Not quite what you have in mind and maybe only a half-measure but when I
produce draft latex documents I like to turn on this package:

\usepackage[color]{showkeys}

It prints the symbol used for labels, references and citations in light
gray in the PDF output.  I can then search for these in the tex to find
the corresponding region.  To the extent they are set in your .org
source you might do similar.

A little screen cap is attached to show an example output.


-Brett.


[-- Attachment #1.2: foo.png --]
[-- Type: image/png, Size: 11842 bytes --]

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reverse lookup from pdf to org?
  2014-03-25 10:07 Reverse lookup from pdf to org? Rainer M Krug
  2014-03-25 13:11 ` Suvayu Ali
  2014-03-25 17:17 ` Brett Viren
@ 2014-03-25 18:56 ` Nick Dokos
  2014-03-25 20:29   ` Brett Viren
  2 siblings, 1 reply; 14+ messages in thread
From: Nick Dokos @ 2014-03-25 18:56 UTC (permalink / raw)
  To: emacs-orgmode

Rainer M Krug <Rainer@krugs.de> writes:

> Hi
>
> I am working on a longish document which will be converted to pdf, and I
> am doing debugging of scripts at the moment.
>
> Therefore I export the document to pdf, and look for errors there. Now I
> have to find the corresponding section in the org file - possible, but
> tedious.
>
> Would it be possibler to include reverse-lookup in org, so that I click
> in the pdf, and the cursor jumps to the position in the org document? I
> really like this feature when e.g. using LyX. 
>
> I have no idea how this could be implemented and if this would be
> difficult, but I think this could be a useful feature for longer documents.
>

One more (half-)possibility is as follows: produce the tex file and
compile it not with pdflatex, but with plain latex, producing a DVI
file. Passing the -src option to the latex invocation inserts "source
specials" into the DVI file that some DVI viewers (in particular, xdvi)
can interpret to jump back from the DVI view to the (approximate)
corresponding location in the tex file:

      latex --shell-escape -src foo.tex
      xdvi foo.dvi

C-<mouse1> at a location invokes your editor of choice (presumably
emacsclient) on the tex file and puts point in the general vicinity.

Invoking pdflatex with -src does not elicit any complaints, so it might
actually insert "source specials" in the PDF file, but even if it does I
don't know if any viewer is capable of interpreting them - xpdf does not
seem to be.

And it also leaves you in the tex file, not in the org file - hence
a half-possibility, or maybe even less.

Nick

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reverse lookup from pdf to org?
  2014-03-25 18:56 ` Nick Dokos
@ 2014-03-25 20:29   ` Brett Viren
  2014-03-27  9:12     ` Rainer M Krug
  0 siblings, 1 reply; 14+ messages in thread
From: Brett Viren @ 2014-03-25 20:29 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1119 bytes --]

Nick Dokos <ndokos@gmail.com> writes:

> One more (half-)possibility is as follows: produce the tex file and
> compile it not with pdflatex, but with plain latex, producing a DVI
> file. Passing the -src option to the latex invocation inserts "source
> specials" into the DVI file that some DVI viewers (in particular, xdvi)
> can interpret to jump back from the DVI view to the (approximate)
> corresponding location in the tex file:
>
>       latex --shell-escape -src foo.tex
>       xdvi foo.dvi

Okay, here is a crazy idea.  Maybe one can use hyperref and place \url{}
and/or \href{}{} macros in the org file.  These will turn into clickable
links in the final PDF.  In them place URLs that look like:

  file:///path/to/foo.tex.orglink?line=42

And then use .mailcap (or whatever MIME config that xpdf/evince/etc
honors) to map the .orglink extension to a script that parses the URL
(does that full URL get passed?) and invokes emacs to open foo.tex at
line 42?

If that much can be made to work (big if!) I see one problem in that the
/path/to will break if the source is moved.

Chance of success: 10%

-Brett.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reverse lookup from pdf to org?
  2014-03-25 13:11 ` Suvayu Ali
@ 2014-03-27  8:18   ` Rainer M Krug
  2014-03-27  8:59     ` Suvayu Ali
  0 siblings, 1 reply; 14+ messages in thread
From: Rainer M Krug @ 2014-03-27  8:18 UTC (permalink / raw)
  To: Suvayu Ali; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1122 bytes --]

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:

> On Tue, Mar 25, 2014 at 11:07:54AM +0100, Rainer M Krug wrote:
>> Hi
>> 
>> I am working on a longish document which will be converted to pdf, and I
>> am doing debugging of scripts at the moment.
>> 
>> Therefore I export the document to pdf, and look for errors there. Now I
>> have to find the corresponding section in the org file - possible, but
>> tedious.
>> 
>> Would it be possibler to include reverse-lookup in org, so that I click
>> in the pdf, and the cursor jumps to the position in the org document? I
>> really like this feature when e.g. using LyX. 
>> 
>> I have no idea how this could be implemented and if this would be
>> difficult, but I think this could be a useful feature for longer documents.
>
> I think this is only possible with synctex.  See this thread:
> <http://thread.gmane.org/gmane.emacs.orgmode/78111>
>
> Hope this helps,

Yes - but is there any progress to get it working? The file is not
included in the contrib directory.

Rainer

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982

[-- Attachment #2: Type: application/pgp-signature, Size: 494 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reverse lookup from pdf to org?
  2014-03-27  8:18   ` Rainer M Krug
@ 2014-03-27  8:59     ` Suvayu Ali
  2014-03-27  9:04       ` Rainer M Krug
  0 siblings, 1 reply; 14+ messages in thread
From: Suvayu Ali @ 2014-03-27  8:59 UTC (permalink / raw)
  To: emacs-orgmode

On Thu, Mar 27, 2014 at 09:18:43AM +0100, Rainer M Krug wrote:
> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> 
> > On Tue, Mar 25, 2014 at 11:07:54AM +0100, Rainer M Krug wrote:
> >> Hi
> >> 
> >> I am working on a longish document which will be converted to pdf, and I
> >> am doing debugging of scripts at the moment.
> >> 
> >> Therefore I export the document to pdf, and look for errors there. Now I
> >> have to find the corresponding section in the org file - possible, but
> >> tedious.
> >> 
> >> Would it be possibler to include reverse-lookup in org, so that I click
> >> in the pdf, and the cursor jumps to the position in the org document? I
> >> really like this feature when e.g. using LyX. 
> >> 
> >> I have no idea how this could be implemented and if this would be
> >> difficult, but I think this could be a useful feature for longer documents.
> >
> > I think this is only possible with synctex.  See this thread:
> > <http://thread.gmane.org/gmane.emacs.orgmode/78111>
> >
> > Hope this helps,
> 
> Yes - but is there any progress to get it working? The file is not
> included in the contrib directory.

In another thread Aaron says he does not use it regularly, and finds the
solution too "fiddly".  I guess that would mean there has been no more
progress on this.

-- 
Suvayu

Open source is the future. It sets us free.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reverse lookup from pdf to org?
  2014-03-27  8:59     ` Suvayu Ali
@ 2014-03-27  9:04       ` Rainer M Krug
  0 siblings, 0 replies; 14+ messages in thread
From: Rainer M Krug @ 2014-03-27  9:04 UTC (permalink / raw)
  To: Suvayu Ali; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1509 bytes --]

Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:

> On Thu, Mar 27, 2014 at 09:18:43AM +0100, Rainer M Krug wrote:
>> Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
>> 
>> > On Tue, Mar 25, 2014 at 11:07:54AM +0100, Rainer M Krug wrote:
>> >> Hi
>> >> 
>> >> I am working on a longish document which will be converted to pdf, and I
>> >> am doing debugging of scripts at the moment.
>> >> 
>> >> Therefore I export the document to pdf, and look for errors there. Now I
>> >> have to find the corresponding section in the org file - possible, but
>> >> tedious.
>> >> 
>> >> Would it be possibler to include reverse-lookup in org, so that I click
>> >> in the pdf, and the cursor jumps to the position in the org document? I
>> >> really like this feature when e.g. using LyX. 
>> >> 
>> >> I have no idea how this could be implemented and if this would be
>> >> difficult, but I think this could be a useful feature for longer documents.
>> >
>> > I think this is only possible with synctex.  See this thread:
>> > <http://thread.gmane.org/gmane.emacs.orgmode/78111>
>> >
>> > Hope this helps,
>> 
>> Yes - but is there any progress to get it working? The file is not
>> included in the contrib directory.
>
> In another thread Aaron says he does not use it regularly, and finds the
> solution too "fiddly".  I guess that would mean there has been no more
> progress on this.

Thanks a lot,

Rainer

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982

[-- Attachment #2: Type: application/pgp-signature, Size: 494 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reverse lookup from pdf to org?
  2014-03-25 20:29   ` Brett Viren
@ 2014-03-27  9:12     ` Rainer M Krug
  2014-03-27 14:30       ` Brett Viren
  0 siblings, 1 reply; 14+ messages in thread
From: Rainer M Krug @ 2014-03-27  9:12 UTC (permalink / raw)
  To: Brett Viren; +Cc: Nick Dokos, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1559 bytes --]

Brett Viren <bv@bnl.gov> writes:

> Nick Dokos <ndokos@gmail.com> writes:
>
>> One more (half-)possibility is as follows: produce the tex file and
>> compile it not with pdflatex, but with plain latex, producing a DVI
>> file. Passing the -src option to the latex invocation inserts "source
>> specials" into the DVI file that some DVI viewers (in particular, xdvi)
>> can interpret to jump back from the DVI view to the (approximate)
>> corresponding location in the tex file:
>>
>>       latex --shell-escape -src foo.tex
>>       xdvi foo.dvi
>
> Okay, here is a crazy idea.  Maybe one can use hyperref and place \url{}
> and/or \href{}{} macros in the org file.  These will turn into clickable
> links in the final PDF.  In them place URLs that look like:

I like the idea of reverse links - could be a nice addition when
enabled.

>
>   file:///path/to/foo.tex.orglink?line=42
>
> And then use .mailcap (or whatever MIME config that xpdf/evince/etc
> honors) to map the .orglink extension to a script that parses the URL
> (does that full URL get passed?) and invokes emacs to open foo.tex at
> line 42?

But jumping to the .org file would be the aim - right?

>
> If that much can be made to work (big if!) I see one problem in that the
> /path/to will break if the source is moved.

That would not be a problem, as this would primarily be a debugging /
draft feature.

>
> Chance of success: 10%

I guess higher?

Rainer

>
> -Brett.

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982

[-- Attachment #2: Type: application/pgp-signature, Size: 494 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reverse lookup from pdf to org?
  2014-03-27  9:12     ` Rainer M Krug
@ 2014-03-27 14:30       ` Brett Viren
  2014-03-27 14:43         ` Rainer M Krug
  0 siblings, 1 reply; 14+ messages in thread
From: Brett Viren @ 2014-03-27 14:30 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: Nick Dokos, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 529 bytes --]

Rainer M Krug <Rainer@krugs.de> writes:

> Brett Viren <bv@bnl.gov> writes:
>>   file:///path/to/foo.tex.orglink?line=42

> But jumping to the .org file would be the aim - right?

Yes, right.  Maybe a better example is:

  file://foo.orglink?line=42

which might get interpreted as "go to line 42 in ./foo.org".

This example is also a relative link which would be less brittle as long
as foo.org and foo.pdf are kept together in the same directory.

>> Chance of success: 10%
>
> I guess higher?

I like your optimism!

-Brett.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reverse lookup from pdf to org?
  2014-03-27 14:30       ` Brett Viren
@ 2014-03-27 14:43         ` Rainer M Krug
  2014-03-27 14:53           ` Nick Dokos
  2014-03-28  4:49           ` Marcin Borkowski
  0 siblings, 2 replies; 14+ messages in thread
From: Rainer M Krug @ 2014-03-27 14:43 UTC (permalink / raw)
  To: Brett Viren; +Cc: Nick Dokos, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 890 bytes --]

Brett Viren <bv@bnl.gov> writes:

> Rainer M Krug <Rainer@krugs.de> writes:
>
>> Brett Viren <bv@bnl.gov> writes:
>>>   file:///path/to/foo.tex.orglink?line=42
>
>> But jumping to the .org file would be the aim - right?
>
> Yes, right.  Maybe a better example is:
>
>   file://foo.orglink?line=42

calling

,----
| emacs +42 foo.org
`----

should open the file foo.org and put the cursor in line 42. 

>
> which might get interpreted as "go to line 42 in ./foo.org".
>
> This example is also a relative link which would be less brittle as long
> as foo.org and foo.pdf are kept together in the same directory.

Yes - that would be quite useful.

>
>>> Chance of success: 10%
>>
>> I guess higher?
>
> I like your optimism!

I am an optimist :-)

Cheers,

Rainer

>
> -Brett.

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 4474 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reverse lookup from pdf to org?
  2014-03-27 14:43         ` Rainer M Krug
@ 2014-03-27 14:53           ` Nick Dokos
  2014-03-27 15:00             ` Rainer M Krug
  2014-03-28  4:49           ` Marcin Borkowski
  1 sibling, 1 reply; 14+ messages in thread
From: Nick Dokos @ 2014-03-27 14:53 UTC (permalink / raw)
  To: emacs-orgmode

Rainer M Krug <Rainer@krugs.de> writes:


> calling
>
> ,----
> | emacs +42 foo.org
> `----
>
> should open the file foo.org and put the cursor in line 42. 
>

In most cases, it would be better to use emacsclient, otherwise
you might end up with many emacs instances; but more importantly
perhaps, using emacsclient avoids the initialization delay.

Nick

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reverse lookup from pdf to org?
  2014-03-27 14:53           ` Nick Dokos
@ 2014-03-27 15:00             ` Rainer M Krug
  0 siblings, 0 replies; 14+ messages in thread
From: Rainer M Krug @ 2014-03-27 15:00 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 604 bytes --]

Nick Dokos <ndokos@gmail.com> writes:

> Rainer M Krug <Rainer@krugs.de> writes:
>
>
>> calling
>>
>> ,----
>> | emacs +42 foo.org
>> `----
>>
>> should open the file foo.org and put the cursor in line 42. 
>>
>
> In most cases, it would be better to use emacsclient, otherwise
> you might end up with many emacs instances; but more importantly
> perhaps, using emacsclient avoids the initialization delay.

True - this was just a "proof of concept" kind of snippet.

Cheers,

Rainer
 
>
> Nick
>
>
>
>

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 4474 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Reverse lookup from pdf to org?
  2014-03-27 14:43         ` Rainer M Krug
  2014-03-27 14:53           ` Nick Dokos
@ 2014-03-28  4:49           ` Marcin Borkowski
  1 sibling, 0 replies; 14+ messages in thread
From: Marcin Borkowski @ 2014-03-28  4:49 UTC (permalink / raw)
  To: emacs-orgmode

Dnia 2014-03-27, o godz. 15:43:45
Rainer M Krug <Rainer@krugs.de> napisał(a):

> Brett Viren <bv@bnl.gov> writes:
> 
> > Rainer M Krug <Rainer@krugs.de> writes:
> >
> >> Brett Viren <bv@bnl.gov> writes:
> >>>   file:///path/to/foo.tex.orglink?line=42
> >
> >> But jumping to the .org file would be the aim - right?
> >
> > Yes, right.  Maybe a better example is:
> >
> >   file://foo.orglink?line=42
> 
> calling
> 
> ,----
> | emacs +42 foo.org
> `----
> 
> should open the file foo.org and put the cursor in line 42. 
> 
> >
> > which might get interpreted as "go to line 42 in ./foo.org".
> >
> > This example is also a relative link which would be less brittle as
> > long as foo.org and foo.pdf are kept together in the same directory.
> 
> Yes - that would be quite useful.
> 
> >
> >>> Chance of success: 10%
> >>
> >> I guess higher?
> >
> > I like your optimism!
> 
> I am an optimist :-)

You really are.

Inserting stuff like this into the TeX file /may/ very easily break it,
in the sense that it does compile, but /looks/ different (read: has
different line and/or page breaks) than without it.  (Though it /might/
be possible, I'm only saying that it would require much TeX expertise
and being very careful.  In fact, TeX4ht seems to do something similar
(though I never used it), so maybe I'm too pessimistic;).)

> Cheers,
> 
> Rainer

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Adam Mickiewicz University

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2014-03-28  4:49 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-25 10:07 Reverse lookup from pdf to org? Rainer M Krug
2014-03-25 13:11 ` Suvayu Ali
2014-03-27  8:18   ` Rainer M Krug
2014-03-27  8:59     ` Suvayu Ali
2014-03-27  9:04       ` Rainer M Krug
2014-03-25 17:17 ` Brett Viren
2014-03-25 18:56 ` Nick Dokos
2014-03-25 20:29   ` Brett Viren
2014-03-27  9:12     ` Rainer M Krug
2014-03-27 14:30       ` Brett Viren
2014-03-27 14:43         ` Rainer M Krug
2014-03-27 14:53           ` Nick Dokos
2014-03-27 15:00             ` Rainer M Krug
2014-03-28  4:49           ` Marcin Borkowski

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).