Wed, Jul 18 2007 at 7:30AM PDT • Contributed by: tpavlic

Recently, someone asked me how they could use Skim as his TeXShop previewer. That is, he really liked Skim and wanted to be able to use its PDFSync support to bring up a line of TeX source inside TeXShop. So I put together a shell script that mainly consists of the following:

fileName="$1"

lineNumber="$2"

gotoString=""

 

[ "${fileName:0:1}" == "/" ] || fileName="${PWD}/${fileName}"

[ "${lineNumber}" == "" ] || gotoString="goto line ${lineNumber}"

 

exec osascript \

-e "set texFile to POSIX file "${fileName}"" \

-e "tell application "TeXShop"" \

-e "activate" \

-e "open texFile" \

-e "tell front document" \

-e "refreshtext" \

-e "${gotoString}" \

-e "end tell" \

-e "end tell"

If you save this script as texshop in your PATH (e.g, as /usr/local/bin/texshop) and chmod it 0755 (e.g., chmod 0755 /usr/local/bin/texshop), then you can go into the Skim LaTeX preferences and set the Preset to Custom, with the Command set to texshop, and the Arguments set to "%file" %line. I hope some other people find this useful

用户登录