sumatrapdfreader / sumatrapdf

SumatraPDF reader
http://www.sumatrapdfreader.org
GNU General Public License v3.0
13.67k stars 1.73k forks source link

Problem with Forward Search #3885

Open NWermes opened 12 months ago

NWermes commented 12 months ago

I use SUMATRA PDF as viewer for PDFLatex from Winedt Editor under Windos 11, which runs under a MAC notebook with M1 processor using the Parallels platform.

I have a problem with Forward Search in WinEdt -> Sumatra that puzzles me for several months now. Before I had an "old" MAC notebook running the same SUMATRA version under Windows 10 and it worked like a charm with identical Forward Search settings.

I have played with the settings and reinstalled SUMATRA, but without any success.

I uninstalled and installed SUMATRA 3.5.2 64-bit builds and ARM 64-bit builds WHich one is correct for me?

No change in either case.

If anyone has an idea what I could check next or whether she/he has had Forward Search problems, too I would be grateful for any hints. thanks,

GitHubRulesOK commented 12 months ago

Mac is unsupported so you will need to check yourself what version can run there with minimal issues. I would suggest for PDFLaTeX the old XP 32bit 3.1.2 portable would be the most stable for testing needs unzipping https://www.sumatrapdfreader.org//dl//rel/3.1.2/SumatraPDF-3.1.2.zip or for most modern try the latest super duper pre-release https://www.sumatrapdfreader.org/dl/prerel/15893/SumatraPDF-prerel-32.exe

As for forward search WinEdt will adjust itself if SumatraPDF is fully installed first, thus a portable version as I am suggesting would need manual settings. there should be many guides for the combination and I think my notes should still apply https://github.com/GitHubRulesOK/MyNotes/blob/master/AppNotes/SumatraPDF/LATeX%20and%20Reverse-Search.pdf

TL;DR SumatraPDF inverse command (ensure UseTabs = true and ReuseInstance is = true) WinEdt = "path to editor\winedt.exe" "[Open(|%f|);SelLine(%l,8)]" on miktex pdf viewer set syctex options

https://tex.stackexchange.com/questions/85060/pdf-viewer-with-auto-update-for-winedt/85117 and https://tex.stackexchange.com/questions/464885/how-to-configure-inverse-search-with-winedt-okular-configuration/464909#464909

some use SelPar some use ' in place of | still need to test each option with SumatraPDF

NWermes commented 11 months ago

Sorry to come back to this. While I have a MAC I run SUMATRA in Windows11 using the Parallels virtual machine. Why should this be different than running SUMATRA directly under Windows 11. How can I check that “Forward Search” is actually working for SUMATRA and if it doesn’t that the cause is at the program that call SUMATRA for viewing? Thanks a lot Norbert

On 16 Nov 2023, at 14:20, GitHubRulesOK @.***> wrote:

Mac is unsuported so you will need to check yourself what version can run there with minimal issues. I would suggest for PDFLaTeX the old XP 32bit 3.1.2 portable would be the most stable for testing needs unzipping https://www.sumatrapdfreader.org//dl//rel/3.1.2/SumatraPDF-3.1.2.zip or for most modern try the latest super duper pre-release https://www.sumatrapdfreader.org/dl/prerel/15893/SumatraPDF-prerel-32.exe

— Reply to this email directly, view it on GitHub https://github.com/sumatrapdfreader/sumatrapdf/issues/3885#issuecomment-1814425442, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO7WIE7MGMUGAWFAB7XEDZDYEYHJFAVCNFSM6AAAAAA7ODUNS6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJUGQZDKNBUGI. You are receiving this because you authored the thread.

————————————————————————————————— Norbert Wermes Senior-Professor of Physics

Bonn University phone +49 - 228 - 73 - 3533 (office) Physikalisches Institut +49 - 228 - 73 - 3225 (secretary) Nussallee 12 fax +49 - 228 - 73 - 3220 53115 Bonn email: @.*** Germany www: http://hep1.physik.uni-bonn.de ————————————————————————————————— Particle Detectors: Fundamentals and Applications by Hermann Kolanoski and Norbert Wermes link https://global.oup.com/academic/product/particle-detectors-9780198858362 book at Oxford University Press https://global.oup.com/academic/product/particle-detectors-9780198858362

GitHubRulesOK commented 11 months ago

ok a simple test in windows is to use a known working set this should download a zip file https://github.com/GitHubRulesOK/MyNotes/raw/master/AppNotes/SumatraPDF/LATeX%20and%20Reverse-Search.zip

if you 1st open sync.pdf to prove inverse search with SumatraPDF and double click Hello World it should open the sync.tex file in an editor.

