![VSCode 中的 Latex,外部 pdf 查看器每次刷新两次](https://linux22.com/image/462968/VSCode%20%E4%B8%AD%E7%9A%84%20Latex%EF%BC%8C%E5%A4%96%E9%83%A8%20pdf%20%E6%9F%A5%E7%9C%8B%E5%99%A8%E6%AF%8F%E6%AC%A1%E5%88%B7%E6%96%B0%E4%B8%A4%E6%AC%A1.png)
我在 vscode 中使用 MacTex 和 Latex-Workshop,并使用 Slkim 作为外部查看器。如果我启用“latex-workshop.latex.autoClean.run”:“onBuilt”,Skim 每次构建都会刷新两次。但如果我禁用 autoClean,问题就会消失。
根据我的观察,似乎 autoClean 会触发额外的更改,然后在删除辅助文件后再次触发 Slim 刷新。如何解决这个问题?
Latex 研讨会日志:
[13:03:43][Extension] onDidSaveTextDocument triggered: file://%WS1%/paper.tex
[13:03:43][Builder] Auto build started on saving file: %WS1%/paper.tex .
[13:03:43][Commander] BUILD command invoked.
[13:03:43][Commander] The document of the active editor: file://%WS1%/paper.tex
[13:03:43][Commander] The languageId of the document: latex
[13:03:43][Commander] Building root file: %WS1%/paper.tex
[13:03:43][Builder] Build root file %WS1%/paper.tex
[13:03:43][Builder] outDir: %WS1% .
[13:03:43][Builder] Preparing to run recipe: latexmk.
[13:03:43][Builder] Prepared 1 tools.
[13:03:43][Builder] Recipe step 1 The command is latexmk:["--shell-escape","-synctex=1","-interaction=nonstopmode","-file-line-error","-pdf","%WS1%/paper"].
[13:03:43][Builder] env: undefined
[13:03:43][Builder] root: %WS1%/paper.tex
[13:03:43][Builder] cwd: %WS1%
[13:03:43][Builder] LaTeX build process spawned with PID 93033.
[13:03:48][Parser][TexLog] Logged 5 messages.
[13:03:48][Builder] Finished a step in recipe with PID 93033.
[13:03:48][Builder] Successfully built %WS1%/paper.tex .
[13:03:48][Viewer] Call refreshExistingViewer: "%WS1%/paper.tex" .
[13:03:48][Viewer] Not found PDF viewers to refresh: undefined
[13:03:48][Cacher] Parsing .fls %WS1%/paper.fls .
[13:03:48][Cacher] Found .aux %WS1%/paper.tex from .fls %WS1%/paper.fls , parsing.
[13:03:48][Cacher] Parsed .aux %WS1%/paper.tex .
[13:03:48][Cacher] Parsed .fls %WS1%/paper.fls .
[13:03:48][Builder] Auto Clean invoked.
[13:03:48][Cleaner] Clean glob matched files {"globs":["*.aux","*.bbl","*.blg","*.idx","*.ind","*.lof","*.lot","*.out","*.toc","*.acn","*.acr","*.alg","*.glg","*.glo","*.gls","*.fls","*.log","*.fdb_latexmk","*.snm","*.synctex(busy)","*.synctex.gz(busy)","*.nav","*.vrb"],"outdir":"%WS1%"} .
[13:03:48][Cleaner] Ignore folder glob patterns with globstar: .
[13:03:48][Cleaner] Cleaning file %WS1%/paper.out .
[13:03:48][Cleaner] Cleaning file %WS1%/paper.log .
[13:03:48][Cleaner] Cleaning file %WS1%/paper.fls .
[13:03:48][Cleaner] Cleaning file %WS1%/paper.fdb_latexmk .
[13:03:48][Cleaner] Cleaning file %WS1%/paper.aux .
我的 VScode 设置:
// AutoSave
"files.autoSave": "afterDelay",
// Latex
"latex-workshop.latex.tools": \[
{
"name": "latexmk",
"command": "latexmk",
"args": \[
"--shell-escape", // added arg to default
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"%DOC%"
\]
},
{
"name": "pdflatex",
"command": "pdflatex",
"args": \[
"--shell-escape", // added arg to default
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"%DOC%"
\]
},
{
"name": "bibtex",
"command": "bibtex",
"args": \[
"%DOCFILE%"
\]
}
\],
"latex-workshop.latex.autoClean.run": "onBuilt",
"latex-workshop.latex.autoBuild.run": "onSave",
"latex-workshop.view.pdf.viewer": "external",
"latex-workshop.view.pdf.external.synctex.command": "/Applications/Skim.app/Contents/SharedSupport/displayline",
"latex-workshop.view.outline.commands": \[
\],