SumatraPDF Inverse Search Not Working: How to Fix LaTeX Editor Sync

  • Verify TeX enhancements, editor commands, path quoting, and line-number arguments.
  • Confirm matching PDF and SyncTeX files exist in the build directory.
  • Use a minimal LaTeX project before resetting settings or reinstalling.

When SumatraPDF displays your compiled LaTeX PDF correctly but double-clicking the document does not open the corresponding source line in your editor, inverse search has stopped working. This PDF-to-source synchronization depends on four connected pieces: SumatraPDF must enable its TeX features, the PDF must have matching SyncTeX data, the inverse-search command must correctly launch your editor, and Windows must allow every referenced path to resolve. The fastest solution is to test those pieces in order rather than reinstalling applications or changing unrelated PDF settings.

LaTeX source editor connected to a matching location in a PDF document.

1. Confirm the Symptom With One Simple Test

First, confirm that the failure is specifically inverse search. Inverse search starts in the PDF viewer: you double-click a location in the PDF, and SumatraPDF asks your LaTeX editor to open the associated source file and line. Forward search is the opposite operation, beginning in the editor and opening or highlighting a location in the PDF.

Open a PDF produced from LaTeX in SumatraPDF and double-click directly on a line of body text. Avoid blank margins, imported graphics, and complex tables during this test because those areas may not map cleanly to one source line.

Successful inverse search should produce a clear result:

  • Your configured editor starts if it is not already running.
  • The correct source file opens.
  • The cursor moves to, or near, the source line that produced the selected PDF text.

If the editor opens but selects an imperfect line, the command is probably working and the remaining issue concerns SyncTeX mapping or the document structure. If nothing opens, concentrate first on SumatraPDF's TeX setting and editor command. If Windows displays a file-not-found error, inspect command paths and quoting.

1.1 Verify That You Are Testing a LaTeX-Generated PDF

Inverse search is not a general feature for arbitrary PDFs, eBooks, comics, CHM files, DjVu documents, XPS files, or images. SumatraPDF can read these formats, but PDF-to-source synchronization requires a PDF generated by a TeX engine with accompanying synchronization information. A downloaded PDF without its build-generated SyncTeX data cannot point back to an unrelated source file.

Stop changing settings if inverse search works with another LaTeX project. That result means SumatraPDF and the editor command are probably configured correctly. Troubleshoot the failing project's build files instead.

2. Check the SumatraPDF TeX Settings and Editor Command

SumatraPDF's advanced settings contain the two entries most directly related to this symptom: EnableTeXEnhancements and InverseSearchCmdLine. Open SumatraPDF's settings menu and select its advanced settings option. This opens the active SumatraPDF-settings.txt file in a text editor.

2.1 Enable TeX Enhancements

Find the TeX enhancement setting and confirm that it is enabled:

EnableTeXEnhancements = true

If it is set to false, change it to true, save the file, close and reopen SumatraPDF, and test again. Success means double-clicking mapped PDF text now opens the source editor. If it does, stop troubleshooting because the underlying command and SyncTeX data are already functioning.

If the line is absent, do not blindly paste settings from an old internet guide. SumatraPDF's settings format can evolve. Let the installed application generate its settings file, then edit the entries that it exposes.

2.2 Validate InverseSearchCmdLine

The InverseSearchCmdLine setting tells SumatraPDF which editor executable to run and how to pass the source filename and line number. A generic form looks like this:

InverseSearchCmdLine = "C:\Path To Editor\editor.exe" --line %l "%f"

The exact arguments after the executable depend on the editor. In SumatraPDF's inverse-search command, %f represents the source filename and %l represents the source line. Your editor must support command-line arguments that accept those values.

Check the following details carefully:

  • The executable path points to the editor that is currently installed.
  • The executable path is enclosed in quotation marks when it contains spaces.
  • The source placeholder is quoted as "%f" so projects in spaced paths work.
  • The line placeholder is placed in the syntax expected by your editor.
  • Old paths from a previous editor version, user profile, or installation folder are removed.
  • The command does not include copied typographic quotation marks.

A path such as C:\Program Files\Editor\editor.exe must be quoted. Without quotes, Windows may interpret C:\Program as the command and treat the rest as separate arguments. This frequently explains why the SumatraPDF inverse search not working problem appears after changing editors or moving from a portable editor to an installed copy.

2.3 Test the Editor Command Outside SumatraPDF

Copy the intended command into Command Prompt, replacing %f with the full path to a real .tex file and %l with a line number. For example, the conceptual test is:

"C:\Path To Editor\editor.exe" --line 12 "C:\LaTeX Projects\Test Document\main.tex"

Use the actual line-switch syntax documented by your editor. If the command does not open the requested file and line from Command Prompt, SumatraPDF cannot make it work. Correct the editor command before testing the viewer again.

If the manual command succeeds and the same structure is stored in InverseSearchCmdLine, reopen SumatraPDF and double-click ordinary body text. If that works, stop changing settings.