With MS Notepad (without its goto enabled) it will simply goto 1st line but with a correctly configured notepad or other LaTeX editor it should goto line 9

With that out of the way we can try the opposite and in a cmd prompt run

SumatraPDF.exe -forward-search "sync.tex" 9 "sync.pdf"

You should see by default a brief flash of blue over the hello world line proving that given the correct forward search the same file will be searched forwards to hello world. for better understanding in SumatraPDF advanced settings

ForwardSearch [
    HighlightOffset = 0
    HighlightWidth = 15
    HighlightColor = #6581ff
    HighlightPermanent = false

change that line to HighlightPermanent = true (file save settings and run command again image

All that proves is there is nothing whatsoever wrong with that installation any problems are caused by the external applications configuration.

ok what about installed AND pre-release AND throw in another new window to see if it works there too image

Now for icing on the cake you can write a cmd line script such that edit a tex in MS Notepad then cmd pdflatex synctex and a double click in SumatraPDF will inverse-search the same line in MS Notepad however its easier with a speel checking LaTeX IDE if configured correctly

image

What can go wrong?

Clearly if the wrong SumatraPDF, or wrong text filename is given, or the compile failed then forward cannot work and thus reverse will be suspect. image

Likewise if the synctex was wrong for any reason the reverse-search could go ape to wrong position or not at all. however be aware synctex may use the end or start of a block or document as a synctex default for some LaTeX constructs. So if Iclick to the left of tauma-thingy it may jump a different part without highlight

image

NWermes commented 11 months ago

Hi, I did what you suggested. I stored sync.pdf in the downloads folder and opened it with SumatraPDF.exe. It displayed the “Hello World” text. Then I opened a Terminal and selected the folder where SumatraPDF.exe is contained (see attached screen shot). The command

SumatraPDF.exe -forward-search "sync.tex" 9 “sync.pdf"

is not accepted (see screen shot). Thanks Norbert

On 19 Nov 2023, at 00:37, GitHubRulesOK @.***> wrote:

ok a simple test in windows is to use a known working set this should download a zip file https://github.com/GitHubRulesOK/MyNotes/raw/master/AppNotes/SumatraPDF/LATeX%20and%20Reverse-Search.zip

if you 1st open sync.pdf to prove inverse search with SumatraPDF and double click Hello World it should open the sync.tex file in an editor with MS Notepad without a got enabled it will simply goto 1st line but with a correctly configured notepad or other editor it should goto line 9

With that out of the way we can try the opposite and in a cmd prompt run

SumatraPDF.exe -forward-search "sync.tex" 9 "sync.pdf" You should see by default a brief flash of blue over the hello world line proving that given the correct forward search the same file will be searched forwards to hello world. for better understanding in SumatraPDF advanced settings

ForwardSearch [ HighlightOffset = 0 HighlightWidth = 15 HighlightColor = #6581ff HighlightPermanent = false change that line to HighlightPermanent = true (file save settings and run command again https://user-images.githubusercontent.com/12754913/284028139-49992d4f-35d1-4bbf-989c-b69d7187c869.png All that proves is there is nothing whatsoever wrong with that installation any problems are caused by the external applications configuration.

— Reply to this email directly, view it on GitHub https://github.com/sumatrapdfreader/sumatrapdf/issues/3885#issuecomment-1817678161, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO7WIE3VO2QM6GHATVWXRHLYFFBFBAVCNFSM6AAAAAA7ODUNS6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJXGY3TQMJWGE. You are receiving this because you authored the thread.

————————————————————————————————— Norbert Wermes Senior-Professor of Physics

Bonn University phone +49 - 228 - 73 - 3533 (office) Physikalisches Institut +49 - 228 - 73 - 3225 (secretary) Nussallee 12 fax +49 - 228 - 73 - 3220 53115 Bonn email: @.*** Germany www: http://hep1.physik.uni-bonn.de ————————————————————————————————— Particle Detectors: Fundamentals and Applications by Hermann Kolanoski and Norbert Wermes link https://global.oup.com/academic/product/particle-detectors-9780198858362 book at Oxford University Press https://global.oup.com/academic/product/particle-detectors-9780198858362

GitHubRulesOK commented 11 months ago

email does not include image

hmm I should have perhaps been clearer the test is like all latex commands expected to be relative to current working folder so the command would need the correct paths included

Forward from editor (or console)

"drive:\path to \sumatrapdf.exe" -forward-search "drive:\path to\sync.tex" 9 "drive:\path to\sync.pdf"

Reverse from SumatraPDF

"drive:\path to \editor.exe" and here the syntax is as required by the editor usually as substitute "%f" %l (= %file %line) but per docs
NWermes commented 11 months ago

Thanks and sorry, of course full paths are required. Anyway, I placed both files in the directory of SumatraPDF.exe

PS C:\Users\wermes\AppData\Local\SumatraPDF> ls

Directory: C:\Users\nwermes\AppData\Local\SumatraPDF

Mode LastWriteTime Length Name


d----- 11/19/2023 7:02 PM sumatrapdfcache -a---- 11/16/2023 4:31 PM 12679680 libmupdf.dll -a---- 11/16/2023 4:31 PM 252416 PdfFilter.dll -a---- 11/16/2023 4:31 PM 543232 PdfPreview.dll -a---- 11/19/2023 7:03 PM 3132 SumatraPDF-settings.txt -a---- 11/16/2023 4:30 PM 7477208 SumatraPDF.exe -a---- 11/28/2017 8:39 PM 50703 sync.pdf -a---- 11/19/2023 6:54 PM 401 sync.tex

First of all, double-click on “Hello World” no longer puts up sync.tex in my editor.

Then I tried executing the commands

"sumatra.exe" -forward-search "sync.tex" 9 “sync.pdf” and also "sumatra.exe" "sync.tex" 9 “sync.pdf” (as you suggested in last email) "sumatra.exe” -forward "sync.tex" 9 “sync.pdf”

Answer is: (1) Unexpected token '-forward' in expression or statement. Unexpected token ‘-search' in expression or statement. (2) Unexpected token ‘ ”sync.tex" ' in expression or statement. I tried several other syntax w/o success. I am sorry to not-being very familiar with shell commands.

In my OLD computer (windows 10) Sumatra installed itself at C:\program files\SumatraPDF\Sumatra.exe In my NEW Computer with M1 processor it appears at C:\Users\nwermes\AppData\Local\SumatraPDF\SumatraPDF.exe

Could this be a reason? Thanks

On 19 Nov 2023, at 17:55, GitHubRulesOK @.***> wrote:

hmm I should have perhaps been clearer the test is like all latex commands expected to be relative to working folder so the command would need the correct paths included

Forward from editor (or console)

"drive:\path to \sumatra.exe" "drive:\path to\sync.tex" 9 "drive:\path to\sync.pdf" Reverse from SumatraPDF

"drive:\path to \editor.exe" and here the syntax is as required by the editor usually as substitute "%f" %l (= %file %line) but per docs — Reply to this email directly, view it on GitHub https://github.com/sumatrapdfreader/sumatrapdf/issues/3885#issuecomment-1817915062, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO7WIE5TYKQZMJ6GTC3MUNDYFI2Y7AVCNFSM6AAAAAA7ODUNS6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJXHEYTKMBWGI. You are receiving this because you authored the thread.

GitHubRulesOK commented 11 months ago

Two points 1) There need to be 3 files The whole key to forward and reverse is the bridge between them is the .synctex file It is the table of tex line references to the chart co-ordinates in a pdf (and vice versa) So it is important all 3 files are always together and of exactly the same date and time.

2) Microsoft windows ComManD> should not normally respond "Unexpected token" so that prompt is a PowerShell response ?

Program Files is an older restricted area for Common (All users) Newer SumatraPDF will use the individuals AppData\Local for Installs per user.

So in summary for this test the sync.synctex needs to be added to that folder AND the command run in Windows Native Command Console (CMD)

NWermes commented 11 months ago

Thank you for your advice and again apologies for my little knowledge in Windows OS. I use a MAC and run SumatraPDF under Windows/Parallels. I have now all three files in Directory of C:\Users\nwermes\AppData\Local\SumatraPDF

11/20/2023 10:01 AM

. 11/16/2023 04:31 PM .. 11/16/2023 04:31 PM 12,679,680 libmupdf.dll 11/16/2023 04:31 PM 252,416 PdfFilter.dll 11/16/2023 04:31 PM 543,232 PdfPreview.dll 11/19/2023 07:16 PM 3,132 SumatraPDF-settings.txt 11/16/2023 04:30 PM 7,477,208 SumatraPDF.exe 11/19/2023 07:02 PM sumatrapdfcache 11/28/2017 08:39 PM 50,703 sync.pdf 11/28/2017 08:39 PM 4,783 sync.synctex 11/19/2023 06:54 PM 401 sync.tex 8 File(s) 21,011,555 bytes 3 Dir(s) 231,878,057,984 bytes free

I use the CMD Terminal See below what happens when I execute your suggestions

On 19 Nov 2023, at 00:37, GitHubRulesOK @.***> wrote:

ok a simple test in windows is to use a known working set this should download a zip file https://github.com/GitHubRulesOK/MyNotes/raw/master/AppNotes/SumatraPDF/LATeX%20and%20Reverse-Search.zip

if you 1st open sync.pdf to prove inverse search with SumatraPDF and double click Hello World it should open the sync.tex file in an editor with MS Notepad without a got enabled it will simply goto 1st line but with a correctly configured notepad or other editor it should goto line 9

This works. The sync.tex source file opens in my editor (WinEdt). C:\Users\nwermes\AppData\Local\SumatraPDF I execute

With that out of the way we can try the opposite and in a cmd prompt run

SumatraPDF.exe -forward-search "sync.tex" 9 “sync.pdf” in directory C:\Users\nwermes\AppData\Local\SumatraPDF>"sumatraPDF.exe" -forward-search "sync.tex" 9 "sync.pdf"

You should see by default a brief flash of blue over the hello world line proving that given the correct forward search the same file will be searched forwards to hello world. for better understanding in SumatraPDF advanced settings

No, I don't see that. Instead the sync.PDF is opened again in another SumatraPDF window.

ForwardSearch [ HighlightOffset = 0 HighlightWidth = 15 HighlightColor = #6581ff HighlightPermanent = false change that line to HighlightPermanent = true (file save settings and run command again)

I did that. => no change … another opening of sync.PDF but no permanent highlighting of “Hello World”.

Thanks for further advice. Scree shot of CMD terminal is attached. N.

https://user-images.githubusercontent.com/12754913/284028139-49992d4f-35d1-4bbf-989c-b69d7187c869.png All that proves is there is nothing whatsoever wrong with that installation any problems are caused by the external applications configuration.

— Reply to this email directly, view it on GitHub https://github.com/sumatrapdfreader/sumatrapdf/issues/3885#issuecomment-1817678161, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO7WIE3VO2QM6GHATVWXRHLYFFBFBAVCNFSM6AAAAAA7ODUNS6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJXGY3TQMJWGE. You are receiving this because you authored the thread.

GitHubRulesOK commented 11 months ago

Generally for the test set to work correctly there must be no updates until the system works so the dates should all be same (thanks for showing that) so in this case it probably does not matter but tex is changed (11/19/2023 06:54 PM 401 sync.tex)

the forward is configured to open SumatraPDF but the file is not reused means one of several needs not in place

1) Advanced settings for modern SumatraPDF should be set to use a tabbed session. (thus the fail would be a second tab is opened) image

2) in Advanced Options settings ReuseInstance must = true so the previous copy is reused image

