1
Error: Failed to run 'pdflatex' to create pdf to preview

I keep getting this error in my build of sublime 3. To be clear, my files compile perfectly and I have no other problems with Latex but this. The problem is that sublime keeps putting this error inline right below where I am typing and it is very distracting. It is causing no other problems, it is just distracting. It only seems to show up when I enter mathmode, whenever I type $$ and write something in here $$ it gives me that error.

Does anyone know how to disable preview or how to get rid of this error?

  • Welcome to TeX.SX! I'm sorry, but the information you give is insufficient to make a diagnosis. – egreg Nov 3 '16 at 18:34
  • 1
    Thats a new LaTeXTools feature to preview math equations, while editing. You can disable the feature by setting preview_math_mode to "none" or try to debug it with the information of #883. We are still at the process of handling error cases and open to suggestions. – r-stein Nov 4 '16 at 11:41
  • @r-stein Would you like to add an answer? – Torbjørn T. Nov 5 '16 at 2:11
4

Thats a new LaTeXTools feature to preview math equations, while editing. You can disable the feature by setting preview_math_mode to "none" or try to debug it.

Most likely you are missing one of the following packages: standalone, preview, latexsym, or mathtools. In version 3.12.6 there should be two button added to that phantom. Click (Check System) to run a system check, which will also search for the required packages. If the system check does not show any problem click on (Show Report) to see a report about the failure. This should contain the build errors and help you to fix that problem.

8

When you see this error, you should be able to see a link/button called "show report", so:

  1. Click this link, which will open a new page with detailed log.

  2. In this page you will find a copy of the mini LaTeX document used for compilation. This should include some head definitions, and the main content is nothing but your equation. Shown below: LaTeX used for compilation

  3. Copy this mini LaTeX document to a new file, save and compile it, just like a normal LaTeX document.

  4. MiKTeX should report some missing packages, you can let MiKTeX install them automatically or install them yourself.
    MiKTeX prompt

  5. Go back to your main document, now it should work. For example: Working math preview

  • 2
    Welcome to TeX.SX! What has this to do with the Sublime issue mentioned here? – TeXnician Jan 2 '18 at 13:44
  • Well, this is exactly what people see in sublime text (for the mentioned problem ), and what you can do to solve it. The "Check System" button as mentioned by r-stein currently performs an incomplete check, so not all missing packages can be identified. The only way is to compile the mini latex sample once. – Hao Liu Jan 3 '18 at 21:12
  • This worked for me! @HaoLiu is right, "Check System" is not sufficient. Furthermore, this solution automatically finds the missing packages and prompts to install them - no manual package installation required. Thanks. – MD004 Jan 3 '18 at 23:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.