3

I am trying to open my PDF document with Skim from Visual Studio Code. I would like the View LaTeX PDF file command to open in Skim my PDF document and update it automatically. Unfortunately, when I click on the View LaTeX PDF file button, it does not open Skim.

The View LaTeX PDF file command button

I am forced :

  • To open Skim myself;
  • And then to open the PDF file;

When I do this, everything works fine. The file updates correctly each time I save the LaTeX file.

I first try to open the file from the button in Visual Studio Code. It doesn't work, then I open skim to open the pdf file and it works

So I would like to be able to open Skim with the PDF document directly from Visual Studio Code. As I try to do at the beginning of the video.

Note that I have already read these questions SyncTex with Skim pdf viewer?, PDF Preview in Visual Studio Code and the documentation.

My configuration is the following:

  • macOS (12.1)
  • Visual Studio Code (1.63.0)
  • LaTeX Workshop plug-in (v8.22.0).
  • Skim 1.6.7 (137)
  • pdfTeX 3.141592653-2.6-1.40.22 (TeX Live 2021) kpathsea version 6.3.3
  • Latexmk, John Collins, 29 September 2020. Version 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
}
Daniel Schreurs
  • 186
  • 1
  • 10
  • Yes, I really don't understand. The path to `displayline` is correct. I just checked. What's annoying is that I opened an issue [here](https://github.com/James-Yu/LaTeX-Workshop/issues/3021) and they closed it saying "We do not officially support external viewers." It's tidy.Do you have any idea of anything else I can check? @KJ – Daniel Schreurs Dec 25 '21 at 00:08
  • Thank @KJ. It would be quite incredible if the order had an impact. But then I simplified my settings [to this](https://pastebin.com/n5BzJcvg) and it still doesn't work. – Daniel Schreurs Dec 25 '21 at 00:22

1 Answers1

1

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. The sdef parser can't handle synonyms. 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

<!-- <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.

Daniel Schreurs
  • 186
  • 1
  • 10