Latex-workshop: PDF is not automatically updated upon finishing building project

Created on 28 Mar 2017  路  17Comments  路  Source: James-Yu/LaTeX-Workshop

I found that after updating to version 1.1.0 there's no more "Preview" button. I highly rely on this functionality because every time I save my tex file, the PDF in the preview tab will be updated immediately. Really convenient! Without this, unfortunately, I have to right click the file "View PDF" to open the PDF every time I want to see the new change because the viewing tab will not show the updated content automatically.

Will the preview functionality be added back? Thanks!

(I am running Visual Studio Code Version 1.10.2 on macOS 10.12.3)

question

Most helpful comment

Update:
I think I found the problem. The error was caused by the conflict from another PDF viewing extension (i.e., vscode-pdf). After removing that extension, the automatic update is now working flawlessly. Sorry for bringing up the issue without first checking that direction.... and thanks so much for the prompt help!

All 17 comments

That is actually weird. The tab should automatically get refreshed upon finishing building project. There is no need to click on anything. Is that the issue?

Yes that's the issue. The PDF in the viewing tab is not updated automatically anymore. Maybe I should change the title of this issue?

I would recommend do so. In addition, can you please provide your log in the output panel?

This is the log I am seeing after I click save (sorry I have to anonymize the name of the paper lol)

[22:06:20] Found root file from active editor: /Users/bnsblue/workspace/clarity-box/clarity-writing/papers/<name>/micro2017/literature-review/main.tex
[22:06:22] BUILD command invoked.
[22:06:22] Found root file from active editor: /Users/bnsblue/workspace/clarity-box/clarity-writing/papers/<name>/micro2017/literature-review/main.tex
[22:06:22] Building root file: /Users/bnsblue/workspace/clarity-box/clarity-writing/papers/<name>/micro2017/literature-review/main.tex
[22:06:22] Build root file /Users/bnsblue/workspace/clarity-box/clarity-writing/papers/<name>/micro2017/literature-review/main.tex
[22:06:22] Created toolchain latexmk -synctex=1 -interaction=nonstopmode -file-line-error -pdf "/Users/bnsblue/workspace/clarity-box/clarity-writing/papers/<name>/micro2017/literature-review/main.tex"
[22:06:22] Toolchain step 1: latexmk -synctex=1 -interaction=nonstopmode -file-line-error -pdf "/Users/bnsblue/workspace/clarity-box/clarity-writing/papers/<name>/micro2017/literature-review/main.tex"
[22:06:22] Toolchain of length 1 finished.
[22:06:22] Successfully built /Users/bnsblue/workspace/clarity-box/clarity-writing/papers/<name>/micro2017/literature-review/main.tex

For the above log, did you open any PDF viewer? Mine would be like

[10:09:46] Build root file \my\project\main.tex
[10:09:46] Created toolchain latexmk -synctex=1 -interaction=nonstopmode -file-line-error -pdf "\my\project\main.tex"
[10:09:46] Toolchain step 1: latexmk -synctex=1 -interaction=nonstopmode -file-line-error -pdf "\my\project\main.tex"
[10:09:46] Toolchain of length 1 finished.
[10:09:46] Successfully built \my\project\main.tex
[10:09:46] Refresh PDF viewer for \my\project\main.pdf
[10:09:47] Preview PDF file: \my\project\main.pdf

If the tab is not refreshed, can you please peek into Help->Toggle Developer Tools and see if there is any error?

The PDF viewing tab in VSCode is opened when I built the project. The file is not opened in any other PDF viewer. I re-open the viewing tab and re-build the project, but the last two lines still do not show up.

In Developer Tools/console, I am seeing the following error. It does not seem very related I guess?

[Extension Host] Error: certificate has expired
    at Error (native)
    at TLSSocket.<anonymous> (_tls_wrap.js:1060:38)
    at emitNone (events.js:86:13)
    at TLSSocket.emit (events.js:185:7)
    at TLSSocket._finishInit (_tls_wrap.js:584:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:416:38)

It seems unrelated. I think the problem should be related to https://github.com/James-Yu/LaTeX-Workshop/blob/master/src/viewer.ts#L20 . Can you please provide the log for openning a pdf tab, e.g.

[10:22:00] TAB command invoked.
[10:22:00] Found root file from active editor: \my\project\main.tex
[10:22:00] Open PDF tab for \my\project\main.pdf
[10:22:00] Found root file from active editor: \my\project\main.tex
[10:22:00] Preview PDF file: \my\project\main.pdf

That may be helpful to trace the bug.

I am seeing no output in the OUTPUT tab when I open the pdf tab.

The way I open the PDF tab was: go to Explorer on the side bar -> right click on the PDF in the workspace file tree -> View PDF.

Is the above the right way to open the PDF?

Hmm that's the problem. It seems you have installed other pdf viewer extensions. The way you view pdf is using theirs so this extension knows nothing about it. For LaTeX Workshop, we provide two ways to open ours: 1) right click the .tex file and View PDF file in xxx, and 2) cmd+shift+p then type view pdf file in. Please check if this works for you, including viewing pdf as well as auto refresh.

OK, I just figured the same thing out. Now I right click in my tex file and see the option "View PDF file in new tab".
After clicking that, I can see

[22:31:28] Found root file from active editor: /Users/bnsblue/workspace/clarity-box/clarity-writing/papers/<paper>/micro2017/literature-review/main.tex
[22:31:30] TAB command invoked.
[22:31:30] Found root file from active editor: /Users/bnsblue/workspace/clarity-box/clarity-writing/papers/<paper>/micro2017/literature-review/main.tex
[22:31:30] Open PDF tab for /Users/bnsblue/workspace/clarity-box/clarity-writing/papers/<paper>/micro2017/literature-review/main.pdf

But PDF.js fails to open the file, showing the following error message:

PDF.js v1.5.188 (build: 0e2d50f)
Message: file origin does not match viewer's

Can you please try again with web browser option and track down the url in the address bar? It's so weird...

Update:
I think I found the problem. The error was caused by the conflict from another PDF viewing extension (i.e., vscode-pdf). After removing that extension, the automatic update is now working flawlessly. Sorry for bringing up the issue without first checking that direction.... and thanks so much for the prompt help!

Thank you as well for providing this issue! Actually I will add a FAQ for this problem in case others may step into the same trap.

Thanks! BTW, this is such a great extension! Please keep up the awesome work!

also meet the same problem, find the solution finally, thanks a lot

I've got the same issue but i don't have another pdf viewer. Strange.

Please open a new issue filling out all the information required in the issue template.

Was this page helpful?
0 / 5 - 0 ratings