TexMaker + Sumatra PDF Forward search

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.

-
FYI, I know I have put -reuse-instance twice. This appears to be the only way to get the forward search and inverse search to work properly. – user26807 Mar 4 '13 at 0:37
There must be another error. That you needs the parameter `-reuse-instance` twice indicates this. Have you checked all pathes in TeXMaker showing to the right place? Which programm starts when you dobbleclick an `tex` file? Which versions of TeX, TeXmaker and SumatraPDF do you use? – Kurt Mar 4 '13 at 0:44
Texniccenter is my default LaTex Editor. But, I don't see why that should make a difference. I am compiling the TeX document from TexMaker Versions: – user26807 Mar 4 '13 at 1:01
versions: sumatra 2.2.1, TexMaker 3.5.2, MikTex 2.9 – user26807 Mar 4 '13 at 1:03
it's mentioned already in issue tracker. If it works, you should add it as a comment to first original thread with help of some moderator and make this thread as duplicate to tidy up the forum. – texenthusiast Mar 5 '13 at 0:54

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 as suggested by Kurt

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`.

-