Windows10でVScodeのlatex-workshopのexternal pdfをsmatraPDFにしてsynctexを使ったforward searchとinverse searchの設定をする.いくつか参照して試行錯誤したのでメモ.
VScode側の設定
settings.josonに以下を追加.
"latex-workshop.view.pdf.viewer": "external",
"latex-workshop.view.pdf.external.viewer.command":
"C:\\Users\\[username]\\AppData\\Local\\SumatraPDF\\SumatraPDF.exe",
"latex-workshop.view.pdf.external.viewer.args": [
"-reuse-instance",
"%PDF%"
],
"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\\[username]\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app\\out\\cli.js\" -r -g \"%f:%l\"", //put same code on Smatra pdf option
"%PDF%",
],
smatraPDF側の設定
詳細設定に以下を追加
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" -r -g "%f:%l"
#使い方
Ctrl+Alt+J
でVScode上のソースからsmatraPDFに飛ぶ.
PDFダブルクリックでsmatraPDFからVScode上のソースに飛ぶ.
#参考
James-Yu/LaTeX-Workshop View
https://github.com/James-Yu/LaTeX-Workshop/wiki/View,
TeX Wiki : SumatraPDF との synctex 連携
https://texwiki.texjp.org/?Visual%20Studio%20Code%2FLaTeX#g142ea7e
LaTeX WorkshopでSumatraPDFを使う
https://qiita.com/hakos/items/7178c9bdd0fbbf8f78db