3. Verify SyncTeX Data and Matching Build Files

Even a perfect editor command cannot identify a source location unless the LaTeX build produces synchronization data. SyncTeX records relationships among positions in the output PDF, source filenames, and source lines.

3.1 Enable SyncTeX in the LaTeX Build

Configure your LaTeX editor or build tool to compile with SyncTeX enabled. TeX engines commonly accept the -synctex=1 option. Many LaTeX editors expose this through a build configuration rather than requiring you to type the option manually.

After rebuilding, inspect the output directory. A project producing main.pdf will commonly produce main.synctex.gz, or in some workflows an uncompressed main.synctex. The synchronization file must belong to the PDF you are viewing.

Success means a fresh SyncTeX file appears after compilation and double-clicking normal PDF text opens the corresponding source. Once that happens, there is no reason to reinstall SumatraPDF.

3.2 Confirm That PDF and SyncTeX Names Match

The PDF and synchronization data should share the same base name. Examples of a matching pair include:

  • report.pdf and report.synctex.gz
  • thesis.pdf and thesis.synctex

A file named draft.synctex.gz does not provide mapping for final.pdf merely because both files are in the same folder. Renaming a compiled PDF manually can also separate it from its synchronization data.

Make sure you are opening the PDF from the actual build output directory. Editors may compile into folders named build, out, or output. An older copy of the PDF on the desktop may look current while lacking the matching SyncTeX file beside it.

3.3 Rebuild Instead of Reusing Stale Files

Delete only the project's generated PDF and SyncTeX files, then perform a clean build with SyncTeX enabled. Do not delete source files. This removes stale output that may reference old source paths.

If the document was moved, copied from another computer, or extracted from an archive, rebuilding is especially important. Existing SyncTeX data can contain source paths from the environment where it was created.

Troubleshooting view of an editor path, project folder, and PDF synchronization connection.

4. Check Windows Paths and Application Expectations

Windows file associations are not normally responsible for line-level inverse search because SumatraPDF directly launches the configured editor command. However, Windows paths, permissions, security controls, and application-instance behavior can affect that launch.

4.1 Eliminate Path and Permission Problems

Check whether the editor executable and source files still exist at the paths referenced by the command and SyncTeX data. Pay particular attention to:

  • Spaces in the editor installation path or project path
  • Projects stored in OneDrive or another synchronization folder
  • Network drives that are disconnected or use different drive letters
  • Source folders renamed after the last LaTeX build
  • Files extracted to a temporary folder and later moved
  • Security software blocking one program from launching another

As a diagnostic step, copy a minimal project to a short local path such as C:\latex-test. Compile it there with SyncTeX enabled. If inverse search works in the short path but not the original location, the likely cause is path quoting, availability, permissions, or stale mapping rather than SumatraPDF itself.

4.2 Account for Installed and Portable Copies

SumatraPDF can be used as an installed application or as a portable executable. If both are present, you may be editing one copy's settings while opening the PDF in another copy. Use the advanced settings command from the exact SumatraPDF window displaying the test PDF. This is safer than locating a settings file manually and assuming it is active.

The same issue can affect editors. A portable editor may move with its folder, while InverseSearchCmdLine still references its previous location. Test the executable path directly and update it if necessary.

4.3 Understand Command-Line and DDE Expectations

SumatraPDF needs an editor integration method that can receive a filename and line number. Modern configurations usually use an editor's command-line interface. Some older editor integrations or setup guides may rely on Windows Dynamic Data Exchange, commonly called DDE.

Do not combine a command-line template for one editor with DDE instructions intended for another. If your editor's documentation provides a current SumatraPDF integration command, follow that syntax. An editor may also reuse an existing process and forward the request internally, so the absence of a new editor window does not necessarily indicate failure. The real success test is whether the correct source file receives focus at the requested line.

Ghostscript, PDF codecs, and printer drivers are generally unrelated when the PDF already renders correctly and only inverse search fails. Investigate them only if the document itself cannot be opened or rendered. Changing a printer driver will not create missing SyncTeX data or repair an invalid editor command.

5. Inspect or Reset SumatraPDF-settings.txt Safely

If changes do not persist, or SumatraPDF repeatedly restores an incorrect inverse-search command, inspect the active settings file carefully. Open it through SumatraPDF's own advanced settings menu and make a backup copy before editing.

5.1 Check Whether Settings Persist

Change only the relevant TeX entries, save the file, close SumatraPDF, reopen it, and return to advanced settings. Confirm that your changes remain. If they do not, check whether the file or its folder is read-only, whether Windows permissions prevent writing, or whether another SumatraPDF process was still running and overwrote the file during shutdown.

Also confirm that you are not editing a settings file associated with a different installed or portable executable. The active window's advanced settings command is the best way to avoid that confusion.

5.2 Reset Without Losing the Original Configuration

