Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyncTex with Skim pdf viewer? #318

Closed
bethandtownes opened this issue Nov 19, 2017 · 10 comments · May be fixed by Aknc34/LaTeX-Workshop#2
Closed

SyncTex with Skim pdf viewer? #318

bethandtownes opened this issue Nov 19, 2017 · 10 comments · May be fixed by Aknc34/LaTeX-Workshop#2
Labels
external issue Issue with something else than LaTeX-Wokshop

Comments

@bethandtownes
Copy link

bethandtownes commented Nov 19, 2017

I would like to use Skim viewer to preview the tex document but I don't know how to configure the pdf sync command inside the Skim viewer since vscode is not in its preset config. I uploaded an screenshot to show where I am stuck.

screen shot 2017-11-19 at 10 01 25 am

@innerlee
Copy link
Contributor

The command is path to vscode binary, and argument is to tell vscode to open which file and the line no.
Ref https://sourceforge.net/p/skim-app/wiki/TeX_and_PDF_Synchronization/ how to get filename and line no, and find vscode documentation for how to specify file and line via command line.

@James-Yu
Copy link
Owner

While @innerlee provided a workaround, I would like to note that this extension does not officially support 3rd-party pdf viewers. Multiple previous issues have discussed this problem.

@ghost
Copy link

ghost commented Apr 19, 2018

Which is a pity given how slow the international compilation/view cycle has become.

@Liam0205
Copy link

Liam0205 commented Apr 23, 2018

Here is the full workaround, as a tip for aftercommings.

Firstly, make a symbol link in /usr/local/bin, since Skim only search /usr/bin and /usr/local/bin.

ln -sf /Applications/Visual\ Studio\ Code.app/Contents/MacOS/Electron /usr/local/bin/vscode

Secondly, in the configuration of the LaTeX workshop extension, we have the following settings.

    "latex-workshop.view.pdf.external.command": {
        "command": "displayfile",
        "args": [
            "-r",
            "%PDF%"
        ]
    },
    "latex-workshop.view.pdf.external.synctex": {
        "command": "/Applications/Skim.app/Contents/SharedSupport/displayline",
        "args": [
            "-r",
            "%LINE%",
            "%PDF%",
            "%TEX%"
        ]
    },
    "latex-workshop.view.pdf.viewer": "external",

Here, for displayfile, we need a script modified from displayline in $PATH.

Finally, in Skim, we give the following settings, for reverse sync.

Command: vscode
Arguments: -g "%file":%line

@ghost
Copy link

ghost commented May 8, 2018

This does not seem to update the file in Skim upon finishing compilation, or to switch to right location. That has to be manually (ctrl-alt-v), which means time wasted waiting and monitoring for the compilation to finish...

@Liam0205
Copy link

Liam0205 commented May 8, 2018

@vomout Skim can trace the chage of PDF file by it self.

@ghost
Copy link

ghost commented May 8, 2018

@Liam0205 But not jump to the correct location (where the build was triggered). This is what SublimeText LaTeXTools does: it will open the PDF after the build has finished in the location where the build was triggered.

@Liam0205
Copy link

Liam0205 commented May 8, 2018

@vomout You might need to raise a new issue. : )

@linhtto
Copy link

linhtto commented Aug 26, 2018

@Liam0205 , sorry for being slow, but where do you store your script displayfile? I suppose you have to make it executable and searchable? When you recompile, do you refresh the same instance of Skim or another instance will be opened?

Finally can you explain why we need displayline and displayfile and not /Applications/Skim.app/Contents/MacOS/skim?

Thank you!

@linhtto
Copy link

linhtto commented Aug 26, 2018

@Liam0205 , I think I answered some of my own questions but not all: It looks like if I use /Applications/Skim.app/Contents/MacOS/skim, I'll get a fresh instance each time without the "--revert" option. It also doesn't let me go to a specific line.

Now what I'm still unsure about: Why can't we use displayline for the external command "latex-workshop.view.pdf.external.command" as well? This may make it easier for others to try without having to create the displayfile script and make it executable in a searchable location. I tested and it didn't work, but I'm unsure why, if it simply calls the command with the arguments. It wouldn't be a bad thing if upon opening the external view, you get to the right line right away. I also tried with %LINE% being replaced by 1, in the case the parameter isn't available, but it also doesn't work. So right now what I do is I always use the SyncTex command and never the Viewer command (ctrl-option-V).

What I tried:

    "latex-workshop.view.pdf.external.command": {
        "command": "/Applications/Skim.app/Contents/SharedSupport/displayline",
        "args": [
            "-r 1",
            "%PDF%"
        ]
    }

Repository owner locked as resolved and limited conversation to collaborators Jan 26, 2022
@tamuratak tamuratak added the external issue Issue with something else than LaTeX-Wokshop label Jan 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
external issue Issue with something else than LaTeX-Wokshop
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants