Tx · LaTeX & TikZ

Texmaker Shows the Same Old PDF: How to Fix It

Published By the 9to5Science editorial team

At a glance

  1. 1. Compile the source

    Run Quick Build or PDFLaTeX and check that the compilation finishes without errors.

  2. 2. Read the log

    Look for the output PDF path and confirm that Texmaker is compiling the file you edited.

  3. 3. Refresh the viewer

    Close and reopen the PDF, or use the viewer's reload command if the old page remains visible.

  4. 4. Remove stale files

    Delete auxiliary files only after checking the document name and output directory.

Texmaker is usually not showing an old PDF because LaTeX has failed silently. More often, either the document was not compiled successfully, a different .tex file was compiled, or the PDF viewer is displaying a copy from another directory.

Use the checks below in order. They distinguish a compilation problem from a viewer or file-location problem.

1. Compile the correct main file

In a multi-file project, only the main document should normally be compiled. For example, suppose your project contains:

thesis.tex
chapter1.tex
chapter2.tex

If thesis.tex contains \input{chapter1} and \input{chapter2}, opening and compiling chapter1.tex will not produce the complete thesis. Make thesis.tex the active document before using Texmaker’s compile or Quick Build command.

A reliable test is to add a temporary, unmistakable change to the main file:

\section{TEST: this is the current source}

Compile it, then search for that text in the generated PDF. Remove the test after diagnosing the problem.

For a project whose files are split across several source files, you can also identify the root document with a magic comment near the beginning of an included file:

% !TeX root = thesis.tex

The exact support for root-file detection depends on the editor version and project arrangement, so selecting the main file explicitly is the safest approach.

2. Check whether compilation succeeded

After compiling, inspect Texmaker’s Log or Messages panel. A PDF may remain unchanged because LaTeX stopped before writing a new one. Common errors include:

  • an unmatched brace, such as a missing };
  • an environment that was opened but not closed;
  • a missing package or input file;
  • an undefined command caused by a typo;
  • an image filename or path that does not exist;
  • a bibliography or external-program failure.

Warnings generally do not prevent a PDF from being produced. Some errors are recoverable and may still produce a PDF, while fatal errors can prevent a new PDF from being written and leave the previous PDF in place. In either case, errors require attention. Look for lines beginning with !, followed by an explanation and a line number. Fix the first error, compile again, and then inspect later errors; many later messages are consequences of the first one.

A successful run normally ends with a message indicating that the output PDF was written. The exact wording varies by TeX engine, but the log should identify a generated file such as thesis.pdf.

3. Confirm the output filename and directory

Texmaker may be opening a PDF with the same name from a different directory. This happens especially when:

  • you copied the project;
  • a cloud-synchronised folder contains another copy;
  • the source was moved after the PDF was created;
  • the PDF viewer was opened manually from an older project directory;
  • the main file has a different basename from the file you expected.

If the source is report.tex, the usual output is report.pdf in the same directory, unless you configured a separate output directory. Check the compiler command and its options in Texmaker’s configuration. Options such as -output-directory=build place the PDF in a directory other than the source directory.

Open the generated PDF directly from the output directory shown by the log. If that file contains the new text, compilation is working and the problem is only that Texmaker’s viewer is opening another PDF.

4. Refresh or reopen the PDF viewer

If compilation succeeds and the correct PDF exists, refresh the viewer. Depending on your Texmaker version and operating system, you may need to:

  1. close the PDF tab or external PDF window;
  2. compile again;
  3. open the generated PDF from Texmaker;
  4. use the viewer’s reload command if one is available.

External viewers sometimes keep a document open while the compiler replaces the file. Modern viewers usually handle this, but closing and reopening the document removes ambiguity. If you use a browser PDF tab, reload that tab or close it and open the file again.

Do not rely only on the PDF’s visible title. Two files with the same filename can be in different folders. Check the full path in the viewer’s file information or open the file through the operating system’s file manager.

5. Delete auxiliary files only when necessary

Files such as .aux, .toc, .lof, .lot, .out, and .synctex.gz store intermediate information. They can cause stale table-of-contents entries, references, or bookmarks, but they do not normally make ordinary text changes disappear from the PDF.

If the PDF is clearly being regenerated but references or structure remain wrong, close Texmaker and delete the auxiliary files for that document. Then compile again, often twice if the document has references or a table of contents. Do not delete the .tex source or the PDF itself unless you have a backup.

A clean rebuild is especially useful after changing labels, moving sections, changing bibliography data, or switching compilers.

A quick diagnostic example

Suppose you edit notes.tex and change:

This is the old sentence.

to:

This is the new sentence.

After compiling, the old sentence remains. Check in this order:

  1. Read the log. If it contains ! LaTeX Error, fix that error first.
  2. Confirm that the active source is notes.tex, not an included chapter file.
  3. Find the generated notes.pdf in the directory named by the log.
  4. Open that file directly.
  5. If it shows the new sentence, refresh Texmaker’s viewer or close the duplicate PDF window.
  6. If it still shows the old sentence, check whether another notes.tex or notes.pdf exists elsewhere.

This procedure identifies the failure without guessing about PDF caching.

Common mistakes

Editing an included file but compiling a different project. The change may be correct, but the compiled root document does not include that file.

Ignoring the first error. LaTeX can leave the previous PDF in place when the new compilation fails.

Opening the PDF from a shortcut. A desktop shortcut or recent-file entry may point to an older copy.

Changing the compiler. A project may be configured for pdfLaTeX while you expect LuaLaTeX or XeLaTeX behavior. Verify the selected command and output directory.

Expecting one compilation to update everything. Cross-references, citations, and tables of contents often require two or more successful runs. This affects those elements, not ordinary paragraph text.

If the correct PDF on disk contains the new text but Texmaker does not display it, the LaTeX source is no longer the problem: refresh the viewer or correct the PDF path it is using.

References

  1. Texmaker User Manual

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