SublimeText / LaTeXTools

LaTeX plugin for Sublime Text
https://latextools.readthedocs.io/
2.01k stars 364 forks source link

Forward search not working in SumatraPDF #1397

Closed LinearChain closed 5 years ago

LinearChain commented 5 years ago

Hi,

I am using Sublime Text 3 with SumatraPDF on Windows 10. I have been using them for years on my laptop (Sublime Text 2 here). Two days ago I installed them on at the compute in my office. Very thing works except the forward search in SumatraPDF.

To be more precise, after compiling the tex file. Sumara does not the pdf file for me, but it focus on the position where it was closed and a warning message shows on the left top

Unknown scource file (C:\User.....tex)

Following is my user-setting

"windows": { // Path used when invoking tex & friends; "" is fine for MiKTeX // For TeXlive 2011 (or other years) use // "texpath" : "C:\texlive\2011\bin\win32;$PATH",`` "texpath" : "C:\texlive\2018\bin\win32;$PATH", // TeX distro: "miktex" or "texlive" "distro" : "texlive", // Command to invoke Sumatra. If blank, "SumatraPDF.exe" is used (it has to be on your PATH) "sumatra": "C:\Program Files (x86)\SumatraPDF\SumatraPDF.exe", // Command to invoke Sublime Text. Used if the keep_focus toggle is true. // If blank, "subl.exe" or "sublime_text.exe" will be used. "sublime_executable": "", // how long (in seconds) to wait after the jump_to_pdf command completes // before switching focus back to Sublime Text. This may need to be // adjusted depending on your machine and configuration. "keep_focus_delay": 0.5 },

I have also set

// Keep focus on Sublime Text after building (true) or switch to PDF viewer (false) // If you are on Windows or Linux and using ST2, you may need to set the // "sublime_executable" setting for this to work in your platform settings. "keep_focus": true, // Sync PDF to current editor position after building (true) or not "forward_sync": true,

I have been trying to solve this problem for two days. It will be very much appreciated, if someone can help!

LinearChain commented 5 years ago

By the way, the inverse search does work.

r-stein commented 5 years ago

Technically the sumatra viewer runs the following command: https://github.com/SublimeText/LaTeXTools/blob/master/viewers/sumatra_viewer.py#L126-L132

I.e. the sumatra executable -reuse-instance, -forward-search with the tex file, the line, and the pdf file. I would suggest to call the commands in the command line and check if they do work there.

LinearChain commented 5 years ago

Hi Stein, Thanks for your reply and suggestion! It seems the problem is just because all these files were copy from another compute, therefore are treated as unknown source. Once I edited the tex file, then everything works properly after complying.