How can I setup SyncTex with qpdfview + LyX?

Asked by Uwe Jugel

I have been experimenting with the LyX settings and the source editor setting in qpdfview but could not achieve any reasonable results.

Helpful Links/Info I found so far:
* LyX SynTex settings: http://wiki.lyx.org/LyX/SyncTeX
* required qpdfview command (derived from man page): `qpdfview --unique [file[#src:name:line:column]]`

Did anybody already solve that problem and can give me some hints?

Question information

Language:
English Edit question
Status:
Answered
For:
qpdfview Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Adam Reichold (adamreichold) said :
#1

Hello Uwe,

By the Okular section in the LyX wiki, my first try would be

    qpdfview --unique "$$o#src:$$f:$$n:0"

as the PDF viewer for LyX and

    lyxeditor %1 %2

as the source editor in qpdfview. (For LyX 2.x that is.)

Best regards, Adam.

Revision history for this message
Adam Reichold (adamreichold) said :
#2

(Just noticed in the wiki, that this seems to require LyX 2.0.5 or later.)

Revision history for this message
Adam Reichold (adamreichold) said :
#3

Ok, I just tested this with LyX 2.0.5.1 and the "PDF command" should be

    qpdfview --unique "$$o#src:$$t:$$n:0"

which seems to work as expected. (After enabling "Document > Settings > Output > Synchronize with output".) (Have not tried reverse search yet.)

Revision history for this message
katy mith (katy-g-smith) said :
#4

I just tried the settings:

  qpdfview --unique "$$o#src:$$t:$$n:0" in lyx 2.1

and

  lyxeditor %1 %2 in qpdfview

This does not seems to work at all. Any idea why?

Revision history for this message
Adam Reichold (adamreichold) said :
#5

Hello katy,

can you be more specific what does not work at all? Do you get an error message that the SyncTeX data could not be found or is the position not found correctly? (And did you enable the "Synchronize with output" setting in LyX?)

Best regards, Adam.

Revision history for this message
katy mith (katy-g-smith) said :
#6

Hello Adam,

No. there is no error message but when I try to compile my lyx file I get no output.

However, I found the solution for this problem.

I fixed the problem by changing Lyx:Preferences->File formats->PDF
(pdflatex)->Viewer->PDFViewWin to Lyx:Preferences->File formats->PDF
(pdflatex)->Viewer->"qpdfview".

This It works fine. But I have a new problem that when I compile a different lyx file a new instance of qpdfview is opened. So, I am not able to make use of the tabbed functionality in qpdfview when working with lyx.

Any ideas?

Revision history for this message
Adam Reichold (adamreichold) said :
#7

Hello again,

I don't have LyX installed at the moment, but this sounds like the LyX's qpdfview preset does not use the "--unique" command-line option. Maybe there is a way to add this to the command-line that LyX uses? (If this doesn't help, I'll try to install LyX here tomorrow to give you more concrete advice...)

Best regards, Adam.

Revision history for this message
katy mith (katy-g-smith) said :
#8

Hello again, Adam

I thought about removing the --unique command. unfortunately that did not work. I still have multiple instances of qpdfview.

Many Thanks for your help.

Katy

Revision history for this message
katy mith (katy-g-smith) said :
#9

Actually another linked issue is that with qpdfview I am not able to refresh the existing PDF output. With for example Okular I was able to compile a lyx file and get an output as well as being able to refresh it once made changes in my tex code. Now with qpdfview I am bot able to do that. So I have to close qpdfview first then compile again. Please not that I already have in lyx: Document> settings> output> Synchronise with output already active with a custom macro \synctex=1. Actually changing this custom macro did not make much difference.

Katy

Revision history for this message
katy mith (katy-g-smith) said :
#10

I just tried something and seems to have solved my very last issue. I removed the command "lyxeditor %1 %2" in qpdfview (Edit>settings> source code) so it is blank. I am now able to refresh my pdf output from lyx.

Back again to the multitab issue... I hope you'll find some solution.

Best,
Katy

Revision history for this message
Arnaud Schmittbuhl (aschmittbuhl) said :
#11

Le Sun, 08 Sep 2013 07:31:26 -0000,
katy mith <email address hidden> a écrit :

