无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

VS Code+Sumatra PDF正反向搜索

2023-06-29 00:36 作者:青爺威武  | 我要投稿

簡介

重新裝機后,在配置VS Code和LaTeX的環(huán)境后,問題卡在了正反向搜索這邊,簡單記錄下。


綜合參考以下鏈接:

  • [VS Code + Tex Live + SumatraPDF配置LaTeX反向搜索(持續(xù)更新)](https://blog.csdn.net/yihuajack/article/details/123877375)

  • [解決SumatraPDF 在VS Code上反向搜索失效](https://www.jianshu.com/p/2b21384e0638)

  • [Sumatra PDF反向搜索的問題記錄 (texlive+vscode)](https://zhuanlan.zhihu.com/p/447892378)

正向

在安裝LaTeX Workshop后,打開VS Code的settings.json


首先是配置基本的命令參數(shù),常用的就是這三種

? ?"latex-workshop.latex.tools": [
? ? ? ?{
? ? ? ? ? ?"name": "xelatex",
? ? ? ? ? ?"command": "xelatex",
? ? ? ? ? ?"args": [
? ? ? ? ? ? ? ?"-synctex=1",
? ? ? ? ? ? ? ?"-interaction=nonstopmode",
? ? ? ? ? ? ? ?"-file-line-error",
? ? ? ? ? ? ? ?"-pdf",
? ? ? ? ? ? ? ?"%DOCFILE%"
? ? ? ? ? ?]
? ? ? ?},
? ? ? ?{
? ? ? ? ? ?"name": "pdflatex",
? ? ? ? ? ?"command": "pdflatex",
? ? ? ? ? ?"args": [
? ? ? ? ? ? ? ?"-synctex=1",
? ? ? ? ? ? ? ?"-interaction=nonstopmode",
? ? ? ? ? ? ? ?"-file-line-error",
? ? ? ? ? ? ? ?"%DOCFILE%"
? ? ? ? ? ?]
? ? ? ?},
? ? ? ?{
? ? ? ? ? ?"name": "bibtex",
? ? ? ? ? ?"command": "bibtex",
? ? ? ? ? ?"args": [
? ? ? ? ? ? ? ?"%DOCFILE%"
? ? ? ? ? ?]
? ? ? ?}
? ?],


然后是由上述基本命令引出的編譯鏈

? ?"latex-workshop.latex.recipes": [
? ? ? ?{
? ? ? ? ? ?"name": "xelatex",
? ? ? ? ? ?"tools": [
? ? ? ? ? ? ? ?"xelatex"
? ? ? ? ? ?]
? ? ? ?},
? ? ? ?{
? ? ? ? ? ?"name": "pdflatex",
? ? ? ? ? ?"tools": [
? ? ? ? ? ? ? ?"pdflatex"
? ? ? ? ? ?]
? ? ? ?},
? ? ? ?{
? ? ? ? ? ?"name": "xe->bib->xe->xe",
? ? ? ? ? ?"tools": [
? ? ? ? ? ? ? ?"xelatex",
? ? ? ? ? ? ? ?"bibtex",
? ? ? ? ? ? ? ?"xelatex",
? ? ? ? ? ? ? ?"xelatex"
? ? ? ? ? ?]
? ? ? ?},
? ? ? ?{
? ? ? ? ? ?"name": "pdf->bib->pdf->pdf",
? ? ? ? ? ?"tools": [
? ? ? ? ? ? ? ?"pdflatex",
? ? ? ? ? ? ? ?"bibtex",
? ? ? ? ? ? ? ?"pdflatex",
? ? ? ? ? ? ? ?"pdflatex"
? ? ? ? ? ?]
? ? ? ?}
? ?],


接著配置外部PDF閱讀器

? ?"latex-workshop.view.pdf.viewer": "external",
? ?"latex-workshop.view.pdf.ref.viewer": "external",
? ?"latex-workshop.view.pdf.external.viewer.command": "C:/Users/AppData/Local/SumatraPDF/SumatraPDF.exe",


接下來才是正向搜索:

  1. 首先保證.gz不會被刪除

  2. 同樣地,在settings.json寫入配置

"latex-workshop.view.pdf.external.synctex.command": "C:/Users/AppData/Local/SumatraPDF/SumatraPDF.exe",
? ?"latex-workshop.view.pdf.external.synctex.args": [
? ? ? ?"-forward-search",
? ? ? ?"%TEX%",
? ? ? ?"%LINE%",
? ? ? ?"-reuse-instance",
? ? ? ?"-inverse-search",
? ? ? ?"%PDF%"
? ?],

有人在latex-workshop.view.pdf.external.synctex.args加入反向搜索的命令,但其實不會起作用,反向搜索只要在Sumatra PDF中設(shè)置就可以了

  1. 設(shè)置正向搜索等快捷鍵,打開keybindings.json

{
? ? ? ?"key": "alt+s",
? ? ? ?"command": "latex-workshop.synctex",
? ? ? ?"when": "editorTextFocus && !isMac"
? ?},
? ?{
? ? ? ?"key": "alt+b",
? ? ? ?"command": "latex-workshop.build",
? ? ? ?"when": "editorTextFocus && !isMac"
? ?},
? ?{
? ? ? ?"key": "alt+t",
? ? ? ?"command": "latex-workshop.kill",
? ? ? ?"when": "editorTextFocus && !isMac"
? ?},
? ?{
? ? ? ?"key": "alt+e",
? ? ? ?"command": "latex-workshop.recipes"
? ?},

這樣就可以通過alt+s來正向搜索

反向

在Sumatra PDF的設(shè)置->選項中,設(shè)置反向搜索命令:

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

  • 第一個參數(shù)是VS Code的所在位置

  • 第二個參數(shù)的cli.js和第三個參數(shù)的--ms-enable-electron-run-as-node是避免VS Code使用子進(jìn)程打開Sumatra PDF后,Sumatra PDF無法反向搜索的情況


VS Code+Sumatra PDF正反向搜索的評論 (共 條)

分享到微博請遵守國家法律
曲阳县| 西峡县| 定州市| 合肥市| 武汉市| 浮梁县| 观塘区| 中西区| 河西区| 通江县| 成都市| 兴文县| 凤城市| 确山县| 兰溪市| 河南省| 东明县| 峡江县| 长寿区| 景东| 射阳县| 华蓥市| 柯坪县| 乐都县| 陈巴尔虎旗| 安徽省| 沂源县| 洮南市| 环江| 天门市| 广西| 项城市| 兴义市| 太湖县| 嘉善县| 河津市| 忻州市| 柏乡县| 连平县| 荥经县| 泰宁县|