James-Yu / LaTeX-Workshop

Boost LaTeX typesetting efficiency with preview, compile, autocomplete, colorize, and more.
MIT License
10.72k stars 534 forks source link

PDF viewer in new tab no refreshing per save #404

Closed bradenkohkz closed 6 years ago

bradenkohkz commented 6 years ago

Issue

I really like what you have done to incorporate visual studio code with latex but I just have the small issue of that my pdf in another tab isn't updating. Also, is there a possibility for the pdf viewer to be other than adobe reader? I have taken a liking to summatra reader and wish to use that as the pdf reader instead. Thanks so much.

Suggested actions

  1. If you don't have already, maybe link the compile code to regenerate the pdf viewer without the user having to manually regenerate
LaTeX Workshop Output [11:25:30] Initializing LaTeX Workshop. [11:25:30] Creating LaTeX Workshop http and websocket server. [11:25:30] LaTeX Workshop initialized. [11:25:30] Found root file from active editor: c:\Users\brade\OneDrive\Work\Work expense_\week 9\expenses.tex [11:25:30] Root file changed from: undefined. Find all dependencies. [11:25:30] Instatiating new file watcher for c:\Users\brade\OneDrive\Work\Work expense_\week 9\expenses.tex [11:25:30] Parsing c:\Users\brade\OneDrive\Work\Work expense_\week 9\expenses.tex [11:25:30] Server created on 127.0.0.1:63969 [11:25:30] Default environments loaded [11:25:30] LaTeX Workshop version: 3.13.0 [11:25:30] Default commands loaded [11:25:30] Default unimathsymbols loaded [11:25:30] TAB command invoked. [11:25:30] Found root file from active editor: c:\Users\brade\OneDrive\Work\Work expense_\week 9\expenses.tex [11:25:30] Root file remains unchanged from: c:\Users\brade\OneDrive\Work\Work expense_\week 9\expenses.tex. [11:25:30] No PDF viewer connected for c:\Users\brade\OneDrive\Work\Work expense_\week 9\expenses.pdf [11:25:30] Serving PDF file at http://127.0.0.1:63969/viewer.html?file=/pdf:c%3A%5CUsers%5Cbrade%5COneDrive%5CWork%5CWork%20expense_%5Cweek%209%5Cexpenses.pdf [11:25:30] Open PDF tab for c:\Users\brade\OneDrive\Work\Work expense_\week 9\expenses.pdf [11:25:31] Found root file from active editor: c:\Users\brade\OneDrive\Work\Work expense_\week 9\expenses.tex [11:25:31] Root file remains unchanged from: c:\Users\brade\OneDrive\Work\Work expense_\week 9\expenses.tex. [11:25:32] Preview PDF file: c:\Users\brade\OneDrive\Work\Work expense_\week 9\expenses.pdf [11:25:34] Root file remains unchanged from: c:\Users\brade\OneDrive\Work\Work expense_\week 9\expenses.tex. [11:25:47] Found root file from active editor: c:\Users\brade\OneDrive\Work\Work expense_\week 9\expenses.tex [11:25:47] Root file remains unchanged from: c:\Users\brade\OneDrive\Work\Work expense_\week 9\expenses.tex. [11:25:48] Preview PDF file: c:\Users\brade\OneDrive\Work\Work expense_\week 9\expenses.pdf [11:25:50] Root file remains unchanged from: c:\Users\brade\OneDrive\Work\Work expense_\week 9\expenses.tex.
James-Yu commented 6 years ago

The viewer should refresh on save. You may want to double check the extension config. If it is still not working, please provide a minimal working example.

AllanWang commented 6 years ago

You didn't have a pdf file for another tex file opened did you?

bradenkohkz commented 6 years ago

@James-Yu thanks for getting back to me, could you let me know what you need to see in specific? sorry I quite understand what you meant by a minimal working example.

@AllanWang Nope I didn't have another tex file opened.

The general case is I find that the pdf doesn't refresh on save and I have to manually compile and manually generate the "view pdf in new tab" every time I change something

James-Yu commented 6 years ago

there should be a config on "auto-refresh after build". Set that to true (which should already be set by default) and make sure that the compilation did not throw errors.

MWE: https://en.wikipedia.org/wiki/Minimal_Working_Example

wopian commented 6 years ago

The PDF no longer refreshes with changes after changing my toolchain from XeLaTeX (via MiKTeX or TeXLive) to Tectonic. No errors are thrown and closing and re-opening the PDF panel shows the updated PDF.

Tectonic emits synctex data as <inputFileName>.synctex.gz containing <inputFileName>.synctex which may be related to this

