欢迎光临
我们一直在努力

Mac上使用Sublime Text+Skim编译LaTeX

在Mac上配置LaTex + Sublime Text2,整个过程如下:

  • 下载安装 MacTex.pkg。文件大小2.4G,安装需要4G的空间。
  • 下载安装 Sublime Text 2
  • Sublime Text 2 中安装 Package Control。在 Sublime Text 2 中,使用 “Control+`” 打开 Console,输入如下代码

import urllib2,os,hashlib; h = 'eb2297e1a458f27d836c04bb0cbaf282' + 'd0e7a3098092775ccb37ca9d6b2e4b7d'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')

如果是在 Sublime Text 3 中安装 Package Control,则用

import urllib.request,os,hashlib; h = 'eb2297e1a458f27d836c04bb0cbaf282' + 'd0e7a3098092775ccb37ca9d6b2e4b7d'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
  • 安装LaTex Tools。在 Sublime Text 2 中输入 Command+Shift+P 打开 command pallet,输入 Install PackageEnter
  • 安装配置Skim。下载Skim,安装。打开Skim,按 Command+, 打开设置窗口,对 同步 做如下配置(如图):
  • 配置好后,如果编译的时候提示
LaTeXTools: you need to migrate your preferences. See the README file for instructions.

则打开 Pallte(Command+Shift+P) 输入如下命令即可。

LaTeXTools: Reconfigure and migrate settings
  • 现在,我们已经做完了所有的步骤,可以打开Sublime Textommand+N新建文件并在里面编写LaTeX代码了,完成编辑之后,Command+S保存文件,Command+B编译并运行,这时就可以在Skim里面看到PDF预览了。另外注意此处逆向搜索是通过 Cmd+shift+click 完成的。
  • 升级 El Capitan‎ 后可能出现无法编译的问题,这是因为 /usr/texbin 文件夹被系统保护了。

MacTeX installs a symbolic link /usr/texbin pointing to the TeX binaries. GUI applications use this link to find the binaries. But in El Capitan, the location /usr is reserved for Apple, and even users with root access are not allowed to write to that location.

The solution to this problem is to relocate the link to /Library/TeX/texbin, and reconfigure GUI applications to look in this location. Consequently, MacTeX-2015 and BasicTeX-2015 write two links, /usr/texbin and /Library/TeX/texbin, when installing on systems earlier than El Capitan, and write /Library/TeX/texbin when installing on El Capitan. These installations configure shell applications to look for TeX in both locations.

Consequently, if you install MacTeX-2015 or BasicTeX-2015 after upgrading to El Capitan, or if you have already installed one of them before upgrading, then TeX will work as usual when accessed from the Terminal, and will work from GUI applications once these are reconfigured.

The latest version of TeXShop automatically reconfigures itself. This version was released a month after MacTeX-2015 was released, so TeXShop users should use the menu item “Check for Updates” before using it on El Capitan.

对于 Sublime+LaTeX tools, 解决这个问题只需要打开 Pallte(Command+Shift+P) 输入如下命令即可。

LaTeXTools: Reconfigure and migrate settings
转载请注明:满忘近 » Mac上使用Sublime Text+Skim编译LaTeX

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址