Forum moved here!

Home / Sumatra PDF with TeXstudio Reopens

cirasj

I have Sumatra PDF set up for use with TeXstudio both on my Windows computer and my portable drive.

I have my Set inverse search command-line set to “C:\Program Files (x86)\TeXstudio\texstudio.exe” “%f” -line %l on my computer.
I have Set inverse search command-line set to “E:\texstudio-2.12.6\texstudio.exe” “%f” -line %l on my portable drive. I change the drive letter manually on the thumb drive when needed.

When I use the inverse search in Windows, I go back to the correct line without reopening TeXstudio.
When I use the inverse search on my portable drive, TeXstudio reopens and then the program go back to the correct line.

How can I stop Texstudio from reopening on my portable drive?

cirasj

I posted this a year ago with no responses so I am posting it again.

I have Sumatra PDF set up for use with TeXstudio both on my Windows computer and my portable drive.

I have my Set inverse search command-line set to “C:\Program Files (x86)\TeXstudio\texstudio.exe” “%f” -line %l on my computer.
I have Set inverse search command-line set to “E:\texstudio-2.12.6\texstudio.exe” “%f” -line %l on my portable drive. I change the drive letter manually on the thumb drive when needed.

When I use the inverse search in Windows, I go back to the correct line without reopening TeXstudio.
When I use the inverse search on my portable drive, TeXstudio reopens and then the program go back to the correct line.

How can I stop Texstudio from reopening on my portable drive?

GitHubRulesOK

Hi @cirasj
Apologies for not responding to earlier post, however not many of us use TeXstudio to be able to assist with confidence, IS your problem that whilst editing in one TeXstudio session on the Installed set-up it jumps back to the one session whilst in a portable set-up it Opens a second session ?

cirasj

It opens a second session.

GitHubRulesOK

Thanks, this is generally going to be related to Windows/TeXstudio rather than SumatraPDF as it has not changed much (if at all) in synctex handling.
Looking at the TeXstudio closed issues I see another user had similar problems with the change to the version you are using 2.12.6 they also checked that also occurred with 2.12.8 so the usual suggestion to update will not fix it. see https://github.com/texstudio-org/texstudio/issues/205
They seemed to concluded there was a change in the creation of .synctex files
Their final comment was “Your comment put me in the good track. I now see where the comment comes from. The path is the synctex is not relative but absolute and this is giving me problem. I manually edited the synctex file to make the path relative to current directory and the backward search works. I just need to find a workaround yet to make it work again.”
Thus their fix was to edit the .synctex file for portable use

cirasj

Thank you. I will try that out.

GitHubRulesOK

@cirasj
MyTests
Downloaded texstudio-2_12_6-win-portable (the subject of this issue). Expand the zip for portable use (I tested on desktop first to reduce any UAC interference). Launch texstudio.exe (ignore the warning about no LaTeX)

Go to options > configure and check External PDF Viewer is correctly detected as C:\Program Files\SumatraPDF… (the installed copy)
Load a sample TeX file (which has alongside it a previous compiled PDF and a prebuilt .synctex)

Open the pdf double-click in more than one location and confirm it jumps back to different locations in the existing session of TeXstudio (without opening a second session)
Installed set-up is functioning correctly as described

Move the portable copy of TeXstudio to another drive. Open Texstudio.exe which because is now on a different drive and a new launch it again warns there is no LaTeX found. Since it is portable it behaves exactly the same and actually opens the same previous pdf file in the known installed SumatraPDF.
Confirm it jumps back to different locations in the new single session of TeXstudio (without opening a second session) Portable TeXstudio and Installed SumatraPDF set-up is functioning correctly as it should

Re-assign the portable TeXstudio to use a portable copy of the installed SumatraPDF (copied to the portable drive) SumatraPDf defaults to a portable settings file without any knowledge of where TeXstudio is. Change inverse command to point to portable drive copy of TeXstudio (same syntax just different drive and path)
confirm it jumps back to different locations in the new single session of TeXstudio (without opening a second session)

Final test replace installed copy of SumatraPDF moved to portable drive with fully portable ones.
First tested 32bit works, as above, then tested 64bit, no difference works exactly the same.

Conclusion as long as a well formed .synctex file is alongside a .pdf it does not matter where the TeXstudio or SumatraPDF reside the reverse links will not change behaviour. for more on this issue and why the files are expected to be together see https://github.com/sumatrapdfreader/sumatrapdf/issues/25

Requirements the .synctex file must not change / interfere with the calling process
The command structure in each direction must be the same except where drive or path changes

What can make a difference is the way in which the pdfLaTeX engine builds/re-builds the .synctex files,
The design of .synctex used to mandate the .tex .pdf and .synctex files were together, recent engines changed that requirement, which can sometimes lead to issues with relative versus absolute addressing, hence pdfTeX was intentionally not present in my tests

FINAL TESTS to check if a second session can be triggered using the known good pdf
whichever SumatraPDF is use to open the one pdf it will correspondingly call as configured either the desktop TeXstudio or the Portable one (since there are now two)
Calling the same pdf from the other SumatraPDF will NOT open a second session of TeXstudio, it will respect whichever one is currently open, even if its not the one it was configured for.

I thus have to conclude for the present it is an issue within one of the TeX components or the structure of the .synctex they build.