Do not immediately delete SumatraPDF-settings.txt. First close all SumatraPDF windows and copy the file to a safe location. Then rename the original, for example to SumatraPDF-settings-backup.txt. Start SumatraPDF so it can generate a clean configuration, enable TeX enhancements if necessary, and add only the verified inverse-search command.

If inverse search works with the clean configuration, an old or malformed setting was likely responsible. Reapply other preferences selectively instead of restoring the entire old file. If the clean configuration does not help, restore the backup and continue with the SyncTeX and editor-command tests. A failed reset is useful evidence that preferences were not the cause.

6. Run a Clean Temporary Test Before Reinstalling

A minimal project separates configuration failures from document-specific problems. Create a temporary folder such as C:\latex-test and save the following as main.tex:

\documentclass{article}
\begin{document}
This is an inverse search test.

This is a second paragraph.
\end{document}

Compile it with your normal LaTeX engine while ensuring SyncTeX is enabled. Confirm that the folder contains main.pdf and main.synctex.gz or main.synctex. Open that exact PDF in the SumatraPDF copy whose settings you edited, then double-click the sentence in the PDF.

Interpret the result as follows:

  • If the correct source line opens, SumatraPDF is working. Repair the original project's build configuration or stale paths.
  • If the editor opens the source but not the line, verify the editor's line-number argument.
  • If the wrong editor opens, correct InverseSearchCmdLine in the active settings file.
  • If no editor opens, run the configured command manually and check TeX enhancements.
  • If there is no SyncTeX file, correct the LaTeX build before changing SumatraPDF.

Reinstalling is rarely the best first action because it does not generate SyncTeX data and may not remove user settings. Consider reinstalling only when a clean project has matching synchronization data, the editor command works from Command Prompt, the active settings file is correct, and SumatraPDF still cannot initiate inverse search.

7. Quick Fix Checklist

  1. Confirm you are testing inverse search by double-clicking PDF body text.
  2. Open advanced settings from the active SumatraPDF window.
  3. Set EnableTeXEnhancements = true.
  4. Verify that InverseSearchCmdLine points to the installed editor.
  5. Quote the editor path and "%f", especially when paths contain spaces.
  6. Test the editor command manually with a real file and line number.
  7. Compile the project with SyncTeX enabled.
  8. Confirm that the PDF and .synctex or .synctex.gz files have matching base names.
  9. Open the PDF from the actual build directory rather than an old copy.
  10. Test a minimal project in a short local path.
  11. Check whether installed and portable SumatraPDF copies use different settings.
  12. Back up and temporarily reset the settings file only after focused tests fail.

Stop as soon as double-clicking the test PDF opens the expected source file and line. Additional changes after success can introduce a second problem and make the original cause harder to identify.

8. Frequently Asked Questions

8.1 Why Does SumatraPDF Open the Editor but Not the Correct Line?

This usually means the executable and filename portions of InverseSearchCmdLine work, but the editor's line-number syntax is wrong or the SyncTeX mapping is stale. Test the editor command outside SumatraPDF with a known line number, then rebuild the PDF and synchronization data.

8.2 Can Inverse Search Work Without a .synctex File?

Not for normal source-line synchronization. SumatraPDF needs synchronization data generated by the TeX build to connect PDF coordinates to source files and lines. Enable SyncTeX and rebuild the project.

8.3 Why Does Inverse Search Work for One Project but Not Another?

If one project works, the global SumatraPDF and editor configuration is probably sound. The failing project may not enable SyncTeX, may use a separate output directory, may have stale build files, or may be opened from a copied PDF whose matching synchronization file is elsewhere.

8.4 Do Spaces in LaTeX Project Paths Break Inverse Search?

Spaces are supported when commands quote paths correctly. Enclose the editor executable path in quotes when needed and pass the source placeholder as "%f". A successful test from Command Prompt confirms that Windows can parse the command.

8.5 Will Changing the Default PDF Association Fix Inverse Search?

Usually not. File association determines which application opens a PDF, while inverse search depends on the SumatraPDF TeX settings, a valid editor command, and matching SyncTeX data. Association matters only if double-clicking a PDF opens a different SumatraPDF copy or another viewer.

8.6 Should I Reinstall SumatraPDF When Inverse Search Stops Working?

Reinstall only after a minimal project fails despite valid SyncTeX data and a manually verified editor command. First check the active settings file, path quoting, portable versus installed copies, and build output. Those checks target the symptom more directly and preserve working preferences.


Citations

  1. Official guidance for configuring inverse search and LaTeX synchronization in SumatraPDF. (SumatraPDF Documentation)
  2. Official reference for supported SumatraPDF command-line arguments. (SumatraPDF Documentation)
Cindy, ContentBASE creator assistant

MEET CINDY

Your ContentBASE creator assistant

Cindy helps creators find Canva templates, content ideas, and simple ways to make better social media posts faster.

Want ready-to-use templates? Claim the free Canva bundles or browse the full bundle store.