settings.json Note: Shell script is called instead of Tectonic directly as I need to generate source code syntax highlighting beforehand. Same issue happens if Tectonic is called directly on *nix ```json { "latex-workshop.latex.toolchain": [ { "command": "bash", "args": [ "-i", "../bin/report" ] } ], "latex-workshop.latex.outputDir": "out", "latex-workshop.latex.clean.enabled": false, "latex-workshop.latex.autoBuild.cleanAndRetry.enabled": false, "latex-workshop.latex.autoBuild.onSave.enabled": true, "latex-workshop.latex.autoBuild.onTexChange.enabled": false } ```
simplified file structure ``` root │ ├───.vscode │ settings.json # Calls bin/report │ ├───bin │ pyg # Calls bin/pyg_styles │ pyg_styles │ report # Calls bin/pyg and bin/tex │ tex # Calls Tectonic │ ├───report │ │ index.tex # Root file | | │ ├───out │ │ index.pdf │ │ index.synctex.gz | | index.synctex │ │ │ └───pyg # Generated by bin/pyg from src │ └───src │ api.tex | └───src api.cr ```
LaTeX Compile output ``` generated: styles pygmented: src/api.cr pygmented: src/errors.cr pygmented: src/hibari/extend.cr pygmented: src/hibari/headers.cr pygmented: src/hibari/table_names.cr pygmented: src/hibari/version.cr pygmented: src/json_api/construct_data.cr pygmented: src/json_api/construct_field.cr pygmented: src/json_api/construct_resource.cr pygmented: src/json_api/content_type.cr pygmented: src/json_api/error.cr pygmented: src/json_api/extend.cr pygmented: src/json_api/response.cr pygmented: src/kitsu/base_url.cr pygmented: src/kitsu/extend.cr pygmented: src/kitsu/get.cr pygmented: src/kitsu/version.cr pygmented: spec/api_spec.cr pygmented: spec/json_api/content_type_spec.cr pygmented: spec/spec_helper.cr note: this is a BETA release; ask questions and report bugs at https://tectonic.newton.cx/ Running TeX ... (index.tex LaTeX2e <2016/03/31> Babel <3.9r> and hyphenation patterns for 83 language(s) loaded. (report.cls Document Class: report 2014/09/29 v1.4h Standard LaTeX document class (size10.clo)) (babel.sty (english.ldf (babel.def (xebabel.def)))) (geometry.sty (keyval.sty) (ifpdf.sty) (ifvtex.sty) (ifxetex.sty)) (subfiles.sty (verbatim.sty)) (enumitem.sty) (datetime.sty (etoolbox.sty) (fmtcount.sty (ifthen.sty) (xkeyval.sty (xkeyval (xkvutils))) (fcprefix.sty (fcnumparser.sty) ) (amsgen.sty) (fc-english.def)) (datetime-defaults.sty) (dt-british.def)) (graphicx.sty (graphics.sty (trig.sty) (graphics.cfg) (xetex.def (infwarerr.sty ) (ltxcmds.sty)))) (tocloft.sty) (titlesec.sty) (fontenc.sty (t1enc.def)) (noto.sty (ifluatex.sty) (textcomp.sty (ts1enc.def)) (fontspec.sty (expl3.sty (expl3-code.tex) (l3xdvipdfmx.def)) (xparse.sty) (fontspec-xetex.sty (fontenc.sty (eu1enc.def) (eu1lmr.fd)) (xunicode.sty (t3enc.def (eu1lmss.fd))) (fontspec.cfg)))) (sourcecodepro.sty) (fancyvrb.sty Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix <2008/02/07> (tvz)) (xcolor.sty (color.cfg)) (fnbreak.sty) (bookmark.sty (pdfescape.sty (pdftexcmds.sty)) (hyperref.sty (hobsub-hyperref.sty (hobsub-generic.sty)) (auxhook.sty) (kvoptions.sty) (pd1enc.def) (hyperref.cfg) (url.sty)) Package hyperref Message: Driver (autodetected): hxetex. (hxetex.def (puenc.def) (stringenc.sty) (rerunfilecheck.sty)) (bkm-dvipdfm.def) ) No file index.aux. (ts1cmr.fd) (t3cmr.fd) *geometry* driver: auto-detecting *geometry* detected driver: xetex (nameref.sty (gettitlestring.sty)) Package hyperref Warning: Rerun to get /PageLabels entry. (se-ascii-print.def) [1] [1] [2] (research/1-technology) (research/2-web-services) (research/3-rest) (research/4-examples) [3] [4] (implementation/1-proposal Overfull \hbox (17.70383pt too wide) in paragraph at lines 13--14 [][][][][] [] [][]$[][]\EU1/NotoSerif(0)/m/n/10 . It exposes a RESTful API ([][ ]$[][][][][] [] [] [] [][][][][] [] [][][][] [] [][][][][][] [] [][]$[][]) usin g the JSON:API[][][][][] ) (implementation/2-approach) (implementation/3-management) (implementation/4-development (pyg/src/api [5] [6])) [7] (index.aux) ) (see the transcript file for additional information) Output written on index.xdv (8 pages, 48584 bytes). Transcript written on index.log. Rerunning TeX because "index.aux" changed ... Running xdvipdfmx ... (index.tex LaTeX2e <2016/03/31> Babel <3.9r> and hyphenation patterns for 83 language(s) loaded. (report.cls Document Class: report 2014/09/29 v1.4h Standard LaTeX document class (size10.clo)) (babel.sty (english.ldf (babel.def (xebabel.def)))) (geometry.sty (keyval.sty) (ifpdf.sty) (ifvtex.sty) (ifxetex.sty)) (subfiles.sty (verbatim.sty)) (enumitem.sty) (datetime.sty (etoolbox.sty) (fmtcount.sty (ifthen.sty) (xkeyval.sty (xkeyval (xkvutils))) (fcprefix.sty (fcnumparser.sty) ) (amsgen.sty) (fc-english.def)) (datetime-defaults.sty) (dt-british.def)) (graphicx.sty (graphics.sty (trig.sty) (graphics.cfg) (xetex.def (infwarerr.sty ) (ltxcmds.sty)))) (tocloft.sty) (titlesec.sty) (fontenc.sty (t1enc.def)) (noto.sty (ifluatex.sty) (textcomp.sty (ts1enc.def)) (fontspec.sty (expl3.sty (expl3-code.tex) (l3xdvipdfmx.def)) (xparse.sty) (fontspec-xetex.sty (fontenc.sty (eu1enc.def) (eu1lmr.fd)) (xunicode.sty (t3enc.def (eu1lmss.fd))) (fontspec.cfg)))) (sourcecodepro.sty) (fancyvrb.sty Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix <2008/02/07> (tvz)) (xcolor.sty (color.cfg)) (fnbreak.sty) (bookmark.sty (pdfescape.sty (pdftexcmds.sty)) (hyperref.sty (hobsub-hyperref.sty (hobsub-generic.sty)) (auxhook.sty) (kvoptions.sty) (pd1enc.def) (hyperref.cfg) (url.sty)) Package hyperref Message: Driver (autodetected): hxetex. (hxetex.def (puenc.def) (stringenc.sty) (rerunfilecheck.sty)) (bkm-dvipdfm.def) ) (index.aux) (ts1cmr.fd) (t3cmr.fd) *geometry* driver: auto-detecting *geometry* detected driver: xetex (nameref.sty (gettitlestring.sty)) (se-ascii-print.def) [1] (index.toc) [1] [2] (research/1-technology) (research/2-web-services) (research/3-rest) (research/4-examples) [3] [4] (implementation/1-proposal Overfull \hbox (17.70383pt too wide) in paragraph at lines 13--14 [][][][][] [] [][]$[][]\EU1/NotoSerif(0)/m/n/10 . It exposes a RESTful API ([][ ]$[][][][][] [] [] [] [][][][][] [] [][][][] [] [][][][][][] [] [][]$[][]) usin g the JSON:API[][][][][] ) (implementation/2-approach) (implementation/3-management) (implementation/4-development (pyg/src/api [5] [6] [7])) [8] (index.aux) ) (see the transcript file for additional information) Output written on index.xdv (9 pages, 67536 bytes). Transcript written on index.log. [1][2][3][4][5][6][7][8][9] Writing ../bin/../report/out/index.synctex.gz (15560 bytes) Writing ../bin/../report/out/index.pdf (72754 bytes) ```
wopian commented 6 years ago

My issue above seems to only occur on Windows were it enters WSL. On *nix the same command refreshes the PDF without issue

zphhhhh commented 6 years ago

windows +1, my problem is latex toolchain terminated with error.

James-Yu commented 6 years ago

WSL is known for not properly exiting process due to its monitor on pipin. It cannot be solved on the extension side. As to terminated error, you cannot expect the extension to refresh PDF when it is not updated.

wopian commented 6 years ago

It properly exits with 0 according to PowerShell and the error (now a constant notification popup on 5.x) happens as soon as the bash process starts.

James-Yu commented 6 years ago

See #460