I like to use SyncTeX when editing files in Texmaker to do forward and backward searches.

However, right now, I'm writing a very long paper that requires me to make regular changes to the beginning of the document (thus jumping between my actual writing location and the beginning). I find it rather cumbersome that SyncTeX always jumps to the last edit location on compilation, because it would be much easier for me to have my actual writing location open in the PDF viewer, do my changes at the beginning and compile to see whether everything works, then jump back to my writing location via backward search from the PDF.

Is there any way to only partially enable Synctex in Texmaker so that forward/backward searching works but no automatic jumps are made on compilation? I'm using LuaLaTeX for compilation.

Edit: I just realized that my original question is utter nonsense. On Quick Build, the PDF viewer doesn't jump to the last edit location but to the cursor. So actually my question is the following: How do I make it so that when I hit Quick Build, the document will update, but the PDF viewer doesn't jump to the cursor position? Instead, the displayed position should only change when I explicitly forward search.

So, for example: Let's suppose I have opened up my .tex file and the compiled PDF in Texmaker. I have the PDF viewer scrolled to page 15. Now, I need to make a change in the document that will appear on page 1. I do that in the .tex file and hit compile. Now, the PDF viewer will jump to the position where my cursor is (right now the cursor is at the top of the tex-file, because I have just made those changes), showing page 1 of the compiled document. I do not want that. Instead, I want the PDF viewer to continue showing page 15, only changing its position when I explicitly hit Ctrl+Space to forward search.

  • 1
    What do you mean "SyncTeX jumps to the last edit location on compilation"? SyncTeX does not compile anything. Does Quick Build change the cursor location for you? I don't know how to replicate the problem. I don't see such jumps. I don't suppose you could do a screen recording or similar so we can see what you mean?
    – frabjous
    Sep 25, 2022 at 21:05
  • My original question was garbage, see the edit.
    – DLCom
    Sep 27, 2022 at 13:37

1 Answer 1


The Issue

From what I can tell, I think the behavior in question is more or less hardcoded into the editor. You could edit the source code if you know some C++, or use the contact form on texmaker's website, but I wouldn't hold your breath.

Other Options

Here are some options, none of which are perfect.

  • You can of course take -synctex=1 out of your compilation options; it will then not jump at compilation, but then you won't be able to do manual forward/inverse searches either, at least not unless you assign a distinct custom command to compile with the synctex flag, and run that beforehand.
  • You can remove "View PDF" from the QuickBuild Command. The downside here is the PDF viewer won't update at all when you run QuickBuild, and you'll have to manually use the "View PDF"/F7 button to see the new output.
  • You can use an external viewer and try to configure it to work this way. (Might depend on the viewer.)
  • You can try this hackish hack I came up with. See below.

A Partly Working Hackish Hack

Under Options > Configure Texmaker > Quick Build, choose the "User:" option for a custom quick build command. Now use the Wizard button and choose the options you normally use. For example, I will assume you choose "Pdflatex" then "Pdf Viewer". This will fill in a routine for you. For me on Linux, it looks like this:

pdflatex -synctex=1 -interaction=nonstopmode %.tex|xdg-open %.pdf

If you're not on linux, it probably will be something other than xdg-open %.pdf; it may even be an external tool, but I think whatever it is gets replaced by the internal viewer command if you have texmaker set to use the internal viewer. Now insert commands for renaming the synctex record to a temporary name before the Pdf Viewer command, and a command for renaming it back afterwards, e.g.:

pdflatex -synctex=1 -interaction=nonstopmode %.tex|mv %.synctex.gz %.temp.gz|xdg-open %.pdf|mv %.temp.gz %.synctex.gz

Now, when it updates the PDF, it won't be able to find the synctex file, effectively breaking its ability to jump while it's updating the PDF. Still, the PDF is updated in the viewer without jumping. And the synctex file is then restored.

From my testing, this partly breaks Forward and Reverse searches afterwards: immediately after, Ctrl-Space in the source and Ctrl-click in the PDF viewer don't work right away. However, if you manually run the "View PDF" command with its toolbar button or "F7", not only does it work, and takes you to the spot matching the cursor, but it re-enables doing forward and backward searches (Ctrl-Space, Ctrl-Click) afterwards, even without recompiling the file.

This hackish hack is probably not really a great solution. Perhaps the TeXmaker devs would be willing to make an option for this. You might have better luck with the TeXStudio fork. (It already has an auto-recompile option that doesn't jump to the current cursor position when activated, for example.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .