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

Sync and View with external Viewer #24

Open
MightyMirko opened this issue Jan 10, 2024 · 3 comments
Open

Sync and View with external Viewer #24

MightyMirko opened this issue Jan 10, 2024 · 3 comments

Comments

@MightyMirko
Copy link

Hello,

is there a way to sync and view with, lets say, sumatraPDF in windows?

@sanjib-sen
Copy link
Owner

sanjib-sen commented Jan 10, 2024

@MightyMirko Do you want to use the local VSCode instead of GitHub codespace? In that case sure.

Add this to .vscode/settings.json file:

"latex-workshop.view.pdf.viewer": "external",
"latex-workshop.view.pdf.external.synctex.command": "C:/Users/<UserName>/AppData/Local/SumatraPDF/SumatraPDF.exe",
  "latex-workshop.view.pdf.external.synctex.args": [
    "-forward-search",
    "%TEX%",
    "%LINE%",
    "-reuse-instance",
    "-inverse-search",
    "\"C:\\Users\\<Username>\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" \"C:\\Users\\<U>\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\out\\cli.js\" --ms-enable-electron-run-as-node -r -g \"%f:%l\"",
    "%PDF%"
  ],

In settings.txt of SumatraPDF, set

InverseSearchCmdLine = "C:\Users\<Username>\AppData\Local\Programs\Microsoft VS Code\Code.exe" "C:\Users\<Username>\AppData\Local\Programs\Microsoft VS Code\resources\app\out\cli.js" --ms-enable-electron-run-as-node -r -g "%f:%l"
EnableTeXEnhancements = true

Reference:
https://github.com/James-Yu/LaTeX-Workshop/wiki/View#sumatrapdf

@MightyMirko
Copy link
Author

I am using it in a docker on wsl2 environment.

Instead of path to c i have to assign path to mnt/c?

@MightyMirko
Copy link
Author

{
    "name": "latex-docker-workspace",
    "image": "your-docker-image:latest",
    "remoteUser": "root",
    "hostRequirements": {
        "storage": "32gb"
    },
    "remoteEnv": {
        "user": "your-username",
        "sumatraPath": "/mnt/c/Program Files/SumatraPDF/SumatraPDF.exe",
        "vscodePath": "/mnt/c/Users/${user}/AppData/Local/Programs/Microsoft VS Code/Code.exe",
        "vscodeCliPath": "/mnt/c/Users/${user}/AppData/Local/Programs/Microsoft VS Code/resources/app/out/cli.js"
    },
    "features": {},
    "customizations": {
        "vscode": {
            "settings": {
                "latex-workshop.view.pdf.viewer": "external",
                "latex-workshop.view.pdf.external.synctex.command": "${sumatraPath}",
                "latex-workshop.view.pdf.external.synctex.args": [
                    "-forward-search",
                    "%TEX%",
                    "%LINE%",
                    "-reuse-instance",
                    "-inverse-search",
                    "\"${vscodePath}\" \"${vscodeCliPath}\" --ms-enable-electron-run-as-node -r -g \"%f:%l\"",
                    "%PDF%"
                ]
            },
            "extensions": [
                "James-Yu.latex-workshop"
                // Add other extensions if needed
            ]
        }
    }
}

This works in one direction for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants