简体   繁体   English

从 Visual Studio Code (macOS) 在 Skim 中直接打开 PDF 文件

[英]Open directly PDF file in Skim from Visual Studio Code (macOS)

I am trying to open my PDF document with Skim from Visual Studio Code.我正在尝试使用 Visual Studio Code 中的 Skim 打开我的 PDF 文档。 I would like the View LaTeX PDF file command to open in Skim my PDF document and update it automatically.我想在浏览我的 PDF 文档中打开View LaTeX PDF file命令并自动更新它。 Unfortunately, when I click on the View LaTeX PDF file button, it does not open Skim.不幸的是,当我单击查看 LaTeX PDF 文件按钮时,它没有打开 Skim。

查看 LaTeX PDF 文件命令按钮

I am forced:我被迫:

  • To open Skim myself;自己打开 Skim;
  • And then to open the PDF file;然后打开PDF文件;

When I do this, everything works fine.当我这样做时,一切正常。 The file updates correctly each time I save the LaTeX file.每次我保存 LaTeX 文件时,该文件都会正确更新。

我首先尝试从 Visual Studio Code 中的按钮打开文件。它不起作用,然后我打开skim打开pdf文件,它可以工作

So I would like to be able to open Skim with the PDF document directly from Visual Studio Code.所以我希望能够直接从 Visual Studio Code 中打开带有 PDF 文档的 Skim。 As I try to do at the beginning of the video.正如我在视频开头尝试做的那样。

Note that I have already read these questions SyncTex with Skim pdf viewer?请注意,我已经使用 Skim pdf 查看器阅读了这些问题 SyncTex? , PDF Preview in Visual Studio Code and the documentation . , PDF 预览 Visual Studio 代码文档

My configuration is the following:我的配置如下:

  • macOS (12.1) macOS (12.1)
  • Visual Studio Code (1.63.0) Visual Studio 代码 (1.63.0)
  • LaTeX Workshop plug-in (v8.22.0). LaTeX 车间插件(v8.22.0)。
  • Skim 1.6.7 (137)脱脂1.6.7 (137)
  • pdfTeX 3.141592653-2.6-1.40.22 (TeX Live 2021) kpathsea version 6.3.3 pdfTeX 3.141592653-2.6-1.40.22 (TeX Live 2021) kpathsea 版本 6.3.3
  • Latexmk, John Collins, 29 September 2020. Version 4.70b Latexmk,John Collins,2020 年 9 月 29 日。版本 4.70b
  • settings.json
{
    "workbench.colorTheme": "Cobalt2",
    "editor.formatOnSave": true,
    "[javascript]": {
        "editor.formatOnSave": true
    },
    "[javascriptreact]": {
        "editor.formatOnSave": true
    },
    "prettier.disableLanguages": [
        "javascript",
        "javascriptreact"
    ],
    "workbench.startupEditor": "newUntitledFile",
    "latex-workshop.intellisense.package.enabled": true,
    "latex-workshop.intellisense.unimathsymbols.enabled": true,
    "latex-workshop.latex.recipes": [
        {
            "name": "latexmk 🔃",
            "tools": [
                "latexmk"
            ]
        },
        {
            "name": "pdflatex ➞ bibtex ➞ pdflatex`×2",
            "tools": [
                "pdflatex",
                "bibtex",
                "pdflatex",
                "pdflatex"
            ]
        }
    ],
    "latex-workshop.latex.tools": [
        {
            "name": "latexmk",
            "command": "latexmk",
            "args": [
                "-shell-escape",
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-pdf",
                "-outdir=%OUTDIR%",
                "%DOC%"
            ],
            "env": {}
        },
        {
            "name": "pdflatex",
            "command": "pdflatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOC%"
            ],
            "env": {}
        },
        {
            "name": "bibtex",
            "command": "bibtex",
            "args": [
                "%DOCFILE%"
            ],
            "env": {}
        },
        {
            "name": "latexmk",
            "command": "latexmk",
            "args": [
                "-xelatex",
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOC%"
            ]
        }
    ],
    "latex-workshop.latex.clean.subfolder.enabled": true,
    "git.autofetch": true,
    "terminal.integrated.fontFamily": "Inconsolata for Powerline",
    "latex-workshop.view.pdf.viewer": "external",
    "editor.minimap.enabled": false,
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "files.exclude": {
        "**/.classpath": true,
        "**/.project": true,
        "**/.settings": true,
        "**/.factorypath": true
    },
    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true
    },
    "workbench.iconTheme": "material-icon-theme",
    "prolog.executablePath": "/Applications/SWI-Prolog.app/Contents/MacOS/swipl",
    "python.languageServer": "Microsoft",
    "editor.wordWrap": "on",
    "latex-workshop.view.pdf.zoom": "page-fit",
    "latex-workshop.view.pdf.external.viewer.args": [
        "0",
        "%PDF%"
    ],
    "latex-workshop.view.pdf.external.viewer.command": "/Applications/Skim.app/Contents/SharedSupport/displayline",
    "latex-workshop.view.pdf.external.synctex.command": "/Applications/Skim.app/Contents/SharedSupport/displayline",
    "latex-workshop.view.pdf.external.synctex.args": [
        "-r",
        "-b",
        "%LINE%",
        "%PDF%",
        "%TEX%"
    ],
    "latex-workshop.latex.autoBuild.cleanAndRetry.enabled": true,
    "latex-workshop.latex.autoClean.run": "onBuilt",
    "latex-workshop.latex.clean.fileTypes": [
        "*.aux",
        "*.bbl",
        "*.blg",
        "*.idx",
        "*.ind",
        "*.lof",
        "*.lot",
        "*.out",
        "*.toc",
        "*.acn",
        "*.acr",
        "*.alg",
        "*.glg",
        "*.glo",
        "*.gls",
        "*.ist",
        "*.fls",
        "*.log",
        "*.fdb_latexmk",
        "*.snm",
        "*.nav",
        "*.synctex.gz",
        "*.run.xml",
        "*.bcf",
        "__latexindent_temp.tex"
    ],
    "explorer.confirmDelete": false,
    "latex-workshop.latexindent.path": "/usr/local/texlive/2021/bin/universal-darwin/latexindent",
    "security.workspace.trust.untrustedFiles": "open",
    "editor.fontSize": 16
}

So...In fact, the problem does not come from the setting file.所以……其实问题不在于设置文件。 It is well formed and valid.它格式正确且有效。 The problem is a scripting support bug in Monterey12.1.问题是 Monterey12.1 中的脚本支持错误。 The sdef parser can't handle synonyms. sdef 解析器无法处理同义词。 This has been documented here .这已在此处记录。

A workaround while waiting for an update is to edit the file /Applications/Skim.app/Contents/Resources/Skim.sdef and comment these lines of code等待更新时的解决方法是编辑文件/Applications/Skim.app/Contents/Resources/Skim.sdef并注释这些代码行

<!-- <synonym name="selection for"/> -->

<!-- <synonym name="get preferences"/> -->

It's not the kind of solution I like, but, in the meantime, it does the job here at first.这不是我喜欢的那种解决方案,但与此同时,它首先在这里完成了工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM