[OS X TeX] Skim SKAutoReloadFileUpdate
Adam R. Maxwell
amaxwell at mac.com
Thu Dec 18 11:09:34 EST 2008
On Dec 18, 2008, at 7:42 AM, Joseph C. Slater PE, PhD wrote:
> On Dec 18, 2008, at 10:30 AM, Adam R. Maxwell wrote:
>> On Dec 18, 2008, at 6:20 AM, Adam M. Goldstein wrote:
>>> OK, another question---how is what TeXShop does any different, and
>>> is there a difference between using it as an "external viewer" or
>>> as the source editor and viewer?
>> Yes, there is a difference.
>>> If the TS user pushes "typeset," does this provide the PDF viewer
>>> with information about when the typesetting process begins and so
>>> the viewer can wait to reload until it's ready?
>> TS runs an external process to typeset your document, so it knows
>> when that call is finished, and when it should open/reload the PDF.
>> TextMate uses a similar approach, since it launches the TeX process
>> (es) on your behalf. If that succeeds, it tells Skim (using Python):
>> os.system("/usr/bin/osascript -e " + """'tell application "Skim" to
>> revert (documents whose path is %s)' """%pdfPath)
>> ...and does something similar for other viewers. This is trivial
>> with a shell script or makefile approach.
> How does it know the process succeeded, though? (20 more questions
> and I'll have enough knowledge to solve the issue in emacs!).
Depends on how clever you want to be :). The trivial way is to test
the exit value of the process and see if it's zero (success) or
anything else (failure). Practically, you probably wouldn't like
that, since TeX returns nonzero pretty frequently, even though it
created a usable PDF. You could count the number of error: lines it
spits out, but that might get hairy.
The easiest solution is probably a compromise: wait until all of your
tex/bibtex/index processes are done, then try to reload the file.
That eliminates the race condition, so you're left with potentially
trying to open a garbage file.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2415 bytes
Desc: not available
More information about the MacOSX-TeX