4

Today, I tried to make inverse_Search from sumatraPDF to Vscode(latex workshop). In the column "Set inverse search command-line" in sumatraPDF,I write "E:\VSCODE\Microsoft VS Code\Code.exe" -g "%f":%l", which is my path of Code.exe. However, when I click in a pdf file, there is a tip that shows: "EPERM:operation not permitted,mkdir'c:\Users\16323\.vscode\extensions.Please make sure the following directories writable: C:\Users\16323\AppData\Roaming\Code C:\Users\16323\.vscode\extensions'". I think the cause of the problem is that I changed the Installation location of the vscode plugin to "E:\VSCODE" and create a symbolic link to the directory to save the space of disk C. What can I do to resolve this problem?

1 Answer 1

2

For the records, here is a solution to this question, extracted from this forum discussion.

IMPORTANT: For the reverse search to work, and only for the first time, one must close all SumatraPDF instances and use the Ctrl+Alt+J hotkey from the LaTeX file to open the corresponding PDF in SumatraPDF. Without this step, double-clicking on the PDF in SumatraPDF opens the cli.js file instead of the LaTeX file.

This gives proper forward and inverse search with SumatraPDF and VSCode, using the fantastic LaTeX Workshop extension:

  • Use Ctrl+Alt+J to jump from the LaTeX editor in VSCode to the PDF location in SumatraPDF.

  • Use mouse double click to jump from the PDF in SumatraPDF to the LaTeX line in VSCode.

In settings.json of VSCode, include the following lines

"latex-workshop.view.pdf.viewer": "external",
"latex-workshop.view.pdf.external.viewer.command": "C:/Program Files/SumatraPDF/SumatraPDF.exe",
"latex-workshop.view.pdf.external.synctex.command": "C:/Program Files/SumatraPDF/SumatraPDF.exe",
"latex-workshop.view.pdf.external.synctex.args": ["-forward-search", "%TEX%", "%LINE%", "-reuse-instance","%PDF%"],

Then, in SumatraPDF one sets the inverse-search command as follows, while replacing PathToCode with the real path to VSCode:

"C:\PathToCode\Microsoft VS Code\Code.exe" "C:\PathToCode\Microsoft VS Code\resources\app\out\cli.js" --ms-enable-electron-run-as-node -r -g "%f:%l"

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .