Tx · LaTeX & TikZ

Why Is the PDF Not Updating in TeXstudio?

Published By the 9to5Science editorial team

At a glance

  1. 1. Save and compile

    Save the source, run the intended XeLaTeX build, and check the log for a successful run.

  2. 2. Check the output path

    Find the PDF path reported by the build and make sure it is the file open in the viewer.

  3. 3. Refresh the viewer

    Reload or close and reopen the PDF; check whether you are using TeXstudio’s viewer or an external one.

  4. 4. Check the root file

    If the project has multiple source files, confirm that TeXstudio is compiling the document’s main file.

If the PDF displayed in TeXstudio does not change after you edit your LaTeX source, the cause is usually a failed or misdirected build, or a viewer that has not reloaded the new file. XeLaTeX itself normally writes a fresh PDF each time a successful build completes.

Work through the checks below in order. The key is to confirm both which file was compiled and which PDF is being viewed.

1. Save the source and check the build result

Save the edited .tex file before compiling. Then run the intended build command and inspect the Messages or Log panel. Look for errors and for a line like Output written on report.pdf near the end of the log. If XeLaTeX stops with an error, TeXstudio may leave the last successful PDF on screen; that old PDF can look like the current result even though the latest build failed.

A warning does not always stop PDF generation, but an error often does. If the log reports an output file, note its full path if shown. Do not assume that a PDF visible in the viewer was generated by the most recent run.

2. Confirm that TeXstudio built the right document

In a project with several .tex files, compile the main document, not a chapter or included file. The main file is the one that contains the document setup and usually the \begin{document} and \end{document} commands. If you opened a subfile directly, TeXstudio might build that file or use a different root than you expect.

You can set the root explicitly with a magic comment at the top of a subfile, for example:

% !TeX root = ../report.tex

Change the path to match your project. Then compile the root document. Also verify that the active compiler is the one you intend to use, such as XeLaTeX, rather than a different build command configured in TeXstudio.

3. Open the PDF that the build actually produced

TeXstudio may be configured to put output files in a separate build directory. For example, the source might be C:\Projects\report\report.tex, while the compiled PDF is C:\Projects\report\build\report.pdf. Opening C:\Projects\report\report.pdf in another viewer would show an older file if the build is writing to build.

Use the path in the build log to locate the latest PDF. If you have multiple copies with the same filename, check their folders and modification times. Open the one in the output directory, not simply the one that is easiest to find in File Explorer.

4. Refresh or reopen the viewer

If the build succeeded and wrote to the PDF you expect, reload the document in the viewer. With TeXstudio’s internal PDF viewer, close the PDF tab and open the generated file again if it does not refresh automatically. With an external viewer, use that viewer’s reload command, or close the document and reopen the correct PDF.

Also check which viewer is active in your setup. A PDF opened by a separate application is not necessarily the same tab that TeXstudio is displaying. If an external viewer is set as the default, TeXstudio may launch it or sync with it, but the viewer can still have a different copy open. As a quick test, open the output PDF directly from its build folder.

A worked example

Suppose your source is C:\Work\thesis\main.tex. You edit a sentence and compile, but the displayed PDF still has the old wording. The log says:

Output written on C:/Work/thesis/out/main.pdf

That message points to C:\Work\thesis\out\main.pdf, not C:\Work\thesis\main.pdf. Open the file in out and the updated sentence should appear if the build completed successfully. If it does not, check for build errors and then close and reopen that exact PDF. This distinguishes a path mismatch from a viewer-refresh problem.

Common mistakes

  • Treating an old display as proof of a successful build. Check the latest log; the viewer can continue showing the previous PDF after an error.
  • Checking only the source folder. Build settings can direct the output to a subfolder or another location.
  • Compiling an included chapter instead of the root document. Confirm the master file and, if needed, set it with % !TeX root = ....
  • Reinstalling XeLaTeX or TeX Live first. That is rarely useful when the log shows a successful build. Establish the output path and viewer state before changing the installation.
  • Deleting auxiliary files as the first fix. Cleaning temporary files can help with particular build problems, but it will not make a viewer display a different PDF or correct a mistaken output path.

If it still does not update

For a reliable test, change a visible word in the source, save, compile, and inspect the end of the log. If the log names a PDF and the run succeeds, open that named file directly in a fresh viewer window. If the named file is not being overwritten, check the build command and output-directory settings; if it is overwritten but still looks old, confirm that the viewer opened the same full path. This isolates the problem without changing unrelated TeX Live settings.

References

  1. TeXstudio User Manual

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.