[OS X TeX] macOS Monterey - broken BBEdit/Skim integration scripts
Richard Seguin
riseguin at earthlink.net
Sun Jul 31 13:49:04 EDT 2022
I just did a mostly trouble free update directly from Big Sur 11.6 to Monterey 12.5. There has only been one nasty surprise: it broke the Nathan Grigg’s BBEdit/Skim integration scripts:
https://nathangrigg.com/latex-bbpackage/
The scripts are an interdependent mix of AppleScript and Python scripts. Apparently in 12.3, Apple removed Python 2 leaving the more secure Python 3, and the removal of Python 2 broke everything. On attempting to typeset I would get the following error message:
> Error extracting directives from file (python script directives.py)
>
> sh: /Users/richardseguin/Library/Application Support/BBEdit/Packages/Latex.bbpackage/Contents/Resources/directives.py: /usr/bin/python: bad interpreter: No such file or directory
The scripts are still available on GitHub via the above address but the author declared a few years ago that he would no longer maintain them, so I don’t anticipate a fix for this problem unless someone who knows Python (I don’t) can take on the project of doing that.
I liked using the scripts because of the elegant way that they trapped TeX errors, displayed them in a custom window and would point BBEdit directly to the line where an error occurred. This is much better than the older Sneep scripts which would just dump all the (voluminous) console messages into a Terminal window on the desktop behind Skim, and I don’t look forward to going back to that.
At least the old Sneep scripts still work:
https://msneep.home.xs4all.nl/latex/
and especially the Run pdflatex.scpt and Synchronize with Skim.scpt scripts. The later script synchronizes forward from the .tex to the .pdf; synchronizing backwards from the .pdf to the .tex is built into Skim itself.)
While looking at all this last night I stumbled on this old BBEdit AppleScript I had that saves the current .tex and tells TeXShop to run pdflatex and display the resulting .pdf. It seems to work when TeXShop is in external editor mode. I don’t know where this script came from if I didn’t write this myself, and I don’t remember.
> tell application "BBEdit"
> set filename to (file of text window 1) as text
> end tell
> set unixname to POSIX path of filename
> set oldDelimiters to AppleScript's text item delimiters
> set AppleScript's text item delimiters to "/"
> -- pull the path out as a string and strip off the filename
> set pathText to unixname
> set pathList to (text items of pathText)
> set docName to last item of pathList
> set AppleScript's text item delimiters to oldDelimiters
> tell application "BBEdit"
> save text document docName
> end tell
> tell document docName of application "TeXShop"
> --activate
> latexinteractive
> end tell
>
Unfortunately I don’t think BBEdit/TeXShop synching has been established yet -- right?
Richard Séguin
More information about the MacOSX-TeX
mailing list