[Tex/LaTex] TexMaker + Sumatra PDF Forward search

forward-inverse-searchtexmaker

I am trying to configure TexMaker with SumatraPDF.

This has previously been discussed
Configure forward search with Texmaker + SumatraPDF
but the solutions did not work for me.

Under "Options >> Configure TexMaker >> Commands >> PDF viewer", I have entered the following

"C:/Program Files (x86)/SumatraPDF/SumatraPDF.exe"  -invert-colors -reuse-instance "%.pdf" -reuse-instance -forward-search "%.tex" @

This "almost works". When I build and view the output, I get two PDFs. One PDF is the document I wish to view. This PDF also has the correct source links so I can do an inverse search from sumatra. But SumatraPDF also tries to the same PDF file, but from the following location:

C:\users\mattlorig\documents

which is not where the document is located.

Also, I use the -invert-colors option so that I get a black PDF with white letters.

Best Answer

It's much of a comment rather than a full pledged answer here by Matth

  1. Double use of -reuse-instance was not needed to resolve your problem

  2. Starting from Version 3.2.1 "- an additional parameter (#) for the current file name is available for the commands (required for pdf synchronization with the sumatra pdf viewer)"

  3. You have missed # it your command line arguments, which was mentioned by Matth

    "C:/Programme/SumatraPDF/SumatraPDF.exe" -reuse-instance "%.pdf" -forward-search "#.tex" @
    
  4. Hence forward-inverse search works when you remove multiple -reuse-instance and replace the % to #

Note: % is for filename without extension. For forward-inverse interaction # takes over the precedence. Both might work along as # is used for #.tex.