Mac latex vscode配置外部PDF阅读器并配置对应跳转

1.下载并安装Skim

下载链接:https://sourceforge.net/projects/skim-app/

2.配置skim

touch displayfile.txt
open displayfile.txt

在文本中写入:

#!/bin/bash

# displayfile (Skim)
#
# Usage: displayfile [-r] [-g] PDFFILE
#
# Modified from "displayline" to only revert the file, not jump to a given line
#

if [ $# == 0 -o "$1" == "-h" -o "$1" == "-help" ]; then
  echo "Usage: displayfile [-r] [-g] PDFFILE
Options:
-r, -revert      Revert the file from disk if it was open
-g, -background  Do not bring Skim to the foreground"
  exit 0
fi

# get arguments
revert=false
activate=true
while [ "${1:0:1}" == "-" ]; do
  if [ "$1" == "-r" -o "$1" == "-revert" ]; then
    revert=true
  elif [ "$1" == "-g" -o "$1" == "-background" ]; then
    activate=false
  fi
  shift
done
file="$1"
#shopt -s extglob
#[ $# -gt 2 ] && source="$3" || source="${file%.@(pdf|dvi|xdv)}.tex"

# expand relative paths
[ "${file:0:1}" == "/" ] || file="${PWD}/${file}"

# pass file arguments as NULL-separated string to osascript
# pass through cat to get them as raw bytes to preserve non-ASCII characters
/usr/bin/osascript \
  -e "set theFile to POSIX file \"$file\"" \
  -e "set thePath to POSIX path of (theFile as alias)" \
  -e "tell application \"Skim\"" \
  -e "  if $activate then activate" \
  -e "  if $revert then" \
  -e "    try" \
  -e "      set theDocs to get documents whose path is thePath" \
  -e "      if (count of theDocs) > 0 then revert theDocs" \
  -e "    end try" \
  -e "  end if" \
  -e "  open theFile" \
  -e "end tell"

然后保存,继续在命令行输入:

chmod u+x displayfile.txt
mv displayfile.txt displayfile
mv displayfile /usr/local/bin/

3. 配置vscode setting

添加配置:

"latex-workshop.view.pdf.viewer": "external",

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

"latex-workshop.view.pdf.external.viewer.command": "displayfile",
"latex-workshop.view.pdf.external.viewer.args": [
"-r",
"%PDF%"
],

4.配置skim

点击skim,是不会有界面的:

  1. 在顶部导航栏Skim -> Preferences
  2. 点开第4个标签Sync,配置如下:
    在这里插入图片描述

跳转

写完latex文档并且编译完成后从插件这里打开pdf文件:
在这里插入图片描述
然后从PDF -> TeX文件:cmd+shift+鼠标左击

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

呆萌的代Ma

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值