NWermes commented 11 months ago

Thanks, I did as you suggested

ForwardSearch [ HighlightOffset = 0 HighlightWidth = 15 HighlightColor = #6581ff HighlightPermanent = true ] Annotations [ HighlightColor = #ffff00 UnderlineColor = #00ff00 SquigglyColor = #ff00ff StrikeOutColor = #ff0000 FreeTextColor = FreeTextSize = 12 FreeTextBorderWidth = 1 TextIconColor = TextIconType = DefaultAuthor = ]

RememberOpenedFiles = true RememberStatePerDocument = true RestoreSession = true UiLanguage = en InverseSearchCmdLine = "C:\Program Files\WinEdt Team\WinEdt 10\WinEdt.exe" -C="WinEdt 10.3" "[Open(|%f|);SelPar(%l,8);]" EnableTeXEnhancements = true DefaultDisplayMode = automatic DefaultZoom = fit page Shortcuts [ ] EscToExit = false ReuseInstance = true ReloadModifiedDocuments = true

Now the tests work, i.e. (1) for reverse search double click on “Hello World” opens the sync.tex in my editor and (2) for forward search “Hello World” is highlighted flashed or permanently depending on HighlightPermanent setting.

So, this probably means that SumatraPDF Forward Search is ok. I am calling SumatraPDF.exe as PDFLatex viewer from WinEdt 10/MikTek Editor with the options -synctex = -1 and .synctex filetype (see screen shot attached) .

So I would expect it to work. In fact, it DID (and still does) work on my previous MAC/Parallels installation (Intel instead of ARM chip) with these settings. What might be wrong? Do I need another SumatraPDF installation? Thanks again. N.

On 20 Nov 2023, at 10:38, GitHubRulesOK @.***> wrote:

Generally for the test set to work correctly there must be no updates until the system works so the dates should all be same (thanks for showing that) so in this case it probably does not matter but tex is changed (11/19/2023 06:54 PM 401 sync.tex)

the forward is configured to open SumatraPDF but the file is not reused means one of several needs not in place

Advanced settings for modern SumatraPDF should be set to use a tabbed session. (thus the fail would be a second tab is opened) https://user-images.githubusercontent.com/12754913/284221643-d244e495-14e1-4b47-b2c5-36f34eeb044b.png in Advanced Options settings ReuseInstance must = true https://user-images.githubusercontent.com/12754913/284221965-2d44b2cf-3e35-4eda-95c2-f1b9ab182c5b.png — Reply to this email directly, view it on GitHub https://github.com/sumatrapdfreader/sumatrapdf/issues/3885#issuecomment-1818633892, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO7WIE3FMFFMX6PGVHQ3PETYFMQKDAVCNFSM6AAAAAA7ODUNS6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJYGYZTGOBZGI. You are receiving this because you authored the thread.

GitHubRulesOK commented 11 months ago

If its working outside of WinEdt then the problem is then entirely how that WinEdt is set to call and respond

I have not used it for years, but the last time I did, it could be pedantic about DDE syntax. hence try | and ' as alternates I said in tex exchange answer that at the time

On some occasions WinEdt 103 configures an additional Application Caption identifier command -C="WinEdt 10.3" so you may eventually use a final command of...

However that was then and may now be different so perhaps try without that part

DDE is the comms channel for inter application communications via memory (rather than command line) so one important aspect is both apps need to be in same memory space. By that I mean both apps need same bitness either 32 or 64 There should not be a mix so a 32bit app may not understand a 64bit app or vise versa.

My suggestion is always to try a CMD means of easier interop calling (SumatraPDF can use DDE input as more direct) so WinEdt should also have a CMD variation for open file at line number, however it prefers per docs the DDE [Open method

NWermes commented 11 months ago

Thanks again for your help. best regards, Norbert

On 20 Nov 2023, at 11:48, GitHubRulesOK @.***> wrote:

If its working outside of WinEdt then the problem is then entirely how that WinEdt is set to call and respond

I have not used it for years, but the last time I did, it could be pedantic about DDE syntax. hence try | and ' as alternates

DDE is the comms channel for inter application communications via memory (rather than command line) so one important aspect is both apps need to be in same memory space. By that I mean both apps need same bitness either 32 or 64 There should not be a mix so a 32bit app may not understand a 64bit app or vise versa.

My suggestion is always to try a CMD means of easier interop calling (SumatraPDF can use DDE input as more direct) so WinEdt should also have a CMD variation for open file at line number, however it prefers per docs the DDE [Open method

— Reply to this email directly, view it on GitHub https://github.com/sumatrapdfreader/sumatrapdf/issues/3885#issuecomment-1818809496, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO7WIE47F6LP675YHJCMHITYFMYQPAVCNFSM6AAAAAA7ODUNS6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJYHAYDSNBZGY. You are receiving this because you authored the thread.

NWermes commented 11 months ago

… perhaps one last question. Which SumatraPDF installation do I need for my MAC with M1 (Apple rather than Intel) Processor? As mentioned, I run SumatraPDF of course on Windows11 under an OS provided by Parallels. Thanks N.

On 20 Nov 2023, at 11:48, GitHubRulesOK @.***> wrote:

If its working outside of WinEdt then the problem is then entirely how that WinEdt is set to call and respond

I have not used it for years, but the last time I did, it could be pedantic about DDE syntax. hence try | and ' as alternates

DDE is the comms channel for inter application communications via memory (rather than command line) so one important aspect is both apps need to be in same memory space. By that I mean both apps need same bitness either 32 or 64 There should not be a mix so a 32bit app may not understand a 64bit app or vise versa.

My suggestion is always to try a CMD means of easier interop calling (SumatraPDF can use DDE input as more direct) so WinEdt should also have a CMD variation for open file at line number, however it prefers per docs the DDE [Open method

— Reply to this email directly, view it on GitHub https://github.com/sumatrapdfreader/sumatrapdf/issues/3885#issuecomment-1818809496, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO7WIE47F6LP675YHJCMHITYFMYQPAVCNFSM6AAAAAA7ODUNS6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJYHAYDSNBZGY. You are receiving this because you authored the thread.

GitHubRulesOK commented 11 months ago

I dont know MacOS Parallels ability to emulate Windows so unclear in your case how much of DDE communications may be disallowed as a potential cause of your issue.

in "Theory" all versions of SumatraPDF work to varying degrees in Linux Wine (Some better than others) but I would not expect Dbus to be working same as DDE, hence my suggestion to try to stick with simple command line text as the control.