Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Texmaker has a Built-in pdf viewer which supports synctex forward/inverse search out of the box. This Built-in viewer can be displayed embedded or in a separate window, external viewers always have a separate window. As I have two screens, I am using the two-window layout.

Now I would like to switch to SumatraPDF as external viewer, but cannot find how to configure Texmaker to get Forward search working.
I have filed a feature request to add that information to the Texmaker documentation already. Does someone here know how to do it? Probably using some DDE command...

share|improve this question
1  
Note, that since Texmaker, 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)” (Changelog), cf. also this answer by Texenthusiast. –  Speravir Apr 5 '13 at 20:49

4 Answers 4

up vote 10 down vote accepted

It seems that Texmaker does not allow DDE commands, but since version 1.9 SumatraPDF supports forward search not only via DDE commands, but also via command line switches. Since version 3.2.1 Texmaker has all variables that are needed to use forward search, so here is a solution that works for me:

"C:/Programme/SumatraPDF/SumatraPDF.exe" -reuse-instance "%.pdf" -forward-search "#.tex" @

where % retruns the basename of the master file without extension, # returns the name of the currently active file and @ returns the line number.

Texmaker Configuration

share|improve this answer

I just made a doc describing how to setup Texmaker and SumatraPDF with forward and inverse search, but fully portable which is bit tricky. Link to the how-to http://goo.gl/hxDeu (without redirect: http://goo.gl/hxDeu+) or see below:

1. Configuring Texmaker to use SumatraPDF as external PDF viewer with forward search Open your portable Texmaker and set path to external viewer as follows:

./SumatraPDF/SumatraPDF.exe %.pdf -reuse-instance -forward-search %.tex @

Note that path to SumatraPDF.exe is relative to Texmaker executable and you may need to edit this path to match your folder structure.

Texmaker -> Configure Texmaker -> Commands

2. Configuring inverse search in SumatraPDF

By default SumatraPDF does not allow to configure inverse search via GUI. Run once the following command:

SumatraPDF.exe -inverse-search "texmaker.exe %f -line %l"

You should not change the path to texmaker.exe file, even if you have different folder structure than I had.

SumatraPDF option window with unhidden inverse search settings

3. Create startup batch file

Due to some limitations in SumatraPDF we have to start Texmaker with following batch file everytime we want to use SumatraPDF as external viewer. Place the following commands in texmaker-portable.bat and save this file to the same folder as Texmaker.exe. Also note that you can pass any parameter to texmaker-portable.bat that you could pass to texmaker.exe itself.

@echo off
set PATH=%~dp0;%PATH%
start /D "%~dp0" texmaker.exe %*

4. Run texmaker-portable.bat and test the settings

Troubleshooting

  • make sure you are using -synctex=1 or -synctex=-1 parameter while formatting a tex file
  • the tex file should not contain space in its name (Texmaker and SumatraPDF handles spaces just fine, but SyncTeX file may not be created even with -synctex=1 parameter)
  • make sure you started Texmaker with the batch file and SumatraPDF via Texmaker (this chain is mandatory)
share|improve this answer
1  
Thanks, that is interesting, I just gave you an upvote. Some people on SX do not like answers that are just links though, so maybe you could copy the content and post it directly here on SX? –  matth Mar 1 '12 at 16:55
1  
Thanks to your upvote I've earned the privilege to answer with wiki posts, so I guess I could copy the doc even with the screenshots. –  Vlastimil Ovčáčík Mar 2 '12 at 17:21

I'm not using TeXmaker but TeXstudio (formerly known as: TeXmakerX) instead. It is quite similar to the TeXmaker but has some nice additional features like code folding. For this editor I can give you a solution to the Forward Search problem. With TeXstudio you have two options: You can reconfigure the viewer command ("Options/Configure TeXstudio" -> "Commands"), thereby changing the standard PDF viewer to SumatraPDF, or if you want to use another standard viewer for some reason, you can go to the User menu (User/User Commands/Edit...) and define a new User Command. In both cases you have to enter the following into the respective command field:

dde://C:/Programme/SumatraPDF/SumatraPDF.exe:SUMATRA/control/[ForwardSearch("?am.pdf","?c:am.tex",@,0,0,1)] 

where you have to replace C:/Programme/SumatraPDF/SumatraPDF.exe with your own path to SumatraPDF.

If required I could also provide configurations of Forward/Inverse-Search for other editors like TeXnicCenter and Emacs.

share|improve this answer
    
Rigth now I only get "Error : could not start the command". Maybe this is because Texmaker uses %.pdf instead of ?am.pdf. But what do I have to use instead of ?c:am.tex ? –  matth Dec 7 '11 at 8:32
    
Even the simpler dde://C:/Programme/SumatraPDF/SumatraPDF.exe:SUMATRA/control/[Open("%.pdf", 1, 1, 0)] gives the same error. Not sure what I am doing wrong. –  matth Dec 7 '11 at 8:39
    
@matth Could be just that you're using TeXmaker, and not TeXstudio. They are after all different programs, and the current version of TeXstudio is based on 2.x of TeXmaker, which itself is in version 3.x. –  Torbjørn T. Dec 7 '11 at 8:54
    
@TorbjørnT. that might be. But the DDE command even fails with hardcoded path, without variables like %.pdf. Do you think Texmaker does not allow DDE commands at all? –  matth Dec 7 '11 at 9:06
    
@matth Apparently it didn't in 2008 at least, I don't know if anything has changed. There's nothing about it in the changelog though. –  Torbjørn T. Dec 7 '11 at 12:31

This is meant to be a response to the answer from Vlastimil above. I found that inverse search works fine without the batch file. I just use the following line in Sumatra PDF Options (it came up automatically as an option). I'm using Sumatra 2.1.1 and Texmaker 3.5.

"C:\Program Files (x86)\Texmaker\texmaker.exe" "%f" -line %l

As others have stated, forward search works as well with the command line in Texmaker's options:

"C:/Program Files (x86)/SumatraPDF/SumatraPDF.exe" -reuse-instance %.pdf -forward-search "#.tex" @
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.