How to Fix “No PDF File Found” in TeXstudio
At a glance
- 1. Check the compile log
Compile once, then find the first error in TeXstudio’s Messages or Log panel.
- 2. Confirm the output path
Check where TeXstudio and MiKTeX are configured to write the PDF.
- 3. Test from the terminal
Run pdfLaTeX in the project folder to separate compilation problems from TeXstudio problems.
- 4. Fix and compile again
Resolve the first error, then use Build and View to open the newly generated PDF.
TeXstudio displays “No PDF file found” when it cannot open the PDF it expected after a build. The message alone does not tell you whether LaTeX failed, the PDF was written to another folder, or the viewer is looking in the wrong place.
Work through the checks below in order. The compile log is usually the fastest route to the actual cause.
1. Read the compile log
In TeXstudio, run the build again and look in the Messages or Log panel. Find the first line beginning with !, or the first error message. Later messages can be consequences of that first error, so fix the earliest one and compile again.
Common causes include a missing closing brace, an undefined command, a missing input file, or a package that MiKTeX cannot find or install. If MiKTeX asks to install a missing package, allow the installation and run the build again. If package installation fails, open MiKTeX Console, check for updates, and confirm that the package repository is configured.
Warnings are not necessarily fatal. Look for the final lines of the log as well: a successful pdfLaTeX run normally reports that output was written, often with a line such as Output written on main.pdf. If the log reports a fatal error, fix it first; depending on where compilation stopped, a PDF may still have been written. If there is no output-written message, check the configured output location directly before concluding that no PDF was produced.
2. Check the compiler and output directory
In TeXstudio, open Options → Configure TeXstudio → Build. The exact labels can vary slightly by version. Confirm that the default compiler is a PDF-producing option, commonly PdfLaTeX, and that the build command is enabled. Select Build & View to compile and then open the result.
Check whether an output directory has been set. If it has, the PDF may be in that directory rather than beside the .tex source file. For example, if the output directory is build, the expected file might be build\main.pdf. TeXstudio’s viewer should use the same build configuration and output location. Temporarily clearing a custom output-directory setting is a useful test: compile again and see whether the PDF appears next to the source.
Also check that you are building the intended master document. In a project split across several files, a chapter file may not compile on its own; compile the root .tex file that contains the document preamble and \begin{document}.
3. Test pdfLaTeX outside TeXstudio
A command-line test helps distinguish a TeXstudio configuration problem from a MiKTeX or document problem. Open Command Prompt, change to the folder containing the main .tex file, and run:
pdflatex -file-line-error -halt-on-error main.tex
Replace main.tex with your actual filename. If the command succeeds and reports that it wrote a PDF, check that folder for main.pdf. If the terminal reports that pdflatex is not recognized, MiKTeX may not be installed correctly or its executable folder may not be on Windows’ PATH. You can still test from MiKTeX Console or use TeXstudio’s configured build command.
If pdfLaTeX fails in the terminal too, follow the error in its output; changing TeXstudio’s viewer will not fix a failed compilation. If it succeeds but TeXstudio still reports no PDF, focus on TeXstudio’s compiler command, working directory, output directory, and viewer settings.
4. Compare with a minimal document
To check whether the problem is specific to your document, save this as test.tex and compile it:
\documentclass{article}
\begin{document}
A test PDF.
\end{document}
A successful build should create test.pdf in the configured output directory, or normally in the working directory if no output directory is set. If this works but your project does not, the issue is likely in the project’s source, its required files, or its packages. If it fails as well, check the MiKTeX installation and TeXstudio’s build configuration.
5. Check the PDF file and viewer
If the log says a PDF was written, look for that file in the reported location. Make sure its name matches the main source filename and that the viewer is not trying to open an older filename or a different output folder. In TeXstudio’s Build settings, check the selected PDF viewer and use Build & View to test it.
If the PDF exists but will not open, close any viewer that may be locking it, then compile again. If TeXstudio’s internal viewer remains the problem, try an external PDF viewer in TeXstudio’s settings. This addresses an opening problem; it does not repair errors that prevent PDF generation.
Common mistakes
- Looking only at the final error: later errors may follow from the first one. Start at the top of the error list or log.
- Searching only beside the source file: a configured output directory may hold the PDF elsewhere.
- Compiling a chapter instead of the master file: subfiles may depend on the root document’s preamble.
- Treating every warning as fatal: use the log’s fatal errors and its final output message to judge whether a PDF was created.
- Changing the viewer before checking compilation: a viewer setting cannot create a PDF when pdfLaTeX failed.
The key diagnostic is whether the log reports that a PDF was written. If it does, locate that file and check TeXstudio’s viewer and paths. If it does not, inspect the first compilation error and check the output location before adjusting the viewer.
References
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.