The relevant variables in the script are
VIEWER. Their values in the script shown before were to use
latexmkto build a PDF and PDFView to display it. However, other settings are possible. For example, setting builds a PDF using
pdflatexand shows it in Preview. These settings would be quite suitable for a "vanilla" installation, assuming no extras are installed beyond TeX.
A more flexible approach is to use those vanilla settings as defaults, and allow them to be overridden, giving Now, if we run the script from the shell, we can set environment variables to change how the script does its work.
Within SEE, the environment variables will be provided by the AppleScript that runs the script. The change is relatively simple: we extend the string that calls our shell script to also set the environment variables. Since a number of minor changes to the AppleScript have accumulated, I'll show the whole thing:
The basic strategy is still to construct a string that calls our shell script and feed it into
do shell script. The string is changed in two ways. First, since the shell script now takes a line number as a second argument, I get the current line from SEE and pass it in. Second, and of more immediate interest, I set the environment variables and prepend those to the earlier
buildScript. I've simplified the construction by defining
SEE_LATEX_VIEWERenvironment variables, customizing the behavior of the shell script. In the above AppleScript, I have set the environment so that
latexmkand Skim are used to build and view a PDF.