> Question #220749 on qpdfview changed:
> https://answers.launchpad.net/qpdfview/+question/220749
>
> katy mith posted a new comment:
> Actually another linked issue is that with qpdfview I am not able to
> refresh the existing PDF output. With for example Okular I was able to
> compile a lyx file and get an output as well as being able to refresh
> it once made changes in my tex code. Now with qpdfview I am bot able
> to do that. So I have to close qpdfview first then compile again.
> Please not that I already have in lyx: Document> settings> output>
> Synchronise with output already active with a custom macro
> \synctex=1. Actually changing this custom macro did not make much
> difference.

Did you enable "auto-refresh" in qpdfview>settings>behavior ?

--
Arnaud Schmittbuhl

Revision history for this message
Adam Reichold (adamreichold) said :
#12

Ok, installed LyX 2.0.6 (which is the version currently in the Arch repositories as 2.1 seems to be still in beta) and used the command 'qpdfview --unique "$$o#src:$$t:$$n:0"' and activated "Synchronize with output" without any customizations and forward search seems to work as expected, with tabs and manually and automatically refreshing the document and all.
What I did was exporting the document to PDF using pdflatex and right-clicking somewhere into the document to choose "Forward search". Also setting the viewer for the PDF format to 'qpdfview --unique' and using LyX's "Display other format" and "Update other format" functions works as expected.

(I also found that the lyxediter-Command does not work, not sure how forward search is supposed to be done with the current LyX verison.)

Revision history for this message
Imad Ahmed (imad-a-ahmed) said :
#13

Hello,

I am currently using lyx 2.1 and here is what I have done:

Inside lyx 2.1 :

1- Preferences->File formats => PDF(pdflatex) =>Viewer => qpdfview --unique
2- Preferences->File formats => PDF(pdfxetex) =>Viewer => qpdfview --unique
3- Preferences->File formats => output => qpdfview --unique "$$o#src:$$t:$$n:0"
4- Document> settings> output> click on "Synchronise with outout" do not use any macros

Inside qpdfview:
Edit => Settings => Behaviour => source editor: lyxeditor 1% 2%

The above is a 100% working settings for qpdfview & lyx but Forward search did not work for me too. I replaced lyxeditor 1% 2% with lyxeditor f% l% but that had no difference.

Regards,
Imad Ahmed

Revision history for this message
Adam Reichold (adamreichold) said :
#14

Hello Imad,

thanks for sharing your test results for LyX 2.1! Note however that I began to mix up forward an d reverse search: When LyX instructs the PDF viewer to go to a specific position, I think it is called forward search. The other way around, i.e. the PDF viewer instructing LyX to go to a specific position, is called reverse search and this currently doesn't work since the "lyxeditor" executable doesn't seem to exist anymore. I think one does have to use "lyx --remote" and something... (In the command-line in qpdfview's settings, %1 is replaced by the file name and %2 by the line number. %f and %l will not be recognized.)

Best regards, Adam.

Revision history for this message
katy mith (katy-g-smith) said :
#15

Hello Imad and Adam,

Thanks for all your help. Problem is now solved. Both of you are stars!

By the way, I am using qpdfview as the main viewer from firefox. So when I download a pdf file, I was expecting qpdfview to pop up opening the pdf file in a similar way to Evince but that is not happening. I wonder if that is just my Ubuntu or Firefox. But again this only happens with qpdfview? It is a minor thing which I can live with but I thought I should mention it.

Thanks once again.
Katy

Revision history for this message
Markus Alexander Kuppe (c-launchpad-net-lemmster-de) said :
#16

Although four years old, here's how I got it working with LyX 2.2.2. With lyxeditor removed from the LyX distribution, I created /usr/local/bin/lyxeditor:

#!/bin/bash
echo "LYXCMD:lyx-script:server-goto-file-row:$1 $2"> ~/.lyx/lyxpipe.in

(The echo line did not work when entered directly as source editor into qpdfview)

Additionally, LyXServer pipe has to be started by setting the path in Tools > Preferences > Paths followed by a LyX restart.rr

Can you help with this problem?

Provide an answer of your own, or ask Uwe Jugel for more information if necessary.

To post a message you must log in.